# 110 — Progress and handoff

This is the **live implementation record**. Update it at phase boundaries and before handing off. Product decisions live in `900`; causes/lessons live in `120`. Keep their roles separate and link rather than duplicate long descriptions.

## Current snapshot — 2026-10-13

- Built: the complete agreed Story feature, all 29 fixed demo counterparts (87 packs) including all eight Harry Potter movies, shared modern selector/settings/modal, separate pure engine/view, fresh one-shot AI boundary, shared cancellable voice and mode-aware demo harness. Exact scopes and current catalog evidence are in `140-demo-catalog.md` and `150-harry-potter-demos.md`.
- Authorization: D37 implementation/Matrix demo checks; D39 resumed autonomous completion after deploy/pause; D41 demo acceptance and paid optimization. D42/D43 authorize the initial complete demo catalog; D44 adds the full Harry Potter movie collection in both modes. All follow-ups are complete locally. No current paid call, GUI/device test, real TTS, commit or new deploy.
- Published on request: initially addon **2.1.64** / skin **1.3.51**, then final correction **2.1.65** / skin **1.3.52**, both via `python3 scripts/release.py publish`. The current script result is in `.agents/state/release.json`. Both published ZIP hashes and Story/XML assets were checked against source; translations were verified in the first package and remain unchanged.
- Offline evidence: 16 Story behavior tests, one transport test containing five mocked provider cases plus two budget/timeout overrides, and two privacy/accounting review tests. Existing Millionaire entry/settings/AI-content/modern/demo/golden checks passed (94 tests). Latest lifecycle changes were followed by fresh entry and golden runs.
- Live evidence: actual Medium 15-question win with two errors, Easy 10-question win with two errors including the last answer, and Hard 20-question third-error defeat at the last answer. Final Easy/Hard reports and captures are in `scripts/game_harness/out/story-qa-final/`; earlier Medium evidence is listed below.
- Option cap is now 30 characters, retaining the existing answer font. Narrow wrong/correct result cards use existing `font27`. The compact rules translation was shortened after observing clipping. Earlier frames are historical; final rules/layout evidence is in `story-qa-final/layouts/`.
- No live test processes remain from the overnight runs. Old exec handles 82410, 26460 and 62624 completed; do not poll/restart them as active jobs.
- Preserve all unrelated dirty files and the local baseline snapshot `/var/folders/xd/kvqb38xx67n40mpbk1tdqm680000gn/T/milionar-story-baseline-155u03vo/` while it still exists.
- Standa confirmed his successful test and explicitly authorized real Luna/Sonnet tests (D41). The former blocked condition was resolved by his actual chat reply; that original goal was subsequently completed. The later demo catalog request is a completed separate follow-up, not a new goal tool invocation.
- Current phase: completed implementation and measured optimization; see `130-ai-experiments.md`. Generic compact v6 is final. Luna/Sonnet repeatedly failed factual review despite valid JSON, and higher efforts often produced no pack. Sol medium is recommended for Story after three further fresh 10/15/20 samples passed structural and manual checks with documented compression notes. No universal accuracy promise; ordinary preparation remains one inference with no TTS/search/persistent settings change.
- Luna/Sonnet comparison is complete: 36 actual inferences / 35 attempts, known computed cost $3.050075 plus two unknown timeout charges. Sonnet xhigh/max returned no full usable pack even at 32K/64K. v6 fresh 10/15/20 high packs passed structural checks but failed manual facts/order/ambiguity checks.
- Final accounting: **41 inferences / 40 attempts**, known computed cost **$3.305965** plus the two unknown timeout charges above. Sol/Opus controls and fresh Sol confirmation cases completed; no review jobs remain. Preserve the diagnostics/`comparison.json` as test evidence, never reusable gameplay content.
- Unpublished edits: `story/{prompts,ai}.py`, review additions to existing harness, optional call-specific timeout in OpenAI/Anthropic clients, affected tests/documentation/skills. Client/global defaults remain unchanged. Story high/xhigh/max on OpenAI/Anthropic now gets 32K/300 s; other Story configurations keep 16K and client defaults.
- Existing `story-review` command reuses production AiSource/provider/validator/engine. It reports schema/local-play checks, tokens/cost/time, and optional diagnostic content. It does not claim automatic factual proof or feed saved responses back into gameplay.
- Latest follow-up evidence: eight catalog tests cover all 87 packs and real modal wins/replays/mode round-trips, 261 pure terminal scenarios, exact scope preservation and prohibited socket/AI/TTS calls. Story 16, Millionaire entry 9/demo 33/golden 1 pass again. All seven new Harry Potter titles completed CLI games in both modes, including all Millionaire lifelines and Story final-life precedence. Three shared Millionaire intros retain estimated scrolling warnings; exact evidence is in `150`. All 90 pre-D44 JSON hashes remain identical. Catalog expansion and earlier optimization are unpublished; next exact action is deploy through the prescribed release script only if Standa requests it.

## Phase evidence board

| Phase | State | Evidence / remaining |
|---|---|---|
| P0 | Done | Current canonical entry/legacy boundaries inspected; scoped baseline saved |
| P1 | Done | Three validated packs, counts/chapters, lives and terminal precedence tested |
| P2 | Implemented/tested | Actual 10/15/20-question Kodi flows, result/life frames, navigation; final layouts below |
| P3 | Implemented/tested | Mode/difficulty/source and metadata round-trip tests; focused caller regression |
| P4 | Completed measured optimization | Actual cases/manual review in `130`; selected fresh Sol 10/15/20 trial; targeted transport/privacy checks pass |
| P5 | Completed for agreed text-only scope | Standa accepted demo; selected Sol medium trial verified at 10/15/20; limitations/release status documented |
| P6 | Completed catalog follow-up locally | 22 titles / 66 authored packs; all-pack offline modal and rules checks; scopes and commands in `140` |
| P7 | Completed Harry Potter follow-up locally | Seven missing movies in both modes; current total 29 titles / 87 Story packs, complete eight-film collection and original data preserved; evidence in `150` |

## Next-agent checklist

1. Read repository instructions, index, this record, and decisions; communicate briefly in Czech.
2. Confirm the user's current authorization from actual chat instructions, not tool acceptance or this template.
3. Inspect the current versions of shared files and `git status`. Existing Millionaire/skin/AI work may have moved since 2026-10-12.
4. Keep the current source of truth and avoid a parallel entry/modal/subject/generator implementation.
5. Select the next incomplete roadmap substep; continue it rather than regenerate the entire plan or restart completed phases.
6. Run only the targeted authorized verification justified by that step.
7. Record concrete evidence and the next action here before stopping.

## Files/ownership ledger

Only the related edits within existing files belong to this task. Their entire dirty contents do not.

| File / group | Changed by this task | Purpose | Related tests / integration dependency |
|---|---|---|---|
| `docs/plan/story-game/*.md`, `docs/features/014-story-game.md` | Yes | Specification, implementation map, evidence and handoff | Local documentation checks |
| `wcs/games/story/*.py` | New | Pure contract/engine/view, source/prompt, adapter | `test_story_game.py` |
| `resources/demo/story/matrix/*.json` | New | Fixed complete movie packs | Validator, headless/live demo |
| `resources/demo/story/<other-id>/*.json`, `scopes.json` | Added under D42/D43 | 63 additional fixed packs and one eight-episode metadata overlay; Matrix preserved | `test_story_demo_catalog.py`, baseline hashes, three CLI reports |
| `resources/demo/millionaire/titles/harry-potter-[2-8].json`, corresponding Story folders | Added under D44 | Seven nine-question quiz files and 21 whole-film Story packs, matching metadata/art; first movie preserved | Updated existing catalog checks, all-mode CLI runs, 90 baseline hashes |
| `DialogMilionarGame.py`, `MillionaireMyTVAdapter.py` | Related edits | Shared selection, screen/retirement, native closure | Story modal tests, Millionaire entry/golden |
| `designs.py`, `game_settings.py`, `millionaire/{__init__,subject}.py`, `demo/launch.py` | Related edits | IDs, preferences, canonical source/metadata routing | Entry/settings/demo tests |
| `gen_modern_game.py`, new `story_screens.py`, generated modern XML | Related edits/new assembly | Shared primitives, Story screens, explicit mode visibility | Modern tests, generator equality, Kodi captures |
| `resources/settings.xml`, cs/sk/en addon strings | Related edits | Hidden remembered mode, separate difficulty, UI labels | Settings/XML/new-ID checks |
| `voice.py`, `millionaire_tts.py` | Related edits | Existing voice reuse and ownership/cancellation | Mocked late-voice/video-preservation cases |
| Five existing provider clients, `AIHandler.py`, new `response_json.py`, `usage_view.py` | Related edits | Optional output-budget/privacy, shared JSON extraction, usage label | Five mocked clients, usage-view tests |
| Existing skin/library/MyTV/search/playback launch callers | Related launch blocks only | Preserve known title/year/art/TMDb/episode fields | Entry round-trip, library clicks checks |
| Existing probe/driver/CLI/golden; new `game_harness/story.py` | Related edits/new scenarios | Actual native controls, Story snapshots and count/life checks | Headless/live reports, old Millionaire goldens |
| New Story tests; existing stubs/modern/settings tests | Related edits | Meaningful behavior coverage, minimal JSONRPC stub | Isolated test scripts |
| Relevant skill instructions | Small documentation edits | Describe implemented Story route, limits and paid-test boundary | Skill frontmatter validator |

## Verification ledger

For each actual check record date, command/scenario, result, code state or relevant changed files, and evidence path. “Planned”, “not run”, and “passed” are different states. Do not inherit stale pass claims from another agent or an old feature document.

| Check | Actual result | Evidence |
|---|---|---|
| Story behavior | PASS, 16 tests, 2026-10-13 | `python3 tests/test_story_game.py`; all difficulties/replay, errors, cancellation, scope, preference, voice/native closure and scoped high-effort budget |
| Complete authored catalog | PASS, 8 tests, 87 packs/modal wins/replays, 261 pure terminal cases, no socket/AI/TTS | `python3 tests/test_story_demo_catalog.py`; current commands/review in `150`, original checkpoint in `140` |
| Harry Potter collection | PASS, all eight movies contiguous and correct identities/years; 33 Millionaire checks and 14 additional CLI games completed | `tests/test_millionaire_demo.py`, `out/harry-potter-demos/`; three shared welcome/rules text-fit warnings retained, `150` |
| Pre-Harry Potter data preservation | PASS, all 90 pre-D44 JSON hashes unchanged | `out/harry-potter-demos/baseline-sha256.json`; previous first movie and every unrelated pack/manifest/moderator retained |
| New representative CLI demos | PASS, Pulp Fiction Hard win, House Medium final-error loss, Chernobyl Easy win | `scripts/game_harness/out/story-demo-catalog/{pulp-fiction-hard,house-md-medium,chernobyl-easy}/` |
| Original demo JSON preservation | PASS, all 26 baseline hashes unchanged | `out/story-demo-catalog/baseline-sha256.json`; 22 Millionaire title files, moderator data and three Matrix packs |
| Provider transport | PASS, 1 test / 5 provider cases + 2 overrides, 2026-10-13 | `python3 tests/test_story_transport.py`; mocked HTTP only, private content, default and 32K/300 s budgets |
| AI review safety/accounting | PASS, 2 tests, 2026-10-13 | `python3 tests/test_story_review.py`; one call, opt-in content, no hidden reasoning, no automatic retry, unknown failure charge |
| Millionaire regression | PASS, entry 9 / settings 19 / AI content 5 / modern 28 / demo 32 / golden 1 | Run each `tests/test_millionaire_*.py` separately; latest entry/golden rerun after lifecycle fix |
| Related caller/usage checks | PASS, library clicks 24 and usage view 7 | `scripts/library_harness/test_clicks.py`, `test_ai_usage_view.py` |
| Headless Matrix cases | PASS, all difficulty/terminal combinations | `out/runs/20261012-230846-matrix-demo*` under `scripts/game_harness/` |
| Medium live | PASS, 15 answers, errors at 2/8, one life, win | `scripts/game_harness/out/runs/20261012-231013-matrix-demo-live/` |
| Final Hard live | PASS, actual 20 answers, errors at 1/16/20, defeat, no ending | `scripts/game_harness/out/story-qa-final/hard/{summary.json,steps.json,report.md,shots/}` |
| Final Easy live | PASS, actual 10 answers, errors at 2/10, win with one life | `scripts/game_harness/out/story-qa-final/easy/{summary.json,steps.json,report.md,shots/}` |
| Native navigation/exit/settings | PASS in actual Kodi; D-pad A→B→D→C→A, Back confirmation, title, restored Medium | Earlier captures `scripts/game_harness/out/story-qa/`; final interaction captures in `story-qa-final/interaction/` |
| Layout edge fixtures | Static Kodi XML captures; distinguish layout evidence from gameplay | `story-qa-final/layouts/`: compact rules, loading, error without art, long title without art |
| Static checks | PASS: 28 Python files compile; generated XML exact, unique IDs/navigation, settings parse; all 44 new IDs once in cs/sk/en | Stdlib checks, 2026-10-13; unrelated existing PO duplicate IDs noted below |
| Millionaire question preservation | PASS: entire question group equals pre-Story XML; same-runtime pixel comparison 100% identical, mean/max difference 0 | `story-qa-final/millionaire-regression/same-runtime-comparison.json` and before/after captures; one question screen, not a whole pixel suite |
| Published package | PASS at deployment, 2.1.65 SHA-256 and then-current Story/XML; first 2.1.64 also checked all 12 assets and cs/sk/en | `.agents/state/release.json`; local AI optimization is newer and unpublished |
| Paid LLM and user acceptance | Demo ACCEPTED; 41 inferences / 40 attempts completed; final Sol 10/15/20 structural/manual PASS_WITH_NOTES | D41 and `130-ai-experiments.md`; rejected cases and unknown charges retained |
| Real TTS | NOT RUN | Text-only scope; mocked ownership checks are separate evidence |
| Plan links/fences | PASS, 17 English files + feature map | Final local link/fence/whitespace check, 2026-10-13; D01–D44 |
| Relevant skills | PASS, four existing skills validate with `skill-creator` validator | Host/runtime lack PyYAML; used a disposable package directory, then removed it; no runtime dependency added |

## Open issues / failures

Resolved Story/harness incidents are in `120`: native difficulty race, hidden Millionaire control resolution, animation settlement, oversized options/result text, cached translations and native adapter cleanup.

- Invalid old live run `out/runs/20261012-232004-matrix-demo-live/` requested Hard but played Easy. Its report/summary is marked INVALID and is never Hard evidence. Subsequent actual-count 20-question runs pass.
- `scripts/library_harness/test_menu.py` has 8 failures and 1 error among 18 existing menu checks. Replaying the pre-Story menu launch block in memory reproduced them; they concern older menu/label expectations, outside this feature. No unrelated menu rewrite was made.
- Existing unrelated duplicate PO IDs: cs/en 30169 and 30180–30183; sk also 32178. New Story IDs are unique/nonempty in all languages. A broad uniqueness assertion initially found these; the feature-specific check was then scoped correctly.
- Real-model comparison found factual/order defects even when schema passed. Sol medium's fresh confirmation samples improved core fidelity substantially; its initial sample still added an unsupported spoon claim. Do not promise canonical certainty for every work or hide rejected/slow calls. Full evidence is in `130`. Real TTS remains untested.
- Underlying video continuation is preserved by the existing launch path and covered at the voice ownership boundary; no fresh live playback test was run. No complete pixel-golden suite or broad skin test was run.
- A direct comparison against the older recorded q1 frame differed (7.189% over threshold) and was not counted as a pass. Re-rendered the saved pre-Story XML and current XML in the same current Kodi runtime: 100% identical. This isolates Story's change from older fixture/runtime differences without rewriting the golden.

When an issue appears, append: reproducible trigger, expected/actual result, scope, suspected/confirmed cause, affected files, attempted fix and outcome, remaining uncertainty, next experiment, and required permission if any.

