# Assistant Module — Plan (atomic implementation steps)

**Per FVW v8 §11.9 thing #5 (Plan-as-law) + §08 Rule 4 (Explicit binary verification).**

## Pre-requisites

1. Read `recipe.md` + `codex.md` + `rules.md` for this module
2. Verify `module.json` `constitutional_fragments` lists every fragment consumed
3. Run baseline: `npx vitest run pact/vp/runtime.test.ts pact/vp/intelligence.test.ts`

## Atomic steps (in dependency order)

### Step 1: Verify environment
- [ ] Node 20+, npm 10+
- [ ] `app/src/assistant/` exists with 11 source files
- [ ] `pact/fragments/oscar.assistant.*.001.md` exist for every fragment in `constitutional_fragments`

### Step 2: Verify codex.md completeness
- [ ] C1 — behaviour inventory present
- [ ] C2 — state machine with transitions present
- [ ] C3 — side effect list present
- [ ] C4 — input validation contract present
- [ ] C5 — failure modes present
- [ ] C6 — user simulation list (≥10) present
- [ ] C7 — reproducibility test plan present
- [ ] C8 — shape matrix (per-surface × per-mode × per-chip × per-state) present
- [ ] C9 — state shape inventory (localStorage + in-memory + IDB) present

### Step 3: Verify rules.md 9-things
- [ ] §1 Capability declaration (incl. Reconstruction Mode Declaration)
- [ ] §2 Do-not-proceed rule
- [ ] §3 Contract primacy
- [ ] §4 Anti-drift enforcement (4 numbered checks)
- [ ] §5 Plan-as-law (this file)
- [ ] §6 Fallback behaviour
- [ ] §7 User-simulator requirement
- [ ] §8 Re-anchor cadence
- [ ] §9 Coverage matrix

### Step 4: Run coverage-matrix.md verification
- [ ] All 5 columns non-empty
- [ ] All rows ✓ or ✗
- [ ] Zero empty cells

### Step 5: Run all 10 C6 user simulations
- [ ] USIM-1: Bar tap → sheet-min
- [ ] USIM-2: "classify a 15m oak" → Layer 4 fires
- [ ] USIM-3: "how many surveys?" → Layer 2 fires
- [ ] USIM-4: "search the web for BS5837" → Layer 1.5 fires
- [ ] USIM-5: "what did we just do?" → Layer 3 fires
- [ ] USIM-6: dismiss sheet-full → bar
- [ ] USIM-7: action chip "Open survey X" → navigate
- [ ] USIM-8: empty prompt → error
- [ ] USIM-9: "Write a blog post about oaks" → writing-mode error
- [ ] USIM-10: swipe-up from bar → sheet-full

### Step 6: Run all App-VP tests
- [ ] `vp/sovereignty.test.ts` PASS
- [ ] `vp/runtime.test.ts` PASS
- [ ] `vp/intelligence.test.ts` PASS
- [ ] `vp/data.test.ts` PASS
- [ ] `vp/ux.test.ts` PASS
- [ ] `vp/build.test.ts` PASS
- [ ] `vp/adversarial.test.ts` PASS

### Step 7: Build + verify
- [ ] `npm run build` succeeds
- [ ] `dist/index.html` generated
- [ ] No TypeScript errors (strict mode)

### Step 8: Deploy (optional)
- [ ] Deploy to CF Pages
- [ ] Verify URL: https://oscar-platform.pages.dev

## Verification protocols (per step)

Each ✓ requires a binary PASS. A failed ✓ must be fixed immediately; re-run from that step + all subsequent steps.

## Failure handling

Per §11.9 thing #2 (Do-not-proceed):
- If any ✓ fails, STOP
- Write `blocker.md` describing what failed + what you need
- 3 failed fix attempts → write `stuck.md`
