# Mode Extension V1 Implementation Plan **Status:** Implemented. The original V1 implementation (session persistence via `mode-state` entries) was revised mid-flight. See `V1.md` for the implemented design (memory-only state, themed `setHeader` UI, `accent` frontmatter). ## Implementation summary What was built: - `index.ts` — pure helpers (`frontmatterSplit`, `parseModeMarkdown`, `loadModes`, `modePromptAddition`, `normalPromptAddition`, `buildHeader`) plus runtime glue (`switchMode`, `modeOff`, `applyMode`, `showStatus`). - Tests: `unit.test.ts` (pure helpers + header factory + no-ui shutdown), `harness.test.ts` (real pi runtime), `coverage.test.ts` (fake runtime + 100% branch coverage gate). - UI: `ctx.ui.setHeader(buildHeader(mode))` replaces `setStatus`. Restoring built-in header via `setHeader(undefined)` on off/shutdown. - Frontmatter additions: `accent: AccentColor`. - Dropped: `mode-state` session entries, `latestModeState`, `persist`, `session_compact` handler, branch restore on `session_start`, baseline tracking, `setStatus`, `setTitle`, `setWidget`. - Updated: `V1.md`, `V2.md` (V2's `color` frontmatter moved to V1 as `accent`), `SPEC.md`, `README.md`. ## Verification ```bash mise run test mise run lint ``` Both pass. See `git log -- extensions/mode` for the implementation commit history.