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
+27 -25
View File
@@ -1,6 +1,6 @@
# Adventure Storyteller — Context and Memory
**Status:** Draft v0.1
**Status:** v1.0 — aligned to Phase 0B findings
**Purpose:** Define what information is supplied to the narrator on each turn, how long-term memory works, and how authority, lineage, retrieval, summaries, and imported knowledge interact.
## 1. Design Goal
@@ -420,7 +420,7 @@ Reason:
- lexical retrieval is transparent and precise for names/terms,
- semantic retrieval is useful for conceptually related old events.
Phase 0B should determine what the selected base already supports.
Phase 0B confirmed useful local semantic memory in AI-DnD and deterministic lexical lore in ai-adventure. The selected production direction is hybrid local retrieval, implemented incrementally with a lexical path that remains usable when semantic embeddings are unavailable.
## 17. Embeddings
@@ -1083,25 +1083,25 @@ If the narrator makes an unexpected choice, the system should support questions
This is why context provenance is a first-class requirement.
## 57. Phase 0B Validation Questions
## 57. Phase 0B Findings Applied
Codex should answer:
The selected AI-DnD base was exercised with real local Ollama embeddings and demonstrated useful lineage behavior:
1. How does AI-DnD currently rank and retrieve memories?
2. Are AI-DnD memories branch-aware?
3. Can abandoned-branch memories leak into active context?
4. How are Story Cards selected and injected?
5. Can Story Cards be generalized into Canon / Reference / Inspiration classes?
6. What exact embedding provider does local AI-DnD use with Ollama?
7. Can memory retrieval work fully offline?
8. What context components are visible in AI-DnD's Insights view?
9. How does Open Dungeon decide when to summarize old history?
10. Can ai-adventure's FTS lore layer be retained as a deterministic lexical retrieval component?
11. How difficult would hybrid lexical + semantic retrieval be in the selected base?
12. Can current context budgeting preserve hard canon under pressure?
13. Are summaries tied explicitly to source lineage?
14. Can memory extraction failure occur without blocking a successful turn?
15. Can prompt/context snapshots be retained without excessive database growth?
- branch-scoped memory retrieval worked,
- a memory from a later/abandoned depth was excluded after moving the active head backward,
- the same memory became eligible again after Redo/return to the applicable lineage,
- switching to a different branch prevented abandoned-branch terms from appearing in the assembled prompt,
- the context/Insights path exposes labeled prompt sections and token costs.
Planning consequences:
1. Preserve AI-DnD's common lineage filtering/chokepoint rather than replacing memory from scratch.
2. Make summaries explicitly lineage/turn-range anchored; never rely on a positional message watermark.
3. Keep accepted story memory distinct from heuristic/inferred memory.
4. Imported knowledge remains a separate subsystem; do not promote Story Cards into the knowledge store merely because they are prompt-injection primitives.
5. Use local Ollama embeddings for semantic story memory where enabled; retain a lexical/deterministic path for imported knowledge.
6. Context/state extraction must be tested at realistic prompt length because Phase 0B showed model protocol adherence can degrade under full application context.
7. Derived memory/summary failure must not corrupt or roll back an otherwise valid authoritative story commit.
## 58. Acceptance Criteria
@@ -1117,6 +1117,8 @@ The final implementation must satisfy:
- retrieval works locally,
- no remote embeddings/search are required,
- abandoned branch memories do not leak,
- moving the active head backward excludes memories derived after that head,
- Redo/returning to the valid lineage can make those memories eligible again,
- context remains bounded,
- output space is reserved,
- prompt composition is inspectable,
@@ -1124,7 +1126,7 @@ The final implementation must satisfy:
- summaries are lineage-safe,
- memory failures do not corrupt authoritative story state.
## 59. Current Recommendation
## 59. Selected Context / Memory Design
Use a layered, authority-aware context builder:
@@ -1141,13 +1143,13 @@ Use a layered, authority-aware context builder:
v
----------------
+
Story Summary
Lineage-Anchored Summary
+
Relevant Story Memories
+
Relevant Local Knowledge
+
Recent History
Recent Active-Lineage Turns
+
Current Input
|
@@ -1155,14 +1157,14 @@ Use a layered, authority-aware context builder:
OLLAMA
```
Retrieval should be:
Retrieval must be:
```text
local
+ lineage-aware
+ lineage-aware where derived from story history
+ provenance-preserving
+ authority-aware
+ token-bounded
```
The application should treat context construction as a deterministic subsystem that can be inspected and tested independently of prose generation.
The application treats context construction as a deterministic, independently testable subsystem. AI-DnD's lineage-aware memory implementation is the starting point; the project's own authority and imported-knowledge rules define the target behavior.