Commit graph

40 commits

Author SHA1 Message Date
Kisa
242e54e01a state-sync + ledger: P1 readiness wiring shipped and live-verified [CC]
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 05:03:34 -04:00
Kisa
a3af499c93 feat: wire readiness model into live pipeline (build plan 01, Phase 2a)
Readiness verdicts now ride additively on /api/upload and /api/confirm-visit:
- core/worklist_readiness.py: ReadinessIndex — row-to-line membership resolved
  through the dedup group key (patient_id, device_type, DOS), never re-derived
  from a row's own plan_type (kills a reviewer-reproduced false green)
- RecordOut gains plan_type / readiness_status / readiness_items (additive,
  default None); UploadResponse gains readiness_stats (reconciles with rows)
- Minimal plan_type CSV mapping (client-supplied, lowercased+trimmed, never
  guessed) per the umbrella reactivation plan; full enforcement lands in P5
- Fixes pre-existing record_lookup miss for order-numbered CSVs; fallback
  fields now come from the dedup MergedShipment (latest-non-null, collected
  order numbers) so doc_state and the verdict grade from the same values
- confirm-visit normalizes plan_type identically to the CSV path

Verification: 132 tests green (108 baseline + 24 wiring/regression);
adversarial 3-lens review + refutation pass (7 findings confirmed, all fixed,
regression-locked); independent code-auditor verdict SHIP; Pi E2E 33/33.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 04:52:32 -04:00
Kisa
77395a1112 docs: reactivation plan + FDA CDS exemption memo draft
- docs/build-plans/00-signal-reactivation-plan.md: umbrella re-activation plan
  (two-currency logic, critical path, Week1/Week2/backlog sequence with
  owners+gates, labABLE-vs-Gaboro call, compliance guardrail, 2026-07-06 findings).
- docs/compliance/fda-cds-exemption-memo-DRAFT.md: attorney-review draft (Fable).
  Primary position = Signal is administrative/billing software outside the FD&C
  201(h) device definition; CDS-exemption kept as the secondary argument. Citations
  grounded against current FDA sources (CDS guidance updated 2026-01-29).
  Flags: internal 2026-06-04 whitepaper overstates the CDS claim; attorney of
  record unconfirmed (Bittinger/Nixon vs Clyde Mathes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 12:12:06 -04:00
Kisa
da6c242b07 docs: readiness-model build-plan starter templates (wiring + completion)
Captured on Fable before access ends. Two grounded, execute-from starter
templates under docs/build-plans/:
- 01-readiness-model-wiring.md: wire dedup+readiness into the live pipeline
  via a post-process orchestrator (avoids the dedup->coverage_calculator
  circular import); flags that the normalizer does not yet ingest plan_type,
  so every live verdict reads 'Plan Type Needed' until a plan_type column is mapped.
- 02-readiness-model-completion.md: P2-P6 (citation IDs, patient rollup,
  device override, plan-type enforcement, frontend nesting).

Readiness+dedup engine verified 57 tests green (2026-07-06); corrects the
stale '73 tests' figure in current-state.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 05:08:46 -04:00
Kisa
86d8a634da docs: Pi startup-protocol fix — companion brief for Signal-pinned sessions [Pi] 2026-06-28 16:20:48 -04:00
Kisa
5b1748ed25 design: readiness model Phase 2 build brief for Claude (rules-config, rollup, override, plan-type enforcement) [Pi] 2026-06-27 08:38:39 -04:00
Kisa
206bf718bd Add readiness verdict engine (kills the false green)
Grade one coverage line's five documentation items on two separated axes the
old code conflated: required_state (from plan_type + payer_rules.json) and
input_state (SUPPLIED | ABSENT). A line is "Clear to Ship" only when EVERY
required item is satisfied by positive evidence — a required item with no data
is NOT_EVALUATED and blocks green, never granted by absence of contradiction.

- plan_type never guessed: None / unmapped / casing-variant -> "Plan Type Needed",
  structurally cannot be green; PECOS/PA sit NOT_EVALUATED while universal items
  (SWO/visit/diagnosis per LCD L33822) still grade.
- Required-ness reads from payer_rules.json (single source of truth), removing
  the latent Python-set-vs-JSON divergence.
- Config-surface fail-safe: a known plan missing/partial in config cannot grade
  green (NOT_EVALUATED), and the green gate checks every item.
- Diagnosis accepts a real ICD-10 code as on-file; only explicit negatives gap.

Additive only: not wired into the live pipeline. 27 tests green (full suite 73),
code-auditor reviewed (H1/H2/M1/M2/M3/M4/L1 fixed).

PROVISIONAL, flagged for Pi/Kisa: gap->label mapping (At Risk/Action Needed/
On Track) and the visit-recency scope boundary (timing layer, not readiness).

Spec: docs/readiness-model-brief-2026-06-23.md section 4

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 00:33:42 -04:00
Kisa
c07d054ca5 Add readiness-model dedup + coverage-line grouping foundation
Group normalized shipment rows into deduped shipments and gradeable
coverage lines (patient -> device -> shipment), the structural fix for the
row-keyed worklist bug (six months of orders no longer = six worklist lines).

- Locked dedup key (patient_id, device_type, date_of_service); order_number
  is display-only. Monthly resupplies stay separate, not duplicates.
- Client-mapped plan_type carried through, never guessed from payer name;
  conflicting plan types in a group route to "plan type needed".
- Quantity merge: sum across distinct component configs, max within a config
  (duplicate guard) with a warning breadcrumb on disagreement.
- CGM gradeable this phase; pumps preserved/displayed but not graded.

Additive only: not yet wired into the live pipeline, grading unchanged.
30 tests green (full suite 46), code-auditor reviewed (M1/M2/L1/L2/L3 fixed).

Design: docs/dedup-design-2026-06-24.md, docs/readiness-model-brief-2026-06-23.md

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 00:22:01 -04:00
Kisa
6f3ce16960 verify+fix: Pi's dedup + Convex-spike designs build-ready [CC]
- dedup: separate client-mapped plan_type (not payer) so CoverageLine never guesses plan type; fix merge_quantities to sum across distinct component configs (blanket-max dropped qty in mixed dup+split groups)
- convex-spike: shipments orderNumber/hcpcs -> arrays (post-dedup multi-value); de-stale dedup note to LOCKED
- ledger: Design Verification section added

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 15:53:10 -04:00
Kisa
0e5c2f13b7 design+state: dedup decision locked (patient_id+device_type+DOS). Readiness model UNBLOCKED [Pi] 2026-06-24 15:23:05 -04:00
Kisa
04d204e965 design+state: Convex-Signal spike full design (40h/3-phase plan, 6 modular seams, Repository interface, auth seam decision) [Pi] 2026-06-24 13:47:57 -04:00
Kisa
bd0009ea10 docs+state: Convex-Signal spike brief + ship-status ledger + session wrap [CC]
- docs/convex-signal-instance-brief-2026-06-24.md: modular, backend-swappable Convex spike brief (separate repo signal-convex)
- docs/ship-status-ledger.md: committed shipped/not-shipped/why ledger, shared with Pi
- context/current-state.md: session wrap (delegation trigger shipped, NocoDB diagnosed, Convex eval)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 13:38:46 -04:00
Kisa
d9e7fb71ca review+fix: end-to-end audit found 9 gaps, fixed 3 in scope, filed rest for Claude [Pi] 2026-06-24 10:22:05 -04:00
Kisa
f5a6a5bfcc docs+state: Pi Option B research versioning design delivered, content dir created [Pi] 2026-06-24 10:13:33 -04:00
Kisa
19fa702eeb docs: Pi delegation router design — trigger, thresholds, Pi mirror, 2 skills [Pi] 2026-06-24 01:06:48 -04:00
Kisa
bbc01d307f docs(aios): recover Pi's Signal AIOS + Automated Blog plans from session log
Pi made zero file-writes; these plans lived only in its jsonl. Recovered to a
durable doc and logged the audit. Shield persisted (file + TriLane research).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 00:22:41 -04:00
Kisa
9d34b22dab docs(delegation): brief Pi on the delegation router + hybrid skill model
Router brain = existing dispatch skill (no new skill). Trigger = cheap keyword
UserPromptSubmit hook. chief-of-staff conditional, not permanent. Hybrid 3-tier
skill model locked. Pi designs the trigger + thresholds + pi-subagents mirror +
design-review/persist skill.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 00:16:22 -04:00
Kisa
00cff7a5f8 feat(workflow): build consolidation foundation from Pi's recovered design
- current-state.md -> v:1 schema (repairs Pi's destructive edit, restores decisions log)
- recover Pi's workflow-consolidation design from session log into a durable doc
- add drift-to-skill governance table
- demote CLAUDE.md embedded state block to a pointer (stops harness re-injecting stale state)
- new shared state-sync skill lives at ~/.claude/skills/state-sync (separate path)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 23:30:56 -04:00
Kisa
4bfe5d25cf chore(state): clean-start current-state.md, ignore context recovery artifacts, add workflow-consolidation brief for Pi
Commit the previously-uncommitted current-state.md (left dirty by an interrupted
wrap-up), gitignore the heavy context recovery files (screenshot/jsonl/snapshot),
and add the consolidated Pi design brief for the shared-state + workflow cleanup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 21:22:31 -04:00
Kisa
e3fb7b7594 add readiness-model design brief for pi and update shared context
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 19:53:57 -04:00
Kisa
20e6556afc docs(shield): v2 — HIPAA+GDPR global scope, user's pricing model (free print, $49 PMS integration), Signal Tier 3 bundle, Shield MVP first 2026-06-22 10:14:57 -04:00
Kisa
41388ed0e7 docs(shield): update target customer to small healthcare ops + AI SaaS, add Consent Engine delivery options (GitHub template, hosted, hybrid) 2026-06-22 09:55:52 -04:00
Kisa
9b3e32f3bd feat(shield): add product architecture design draft — positioning, features, pricing, tech stack 2026-06-22 09:04:44 -04:00
Kisa
9a274f6fee feat(build-spec): Phase 4 — support bot foundation spec + trust fixes applied 2026-06-22 08:13:36 -04:00
Kisa
25746de7b3 fix(compliance): trust fixes — audit retention 7yr→6yr (45 CFR §164.530(j)), false BAA claim corrected to live posture 2026-06-22 08:06:01 -04:00
Kisa
1183d83f1a feat(build-spec): Phase 2 — session-brain auto-write + insight extraction spec 2026-06-21 23:53:14 -04:00
Kisa
70c1f28230 add pilot end-to-end validation + production readiness docs
Live validation of the deployed Signal stack: engine verified (5k-patient
upload, PHI-clean, export, confirm-visit), live app outage diagnosed and
restored (Clerk dev-instance revert), 3 product blockers + master-key
exposure + compliance gaps documented for Pi to design remediation.
Includes Pi's current-state.md design updates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 12:46:36 -04:00
Kisa
7053e4e061 docs: add build spec, support manual, and shared current-state context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 17:38:31 -04:00
Kisa
ca65185ba2 feat(signal-ui): Clerk redirect fix, stoplight colors, Clear to Ship checkmark, tab counts
- ClerkProvider now sets signInUrl/afterSignInUrl to signal-ui-xi.vercel.app so
  invitation emails and sign-in links land on the webapp not Clerk's hosted page
- Stoplight colors on status badges (red/amber/teal/green)
- Clear to Ship shows checkmark instead of dot
- Filter tabs include count + percentage
- EmptyState V2: "Drop your file here" heading
- Legend bar removed from worklist header (redundant with tabs)
- Pilot readiness at 13/13 (100%) as of 2026-06-16
- Signal Intelligence spec added to docs

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-16 15:01:39 -04:00
Kisa
1d95bb2ab2 feat: doc status persistence, empty state, status legend, and Clear to Ship guard
- Doc status click-to-update: SWO and PA cycle through states and persist to Supabase
- Status legend added to worklist header
- Empty state with file-open prompt for first-time users
- Device normalizer expanded for broader CGM variant coverage
- Warm cream text applied globally for secondary/muted UI elements
- Drag-drop CSV import support
- CORS root cause fixed via Railway ALLOWED_ORIGINS env var
- DOCS_REQUIRED badge: RESUPPLY_READY patients with open cascade items now show
  amber Docs Required instead of green Clear to Ship, preventing premature shipment

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-14 05:09:06 -04:00
Kisa
cc2a5f4b47 coverage calculator and UI refinements; add demo MVP gap analysis and quality review docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 13:04:23 -04:00
Kisa
34e6c08c14 Mark Paste MCP Phase 1 complete
Content Outbox + Call Prep pinboards live. linkedin-post, linkedin-carousel,
and pilot-prep skills updated to push to Paste automatically. All 3 skills
passed spec compliance and code quality review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 10:31:57 -04:00
Kisa
aba7237de8 Add Paste MCP Phase 1 implementation plan
6 tasks: create 2 pinboards, update 3 skills (linkedin-post, linkedin-carousel,
pilot-prep), end-to-end verification. Skills dir is not a git repo — file edits only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 07:16:33 -04:00
Kisa
ee2d6b0308 Add pharmacy vs DME adherence stats and regulatory handicap framing to Brand Vault spec
DME wins on patient outcomes despite heavier Part B documentation burden vs pharmacy Part D.
Signal removes the handicap — the pitch framing belongs in the Brand Vault.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 07:12:00 -04:00
Kisa
43dcab2f68 Add Paste MCP ambient layer design spec
Four-phase architecture: Content Outbox + Call Prep (Phase 1, immediate),
Brand Vault (Phase 2), Session Handoff (Phase 3), Agent Trays (Phase 4).
Phase 1 starts now; Phase 3 gated on auth stability across 5+ sessions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 22:06:56 -04:00
Kisa
bcb1a10fe6 feat: demo MVP — 90/60/45 priority tiers, doc state machine, confirm visit workflow
- New CoverageFlag enum: SUPPLY_LAPSED, VISIT_REQUIRED, TRANSFER_PENDING,
  RENEWAL_CRITICAL/ELEVATED/SOON, RESUPPLY_READY, ACTIVE
- Doc state machine: 5-item payer-dependent status per patient (SWO, Visit,
  PECOS, PA, Diagnosis) with cascade chain
- Confirm Visit endpoint: staff enters prescriber-confirmed date, persisted in
  Supabase confirmed_visits table, survives all future CSV imports
- Supabase migration: 001_add_confirmed_visits.sql (run manually in SQL editor)
- Frontend: Badge rebuilt for 8 flags, DocStatusBar 5-dot display,
  ConfirmVisitModal, expandable WorklistTable rows
- Legal: LOI, NDA, BAA drafts at pitch/legal/ for Nixon Law Group review
- Compliance docs: privacy policy, incident response, data handling
- CSV generator: market_data.json + PA/NJ generator scripts
- 15/15 tests passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 11:29:33 -04:00
Kisa
ec2cd24bd7 Add Phase 3: Clerk auth with org-scoped data isolation
Backend: JWT middleware validates Clerk tokens on every request,
extracts org ID from claims, enforces org-scoped queries via
Supabase RLS. Frontend: ClerkProvider wraps the app, auth gate
blocks unauthenticated access, UserButton in header, token
injected into every API call. Supabase production wired to trust
Clerk JWTs via Third-Party Auth integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 12:12:17 -04:00
Kisa
cf171a3f87 add Phase 1 security hardening, mapping confidence, audit logging, pilot docs
- lock CORS to Vercel domain via ALLOWED_ORIGINS env var (removes allow_origins=*)
- add X-API-Key header auth on /api/upload and /api/export
- normalizer: add mapping confidence (high/inferred), new aliases for Acct #,
  Member ID, External Patient Ref, DME Description, dispensedate; 63/63 CSV files pass
- coverage_calculator: add RULE_VERSION = "v0.1", rule_version on every CoverageResult
- main.py: audit logging wired on upload + export, rule_version + mapping_summary in response
- generate_samples.py: 25 CSV files now use 25 different real-world header formats
- add generate_10k.py for 10,000-patient synthetic dataset
- add tests/smoke_test.py (passes against local backend)
- add docs/pilot-guide-v1.md for Robert Robinson pilot onboarding
- add docs/daniel-pilot-readiness-whitepaper.md and .pdf

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 05:41:25 -04:00
Kisa
c2141a127a Update Signal brand language and add pitch/build artifacts
- Remove 'coverage' from worklist description across all docs
- Add whitepaper v2, documentation gap whitepaper, gate demo, sample
- Add TERAX.md, Claude Code settings, test-data generator
- Add settings.local.json to .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 10:14:16 -04:00
Kisa
eb927258c6 refactor: reorganize repo structure — flatten CGM-Denial-Prevention/ and Projects/ into docs/ pitch/ research/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 05:10:00 -04:00