Skip to content

Execution Roadmap — Dependency-Aware Phased Implementation

Status: Active planning document Date: 2026-04-17 Session: 41 Principle: Specs are non-negotiable before execution. UI/UX design identified where needed.


Inventory Summary

Source Total items Implemented Designed (ready for spec) Deferred
ADRs 19 19 (decisions accepted)
Feature specs 18 11 7
Deferred specs 6 0 6
Platform restructuring 17 parts 0 17 (design complete)
Gap report 31 21 3 7
Post-MVP tech evolution 13 items 2 11

Total architectural surface: ~92 items across 6 categories.


Dependency Graph — What Blocks What

FOUNDATION LAYER (must exist before anything else)
├── DAO Layer (spec ready) ─────────────────────────┐
├── PostgreSQL RLS (spec ready) ────────────────────┤
├── LLM Fallback Gateway (spec ready) ─────────────┤
└── Monorepo Setup (no spec yet — NEEDS SPEC) ──────┤
INTAKE RESTRUCTURING (demo-critical)                 │
├── 5-Layer State Model (design complete) ──────────┼── depends on DAO Layer
├── Triage Agent + LangGraph (design complete) ─────┤     (clean data access)
├── Per-Layer Extractors ×5 (design complete) ──────┤
├── PFS/HSS/FMS Scoring (design complete) ──────────┤
├── Prompt Layer Contexts (design complete) ─────────┤
└── Progress Rail + Summary Panel UI ───────────────┤── NEEDS UI/UX DESIGN
MULTI-TENANCY (ADR-0018)                             │
├── Phase 0: Foundation (tenants, RBAC, Clerk orgs)─┼── depends on DAO + RLS
├── Phase 1: Provider Flow (onboarding, quoting) ───┤
├── Phase 2: Risk + MSO (video, consultation) ──────┤
├── Phase 3: Coordinators (assignment, tools) ──────┤
├── Phase 4: Payments + SLA ────────────────────────┤
├── Phase 5: Coordination Lifecycle ────────────────┤
└── Phase 6: Recovery Matching ─────────────────────┘
COORDINATOR TOOLING                                  │
├── Case Queue Dashboard ───────────────────────────┼── depends on Phase 3 + 5
├── Timeline & Transport Manager ───────────────────┤
├── Vendor Directory + Booking ─────────────────────┤── depends on Transport Spec
├── Escalation Panel ───────────────────────────────┤── depends on Phase 6
├── Coordinator Chat ───────────────────────────────┤── depends on ADR-0015
└── All coordinator UI ─────────────────────────────┤── NEEDS UI/UX DESIGN
PROVIDER PORTAL                                      │
├── Case Inbox ─────────────────────────────────────┼── depends on Phase 1
├── Quote Builder ──────────────────────────────────┤
├── Redacted EHR Viewer ────────────────────────────┤── depends on DAO redaction
├── Provider Performance Reports ───────────────────┤── depends on Phase 1 data
└── Provider portal UI ─────────────────────────────┤── NEEDS UI/UX DESIGN
TRANSPORT & SERVICES                                 │
├── coordinator_vendors table ──────────────────────┼── depends on Phase 5
├── coordinator_service_bookings table ─────────────┤
├── Travel Fitness Assessment ──────────────────────┤── depends on Intake Layer 3
├── Transport Panel (patient UI) ───────────────────┤── NEEDS UI/UX DESIGN
└── Vendor Management (coordinator UI) ─────────────┘── NEEDS UI/UX DESIGN
COST ESTIMATE                                        │
├── Estimate Generation Service ────────────────────┼── depends on Phase 1 quotes
├── Fee Model Configuration ────────────────────────┤     + Layer 5 PV
├── Estimate Display (patient UI) ──────────────────┤── NEEDS UI/UX DESIGN
└── Budget Comparison Logic ────────────────────────┘
MOBILE                                               │
├── Monorepo prerequisite ──────────────────────────┼── depends on Monorepo Setup
├── shared-core extraction ─────────────────────────┤
├── Expo app scaffold ──────────────────────────────┤
├── Chat + upload + notifications ──────────────────┤
└── Mobile patient UI ──────────────────────────────┤── NEEDS UI/UX DESIGN
PDF EXTRACTION                                       │
└── opendataloader-pdf shadow mode ─────────────────┼── independent (no blockers)

