# 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 widget UI, `accent` frontmatter). ## Implementation summary What was built: - `index.ts` — pure helpers (`frontmatterSplit`, `parseModeMarkdown`, `loadModes`, `modePromptAddition`, `normalPromptAddition`, `buildWidget`) plus runtime glue (`switchMode`, `modeOff`, `applyMode`, `showStatus`). - Tests: `unit.test.ts` (pure helpers + widget factory + picker + no-ui shutdown), `harness.test.ts` (real pi runtime), `coverage.test.ts` (fake runtime branch coverage). - UI: `ctx.ui.setWidget("mode", buildWidget(mode))` shows active mode. Clearing uses `setWidget("mode", undefined)` on off/shutdown. - Frontmatter additions: `accent: AccentColor`. - Dropped: `mode-state` session entries, `latestModeState`, `persist`, `session_compact` handler, branch restore on `session_start`, `setTitle`. - 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.