Tracker Transitions — Design Document

Status: ✅ shipped 2026-10-29 as chat events M1 (scene directions on chat., lines on every reading surface; 19adee20e / eea8d9b8a, live-checked 2026-10-29, pushed with origin/develop f25b4ad4b). Planned 2026-10-17. Mockup: docs-internal/mockups/TrackerTransition.dc.html.

"when tracker is updated, make offer to make it a transition instruction for the LLM. file in the ledger to plan and see how it would look" — owner, 2026-10-17

This page builds on Trackers (Phase 1 shipped; typed values; per-message snapshots), the chat. scene editor (docs-internal/architecture/consoles/CHAT_STORY_SURFACE.md → Scene editor, Q1, B4), the Author's Note current-turn slot, and the self-guarding feature pattern (docs-internal/architecture/chat-engine/CLASSIC_PIPELINE_SIMPLIFICATION.md §7).

Overview

The reader can change the scene in chat.: open the scene editor, move Location from Tannery Row to Harbour market, raise Affection by 10, put a watch ledger in Kaelen's pack, and Save. Today that save is a correction: it rewrites the latest reply's snapshot, and the next reply reads the new state as if it were already true. The story never shows the move. The characters are suddenly at the harbour, and the prose either jumps there or ignores it.

A tracker transition is the other thing the reader often means: "make this happen in the story." When the reader changes trackers, the editor offers to turn the change into a scene direction for the next reply: "Location: from Tannery Row to Harbour market. Show it happening." If the reader takes the offer, the change is not written onto the past. The next reply is asked to play it out, and when that reply lands, its snapshot carries the values the reader set. The change shows under the reply that narrated it.

The reading, and what it corrects

The director read the ask as: after a tracker edit, offer a one-shot instruction for the next reply, built from the before and after values. That reading holds, with two corrections found in the code:

  1. Only the Now view edits. After this reply is read-only (SceneEditor.tsx, readOnly = showingPast || …; SCENE_COPY.pastIsReadOnly). The offer exists only where an edit exists: the Now view of the chat. scene editor, on the margin (desktop) and the sheet (phone).

  2. Accepting the offer can't also write the snapshot. A save writes onto the latest reply's snapshot (B4: "Save corrects the snapshot the next update reads"). Three readers treat that snapshot as what that reply's prose established:

    • the stage direction under the reply, built from the two snapshots either side of it (sceneModel.ts buildScene → snapshotChanges(prior, point.trackerJson));
    • the summary timeline (TrackerTimeline.Build), which folds the window's snapshots into Tannery Row → Harbour market;
    • the state block the next turn injects after that reply (WebTrackerHistoryInjector), which would say Location: Harbour market (already there) beside a direction saying move there.

    Write-then-direct makes all three lie: the previous reply's stage direction would read Location → Harbour market under prose set in Tannery Row. So an accepted offer stages the change: the snapshot stays, and the targets ride the direction onto the next reply.

Alternatives considered