Critical Insight: The Least Friction Path

The naive approach is to execute ADR-0018 phases 0→1→2→3→4→5→6 sequentially. This is wrong. The demo-critical work (intake restructuring) doesn't depend on multi-tenancy. And multi-tenancy Phase 0 depends on DAO + RLS which are unrelated to intake.

The least friction path interleaves epics based on actual dependencies:


Execution Waves

Wave 0: Foundation (Weeks 1-2)

What: Infrastructure that every subsequent wave depends on.

# Item Source Spec status Effort Depends on
0.1 DAO Layer — Phase 1 (PostgreSQL repositories) Feature spec (ready) Spec + steer complete 1 week Nothing
0.2 PostgreSQL RLS Deferred spec (ready) Spec complete 2-3 days 0.1 (DAO enforces tenant_id)
0.3 LLM Fallback Gateway Feature spec (ready) Spec + steer complete 3-4 days Nothing

Why these first: - DAO gives clean data access to every service built afterward. Without it, every new feature adds more inline SQLAlchemy that will need migration later. - RLS is defense-in-depth for multi-tenancy. Must exist before any provider/coordinator sees patient data. - LLM Gateway centralizes all LLM calls before we add 5 new extractors + Triage Agent.

UI/UX needed: None — pure backend. Specs needed: All ready. Execute directly.


Wave 1: Intake Restructuring (Weeks 3-6)

What: The demo-critical rewrite. 5-layer intake + Triage Agent + PFS/HSS/FMS.

# Item Source Spec status Effort Depends on
1.1 Layer state model (patient_state schema, layer tracking) Restructuring Part 1, 10 NEEDS IMPL SPEC 3-4 days 0.1 (DAO)
1.2 Triage Agent as LangGraph graph Restructuring Part 2, 17 NEEDS IMPL SPEC 1 week 0.3 (LLM Gateway), 1.1
1.3 Layer 1 extractor (intent/emotional) Restructuring Part 7 NEEDS IMPL SPEC 2-3 days 1.2
1.4 Layer 3 extractor (travel fitness) Restructuring Part 12 NEEDS IMPL SPEC 2-3 days 1.2
1.5 Layer 4 extractor (logistics) Restructuring Part 13 NEEDS IMPL SPEC 2 days 1.2
1.6 Layer 5 extractor (financial) Restructuring Part 8 NEEDS IMPL SPEC 2 days 1.2
1.7 Layer 2 wiring (existing Clinical Context Agent as LangGraph node) Restructuring Part 2 NEEDS IMPL SPEC 2-3 days 1.2
1.8 PFS scorer (pure function + config/scoring.yaml) Restructuring Part 9 NEEDS IMPL SPEC 2-3 days 1.1
1.9 HSS reframing (existing matching engine → HSS output) Restructuring Part 9 NEEDS IMPL SPEC 2 days 1.8
1.10 FMS scorer (sigmoid, historical conversion) Restructuring Part 9 NEEDS IMPL SPEC 1-2 days 1.8, 1.9
1.11 Prompt layer contexts (7 YAML files + load_layer_context) Restructuring Part 17 NEEDS IMPL SPEC 2-3 days 1.2
1.12 Audit tables (graph_node, scoring, extraction) Restructuring Part 17 NEEDS IMPL SPEC 2-3 days 0.1, 0.2
1.13 LangGraph checkpointing → PostgreSQL Restructuring Part 17 NEEDS IMPL SPEC 2-3 days 1.2
1.14 PFS remediation behavior (agent behavior per band) Restructuring Part 11 NEEDS IMPL SPEC 2-3 days 1.8, 1.11

UI/UX needed before execution: - Progress rail redesign (layers replacing current 8-flag model) - Layer summary cards (in-chat completion cards) - Summary panel redesign (layer-organized patient dashboard) - PFS/HSS/FMS display in match results

