# Signal — Ship-Status Ledger

Canonical, git-tracked record of **what shipped, what didn't, and the reason or dependency** for anything outstanding. Both Pi and Claude read and maintain this; Kisa validates. Ship-status never lives only in private memory. Update this on every ship or blocker change. Pairs with `context/current-state.md` (this = the detailed ledger; current-state = the live ACTIVE/NEXT snapshot).

**Status legend:** SHIPPED · IN PROGRESS · BLOCKED · NOT STARTED · DEFERRED · PI-SIDE · PARKED

---

## Ledger (as of 2026-06-24)

| # | Item | Owner | Status | Reason / Dependency | Next action |
|---|------|-------|--------|---------------------|-------------|
| 1 | Claude-side delegation trigger (`dispatch-trigger.sh` + settings.json `UserPromptSubmit` hook + dispatch thresholds) | Claude | **SHIPPED** (verified live) | none | done |
| 2 | Audit Finding 1 — hook stdout injection works | Claude | **SHIPPED** | verified live (marker reached the model) | done |
| 3 | Audit Finding 2 — `$1` bug → read stdin JSON | Claude | **SHIPPED** | caught + fixed during build | done |
| 4 | Audit Finding 4 — old+new dispatch rules conflict | Claude | **SHIPPED** | added clarifying line (kept judgment fallback, marker = evaluate not auto-dispatch) | done |
| 5 | Convex-Signal spike **brief** | Claude | **SHIPPED** (committed this wrap) | — | Pi designs from it |
| 6 | Convex-Signal spike **design** | Pi | **SHIPPED** | docs/convex-signal-spike-design-2026-06-24.md. 40h/3-phase plan; Module map + Repository interface + Convex schema + Auth seam (Convex default, Clerk swappable) + Phase 1 (core readiness loop) = what Claude builds first. | Claude builds Phase 1 from it |
| 7 | `signal-convex` repo creation | Claude (GitHub) + Kisa/token (Forgejo) | **PENDING** | Dependency: Pi design + Kisa approval (create once, correctly). Claude can do GitHub via `gh`; Forgejo has no API token here. | after design approved |
| 8 | Convex BAA email (plan/cost/signing) | Kisa | **IN PROGRESS** | Kisa handling | Kisa sends |
| 9 | Readiness-model build (rename coverage→readiness, rules-to-config, grouping+verdict, device override, require-plan-type, frontend nesting) | Claude | **IN PROGRESS** | Step 3 SHIPPED 2026-06-26/27 (additive, not yet wired): (a) `core/dedup.py` grouping (CSVRow→MergedShipment→CoverageLine), 30 tests, auditor-reviewed; (b) `core/readiness.py` verdict engine — required-vs-input two-axis grading that KILLS the false green (required+absent never satisfied; clear-to-ship only on positive evidence; plan unknown→"Plan Type Needed"; required-ness read from payer_rules.json not Python sets), 27 tests, auditor-reviewed (H1/H2 config-surface false greens + M2/M3/M4 fixed). Added additive `plan_type` to ShipmentRecord. **OPEN for Kisa/Pi:** provisional gap→label mapping (At Risk/Action Needed/On Track) + H3 scope boundary (visit recency = timing layer, not readiness verdict — confirm). Remaining: rules-to-addressable-config (citation IDs), patient rollup, device-keyed override+recompute+rollup, require-plan-type enforcement + remove name-guesser/default in the LIVE path, frontend nesting + "plan type needed" UX (→ Pi). | Next: hand frontend/label UX to Pi (brief staged); build patient rollup + WIRE orchestration in `api/main.py`/new pipeline module, NOT inside `coverage_calculator` (circular import). Each step auditor-reviewed. |
| 10 | NocoDB leads / CRM cleanup | Claude + Kisa | **BLOCKED** | Reason: leads table has no primary key (Signal-base data source `bdmhi02nks1pg6g` is corrupted — a fresh table there also came up PK-less; content base is healthy). SQLite can't add a PK to a populated table (Route 1 failed). Interim: capture still works (inserts via n8n `signal-cgm-lead`); the 2 test rows can't be deleted. | resolved by the data-platform decision (item 11) |
| 11 | Data-platform decision (leads + future PHI backend) | Kisa (with Claude/Pi analysis) | **OPEN** | Options analyzed: repaired-NocoDB / Supabase Postgres / Neon / AWS (already set up, BAA+RDS+S3 parked) / Convex ($25/mo incl. BAA). Leads = non-PHI (stay outside PHI boundary). Decision informed by the Convex spike. | run spike → decide |
| 12 | Research-versioning Layer-1 (`research-autopush.sh` + Stop-hook entry) | Claude | **NOT STARTED** | Dependency: Pi design exists (`docs/research-versioning-design-2026-06-24.md`). Lower priority than product. | next infra slot |
| 13 | `signal/docs/` auto-versioning (Audit Finding 5) | Claude + Pi | **NOT BUILT** | Reason: research-versioning scope excludes `signal/docs/`. **This is why design docs need manual commits.** | add `signal/docs/` to scope |
| 14 | Pi research-versioning ext `tool_call`→`tool_result` (Finding 3) | Pi | **LIKELY DONE** | Pi state reports persist gap closed (8 file writes this session); confirm it is the tool_result fix | Pi confirm |
| 15 | Mid-session commit push on clean tree (Finding 6) | Claude | **DEFERRED** | optional, low risk, adds session-close latency | revisit if loss occurs |
| 16 | Chief-of-staff sequential-dependency capability (Finding 7) | Claude | **NOT TESTED** | Dependency: a discovery test with a sequential multi-specialist brief | run the test |
| 17 | Pi injected-message behavior (Finding 8) | Pi | **NOT TESTED** | Pi-side test | Pi test |
| 18 | Skills-as-git-repo (Finding 9) | Claude/Pi | **DEFERRED** | Phase 2 per workflow-consolidation plan | phase 2 |
| 19 | Website copy + agent-file fixes | lead-content / Claude | **STAGED, not deployed** | prose rewrites routed to lead-content; BAA wording attorney-gated | deploy when ready |
| 20 | Signal AIOS product | — | **PARKED** | Activate only on demand-pull + Signal self-sustaining + delegable capacity | hold |

---

## Timeline / critical path

1. **Next session:** (a) Kisa gives the dedup decision → Claude builds the readiness model (item 9). (b) In parallel, Pi designs the Convex-Signal spike from the committed brief (item 6).
2. **After Pi's Convex design:** Kisa validates → create `signal-convex` (item 7) → Claude builds the spike.
3. **Convex spike + BAA terms (item 8)** → inform the data-platform decision (item 11) → which resolves the NocoDB leads/CRM fix (item 10).
4. **Infra cleanup (batched in slack):** research-versioning Layer-1 + `signal/docs/` scope (items 12–13, the reason docs need manual commits), then low-priority Findings 6/7/9. Findings 3/8 are Pi-side.
5. **Fixed date:** labABLE `/pilot-prep` Fri 2026-06-26 1:30 PM.

## Dependencies summary

- Readiness build ⟸ Kisa dedup decision.
- Convex spike build ⟸ Pi design ⟸ committed brief (ready) ; and ⟸ Kisa approval + repo creation.
- NocoDB/leads fix ⟸ data-platform decision ⟸ Convex spike evidence + BAA terms.
- Design-doc durability ⟸ `signal/docs/` auto-versioning (until built, commit docs manually).

## Maintenance

Update this whenever an item ships or a blocker changes. Move shipped items to a `## Shipped (archive)` section when the table grows. Both agents reason from this; Kisa validates and redirects.

## Design Verification (2026-06-24, Claude)

Pi's dedup design (item 9) and Convex-spike design (item 6) were verified line-by-line. Both are build-ready; fixes applied directly to the design docs:

- **dedup-design-2026-06-24.md**: (1) added a separate client-mapped `plan_type` field, distinct from display `payer`, so CoverageLine keys on the mapped plan type, never the payer name — the original draft reintroduced the killed plan-type-guessing bug. (2) Fixed `merge_quantities` to sum across distinct component configs; the old blanket-max dropped quantity in mixed duplicate+split groups (e.g. two [sensor] + one [transmitter] returned 3 instead of 4).
- **convex-signal-spike-design-2026-06-24.md**: `shipments.orderNumber`/`hcpcs` changed to arrays (post-dedup multi-value); §11 dedup note de-staled to LOCKED; carry-forward note to grade on the mapped `planType`.
- Noted, not a blocker: "Convex auth -> Clerk = config-only swap" is optimistic; treat as low-but-nonzero effort (Convex Auth still maturing).

## Shipped: readiness model wired live (2026-07-07, Claude, commit a3af499)

Build plan 01 executed end to end. Phase 2a coexistence: readiness verdicts ride
additively on `/api/upload` and `/api/confirm-visit`; legacy output proven
byte-identical (live diff vs pre-deploy baseline: NONE).

- New `core/worklist_readiness.py` (ReadinessIndex). Row-to-line membership
  resolves through the dedup group key `(patient_id, device_type, DOS)` — an
  adversarial review reproduced a false green in the first draft's row-keyed
  resolution; fixed and regression-locked before ship.
- Minimal plan_type CSV mapping shipped with the wiring (per umbrella plan 00;
  OQ1 recorded for Kisa's explicit confirmation). Values lowercased+trimmed
  only, never guessed; unknown values grade Plan Type Needed.
- Pre-existing bug fixed: record_lookup missed for ALL order-numbered CSVs
  (CoverageResult has no order_number), silently dropping doc_state. Fallback
  now resolves through the dedup MergedShipment (latest-non-null fields,
  collected order numbers).
- Verification (measured, live): 132 tests green; Pi E2E 33/33; adversarial
  3-lens review + refutation (7 confirmed findings, all fixed); independent
  code-auditor SHIP. Live: no-plan_type upload = 3/3 "Plan Type Needed",
  stats reconcile; engineered false-green row reads legacy "Clear to Ship" +
  readiness "Action Needed" in the same record; confirm-visit flips verdict to
  Clear to Ship and normalizes "Medicare" -> "medicare".
- Frontend intentionally renders nothing new yet (P6, gated on Kisa's mockup
  approval).

## Shipped: readiness-model completion P2-P5 (2026-07-07, Claude, commits d24340c / bd92126 / a53728e / f28b5bf)

All four backend items shipped one at a time, each with an independent
code-auditor SHIP verdict and measured live verification:

- P2 citation IDs: every doc item cites its rule (R001-R004 plan-scoped,
  R100-R102 universal per LCD L33822); registry-drift test guards the config.
  Live: deployed verdict cites R004/R003/R100.
- P3 patient rollup: nested patients payload (worst gradeable line; Plan Type
  Needed caps at Action Needed; non-gradeable displayed, never counted);
  patient_stats count patients, not rows. Live-verified with a two-device
  patient.
- P4 device-keyed overrides: doc_status migration applied to production
  (device_type in the unique key, legacy '' rows honored); overrides now FEED
  the verdict, device-scoped; recompute contract returns {lines, rollup}
  through the same engine. Live: G7 override flipped only G7's line — the
  leak is dead, measured against real Supabase state.
- P5 plan-type enforcement: full alias + value canonicalization; zero greens
  reachable without a client-mapped plan type (live-measured); once-per-batch
  deprecation fence; all 66 fixture CSVs authored with plan_type (drift
  corpus uses variant headers/values; 66/66 map). _normalize_payer and the
  default config entry remain (Phase 2c stays Kisa-gated).

Final state: 169 unit/API tests green, Pi E2E 33/33, live drives recorded
above. P6 (frontend nesting) BLOCKED on Kisa's mockup approval:
docs/mockups/p6-worklist-mockup-2026-07-07.png (decisions A-D annotated).

## Shipped: P6 patient-nested worklist (2026-07-07, Claude, commit 6181de7)

The readiness-model build is COMPLETE end to end. The worklist now renders
one row per patient (rollup verdict), expanding into device lines with doc
checklists and rule citations; green is earned only from the verdict. All
five Kisa decisions honored (nesting, purple family, legend, per-line export,
no-sixth-label data-gap filter). Not-processed strip + download; PTN CTA;
device-scoped cycling returns the re-rolled patient via the P4 echo; Confirm
Visit fans out. Legacy table at ?legacy=1 (stopgap intentionally retained
there). Backend: /api/export lines[] (live-verified). Audit: SHIP; MEDIUM
line-identity merge fix + 2 LOWs applied pre-ship. New bundle confirmed
serving (marker strings measured). REMAINING: Kisa's signed-in click-through
(6 probes listed in the audit); backlog: CSV formula-injection sanitization
pass (pre-existing, both export paths).
