# 100 — Implementation roadmap

Standa authorized implementation and Matrix demo testing in D37. The roadmap below remains the acceptance contract; current completion/evidence is in `110`. Work in narrow reviewable phases. Paid model testing follows his successful demo test (D38), and deployment requires a separate request. Do not wait for a complete unrelated Millionaire cleanup.

## P0 — Reconcile the live baseline

Read `AGENTS.md`, this plan and current `git status`; inspect active canonical entry/modal/generator/settings/probe files. Identify unrelated edits and any parallel Millionaire refactor. Confirm the current modern design path and the remaining classic compatibility boundary.

Record a small change map: files to touch, exact shared extractions, current control IDs, baseline screens/goldens available, and which narrow checks apply. Capture current generator output for comparison without launching Kodi.

Gate: implementation scope is explicit; public entry/source behavior is understood; no code from the large controller will be copied. Update `020-current-state.md` if source paths have moved and `110` with the actual baseline/first patch target.

## P1 — Content, pure rules, and authored demo

Create `story/content.py` and `engine.py`, one set of constants/normalized types, strict pack validation, and the life/terminal transitions. Author/review Matrix Easy/Medium/Hard JSON using `080`. Keep user-facing narrative Czech and code/docs English.

Run targeted engine/content checks: every pack count/group, immediate evaluation, survival/third error, wrong final survival/final zero-life precedence, replay reset and illegal input handling.

Gate: real production validator accepts the reviewed packs; pure engine passes meaningful behavioral checks; no provider/Kodi dependency, save-game code, or runtime demo-generation framework exists.

## P2 — Shared modal and playable modern Story

Extract only XML tokens/primitives genuinely needed by both modes, preserving Millionaire defaults/output. Add Story screens to the existing generated modern XML, a pure Story view and small Story adapter. Introduce the narrow screen/retire/focus shell seam in the existing adapter and modal.

Build common title-mode behavior first with explicit offline Matrix source context. Implement lives/chapter panel/narrator/A–D/reveal/terminal screens, field clearing, immediate Continue, and focus. Use silent voice. Generate/parse XML and drive the real modal headlessly.

Gate: Matrix is playable in all difficulties through the real shared modal; no hidden lifeline focus, countdown, feedback inference or automatic advance; no copied dialog/generator/controller; affected Millionaire headless regressions pass. Visual verification stays explicitly pending until authorized.

## P3 — Entry convergence and preference handling

Add `game_last_mode` and independent `story_difficulty`, cs/sk/en strings and mode-scoped settings rows. Audit the actual caller list, fix only missing identity/scope/source fields, and preserve routes/public signatures.

Handle person/mixed exclusions, missing/unknown demo exclusion, saved-mode fallback without overwrite, original demo random behavior, and playback notification launch over continuing video. The initial Matrix-only limit is superseded by the full catalog in `140` under D42/D43. Resolve the narrow modern/classic launch boundary without deleting legacy files/settings.

Gate: targeted subject/source/preference checks cover movie/series/episode paths; all approved existing modern launches expose the same selector, metadata and demo intent survive switches, and Millionaire behavior is preserved. Record touchpoint outcomes instead of merely listing files edited.

## P4 — Whole-pack AI and shared optional voice

Implement one-shot `story/ai.py` and `prompts.py`, configured provider reuse, tools off, JSON contract, one transient usage session and no content memory. Bind the adapter's generation worker and strict validation/error/retry flow. Protect late worker/TTS results on close/replay.

Reuse existing voice helpers through the narrator binding and existing toggle semantics. Keep demo tests silent. Render/check prompts offline and use provider mocks; no live API request is needed to complete local behavior.

Gate: one stubbed generation per explicit attempt, zero per-scene calls, unavailable/invalid/truncated/failure flows safe, cancellation tested, selected scope/limits present, no raw pack persistence or duplicate accounting. Paid model-content quality is reported separately if requested.

## P5 — Focused final acceptance

Run the remaining targeted scenario/regression matrix once, inspect the code diff for ownership/reuse/cleanup, and perform authorized Kodi captures/comparisons. Fix actual findings, updating lessons with evidence. Check packaging scope if relevant without deploying.

Present a short user test checklist; record actual acceptance. Update feature/harness documentation and relevant skills only for implemented behavior. Mark phases individually, with GUI or paid checks clearly pending if not run.

Gate: all release acceptance requirements in `000-index.md` are met, test evidence names the code state tested, handoff has no hidden unresolved issue, and Standa has accepted the feature. No commit/deploy unless explicitly requested.

## Pause/restart protocol

Before ending any implementation turn, record the last completed substep, exact changed files, commands/results, unresolved issue, next concrete action, and authorization scope in `110`. A new agent must be able to continue from that record without the chat transcript.

If interrupted mid-phase, retain an honest “in progress” status and make local changes reviewable. Do not mark a phase done to simplify the handoff. If an approved product rule conflicts with current code or requires a genuine new choice, explain the concrete conflict and ask Standa in final chat; do not silently relax the requirement.