Specs needed: Design is complete. Each item needs an implementation spec (file-by-file change list, test plan, migration plan). Write specs in a batch before Wave 1 starts.

Note: Layer 2 (1.7) reuses the existing Clinical Context Agent — lowest risk. Layers 1, 3, 4, 5 are net-new extractors.


Wave 2: Frontend Monorepo + Patient UI (Weeks 5-8, overlaps with Wave 1)

What: Restructure frontend for multi-stakeholder apps. Ship intake UI changes.

# Item Source Spec status Effort Depends on
2.1 Monorepo setup (pnpm workspaces, Turborepo) Restructuring Part 4 NEEDS SPEC 2-3 days Nothing
2.2 shared-core extraction (types, API client, formatters) Restructuring Part 4 NEEDS SPEC 2-3 days 2.1
2.3 shared-web extraction (EHR viewer, doc viewer, rich cards) Restructuring Part 4 NEEDS SPEC 2-3 days 2.1
2.4 patient-app migration (move into workspace) Restructuring Part 4 NEEDS SPEC 1 day 2.1
2.5 Progress rail redesign Restructuring Part 4 NEEDS UI/UX + SPEC 2-3 days 2.4, 1.1 (layer state)
2.6 Layer summary cards (rich_content type) Restructuring Part 4 NEEDS UI/UX + SPEC 2 days 2.4, 1.1
2.7 Summary panel redesign (layer-organized) Restructuring Part 4 NEEDS UI/UX + SPEC 2-3 days 2.4, 1.1
2.8 PFS/HSS/FMS display (match results + case queue) Restructuring Part 4 NEEDS UI/UX + SPEC 2 days 1.8, 1.9, 1.10

UI/UX needed: Items 2.5, 2.6, 2.7, 2.8 need design before implementation. Specs needed: Monorepo setup (2.1-2.4) needs a spec. UI items need UI/UX design → spec → implementation.


Wave 3: Multi-Tenancy Foundation (Weeks 7-10, overlaps with Wave 2)

What: ADR-0018 Phases 0-1. Tenant infrastructure + provider onboarding.

# Item Source Spec status Effort Depends on
3.1 Tenants table + Clerk org integration ADR-0018 Phase 0 NEEDS IMPL SPEC 3-4 days 0.1 (DAO), 0.2 (RLS)
3.2 RBAC model (7 roles per ADR-0018) ADR-0018 Phase 0 NEEDS IMPL SPEC 2-3 days 3.1
3.3 Case shares + redaction engine ADR-0018 Phase 0 NEEDS IMPL SPEC 3-4 days 3.1, 3.2
3.4 Case lifecycle state machine refactor ADR-0018 Phase 0 NEEDS IMPL SPEC 2-3 days 3.1
3.5 Provider onboarding API ADR-0018 Phase 1 NEEDS IMPL SPEC 1 week 3.1, 3.2
3.6 Forwarding + quoting endpoints ADR-0018 Phase 1 NEEDS IMPL SPEC 1 week 3.3, 3.5
3.7 Cost estimate generation Restructuring Part 15 NEEDS IMPL SPEC 3-4 days 3.6, 1.10 (FMS)
3.8 Consultation routing service Restructuring Part 14 NEEDS IMPL SPEC 2-3 days 1.3 (Layer 1)

UI/UX needed: - Provider portal (case inbox, quote builder) — NEEDS UI/UX DESIGN - Cost estimate display (patient-facing) — NEEDS UI/UX DESIGN - Admin portal (tenant management) — NEEDS UI/UX DESIGN

Specs needed: ADR-0018 has the architecture. Each item needs file-by-file implementation spec.


Wave 4: Coordination + Transport (Weeks 11-14)

What: ADR-0018 Phases 3+5, coordinator tooling, transport bookings.

# Item Source Spec status Effort Depends on
4.1 Coordinator assignment engine ADR-0018 Phase 3 NEEDS IMPL SPEC 3-4 days 3.2 (RBAC)
4.2 coordinator_vendors table Transport spec (ready) Spec complete 2 days 0.1 (DAO)
4.3 coordinator_service_bookings table Transport spec (ready) Spec complete 2 days 4.2
4.4 Coordinator audit log Restructuring Part 4 NEEDS IMPL SPEC 1-2 days 4.1
4.5 Coordinator case queue API Restructuring Part 4 NEEDS IMPL SPEC 3-4 days 4.1, 1.8 (PFS)
4.6 Timeline manager API ADR-0018 Phase 5 NEEDS IMPL SPEC 3-4 days 4.3
4.7 Vendor directory + booking API Transport spec (ready) Spec complete 3-4 days 4.2
4.8 Coordinator chat (SSE) ADR-0015 Steer complete 2-3 days 4.1
4.9 Escalation engine (recovery alerts → transport) ADR-0018 Phase 6 NEEDS IMPL SPEC 3-4 days 4.3, 4.6

UI/UX needed: - Full coordinator dashboard (case queue, timeline, vendor selector, escalation panel, chat) — NEEDS UI/UX DESIGN - Patient transport panel — NEEDS UI/UX DESIGN - Patient timeline cards — NEEDS UI/UX DESIGN

Specs needed: Transport spec is complete. Coordinator tooling needs implementation specs.


Wave 5: Provider Portal + MSO (Weeks 13-16, overlaps with Wave 4)

What: ADR-0018 Phases 1-2 frontend + MSO consultation.

# Item Source Spec status Effort Depends on
5.1 operations-app scaffold (coordinator + admin) Restructuring Part 4 NEEDS SPEC 2-3 days 2.1 (monorepo)
5.2 clinical-app scaffold (provider + MSO) Restructuring Part 4 NEEDS SPEC 2-3 days 2.1 (monorepo)
5.3 Provider case inbox UI ADR-0018 Phase 1 NEEDS UI/UX + SPEC 1 week 5.2, 3.5
5.4 Quote builder UI ADR-0018 Phase 1 NEEDS UI/UX + SPEC 1 week 5.2, 3.6
5.5 MSO consultation flow (video + review) ADR-0018 Phase 2 NEEDS IMPL SPEC 1 week 3.8, 5.2
5.6 Coordinator dashboard UI Restructuring Part 4 NEEDS UI/UX + SPEC 2 weeks 5.1, 4.1-4.9
5.7 Admin portal UI (tenant + user mgmt) ADR-0018 Phase 0 NEEDS UI/UX + SPEC 1 week 5.1, 3.1
5.8 Redacted EHR viewer (role-based) Restructuring Part 4 NEEDS SPEC 3-4 days 2.3, 3.3

UI/UX needed: 5.3, 5.4, 5.5, 5.6, 5.7 all need full UI/UX design.


Wave 6: Mobile + PDF + Polish (Weeks 15-20)

What: Mobile patient app, opendataloader-pdf integration, remaining gap items.

# Item Source Spec status Effort Depends on
6.1 shared-native scaffold Mobile spec (ready) Spec complete 2 days 2.2 (shared-core)
6.2 Expo app + Clerk auth Mobile spec (ready) Spec complete 2 days 6.1
6.3 Mobile chat interface Mobile spec (ready) NEEDS UI/UX + SPEC 1 week 6.2
6.4 Mobile document upload (camera + picker) Mobile spec (ready) Spec complete 2-3 days 6.2
6.5 Mobile push notifications Mobile spec (ready) Spec complete 1-2 days 6.2
6.6 Mobile transport panel Mobile spec (ready) NEEDS UI/UX + SPEC 2-3 days 6.2, 4.3
6.7 opendataloader-pdf shadow mode Evaluation (ready) Spec complete 5 days Nothing (independent)
6.8 Match progress SSE Deferred spec (ready) Spec complete 1-2 days Nothing
6.9 EHR builder service class refactor Deferred spec (ready) Spec complete 3-5 days 0.1 (DAO)
6.10 Pre-travel checklist Restructuring Part 16 NEEDS IMPL SPEC 3-4 days 1.4, 1.5 (Layers 3+4)
6.11 Post-op manual generator Restructuring Part 16 NEEDS IMPL SPEC 3-4 days 4.9 (escalation)
6.12 Provider performance reports Restructuring Part 16 NEEDS IMPL SPEC 3-4 days 3.5 (provider data)
6.13 Channel preference detection Restructuring Part 16 NEEDS IMPL SPEC 1-2 days Nothing