## Change log

### 2026-10-12 — Planning

- Approved second mode, whole-pack knowledge-only generation, fixed Matrix fixtures, remembered mode and independent difficulty; details in `900`.
- Inspected canonical entry, Subject/source seams, current/legacy controllers, generated modern layout, settings, TTS/provider route, demo catalog and existing harness/regression assets.
- Created English plan split by specification, architecture, execution, evidence and learning ownership.
- Checked all index links and code fences locally. Reviewed cross-file rules for terminal precedence, saved preferences versus content memory, explicit offline sources, modern/classic launch policy, and cancellation. No production test was substituted for this documentation check.
- No implementation, game launch, API/TTS request, commit, or deployment performed.

## Handoff entry template

```text
Date / agent:
Current phase and status:
Authorization currently in force:
Last completed concrete step:
Changed files owned by this task:
Checks actually run and results / artifact paths:
Observed failures and confirmed causes:
Pending checks or user decisions:
Next exact action and why:
State that must be preserved (workers/settings/fixtures/unrelated edits):
```

### 2026-10-12 — Implementation progress

- Added `wcs/games/story/`, `resources/demo/story/matrix/`, `scripts/game_dialog/story_screens.py`, `scripts/game_harness/story.py`, `tests/test_story_game.py`.
- Modified existing modal/adapter/design/settings/subject/demo launch, modern generator/XML, cs/sk/en strings, necessary game launch metadata callers, dev probe and harness.
- Existing provider clients accept optional per-call output budget/private-content suppression. Shared JSON extraction moved to `wcs/ai/response_json.py` with AIHandler compatibility alias; usage view has Story label.
- No second dialog, copied controller/generator/client, persisted AI pack, per-scene inference, real LLM/TTS request, commit or deploy.
- Existing demo regression exposed missing JSONRPC in its offline stub (also present before Story); extended the shared stub so all 32 demo checks run offline. Initial combined discovery also mixed fake modules; isolated test scripts are authoritative.

### 2026-10-13 — Final demo checks and requested release

- Completed actual Easy/Hard click scenarios with per-step captures; corrected option/rules wording from visual findings without changing font defaults or canonical answer meaning.
- Verified native closure releases the active pack and owned voice; repeated affected entry/golden checks, not unrelated broad suites.
- Published 2.1.64 / skin 1.3.51 at Standa's explicit request, then paused. He explicitly resumed completion work later that morning.
- Revalidated current generated XML/Python/new translations and the published archive; updated handoff, feature and relevant harness/prompt/provider instructions.
- Verified compact rules/loading/error/long-title fixtures and native A–D, settings, wrong-answer Continue and exit behavior. The first ad-hoc native script lacked the existing stub initialization; reran through `env.install()` successfully. The first long-title fixture used `Title` instead of actual `Name`; corrected the fixture and retained the incomplete capture as such.
- Final settings capture exposed the inherited “Game and moderator” heading in Story. Reused the existing localized Story label for that mode only, regenerated XML, passed all 28 modern checks and captured `interaction/settings-corrected.png`. Published the follow-up release **2.1.65 / skin 1.3.52** using the existing deploy authorization and verified its ZIP hash/current Story assets.
- Current implementation is ready for Standa's text-only Matrix test. Record his actual feedback before any paid Luna/Sonnet experiment. Keep the full original goal active until that later work and acceptance are actually complete.

### 2026-10-13 — Accepted demo and completed AI optimization

