Tracker Start Values per Greeting — Design Document
Status: ✅ Shipped — S1 and S2 are both built and pushed (kb-audit 2026-10-29). Decided 2026-10-17: the owner chose
Option A and took the defaults for Q1–Q4, and added one requirement: a tracker added later must be detectable. The
delivery plan, with contracts, milestones and lanes, is
docs-internal/architecture/chat-engine/TRACKER_GREETING_START_DELIVERY.md. The Acceptance Criteria boxes below are
not ticked on this page; the delivery doc carries the live-pass record.
S1 — shipped (SQL ff1bd3e14 2026-10-17; runtime + authoring d7d649f6b 2026-10-18): the three greeting write
doors take trackerJson, the starts read is in, the AI ladder and the manual run screen the values, and all three
greeting editors carry the block.
S2 — shipped (9ff12ce50 + 1f8d4c005, live-checked 2026-10-29, fix b96f082d8; pushed with f25b4ad4b): the
package keeps its own start values per curated greeting, the package save writes them in its own transaction (checked
against the set the save leaves), the resolver lays them over everything else, the cast section falls back to them
before the first snapshot, the publish checks screen them, and the builder's greeting step carries the block, with the
cast picked from the members' names.
This page builds on Trackers (Phase 1, T1, P1 and C1 shipped) and on Package Cast.
Overview
A tracker has one starting value today. A character can have many greetings, and each greeting opens the story somewhere else: one in the tavern at dusk, another on the road at dawn. The tracker's starting state should match the greeting the reader picked: location, time of day, affection, who is on stage.
The tracker spec already decided what this is. It named the field tracker_overrides_json and gave a greeting's value
precedence over every other starting value (trackers.md → Package Integration, and its
resolved Open Question 5). This page now calls the field tracker_json, following the owner. The tracker spec also
sketched how: store the starting values as the first message's tracker_json (trackers.md, Implementation Map →
Conversation Creation Flow). This page maps today's code, compares the ways to build it, records the decision, and adds
the detection of trackers added later.
Owner decisions (2026-10-17)
"Tracker greeting start values - it needs to be possible to detect a new addition to tracker. Otherwise agreed. Greeting is basically the first message so it having it's own tracker_json is a good solution"
- Option A.
- The greeting carries its own
tracker_json, in the shape ofweb_messages.tracker_json. - The greeting's values become the story's first tracker snapshot, frozen like the greeting's text.
- The resolver layers them into the initial values that every "no snapshot yet" fallback uses.
- The greeting carries its own
- Q1–Q4 take this page's defaults:
- the greeting picker doesn't show the starts;
- package authors set starts on their curated greetings;
- Reset puts back the creator's current value;
- no assistant or agent-tool authoring in S1.
- New: a tracker added later is detectable. Trackers get bound after a greeting's starts were written, and after a story started from that greeting. The system tells such a tracker apart from one the author set or deliberately left on its default, in the greeting editor and in the running story. A missing key is never silently treated as authored. See Detecting a tracker added later.
Today's code
Line numbers are at 7d64d82c5.
What a starting value is now.
| Piece | Where | What it does |
|---|---|---|
| The tracker's own start | trackers.initial_value (68_tables_trackers.sql:22), 500 chars (CreatorFieldLimits.TrackerInitialValue) |
The default. |
| Per-binding start | entity_tracker_bindings.override_initial_value (68_tables_trackers.sql:126) |
A character's or package's own start. Written by the API and agent proposals only; the character's Trackers section shows it read-only (CharacterTrackersSection.tsx:272). |
| Effective start of a binding | TrackerRepository.GetActiveForOwnerAsync, COALESCE(b.override_initial_value, t.initial_value) (TrackerRepository.cs:141) |
One value per binding. |
| The conversation's set | ConversationTrackerSetResolver.UnionAsync (ConversationTrackerSetResolver.cs:59-84) |
Cast roster first, then the character's bindings, then the package's; deduped by key, the first definition wins for its start too. Read live every turn. |
| The cast's start | the synthesised roster (ConversationTrackerSetResolver.cs:128-129) |
InitialValue = the members with present_at_start, in cast order. |
Where the greeting is chosen and stored.
- The link. The conversation keeps
web_conversations.greeting_id(07_tables_conversations.sql:66; FKON DELETE SET NULL,15_deferred_constraints.sql:42). - The text is copied into the first assistant row of
web_messagesat start, only when it is not empty:- the character start,
fn_create_conversation_in_lane(11_conversation_migration_functions.sql:496-511); - the package start (
47_package_functions.sql:792-800).
- the character start,
- The scenario is read live from the greeting on every turn (
WebScenarioContentProvider). - Package greetings.
- A package opens on its default
packages.greeting_idor on the reader's pick, which must be one of the package character's greetings (47_package_functions.sql:651-686). - The package's curated set is
package_greeting_bindings(21_tables_packages.sql:167-178). - A package can wrap a public character it does not own (
47b_package_publish_unification.sql:540-562).
- A package opens on its default
- One create door. Every client starts a conversation through
POST /api/conversations(ConversationsEndpoints.cs:962; package path:1094, character path:1307).
The greeting row never gets a snapshot. The first snapshot is written by the first eval, after the
reader's first message. It seeds each key the prior state lacks from InitialValue, canonicalised when it
fits the type and kept as authored when it doesn't (WebTrackerEvalService.cs:221-241).
Until that first snapshot, four places fall back to InitialValue on their own:
- the eval prompt's current values, using the raw value, not the canonical one (
EvalRequests.cs:115); - the lorebook entries a linked tracker pins (
WebTrackerPinnedKnowledgeSource.cs:70); - who the cast section puts on stage, read from
present_at_startdirectly (CastPresence.cs:33-34); - the Story surface's scene:
ConversationTrackerDto.InitialValue(ConversationsEndpoints.cs:2516-2520) becomes "Starting values — the scene keeps track from the first reply" (sceneModel.ts:74-81,sceneCopy.ts:34).
Gaps that exist today:
- The story model sees no tracker state on the first reply. The history injector renders only rows that carry a
snapshot (
WebTrackerHistoryInjector.cs:58-72), and the greeting has none. Hybrid's opening scene is the same (HybridLegPlanner.cs:650-673). - The reader can't change the scene before the first reply. The editor needs a snapshot to save onto
(
SceneEditor.tsx:91-93), and the scene save answers "conflict" when there is none (78_tracker_functions.sql:667-669). - The only per-greeting start that exists is inferred. With no snapshot there is no watermark, so the first eval's
window starts at the greeting, read as an assistant-only exchange (
WebTrackerEvalService.cs:409-416,EvalTurns.cs:8). The eval may pick "road" out of the greeting's prose, but only after the first reply, and only for what the prose says.
A tracker added mid-story, today. A tracker bound after a story already has snapshots is picked up by the resolver on the next turn. Then:
The eval is shown its default as if it were recorded state. The prompt calls these values "as last recorded" (
TrackerEvalLlmService.cs:41), and tells the model to change a value only on clear evidence (:49). It reads only the newest exchange. So a default that is wrong for where the story now is usually sticks, and nothing in the prompt says the tracker is new.The eval seeds it into the next snapshot (
WebTrackerEvalService.cs:225-241).Until then, nothing else shows it. The story prompt, Hybrid's director, the scene ("not set") and the writing client's bar don't show it: they render only a snapshot's own keys (
WebTrackerHistoryInjector.cs:89-92).A blank never lands in a snapshot.
- The eval refuses blank values (
TrackerValueFormatter.cs:177). - The one-key edit removes a key on blank (
78_tracker_functions.sql:493-494). - The scene save turns a blank into the default or a removal (
ConversationsEndpoints.cs:2268-2271).
So at runtime, "absent" is the only way a snapshot says "no value".
- The eval refuses blank values (
Reset. A blank value in the scene save resets the key to the binding's start, else the tracker's
(ConversationsEndpoints.cs:2268-2271, InitialTrackerValue at :2367-2378).
Typed values.
- The normaliser.
TrackerValueFormatter.TryNormalize(TrackerValueFormatter.cs:172-262) has no TypeScript twin:- numeric clamps into its range, percentage into 0–100;
- enum takes the declared spelling;
- list becomes a canonical JSON-array string (an explicit
[]is a legal empty list); - freeform and datetime are trimmed.
- The words.
DescribeType(:107) words the expected shape. - The checks. The scene save already validates this way and refuses with the key named
(
ConversationsEndpoints.cs:2265-2293). A definition's own config is checked byCreatorTrackerEndpoints.ValidateTypeConfig.
Greetings.
- The table.
character_greetings(03_tables_characters.sql:236-267). Limits: name 60, description 500, text 20,000, scenario 10,000 (CreatorFieldLimits). There is no cap on the number per character. - The writer. The only CRUD writer is
fn_upsert_character_greeting(07_greeting_migration_functions.sql:128-271). - Three edit paths:
- the character page's Greetings step (
CharacterFormPage.tsx:858-908,useCharacterGreetingForm.ts:80); - the Forge character's Greetings section (
CharacterGreetingsSection.tsx:66-180); - the greeting editor (
GreetingEditForm.tsx), opened standalone, from the package builder and from the detail view.
- the character page's Greetings step (
- No editor loads trackers.
- Routes:
CreatorCharacterEndpoints.csPOST:593and PUT:602;CreatorGreetingEndpoints.csPUT:180. Its edit lock while the character is in review is at:256-263, and its three-state update at:273-284.
- One DTO. The creator's greeting read and five reader surfaces share it:
GreetingOverview(BrowseModels.cs:450-469). - The promise. Both tracker forms already promise this feature: "per-greeting overrides coming soon"
(
TrackerFormPage.tsx:313,TrackerEditForm.tsx:232).
Around the edges.
- Branching copies every message's
tracker_jsonand thegreeting_id(38_branch_conversation.sql:367,:520-550). - The greeting can't be regenerated: a conversation with no reader line refuses it (
WebChatTurnService.cs:236-249). - The reader can delete the greeting row (
ActionableRow.tsx:140). - Re-picking a greeting starts a new conversation (
GreetingChoiceModal.tsx). - Discord runs no tracker eval.
- Character export carries no trackers or bindings (
CreatorModels.cs:393-418).
Design Goals
- The start matches the greeting picked, for every tracker type and for the cast.
- A started story never changes when its greeting is edited later, the same as the greeting's text.
- One answer to "what does this tracker start at", for every consumer.
- Values are written where the greeting is written, and checked like any other tracker value.
- A tracker added later is never mistaken for an authored one: not in the editor, not by the eval.
- No new LLM call.
Non-Goals
- Inferring starts with a new call. The first eval keeps reading the greeting for whatever it leaves blank (Option C).
- An editor for the per-binding start. It exists in the schema and stays as it is.
- Changing binding precedence. P1 ships "character first, then package" and this feature keeps it.
- Values for conversation-bound trackers (T2). A reader adds those after the start, so no greeting names them.
- Blanking a tracker that has a default. A greeting can leave a tracker on its default or give it a value. A list
tracker can start empty (
[]). A freeform tracker with a default can't start with nothing. - Back-filling a tracker added mid-story from older history. The eval reads its usual window and is told the value is a default.
- A reader-facing "new tracker" badge. The scene shows a new tracker as "not set" until the eval has recorded it.
- Export and import. The character export carries no trackers to attach values to, and SillyTavern cards have no field for it.
- Discord. Trackers are web-only.
Options
A, B and D share the authoring block in the greeting editors and the write-time validation described under the design. They differ in storage and in when the start becomes the story's. C has no authoring at all. None of them needs a backfill, and none reaches Discord.
| A — Opening snapshot | B — Side table | C — Eval reads the greeting | D — Live layering only | |
|---|---|---|---|---|
| Storage | JSON map on the greeting, keyed by tracker key | greeting_tracker_values(greeting_id, tracker_id, value) |
none | JSON map on the greeting |
| The start is fixed | at creation, on the greeting row | never: read live | at the first eval | never: read live until the first eval |
| First reply's prompt has the state | yes, through the existing injector | no | no | no |
| Reader can edit before the first reply | yes, through the existing scene save | no | no | no |
| Cast and package trackers | by key: cast and package keys fit |
cast has no tracker row; needs a second table for packages |
inferred only | by key |
| New consumer code | one write at start, one eval-window rule | a join in every resolve | an opening eval call | one resolver seam |
| Exact typed values | yes | yes | guessed | yes |
A — The greeting's values become the story's first snapshot. Chosen (2026-10-17); designed in full below.
B — A side table.
- What it buys. Rows keyed by
tracker_idcascade cleanly on delete. - What it costs.
- Everything else speaks
key(snapshots, eval answers, scene saves), so every read would map ids back to keys. - The cast roster has no tracker row, so it can't be named.
- A package author can't set values on a greeting they don't own without a second table.
- Read live, it neither freezes the start nor reaches the first reply.
- Everything else speaks
The values are always read and written with their greeting, so rows buy nothing the map lacks.
C — The eval reads the start off the greeting. This is today's baseline, not a new design.
- As a deliberate step it would be an opening eval call at start.
- What that costs.
- It bills a reader who hasn't written anything.
- It can't say what the prose leaves out ("affection: wary", "gold: 50").
- It guesses typed values.
It stays as the complement: whatever a greeting leaves blank, the first eval still infers.
D — Live layering only. The resolver puts the greeting's value into each definition's InitialValue, and every
fallback listed above follows with no change of its own. It is small.
- But the first reply still sees nothing, and the scene stays read-only until then.
- The start stays live until the first eval: the text was copied at start, but the values were not.
- Freezing a copy on
web_conversationswould close that, with a column that duplicates what a snapshot already is.
D is A's supporting rule, not a design on its own.
Recommendation: A, with D's seam
Why A:
It is the spec's design. trackers.md already resolved the field and the precedence, and its creation flow stores the starts "as the first message's
tracker_json". This is inside documented vision, so it gets the durable build.It uses the model that exists. Every assistant row carries a full snapshot, and the greeting is the conversation's first assistant row. Almost every reader already reads snapshots:
- the injector;
- Hybrid's current-turn block on the first turn;
- the eval's prior state;
- the scene;
- the cast section;
- pinned knowledge;
- the first summary's
tracker_start_json; - branching.
The scene needs one change (the opening shows no stage direction) and the eval needs one (the watermark rule).
Frozen like the text, live like the scenario. The story's start is history: copied once, never rewritten. "The creator's start value", which is what Reset puts back, stays live like the scenario.
It closes both of today's gaps. The first reply reads the start, and the reader can adjust it before writing a word.
The cast fits.
castis a key like any other: a list of member names, checked against the roster.
D's seam stays, as A's supporting rule. The resolver layers the greeting's values into InitialValue. So Reset, the
scene's starting values, and every "no snapshot yet" fallback give the same answer as the opening snapshot. That covers
conversations without one:
- created before this feature;
- started without a greeting;
- opened on a greeting with empty text;
- after a failed opening write.
The greeting's map is a primary-key read beside the conversation read the resolver already makes. It happens only when the conversation has a greeting.
Two costs, named and designed.
The watermark. A snapshot on the greeting would make it the first eval's anchor, and the greeting text would drop out of the first eval's window. Keys the greeting leaves blank could then no longer be read off its prose: a regression.
Rule: the opening snapshot is the first eval's prior state, but not its watermark. The eval reads the story's first snapshot and knows whether it is the opening: an assistant row no model wrote, with no row before it (the chat client's own greeting rule). The eval passes over that row when it looks for the anchor. So the first eval still reads the greeting and the first exchange, starting from the authored values.
Where the write runs. The set (roster synthesis, dedupe, binding starts) and the type normaliser live in C#. Writing the snapshot inside the SQL start would copy all of that into plpgsql. The repository can't call WebChat, so the create transaction can't build it either.
Decision: write it right after the create, in the same request, before the response. Both create paths (
ConversationsEndpoints.cs:1094package,:1307character) call one WebChat service. The client can't send a first message before the response arrives. The write is guarded: it only lands when the conversation has no snapshot at all. A failed write degrades to the first eval seeding the same values, through D's seam.
No backfill. Stories created before this feature keep today's path. The fallbacks stay for them.
The design
Schema (idempotent, through v1_run_all.sql):
-- S1: the greeting author's starts
ALTER TABLE character_greetings ADD COLUMN IF NOT EXISTS tracker_json JSONB;
-- S2: the package author's starts, per curated greeting
ALTER TABLE package_greeting_bindings ADD COLUMN IF NOT EXISTS tracker_json JSONB;
-- each: CHECK (tracker_json IS NULL OR jsonb_typeof(tracker_json) = 'object')
Values are strings in the same canonical form as a message's tracker_json. A list is a JSON-array string. Example:
{"location": "The Rusty Tankard", "time_of_day": "Evening", "mood": "", "cast": "[\"Innkeeper Bran\"]"}.
Three states per key. This is what makes a later addition detectable:
| In the greeting's map | Meaning | The story starts at |
|---|---|---|
"location": "The Rusty Tankard" |
the author set it | that value |
"mood": "" |
the author left it on its default | the binding's start, else the tracker's |
no weather key |
never set on this greeting: the tracker was bound after the author last saved the starts | the default, and the editor marks it New |
""is a convention of the map only. It never reaches a snapshot: the opening stores only non-empty canonical values.{}is stored as NULL, the one spelling of "nothing set".- A map belongs to its character. When a greeting moves to another character or is detached, a trigger clears its map. Keys mean nothing on another character, and there every bound tracker is New.
Precedence, for each key in the conversation's resolved set:
- the package's greeting binding (S2);
- the character's greeting;
- the winning binding's own start (character first, as P1 ships);
- the tracker's
initial_value.
The character greeting's values land only on the character's own trackers, never on the cast roster or a package
tracker. For cast, step 1 applies, else the present_at_start members.
Write path. The greeting routes take trackerJson, a whole map in three states:
- omitted keeps it;
{}clears it;- a map replaces it.
The editor sends every key already in the map that is still bound, plus every row the author touched. A row that was never set and that the author didn't touch stays out, so it stays New.
Each value is checked the way the scene save checks one:
- the key must be bound to the greeting's character (S1), or be in the package's resolved set,
castincluded (S2); ""keeps the default;- a value equal to the one already stored is kept as stored. A tracker re-typed after its value was saved therefore never blocks a Save. The editor flags such a value, and a new off-type value is still refused;
- any other value goes through
TryNormalizeagainst that definition, and the canonical value is stored; - at most 500 characters, 64 keys;
- a refusal is a 400 naming the key, worded with
DescribeType.
Where the write runs.
- A sibling function. The map is written by
fn_set_greeting_tracker_json(greeting_id, jsonb), in the same repository transaction as the greeting upsert. - Never a new parameter on
fn_upsert_character_greeting. The start functions document why (11_conversation_migration_functions.sql:250-264,47_package_functions.sql:430-437): a replayed older tree would leave two overloads, and every call at the old arity would fail as ambiguous (42725). - S2 follows the same rule for the package save.
Around the write.
- A standalone greeting (no character yet) takes no values. Its editor hides the block.
- The edit lock. The values ride the greeting's existing edit lock while the character is in review.
- The triggers. The values get their own arm in
trg_greeting_changelog, which diffs named columns (43_entity_changelog_triggers.sql:701-724), and in the greeting's content stamp (94_entity_release_dates.sql:393-400). - S2. The package save keeps a re-listed greeting's map, the way an agent proposal keeps a re-listed binding's
override_initial_value.
Start path. After the create returns, the service:
- stops when trackers are off for the conversation, or it has no greeting;
- resolves the set, with greeting-aware starts;
- takes each non-empty start and canonicalises it with the eval's seed rule, which is extracted into one helper (the eval seed, Reset and the trackers DTO each do it separately today);
- writes the result in the set's order with
fn_seed_opening_tracker_snapshot(conversation, json).
The function takes the tracker_state lock and says whether it wrote. It writes only onto the conversation's first row,
only when that row is an assistant row, and only when no row in the conversation has a snapshot. An empty start writes
nothing, so a story with no starting values behaves exactly as today.
Read path.
- The resolver.
UnionAsynctakes the conversation's greeting and layers its values intoInitialValue. A greeting that has been soft-deleted (the standalone delete keepsgreeting_idon its conversations) layers nothing. - The eval:
- the watermark rule above;
- the new-tracker mark below.
- The scene. The opening row never shows a stage direction. The first reply's direction compares with the opening.
- Cast (S2). The cast section's no-snapshot start reads the resolved roster, so S2's greeting cast value holds even without a snapshot.
UI.
Greeting editors. A Starting values block in all three edit paths:
- one row per tracker bound to the character, typed to the tracker;
- the tracker's own start as the placeholder ("Default: Day 1, Morning"), so a blank field means the default;
- a row the greeting never set is marked New;
- a row whose stored value no longer fits a re-typed tracker is flagged;
- "Use default" on each row, and "Use defaults for new trackers" on the block.
The block saves with the greeting form's own Save and Cancel. Each greeting's row in the Greetings list shows how many new trackers it hasn't set yet.
One typed field, extracted. The scene editor's typed field (
chatConsole/src/chat/scene/SceneEditor.tsx:304) moves intoshared/src/components/common/with a showcase entry. The scene editor and the greeting block both use it.The scene. Before the first reply, the scene stands on the opening snapshot and can be edited. Its note changes from "the scene keeps track from the first reply" to copy about the story's start.
The writing client's bar.
TrackerBarrenders on every assistant row with a snapshot, so the greeting bubble gains a collapsed bar showing the start.Tracker forms. The "coming soon" line points at the greeting editor instead.
Package builder (S2). The greeting step gets the same block for each curated greeting. It covers the package's whole set, and the cast row offers chips over the members' names.
Detecting a tracker added later
The owner's requirement (2026-10-17): a tracker added after the starts were written, or after a story started, is told apart from one that was authored.
In the greeting editor.
- The read.
GET /api/creator/characters/{id}/greeting-tracker-startsreturns the character's bound trackers, each with its effective default. For every greeting it also returns:values: the still-bound keys only, with""where the author kept the default;newKeys: bound trackers the greeting has never set;misfitKeys: stored values a re-typed tracker no longer accepts.
- Why on the server. The type rules are C#-only, and the effective default isn't on any existing creator read.
- What the editor shows. New rows are marked, and the greeting's row in the list shows the count.
- When the mark goes. It goes when the author gives the tracker a value or chooses its default. It never goes because the author saved some other field.
In a running story.
- Detected positively, by date. A tracker is new when its binding was created after the story's first snapshot, and
nothing has recorded it since.
- Why not a missing key. A key missing from the snapshots is not enough: a reader who blanks a value on the opening removes its key, and that tracker isn't new.
- What keeps the date. Re-binding a tracker, or re-saving a package that already lists it, keeps the binding's date. Unbinding and binding again makes it new.
- What the eval sees. The line carries
(new tracker: added after this story began, not recorded yet), after its default or after(unset), with one note after the list: if the exchanges show what it is now, output that; otherwise a default stands. - After that. The eval that records it is the last to mark it.
- For stories that never grew. When no tracker was bound after the first snapshot, the eval prompt is byte-identical to today's.
- Pre-feature stories. For a story created before this feature, the "first snapshot" is its first eval's, so an addition is detected there too.
Limits, by design.
Only the eval sees a new tracker before it is recorded. The story prompt, the scene ("not set") and the bar show it once the eval has recorded it, so a default that's wrong for where the story now is never reaches the story as state. Owner question O3.
Changes to a tracker that stays bound are not "new" to a running story. Its binding keeps its date:
- a re-keyed tracker;
- a default added to an existing tracker;
- one tracker swapped for another with the same key between two turns.
The greeting editor still marks a re-keyed tracker New.
What each case does
| Case | Behaviour |
|---|---|
| Character, package and cast trackers | By key. S1 names the character's trackers; S2 adds package trackers and cast on the package's greeting binding. |
| Conversation-bound trackers (T2) | No greeting value. They start at their own start, seeded by the first eval. |
| A greeting edited after a story started | The story's opening snapshot is untouched, and the opening shows no stage direction. Reset and keys bound later follow the edit, as they follow tracker edits today. |
| A tracker bound to the character after the starts were written | Every greeting marks it New. It starts at its default until the author sets it. |
| A tracker bound after a story started | The next eval marks it new, with its default or unset, and records what it can. The story prompt, the scene and the bar show it from then on. |
| A tracker unbound or deleted later | The key stays in the opening snapshot. The injector and the eval drop keys outside the set (WebTrackerHistoryInjector.cs:92), and the scene lists a stray key last, as it does today. In the greeting's map the key is ignored, absent from the editor, and dropped on the block's next save. |
| A tracker re-keyed | The new key is New on every greeting; the old key is stale. A running story doesn't mark it new: its binding is old, so the eval shows its default unmarked, as today. |
| A greeting moved to another character, or detached | Its map is cleared. On the new character every bound tracker is New. |
| A tracker re-typed after the value was saved | At start the value is canonicalised when it fits and kept as authored when it doesn't (the seed rule). The editor flags it; saving the block with the value unchanged still works. |
| The reader's inline edit | Works on the opening row like any reply's snapshot, before and after the first reply. Reset puts back the greeting's value. A scene save made while the first eval runs wins key by key. |
| Branching | Copies the opening snapshot with the messages. No change. |
| Regenerating | The greeting can't be regenerated. A regenerated first reply reads the opening snapshot as its prior state and the greeting in its window. |
| Re-picking a greeting | Starts a new conversation with its own opening snapshot. |
| Start without greeting, or a greeting with empty text | No row to carry a snapshot, so no opening is written. Until the story's first snapshot exists, every turn carries the canonical start values (greeting-aware where a greeting is set) as a state block at the head of the reader's turn, on every model leg: Classic, the Hybrid director in both shapes, and the writer. Nothing is written for it; the first eval seeds the same values and the normal path takes over (owner, Relay eod-521, 2026-11-25). |
| Greeting deleted after the start | The story keeps its opening snapshot, and Reset falls back to the binding's start or the tracker's. A hard delete sets greeting_id to NULL. A soft delete keeps greeting_id, but the resolver skips a deleted greeting. |
| The reader deletes the greeting row | Its snapshot goes with it. The no-snapshot fallbacks resume, and the first eval seeds the starts. |
| Trackers off for the conversation | No opening snapshot. Nothing else changes. |
| Visual-novel runs | Their own start path with trackers off: no opening. |
| Discord | Untouched. Trackers are web-only. |
| Import and export | Not exported. Imports never create a map. |
| Turn cost | No new call. The first prompt grows by the state block (tens of tokens). The tracker-eval line is still reserved from the eval's own prompt builder (FeatherlessComputeCostEstimator.cs:565-579), now fed the opening's values and any new-tracker mark. Each eval adds one indexed read (the story's first snapshot). |
| Public or author-only | Creator content, like the scenario. Only the creator's starts read carries it. greeting_view and every reader DTO stay without it: browse greetings, package details, the public character, the conversation greeting re-pick. Readers meet the values in the scene once the story starts. Hidden trackers stay hidden as they are today: a snapshot travels whole, and the scene filters is_visible. |
| Moderation and all-ages | The values join every place that screens the greeting, rendered as key: value lines: the moderator projection, which the all-ages attachment screen also reads (EntityContentExtractionService.cs:347-361, SfwAttachmentTexts.cs:126-139); the AI check's greeting fields (PublishRequestFieldLoader.cs:204-216); the SQL keyword pass over greetings (32_run_content_checks.sql:360-390); the verified-creator scan (26_verified_creator_functions.sql:141-155). They are prompt material, like a tracker's initial_value (26:376-377). |
| Agent proposals and tools | Unchanged in S1. Agent-proposal edits patch named fields, so a patch that doesn't name the new field keeps it, and its undo (an inverse edit) doesn't touch it either. Undoing a greeting an agent proposal created deletes the greeting, map included (68h_composer_undo.sql:856-870). The creation stamp leaves the field out while it is empty, so older undos still match. |
Slices
S1 — Character greetings and the opening snapshot. 📋 Two pushes: its SQL first, then the runtime and the authoring as one push unit. The runtime alone would change every tracker character's new stories before authors could fix their starts.
Its SQL. The column, the setter, the re-parent trigger, the opening function, changelog, content stamp, agent proposals stamp and the SQL screening.
The runtime (inside the unit), with the moderator projection's screen:
- D's resolver seam and the one start rule;
- the opening write;
- the eval-window rule;
- the new-tracker mark;
- the scene's opening.
Every new tracker story now opens on its defaults.
Authoring (inside the unit; 🔨 built, awaiting the unit's live pass). The greeting routes and their validation, the starts read, the AI ladder's screening, all three greeting editors with the extracted typed field and the New marks, the tracker forms' copy, docs.
Package conversations get the character greeting's values for the character's trackers; package trackers and the cast keep their defaults.
S2 — The package's per-greeting values, cast included. 🔨 Built (2026-10-28), awaiting its live pass:
- the column on
package_greeting_bindings; - the package save;
- the builder block;
- validation against the package's set;
- the cast section's no-snapshot start from the resolved roster.
- the column on
T — Tooling check. 📋 The agent lane (staging, apply, undo) and the authoring tools are checked against the new field: they leave it intact and never write it (Q4).
Open Questions
Resolved by the owner (2026-10-17):
- Q1 — Show the starts in the greeting picker? No. The values appear in the scene once the story starts.
- Q2 — Package authors set starts on greetings they don't own? Yes, on the package's greeting binding (S2). The character's author never sees them.
- Q3 — What Reset puts back. The creator's current value for this greeting (live, like the scenario).
- Q4 — May the assistant and agent proposals author greeting starts? Not in S1. The tools leave the field alone, and the T check confirms it.
For the owner (each with the default the plan builds):
- O1 — Defaults-only openings. Every new conversation whose trackers have any start opens on a snapshot of those starts, even when its greeting sets nothing (Decided here, below). A delivery brief asked instead that "a greeting without starts behaves exactly like today". - The precise cost. Take a character with several greetings and a default that fits only one of them, location "the tavern". A story opened on the road greeting now has "the tavern" asserted to the story model right after the road greeting, as recorded state. Today only the eval sees that default, and it can correct it from the greeting's prose. - What softens it. The authoring ships in the same push, and every greeting that hasn't set the tracker shows it as New. - The alternative. Open only with values a greeting set itself, and keep defaults eval-only as today. - Default: keep the decision. The carve-out is then "a story whose trackers have no start at all behaves exactly like today".
- O2 — withdrawn (2026-10-17). New trackers are detected by their binding's date, so one with no default is marked too.
- O3 — Before the eval records a new tracker, only the eval sees it. Default: as designed. The alternative injects the default into the story prompt at once.
Decided here (overrule if wrong):
- A JSON map keyed by tracker key, not a side table, so it speaks the same keys as
tracker_json. - The column is named
tracker_json(the owner's word). It supersedes trackers.md'stracker_overrides_json. - Three states per key: a value,
""(keep the default), or absent (never set: New). - Every new conversation whose greeting row gets at least one non-empty start gets an opening snapshot, even when the greeting itself sets nothing. This changes the first prompt and the scene for every new story with tracker starts. That is the point: the story starts from its stated state.
- The write runs right after the create, not in SQL; a failed write degrades to the first eval's seed.
- The opening row is not the first eval's watermark.
- Standalone greetings carry no values; stale keys are ignored; values that don't fit after a type change are kept as authored at start.
- Binding precedence stays as P1 ships it. trackers.md's "package binding over character binding" (Package Integration, point 4) was superseded by the resolver's "character first".
- The cast section's fallback moves with S2, not S1. In S1 the opening snapshot already carries the roster's start.
Acceptance Criteria
The feature is not done until every box below is verified ✅ against the running product. S2 lines are marked; every other line is S1. The delivery plan maps each line to its milestone and its proof.
User use cases — satisfiable + accessible (verify by driving the UI, not the code):
- UC1 As a creator, I can set a greeting's starting values in the Forge: Creator's Space → the character in the Forge → Greetings → a greeting → Starting values. There is one row per bound tracker, typed to it, with its default as the placeholder. I save with the greeting form's own Save, or discard with Cancel.
- UC2 As a creator, I can do the same in the character page's Greetings step, for a character with trackers bound.
- UC3 As a creator, I can do the same in the greeting editor when it opens a greeting that belongs to a character (from the package builder or the detail view). A standalone greeting shows no block.
- UC4 As a creator who has just bound a new tracker to my character, I see on each greeting's row in the Greetings list that it has a new tracker without a start. Inside the greeting, that row is marked New. I can give it a value, or keep its default with "Use default" or "Use defaults for new trackers", and after saving the mark is gone.
- UC5 As a reader who starts a chat on the "road" greeting, the scene shows the road's values before I write anything. A chat started on the "tavern" greeting shows the tavern's.
- UC6 As a reader, I can change a starting value in the scene before my first message, and the first reply starts from my change.
- UC7 As a reader in the writing client, the greeting bubble carries the tracker bar with the starting values, and I can correct one there.
- UC8 (S2) As a package creator, I can set starting values, including who is on stage, for each curated greeting in the package builder's greeting step. This works on a public character I don't own, and new trackers are marked the same way.
Behavior:
- A greeting save with
trackerJsonstores canonical values:7/10→7,evening→ the enum's spelling,rope, lantern→ a JSON array,[]kept as an empty list. A""is kept as "use the default". Omitted keeps the map,{}clears it, a map replaces it. - The starts read returns each greeting's
values, itsnewKeys(a tracker bound after the last save shows up there) and itsmisfitKeys(after a re-type). Stale keys are not returned. - A character start and a package start both write the opening snapshot onto the greeting row: the greeting's values over the defaults, canonical, every non-empty key of the resolved set, in the set's order, hidden trackers included.
- The first reply's prompt carries the opening state block: on Classic right after the greeting, on Hybrid in the beat
leg's current turn (
HybridLegPlanner.cs:583-587). Verified with mock LLM captures. - A story with no snapshot at all (no greeting, a greeting with empty text, a failed opening write) carries the start
values at the head of the reader's turn on every leg, once, before the at-end enhance, until its first eval stores a
snapshot; the next turn carries that snapshot instead and no start block (I2 as amended, Relay eod-521). The
/context-budgettracker figure counts the block. - The first eval's prior state is the opening snapshot, and its transcript still includes the greeting (mock LLM capture). A key the greeting leaves blank can still be filled from the greeting's prose.
- A value the first reply doesn't change is carried into the first eval's snapshot unchanged.
- Reset in the scene puts back the greeting's current value.
GET /api/conversations/{id}/trackersreturns it asinitialValue. - A tracker bound after a story's first snapshot: the next eval's prompt shows it with its default, marked
(new tracker: …), plus the one-line note. That eval records it. The following eval doesn't mark it. The story prompt and the bar carry it from that recording on, and before it the scene shows it as "not set". - A tracker with no default bound mid-story shows as
(unset), also marked, until an eval sets it. - A greeting moved to another character or detached (a binding proposal) loses its map; on the new character every bound tracker is New.
- Branching at the greeting keeps the opening snapshot.
- The opening row shows no stage direction, even after the greeting's values are edited or the reader changes a value before the first reply. The first reply's stage direction compares with the opening.
- A greeting's start value is screened everywhere the greeting is:
- the moderator projection;
- the AI check's greeting fields;
- the SQL keyword pass (a seeded keyword in a value flags the publish request with
field_type 'greeting_tracker_starts'); - the verified-creator scan; - the all-ages attachment screen. - Changing a greeting's values writes a greeting changelog row with the field
tracker_json, and moves the character'scontent_updated_at. - The tracker forms' "coming soon" line points at the greeting editor.
- (S2) The
castvalue from the package's greeting binding decides who is on stage in the opening and in the first prompt. With no value, thepresent_at_startmembers are on stage, also when the opening write failed.
Invariants that must stay true:
- I1 A story whose resolved set has no non-empty start (no greeting value, no binding start, no tracker initial value, nobody present at start) writes no opening snapshot. Its first prompt and first eval are byte-identical to today's (captures taken on the pre-feature build).
- I2 "Start without greeting" and a greeting with empty text write no opening snapshot. Amended 2026-11-25
(owner, Relay eod-521: "while a story has no tracker snapshot at all, put the canonical start values at the head of
the reader's turn for every model"): while the story has no snapshot at all, every turn's prompt carries the
canonical start values (greeting-aware where a greeting is set) as one state block at the head of the reader's turn,
on every model leg (Classic, the Hybrid director assembled and flattened, the writer), hidden trackers included. The
values are the ones the first eval seeds (
EvalRequests.StartOf: a built-in has none once the story is underway). It is read-side only: no snapshot is written for it. Once any snapshot exists ({}included), only the normal path carries state, so there is never a second block. Same for a greeting row whose opening write failed. Pinned byOpeningSnapshotEveryLegPromptTests(WebTrackerStartInjector). - I3 No snapshot is written for a conversation created before the feature, and nothing is backfilled. Until its greeting gets starting values, it behaves as before. The only difference is that a tracker default written non-canonically shows in the first eval's prompt in the canonical spelling the seed has always stored.
- I4 With trackers off for the conversation (
Features.EnableTrackers), no opening snapshot is written and nothing else changes. - I5 Editing a greeting's values after a story started changes nothing in that story's snapshots, injected blocks, bar or scene history.
- I6 The opening write never overwrites a snapshot. With any snapshot in the conversation it writes nothing; a retried package create writes nothing new.
- I7 A tracker the greeting leaves on its default, or never set, starts from its binding's start, else its own
initial_value. - I8 Reader DTOs carry no starting values: browse character details, package details, the public character, the
conversation greeting re-pick,
GET /api/characters/{id}/greetings, and the anonymous and showcase projections. - I9 Hidden trackers stay out of the scene and the bar.
- I10 No new LLM call at start. The tracker-eval line is reserved from the same builder, fed the same values the eval sends.
- I11 Discord conversations and visual-novel runs are untouched.
- I12 Hybrid stories get the opening on their first beat. On the all-ages lane, a protected reader's story opens the same way, and the start values are part of the character's attachment screen.
- I13 In a story where no tracker was bound after its first snapshot, no eval prompt ever carries the new-tracker mark (byte-identical to today's). This holds after the reader blanks a value on the opening (the key is removed; no mark) and after a re-bind or a package re-save of an existing binding.
- I14 An agent-proposal patch that doesn't name the field keeps the map. A greeting an agent proposal created before this feature still undoes.
- I15 A
""from a greeting's map never reaches a snapshot.
Edges:
- E1 A key not bound to the greeting's character → 400
invalid_tracker_startnaming the key. Nothing is saved, including the greeting's other fields in the same request. - E2 An off-type value (
uneasyfor a 0–10 numeric, an enum value outside the set) → 400 naming the key and the expected shape. - E3 A value over 500 characters, more than 64 keys, a malformed key, or a JSON
nullvalue → 400. - E4 A greeting of a character in review → the existing edit-lock refusal.
- E5 A standalone greeting with a non-empty map → 400
tracker_starts_need_character.{}is accepted. - E6 A tracker unbound after its value was saved → ignored at start, absent from the editor, dropped on the block's next save. In a started story, the opening keeps the key, and the injector and the eval drop it.
- E7 A tracker deleted → the same as unbound.
- E8 A tracker re-keyed → the new key is New in the editor, and the old key is stale. A running story doesn't mark it new (its binding is old): the eval shows its default unmarked, as today.
- E9 A tracker re-typed after its value was saved → canonicalised at start when it fits, kept as authored when it doesn't; the editor flags it. Saving the block with that value unchanged answers 200, "Use defaults for new trackers" included. Changing it to another off-type value → 400.
- E10 A greeting deleted after the start → the story keeps its opening snapshot; Reset falls back to the defaults.
This covers a hard delete (
greeting_idbecomes NULL) and the standalone route's soft delete (greeting_idstays, and the resolver skips the deleted greeting). - E11 The reader deletes the greeting row → the scene falls back to the starting values, and the first eval seeds them.
- E12 Regenerating the first reply → its eval reads the opening as prior state and the greeting in its window.
- E13 An inline edit on the opening (the greeting bubble's bar, or the scene before the first reply) → saved. A save made while the first eval runs wins key by key. Reset puts back the greeting's value.
- E14 A failed opening write (forced in a test) → the conversation still opens, and the first eval seeds the greeting's values.
- E15 Not signed in → 401. Someone without edit access to the character → the greeting routes' existing refusals. The starts read needs view access.
- E16 In a package conversation, a character greeting's value for a character tracker keyed
castis ignored: the roster ownscast. - E17 A list tracker given
[]on a greeting starts empty, not at its default. - E18 Reordering greetings (a save carrying only the sort order) keeps every map.
- E19 A greeting re-parented through a binding proposal (
68a_entity_binding_proposal_functions.sql:249-254add,:258-262remove) loses its map: a trigger clearstracker_jsonwhenevercharacter_idchanges, for every writer. Moved between two characters that both bindlocation, the greeting's oldlocationvalue is gone, and the row is New on the new character. An update that leavescharacter_idas it was keeps the map. - E20 On a branch cut after the greeting and the first reader message were deleted, the branch's first reply is not taken for the opening (a model wrote it), so it stays the eval's watermark.