Wave 7: Payments + Recovery + Long-term (Weeks 19-24)

What: ADR-0018 Phases 4+6, subscription model exploration.

# Item Source Spec status Effort Depends on
7.1 Payment token fee model ADR-0018 Phase 4 NEEDS FULL SPEC 2-3 weeks 3.6, 3.7
7.2 SLA monitoring ADR-0018 Phase 4 NEEDS FULL SPEC 1 week 4.6
7.3 Recovery provider matching ADR-0018 Phase 6 Design in ADR 2-3 weeks 4.9
7.4 Recovery milestone tracking ADR-0018 Phase 6 Design in ADR 1-2 weeks 7.3
7.5 Facility capability disclosure ADR-0018 amendment Design in ADR 1-2 weeks 3.5
7.6 Long-term engagement model Restructuring Part 16 NOT DESIGNED TBD 7.3, 7.4 (outcome data)
7.7 FHIR Bundle export endpoint ADR-0020 NEEDS SPEC 2-3 days 0.1 (DAO) — independent

Items Requiring UI/UX Design Before Spec

These cannot be specced or built until UI/UX design is done.

Critical (blocks Waves 1-2)

Item What needs designing Wave Complexity
Progress rail redesign Layer-based steps replacing 8-flag binary model. Completion rings per layer. Partially-filled state for out-of-order completion. Wave 2 Medium
Layer summary cards In-chat completion cards with key findings + "anything I got wrong?" prompt. Visual treatment, content structure. Wave 2 Low
Summary panel redesign Layer-organized live dashboard (About You, Health Profile, Travel Readiness, Planning). Wave 2 Medium
PFS/HSS/FMS display How scores appear in match results, case queue, patient view. Wave 2 Medium

Important (blocks Waves 4-5)

Item What needs designing Wave Complexity
Coordinator dashboard Case queue, timeline manager, vendor selector, escalation panel, chat. Full new application. Wave 4-5 High
Provider portal Case inbox, quote builder, redacted patient view, analytics. New stakeholder app. Wave 5 High
Admin portal Tenant management, user RBAC, system health, audit logs. Wave 5 Medium
Patient transport panel Journey overview, booking status, driver details, emergency contact. Wave 4 Medium
Cost estimate display Breakdown card with categories, ranges, PV comparison, fee transparency. Wave 3 Medium

Nice to have (blocks Wave 6)

Item What needs designing Wave Complexity
Mobile chat interface React Native adaptation of web chat. Rich cards in native. Wave 6 Medium
Mobile transport panel Native transport view. Wave 6 Low

Spec Pipeline — What Needs Writing Before Each Wave

Before Wave 0 (write now — this week)

  • DAO Layer: spec is ready, steer is ready. Execute directly.
  • RLS: spec is ready. Execute directly.
  • LLM Gateway: spec is ready, steer is ready. Execute directly.

Before Wave 1 (write in Week 2)

Write one consolidated implementation spec covering: - Layer state model (Alembic migration, patient_state schema) - Triage Agent LangGraph graph definition - 5 extractors (input/output schemas, model choice, structured output) - PFS/HSS/FMS scorers (pure functions, config loading, Flagsmith override) - Prompt layer contexts (7 YAML files) - Audit tables (3 Alembic migrations) - LangGraph checkpointing setup - PFS remediation behavior (agent prompt changes per band)

Before Wave 2 (write in Week 4, UI/UX in Week 3)

  • Monorepo setup spec (pnpm workspace structure, CI/CD changes, Vercel config)
  • UI/UX designs for progress rail, summary cards, summary panel, score display
  • Implementation spec for each UI component

Before Wave 3 (write in Week 6)

  • ADR-0018 Phase 0 implementation spec (tenants, RBAC, case_shares, state machine)
  • ADR-0018 Phase 1 implementation spec (provider onboarding, quoting, forwarding)
  • Cost estimate service implementation spec

