---
phase: 04
slug: harden-clean-up-optional
plan: 07
type: execute
wave: 6
depends_on:
  - 01
  - 02
  - 03
  - 04
  - 05
  - 06
files_modified:
  - .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md
  - .planning/REQUIREMENTS.md
  - .planning/ROADMAP.md
  - .planning/STATE.md
  - .planning/PROJECT.md
autonomous: true
requirements: []
tags:
  - verification
  - phase-4-closure
  - roadmap-backfill
  - v1-close-prep
  - aggregator
  - charter-d-p4-05
  - charter-d-p4-01
user_setup: []
must_haves:
  truths:
    - "04-VERIFICATION.md exists at .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md with canonical frontmatter shape (phase + verified + status + score + overrides_applied + override_notes + human_verification)"
    - "Per-Requirement Scorecard cites all 4 ROADMAP success criteria with evidence rows (Plan + commit + UAT assertion + grep gate output)"
    - "All P1 polish items (#11 + #14 + #15) cited as GREEN with Plan 04-01 evidence"
    - "All Phase 4 hardening items (setimmediate + dead-code + generate-icons + A29 race fix + cursor verification + dark-logo + ROADMAP backfill) cited as GREEN with their plan + commit refs"
    - "Pre-checkpoint bundle gates 6/6 PASS evidence (per saved memory feedback-pre-checkpoint-bundle-gates.md)"
    - "Operator empirical ack from Plan 04-06 cited verbatim with date stamp (REVISION iter-2 WARNING 4 — Task 1 verify greps the ack literal from 04-VERIFICATION.md to confirm it's a REAL ack, not a placeholder)"
    - "Deferred Items table carries forward the v1.1/v2 items: rrweb v2 upgrade + programmatic SW-RAM measurement + REQ-password-confidentiality v2 candidate"
    - "ROADMAP.md Phase 4 row flipped [x] with closure date; harness count updated from 33 to 35 (Plans 04-04 + 04-05 added A33 + A34)"
    - "ROADMAP.md Plans 01-08..01-13 rows verified per D-P4-05 backfill (per plan-checker flag #4)"
    - "REQUIREMENTS.md: no new REQs but verification status notes appended where ROADMAP SCs map to existing REQs"
    - "STATE.md progress.completed_phases incremented to 4 (was 3); milestone v1 status updated to CLOSED-PENDING-ALPHA OR CLOSED based on alpha redistribution status"
    - "PROJECT.md Validated section evolved to include Phase 4 hardening closure summary"
  artifacts:
    - path: ".planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md"
      provides: "Phase 4 closure aggregator: 4 ROADMAP SCs + audit P1 polish + flake stabilization + visual polish + build hygiene + cross-cutting gates + operator ack + deferred items"
      min_lines: 120
    - path: ".planning/REQUIREMENTS.md"
      provides: "Verification status notes appended for REQs touched by Phase 4 (no new REQs)"
      contains: "Phase 4 closure"
    - path: ".planning/ROADMAP.md"
      provides: "Phase 4 row flipped [x] + closure date + harness count update + Plan rows for 01-08..01-13 verified backfilled"
      contains: "Phase 4: Harden + clean up"
    - path: ".planning/STATE.md"
      provides: "progress.completed_phases: 4; current focus updated; session continuity logged"
      contains: "milestone v1"
    - path: ".planning/PROJECT.md"
      provides: "Validated section update + DEC-* table closure citations (where applicable)"
      contains: "Phase 4"
  key_links:
    - from: ".planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md"
      to: "Plan 04-01..04-06 SUMMARY files"
      via: "per-plan citation in Per-Requirement Scorecard"
      pattern: "Plan 04-0\\d"
    - from: ".planning/ROADMAP.md"
      to: ".planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md"
      via: "Phase 4 row flipped [x] with closure-doc citation"
      pattern: "04-VERIFICATION\\.md"
---

<objective>
Phase 4 closure ceremony — the v1 milestone close. This plan does NO source-code or test changes; it does the documentation aggregation + marker flips that close out Phase 4 and signal v1 milestone closure.

Three workstreams:

1. **04-VERIFICATION.md (NEW; aggregator):** Create the canonical Phase 4 verification document per the precedents at Phase 3 03-VERIFICATION.md + Phase 2 02-VERIFICATION.md + Phase 1 01-VERIFICATION.md. The 4 ROADMAP SCs are cited row-by-row with evidence (Plan + commit ref + UAT assertion ID + grep gate output). The audit P1 polish items (#11 + #14 + #15) and the additional Phase 4 work (setimmediate polyfill + dead-code grep + generate-icons rename + A29 race fix + cursor verification + dark-logo strategy) are inventoried in a non-ROADMAP-SC section as "Audit residual closure" with the same evidence shape. Cross-cutting gates section: UAT harness 33 -> 35 GREEN (+A33 from Plan 04-04 + A34 from Plan 04-05), vitest baseline 171 -> >=185 GREEN, Tier-1 FORBIDDEN_HOOK_STRINGS unchanged at 12, pre-checkpoint bundle gates 6/6 PASS (Gate 2 polarity flipped 1 -> 0 per Plan 04-02). Operator empirical ack (Plan 04-06 Task 4) cited verbatim. Deferred Items table carries forward the v1.1/v2 items from CONTEXT.

2. **ROADMAP backfill (D-P4-05):** Per the plan-checker flag #4 against Plan 01-13 — Plans 01-08..01-13 were inline-tracked but not row-added in ROADMAP.md Phase 1 row block. PATTERNS.md notes the rows ARE at lines 90-95 already, so this is mostly a verification + addition of any missing row text per re-audit. Add any Phase 2/3 plan rows similarly missing (per the re-audit; per saved feedback `feedback-no-unilateral-scope-reduction.md`, surface every potentially-missing row to the user via the VERIFICATION.md backfill table for sign-off rather than pre-filtering).

3. **Marker flips:** REQUIREMENTS.md (no new REQs but optional closure notes); ROADMAP.md (Phase 4 row [x] with date); STATE.md (`progress.completed_phases: 4`; `current_focus: v1 milestone CLOSED-PENDING-ALPHA OR CLOSED`); PROJECT.md (Validated section evolves; DEC-* table closure citations where applicable).

Purpose: Closes Phase 4 + closes v1 milestone (or stages CLOSED-PENDING-ALPHA gate depending on alpha redistribution state per D-P4-04). Phase 4 is THE LAST phase per the 4-phase ROADMAP; no Phase 5 work is planned.

Output: 1 NEW VERIFICATION.md + 4 docs marker flips. No code, no tests, no harness changes. Single closure commit per file (or 1 mega-commit per the closure convention).
</objective>

<execution_context>
@$HOME/.claude/get-shit-done/workflows/execute-plan.md
@$HOME/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/REQUIREMENTS.md
@.planning/phases/04-harden-clean-up-optional/04-CONTEXT.md
@.planning/phases/04-harden-clean-up-optional/04-RESEARCH.md
@.planning/phases/04-harden-clean-up-optional/04-PATTERNS.md
@.planning/phases/04-harden-clean-up-optional/04-UI-SPEC.md
@.planning/phases/04-harden-clean-up-optional/04-VALIDATION.md

# Prior verification documents — pattern precedents
@.planning/phases/01-stabilize-video-pipeline/01-VERIFICATION.md
@.planning/phases/02-stabilize-export-pipeline/02-VERIFICATION.md
@.planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-VERIFICATION.md

# Plan SUMMARYs for evidence rows (populated when Plans 04-01..04-06 complete; this plan executes last)
# @.planning/phases/04-harden-clean-up-optional/04-01-SUMMARY.md  (Plan 04-01 closure)
# @.planning/phases/04-harden-clean-up-optional/04-02-SUMMARY.md  (Plan 04-02 closure)
# @.planning/phases/04-harden-clean-up-optional/04-03-SUMMARY.md  (Plan 04-03 closure)
# @.planning/phases/04-harden-clean-up-optional/04-04-SUMMARY.md  (Plan 04-04 closure)
# @.planning/phases/04-harden-clean-up-optional/04-05-SUMMARY.md  (Plan 04-05 closure)
# @.planning/phases/04-harden-clean-up-optional/04-06-SUMMARY.md  (Plan 04-06 closure)

<interfaces>
<!-- Key shapes the executor consumes directly. Extracted from precedent VERIFICATION.md files 2026-05-21. -->

From .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-VERIFICATION.md (immediate prior precedent; 4-override template):
- Frontmatter shape: `phase` + `verified` ISO timestamp + `status: passed` + `score: <N>/<N> ROADMAP success criteria + <M>/<M> SPEC §10 criteria` + `overrides_applied: <count>` + `re_verification` block + `override_notes` block + `human_verification` block + `deferred` block.
- Body sections: Per-Requirement Scorecard + Cross-Cutting Gates + Operator-Empirical Acks (verbatim + commit refs) + Deferred Items.

From .planning/phases/01-stabilize-video-pipeline/01-VERIFICATION.md (per-requirement scorecard + cross-cutting gates + operator acks shape):
- Per-Requirement Scorecard: one row per REQ, columns include {ID, Acceptance, Status, Evidence, Plan + commit}.
- Cross-Cutting Gates: vitest count, UAT count, Tier-1 grep count, bundle gates 6/6.
- Operator-Empirical Acks: verbatim quote + date + commit + context (the operator surface that was empirically validated).
- Deferred Items: forward-looking table with category + item + status + deferred_at.

Per CONTEXT §"Deferred Ideas" — v1.1/v2 items to carry forward in 04-VERIFICATION.md:
- rrweb 2.0.0-alpha.4 -> stable v2 upgrade (D-P3-03 + D-P4-01)
- Programmatic SW-realm RAM measurement (D-P3-04 + D-P4-01)
- REQ-password-confidentiality v2 candidate (D-P3-02; only if charter reverses)
- Alpha-tester findings integration (D-P4-04; routed via separate maintenance window)

Operator empirical ack format (REVISION iter-2 — WARNING 4 mitigation):
Plan 04-06 Task 4's `<resume-signal>` is canonically: `Type "approved" or describe issues (e.g., "stroke too thin", ...)`. The Phase 4 prior-art ack pattern from Plan 01-10 cycle-2 was `"All good" 2026-05-20`. The 04-VERIFICATION.md `human_verification[0].evidence` field MUST contain the verbatim operator ack from the 04-06 Task 4 SUMMARY — matching ONE of: `approved`, `All good`, `APPROVED`, `approved by`, `operator ack`, `all good`. The Task 1 `<verify><automated>` greps the file for these patterns to ensure the field is a REAL ack, not a placeholder string like "TBD" or "TODO" or "<verbatim>".

Frontmatter sketch for 04-VERIFICATION.md:
```yaml
# (yaml document marker omitted for parser-compat)
phase: 04-harden-clean-up-optional
verified: 2026-05-21T<HH-MM-SS>Z
status: passed
score: 4/4 ROADMAP success criteria + 3/3 audit P1 polish items + 5/5 hardening items (setimmediate + dead-code + generate-icons + A29 race + cursor verify + dark-logo)
overrides_applied: <count>
re_verification:
  milestone: v1.0.0
  previous_phase_status: 3/3 phases complete
  previous_phase_score: 5/5 SPEC §10 + 9/9 acceptance criteria with 4 overrides
  gaps_closed:
    - "ROADMAP SC #1 — SW state persistence via A33 harness assertion (Plan 04-04)"
    - "ROADMAP SC #2 — fetch + XHR network_error via A34 harness assertion (Plan 04-05) + P1 #11 unit tests (Plan 04-01)"
    - "ROADMAP SC #3 — generate-icons.cjs rename verified (Plan 04-02)"
    - "ROADMAP SC #4 — dead-code grep regression-pinned (Plan 04-02)"
    - "Audit P1 #11/#14/#15 — content-script polish tests GREEN (Plan 04-01)"
    - "setimmediate polyfill — dist/ SW chunk grep 0 hits 'new Function' (Plan 04-02)"
    - "A29 flake — strict-sentinel rewrite + 5/5 PASS stress (Plan 04-03)"
    - "Cursor visibility — verified shipped at recorder.ts:285 + 01-07-SUMMARY back-patched (Plan 04-06; RESEARCH Finding 4)"
    - "Dark-logo currentColor strategy — inline-SVG injection landed (Plan 04-06; operator ack received)"
    - "ROADMAP backfill Plans 01-08..01-13 — verified per D-P4-05 (this plan)"
override_notes:
  - dimension: "<per-criterion override per Phase 4 needs>"
    initial_status: "<...>"
    override_to: "<...>"
    rationale: |
      <verbatim memory-citation block>
human_verification:
  - test: "dark-mode operator visual aesthetic on welcome hero"
    expected: "mark legible on OS dark-mode rendering surface"
    why_human: "Aesthetic contrast judgment — UI-SPEC §'Manual-Only Verifications' acceptance criterion #6; canonical operator-empirical case per feedback-trust-harness-over-manual-uat.md"
    evidence: "Plan 04-06 Task 4 operator ack <VERBATIM_ACK_FROM_PLAN_04_06_SUMMARY>"
deferred:
  - truth: "rrweb 2.0.0-alpha.4 -> stable v2 upgrade"
    addressed_in: "v1.1 / v2 maintenance milestone"
    evidence: "D-P3-03 + D-P4-01 charter exclusion + alpha-pin stable across 13 plans + 35/35 UAT GREEN"
  - truth: "Programmatic SW-realm RAM measurement via chrome.devtools Memory API"
    addressed_in: "v1.1 / v2 maintenance milestone"
    evidence: "D-P3-04 + D-P4-01 charter exclusion; A32 best-effort + chrome://memory-internals + alpha-distribution coverage accepted"
  - truth: "REQ-password-confidentiality v2 candidate"
    addressed_in: "v1.1 / v2 maintenance milestone IF charter reverses"
    evidence: "D-P3-02 + D-P4-01 charter exclusion 2026-05-20 — 'we don't care about privacy hardening'"
  - truth: "Alpha-tester findings integration"
    addressed_in: "post-v1 maintenance window"
    evidence: "D-P4-04 charter — operator handles alpha signal out-of-band"
# (yaml document marker omitted for parser-compat)
```
The placeholder `<VERBATIM_ACK_FROM_PLAN_04_06_SUMMARY>` MUST be replaced with the actual operator response captured in 04-06-SUMMARY.md (e.g., "approved 2026-05-21" or "All good 2026-05-21" or longer verbatim quote). The Task 1 verify-gate greps for the ack literal to ensure the placeholder is NOT left intact.
</interfaces>
</context>

<tasks>

<task type="auto">
  <name>Task 1: Write 04-VERIFICATION.md aggregator (NEW)</name>
  <files>.planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md</files>
  <read_first>.planning/phases/01-stabilize-video-pipeline/01-VERIFICATION.md, .planning/phases/02-stabilize-export-pipeline/02-VERIFICATION.md, .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-VERIFICATION.md, all Plan 04-01..04-06 SUMMARY files (.planning/phases/04-harden-clean-up-optional/04-0?-SUMMARY.md — produced by the prior plans), specifically Plan 04-06 SUMMARY for the verbatim operator ack quote (REVISION iter-2 WARNING 4 — required for human_verification[0].evidence)</read_first>
  <action>
    1. Read the 3 precedent VERIFICATION.md files (Phase 1 + 2 + 3) ONCE each to extract the canonical frontmatter shape + body section structure. Read each Plan 04-01..04-06 SUMMARY.md once to extract evidence (commit refs, test counts, harness assertion numbers, pre/post measurements). **Specifically extract the verbatim operator ack quote from Plan 04-06 Task 4 SUMMARY** — Task 1 verify-gate requires the ack literal to be present in human_verification[0].evidence.

    2. Create `.planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md` with frontmatter per the sketch in `<interfaces>` above. Replace placeholder fields with actual values from the Plan 04-01..04-06 SUMMARYs:
       - `verified:` — current ISO timestamp (`date -u +%Y-%m-%dT%H:%M:%SZ`)
       - `score:` — fill in actual counts from SUMMARYs
       - `re_verification.gaps_closed[*]` — bullet per closed gap with Plan + commit citation
       - `override_notes` — populate if any T5 override applied to a Phase 4 criterion (e.g., the operator-empirical UAT for dark-logo can be cited as harness-coverage-augmented rather than override; depends on Plan 04-06 outcome).
       - `human_verification[0].evidence` — verbatim operator ack quote from Plan 04-06 Task 4 SUMMARY (REVISION iter-2 WARNING 4 — MUST contain one of: `approved`, `All good`, `APPROVED`, `approved by`, `operator ack`, `all good` — verified by Task 1 verify-gate grep).
       - `deferred[]` — 4 v1.1/v2 items per CONTEXT Deferred Ideas + the alpha-distribution item per D-P4-04.

    3. Body sections (after frontmatter):
       - `## Per-Requirement Scorecard` — Phase 4 has no new REQs but rows for the 4 ROADMAP SCs + the 5 hardening items (per `score:` line). Each row: {Item, Acceptance, Status, Evidence, Plan + commit}.
       - `## Cross-Cutting Gates`:
         - vitest count: 171 (Phase 3 baseline) -> 171 + new Wave 0 tests from Plans 04-01 + 04-02 + 04-06 = approximately 171 + 8 + 2 + 4 = 185 GREEN (verify exact count via final `npm test -- --run` invocation).
         - UAT harness count: 33 -> 35 GREEN (Plans 04-04 A33 + 04-05 A34 added; Plan 04-03 rewrote A29 in-place, count unchanged).
         - Tier-1 FORBIDDEN_HOOK_STRINGS: 12 unchanged (Phase 4 introduced no new __MOKOSH_UAT__-gated symbols per CONTEXT Claude's Discretion).
         - Pre-checkpoint bundle gates: 6/6 PASS (Plan 04-02 flipped Gate 2 polarity 1 -> 0 hits `new Function` in canonical `dist/assets/index.ts-*.js` glob — REVISION iter-2 BLOCKER 1 mitigation in Plan 04-06).
       - `## Operator-Empirical Acks (verbatim + commit refs)`:
         - Append the Plan 04-06 Task 4 ack from the SUMMARY (verbatim quote + date + commit hash). REVISION iter-2 WARNING 4: this line MUST contain the actual operator response (e.g., `> approved 2026-05-21` or `> All good 2026-05-21`) — NOT a placeholder.
       - `## Deferred Items` — table mirroring frontmatter `deferred:`.
       - `## ROADMAP backfill verification (D-P4-05)` — list of Plans 01-08..01-13 row presence + any newly-added rows. If all rows are already present (per PATTERNS.md noting lines 90-95 exist), this section's content is "Verified — no row additions needed; plan-checker flag #4 closed".

    4. Commit: `docs(04-07): Phase 4 closure — 04-VERIFICATION.md aggregator (4/4 ROADMAP SCs + N/N hardening items)`.
  </action>
  <verify>
    <automated>test -f .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md && grep -cE '^## ' .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md; grep -c 'Plan 04-0' .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md; grep -cE 'approved|All good|APPROVED|approved by|operator ack|all good' .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md</automated>
  </verify>
  <acceptance_criteria>
    - File exists at `.planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md`.
    - Frontmatter valid (parseable YAML; required fields present per precedent).
    - File has >= 5 top-level `## ` sections (Per-Requirement Scorecard + Cross-Cutting Gates + Operator-Empirical Acks + Deferred Items + ROADMAP backfill verification).
    - File >= 120 lines.
    - `grep -c 'Plan 04-0' .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md` returns >= 6 (one per Plan 04-01..04-06 evidence citation).
    - `grep -c 'commit' .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md` returns >= 6.
    - REVISION iter-2 WARNING 4 — Operator ack gate: `grep -cE 'approved|All good|APPROVED|approved by|operator ack|all good' .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md` returns >= 1. This proves the `human_verification[0].evidence` field contains a real operator ack literal (not the `<VERBATIM_ACK_FROM_PLAN_04_06_SUMMARY>` placeholder or "TBD"). The pattern set matches both lowercase ("approved", "all good") and titlecase/uppercase ("All good", "APPROVED") variants per the prior-art ack format from Plan 01-10 cycle-2 ("All good" 2026-05-20) AND the canonical 04-06 Task 4 `<resume-signal>` expectation ("approved" verbatim).
  </acceptance_criteria>
  <done>04-VERIFICATION.md created with frontmatter + 5+ body sections + 6+ plan citations + verbatim operator ack + deferred items. Commit: `docs(04-07): Phase 4 closure — 04-VERIFICATION.md aggregator`.</done>
</task>

<task type="auto">
  <name>Task 2: Marker flips — REQUIREMENTS.md + ROADMAP.md + STATE.md + PROJECT.md</name>
  <files>.planning/REQUIREMENTS.md, .planning/ROADMAP.md, .planning/STATE.md, .planning/PROJECT.md</files>
  <read_first>.planning/REQUIREMENTS.md, .planning/ROADMAP.md, .planning/STATE.md (frontmatter only), .planning/PROJECT.md (Validated section), .planning/phases/03-spec-10-smoke-verification-dom-event-log-verification/03-VERIFICATION.md (precedent for closure marker style)</read_first>
  <action>
    Edit 1 — REQUIREMENTS.md (verification status notes):
    - Phase 4 has NO new REQ entries. The 4 ROADMAP success criteria verify against existing REQs (Phase 1-3). Optional: append a "Phase 4 verification" note to each REQ touched by a Phase 4 SC (per Phase 1/2/3 precedent of inline closure citations).
    - Surgical edits per REQ:
      - REQ-video-ring-buffer: append "Phase 4 closure 2026-05-21: ROADMAP SC #1 SW state persistence verified via Plan 04-04 A33 (UAT 5-min idle + worker.close() empirical PASS; archive video size > 100 KB after SW eviction)."
      - REQ-user-event-log: append "Phase 4 closure: Audit P1 #11/#14/#15 polish + ROADMAP SC #2 fetch+XHR empirical (Plan 04-01 + Plan 04-05 A34) GREEN."
      - REQ-rrweb-dom-buffer: append "Phase 4 closure: A29 cs-injection-world rewrite + strict-sentinel filter (Plan 04-03); flake closed 5/5 PASS."
      - REQ-install-clean: append "Phase 4 closure: ROADMAP SC #3 generate-icons.cjs rename + SC #4 dead-code grep verified (Plan 04-02)."

    Edit 2 — ROADMAP.md (Phase 4 row [x] + backfill verification):
    - Locate the Phase 4 entry under `## Phases` (top-level list). Flip `- [ ] **Phase 4: Harden + clean up** _(optional)_ ...` to `- [x] **Phase 4: Harden + clean up** _(optional)_ — CLOSED 2026-05-21 via Plan 04-07 closure (4/4 ROADMAP SCs + N/N hardening items GREEN; 04-VERIFICATION.md at .planning/phases/04-harden-clean-up-optional/04-VERIFICATION.md). UAT 33 -> 35 GREEN; vitest 171 -> >=185 GREEN; Pre-checkpoint bundle gates 6/6 PASS (Gate 2 polarity flipped per Plan 04-02). Operator empirical ack 2026-05-21 (Plan 04-06) for dark-mode visual aesthetic.`
    - Locate the Phase 4 details section. Add `**Plans**:` list with rows for 04-01..04-07 (mirror Phase 3 plan-row block):
      - [x] 04-01-PLAN.md — Audit P1 polish #11 + #14 + #15 (TDD; 3 unit tests + 3 surgical edits in src/content/index.ts)
      - [x] 04-02-PLAN.md — Build/CSP hygiene (setimmediate polyfill + dead-code grep + generate-icons.cjs rename)
      - [x] 04-03-PLAN.md — A29 cs-injection-world rewrite (strict-sentinel; 5/5 PASS stress)
      - [x] 04-04-PLAN.md — A33 SW state persistence harness assertion (5-min idle + worker.close() CDP; ROADMAP SC #1)
      - [x] 04-05-PLAN.md — A34 fetch + XHR network_error empirical (ROADMAP SC #2; validates Plan 04-01 P1 #11 end-to-end)
      - [x] 04-06-PLAN.md — Dark-logo currentColor + cursor visibility verification + 01-07-SUMMARY back-patch (UI-SPEC; operator empirical ack)
      - [x] 04-07-PLAN.md — Phase 4 closure aggregator (this plan)
    - Update the `## Progress` table row for Phase 4: change `0/TBD` to `7/7` and set Status to CLOSED 2026-05-21.
    - Verify Plans 01-08..01-13 rows exist in the Phase 1 plan-row block (per D-P4-05). Per PATTERNS.md they ARE at lines 90-95; just verify visually + document in 04-VERIFICATION.md.

    Edit 3 — STATE.md (frontmatter + Current Position + Session Continuity):
    - Frontmatter:
      - `progress.completed_phases: 4` (was 3).
      - `progress.total_plans: 30` (was 23; +7 from Phase 4) — verify the exact count.
      - `progress.completed_plans: 30` (was 23; +7).
      - `progress.percent: 100`.
      - `status: ready_for_v1_close` OR `status: v1_closed` depending on whether the v1 close is a separate ceremony.
      - `stopped_at: 'Phase 4 closed 2026-05-21; v1 milestone ready for alpha re-distribution (per D-P4-04 ack out-of-band)'`.
      - `last_updated:` — current ISO timestamp.
    - Current Position block: update narrative to reflect Phase 4 closure + milestone v1 close gate (alpha redistribution).
    - Performance Metrics section: append Phase 04 row to the "By Phase" table with the plan count + cumulative time.
    - Session Continuity log: prepend a new entry for the current session "2026-05-21 Phase 4 closed end-to-end via 7 plans (04-01..04-07); v1 milestone ready for alpha redistribution".

    Edit 4 — PROJECT.md (Validated section + DEC closure citations):
    - Locate the `## Validated` section. Append a Phase 4 entry summarizing the hardening + audit-residual closure + visual polish.
    - DEC-* table: if any DEC was touched by Phase 4 plans (likely none — Phase 4 is hardening, not new decisions), append closure citations. Otherwise no change.
    - Active section: update Phase 4 status to CLOSED; remove from active backlog.

    Verify gates:
    - `git status` — only the 4 docs + 1 new VERIFICATION.md are dirty (no inadvertent code changes).
    - Each edit lands as a separate atomic commit OR one combined closure commit per the closure convention (Phase 1 + 2 + 3 precedent used 1 commit per marker file; Phase 4 should mirror).
  </action>
  <verify>
    <automated>grep -c 'Phase 4.*CLOSED\\|\\[x\\] \\*\\*Phase 4' .planning/ROADMAP.md; grep -c 'completed_phases: 4' .planning/STATE.md; grep -c 'Phase 4 closure' .planning/REQUIREMENTS.md</automated>
  </verify>
  <acceptance_criteria>
    - `grep -c '\\[x\\] \\*\\*Phase 4' .planning/ROADMAP.md` returns >= 1 (Phase 4 row flipped).
    - `grep -c 'Phase 4 closure' .planning/REQUIREMENTS.md` returns >= 3 (4 REQ closure citations).
    - `grep -c 'completed_phases: 4' .planning/STATE.md` returns 1.
    - `grep -c 'Phase 4' .planning/PROJECT.md` returns >= 1 (Validated section entry).
    - ROADMAP.md `## Progress` table updated for Phase 4 row.
    - Plans 01-08..01-13 rows verified present per D-P4-05 (no addition needed if PATTERNS.md mapping holds; otherwise add per re-audit).
  </acceptance_criteria>
  <done>4 marker files updated; Phase 4 closure markers GREEN. Commits: `docs(04-07): closure markers — REQUIREMENTS + ROADMAP + STATE + PROJECT for Phase 4 + v1 close`.</done>
</task>

</tasks>

<threat_model>
## Trust Boundaries

| Boundary | Description |
|----------|-------------|
| Phase 4 plan SUMMARYs -> 04-VERIFICATION.md aggregator | aggregator reads each SUMMARY's reported counts + commit refs verbatim; no fabrication; if a SUMMARY is missing or incomplete, the aggregator MUST flag rather than fill defaults |
| 04-VERIFICATION.md -> alpha redistribution -> tester confirmation | The 04-VERIFICATION.md scorecard is what the operator references when deciding whether the v1 build is ready for alpha tester redistribution per D-P4-04; misleading scorecard rows could cause premature alpha-build sign-off |

## STRIDE Threat Register

| Threat ID | Category | Component | Disposition | Mitigation Plan |
|-----------|----------|-----------|-------------|-----------------|
| T-04-07-01 | Repudiation | aggregator could over-claim closure (e.g., mark ROADMAP SC #2 GREEN when only fetch is empirically verified but XHR is not) | mitigate | Each scorecard row MUST cite specific UAT assertion ID (e.g., "A34.3 XHR 404 -> network_error" or "A34.5 XHR meta.status === 404") + commit hash; absence of an assertion = row marked PARTIAL or YELLOW with explanation |
| T-04-07-02 | Tampering | a docs-only commit could in theory be conflated with a code commit; the closure ceremony must be docs-pure | accept | Verification gate `git diff --stat HEAD~1 HEAD` on closure commits should show only `.planning/` files dirty; pre-commit check |
| T-04-07-03 | Repudiation | alpha redistribution decision is non-automated (per D-P4-04 user handles out-of-band); 04-VERIFICATION.md is advisory not gating | accept | Documented in scorecard + STATE.md status field clarifies v1 close vs CLOSED-PENDING-ALPHA distinction |
| T-04-07-04 | Repudiation (REVISION iter-2 — WARNING 4) | `human_verification[0].evidence` field could be left as a placeholder (e.g., `<verbatim>` or `TBD`) — the 04-VERIFICATION.md "passes" gates but contains no real operator ack, masking a missing closure step | mitigate | Task 1 `<verify><automated>` greps for the ack literal (`approved`, `All good`, `APPROVED`, `approved by`, `operator ack`, `all good`) in the file; count >= 1 required to pass the gate. The pattern set covers both the canonical Plan 04-06 `<resume-signal>` expectation ("approved" lowercase) AND the historical Plan 01-10 cycle-2 ack format ("All good" titlecase). If the operator response uses a non-canonical phrasing, the SUMMARY for 04-06 still records it verbatim; the executor extends the grep alternation to match. |
</threat_model>

<verification>
- 04-VERIFICATION.md exists with valid frontmatter + 5+ body sections + 6+ plan-evidence citations + 120+ lines.
- ROADMAP.md Phase 4 row flipped [x] with closure date + plan-row block enumerating 04-01..04-07.
- ROADMAP.md `## Progress` table updated for Phase 4 (count + status).
- REQUIREMENTS.md: 3-4 REQ closure citation lines added (no new REQs).
- STATE.md: `progress.completed_phases: 4` + `progress.percent: 100` + `stopped_at` updated + Session Continuity entry prepended.
- PROJECT.md: Validated section updated for Phase 4 hardening closure.
- No code or test changes in this plan; `git diff --stat HEAD~1 HEAD` shows only `.planning/` files modified.
- All Phase 4 plan SUMMARY files exist (Plans 04-01..04-06; this plan creates its own SUMMARY at completion).
- REVISION iter-2 WARNING 4: 04-VERIFICATION.md contains a verbatim operator ack literal (one of `approved`, `All good`, `APPROVED`, `approved by`, `operator ack`, `all good`); verified by Task 1 `<verify><automated>` grep count >= 1.
</verification>

<success_criteria>
- 04-VERIFICATION.md aggregator created (Task 1).
- 4 marker files updated for Phase 4 closure (Task 2).
- Plans 01-08..01-13 ROADMAP backfill verified (D-P4-05).
- v1 milestone status updated: CLOSED-PENDING-ALPHA OR CLOSED.
- All Phase 4 success criteria from the ROADMAP cited as GREEN with evidence.
- Operator empirical ack from Plan 04-06 cited verbatim in 04-VERIFICATION.md (REVISION iter-2 WARNING 4 — grep-pinned).
- Deferred items table carries forward v1.1/v2 items per CONTEXT.
- No code/test changes (docs-only ceremony).
</success_criteria>

<output>
After completion, create `.planning/phases/04-harden-clean-up-optional/04-07-SUMMARY.md` capturing:
- 04-VERIFICATION.md created (final line count + section structure)
- 4 marker file diffs (REQUIREMENTS + ROADMAP + STATE + PROJECT)
- D-P4-05 ROADMAP backfill outcome (rows already present per PATTERNS.md mapping; verified via grep)
- v1 milestone status flip (CLOSED-PENDING-ALPHA OR CLOSED — depending on alpha redistribution sequencing)
- Closure commit refs
- Final tally: UAT 35/35 GREEN; vitest >=185 GREEN; pre-checkpoint bundle gates 6/6 PASS; FORBIDDEN_HOOK_STRINGS at 12.
- Verbatim operator ack from Plan 04-06 Task 4 (REVISION iter-2 WARNING 4 — grep-verified at Task 1 closure).
- Next steps for the operator: alpha redistribution + v1.0 tag + release notes (separate workstream per D-P4-04).
</output>
</content>
