> ## Documentation Index
> Fetch the complete documentation index at: https://docs.super-intelligent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Health Clinic Layer 1

> Foundation health and final trust score readiness for an entity: the readiness board and the Daily Core scan.

## Surface

Two components render Health Clinic Layer 1:

* `HealthClinicLiveReadinessBoard` (`src/components/health-clinic/LiveReadinessBoard.tsx`) — read-only synthesis of Health Clinic, score-family, and provider-context signals.
* `HealthClinicDailyCoreScanPanel` (`src/components/health-clinic/DailyCoreScanPanel.tsx`) — quota-governed Daily Core scan with Final V1 materialization receipt and reload-proof visibility.

Orchestration is in `src/lib/health-clinic/orchestration.ts` (`runHealthClinicDiagnosis`).

## Readiness board

### Row fields consumed

* `state` is one of `READY_FOR_HUMAN_REVIEW`, `BLOCKED_HEALTH`, `CONFLICTING_SOURCE_STATE`, `READ_MODEL_UNAVAILABLE` (list may extend).
* `next_step_class` — `READ_ONLY_REVIEW` means no follow-up lane; any other value is counted as a follow-up.

### Header counters

Computed from the loaded rows:

* `rows.length` → "readiness rows loaded".
* `rows.filter(r => r.state === 'READY_FOR_HUMAN_REVIEW').length` → "ready/review".
* `rows.filter(r => r.next_step_class !== 'READ_ONLY_REVIEW').length` → "follow-up lanes".
* `rows.filter(r => r.state === 'BLOCKED_HEALTH' || r.state === 'CONFLICTING_SOURCE_STATE' || r.state === 'READ_MODEL_UNAVAILABLE').length` → "blocked/conflict".

### Collapse behavior

`expanded` is a client-side `useState(false)`. When collapsed:

* Renders a tenant-safe summary block with `data-live-readiness-collapsed="tenant-safe-summary"`.
* Per-row cards and board-safe warnings are not rendered.

When expanded:

* Renders per-row `<article>` cards from `data.rows`.
* Renders `data.warnings[]` when present.

The toggle button carries `data-live-readiness-toggle="technical-details"` and `aria-expanded={expanded}`. Toggling is display-only; it does not fetch, mutate, or trigger any provider execution.

## Daily Core scan

### Diagnosis response contract

Extended in PR #451:

```ts theme={null}
interface DailyCoreScanResponse {
  success?: boolean
  status?: string
  diagnosis?: {
    entity_ai_verdict_snapshot?: {
      stored?: boolean
      id?: string | null
      error?: string | null
    } | null
  } | null
  daily_scan?: { /* ... reservation, quota_date, quota_time_zone ... */ }
}
```

`HealthClinicDiagnosisResult.entity_ai_verdict_snapshot` mirrors this on the orchestration result and is always present — either the record from `scanResult.json.entity_ai_verdict_snapshot` (when `isRecord`) or `null` for seed-only responses.

### Final V1 materialization receipt

`materializationReceipt = dailyState?.diagnosis?.entity_ai_verdict_snapshot`. Rendered only when non-null, with:

* Status line: `snapshot stored` when `stored === true`, else `snapshot not stored`, appended with ` - {compactId(id)}` when `id` is set.
* Error line: rendered in amber when `error` is set.
* DOM attribute: `data-daily-core-final-v1-materialization="receipt"`.

An unstored snapshot is not an entity failure; the receipt is informational. A stored snapshot does not by itself activate final V1 — activation is a separate control not implemented at this surface.

### Reload-proof proof scan resolution

Introduced in PR #453. The panel derives `proofScan` before rendering the linked-result block:

```ts theme={null}
const proofScan = linkedScan || (sameDayStoredScanAvailable ? latestStoredScan : null)
const resultScanId = proofScan?.id || reservationScanId
const persistedSnapshot = storedVerdictSnapshotFromScan(proofScan)
const showLinkedResult =
  (status === 'completed' && !!(linkedScan || resultScanId)) || !!proofScan
```

Consequences:

* After a page reload with no in-memory `linkedScan`, the linked-result section still renders when a same-day stored scan exists.
* `Scanned` uses `proofScan.scanned_at`.
* Result counts render as `{pass_count} pass / {warning_count} warning / {criticalWarningCountLabel(critical_count)} / {skip_count} skipped`, always drawn from `proofScan`.
* `persistedSnapshot` is derived from `proofScan` so the persisted verdict view survives reload.

### Orchestration wiring

In `runHealthClinicDiagnosis`:

* Seed-only branch returns `entity_ai_verdict_snapshot: null`.
* Scan branch sets `entity_ai_verdict_snapshot: isRecord(scanResult.json.entity_ai_verdict_snapshot) ? scanResult.json.entity_ai_verdict_snapshot : null`.

## Controls and traps

* Expanding the readiness board runs no fetch or mutation; only local `useState` toggles.
* The Daily Core scan is quota-bounded through `daily_scan.reservation`; `reservation.health_clinic_scan_id` is only used as a fallback for `resultScanId` when no `proofScan` exists.
* Do not treat `entity_ai_verdict_snapshot.stored === true` as final-V1 activation — activation is not implemented at this surface.
* Do not surface `Provider L2` / composite-preview / provenance internals in this page's human door; they belong to Layer 2 surfaces.

## Proof chain

* PR #442 — collapse readiness details by default; add header counters and tenant-safe summary.
* PR #451 — expose Final V1 materialization receipt on `DailyCoreScanResponse.diagnosis.entity_ai_verdict_snapshot` and mirror on `HealthClinicDiagnosisResult`.
* PR #453 — resolve `proofScan` from `linkedScan` or latest same-day stored scan so the linked-result block is reload-proof.

## Related

* Overview: [/index](/index)
* Parent: [/lifecycle/health-clinic](/lifecycle/health-clinic)
* Upstream: [/lifecycle/core-truth-inked](/lifecycle/core-truth-inked), [/lifecycle/gbp-mri](/lifecycle/gbp-mri), [/lifecycle/admin-verify](/lifecycle/admin-verify), [/lifecycle/evidence-locker](/lifecycle/evidence-locker), [/lifecycle/identity-anchors](/lifecycle/identity-anchors)

***

**Status:** In-flight · **Layer:** 1 (foundation health and final trust score readiness)