Shape What it does Why not
A. Write now, then direct (the director's literal reading) Save corrects the latest snapshot; a separate one-shot note asks the next reply to narrate it Misattributes the change to the previous reply (stage direction, summary timeline), and the state block contradicts the direction. Undoing it later means a compensating snapshot write racing the eval
B. Stage, then land (chosen) The change becomes a pending direction with target values; the next reply is asked to play it out; its snapshot takes the targets —
C. Put it in the Author's Note with a one-turn life Reuses the note's field One note per conversation (web_conversations.author_note): it would overwrite the reader's own note, and its countdown, pause and expiry notice mean something else
D. Append it to the reader's message as out-of-character text No new storage Pollutes the reader's words in the transcript and in the eval's input; Hybrid can't strip it from the prose leg, because it carries no marker
E. A creator-authored transition rule per tracker ("when Location changes, describe the journey") Creator phrasing The eval's own updates already come from prose, so they need no instruction. Only the reader's edits do. Kept as a later, optional phrasing override (Non-Goals)
F. Have a model write the proposal Nicer sentences A model call on every edit: cost, latency, a failure path in the editor, and nondeterministic words the reader must review anyway. The story model already turns a plain direction into prose; the proposal only has to be clear

Design Goals

  1. A correction and a transition are different intents, and both stay one Save away. The reader chooses; Save commits either one.
  2. The record tells the truth. A snapshot only carries what its reply established. A directed change appears under the reply that played it out.
  3. Built from the values, never by a model. The proposal uses the stage direction's own vocabulary, per type, and the reader can edit it.
  4. One-shot, and replayable. It steers exactly one turn. A regenerate of that turn gets it again; later turns never see it.
  5. Reuse the channels that exist. The current-turn slot (ICurrentTurnMessageInjector), its typed marker, the Hybrid director-only strip, the context-budget line, the scene save's validation and screens.
  6. No trackers, no offer. The feature guards itself on the Trackers switch (§7).

Non-Goals

The design

When the offer appears

In the scene editor's Now view, as soon as the draft changes at least one tracker the reader can see, an offer card appears above the Cancel / Save pair. It is part of the form, not a second dialog (the form pattern: one pair per form). It reads:

Play it out in the next reply? Location: from Tannery Row to Harbour market. · Affection rises by 10, from 40 to 50. · Kaelen carries gains watch ledger. Skip · Use

The proposal: one template per type

Built in one place, a shared TypeScript function beside changeText (shared/src/chat/trackers/, so the stage direction and the proposal speak the same language). One line per changed tracker, in the creator's order, each a plain clause. The tracker's name carries no meaning the template can use: Location is not known to be a place. So the template is generic, and the editable text is what rescues it.

Type Before → after Clause
Freeform Tannery Row → Harbour market Location: from Tannery Row to Harbour market.
Freeform, from unset — → dry, cold wind Weather: becomes dry, cold wind.
Freeform, cleared dry, cold wind → — Weather: no longer dry, cold wind.
Number 40 → 50 Affection rises by 10, from 40 to 50. (falls by …)
Percentage 80% → 62% Ward strength falls from 80% to 62%.
One of a set neutral → wary Ilsa’s stance: from neutral to wary.
List + watch ledger, − 3 silver Kaelen carries gains watch ledger and loses 3 silver.
List, emptied → [] On stage: now empty.
Date / time 11:40 pm → 11:52 pm Time: from 11:40 pm to 11:52 pm.

Multiple changes in one save merge into one direction, one clause per line. The reader sees the clauses joined by line breaks in the field. A hand-typed value that isn't valid for its type (text in a number tracker) is refused on Save with the scene save's own message, before any direction exists.

The date/time row says no "moves on": a tracker's datetime is written in the creator's example format, and the template can't tell which of two values is later.

What the reader sees after Save

How it reaches the model

Storage — a pending direction on the conversation, consumed onto the turn.

Injection — the current-turn slot.

Landing — the targets win for their keys. After the reply, the tracker eval runs as today, with the previous snapshot as its prior. Its result is then laid under the targets: for each directed key, the snapshot stores the reader's value; every other key keeps the eval's answer. So the eval can't revert or drift a directed value (the reader said where the scene ends up), and nothing in the eval's prompt changes. If the eval fails, the reply's snapshot is the prior with the targets applied, so the reader never loses the change. This is a deliberate divergence: today a failed eval writes no snapshot (Failed, stats row kept). A directed turn writes one on that path, which also advances the eval's window past this reply.

Regenerate, versions, branch, delete

Interactions

Implementation Plan (Sliced)

One push unit: the slices below are only honest together (a stored direction nothing injects is a dead control).

Slice What
S1 — SQL web_conversations.scene_direction, web_messages.scene_direction, fn_set_conversation_scene_direction, the stamp onto the reader's row and the clear in the reply's storage transaction, branch column copy, idempotent through v1_run_all.sql
S2 — Server PUT / DELETE /api/conversations/{id}/scene-direction (reusing the scene save's validator and screens), SceneDirectionBlock, ToggleableCurrentTurnInjector + WebSceneDirectionInjector, LlmMessageSource.SceneDirection + Hybrid strip, the targets-over-eval landing in the tracker eval's write, /context-budget sceneDirectionTokens, the conversation read and the turn's terminal frame carrying the pending direction
S3 — chat. The proposal template (shared, beside changeText), the offer card in SceneEditor (both densities), the scene's pending marks, the composer's scene direction line, the reader's-turn Directed line

Open Questions

Owner, 2026-10-28: in chat, tracker changes should be events in the story — and the same model will carry dice roll animations, skill application and inventory application, so it is designed as a whole, not per feature. These defaults are on hold until that design exists; research draft: docs-internal/architecture/chat-engine/CHAT_EVENTS_RESEARCH.md. The build doesn't take them as written.

Decided 2026-10-28: docs-internal/architecture/chat-engine/CHAT_EVENTS.md §1. Defaults 1–4 and 6 stand; default 5 changes — the direction is one merged event line where the reply's stage direction sits, not a reader-turn line. The storage below (scene_direction columns) is replaced by the generic staged_events / turn_events (CHAT_EVENTS.md §3); S1–S3 are built as that doc's M1. Where this page disagrees with CHAT_EVENTS.md, that doc wins — in particular:

  • Stamp and clear are one step. The turn's storage transaction stores the reader row, the reply and the consumed direction together; there is no separate stamp at the reader insert.
  • A turn that dies before its first token has no reader row on the standard lane, so there is nothing to regenerate; the direction stays staged and the next send carries it (replaces the edge and the Regenerate bullet that say "a regenerate of that turn sends the direction").
  • The slot's emptying reaches the client through the conversation read after done, not the terminal frame (S2).
  • The failure-path write (Landing) is the general rule for every event with effects (CHAT_EVENTS.md §6).

Each has a recommended default; the build takes the default unless the owner says otherwise.

  1. Who wins on the next reply, the reader's target or the eval? Default: the target, for the directed keys only. The alternative (the eval wins whenever it set a value) lets a reply that walks past the harbour end at "the fishmonger's stall", which may be truer to the prose but drops the reader's word.
  2. A regenerate while a new direction is pending. Default: the regenerate replays only its own turn's direction; the pending one waits for the next new message. The alternative sends the pending one on the regenerate, which makes "edit the scene, then regenerate" a way to redo the last reply with the move in it.
  3. Trackers switched off with a direction pending. Default: kept and inert, as a paused Author's Note. The alternative drops it.
  4. Is the offer collapsed or armed by default? Default: collapsed (Skip / Use). The owner's word is "offer". A reader who always wants transitions could get a per-story preference later.
  5. Show the Directed line on the reader's turn? Default: yes, one italic line, pressable for the full text. It is the only record of why the reply moved the scene. When the eval agrees, it reads the same as the reply's own stage direction one screen below (see the mockup). The alternative folds it into that stage direction as a prefix (— Directed · Location → Harbour market … —) and drops the reader-turn line.
  6. A per-tracker creator phrasing (Phase 2). Default: not now.

Acceptance Criteria

The feature is not done until every box below is verified ✅ against the running product.

User use cases — satisfiable + accessible (verify by driving the UI, not the code):

Behavior:

Invariants that must stay true (carve-outs):

Edges: