Update planning package after Phase 0B

This commit is contained in:
JesseMarkowitz
2026-09-01 20:41:23 -04:00
parent ba737de9b4
commit 717670afe0
34 changed files with 2061 additions and 1204 deletions
+140 -122
View File
@@ -1,155 +1,173 @@
# Adventure Storyteller Planning Package
This package contains the current product requirements, provisional architecture, Phase 0 research, detailed subsystem designs, acceptance tests, and the Codex Phase 0B validation handoff for the local-only interactive-story project.
**Status:** Phase 0 complete; architecture selected; planning revision ready for review.
**Production coding:** Not yet authorized. Review this package before preparing the first implementation prompt.
## Current Status
This package contains the current product requirements, final Phase 0 architecture decisions, detailed subsystem designs, acceptance tests, research evidence, and the production milestone plan for the local-only interactive-story project.
Phase 0A static research is complete.
## Current Decision
The project is now ready for **Phase 0B local validation** of the three finalists:
Phase 0A static research and Phase 0B local validation are complete.
1. AI-DnD
2. Open Dungeon
3. ai-adventure
The production starting point is:
**Do not begin production implementation yet.**
> **Fork AI-DnD at upstream commit `d72f7c1bda0f34fccd84afb7a25c34eb01c901de`.**
The purpose of Phase 0B is to validate the fork/base decision and resolve the remaining architecture questions with real builds, tests, offline runs, and tightly scoped experiments.
The selection is based on measured Phase 0B behavior, not feature count. AI-DnD already contains the highest-value structural machinery: browser UI, FastAPI service boundary, SQLite persistence, parent-linked story history, alternate takes, branch-aware state snapshots, local Ollama operation, branch-scoped memory, prompt/context inspection, streaming, export/import, and a substantial automated test suite.
The selected composition of ideas is:
```text
AI-DnD production base
+ ai-adventure state/event/commit/checkpoint/privacy patterns
+ Open Dungeon story-reading and future-media UX patterns
+ Chronicler memory-authority concepts
+ Interactive Fiction Framework canon/validation concepts
+ Gamentic provider-neutral media concepts
```
This is **not** a repository merge. AI-DnD is the ownership center. Other projects are implementation references only unless a later milestone explicitly reimplements a compatible idea.
## Phase 0B Findings That Changed the Plan
Phase 0B confirmed the fork choice while correcting several Phase 0A assumptions:
- AI-DnD's shipped Undo was destructive and had no Redo.
- A disposable spike proved non-destructive head-cursor Undo/Redo in three backend files while preserving branch-scoped memory isolation.
- A new continuation written after Undo can fork from the moved-back head while retaining the abandoned future.
- AI-DnD's current relative-delta world-state protocol can produce semantically wrong state under realistic context even when the proposal is syntactically valid.
- Production narrative state will therefore use explicit typed events/absolute assignments inspired by ai-adventure rather than AI-DnD's relative-delta protocol.
- AI-DnD requires offline hardening: `tiktoken` attempts a first-use CDN fetch and the SPA requests Google Fonts at runtime.
- AI-DnD's export format must preserve the active head position; otherwise export/import can silently redo an undone story.
- AI-DnD Story Cards are not a sufficient imported-knowledge store because they are not designed for the required classification, provenance, chunking, and lineage semantics.
- Open Dungeon remains useful for UX/media ideas but is no longer a serious production-fork candidate.
- ai-adventure is not the production base but is the strongest implementation reference for authoritative typed state events, head movement, checkpoints, replay, and narrow local-only behavior.
See `PHASE-0B-RECOMMENDATION.md` for the coding agent's evidence. That report is retained as research evidence; the planning documents in this package record the decisions made after reviewing it.
## Document Authority
Use the documents in this order when requirements appear to conflict:
1. `SPECIFICATION.md` — product requirements and desired behavior.
2. Detailed design/behavior documents listed below — elaborations of the specification.
3. `V1-ACCEPTANCE-TESTS.md` — observable pass/fail interpretation of v1 requirements.
4. `TECHNICAL-DESIGN.md` — provisional implementation direction, subject to Phase 0B findings.
5. Phase 0A reports — research evidence and candidate analysis.
6. `BUILD-MILESTONES.md` — intentionally incomplete until the fork/architecture decision is made.
1. `SPECIFICATION.md` — product requirements and required behavior.
2. Detailed behavior/design documents:
- `STORY-BRANCH-SEMANTICS.md`
- `CONTEXT-AND-MEMORY.md`
- `IMPORTED-KNOWLEDGE-DESIGN.md`
- `SECURITY-THREAT-MODEL.md`
- `MEDIA-EXTENSION-CONTRACT.md`
- `BROWSER-UX-SPEC.md`
- `DATA-MODEL.md`
3. `V1-ACCEPTANCE-TESTS.md` — observable pass/fail contract.
4. `TECHNICAL-DESIGN.md` — selected implementation architecture.
5. Foundational ADRs (`001-...md` through the current ADR set).
6. `BUILD-MILESTONES.md` — implementation sequence; it does not override product behavior.
7. Phase 0 research reports — evidence and historical findings.
The detailed design documents describe target behavior; they do not force a particular repository schema when an equivalent implementation satisfies the behavior.
Candidate repositories and research reports are **not** specifications. In particular, ai-adventure is an implementation reference for selected patterns; its behavior does not override this package.
## Recommended Reading Order for Codex
## Foundational Decisions
### A. Product and architectural intent
1. `SPECIFICATION.md`
2. `DATA-MODEL.md`
3. `STORY-BRANCH-SEMANTICS.md`
4. `CONTEXT-AND-MEMORY.md`
5. `IMPORTED-KNOWLEDGE-DESIGN.md`
6. `SECURITY-THREAT-MODEL.md`
7. `MEDIA-EXTENSION-CONTRACT.md`
8. `BROWSER-UX-SPEC.md`
### B. Test contract
9. `TEST-CAMPAIGN-FIXTURE.md`
10. `V1-ACCEPTANCE-TESTS.md`
### C. Provisional architecture and research
11. `TECHNICAL-DESIGN.md`
12. `RESEARCH-PLAN.md`
13. `reports/PHASE-0A-STATUS.md`
14. `reports/PRELIMINARY-RECOMMENDATION.md`
15. `reports/REUSE-MATRIX.md`
16. Candidate-specific reports in `reports/`
### D. Execute
17. `PHASE-0B-CODEX-HANDOFF.md`
## Core Product Decisions Already Settled
The Phase 0B investigation should treat these as requirements rather than questions:
The following are settled for v1:
- browser-first UI,
- local-only v1 runtime,
- local Ollama inference,
- application-owned authoritative story state,
- complete retained transcript,
- local-only runtime across user-controlled local infrastructure,
- Ollama inference with same-host loopback as default and explicitly configured trusted-LAN inference supported,
- single-user deployment,
- AI-DnD production base at the pinned Phase 0B commit,
- application-owned authoritative state,
- complete retained transcript/history,
- simple user-facing Undo/Redo/Retry/Save Point semantics,
- non-destructive internal lineage,
- abandoned history retained but marked disposable; cleanup later,
- at least five Undo operations; unlimited preferred if technically straightforward,
- Redo and Retry supported,
- named checkpoints retained until explicitly deleted,
- genre-agnostic core schema,
- imported knowledge classes: Canon / Reference / Inspiration,
- local retrieval and embeddings,
- non-destructive head-cursor history internally,
- new write after moving backward creates a new continuation while retaining the old future,
- abandoned history is retained and marked disposable; **no automatic cleanup is required in v1**,
- named checkpoints remain until explicitly deleted,
- genre-agnostic core state,
- explicit typed narrative-state events/absolute assignments rather than ambiguous relative deltas,
- hybrid state model: validated events plus state snapshots/cache,
- branch/lineage-safe summaries and memories,
- imported knowledge is a separate first-class subsystem rather than an extension of AI-DnD Story Cards,
- knowledge classes: Canon / Reference / Inspiration,
- local lexical retrieval plus local semantic retrieval where practical,
- prompt/context provenance and inspection,
- no cloud inference, telemetry, automatic web retrieval, remote runtime assets, shell/MCP/general plugin execution,
- future local image/video/TTS/STT capability must remain possible without coupling it to the core story engine.
- export/import must preserve active branch **and active head position**, including an undone position,
- no cloud/Internet inference, telemetry, automatic web retrieval, remote runtime assets, shell/MCP/general plugin execution,
- LAN inference is distinct from LAN exposure of the storyteller UI/API; the latter is not required for v1,
- future local image/video/audio/TTS/STT support remains optional and decoupled from the story engine.
## Detailed Documents
## Phase 0 Status
- `DATA-MODEL.md` — conceptual target data model and authority/state structures.
- `STORY-BRANCH-SEMANTICS.md` — exact Undo, Redo, Retry, Edit, checkpoint, restore, and disposable-history behavior.
- `CONTEXT-AND-MEMORY.md` — context construction, authority hierarchy, summaries, memory, retrieval, provenance, token budgeting.
- `IMPORTED-KNOWLEDGE-DESIGN.md` — import, classification, chunking, local indexing, retrieval, provenance, isolation, and prompt-injection handling.
- `SECURITY-THREAT-MODEL.md` — local trust boundary, network policy, untrusted input handling, browser security, and offline acceptance.
- `MEDIA-EXTENSION-CONTRACT.md` — future image, video, audio, TTS, and STT extension boundaries. Media remains optional and derived from story state.
- `BROWSER-UX-SPEC.md` — user-facing browser workflow and advanced inspection surfaces.
- `TEST-CAMPAIGN-FIXTURE.md` — deterministic campaign fixture for comparing candidates and later regression testing.
- `V1-ACCEPTANCE-TESTS.md` — black-box requirements and release gate.
### Complete
## Phase 0A Research
- candidate discovery and triage,
- static architecture/privacy/licensing review,
- local clone/build/test validation,
- real Ollama testing,
- offline/network observation,
- AI-DnD strip-down/entanglement checks,
- Open Dungeon history-retrofit analysis,
- ai-adventure Ollama/service-boundary checks,
- AI-DnD non-destructive Undo/Redo spike,
- referee/state-protocol follow-up,
- export/import head-position follow-up,
- Story Card lineage review,
- Postgres removability review,
- production fork decision,
- production architecture decision.
Static repository research was completed on 2026-09-01.
### Deferred to implementation/release validation
Key reports:
These do not block the architecture decision:
- `reports/PHASE-0A-STATUS.md`
- `reports/PRELIMINARY-RECOMMENDATION.md`
- `reports/REUSE-MATRIX.md`
- `reports/AI-DND-ANALYSIS.md`
- `reports/OPEN-DUNGEON-ANALYSIS.md`
- `reports/AI-ADVENTURE-ANALYSIS.md`
- `reports/PRIVACY-STATIC-ANALYSIS.md`
- `reports/LICENSING-REUSE.md`
- `reports/SOURCE-INDEX.md`
- comparative recommendation of narrator/state models for real users,
- multi-hour/100-turn long-run behavior,
- detailed concurrency behavior beyond the single-user turn lock,
- actual future image/video/TTS/STT provider integration,
- abandoned-history cleanup UI/policy (not required in v1).
Current preliminary architecture hypothesis:
## Recommended Reading Order for the Next Implementation Stage
Do not convert this into a coding prompt until the package review is approved.
When implementation planning resumes, read:
1. `SPECIFICATION.md`
2. `TECHNICAL-DESIGN.md`
3. `BUILD-MILESTONES.md`
4. `STORY-BRANCH-SEMANTICS.md`
5. `DATA-MODEL.md`
6. `CONTEXT-AND-MEMORY.md`
7. `IMPORTED-KNOWLEDGE-DESIGN.md`
8. `SECURITY-THREAT-MODEL.md`
9. `BROWSER-UX-SPEC.md`
10. `V1-ACCEPTANCE-TESTS.md`
11. ADRs, especially the production-base and narrative-state-event decisions
12. Phase 0B reports only as supporting evidence
## Workflow From Here
```text
AI-DnD production base
+ ai-adventure trust/commit/privacy rules
+ Open Dungeon scene/media UX patterns
+ Chronicler memory authority tiers
+ Interactive Fiction Framework Story Bible authority/validation
+ Gamentic media-provider abstraction
Phase 0 research and spikes COMPLETE
|
v
Architecture/fork decision COMPLETE
|
v
Planning package revision CURRENT REVIEW
|
v
Approve planning package
|
v
Prepare one implementation prompt
for Production Milestone 1
|
v
Implement and review milestone-by-milestone
```
This is a hypothesis to test, not a fork decision.
## Stop Rule
## Overall Workflow
**Do not begin production coding from this package yet.**
```text
Specification + detailed behavioral designs
|
v
Phase 0A static research
|
v
Phase 0B local validation
|
v
Fork / architecture decision
|
v
SPECIFICATION v1.0
TECHNICAL-DESIGN v1.0
|
v
Detailed BUILD-MILESTONES.md
|
v
Production implementation
```
## Important Stop Rule
Phase 0B ends with evidence and a recommendation.
Codex should **not** begin production coding, repo conversion, or broad feature implementation until the Phase 0B results have been reviewed and the production base has been selected.
The current action is to review the planning changes. No replacement Codex prompt has been prepared in this revision.