# Phase Checks — a452 (FWV v8.3 alignment of freshvibe-cms)

**Locked 2026-08-04 07:23 BST per operator directive: "as long as you work proper checks into the plan I would prefer if the plan rolled on autonomously through each phase only pause if work needs major plan update etc"**

## Policy (operator-locked)

The a452 plan rolls **autonomously** through Phases 1.2 → 8 with one exception: pause for operator signoff only when a phase requires a **major plan update**.

A "major plan update" is any of:
- Phase output contradicts the operator-confirmed answers in §7
- Phase discovers new audit findings that change the work breakdown
- Phase output introduces a new dependency, file structure, or naming convention
- Phase output conflicts with the existing Constitution (app-pact.md) and the reconciliation isn't covered in the plan
- The 14-23h estimate is wrong by >25% in either direction

A phase does NOT pause for:
- Routine scope decisions (which file to touch, which exact JSON shape)
- Minor naming choices within the locked conventions
- Verification failures that have a known fix in the phase description
- Plan completion — the system auto-finishes on the last step's tick

## Proper checks per phase (mandatory)

Every phase must have **at least 3 verifiable checks** before it can be ticked done. A check is `file_exists` / `http_200` / `sql_count` / `shell` (per the plan verification API).

### Phase 1.2 — Write App-DNA
- `file_exists`: `app-pact/dna/app.dna.json` (the DNA file itself)
- `shell`: `python3 -c "import json; json.load(open('app-pact/dna/app.dna.json'))"` (valid JSON)
- `shell`: `grep -q '"schema": "freshvibe-way-v8.app-dna"' app-pact/dna/app.dna.json` (correct schema header)

### Phase 1.3 — Verify shadow + commit
- `file_exists`: `app-pact/shadow/EXTRACTION-MANIFEST.md` (manifest from 1.1)
- `shell`: `git log --oneline | grep -q "phase-1.1"` (the atomic commit exists)
- `shell`: `find app-pact/shadow -type f | wc -l | grep -q "^52[6-9]$"` (file count matches manifest)

### Phase 2 — App-Trace Atlas shell
- `file_exists`: `app-trace-atlas/atlas.json` (the atlas shell)
- `file_exists`: `app-trace-atlas/modules.md` (the module index)
- `shell`: `python3 -c "import json; d=json.load(open('app-trace-atlas/atlas.json')); assert 'surfaces' in d and 'behaviours' in d and 'modules' in d"` (atlas has the 3 required keys)

### Phase 3 — App-Codex
- `file_exists`: `app-codex/codex.md` (the app-level codex)
- `shell`: `grep -q "## C1" app-codex/codex.md && grep -q "## C8" app-codex/codex.md` (C1-C8 sections present)
- `shell`: `wc -l app-codex/codex.md | awk '{print $1}' | python3 -c "import sys; n=int(sys.stdin.read()); assert n >= 200"` (at least 200 lines)

### Phase 4 — App-Pact complete
- `file_exists`: `app-pact/anti-drift.md` (the anti-drift rules per §08)
- `file_exists`: `app-pact/invariants.md` (the invariants list)
- `file_exists`: `app-pact/rules/app.pact.panel-system.001.md` (at least 1 rule file per §02)
- `shell`: `ls app-pact/ | wc -l | python3 -c "import sys; n=int(sys.stdin.read()); assert n >= 5"` (at least 5 files in app-pact/)

### Phase 5 — Per-module Recipe Books
- `file_exists`: `app-recipe/recipe.md` (the package-level Recipe manifest)
- `shell`: `find app-fragments runtime modules -name "recipe.md" -o -name "module-meta.json" | wc -l | python3 -c "import sys; n=int(sys.stdin.read()); assert n >= 20"` (at least 20 recipe files for the ~25 modules/panels)
- `shell`: `find app-fragments runtime modules -name "module-meta.json" -exec grep -l "tier" {} \; | wc -l | python3 -c "import sys; n=int(sys.stdin.read()); assert n >= 5"` (at least 5 module-meta.json files declare a tier)

### Phase 6 — App-Overlays
- `file_exists`: `app-overlays/README.md` (the overlay entry point)
- `shell`: `ls app-overlays/ | wc -l | python3 -c "import sys; n=int(sys.stdin.read()); assert n >= 2"` (at least 2 overlay stubs)
- `shell`: `grep -q "extension_point" app-overlays/README.md` (overlay doc references the §3.7 extension_point concept)

### Phase 7 — App-VP + drift detector
- `file_exists`: `app-vp/app.vp.json` (the verifiable properties per §21)
- `file_exists`: `scripts/drift-detector.py` (the drift detector script)
- `shell`: `python3 scripts/drift-detector.py --check-shadow` (drift detector runs without error)

### Phase 8 — Ship + verify
- `file_exists`: `FV-CMS-VERSION.txt` (version file bumped to 1.0.0)
- `shell`: `cat FV-CMS-VERSION.txt | grep -q "1.0.0"` (version is 1.0.0)
- `shell`: `python3 scripts/drift-detector.py --full` (full drift check passes)

## Verification protocol (every phase)

1. After the phase work is complete but BEFORE ticking the step done, run all 3+ checks for that phase
2. If any check fails: investigate + fix + re-run. Do NOT tick the step done with failing checks.
3. If a check cannot be made to pass: that means the phase output contradicts the plan — post a 🟥 bulletin, pause for operator signoff, treat as a major plan update
4. The `evidence_bulletin_id` on every shipped step must be a bulletin that mentions the 3 checks passing

## Auto-roll behavior

The `team` workflow is overkill for a single-session alignment. The work is:

1. Do phase N's work
2. Run phase N's 3 checks
3. Post 🟦 bulletin "phase N done" with check results in the body
4. Tick step N done with evidence_bulletin_id pointing to the bulletin
5. Move to phase N+1 immediately (no operator pause unless major plan update)
6. Repeat until phase 8
7. Phase 8's last tick auto-fires the finish bulletin + sets plan status=completed

This single-session roll is what the operator signed off on with "as long as you work proper checks into the plan". The checks are the safety net; the autonomous roll is the speed.

## Time budget reminder

Estimated total: 14-23h across 8 phases. The estimated phase split:
- 1.2: 30-60min (App-DNA is a JSON file, mostly metadata we already have)
- 1.3: 5min (verify shadow + commit)
- 2: 2-3h (Atlas shell + module index)
- 3: 1-2h (Codex C1-C8)
- 4: 1-2h (anti-drift + invariants + rules/)
- 5: 4-6h (per-module Recipe Books — biggest phase, 25+ modules/panels)
- 6: 1-2h (overlays)
- 7: 3-4h (App-VP + drift detector)
- 8: 1-2h (ship + verify)

If a phase's actual time exceeds the upper bound by >50%, that's a major plan update — pause and flag.