Before Wave 4 (write in Week 10, UI/UX in Week 9)

  • Coordinator tooling implementation spec
  • Transport booking service implementation spec (mostly ready from deferred spec)
  • UI/UX designs for coordinator dashboard, transport panel

Before Wave 5 (write in Week 12, UI/UX in Week 11)

  • Provider portal implementation spec
  • MSO consultation flow implementation spec
  • Admin portal implementation spec
  • UI/UX designs for all three portals

Before Wave 6 (write in Week 14)

  • Mobile implementation spec (mostly ready from deferred spec)
  • opendataloader integration spec (mostly ready from evaluation)
  • Remaining feature specs (checklist, post-op manual, reports)

Items That Can Execute Independently (No Wave Dependencies)

These can be parallelized or slotted into any gap:

Item Source Spec status Effort Notes
opendataloader-pdf shadow mode Evaluation (ready) Complete 5 days Pure backend, no UI, no dependencies
Match progress SSE Deferred spec (ready) Complete 1-2 days Frontend + backend, self-contained
Channel preference detection Restructuring Part 16 Design complete 1-2 days Notification system enhancement
EHR builder service refactor Deferred spec (ready) Complete 3-5 days Internal refactor, no UI
DICOM support Phase 1 Feature spec (ready) Complete 3-4 weeks Large but independent
Conversation flow Layer 2 (orchestrator planner) Feature spec + steer Complete 1-2 weeks Depends on Layer 1 validation (done)
Conversation flow Layer 3 (sync chat extractor) Feature spec + steer Complete 1 week Independent of Layer 2

Risk Register

Risk Impact Mitigation
Wave 1 (intake restructuring) takes longer than 4 weeks Delays demo-critical functionality Parallel extraction — Wave 2 frontend starts in Week 5 regardless of Wave 1 completion. PFS scoring can ship before all 5 extractors are done.
UI/UX design bottleneck (no dedicated designer) Blocks Waves 2, 4, 5 Use existing platform patterns (EHR drawer, rich cards). Wireframes in Figma/Excalidraw before full design. Ship functional first, polish later.
LangGraph migration introduces regressions Breaks live patient intake Feature flag triage_agent_v3. Run in shadow mode alongside existing orchestrator. Promote when validated. Same pattern as gates_v2.
DAO migration across existing services is tedious Slows Wave 0 Migrate one service per PR. Start with highest-value: patient_service, case_service, fhir_service. Others can migrate during later waves.
Multi-tenancy (Wave 3) conflicts with intake restructuring (Wave 1) Merge conflicts, architectural tension DAO layer (Wave 0) provides the buffer. Intake code uses DAO, multi-tenancy enhances DAO. Clean separation.

Timeline Summary

Week  1-2:   Wave 0 — DAO + RLS + LLM Gateway (foundation)
Week  3-6:   Wave 1 — Intake restructuring (backend, demo-critical)
Week  5-8:   Wave 2 — Monorepo + patient UI (overlaps Wave 1)
Week  7-10:  Wave 3 — Multi-tenancy Phases 0-1 (overlaps Wave 2)
Week 11-14:  Wave 4 — Coordination + transport
Week 13-16:  Wave 5 — Provider + MSO + coordinator portals
Week 15-20:  Wave 6 — Mobile + PDF + polish
Week 19-24:  Wave 7 — Payments + recovery + long-term

Total: ~24 weeks with overlapping waves
       ~20 weeks of active development (4 weeks overlap)

First demo-ready checkpoint: End of Week 8 (Waves 0-2 complete). Patient can go through 5-layer intake with PFS scoring, see layer-based progress, get matched with HSS/FMS scores.

Full platform checkpoint: End of Week 16 (Waves 0-5 complete). Multi-tenant, provider portal, coordinator dashboard, transport bookings, cost estimates.


Next Action

  1. This week: Execute Wave 0 (DAO, RLS, LLM Gateway) — specs are ready
  2. In parallel: UI/UX design for Wave 2 critical items (progress rail, summary cards, summary panel, score display)
  3. Week 2: Write consolidated Wave 1 implementation spec
  4. Week 3: Begin Wave 1 execution