- Standa confirmed his hands-on test and authorized LLM testing. The old demo gate was satisfied by his actual chat reply.
- Compared Luna/Sonnet low/medium/high and selected higher efforts across six prompt variants; rejected a two-call outline experiment. Complete ledger and manual findings: `130-ai-experiments.md`, `out/story-ai-review/comparison.json`.
- Added the explicit `story-review` command to the existing harness, using the production source/provider/validator/engine with opt-in content diagnostics. Defaults remain private; no hidden thinking, keys or headers are archived.
- Kept generic compact v6 and added per-preparation 32K/300 s ceilings for OpenAI/Anthropic high/xhigh/max. Existing model selections/client defaults/global settings remain intact; no copied client or automatic repair.
- After repeated Luna/Sonnet content failures, named Sol/Opus medium controls produced stronger core actions/order. Fresh Sol 10/15/20 confirmation samples passed structure and manual review with noted narrative compression, at 44–87 s / $0.023–0.041. Recommend Sol medium for this trial rather than silently changing defaults.
- Passed Story 16, transport 1 / seven mocked request cases, review 2 and Millionaire AI-content 5 focused tests; related compile, skill and English-plan checks passed. All API processes completed.
- Local optimization is not yet published; latest release remains 2.1.65 / skin 1.3.52. At this checkpoint further demos were deferred; D42/D43 subsequently authorized and completed them below. No commit, new GUI test or real TTS.

### 2026-10-13 — Complete authored demo catalog

- Standa requested Story counterparts for all existing Millionaire demos and approved the mixed complete-narrative/identified-episode recommendation. Individual selections are implementation defaults in I23; the full table is in `140`.
- Added 63 fixed Czech packs for the remaining 21 titles. Each variant explicitly samples the complete selected narrative, including the last event, across five chapter groups. Existing Matrix/Millionaire JSON hashes remain unchanged.
- Reused the existing loader/validator/engine/adapter/modal, replaced Matrix-only eligibility with complete-file gating, and introduced only a Story-specific subject copy via one episode manifest. The original Subject and Millionaire source survive switching back. No new catalog UI, controller, XML, provider, cache or runtime fixture-generation layer.
- Editorial review corrected four duplicate question wordings (five failing packs), revealed-answer setups, weak/cross-work distractors, Czech typos and presentation order in the aired Big Bang Theory and Stranger Things pilots. Read-only sources were checked for uncertain episode events; runtime AI still uses no online grounding.
- All targeted offline checks passed: catalog 8, Story 16, Millionaire entry 9/demo 32/golden 1; three standalone CLI Story scenarios passed. The catalog test runs every actual shared modal and prohibits socket/AI/TTS calls, including with all speech preferences enabled. Full commands/evidence and lessons are in `140`/`120`.
- No new GUI/device/API/TTS test, commit or deploy. Latest published release remains 2.1.65 / skin 1.3.52. Next action: requested deployment, then Standa can test this catalog on another device. Do not claim these local additions are already published.

### 2026-10-13 — Complete Harry Potter movie collection

- Standa explicitly requested every movie in the Harry Potter collection for both demos (D44). Added the seven missing titles, including separate Deathly Hallows parts; preserved all four original Philosopher's Stone files and all other pre-existing data.
- Added seven static nine-question Millionaire JSON files and 21 static 10/15/20 Story packs. Public metadata/art came from the existing TMDb route; manually authored Czech quiz/narrator content and movie-only boundaries are recorded in `150`. Existing rank 10 groups the eight adjacent without rewriting old ranks.
- Production loader/controller/design/settings/prompt contracts remain unchanged. Corrected only the stale demo package description and relevant test catalog counts; added an identity/year/contiguity assertion. Temporary authorship reused the existing serializer with a selected-ID filter to avoid changing older fixtures.
- Checked actual film order where compressed plot summaries were misleading: Moody lesson before selection, Quidditch before map/Hogsmeade, Slughorn recruitment before Snape's vow, young Riddle memory before keeper trials, and Sectumsempra before Aragog. Kept film-specific Neville/Goyle/Elder Wand outcomes and separate Part 1/2 endpoints.
- Targeted checks pass: Millionaire demo 33, Story catalog 8, Story 16, entry 9, golden 1. All 14 new-title CLI games reached expected outcomes. Millionaire 3/7/8 report estimated eight-line welcome/rules versus seven without scrolling; existing autoscroll handles this case, no new GUI result or hidden template/title rewrite is claimed.
- All 90 pre-D44 JSON hashes remain unchanged. No paid LLM/TTS call, GUI/device test, production runtime dependency, commit or new deploy. Current total: 29 titles / 87 Story packs. Exact evidence/report paths and next deploy boundary are in `150`.
