M5: genre-neutral authoritative narrative state, with review corrections

Replaces AI-DnD's RPG relative-delta world state with the genre-neutral typed
narrative state of ADR 010: explicit, absolute, allowlisted events proposed by
the model, validated by the application, applied to one authoritative document,
and snapshotted per position so restore stays a row read.

This commit includes the corrective pass that followed the independent review
in planning/reports/M5-IMPLEMENTATION-REPORT.md. The invariant it exists to
hold is:

    visible active transcript position == stored head == authoritative state

Narrator editing (D10, STORY-BRANCH-SEMANTICS §§14-15)

  A narrator edit no longer rewrites a row. It returns to the state before the
  turn, takes the reader's exact text as the accepted narration, re-derives the
  state that text implies, and becomes a new active continuation — while the
  original narration keeps its words, its live flag and its whole future as
  retained history. At the tip the correction is another take; with story below
  it, it forks. No new history machinery: this is the existing fork/take/head
  path with the reader's text in place of a generated reply. The §14A refusal
  is therefore gone for narrator turns, and remains only for player input.

Pre-M5 positions

  Migration 88 backfills the empty narrative document onto every action written
  before M5, and a missing snapshot now restores the empty document instead of
  leaving the previous position's state standing. Restoring to an old Save
  Point no longer leaves a later position's entities and facts on screen.

Narrator context

  Replayed history carries prose only; the machine-readable block is no longer
  reconstructed into past turns, where it contradicted the authoritative state
  in the same prompt. A fact withdrawn by a manual correction is now named as
  no longer true, with the reader's reason, rather than silently dropped.

Also

  - state_changes joins the action-list bulk read, removing one query per row.
  - Extraction takes only the application's own protocol payload: an ordinary
    ```json or ```python block in a story survives, and a mangled proposal
    still does not reach the reader.

Planning: ADR 013 records the authoritative document shape; §§14-15/14A, D10,
C04 and BUILD-MILESTONES are updated to describe what exists. Debt is recorded
against M8 (scenario editor UX) and M9 (export of the audit trail).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWU4gTfLYY6Qq9U7aa9Qw2
This commit is contained in:
JesseMarkowitz
2026-09-05 07:01:50 -04:00
co-authored by Claude Opus 5
parent 62a997f364
commit b7005e6fdd
57 changed files with 7257 additions and 474 deletions
+47 -1
View File
@@ -1,6 +1,6 @@
# Adventure Storyteller — Production Build Milestones
**Status:** In implementation. M1-M4 complete and accepted (M1 and M2: 2026-09-02; M3 and M4: 2026-09-03); M5 — Genre-Neutral Authoritative Narrative State — next to brief
**Status:** In implementation. M1-M5 complete and accepted (M1 and M2: 2026-09-02; M3 and M4: 2026-09-03; M5: 2026-09-04, after an independent review and a corrective pass); M6 — Branch-Safe Context, Summaries, and Long-Term Story Memory — next to brief
**Base:** AI-DnD `d72f7c1bda0f34fccd84afb7a25c34eb01c901de`
## 1. Purpose
@@ -591,6 +591,52 @@ treat the edited text as accepted output, re-evaluate the implied state, create
new continuation, and retain the original. The refusal in §14A is then replaced
by that behavior rather than kept alongside it.
**Delivered in the M5 corrective pass.** The first M5 implementation did the
state half only and kept editing the row in place, which the independent review
found broke the head/state invariant. A narrator edit now forks — the original
narration and its whole future are retained untouched, and the correction
becomes a new active continuation carrying its own re-derived state. The §14A
refusal is gone for narrator turns and remains only for a player's own input
(§13), which M5 did not change.
---
## M5 — Outcome
**Complete and accepted, 2026-09-04**, after an independent implementation
review (`planning/reports/M5-IMPLEMENTATION-REPORT.md`) and the corrective pass
recorded in that report's addendum.
Delivered:
- Genre-neutral typed narrative state per ADR 010, with the authoritative
document shape now recorded in
[ADR 013](DECISIONS/013-authoritative-narrative-state-document.md).
- **D10 complete.** A narrator edit returns to the state before the turn, uses
the reader's exact text, re-derives the state it implies, becomes a new active
continuation, and retains the original narration and its future
(`STORY-BRANCH-SEMANTICS.md` §§14-15).
- **Pre-M5 compatibility.** Migration 88 backfills the empty narrative document
onto every action written before M5, and a missing snapshot restores the empty
document rather than leaving a later position's state standing. Old campaigns,
Save Points, branches and transcripts stay usable, and no legacy RPG machinery
becomes authoritative again.
- **Manual corrections govern the narrator's context.** Replayed history carries
prose only, and a withdrawn fact is named as no longer true rather than
silently dropped.
Debt carried forward, deliberately:
- **M8 (browser UX):** the scenario editor still exposes the legacy RPG stat
schema. Its copy no longer claims that schema is how the story is tracked, but
the screen itself is M8's to redesign.
- **M9 (export/recovery):** `state_events` and `state_proposals` are not carried
in an export, so an imported campaign keeps a correction's effect but not its
audit trail. C04 therefore passes for a live campaign and not across a round
trip.
- **§13 (editing player input)** is still an in-place edit guarded by the
off-screen refusal. Bringing it onto the §§14-15 footing was out of M5's scope.
---
# M6 — Branch-Safe Context, Summaries, and Long-Term Story Memory