Prose/rfc/0018-game-writing-first-class
RFC 0018: Game writing as a first-class mode
Status: proposed 2026-11-07 · Ticket: PRS-T922 · Supersedes: RFC 0007 Phase 2 ("game-writing deliverables are Books") · Builds on: RFC 0017 (the game data conduit, prose-text/1), RFC 0009 (no autonomous prose writes), RFC 0013 (the narrative obligation ledger), RFC 0011 (context-aware verification) · Working spec: docs/CONDUIT.md
"Prose needs to evolve to be able to do Video Game writing as well as classical book writing." (owner, 2026-11-07)
1. Goal
Prose already stores game writing. Since PRS-T917 a game's player-facing words (conversations, crawls, descriptions, quest text, in-game books, barks, glossary terms) live in Prose as prose-text/1 texts in the game's universe (gridgame, spacegod), are approved by the author, and reach the game through the consumer kit.
What Prose does not yet do is check that writing. Every narrative instrument reads beats: CanonContradictionService.CheckNodeAsync(nodeId), ContinuityEnforcer.EnforceAsync(beatText, …), the obligation extractor (NarrativeObligations.OriginBeatId), voice drift (VoiceFingerprintAnalyzer driven from BeatEntityPresence). A text is drafted, validated for shape and entity references by ProseTextService.ValidatePayload, and nothing more. A line that names a retired faction, a talk whose branch can never be reached, a glossary term defined twice with two meanings, a crawl that names a villain the player meets three chapters later: none of these is found today.
This RFC makes game writing a first-class mode of the same engine:
- game texts run through the verification instruments and file findings in the same
Findingstable books use; - each text can say where and when it appears (its
context), so continuity can be judged in a game that has no single reading order; - branching conversations and bark pools get checks shaped for them;
- the Writer gets a view of a universe's game texts with an approval queue;
- RFC 0009 holds unchanged: verifiers describe, the author decides, nothing rewrites a text.
2. Why not "game script as Book" (RFC 0007 Phase 2)
RFC 0007 Phase 2 (2026-08-26, design-approved, never built) proposed that a game's script be an ordinary Prose book, so the Book → Chapter → Beat spine and its continuity machinery would guard game canon "for free", with a --barks-export filter to pull single-speaker beats out for the game. Only that filter was built (BarksExportService, the portable-writing-service plan, Phase 4).
The conduit made the rest obsolete, and the reasons are structural:
| A book | A game |
|---|---|
| One reading order. Law 6: "the book is read and written whole". | No single order. A player reaches a region early or late, skips a talk, picks one branch of three. |
| The unit is a beat: prose in sequence. | The unit is a text: a graph (conversation), a random draw (bark pool), a reference entry shown anywhere (description, glossary). |
| Done is the read gate and the factory stations (F1–F7). | Done is draft → approved → published, then the game applies it by key.
|
| The deliverable is the book. | The deliverable is the game's text files, generated by the game's applier from approved texts. |
Forcing a talk graph into beats loses its branches; forcing a bark pool into beats invents an order that does not exist; and the read gate would demand a linear read of something that is never read linearly. Texts are already first-class rows (Entity of type prose-text, every version in its Record JSON, about and spoken-by edges to the entities they name), so game writing should get its checks on texts, not by being re-shaped into a book.
What stays from RFC 0007 Phase 2: --barks-export keeps working for books that contain dialogue beats. The "Game Design Document" and "game script" books are withdrawn as a design; a design document an author wants is still just a nonfiction book.
3. Two modes, one engine
| Book mode | Game mode | |
|---|---|---|
| Unit | beat (Beats row, system-versioned)
|
text version (TextVersion in the text's Record JSON)
|
| Order | beat order in the node tree | context.order plus context.after (section 4), a partial order
|
| Canon | the universe's entities and edges | the same entities and edges; texts link to them by id |
| Lifecycle | planned → written → captured → read → clean → verified → pressed | draft → approved → published → retired |
| Who approves | the author, at the read gate and press | the author, by name (--by), never an agent
|
| Findings | Findings, path node:{slug}/…
|
Findings, path text:{universe}/{id}#v{version} (section 6)
|
| Checks | logic sweep, ledger, canon, voice, linter | the game-mode verifiers (section 5) |
The two modes share the database, the universes, the entities, the Hub, the CLI, MCP and the Writer. Neither changes the other: no book command, table or law changes in this RFC.
4. Per-text context: where and when a text appears
4.1 The field
prose-text/1 gains an optional context object. A text without it is valid and behaves exactly as today (backward compatible: old documents, the kit and games that ignore the field are unaffected).
"context": {
"place": "place-arkgrave", // an entity id: where the player meets this text
"chapter": "act-2", // the game's own chapter/act/region label (free text)
"order": 20, // the earliest story point the player can see it (number)
"trigger": "stage:arkgrave-3/victory", // the game's own trigger handle (opaque to Prose)
"after": ["conversation-wanderer-ember"] // texts the player must have seen first (text ids)
}
placeis an entity reference likeabout: it must exist and not be archived when drafted, and it becomes anappears-atedge from the text, so the graph shows what is said where.orderis a number on the game's own scale (stage index, chapter × 100 + step, anything monotone). It means "no earlier than": a text with order 20 can be seen at story point 20 or any time after.afternames texts that are guaranteed to have been seen first, whatever their order. It is how a non-linear game says "this talk only fires after that one" without inventing a global order.chapterandtriggerare labels for the author and the Writer. Prose does not interpret them; the game owns their meaning (as it owns choice tags, RFC 0017 §11.2).- Unknown fields in
contextare refused at drafting, so a typo does not silently drop a placement. - The payload hash stays the hash of the payload only, so existing hashes and
applied.jsonlrecords are unchanged. A change of context alone is still a new version (the unchanged check compares context too).
4.2 What the player can know at a text
For a text T with a context, T's effective order is the larger of its own order and the orders of the texts in its after chain (a text cannot play before the texts it comes after). known-before(T) is every live or drafted text X of the universe with X.order ≤ T's effective order, plus every text in T's after list and, transitively, theirs. (Equal orders count as known: two texts at the same story point are not judged against each other.) That is the set of texts the player is guaranteed to be able to have seen when T plays. It is a lower bound on knowledge, which is exactly what a continuity check needs: if the player might not know something, a text that relies on it is a finding.
A text with no order and no after is unplaced. Continuity is not judged on unplaced texts (there is nothing to judge against), and the Writer lists them so the author can place them. Descriptions and glossary entries are usually unplaced on purpose (a codex can be opened any time).
5. The instruments, on texts
Law 7 of the protocol: deterministic checks only, no LLM judges, votes or scores. Every game-mode verifier below is deterministic and runs in milliseconds over a universe's texts and entities, so it can run on every draft and every approval without a cost gate. Each maps to an existing book instrument:
| Book instrument | Game-mode check (code) | What it finds |
|---|---|---|
Canon contradiction (CanonContradictionService: "a retired/destroyed thing used as current")
|
TEXT-CANON [retired-entity]
|
a text refers to an archived entity (by about, speaker, {entity:id}, context.place) or names one in a line when no live entity has that name. Drafting already refuses archived references; this catches a live text that went stale when canon changed later.
|
| Canon contradiction (an entity's documented nature) | TEXT-CANON [glossary-conflict]
|
two live or pending glossary texts define the same term or alias: two meanings for one word. |
TEXT-CANON [unknown-giver]
|
a quest giver that is written as an entity id names no entity.
| |
Continuity / knowledge states (logic sweep "what a character knows", ContinuityEnforcer)
|
TEXT-CONTINUITY [before-introduction]
|
a placed text names an entity (speaker, {entity:id}, or its name in a line) that is introduced (is the about of a placed text) only at a later order and not in known-before(T): the player meets the name before the thing.
|
TEXT-CONTINUITY [unknown-after]
|
context.after names a text that does not exist.
| |
TEXT-CONTINUITY [after-order]
|
context.after names a text whose order is later than this one's: the two placements contradict.
| |
TEXT-CONTINUITY [place-type]
|
context.place is an entity that is not a place (its type is not a place, location, region, area, planet, system, station or stage).
| |
| Obligation ledger (RFC 0013: a promise logged at origin, closed by its payoff) | TEXT-OBLIGATION [quest-unresolved]
|
a quest has a brief (the promise) and no complete (the payoff).
|
(RFC 0013 introduced-referent)
|
TEXT-OBLIGATION [undescribed]
|
a story text names an entity as about or {entity:id} and the universe has no description text about it: a referent the player can never look up.
|
Voice consistency (VoiceFingerprintAnalyzer, Jaccard over distinctive tokens)
|
TEXT-VOICE [drift]
|
an entity speaker's lines in this text match another speaker's established vocabulary better than the speaker's own, by the analyzer's calibrated margin. $placeholder speakers are skipped (one placeholder is many characters). Below the analyzer's floor (30 distinctive tokens) there is no signal and nothing is filed.
|
| (structure, game-only) | TEXT-BRANCH [unreachable]
|
conversation nodes no path from start reaches.
|
TEXT-BRANCH [no-ending]
|
from start no path ever ends (a node with no next and no choices) or leaves to a $token: the player is stuck in a loop.
| |
TEXT-BRANCH [duplicate-choice]
|
one node offers two choices with the same text. | |
| (barks, game-only) | TEXT-BARK [duplicate]
|
the same line twice in one pool. |
TEXT-BARK [repeated]
|
a line also in another pool of the same speaker. | |
TEXT-BARK [long]
|
a bark line over 140 characters (a bark is heard mid-action). |
The LLM canon check is not run on texts in this RFC. CanonContradictionService.DetectAsync asks a model whether prose contradicts retrieved canon; Law 7 and its per-call cost keep it off the draft and approval path. A later, explicitly author-invoked pass (--texts-check-canon <slug> <id>, cost-gated like other paid commands) could run it over a text's lines with retrieval scoped to the universe and file TEXT-CANON [llm] findings. It is listed in section 12 as an open question, not built.
The RFC 0013 ledger tables are not written. NarrativeObligations is book-scoped (OriginBeatId, OriginQuote from a beat). A game text holds both ends of its own obligations (a quest's brief and complete), so game-mode obligations are recomputed from the texts on every verification and filed as NarrativeObligation findings. Obligations that cross texts (a talk that promises a quest) need an explicit link and are open question 12.2.
6. The findings contract
- Sink.
FindingsService.Upsert, the shared sink every book instrument uses (RFC 0011 §2). No new table. - Path.
text:{universe}/{id}#v{version}. Findings belong to a version, so the history view can show what each version was found to have, and a later version starts clean.WhereUnderPathalready treats#as a separator, sotext:gridgame/crawl-prologuelists every version's findings and…#v3does not reach…#v30. - Summary.
TEXT-<FAMILY> [<code>]: <what was observed>, e.g.TEXT-CONTINUITY [before-introduction]: names "Ember" (faction-ember) at order 10; the first text about it is crawl-act-3 at order 30.FindingCodeRegistrygets one entry per code, so every code is documented where the book codes are. (Suppression rules are node-scoped today, so a text finding is dismissed per row; a dismissed row stays dismissed when found again.) - Category. canon and continuity →
Contradiction; voice →Voice; obligation →NarrativeObligation; branch →StructuralFailure; bark →NearDuplicate. - No fix line.
SuggestedFixis always null (RFC 0009 §2, corollary 1: a finding describes; it never instructs). - Freshness. Each run deletes the version's open
TEXT-findings and re-files the current set. Triaged, dismissed and applied rows are kept (DeleteBySummaryPrefixkeeps ruled rows), so a finding the author already dismissed stays dismissed when it is found again. Rows carrySourceRuleVersion = prose-text-verify/1(RFC 0011 brick 2), so a later rule change can be listed as stale. - When it runs.
- on draft, over the new version (the draft result lists what was found);
- on approval, single or bulk, over each text approved;
- on demand:
prose --texts-verify <slug> [id...] [--kind k],POST /api/universes/{slug}/texts/verify, MCPverify_texts, and the Writer's "Verify" button. A universe sweep re-checks every text against the others; a draft re-checks only itself (a new glossary term files its conflict on itself; the sweep files it on both).
- Reading them.
GET /api/universes/{slug}/texts/{id}/findings,prose --texts-findings <slug> [id], MCPtext_findings, the Writer. - Never blocking. A finding never refuses a draft or an approval. Drafting still refuses what it refused before (bad shape, unknown or archived entity, used key); everything a verifier finds is the author's to judge.
7. Branching conversations
The conversation payload is already a graph: start, nodes[{id, speaker, line, next?, choices?[{text, next, tags[]}]}], with $tokens as exits the game resolves ($outcome). This RFC keeps the shape and adds:
- structure checks (
TEXT-BRANCH, section 5): unreachable nodes, a graph with no way out, duplicate choices; - voice per speaker: each entity speaker's lines across every node are one sample for
TEXT-VOICE [drift], compared against that speaker's lines in every other text of the universe; - branch-aware continuity: every node of a conversation shares the conversation's context, so a name a branch uses before its introduction is found whichever branch it is on;
- the Writer renders the graph as a tree from
start, each choice labelled with its tags, a revisited node shown as a link back instead of repeated,$tokenexits shown as exits.
Conditions (which branch is offered when) stay gameplay, in the game (RFC 0017 §11.2). Prose carries the tags.
8. Bark pools
A bark text is one pool: one speaker (payload.speaker), one situation (payload.context, e.g. low-health), and lines[] the game draws from at random. The key convention is bark:<speaker>/<situation> (e.g. bark:class-ronin/low-health). A pool has no order, so it is unplaced unless the game only unlocks it at a point (then context.order says when).
Checks: duplicates in a pool, the same line in two pools of one speaker (the player hears it in the wrong situation), lines too long to hear mid-fight, and the speaker's voice across every pool they bark in.
9. The Writer view
/texts in the Hub (the same explicit-endpoint pattern as /repo), in Prose.WriterUi, reading through ProseTextService and FindingsService in-process like the rest of the Writer:
- Universes.
/textslists every universe that has texts, with counts by status. - Browse.
/texts/{universe}lists the texts, filtered by kind, key (substring) and entity (anyabout, speaker or place), each row with its status, live and pending versions and its open finding count. - One text.
/texts/{universe}/{id}shows the selected version's payload rendered for its kind (the conversation tree, the bark pool, the crawl's paragraphs, …), its context, every version with its status, approver and dates, and the findings of the selected version. Findings can be triaged or dismissed there; a dismissed finding stays dismissed on re-verification. - The approval queue. Pending drafts grouped by kind, each kind with its count and how many of its drafts have open findings. "Approve all of this kind" first runs
BulkApproveAsync(…, dryRun: true)and shows what would be approved and what would be refused, then approves only on the author's confirmation. Single approve is on the text page. - Approval stays an author action. Approving needs the author's name in the view (the
byevery approval records); the view never approves on load, on a timer or on a finding. It uses the existing PRS-T918 service (BulkApproveAsync,ApproveAsync); there is no second approval path.
10. RFC 0009, applied
"An LLM may write prose the author asked for. It may never rewrite prose the author already accepted."
For game texts:
- Verifiers raise findings; they never write. No verifier creates a version, edits a payload, approves, publishes or retires. The only writes a verification makes are
Findingsrows. - No fix lines. Findings describe what was observed (section 6).
- Agents draft; the author approves. MCP keeps
draft_textand gains read-onlytext_findingsand the findings-onlyverify_texts; there is still no MCP approve, publish or retire. The CLI and HTTP approval calls and the Writer all require a named author. - Nothing auto-rewrites. A finding on an approved text does not demote it, re-draft it or hold it back from a pull. The approved version stays live until the author approves a replacement (the RFC 0017 lifecycle).
- No autonomous writer can be added silently. A new version only ever comes from
DraftAsyncwith aby; game mode adds no other write path.
11. Rollout (PRS-T922)
| Phase | Delivers | Done when |
|---|---|---|
| 1 | this RFC | proposed to the owner |
| 2 | ProseTextVerifier (section 5) on draft, approval and on demand; context in prose-text/1 (service, schema, CONDUIT.md, kit validate); CLI --texts-verify/--texts-findings, HTTP verify/findings, MCP verify_texts/text_findings; finding codes registered; unit tests
|
builds; tests written (they run when the owner asks) |
| 3 | the Writer view (section 9) at /texts
|
builds; served by the Hub |
| 4 | README and identity: Prose serves books and games | README says so |
12. Open questions
- The LLM canon pass on texts (section 5): worth an explicit, cost-gated
--texts-check-canon? Law 7 keeps it off every automatic path either way. - Cross-text obligations. A talk that sets up a quest, a crawl that promises a reveal: an optional
context.opens[]/context.pays[]naming obligation keys would let the ledger open in one text and close in another, with "past due" judged by order. Not built until a game needs it. - Order scale per game. Each game picks its own
orderscale. Should the game'sprose.config.jsondeclare it (e.g."orderScale": "stage") so the Writer can label it? - Neighbour re-verification on draft. A draft re-checks itself only; a sweep re-checks everything. Should a draft also re-check the texts that share an entity with it? Cheap, but it changes other texts' findings as a side effect of one draft.
- Localization stays out of scope (RFC 0017 §11.3);
contextleaveslangfree for later.