Adopt Ink for branching scenes

This commit is contained in:
Meta Vens 2026-05-01 23:52:15 +01:00
commit 909d9be119
12 changed files with 732 additions and 29 deletions

View file

@ -0,0 +1,100 @@
# Ink Branching Scenes
Ink is the branching scene format.
Ghostlight should not invent a parallel dialogue-tree language unless Ink
fails a concrete requirement. Ink already gives us readable interactive fiction,
choices, knots, stitches, variables, tags, compiled JSON, and a format writers
can inspect without needing to wear a compiler helmet indoors.
Ghostlight's job is the machinery around Ink:
- build actor-local awareness from agent state and scene state
- project plausible speech and non-speech choices
- annotate why those choices make sense
- preserve listener interpretation as separate from actor intent
- record consequence surfaces for later state mutation
- keep fuzzy social updates reviewed until there is training data
- compile Ink into game-consumable JSON
Ink owns the playable branch structure. Ghostlight owns the psychological,
cultural, memory, relationship, and consequence rationale.
## Runtime Shape
The near-term authoring path is:
```text
agent state + scene state + lore grounding
-> local awareness
-> projected branch choices and NPC responses
-> Ink scene
-> compiled Ink JSON
-> reviewed training annotations
-> selected branch consequences
-> state, memory, belief, and relationship updates
```
The Ink file should be readable as Aetheria content on its own. The sidecar
training annotation should explain which Ghostlight state produced each branch
and which consequences are automatic, reviewed, or deferred.
## Ink Tags
Use Ink tags for lightweight traceability:
- `ghostlight.scene`
- `ghostlight.fixture`
- `ghostlight.branch`
- `ghostlight.action`
- `ghostlight.intent`
- `ghostlight.npc_response`
- `ghostlight.consequence`
- `ghostlight.training_hook`
- `aetheria.flashpoint`
Tags are not the full state model. They are handles that let runtime and
training tools connect a playable branch back to Ghostlight state.
## Sidecar Annotations
Each Ink scene should have a `.training.json` sidecar with:
- source fixture reference
- protagonist and NPC ids
- actor-local awareness summary
- projection controls
- branch ids and Ink knot paths
- action type and actor intent
- state basis
- reviewed consequences
- training hooks
- mutation policy
This sidecar is intentionally not a new branching format. It is a receipt. Ink
remains the scene tree; the sidecar says why the tree grew that way and which
state changes a reviewer accepted.
## Mutation Policy
Ink variables can record local playthrough outcomes. They should not silently
become canonical Ghostlight state.
Automatic:
- Ink compilation
- branch id and knot validation
- local variables for the current playthrough
- mechanical tags and training hook checks
Manual reviewed until trained:
- relationship deltas
- belief updates
- memory writes
- listener misread classification
- activation changes
- promotion from branch outcome into durable Aetheria lore
The first prototype lives in
`examples/ink/cold-wake-sanctuary-intake.ink`.

View file

@ -8,6 +8,10 @@ use, refusal, revelation, concealment, violence, withdrawal, trade, or any other
scene-valid action. "Dialogue tree" does not mean a tree made only of spoken
lines. It means an interactive branch structure for a character encounter.
Ink is the branch format for that structure. Ghostlight should not invent its
own dialogue-tree file format while Ink already exists and fits the job. See
`docs/architecture/ink-branching-scenes.md` for the integration contract.
Ghostlight should set up a scene, generate plausible things the protagonist or
NPCs could do, generate responses from the people present, and propagate the
consequences into world state, memory, belief, and social perception.
@ -46,7 +50,9 @@ withdrawal, refusal, or concession. That is the point of the machine.
For game use, the loop should be able to emit:
- a scene transcript
- candidate player choices, including speech and non-speech actions
- Ink scenes with candidate player choices, including speech and non-speech
actions
- compiled Ink JSON
- NPC response branches
- state/memory/social-perception deltas for each branch
- unresolved hooks for later scenes
@ -320,18 +326,19 @@ agent state + scene state
The next implementation should not try to simulate a city. Calm down, wizard.
Prototype one tiny branching-scene loop:
Prototype one tiny Ink-backed branching scene loop:
1. Load `examples/agent-state.cold-wake-story-lab.json`.
2. Select one scene and one acting agent.
3. Build a local awareness packet from existing state.
4. Compile projection controls.
5. Render a prompt that asks for an action or dialogue response.
6. Send it to Qwen.
7. Save the response as an event proposal.
8. Apply a small deterministic mutation:
- append event
- apply only mechanical world/resource/object deltas the resolver can prove
5. Generate or author an Ink scene with branch choices and NPC responses.
6. Compile the Ink scene to JSON with `inkjs`.
7. Save a sidecar training annotation that maps Ink branches to Ghostlight
state basis, actor intent, consequence surfaces, and mutation policy.
8. Apply selected branch consequences only through reviewed mutation:
- Ink variables can track local playthrough facts
- canonical state changes require resolver/reviewer approval
9. Manually review fuzzy state effects:
- add one memory or belief update
- adjust one or two `current_activation` values