Hybrid Narrative Pipeline (Beats → Prose)

Status (updated 2026-07-04 — kb-audit found this stale): Phase 1 v1 is BUILT and LIVE, free-to-choose, no access gate. The "Concept" line below described the pre-build state and is superseded by the "as built" annotations scattered through this doc (Cost Model, §Architecture, the G1–G7 gap resolutions) — those were being kept current while this banner wasn't. Verified against the running code (not yet a live end-to-end product drive — see caveat): the New-Chat modal offers Classic vs Hybrid with an "Experimental" badge and the exact copy in Phase 1 (HybridChoiceModal.tsx); the collapsible Story beat panel renders beatJson on assistant replies, collapsed by default (BeatPanel.tsx); PipelineType.Hybrid is fully wired in ChatPipelineFactory (no longer the stub the paragraph below describes); a hybrid turn is billed its real two-call cost per the Cost model revision. Not verified: the Acceptance Criteria (v1) checklist below is still all [ ] — nobody has driven a live hybrid turn end-to-end (beat call → prose call → tracker/journal/summary extraction → billing receipt) and ticked them off. Do that before calling this "done"; until then treat the mechanism as shipped-and-live but not acceptance-verified. Superseded original text, kept for history: "Concept — load-bearing scaffolding already exists. PipelineType.Hybrid is defined in PipelineType.cs as 'Hybrid pipeline with multiple chained LLM calls (e.g., beats → style)'; WebChatRequest already carries a PipelineType parameter documented as 'WebChat (full) or Hybrid (multi-model)'; and ChatPipelineFactory.GetStageKeysForType has a Hybrid branch stubbed with 'platform-specific selection TBD'. This document specifies what that branch becomes." It depends on the eval-pass pattern proven by Journal / Trackers, the routing/composition layer from Model Profiles and Model Profile Base Prompts & Flavors, and the open-weight prose rail from Hosted Inference via Featherless.

What we are actually solving

Every lab benchmarks coding and math. Almost no one measures "does it feel alive." The roleplay and creative-writing audience is enormous and it cares about exactly one thing no leaderboard tracks: a model that holds character over long context, commits to a dramatic beat without flinching, understands subtext, and tolerates ambiguity without resolving it too fast. Echo of Dreams exists to take that seriously.

The structural problem is that the models with the horsepower to hold a 50-turn, multi-character narrative have all been RLHF'd toward conflict-aversion and people-pleasing — the edges get sanded off as models scale and accumulate training passes. Meanwhile the models that don't flinch (small uncensored open-weight models like vanilla Gemma) lose the thread on complex narratives: they forget established details, contradict themselves, and loop past a certain context depth. The viciousness is there; the horsepower isn't. The horsepower is there; the viciousness has been domesticated.

The value we want is not "go dark." Dark without authenticity is just edgeporn. The value is "stay authentic over comfort" — treat discomfort as information rather than a problem to resolve. A character's cruelty means something. Silence means something. Unresolved tension is allowed to stay unresolved because the story needs it. That is a craft value, not a content permission — orthogonal to the platform's hard limits. Those limits are enforced the same way for both pipelines: non-blocking moderation flags on messages (review, not generation-time blocking), so the structural split here is about craft, not content gating.

Two things make this hard to get from a single model:

  1. You can't reason a small model into "authentic over comfort." A careful protective prompt can get a large model to embody the value, but small models need clear instructions and don't generalize the principle. Crucially, the resistance isn't an instruction-coherence problem you can argue your way past — it lives in the weights. Fighting it with a better jailbreak is the wrong frame. The right move is to structure the work so the model's trained-in flinch never activates — the same way you'd work with a human collaborator's blind spots instead of arguing them out of them.

  2. "What happens" and "how it reads" are different skills. Narrative judgment — character motivation, consequence tracking, dramatic timing, knowing that the silence after the betrayal is the beat, not the confrontation — is one capacity. Visceral, committed prose that lands that beat and gets out is another. There is no reason one model has to be good at both, and asking one model to do both is what forces the compromise.

The core idea

Split the turn into two chained model calls, each doing exactly one job:

Stage Model character Job Failure mode it removes
Beat Cold, analytical, psychologically literate Decide what happens, why (character logic), and how the characters' history/trauma would shape its expression Conflict-aversion in plotting, narrative drift, character inconsistency
Prose Uninhibited, committed, stylistically consistent Take the beat and write visceral, emotionally resonant prose. Zero hedging. Intense moments intense. Hedging, explaining emotions instead of showing them, breaking intensity with safety language

Neither model is asked to do the thing it is bad at.

The director is the heavy lifter; the prose is a polish pass

Acceptance Criteria — polish-only prose, and the unassigned director (2026-11-22, Relay eod-421):

Invariants:

This dissolves the flinching problem structurally instead of fighting it. A model that would refuse to write a scene will often have no problem noting that "Character A, who has established violent tendencies, acts on them here" as a clinical narrative event. Resistance lives at the framing level, not the content level — so separating the intent-declaration step (clinical, cold, "here are the events that must occur") from the prose-execution step (craft instruction, "render this") sidesteps a large chunk of the resistance on both sides. The beat model never has to write the ugly thing; the prose model never has to decide that the ugly thing should happen — that judgment was already made upstream, so its lack of a flinch becomes a pure asset instead of a liability we manage around.

The psychology layer

The beat model is not only a plot engine. Because it is cold and analytical with psychological understanding, it can annotate each beat with how a specific character's history would make this moment land — and the prose model simply shows it, without naming it.

Beat (what + why + psychology):
  Event:    Mara learns the letter was forged. She does not confront Aunt Vesh.
  Why:      Confrontation would force a break she can't afford yet — Vesh holds the deed.
  Beat:     The silence is the beat, not the accusation.
  Psych:    Mara learned young that losing control had consequences. Control, for her,
            looks like stillness — she gets quieter, not louder, the more it costs her.

Prose model receives that and writes:
  → She set the letter down and smoothed it flat with two fingers, corner to corner,
    the way you'd straighten something in a house that wasn't yours. "More tea?" she said.

No internal monologue announcing the fear. No "she felt the old familiar dread." The reader feels it through behavior. This is how trauma-informed fiction actually works: the psychology is structural, not decorative — it shapes what the character does, not what the narrator tells you they feel. The coldness of the analytical layer is a feature; you don't want empathy at the beat stage, you want accuracy.

Architecture

The Hybrid pipeline runs two model conversations in parallel, each with its own context window and its own history, handing off once per turn.

User turn
   │
   ▼
┌─────────────────────────────────────────────────────────────┐
│ BEAT CONVERSATION  (own history: cold, structural)          │
│  input:  story context + journal/tracker state              │
│          + beat-conversation history + user input           │
│  model:  Beat role  (analytical, psychologically literate)  │
│  output: structured beat — events, motivation, psych hints  │
└─────────────────────────────────────────────────────────────┘
   │  beat injected as a read-only DIRECTION block
   ▼
┌─────────────────────────────────────────────────────────────┐
│ PROSE CONVERSATION  (own history: only ever sees prose)     │
│  input:  prose-conversation history + user input + beat     │
│  model:  Prose role  (uninhibited, committed, consistent)   │
│  output: the visceral scene  ── streams to the user ──►     │
└─────────────────────────────────────────────────────────────┘
   │
   ▼
 post stages: storage + billing as today;  journal / tracker / summary
 extraction now reads the BEAT, not the prose  (see story-of-record below)

Why two separate conversation histories

The beat model maintains its own thread of clinical beats; the prose model maintains its own thread of prose. The prose model never sees clinical beat language as part of its own history — so it doesn't drift toward the cold register, and it can develop and hold a consistent voice across the session because everything in its context is prose. The beat model, symmetrically, is never contaminated by having to be a prose writer. Each model stays what it is.

This mirrors how professional writers work: the beat sheet is cold and functional ("protagonist betrays ally; ally doesn't react immediately; the silence is worse than the confrontation"); the prose draft is where that becomes felt. Two artifacts, two registers, one author splitting the labour across time. Here we split it across models.

The handoff: inject the beat as a user-role direction block

The beat output is handed to the prose call as a read-only direction block attached to (or immediately before) the last user message — not as a system instruction and not as a prior assistant turn.

This is the exact load-bearing decision the Trackers design already locked in for state injection, for the same reason: models echo patterns they see in system and assistant turns, but treat user turns as input they respond to, not a template to copy. A beat block in the system prompt risks the prose model reproducing the clinical "Event / Why / Beat / Psych" scaffolding in its narrative output. As the last user turn, the beat reads as "this is what you're responding to," which is precisely what we want.

The prose stage therefore reuses the existing prompt-assembly path; the beat block slots in as one more provider-keyed segment on the final user message, alongside (and below) any tracker/journal state.

Pipeline wiring

The Hybrid branch in ChatPipelineFactory.GetStageKeysForType (today a stub) gains a pre-LLM beat stage ahead of the prose LLM call:

PipelineType.Hybrid =>
  PRE:  hybrid_context  →  compute_allocation  →  beat_direction (new)
  POST: prompt_leak_detection → storage → compute_settlement
        → engagement_charge → message_stats → summarization → journal_eval → tracker_eval

The beat stage is an IPreLlmStage that makes its own LLM call (via ILlmProviderFactory, resolving the beat role's model/params — see Model routing), persists the beat to a beat_json column on the turn's message (mirroring tracker_json, see story-of-record below), and writes the direction block into the context for the prose call. The prose call is the pipeline's normal LLM step. Storage is unchanged from WebChat; user billing charges the beat as its own line — HybridComputeLineProfile includes Beat among the turn's candidate cost lines, compute_allocation reserves it up front, and ComputeSettlementStage settles it from the beat call's real telemetry, so it appears on the per-message receipt (v1 pricing; operational design in docs-internal/architecture/billing/COMPUTE_COST_LINES.md). compute_allocation still runs before beat_direction so a turn that can't afford the full two-call estimate spends no compute at all, including the beat (G1). (As built 2026-09-24: a hybrid_leg_plan pre-stage (Order 400) runs before compute_allocation. It freezes the role-tagged Model Profile resolution and builds both legs' inputs, none of which depend on the beat: the beat leg (flattened or assembled) and the prose prompt's system part. The allocation prices both lines on those exact prompts, and beat_direction sends them from the same plan. The plan stage makes no model call. Before this, both lines were priced on the classic context as-is (HybridLegPlan; COMPUTE_COST_LINES.md §"No absorbing"). Later the same day the plan moved into hybrid_context (Order 100), which takes the place of context on Hybrid: it builds both legs from one read of the turn and assembles the conversation's own block only for a flattened beat — see The conversation's own block is assembled only when a leg reads it.) What does change: journal, tracker, and summary extraction now read beat_json instead of the prose response.

This is the inverse of the eval pattern, then partly a merge with it. Today journal/tracker eval runs after the response and reads the prose to extract state. The beat stage runs before the response and writes the direction the prose executes — and because the beat is already the structured "what happened," the downstream extraction reads it instead of re-deriving state from prose. The eval and the beat are the same structured pass viewed from two ends; see folding the eval into the beat call. It reuses the exact "separate, dedicated LLM call with its own model and prompt" shape the codebase proves out in JournalEvalStageBase.

The beat track is the story-of-record

The prose is what the reader sees, but it is purely presentational. The structured truth of the story lives in the beat. So every downstream consumer that needs "what is true now" reads the beat, never the prose:

This is deliberate. Prose is dense with texture, mood, and ambiguity that is wonderful to read and miserable to parse — extracting "Elara's HP dropped to 58" or "the party moved to Level 3" out of three paragraphs of combat prose is exactly the lossy, error-prone round-trip that makes eval calls flaky. The beat already states it cleanly and clinically. Reading state from the beat is direct; reading it from the prose is reverse-engineering. It is also register-correct: summaries and journal profiles feed back into the beat model's context (memories and state are beat-side in the provider split), so keeping that whole loop in the clinical register avoids a clinical→florid→clinical translation on every turn.

As built (2026-06-25): the active-summary half of the loop is wired. WebSummaryContentProvider injects WebSummary.BeatTrackContent (= beat_summary when present, else content), so the beat reads back the clinical summary it produced; only the beat consumes it (the prose prompt is starved of the summary block), and Classic is unchanged (beat_summary null → content). Two remainders, Phase 2: (a) the semantically-recalled L0 memories (WebMemoryContentProvider) still inject content, because retrieval matches the embedding generated from content — closing that fully means re-embedding on the clinical register; (b) the summarization rollup's LLM input reads the children's prose content, never their beat_summary — the beat-track handling there is output-side gating only (WebSummarizationService.SummarizeSummariesAsync, tagged TODO(hybrid-phase2)). In v1 both are identical by construction (the two registers are the same text), so the divergences only matter once a separate prose-register summary exists — but Phase 2 must close both.

The beat is structural story beats, plus portrayal hints

The beat is a structural story beat — what happens, not key:value state (revised 2026-06-25; the original design used a story_state key:value map, which duplicated what Trackers do — so that map was removed and Trackers now distill their key:values from the beat). The output separates the structural record from the craft direction:

Part Fields Goes to Example
Structural beat — what happened, canonical npcs, environment, plot, situation journal / trackers / summary and prose npcs: "Vesh sets the forged letter down, says nothing — she will not give Mara the confrontation." situation: "Mara knows, and Vesh knows she knows; the silence is hers to break or hold."
Portrayal hints — how to render it portrayal_hints prose + the director's own history — never the extractors "Show control as stillness, not volume — she gets quieter the more it costs her. Don't name the fear."

Portrayal hints are rendering directions, not story facts — they must not leak into the journal or memories. The extractors take the four structural fields; the prose takes those plus the hints, and so does the director's own beat history (it wrote them — shown its past beats without them it stopped writing them; MD-12, 2026-10-27).

This is also where your earlier observation lands: routing journal/summarization off beats puts more pressure on the prose pass, because the beat carries the full clinical detail and the prose's entire job becomes "remove the clinicality, keep the truth, make it felt." The portrayal hints are the pressure valve — the beat model, which is the one with the psychological literacy, tells the prose model how to warm each beat, so the prose model isn't reinventing the emotional read from scratch.

Storage and visibility — mirror trackers exactly

beat_json on web_messages is the Trackers tracker_json precedent applied verbatim, and it earns its keep three times over:

  1. Extraction source — journal/tracker/summary read it.
  2. Beat-model history — the beat conversation is reconstructed by interleaving user turns with each message's beat_json; no separate hidden message track is needed. As built (2026-07-10): this interleave is the Phase-2 target, not v1 — there is no beat_json history injector; v1 flattens the already-assembled prose prompt into a transcript for the beat call (BeatDirectionStage.FlattenPrompt, tagged TODO(hybrid-phase2); G3 describes the flatten).
  3. Verification & edit surface — beats are shown the same way trackers are: hidden by default, with a show_beats BOOLEAN master toggle on the conversation (in the How drawer, beside show_trackers), a collapsed beat bar below each assistant message, per-message expand, and inline edit with carry-forward. A user who sees the director steer wrong fixes the beat at message N; the corrected beat carries forward into the beat model's context (and, if the prose is regenerated, into the next render). Same manual / eval source attribution, same "eval skips manually-edited values" rule as trackers.

Consequence: the eval call can fold into the beat call

Once journal/tracker/summary all read the beat, the separate post-LLM eval pass becomes redundant in the hybrid pipeline: the beat model is already doing the structured reasoning, so it can emit beat + journal delta + tracker delta + portrayal hints in one structured output. This is the journal per-message-vs-summarization debate resolved by construction — in hybrid, the beat call is the eval call, so there is no "extra" call to amortize.

One caveat worth stating plainly: the beat is produced before the prose, so extracted state reflects the planned beat, not the rendered prose. This is fine as long as the prose faithfully executes the beat (which is its job — the prose model renders, it does not re-decide events), and "the beat is canonical" is the cleaner contract regardless: state is decided deterministically upstream instead of reverse-engineered from whatever the prose happened to say. Phase 1 may keep the eval as a separate pass reading beat_json; the fold-in is a Phase 2 simplification.

Model routing

The two roles need two different models, each with its own Mode and sampler parameters. Model Profiles are already the reusable model-pattern → Base-prompt → parameter-recommendation unit; Model Profile Base Prompts & Flavors explicitly retires a separate Bundle entity. Today a Profile resolves one primary role per turn. Phase 2 extends the same Profile aggregate to explicit roles:

Model Profile: "Authentic over Comfort"
├── Role: BEAT
│   ├── deepseek     → "Beat Director" mode, temp 0.6   (cold, analytical reasoner)
│   ├── opus         → "Beat Director" mode, temp 0.7
│   └── *            → "Beat Director" mode (fallback)
│
└── Role: PROSE
    ├── gemma        → "Visceral Prose" mode, temp 1.0  (Featherless-hosted open fine-tune)
    ├── magnum       → "Visceral Prose" mode, temp 0.95
    └── *            → "Visceral Prose" mode (fallback)

Each role is an ordinary Model Profile Entry set—policy-aware pattern matching, per-model Base Mode, per-model recommendations, and policy-1 * fallback—tagged with a role discriminator. This keeps one Profile describing both halves, propagates to every package that references it, and survives model-version churn. The consumption contract (canonical form in Model Profiles — Hybrid-Ready): an Entry never supplies a model — each leg's concrete model comes from the settings/preset side, and the same-role Entry it matches supplies that leg's Mode and param overrides. No wrapper Bundle exists, and a public Profile stays credential-free.

As built (2026-07-12): the role discriminator is real end-to-end. model_profile_entries.role SMALLINT shipped (database/v1/91_model_profile_entry_roles.sql: 0 = Primary, 1 = Beat, 2 = Prose, CHECK-constrained) with role-scoped uniqueness — (profile, role, identifier), so the same * may be Primary and Prose — through the repository, the creator API (create carries Role, PATCH validates 0–2), and the workbench entries panel (role selector, per-role grouping, per-role fallback badges). The * wildcard tier is genuine in the resolver: fn_resolve_package_effective_mode matches exact → substring → literal *, filters role = 0 on every tier (a Beat/Prose entry never wins a classic resolution), and returns the winning entry id — persisted as web_conversations.model_profile_entry_id (auto-resolve provenance; no FK, mirrors the mode_id convention, may dangle — readers LEFT JOIN) and used for exact isActiveMatch in the chat UI.

Update (2026-08-04): the runtime now CONSUMES role-tagged entries — piece 1 of Model Profiles — Hybrid-Ready shipped. The sentence this note used to carry ("nothing consumes a role-tagged entry yet") no longer holds. fn_resolve_hybrid_role_modes (database/v1/functions/47d_hybrid_role_mode_functions.sql) picks a pair-owner Profile — the first package-bound Profile in binding order carrying any role-tagged entry — and matches each leg's concrete model against that Profile's same-role entries, reusing the exact → substring → * ladder via the shared fn_match_model_profile_role_entry. HybridContextBuildingStage (the hybrid_context pre-stage, before compute allocation) resolves this once per turn into the turn's HybridLegPlan and freezes it on IPipelineContext.HybridRoleModes, and BeatDirectionStage reads the frozen plan; per-leg mode precedence became entry → HybridPipelineLlm.BeatModeId/.ProseModeId → hardcoded constants. The arrow still points the settled way: the entry supplies the leg's Mode only — the concrete model comes from the settings side and is an input to the match, and entry parameter overrides remain opt-in recommendations that nothing auto-applies. A Profile with no role-tagged entries changes nothing. Provenance lands on web_message_stats.model_profile_entry_id (per leg: the hybrid-beat row stamps the role=1 winner, hybrid-prose the role=2 winner). The seeded "Authentic over Comfort" Profile (database/v1/92_seed_hybrid_model_profile.sql) now pairs the two system Modes. One precondition had to be built with it: package-start was hard-pinned to Classic, so no conversation could be both package-bound and Hybrid — fn_create_conversation_from_package gained p_pipeline_type and the endpoint now honours IsHybrid on the package path. (Originally API-reachable only; since 2026-08-05 the gear-menu "New conversation" re-pick is package-aware and is the sanctioned UI entry — see the update note under the picker as-built block below. The package-page start still creates Classic without a picker, deferred with the rest of the new-chat flow.)

As built (2026-09-20): the leg model bindings are user-facing on the chat side. HybridPipelineLlm.PresetId (beat) and .ProsePresetId (prose) — the preset-side half of the settings routing above, which LlmPresetEnricher flattens into the flat HybridPipelineLlm.* / .Prose* keys — were seeded server-only (scopes = '{}'), so the pair was curated by the operator and the sections below speak in operator voice throughout (G7, UC-O2). That was the right call while the pipeline was experimental and while the platform was still trying to serve customization and convenience in one place. It is superseded: both keys are now {user, conversation} and are ordinary assignable stages on the chat side — Settings → Presets (user scope, the llm-stages view) and the chat How drawer's Model section (per-conversation override, with the same dangling-preset warning and override badge as Chat/Summary). Neither leg breaks when unassigned: both fall through to the conversation's chat model (the beat since 2026-11-22, owner, Relay eod-421: BeatLlmService.Chain is HybridPipelineLlm → Llm; it used to walk the tracker / journal / summarization links first), so an unassigned row inherits rather than dying. This is not "we added knobs" — it is the chat/games surface split: chat is deliberately the customization surface, while a game built on this pipeline fixes the beat/prose pair and builds on that guarantee. Reasoning and this change as its worked example: docs-internal/vision/GAME_DIRECTION.md §"chat and games are two surfaces, not one product evolving". The beat's output cap (HybridPipelineLlm.DefaultMaxBeatTokens, blank → 8192, no ceiling — raised and unclamped the same day in 377ecb78) rides along on the Beat row; the prose leg deliberately has no such knob — it rides the chat pipeline's generation settings via ProseSettingsOverride.

The prose role is the natural home for Featherless-hosted open-weight fine-tunes — the Magnum / Lumimaid (Gemma 27B) and RP-Ink (Qwen) lineages that preserve a base model's willingness to commit while adding narrative coherence. Featherless's flat-rate subscription and policy-free posture (model choice is the policy) make it the right rail for the uninhibited prose slot. The beat role wants the opposite kind of model: a cold, structurally-strong reasoner where clinical framing survives the positivity bias.

Modes: one hybrid "mode" is a pair of ordinary modes

Modes are the one piece that does not transfer unchanged — but the fix is not a new entity. A mode today (prompt_modes + sub_prompts + prompt_mode_sub_prompt_links, see database/v1/04_tables_prompts.sql) is already exactly "one model's prompt-assembly config": an ordered set of sub-prompts, each carrying a provider_key, a role (0=User / 1=Assistant / 2=System), and a template, plus the enhance / merge / summarization / nsfw_enabled settings. It produces one message array for one model that does everything.

The hybrid pipeline has two calls with two jobs, so each call needs its own prompt assembly — which is precisely what a mode already is. Therefore:

A hybrid "mode" is a pair of ordinary Modes bound by role—a Beat Mode and a Prose Mode—selected by the future role-tagged Model Profile from Model routing. No new Mode or Bundle entity. This reuses sub_prompts, the Workbench editor, sharing, proposals, and parent-version locking. Embedding both halves into a new "hybrid mode" row would duplicate the entire Mode machinery into a second shape.

What is genuinely new is small:

1. One new provider key: beat

The director's output reaches the prose call through a new content provider keyed beat (or direction) — structurally identical to the existing journal / summary / recalled_memory providers. A prose mode includes a beat sub-prompt wherever the creator wants the direction block to land. Its default role is User (0), applying the Trackers injection principle verbatim: state and direction go on the last user turn, never system/assistant, so the prose model treats the beat as input it responds to rather than a template it reproduces.

As built (2026-07-12): the beat key now exists — with one deliberate twist on the paragraph above: placement is STAGE-owned, not section-owned. ContextKeys.Beat + a PromptKeyCatalog descriptor ship (the name is beat; direction was not taken as an alias), but the direction block must land on the last user turn, after history — a position section ordering cannot express — so no IPromptContentProvider is registered for the key. A prose mode declaring a beat sub-prompt therefore supplies only the framing template around {content} (= the direction body, HybridPipelinePrompts.FormatDirectionBody); BeatDirectionStage substitutes the body and appends the result to the last user turn, and a mode with no beat section gets the default framing (FormatDirectionBlock). On the classic path the unregistered key resolves empty and the section is skipped — the correct behavior for a mode carrying beat framing outside a Hybrid turn. The §5 editor gap stays open: the workbench's Provider Key field is free text with no picker and its guidance nowhere surfaces beat; the docs-catalog half (the beat row in the Modes provider-key table) is done.

2. The asymmetric provider-key split is the design content

This is what makes two modes a hybrid mode rather than two unrelated modes. Because the mode's sub-prompt set declares exactly what its model sees, the mode is the context-routing config — no new mechanism needed. The editorial decision is which provider keys live on which side:

Provider keys Beat mode (cold, reasoning-heavy) Prose mode (craft-heavy)
character (full psychology) ✓ — judgment needs it minimal — name/voice only
journal, trackers, recalled_memory ✓ — state drives the beat usually ✗
lorebook ✓ — world logic only if it affects prose texture
persona ✓ ✓
beat (new) ✗ (it produces the beat) ✓ — the handoff
recent prose history ✗ (own beat history) ✓ — voice continuity
craft / style framing (static) ✗ ✓

This asymmetry is also a second authenticity lever: keep the safety-triggering world detail off the prose model and feed it a clean clinical beat instead, and you avoid re-arming the flinch the architecture just routed around. A prose model that never sees the heavy thematic context has nothing to flinch at — it has a craft instruction.

3. Mode settings that don't split evenly

The beat contract (2026-11-07)

Superseded in part (2026-11-23, planned: HYBRID_DIRECTOR_AUTHORITY.md S1). The director now writes every spoken line and the whole truth in layers ("The director is FACTS. the prose is PRESENTATION."). Once S1 ships, the structured contract asks for lines, established, hidden and disclosure beside the five fields below, and no longer forbids dialogue. The freeform contract ends with a Lines: array and a Not yet revealed: line. The seed's copy of the prompt (90's v_beat_prompt) stays as a fingerprint of shipped text, and migration 494 carries the new text. The engineering contract is docs-internal/architecture/chat-engine/HYBRID_DIRECTOR_AUTHORITY.md. The text below is the 2026-11-07 design as shipped.

Owner decision 2026-11-07: "Like in the editor for the beat, you will be able to choose freeform, or our current json structure, or the phase one in the future", refined the same day: phase is not a contract ("agreed about the phase"). The contract is the shape of the director's answer. Phase tracking comes later as a separate per-mode toggle that adds a phase call beside the existing scene call, in either contract.

This is the first concrete piece of the format declaration above. A beat mode now declares which answer shape it wants, out of a list the engine owns, or that its own prompt sets the format. The rest of the declaration (a mode's own field list, with a routing role per field) is still the later step, and the parser still reads its five fields from constants.

What it is. prompt_modes.beat_contract (database/v1/04_tables_prompts.sql), a short text with a CHECK listing its values:

Value The director is asked for Shown in the editor as
structured The JSON contract: the five fields (npcs, environment, plot, situation, portrayal_hints) and their rules, word for word what the built-in prompt asked. Structured (JSON): five fields
freeform The prose contract: plain prose with no field labels. It opens with where the story stands in its arc and what pressure is building (the world and the other characters move even when {{user}} avoids the turn), then the beat: what happens next and why. It never writes the scene itself, and it ends with a How to portray it: line and a Scene: line, the two spellings the parser reads out of prose. Freeform: prose direction
NULL Nothing from the engine: the mode's own text carries its format. Every mode written before the column, and any mode whose creator keeps a format of their own (a custom labeled format included). My prompt sets the format

A further shape is one more value in the CHECK and one more contract text. It is a list on purpose, never a boolean.

Where the contract goes: directly after the mode's instruction. The engine owns both texts (Core/Services/Hybrid/BeatContracts.cs), and a creator picks one without writing it. The beat leg sends the mode with the chosen contract as one more keyless System section, placed right before the mode's first section that asks for context (BeatContracts.WithContract):

The contract is a section of the mode the leg records (HybridBeatLegPrompt.Mode), so the prompt-leak guard protects it exactly as it protects the mode's own text, on the turn and on a summary regenerate or catch-up alike (SummaryScreenContextSource builds its plan from the same decorated mode). A mode's own text stays the creator's, whatever it says about format.

The built-in prompt is composed. HybridPipelinePrompts.BeatSystemPrompt is BeatContracts.DirectorRole, a blank line, then BeatContracts.StructuredContract, two constants: no runtime cut, the same words as before. The seed's verbatim copy is pinned to that composition by HybridSystemModeSeedTests.

The floor follows the contract. Three places fall back on a built-in instruction: no mode bound, a mode whose sections render nothing, and an assembled mode with no instruction text of its own. A mode with no contract chosen gets the whole built-in prompt there, as before. A mode with a contract gets the director's role and that contract: on the flattened floor as one instruction, on the assembled floor as the role followed by the contract section. A floor never sends a second contract. The contract section never counts as the creator's instruction.

Not chosen is byte-identical to before. NULL sends exactly the prompt it sent before the column. The editor offers "My prompt sets the format" on every Beat mode, so any mode can opt out of the engine's contract; a new Beat mode starts Structured. When a creator picks a format while the mode's prompt already carries a contract's opening words, the field warns that the director would get two. When they pick "My prompt sets the format" while the prompt carries neither, it warns that, unless the prompt describes a format of its own, the director has none to follow. Neither warning blocks. A form that didn't touch the field never sends it.

The seeded "Beat Director" is Structured. fn_seed_hybrid_system_modes step 1c (90_seed_hybrid_system_modes.sql) cuts the seed's own copy of the JSON contract out of the mode's instruction and sets the mode to structured, in the same call. The engine puts the contract back in the same place, so the sent prompt keeps exactly one JSON contract, in the same words, and a switch to Freeform sends only the freeform one. The step is wider than the 2026-10-27 text upgrade on purpose: "the contract part is pristine", not "the whole text is". The block is cut wherever either of the seed's two contract texts still stands verbatim, even in an instruction an admin edited elsewhere. Every other bound holds:

Accepted, not fixed (review, 2026-11-07): the step reads and rewrites the instruction in one statement without a row lock first, so an admin save of the same section committing in that same instant could be overwritten. The window is the statement's milliseconds, once, on the deploy that runs it.

Where it is chosen. The Forge mode editor, in the Pipeline subsection beside Pipeline Role (BeatContractField, shared). It is staged like every field and saved by the form's one Save. On a Classic or Prose mode it stays on the form, disabled, saying why. A new Beat mode is created Structured; a new mode of any other role is created with none.

Save, copy, import, MCP.

Lookups. The freeform contract ends with its two labeled lines, and the lookups ask (LookupsAsk) asks for a trailing Lookups: line. Either order is safe: the labeled tier reads Lookups: as a discard label, and the freeform tier reads the answer without its lookups (BeatCodeFields.Strip, with BeatLookups.Strip), so a lookup never reaches the story or the writer.

Games. The Visual Novel and RPG directors are beat modes of their own. The VN's "VN Director" seed has no contract chosen, so it sends exactly what it sent. A reader picks beat modes, never a contract, so no reader setting can switch a game's contract.

Pricing. The estimator prices the prompt the call sends: the plan's one BeatLlmRequest construction carries the leg's instruction, the contract section included. The part sizes the budget reads (WebPromptPartSizes) count the mode with its contract section, and keep the whole built-in prompt as an upper bound. The prose contract is shorter than the JSON one, so a measure built on the built-in prompt (the no-plan quote) stays an upper bound too.

Runtime stamp. A contract change is model-facing tuning, like the enhance settings. It moves runtime_updated_at (functions/94), not the public "Updated" date.

Acceptance Criteria — the beat contract

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:

Edges:

4. Seed system modes

Ship two system Modes (created_by_user_id = 0, the same convention as the default mode)—a default "Beat Director" and a default "Visceral Prose"—paired by roles in a default "Authentic over Comfort" Model Profile, so a creator can adopt the hybrid pipeline without authoring either half first.

As built (2026-07-12): the two seed system Modes exist — and they already drive the v1 prompts, via interim settings rather than a role-tagged Profile. database/v1/90_seed_hybrid_system_modes.sql seeds "Beat Director" and "Visceral Prose" (created_by_user_id = 0, is_public = FALSE — system-owned, not browsable), carrying the previously compile-time prompts in mode form (Beat: one keyless System sub-prompt with nsfw_enabled = TRUE per §3; Prose: a keyless craft sub-prompt + a persona-keyed sub-prompt, and deliberately no beat framing — placement is stage-owned, see §1's as-built note). Two settings bind them: HybridPipelineLlm.BeatModeId / .ProseModeId — an explicit interim bridge until the role-tagged Profile resolution in Model routing; the seed is insert-if-missing and only re-points a dangling id, so an admin override (including a deliberate blank) is never clobbered on re-migration. BeatDirectionStage resolves the bound modes per turn: the beat mode's keyless sections (joined in SortOrder) replace the hardcoded beat instruction; the prose mode is assembled through the normal provider machinery — its provider-key set IS the starve — with the beat still riding the last user turn. Unset or unresolvable settings fall back to the retained hardcoded HybridPipelinePrompts constants; a mode-config problem never fails a turn (log + fallback). Still open (2026-08-04: the "Authentic over Comfort" Profile IS now seeded and consumed — see the Model routing update; the settings bindings survive as the fallback tier beneath it), two beat-side limits remain Phase 2 — a beat mode's provider-keyed sections are skipped (no beat-side provider resolution; the beat leg still sees the flattened classic context) and there is no beat-mode-assembled history injection.

As built (2026-09-20): both beat-side limits above are CLOSED — and the switch between the old and new shapes is the beat mode's own key set, not a setting. Declaring a provider key is how a creator says "this is what the director sees", so BeatDirectionStage now picks per turn:

  • The beat mode declares ≥1 provider key → the leg is ASSEMBLED. Its sections resolve through the normal provider machinery (IPromptBuilder.BuildPromptAsync(context, beatMode, …) — the engine adds the package cast but not the journal fallback or the reply-length directives; see the 2026-09-24 note below) — its key set IS the beat's context, exactly symmetric with the prose leg since 2026-07-12 — followed by the beat leg's own history and the current user turn. The flattened classic transcript is no longer sent: withholding is now expressible on the beat side, which is what made §2 only half-real before.
  • The beat mode declares no key (or none is bound) → the leg stays FLATTENED, byte-for-byte the pre-change behavior: keyless sections joined in SortOrder as the instruction, the whole assembled context as one user turn. This is the shape the seeded "Beat Director" still runs … The seed was deliberately not re-authored to declare keys — flipping it is a content decision, not a code one. Superseded 2026-09-24 — the content decision was made (owner): the seeded "Beat Director" now declares its keys, so the default Hybrid conversation runs the ASSEMBLED leg. See the as-built note below. The flattened shape remains exactly as described for any beat mode that declares no key.

Amended 2026-10-22 — a Document-editor beat mode's tokens are its keys. "Declares a key" now means asks for context, read row by row by one rule (Core/Services/Hybrid/BeatLegShape.cs, shared by HybridLegPlanner, the budget mirror WebPromptPartSizes and package readiness):

  • A legacy row (expansion_version = 0) asks for context when it carries a provider key — unchanged.
  • A document row (expansion_version = 1) asks for context when its template carries a token the inline expander resolves — an insertion such as {{knowledge}} / {{ summary }} / {{identity}}, or a closed conditional such as {{#journal}}…{{/journal}} (InlinePromptExpander.HasContentToken). Such a mode is ASSEMBLED: the expander resolves its tokens, exactly as on a Classic prompt. Before this, a document had no provider key, ran flattened, and its tokens reached the director as raw markup.
  • A document row's provider key asks for nothing. The renderer expands a v1 row's template and never runs its key (SystemPromptBuilder.RowPlacesKey, the same rule); a document switched to the Advanced editor keeps its rows at v1 with whatever keys they carry.
  • Everything else stays FLATTENED, byte for byte as above: legacy keyless modes, a document whose template carries no content token (plain text, the reserved {{char}}/{{user}}, unknown or malformed tokens — all of which the expander leaves as written), and a v1 keyed row without a token.

On the assembled shape, a document's instruction is its text with every token resolved empty: a document of tokens alone carries no output contract, so it gets the built-in HybridPipelinePrompts.BeatSystemPrompt floor like a mode that declares only keys. (Since 2026-11-07 the floor follows the mode's beat contract: the whole built-in prompt when none is chosen, the director's role followed by the mode's contract section when one is.)

Be precise about who this changes. "Existing conversations are unaffected" is true only of beat modes with no keys. A beat mode that mixes keyed and keyless sections previously ran flattened-with-keyed-sections-skipped and now takes the assembled path — a complete reshape of that leg's prompt. That is the intended fix (it is what the skipped-sections Warning was reporting), but it is a live behavior change for any conversation already bound to such a mode, and pipeline_role is picker metadata the runtime never gates on, so any mode can be bound as Beat through a model_profile_entries role=1 row or the HybridPipelineLlm.BeatModeId setting. Before assuming the blast radius is zero, check which bound beat modes carry keyed sections in production — a local query cannot answer that.

The beat's own history (the two-histories rule, previously architecture-only): on the assembled shape the beat conversation replays prior beats — each assistant turn rendered from that message's beat_json via HybridBeatState.ToExtractionText(), so the four structural fields and never portrayal_hints (craft direction belongs to the prose model alone). An assistant turn with no beat — a Classic turn of a conversation that later switched to Hybrid, or a beat that parsed to nothing — is dropped, not downgraded to its prose: letting prose in would contaminate the clinical register the separate history exists to protect. Dropping a turn's prose never drops the turns around it — the user turns on either side stand, and RequestPrompt.NormalizeForProvider() closes the adjacency each drop opens by folding them together. This is what keeps the first Hybrid turn after a Classic run sane: every assistant turn in that window is beat-less and drops, and what the director still sees is the user's side of the conversation plus whatever the mode's own keys (summary, journal) carry — not an empty history. MessageHistoryItem gained BeatJson to carry the track (null on user turns, on Classic turns, and on Discord).

The clinical-register guarantee is about HISTORY, and only about history. The beat leg's own history is beat-only, full stop — that is what this change makes true. But a declared key brings whatever its provider emits, and the register split is not finished on the provider side. Three known routes by which prose-register text still reaches an assembled beat leg, all pre-existing Phase 2 remainders rather than regressions from this change — but all newly reachable, because a beat mode's keyed sections used to be skipped outright and now resolve:

  • recalled_memory injects prose Content outright (WebMemoryContentProvider) — remainder (a) in §The beat track is the story-of-record. Embedding-coupled: retrieval matches the vector built from Content, so switching it means re-embedding on the clinical register.
  • summary is only conditionally beat-aware. WebSummaryContentProvider injects WebSummary.BeatTrackContent, which is BeatSummary ?? Content — and BeatSummary is written as windowHasBeats ? result.Content : null. So a window with no beats (the Classic-era turns of a conversation that later switched to Hybrid) has a NULL beat_summary and falls back to the prose summary. Those are precisely the turns the beat history now drops for being prose; a declared summary key can re-admit a summary of them.
  • Rollups can make beat_summary itself prose-derived, because the rollup's LLM input reads the children's prose Content and never their beat_summary (remainder (b), WebSummarizationService.SummarizeSummariesAsync) — so even a non-null BeatTrackContent is not a guarantee of register.

A creator authoring the §2 split should know this; closing it is the Phase 2 register work, not prompt assembly. The test ProcessAsync_AssembledBeatLeg_DeclaredSummaryKeyCanStillCarryProseRegisterText pins the boundary so it stays visible instead of being rediscovered.

Degrades, never fails, like every other mode-config path in the stage: a failed assembly or a failed beat-track read falls back to the flattened shape, and a mode that declares keys but carries no instruction text gets the built-in HybridPipelinePrompts.BeatSystemPrompt prepended as a floor — the beat's JSON output contract is in the instruction, so losing it would degrade every beat on that mode to an unparseable one. (Since 2026-11-07 the floor follows the mode's beat contract: with a contract chosen it is the director's role, followed by the mode's contract section.)

One consequence worth naming: the Warning that fired once per beat mode per process ("declares provider-keyed sections … so they are skipped") is gone, because the thing it warned about no longer happens. Acceptance criteria and how they were verified: below.

Acceptance Criteria — beat-side provider resolution + beat history

Verified 2026-09-20. API/pipeline = driven end-to-end against running services with the deterministic mock LLM (.claude/scripts/dev-verify-hybrid-beat-assembly.ps1, 28 checks, asserted on the mock's verbatim request captures — the beat call identified by its mode marker, so a claim about "the beat prompt" is about that call and not the prose or eval call). Unit = BeatDirectionStageTests (401 WebChat + 4372 Core tests green).

User use cases — satisfiable + accessible:

Behavior:

Invariants that must stay true:

Edges:

Not done here, deliberately: re-authoring the seeded "Beat Director" to declare the §2 split (a content decision — see the as-built note above) (done 2026-09-24 — next section), and the §5 editor gaps, which are unchanged by this work and gate nothing (see the correction in §5 — the beat key is already reachable from the editor; what is missing is guidance, not access).

The seeded director reads its own context (2026-09-24)

Owner decision 2026-09-24: yes — re-author the seed. The seeded "Beat Director" now declares its story-context keys after its instruction — character, scenario, persona, facts, cast, lorebook, summary, journal, recalled_memory, tracker (every key the conversation's own default prompt carries: the §2 split withholds story state from the prose side, not from the director). So every default Hybrid conversation runs the assembled beat leg: its own context, and its own history of beats instead of a flattened copy of the prose conversation. That is also what makes a correction in the Story-beat panel reach the director's next turn — the flattened shape never replayed beats at all.

Flipping the default made three assembled-leg gaps (found in docs-internal/reviews/HYBRID_PIPELINE_REVIEW_2026-09-24.md, items 8 / 17 / 36) the default behaviour, so they were closed first:

Migration. The seed is create-if-missing, so the new sections are added by a separate step in fn_seed_hybrid_system_modes that runs for fresh and existing databases alike — and only over a pristine mode: exactly the one keyless section the original seed wrote, its text still verbatim. A mode someone shaped (edited the text, added or removed a section) is left exactly as it is; the description is rewritten only over the seed's own words. After the step runs once the mode is no longer pristine, so it never runs twice.

One visible side effect: the seed declares lorebook, and the lorebook provider records the turn's activations (and the matched entry images shown on the reply) from the last assembly that searched — on a default Hybrid turn, now the director's. That is "what the model saw" for the leg that plans the scene, and it appears even when the conversation's own mode declares no lorebook, because that mode drives neither call on a Hybrid turn. The classic block was still assembled at Order 100 and searched too, so a default Hybrid turn ran each searching provider twice. Closed the same day — see The conversation's own block is assembled only when a leg reads it.

What this does not change: the flattened shape for any beat mode that declares no key; the register remainders (recalled_memory still injects prose Content, and summary falls back to the prose summary for beat-less windows — the story-of-record note); tracker values already written for a turn whose beat is later corrected (they are not re-derived).

Acceptance Criteria — seeded director on the assembled leg

Verified 2026-09-24. Live = .claude/scripts/dev-verify-hybrid-seeded-director.ps1 against running ServerAPI + the deterministic mock, with no conversation pin (the default path), asserted on the mock's verbatim captures — 22 checks, all passing (re-run after the adversarial-review fixes). Unit = BeatDirectionStageTests (51), SystemPromptBuilderTests, ContextBuildingStageBaseTests; DB = HybridSystemModeSeedTests against real Postgres.

User use cases — satisfiable + accessible:

Behavior:

Invariants that must stay true:

Edges:

The conversation's own block is assembled only when a leg reads it (2026-09-24)

The problem. A Hybrid turn sends the conversation mode's own block — its sections, the "classic block" — to no model, except inside a flattened beat. It was still assembled on every Hybrid turn, running every provider the mode declares (the lorebook and recalled_memory searches, the summary, journal, facts and cast reads). With the seeded director on the assembled leg, the default turn ran each of them twice: once for nothing, once for the director. The beat leg also read the history and ran the history injectors a second time.

The shape now — the first slice of the leg assembler the 2026-09-24 review names S2 (docs-internal/reviews/HYBRID_PIPELINE_REVIEW_2026-09-24.md, structural table):

What a user can see change:

Unchanged: Classic turns (the same code path, byte for byte); the flattened beat's input (it is the conversation's leg as Classic builds it — pinned byte for byte against the Classic stage; since 2026-10-05 that holds when the beat mode carries no enhance and the conversation's is not assistant-role, see §3); the order in which the legs search, so a prose mode that declares lorebook still owns the record; the conversation mode's enhance cadence on the prose leg's turns (per-leg cadence is review item 37; since 2026-10-05 the same cadence reaches the director too, and each leg mode's own cadence rides its own leg — §3).

Acceptance Criteria — the block is assembled only when a leg reads it

Verified 2026-09-24. Live = both scripts against a probe ServerAPI built from this change (port 5110, its own log confirming it served every turn through hybrid_context and none through context) and a private mock — 23 + 28 checks, all passing, re-run after the adversarial-review fix; each live Hybrid turn ran exactly two prompt assemblies (director, prose), the flattened one exactly two (conversation, prose). Unit = HybridContextBuildingStageTests (16), BeatDirectionStageTests (54, now driven through both stages in production order), PreStageEmbeddingAccountingTests; Core.Tests 4506, WebChat.Tests 447, DiscordChat.Tests 980, all green. Not run: the Database.Tests prompt-capture filter (ManagedPromptCaptureTests, Discord Classic) — it timed out in fixture setup behind other sessions' concurrent DB runs; Classic is covered by the suites above.

User use cases — satisfiable + accessible:

Behavior:

Invariants that must stay true:

Edges:

Each leg is held to the context-fit settings, on the call that sends it (2026-09-29)

The check. A Hybrid turn makes up to two prompt assemblies, so every setting that bounds a Classic prompt has to bound each of them. Driven live against the mock LLM (dev-verify-hybrid-settings.ps1), the same conversation settings were applied to a Classic chat and to three Hybrid shapes: the default (seeded director, assembled; seeded prose, no lorebook), a prose mode that declares lorebook, and a key-free beat mode (flattened). Every call was compared with Classic.

The retrieval settings already held. Knowledge.MaxEntries (3, and 0 = always-include only), Features.EnableLorebook = false and Knowledge.LimitMode = tokens with a Knowledge.TokenBudget each gave every lorebook-carrying call exactly Classic's entries: the searches read context.Settings, and they run once per leg that declares the key. Always-include stayed exempt from every bound. Memory.* follows the same path (RetrievalBudgets.ForMemory).

Two context-fit settings did not:

Which block the retrieval budgets are derived from. Fitting a block also derives next turn's retrieval budgets from its composition (IPipelineContext.DerivedRetrievalBudgets; only Discord's governor reads it today). A Hybrid turn now fits up to two blocks, so one has to own that: the conversation's own block, when a flattened beat sends it. The starved prose system part never does — read as a composition it says "no lore wanted" — and an assembled-beat turn leaves it unset, as before.

What a user can see change: a prose mode that declares heavy context and a tight share or Dynamic Context cap keeps more of the story and less of the lore in the prose call; a key-free beat mode on a beat model smaller than the writer (or with a larger beat cap than the chat's) keeps its full beat cap instead of being clamped, at the cost of the oldest context the director could not have taken anyway.

Noted, not changed: a director's instruction bigger than its whole share has nowhere to go. At the extreme (Dynamic Context 2000 × share 0.2 = a 400-token share) the seeded, assembled director's own ~600-token instruction is shortened by the trimmer's last-resort pass — the designed "degraded, never refused" behavior, and it can cut the beat's output contract. A flattened beat's instruction is never shortened (it isn't part of the block): its block is trimmed to nothing and the send-time guard decides. Either way, any share that leaves the instruction room is unaffected — the same guarantee Classic's block gets.

Amended 2026-10-22 (CTX-NO-TRIM (c), owner 2026-10-07: "FAIL LOUD at the model's maximum, never at the 80% static share"). No leg bounds its block to the share any more, and the last-resort pass is gone. Every leg — Classic, the flattened beat, the assembled beat and the prose call — fits its WHOLE request in one pass (LegWindowFit): nothing is cut while it fits; past it the oldest history goes first (down to the share's reserve), then the block's ranked sections (searched lore down to its always-include head, facts, memories, journal, cast, summaries), then the rest of the history. The prose system part is no longer fitted in PlanAsync, before its history exists: the Hybrid context stage fits it together with the prose history (PromptLeg.CallerSystem) and writes the result back to HybridLegPlan.ProseSystem before allocation prices it. A director's instruction, a prose template's persona card or craft instructions, and any identity section are never shortened: a leg they alone overflow is refused by the capacity check with the typed ContextTooLong (leg names the call). The "noted, not changed" case above is therefore a refusal now, not a shortened instruction. The share still sizes the retrieval budgets the flattened beat's block derives.

Acceptance Criteria — each leg is held to the context-fit settings

Verified 2026-09-29. Live = dev-verify-hybrid-settings.ps1 (local tooling) against a probe ServerAPI built in Release from a clean detached worktree of HEAD plus only this change (port 5120; its own log shows it served all 16 Hybrid and 5 Classic turns, 0 guard clamps) and the mock LLM: 5 settings scenarios, each on Classic, default, prose-lore and flat-beat, plus the beat-window turn, all passing. Re-run after the review on the final code (the share and beat-window scenarios, 4 Hybrid + 1 Classic turns on a fresh probe): all passing, the trim warnings naming the prose and beat calls, and the flattened block's share net of its instruction (375 = 400 − 25 tokens). The same script against the pre-fix build failed exactly the two gaps above (the prose call kept 6 of 6 entries at share 0.2; the flattened beat went out at ~23.7k tokens and the guard clamped MaxBeatTokens 8192 → 6638). Unit = five new HybridContextBuildingStageTests (8 cases) — the bound prose mode (also on a prose-only regeneration), the built-in prose template, the flattened beat's history + instruction reserve (a key-free mode's instruction and the built-in one), the flattened beat's always-on block beside a large instruction, and the retrieval-budget derivation rule. Six mutants — prose-sized flattened block, instruction not taken off the share, instruction not reserved from the history, built-in instruction unreserved, template unfitted, prose block deriving — each fail their own test, with a green baseline before and after. WebChat.Tests 506, DiscordChat.Tests 1034, Core.Tests Pipeline/ContextWindow/Hybrid/Subscriptions 940, all green in a clean worktree of HEAD plus this change (the shared tree's Core.Tests was red on another session's in-progress edit).

User use cases — satisfiable + accessible:

Behavior:

Invariants that must stay true:

Edges:

The director decides each reply's length and marks scene breaks (📋 planned, 2026-09-24)

The problem — length. Classic shapes reply length with two per-conversation settings, Response Pacing (Off / Concise / Adaptive / Expansive) and Target Length (a word count), injected as fixed system directives (PromptContextManager.AppendPacingInstruction / AppendTargetWordsInstruction, keys pacing / target_words). Adaptive's text asks the writer to "let the beat decide" — but in Hybrid the writer is deliberately starved of the story, so it is the one model that can't judge the beat, while the director reads everything and literally decides it. Three leftovers make the current Hybrid shape worse than Classic's:

The problem — scene breaks. Summaries cut every Summarization.SummaryWindowSize messages, so a summary routinely covers half a scene. The director is the natural source of scene boundaries: it reads every turn with the full story context, and it causes the transitions. The summary side of that — when a scene's summary is written and where it ends — is its own feature: Scene-Aligned Summaries. This section is the director's half: asking for the boundary and storing it.

The shape

Two optional beat fields. The beat keeps its five fields and gains two, both optional — every stored beat and every beat mode that never emits them stays a complete beat:

Field Values Class Reaches
length brief · standard · full (read back from short / medium / long too) Rendering direction, like portrayal_hints The director's note; the director's own history. Never the extractors (journal, tracker, summary).
scene continue, or new — <short name> Story structure The extractors (ToExtractionText, only when new and only when the beat has story content — a beat that is nothing but a scene line must still fall back to the prose in HybridExtraction), the director's own history, the summary trigger.

A category, not a number: models are bad at counting words, and a category survives an edit in the Story-beat panel.

The grammar is strict, so creator text is never claimed by accident. A length value is exactly one of the six words (any case, trailing punctuation ignored). A scene value is continue (or same), or new followed by optional punctuation (—, -, :) and a name; a bare new is a break with no name. The product prints one form everywhere — Scene: new — <name> — in the ask, the extraction text and the director's history, so the director echoes what it reads. Anything that doesn't match is not the field:

How the director is asked: an engine addendum, never the instruction text. The seeded "Beat Director" carries its own verbatim copy of the instruction (90_seed_hybrid_system_modes.sql, v_beat_prompt, which the pristine-mode check also compares against), and a creator's beat mode carries its own — editing HybridPipelinePrompts.BeatSystemPrompt reaches neither. So every beat leg carries one beat addendum, whose text lives in HybridPipelinePrompts and asks for the fields "in the same format as the rest of your answer" (a JSON director that tacked a Length: line after its object would fail the strict parse and lose the line). Where it goes differs by shape, and both placements are load-bearing:

As built (2026-10-27): the channel shipped first, carrying a portrayal ask — length and scene are still planned. Found live: the beat's Portrayal was filled on the first reply and "Not set" on every later one, so the writer lost its "How to portray it" from turn 2. The stored instruction marked portrayal_hints "Optional" and said "Omit fields that have nothing new this beat", and from turn 2 the director's own history shows its beats without hints (ToExtractionText, by design), so it copied that. The engine ask is HybridPipelinePrompts.BeatAsk: write portrayal_hints on every beat, in the answer's own format, exempt from the omit rule, for a writer who never saw the previous note. It travels exactly as specified above: PromptAssemblyOptions.BeatAsk → a System message keyed beat_ask after pacing and before security on the assembled leg (HybridLegPlanner.AssembledBeatLeg); HybridBeatLegPrompt.Addendum → BeatLlmRequest.Addendum, appended after the instruction by BeatLlmService.SentPrompt on the flattened leg (HybridPipelinePrompts.WithAddendum, which the flattened fit also reserves room for). HybridLegPlan.BeatRequest is the one construction the beat stage sends and the estimator prices. The ask is constant for now, so the leg still uses the static options; the per-turn with { … } arrives with the length ask. Cost: 219 characters, 63 tokens by the platform estimator (260 / 75 before MD-12 dropped its "your past beats are shown without them" clause) (3.5 characters a token), per beat call; nothing on the prose call. The built-in instruction and the seed's v_beat_prompt were reworded together (portrayal required, the omit rule scoped to the four structural fields); the seed rewrites only its own unedited old text (step 1a, a fingerprint check), never an admin's copy — those directors get the ask from the engine. BeatParser also reads a portrayal key and an object or list value for the hints (flattened to text).

As built (2026-10-27, MD-12): the director's own history carries its portrayal hints. The ask alone left the director reading its past beats without the hints it had written, so its own history still taught it the omission. The assembled beat leg now replays each prior beat through HybridBeatState.ToDirectorHistoryText — the four structural lines exactly as ToExtractionText renders them, then How to portray it: … last (the writer's-note label, which BeatParser reads back) — in HybridLegPlanner.ProjectBeatHistory, the one place it is used. Every other reader of a stored beat (journal, tracker eval, summary, HybridExtraction) keeps ToExtractionText, unchanged byte for byte. Which turns survive is still decided by the structural fields: a beat with only hints is dropped, as before. The rendering is a pure function of the stored beat_json (the hints were screened by BeatLeakScreen before it was stored; the VN guard's prose-only direction is never stored), so a past beat reads the same on every later turn and the cache prefix holds; the beat leg's window fit prices the rendered units, so the reservation counts the hints (HybridLegPlan.BeatSentPrompt = what is sent). The flattened leg has no beat history and a prose-only regeneration makes no director call — neither changes. The ask's "(your past beats are shown without them)" clause, false from here on, was dropped. /context-budget still sizes the director on the conversation's prose history rows (the documented one-sided bound), not on the rendered beats.

As built (2026-10-27, memory plan M8a): the scene half — length is still planned. HybridBeatState.Scene (HybridScene: Continue / New(name)) is read by one grammar, HybridScene.TryParse, which is fn_scene_mark_from_beat_json's exactly (R-M8-15): spaces-only trim, lower case, continue, or new then the end or whitespace and an em dash, colon or hyphen-minus. Stricter than the plan text above: same is not a continue, an en dash and a non-breaking space are not separators. ToBeatJson writes "scene" only when the beat made a call, and only canonically (continue / new / new — <name>), so a beat without one stores byte for byte as before and the SQL only ever sees one spelling; web_messages.scene_mark is derived from it in SQL on both write paths (no C# writes a Hybrid mark). The ask is the second sentence of BeatAsk (always present): 414 characters, about 119 tokens at 3.5 characters a token, per beat call. ToExtractionText ends with Scene: new — <name> only for a break on a beat with story; ToDirectorHistoryText shows every call, Scene: continue included, between the story lines and the hints. A labeled Scene: line claims the field only when its body is a call and never counts toward the two-label bar; HasBeatFields didn't learn the key. Also fixed (R-M8-16): an answer whose only content is the hints and/or a scene call now parses as a beat with no story fields instead of degrading to its raw text in npcs (where the hints reached the journal, tracker and summary as Characters: {…}). That covers a JSON answer, and a labeled one whose only labeled content is one hints section with or without a Scene: call (text before the first label joins the hints); a story label still needs the two-label bar (Plot: + Scene: alone degrades). Of the rows stored by the old degrade, only those whose npcs is a JSON object carrying a beat field heal on read; a stored labeled-text degrade reads as it did until it is edited. Pinned by BeatSceneTests (Core) and SceneMarkParityTests (Database, the parser against the SQL).

The length reaches the writer inside the director's note. Pacing and target do different jobs, and the note keeps both:

One carrier, always the note. The prose system part stops carrying the pacing / target directives on Hybrid (HybridLegPlanner.ProseLeg → ResponseShapingDirectives: false), and the flattened beat's conversation block is assembled without them too (closes item 17). Keeping them in the prose system part and stripping them at compose time would mean carrying its unmerged copy on the plan and re-merging after the beat exists (the part is built at Order 100, and the seeded prose mode merges, which drops the keys from the merged copy) — possible, but the note is simpler and it also reaches the built-in template path, which has no system directives at all.

The director sees its own rhythm. On the assembled leg (the flattened one has no beat history), each prior beat is replayed with its length while the ask is active (a history renderer next to ToExtractionText, which stays length-free for the extractors), so "three brief beats in a row" is visible when it decides the fourth.

Pricing. HybridProseLeg.EstimateKnownNoteTokens goes through the same settings-aware renderer (it gains a settings parameter; every call site has the settings in hand). On a prose-only regeneration it is exact — the one path where an under-count would be an under-bill, since that path reserves no beat-output cap. For a new beat, the known part is the framing, the pacing text, and the larger of the longest length line and the target directive (about 100 tokens at the default text, several times the line), so the reservation stays an upper bound either way.

Parser and panel — the two places this breaks silently if half-done.

Pacing Off and no target — the defaults. No length ask, no length line, no fallback, and no lengths in the director's history — even if a beat carries a length (a beat produced while pacing was on and regenerated after it was turned off, or a creator's mode that emits one unasked). The prose prompt is byte-identical to today's; the platform adds nothing. A creator who wants length control on every reply writes it into their beat mode's portrayal hints.

Non-Goals
Acceptance Criteria — length and scene breaks

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

Criteria above this section that this plan amends (they held when verified; building this changes them, and the build re-verifies them in their new wording):

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

Behavior:

Invariants that must stay true (carve-outs):

Edges:

5. Mode-editor support — the one place "reuse the editor for free" isn't free

The claim above — that a hybrid mode "reuses the workbench editor for free" — is true for building each half, but "free" hides three concrete editor gaps to close when this lands. Follow-up when picking the feature up: none of these comes automatically from the per-mode editor.

Correction (2026-09-20): the first bullet below was wrong, and it is NOT a gate on anything. It said a creator "literally cannot" add the handoff sub-prompt and that the feature is "unreachable from the editor". Both are false as shipped. GET /api/creator/modes/provider-keys derives its list from Core's PromptKeyCatalog — the same registry the engine resolves against, so it already includes beat — and ModeFormPage renders it (ProviderKeysInfoInline). A creator can see beat and use it today.

What is actually true is narrower: the Provider Key field is a free-text Input (placeholder "character, persona, etc.") with the catalog shown as a reference panel beside it rather than a picker bound to the field. So the key is discoverable but mistypeable, and a mistyped key drops the whole section with only a server-side Warning (PromptContextManager — a key the catalog has never heard of logs Warning; one the catalog knows but that has no provider logs Debug). Nothing tells the creator.

This is authoring quality, not access, so it gates nothing — it is not a precondition for offering Hybrid to creators, and the items below are follow-ups to schedule on their own merit. It did get sharper on 2026-09-20: now that a beat mode's key set IS the beat's context, a typo there is the difference between the director seeing the character sheet and seeing nothing, where before every keyed section was skipped regardless and a typo cost nothing.

So the editor work is: the per-Mode editor binds the Provider Key field to the catalog it already fetches and adds a hybrid-aware authoring path; the Model Profile editor adds role pairing; and docs/docs/features/modes.md gains a Hybrid section (the beat key in the catalogue + a "Building a hybrid Mode pair" example). None of it blocks anything — see the correction above.

6. Discovery & selection — the consumption layer

§5 settles authoring (per-Mode editor) and Model routing settles runtime pairing (role-tagged Profiles) — but neither answers how a reader finds a Beat or Prose mode and runs it. Modes are browsable entities; a published Prose mode listed as an ordinary mode is a trap (selected as THE mode of a Classic chat it's a starved renderer waiting for a direction that never arrives), and requiring a Model Profile to use a browsed mode puts the only path to use behind the power-user surface. The consumption layer closes that without a new entity:

As built (2026-08-07): pipeline_role column + CHECK + partial index (04_tables_prompts.sql), seed modes stamped Beat/Prose (90_seed_hybrid_system_modes.sql), pins + tier-0 resolution (71_hybrid_pipeline_columns.sql, functions/47d_hybrid_role_mode_functions.sql — incl. fn_set_conversation_hybrid_modes with the same mode-usability/private-mode guards as the classic re-bind path), role facet on GET /api/browse/modes (?role=), role-clamped conversation modes browse (?role=beat|prose; Classic conversations are clamped to Classic), PUT /api/conversations/{id}/hybrid-modes, conversation GET carries pipelineType + pin state, creator forms carry the Pipeline Role select, Hybrid How drawer shows the Beat/Prose leg cards (Auto/Pinned + reset-to-automatic). Not in scope here: the §5 editor gaps (beat key picker, hybrid-aware authoring guidance) and Profile role-pairing UI.

Acceptance criteria (consumption layer) — verified 2026-08-07 (API-probe = 19-check live E2E against running services; SQL = targeted Database.Tests; UI = driven in the browser preview):

Package start — the missing front door

Status update (2026-09-20) — the pipeline pin is RETIRED. packages.mode_locked stopped gating anything in 79bd3fa7 + 767b1daa: the SQL clamp in fn_create_conversation_from_package, the leg-pin refusal, the managed-bot override, the PATCH mode-swap refusal, the How-drawer padlocks and the gear-menu skip are all gone, and every start path now reads Chat.PipelinePreference (clientConsole/src/services/pipelinePreference.ts) — every package reader picks the pipeline, or starts on their saved preference. The "as built" notes below, What mode_locked means now, The lock has to hold on every entry point and the lock acceptance lines describe the 2026-08-11 state — history; the column survives only as a retired shell. The creator-side Pipeline choice radio on the package About form was removed 2026-09-29.

✅ Built 2026-08-11 — UX pass still owed. §6 settled how a reader finds and pins Beat/Prose modes inside a conversation. This settles how a package reader gets a pipeline at the start, which was the one entry point Hybrid could not be reached from.

As built (2026-08-11). Readiness is fn_package_is_hybrid_ready, riding the extracted fn_resolve_hybrid_pair_owner that fn_resolve_hybrid_role_modes now also calls — so readiness and the runtime cannot drift (47d_hybrid_role_mode_functions.sql). The lock clamp lives in SQL, in fn_create_conversation_from_package (47_package_functions.sql), which is the only function in the database that can set web_conversations.package_id — so both the package Start and the gear-menu re-pick pass through it and no C# caller can walk around it. PackageDetailResponse carries pipelineLocked + hybridReady. The modal moved to components/common/HybridChoiceModal.tsx (second consumer) and is mounted in PackageDetailContent, which PackagePage and PackageDetailModal share. Creator control is a RadioGroup on the package About form, staged into the draft and committed by the builder's single Save. services/pipelinePreference.ts extracts the preference write both entry points need.

Verified in the browser 2026-08-11 against running services (ServerAPI :5000, clientConsole :5173, local Postgres), driving the real package pages as claude-tester, with the fixture package's readiness and lock flipped in the database between runs and restored afterwards. What was exercised: a hybrid-ready package preselecting Hybrid with the tuned copy; an untuned one preselecting Classic, saying so, and still offering Hybrid as selectable; a pinned package rendering Pipeline · Set by the creator before Start, skipping the pipeline dialog, posting no isHybrid, and landing pipeline_type = 1 because the server derived it from readiness; and an explicit isHybrid: false against that pinned package returning 201 with pipeline_type = 1 and logging the clamp — not a 400. Backend also has 31 targeted Database.Tests (ordering pinned both ways) and the frontend 60 jsdom tests.

The problem

A package's Start button (PackagePage.handleStartExperience) posts packageId, greetingId, personaTemplateId and source — and nothing about the pipeline. So a package conversation is always created Classic. The only way a package reader reaches Hybrid today is to start a Classic conversation and then use the gear-menu re-pick, which the Selection as-built note calls the sanctioned entry point "while the pipeline is experimental." That is a workaround standing in for a front door, and it means the reader has to already be in the wrong conversation to find the right one.

Hybrid degrades onto a Classic-built package — that is what makes offering the choice safe

This is the load-bearing fact, and it comes from the routing contract, not from optimism: each hybrid leg's concrete model is matched against the effective Profile's same-role entries, and a leg with no matching entry keeps the settings-bound seed-mode behavior (Model routing; Model Profiles — Hybrid-Ready). A package whose Model Profiles carry only classic_primary entries therefore runs perfectly well under Hybrid — it simply gets the platform's seed Beat/Prose modes instead of the creator's own.

So hybrid-readiness is a quality-of-fit signal, never a compatibility gate. The modal must not hide or disable Hybrid for a package that isn't tuned for it; it tells the reader what they will get. Hiding it would be the access-first ethic violated in the usual direction — a capability made unreachable because someone else didn't opt in.

The design: two independent reads

The start modal reads two things that must not be conflated:

Read Source Governs
Hybrid-ready? Does any one of the package's bound Model Profiles carry both a beat and a prose role entry (model_profile_entries.role)? See Readiness is a matched pair. The copy and the preselected card. "This package is tuned for Hybrid" vs "Hybrid works here, but this package hasn't tuned its beat/prose halves — you'll get the platform defaults."
packages.mode_locked Retired 2026-09-20 (enforced by nothing; see its column comment) —

Every package start offers the Classic / Hybrid cards, same HybridChoiceModal shape as the re-pick, with the readiness note — Hybrid is never hidden or disabled. The Forge sandbox offers the same pick in its header (2026-10-04).

A locked package says so, before the reader presses Start (dev decision, 2026-08-06). Not silent: a reader who has seen the pipeline choice on other packages should learn why it is absent here, and learn it while deciding whether to start — not by noticing an option that never appeared. The note goes in the package detail body (PackageDetailBody, shared by PackagePage and PackageDetailModal, so one addition covers both surfaces), alongside the other "what this experience is" facts rather than attached to the Start button as a warning. It is a statement of the experience's shape, not an error. Copy follows /brand-voice: what the creator chose, not what the reader is denied.

Readiness is a matched pair, within one Profile

(Dev decision, 2026-08-06. Refined 2026-08-11 — see the pair-owner note below.) A package counts as hybrid-ready when the Profile that will actually own the pair at runtime carries both a beat entry and a prose entry. Any-role-entry is not enough, and the pair must live in the same Profile.

Both halves of that rule come from the runtime rather than from tidiness:

Consequence worth stating, because it changes an open question elsewhere: a creator who tags a Beat entry and stops now gets nothing — no readiness copy, no Hybrid preselect — and no feedback saying why. That makes the Workbench pair-nudge in Model Profiles — Hybrid-Ready materially more valuable than when it was first raised as a nicety; it is the only surface that would tell them their half-pair is inert.

The pipeline default is driven by the Model Profiles, not by a flag (dev decision, 2026-08-06). The same role entries that produce the readiness copy also decide which card is preselected: a package whose profiles carry beat/prose entries opens with Hybrid preselected, because tuning those halves is the creator saying what this experience is for. A package without them preselects Classic. The reader can still choose either — this sets the default, never the availability, and the never-hide invariant below is unaffected. This is why the lock does not need to default on: creator intent is already expressed by what they built, and a lock is only for the creator who wants to remove the choice outright.

What mode_locked means now

Superseded 2026-09-20: mode_locked is retired and now means nothing at runtime — see the status update at the top of Package start. This section is kept as the record of the 2026-08-11 design.

The lock's original meaning — "the reader cannot swap the Mode" — is dead. Model Profiles replaced Modes as the composition surface, no seeded preset carries a mode step, and the package's mode_id is a legacy compatibility fallback (Packages). The column is still enforced server-side and still settable through the API, so it is not dead code; it is a live lock with no current meaning.

It governs more than the pipeline — know this before you flip it. mode_locked already gates the reader's entry and leg controls: ModelProfileSection and HybridLegModeSection disable them on a locked package, and the server refuses a mode change on a locked package conversation. So pinning the pipeline also removes the reader's §6 Beat/Prose leg pinning. That is coherent — a creator who paired Beat and Prose modes deliberately is not obviously served by letting a reader swap one half out — and it is deliberately left as-is rather than loosened, because narrowing a creator's existing lock is a product change, not an implementation detail. But the honest description of the lock is "the reader runs my composition", of which the pipeline pick is the newly-meaningful part, not the whole. Anything that later wants pipeline-pinning without leg-pinning needs a second flag and a dev decision, not a reinterpretation of this one.

Its newly-meaningful part under Hybrid is the pipeline pick. A creator who wired a three-act mystery around paired Beat/Prose modes is making a composition statement, and "the reader doesn't get to re-pick the pipeline" is exactly the guarantee they want — the same argument the locking rationale makes about components, applied to the one composition choice that still exists. That also relocates the creator-side control: it is a package-level setting on the About form, next to genre and content rating — not a per-component toggle on a builder step card, because there is no mode card to host it and the thing it governs is not a component.

Word it as what it does. "Readers can choose the pipeline" / "Pinned to my setup" — not "Mode locked".

The lock has to hold on every entry point, not just the new one

confirmRepickPipeline → createRepickedConversation re-creates a package conversation with isHybrid and never consults the package. Since the gear menu is currently the only way into Hybrid for a package, a lock that the start modal honors and the re-pick ignores is one menu click from meaningless. Both paths gate on the same read, or the lock is decorative.

Same for the remembered preference: Chat.PipelinePreference (ask | classic | hybrid) is a user setting, and a locked package must beat it. A reader who once ticked "remember: Hybrid" must not thereby override a creator's pin — the preference decides what happens when the reader has a choice, and a locked package is precisely the case where they don't.

Non-Goals

Open Questions

Acceptance Criteria

Not done until every box is verified ✅ against the running product.

Verification state (2026-08-11). Ticked boxes were driven in a browser against running services. Still unticked, and honestly so: the creator's About-form toggle and the gear-menu re-pick lock were exercised in jsdom but not in a browser; the cross-Profile and binding-order readiness rules are proven by Database.Tests against real Postgres but have no UI path to drive; and the remaining edges (deleted/private Profiles after publish, lock flipped mid-session, Discord) are unexercised. None of the unticked lines is known-broken — they are unverified, which is a different claim.

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

Behavior:

Invariants that must stay true:

Edges:

Cost model (and an honest correction)

The hybrid pipeline was originally conceived to save money: a cheap analytical model drafts beats, a strong model writes prose. The honest version is more nuanced, and the design should be built around the honest version:

So the realistic economic shape is "a capable beat model + a cheap, fearless, subscription-billed prose model," not "two cheap models." The saving comes from moving the bulk token volume (the long prose output) onto the flat-rate Featherless rail while keeping the smaller, judgment-heavy beat call on whatever reasoner does it best.

v1 pricing decision (dev, 2026-06-25 — revised same day): a hybrid turn is billed its real two-call cost; the beat is NOT absorbed. The original decision absorbed the beat (charge the same Echoes as Classic); on building the itemized per-line billing it was reversed — an "absorbed / recorded-but-not-charged" line is a trap that institutionalizes a standing margin leak. So the beat is a normal billed line (its own line — a different model/rate than the prose): a hybrid turn costs prose-model + embedding + evals + beat, the turn's honest two-call price, no longer artificially equalized to Classic. This is the itemized-transparency ethic applied to pricing — show and charge the real cost rather than silently subsidize it. The beat's real cost is still recorded in web_message_stats (the hybrid-beat row) for margin/analytics and now appears as a beat line on the user's per-message receipt. (Operational design: docs-internal/architecture/billing/COMPUTE_COST_LINES.md.)

Relationship to existing systems

Resilience & latency

An earlier microservices sibling of this design (a Go-orchestrated version of the same beats→prose idea) carried per-service circuit breakers, timeouts, retry/backoff, and model-fallback chains in a YAML service registry. EoD already has most of that in-process at the provider level (TransientErrorHelper in server/EchoOfDreams.Core/LLM, the Featherless resilience rail), so the hybrid pipeline does not import the registry. Three pieces are worth calling out specifically.

Per-stage timeouts — build now

As built (2026-07-10): the "build now" landed as one beat-side key, not a per-role pair. HybridPipelineLlm.RequestTimeoutSeconds bounds the beat call (falling back through the eval families, then the platform default); the prose leg rides the ordinary chat Llm.RequestTimeoutSeconds like any Classic turn. A distinct prose-side timeout key is future work. And a beat timeout does not degrade to single-model — it fails the turn like any LLM failure (the no-degrade-path decision, Non-Goals).

The beat call and the prose call have different latency profiles and deserve different budgets. The beat is short and structured (a beat sheet, not prose), it blocks the whole turn before the user sees a token, and it should fail fast; the prose call is long and streamed and tolerates a longer ceiling. So the hybrid pipeline carries a beat-specific timeout (HybridPipelineLlm.RequestTimeoutSeconds) rather than only the global chat timeout; the separate prose ceiling is the unbuilt half.

Model-fallback chain — future, rides on presets

Each role should fall back to a backup model when its primary errors or times out (Beat: another reasoner strong enough to carry the story; Prose: a hosted backup if Featherless is down). The sibling design expressed this as a fallback_service in a service registry. EoD will not add a parallel registry—presets are load-bearing and stay that way. A fallback chain belongs as a preset-level concept (a preset naming its fallback preset), riding under the per-role concrete preset selected on the user/settings side — never under the Profile Entry, which matches models rather than supplying them and stays credential-free (the consumption contract in Model Profiles — Hybrid-Ready). Deferred until the single-model preset-fallback story is designed; Hybrid inherits it once it exists.

Parallel non-dependent stages — future, needs a pipeline redesign

The obvious latency win is running anything that doesn't depend on the beat (lorebook search for the prose call, moderation pre-warm) concurrently with the beat call instead of after it. It's real, but out of scope by construction: ChatPipeline runs pre-stages → LLM → post-stages strictly in Order sequence — the stages are sequential by design. True intra-turn parallelism is a pipeline-execution redesign that would benefit the single-model path too, so it's tracked there, not here.

Design decisions

  1. The story (prose) model never does bookkeeping or judgment. It writes the beat it is given and adds no events, facts, characters or choices of its own: the director plans from beats, not prose, so anything the prose invents is lost to the story's memory. This is the Trackers north-star principle extended one step further: not only is state extraction a separate pass, narrative direction is too.
  2. The beat is injected as a user-role direction block. Never system, never assistant. Prevents the prose model echoing the clinical scaffolding into its output.
  3. Two separate conversation histories. Context hygiene buys voice consistency on the prose side and register purity on the beat side.
  4. Clinical framing is the mechanism, not a jailbreak. We are not arguing the prose model past its weights; we are structuring the turn so the flinch never triggers.
  5. Routing is role-tagged model-profile entries, reusing substring matching and * fallbacks — not a bespoke two-model config.
  6. Only the prose call streams to the user. The beat call is a hidden pre-pass.
  7. The beat track is the story-of-record. Journal, trackers, and summarization all read beat_json, never the prose. Prose is presentational; the beat is canonical state.
  8. The beat is structural story beats — npcs/environment/plot/situation (to extractors + prose) and portrayal hints (to prose, and back to the director in its own history — MD-12). Hints never leak into journal/memory; the key:value state role is Trackers', distilled from the beat (revised 2026-06-25 — was a story_state key:value map, removed to stop duplicating Trackers).
  9. beat_json on web_messages, mirroring tracker_json. One column serves extraction, beat-model history, and the verify/edit surface. No separate hidden message track.
  10. Beats are shown like trackers — hidden by default, show_beats master toggle, collapsed bar, per-message expand, inline edit with carry-forward.

Open questions

Load-bearing product / commercial / content-policy calls the dev owns — surfaced here, not silently defaulted into the build:

Engineering / design questions, open for later phases (v1 defaults noted, mine to decide):

Phase 1 — v1 Proof-of-Concept (decided scope)

The full design above is the target. v1 is a deliberately experimental proof-of-concept answering one question—does beats → prose actually produce more authentic scenes than one model, and at what latency? So the scope locks the substrate (schema, routing, storage) and keeps the experimental variables soft (prompts, model pair, context split). No creator Modes or role-tagged Profiles yet.

Altitude split — durable vs. throwaway in v1

Pipeline & beat stage

  1. Flesh the Hybrid branch in ChatPipelineFactory.GetStageKeysForType: PRE: context → compute_allocation → beat_direction (new); POST unchanged from WebChat (allocation precedes the beat so a blocked turn never bills a beat call — G1). The beat_direction IPreLlmStage is the first pre-LLM stage to make a blocking model call — shaped like an eval service (EvalLlmServiceBase lineage), it resolves the beat model, writes beat_json, and injects the beat as a user-role direction block on the last user turn.
  2. Locked model pair, resolved from the HybridPipelineLlm.* settings family — beat = HybridPipelineLlm.Provider/Endpoint/ApiKey/Model, prose = HybridPipelineLlm.Prose* (+ preset families) — mirroring JournalEvalLlm.*. One beat-side timeout, HybridPipelineLlm.RequestTimeoutSeconds; the prose leg rides the chat Llm.RequestTimeoutSeconds (a per-role prose timeout was not built — see Per-stage timeouts). No degrade path — a beat failure/timeout fails the turn like any LLM failure today (reuse the existing mechanism). No beat-skip — every hybrid turn runs both calls.
  3. Hardcoded built-in prompts for both beat and prose (creator-tunable modes are Phase 2). The beat emits structural story beats (npcs/environment/plot/situation) + portrayal hints. Keep the prompts and the context split in one tunable place — calibrating the split (does the prose model need persona/lorebook/character, or only the beat?) is the core experiment and the reason v1 is "experimental." (As built 2026-07-12: both prompts are now mode-driven when bound — HybridPipelineLlm.BeatModeId/.ProseModeId point at the seeded "Beat Director"/"Visceral Prose" system modes, making them admin-tunable in the DB; the hardcoded constants are retained as the unset/unresolvable fallback. See the §4 seed-modes as-built note.)

Storage — reuse the substrate (column over new table)

  1. beat_json TEXT on web_messages (mirrors tracker_json; TOAST'd out-of-line so it doesn't bloat history scans, inherits branch/version/retention — 38_branch_conversation already copies tracker_json). Holds { npcs, environment, plot, situation, portrayal_hints } — content only, no model/timing. Beat-model history = interleave user turns with beat_json — as built, this is Phase 2: v1 has no beat_json history injector and instead flattens the assembled prose prompt into a transcript for the beat call (BeatDirectionStage.FlattenPrompt, TODO(hybrid-phase2); the flatten is the G3 context-split mechanism).
  2. beat_summary column on web_summaries — beat-track summarization reuses the existing rollup/merge mechanism, one level over.
  3. Point journal / tracker / summary extraction at beat_json (separate post stages reusing JournalEvalStageBase; fold-into-beat-call deferred to Phase 2). Define the empty-beat_json contract so extractors don't zero out existing state on a missing beat.

Stats

  1. Extend web_message_stats with stage VARCHAR(20) NOT NULL DEFAULT 'classic' — values 'classic' | 'hybrid-beat' | 'hybrid-prose'. A hybrid turn writes two rows (beat + prose) FK'd to the same message, each with its own model/tokens/timing; this differentiates pipeline source for analytics and visibility. (VARCHAR(20), not 10 — 'hybrid-prose' is 12 chars.) Verify nothing assumes web_message_stats is strictly 1:1 with assistant messages before relying on it (functions/45_message_stats_functions.sql).

Selection — per-conversation, immutable

  1. web_conversations.pipeline_type SMALLINT NOT NULL DEFAULT 0 (0=Classic, 1=Hybrid). SendMessage reads it → sets WebChatRequest.PipelineType. Immutable per conversation, so "switching pipeline always starts a new conversation" is structural, not a rule to enforce.
  2. New-chat modal: Classic / Hybrid, with an Experimental badge (as built: a Badge, not the CornerRibbon component) + explanation on the Hybrid card. "Remember my choice" → user setting Chat.PipelinePreference (ask | classic | hybrid, default ask); when not ask, skip the modal and use the stored value.
  3. Chat dropdown → "Start a new conversation": for a standalone character chat, spin a fresh conversation and preselect the same directly accessible character/Mode, then always reopen the pipeline modal (explicit re-pick, ignoring the remembered preference). A package chat must instead use the package-aware restart contract from Document Mode Editor: reload current package context, preview/re-resolve its Profile Entry/Base, and never assume an encapsulated package Base can be copied as a directly usable Mode. Future greeting selection belongs to the corresponding launch-context preview.

Partly superseded (2026-09-20) — read the correction under this callout before trusting it. Two of its three claims have since changed: the picker gained a second caller on 2026-08-11 (package start), and the deferral it records has been lifted.

As built (2026-07-10, dev decision — stays as-is for now): the picker modal (HybridChoiceModal) is wired only into the in-chat "Start a new conversation" re-pick (item 10). The main character-direct start path (character page → /chat?characterId=… → the saved-chats page's raw conversation POST) shows no picker and cannot pass the hybrid flag — a writer starting a chat from a character card always gets Classic. And Chat.PipelinePreference is written on modal confirm but nothing reads it back yet (write-only), so item 9's "skip the modal when not ask" is not in effect. Dev decision: leave this as-is — the new-chat flow will be addressed and redesigned once persona templates come live properly, and the picker wiring lands with that redesign. UC-W1 / UC-W6 in the Acceptance Criteria are marked deferred accordingly.

Correction (2026-09-20) — the deferral above is LIFTED, and one of its claims was already stale. Point by point against the code:

  • "wired only into the in-chat re-pick" — was already false since 2026-08-11. HybridChoiceModal has had a second caller since package start shipped: PackageDetailBody (PackageDetailContent.tsx), shared by PackagePage and PackageDetailModal. The Package start section below documented this correctly while this callout kept saying "only" — the two sections disagreed with each other for five weeks. The same wrong claim was duplicated in code on CreateWebConversationRequest.IsHybrid's doc comment.
  • "the character-direct path always gets Classic" — was true, and is the gap being closed. That path (/chat?characterId=… → SavedChatsPage's raw conversation POST) genuinely had no picker and never sent the flag.
  • "Chat.PipelinePreference is write-only" — was true. The setting round-tripped to the client on the auth/display-settings DTO for the Settings page to render, and nothing in either the frontend or backend creation path branched on it. The write seam (pipelinePreference.ts, the modal's showRemember plumbing) was built in anticipation; only the read was missing.

Dev decision reversed 2026-09-20: waiting for the persona-templates redesign is no longer the plan. The preference becomes load-bearing across every new-chat entry point — ask shows the picker, classic/hybrid starts directly with no modal, anything unknown falls back to ask (never silently Hybrid) — and the character-direct path gains the picker. A locked package is no longer a carve-out — this sentence originally read "a locked package still ignores the preference entirely: the creator's pin outranks it, and the server-side clamp, not the client, remains the gate." That was written before packages.mode_locked was retired later the same day, and it did not survive the retirement: there is no server-side clamp left to be the gate. Leaving the client's skip in place while the clamp was gone made a locked, hybrid-ready package send no pipeline at all and therefore start Classic every time, with no path to Hybrid — strictly worse than the clamp it replaced, and silent. Every package now reads the preference, locked or not.

Update (2026-08-05, dev decision): the gear-menu re-pick is now package-aware — and is the sanctioned Hybrid entry point for packages while the pipeline is experimental. Previously a package chat's re-pick demoted to a standalone copy (the exact "copy an encapsulated Base" trap item 10 warns about, and the reason package+Hybrid was unreachable end-to-end). Now, when the source conversation is package-bound, the re-pick creates a new conversation from the same package honoring the pipeline pick (fn_create_conversation_from_package(p_pipeline_type) + isHybrid on the package POST — shipped with hybrid-readiness piece 1), skipping the greeting picker because the package start resolves its own effective greeting/defaults server-side. This is deliberately not item 10's full package-aware restart contract (reset/result preview, Style-&-rules roster) — that remains Document Mode Editor territory; this is the minimal correct routing so package readers can reach Hybrid at all. Verified live 2026-08-05: re-pick on a package conversation → new row with package_id set and pipeline_type=1, role-tagged entry provenance intact.

The front door that replaces this workaround is specced at § Package start (2026-08-06). Until it lands, this re-pick remains the only route from a package into Hybrid — which is also why the lock work in that section has to gate this path too, not just the new modal: a pipeline pin the start modal honors and the gear menu ignores is one click from decorative.

UI & streaming

  1. Show both outputs: prose as the main bubble, beat in a collapsible panel (reuse the TrackerBar collapsed-by-default pattern) rendering beat_json.
  2. SSE stage events: emit stage transitions beat_running → prose_streaming (anonymous lowercase frames per the SSE-heartbeat convention); the keepalive pump runs during the blocking beat call, then prose streams.

Phase 2+ then lands role-tagged Model Profile composition (Beat/Prose Base Modes), creator-tunable halves plus the Mode-editor support to author them (the beat provider key + Profile role-pairing UI + split guidance—see §Modes #5), inline Beat edit/carry-forward, eval-folded-into-Beat consolidation, Beat-skip gating, multi-greeting selection, and Featherless-hosted prose models as first-class.

The v1 carry-over points are tagged in code for this work to find. Grep TODO(hybrid-phase2) for the structural items this section absorbs—the imperative prose-prompt rebuild in BeatDirectionStage (→ a beat content-provider key + a starved Prose Mode) and ProseSettingsOverride flat HybridPipelineLlm.Prose* routing (→ role-tagged Model Profile Entries). (As built 2026-07-12: the mode-driven half of the first item landed — the beat key exists and a bound Prose Mode IS the starve, see the §4 as-built note; the updated TODO(hybrid-phase2) in BeatDirectionStage now points at the remaining role-tagged profile resolution, beat-side provider resolution, and beat history injection.) (Superseded 2026-09-20: all three landed — role-tagged profile resolution earlier, and beat-side provider resolution + beat history injection in the §4 as-built note. BeatDirectionStage carries no TODO(hybrid-phase2) any more; the TODO(hybrid-cleanup) items below are untouched.) Grep TODO(hybrid-cleanup) for hygiene that need not wait on role routing: the EvalLlmServiceBase name, duplicate Beat carriers, the "beat_direction" magic string, and misnamed HybridExtraction.

Open v1 gaps — and how v1 closes them

Validation surfaced seven gaps between "decided scope" and "buildable." Each is resolved here so v1 has no undefined behaviour; the two that actually block a build start are G1 (billing order) and G2 (beat output contract).

G1 — Balance check must run before the beat call. Problem: the natural wiring context → beat_direction → compute_allocation fires the beat LLM call before the balance check (ComputeAllocationStage is Order=500, last pre-stage), so a zero-Echo user triggers a beat call before the balance_block short-circuits them — wasted platform compute on a turn that's about to be blocked. Resolution: (Billing note, as built 2026-07-10 — the beat-line wiring in docs-internal/architecture/billing/COMPUTE_COST_LINES.md shipped; (2) and (4) below describe the billed state per the revised 2026-06-25 pricing.) (1) reorder to context → compute_allocation (500) → beat_direction (550), so the turn is gated before any compute; (2) the beat is in the user estimate — HybridComputeLineProfile includes the beat line among the turn's candidate kinds, so compute_allocation reserves the real two-call amount (embedding + model + evals + beat); (3) beat_direction checks context.ShouldSkipLlm / SynthesisKind and no-ops when allocation blocked — no beat call on a blocked turn; (4) ComputeSettlementStage settles the model line to the prose leg exactly as Classic does and the beat line to the beat call's real cost from context.BeatTelemetry; the same telemetry is also recorded in the hybrid-beat web_message_stats row for margin/analytics (two views of one source, not competing).

G2 — Beat output contract + parser. Problem: "hardcoded prompts" with no defined beat_json shape leaves nothing to parse. Resolution (as built, revised 2026-06-25): the beat is genuine structural story beats, NOT key:value state — that key:value role belongs to Trackers, which now distill their values from the beat. The beat emits prompt-instructed JSON (not forced json_object — the eval-no-forced-json rule): { "npcs": "…", "environment": "…", "plot": "…", "situation": "…", "portrayal_hints": "…" }. npcs/environment/plot/situation are the four structural fields (what each non-user character does + why + continuity details; observable environment changes; new plot logic; the circumstance now facing the user — never a choice menu); portrayal_hints is craft direction (prose-only). A BeatParser layers typed deserialization on EvalJsonParser (fence-strip, preamble-tolerant ExtractJsonObject, truncation-tolerant) exactly as JournalEvalParser does, and folds the legacy { beat_text, story_state } shape (beat_text → npcs; the key:value story_state is dropped). Graceful degradation (the parser never throws): on parse failure, the raw response becomes npcs with the other fields empty — the prose still receives a direction block (raw text) and the extractors still read it. The recovered object is what lands in beat_json. (2026-11-07, owner: "make sure the beat director in hybrid supports freeform AND json - we need to support both". Plain prose is no parse failure any more: it is a freeform beat, { "freeform": … }, read verbatim by every reader. Since the owner's second 2026-11-07 line ("Beat director should always fall back into 'freeform' when the json parse fails") nothing degrades into npcs at all: a broken JSON beat or one cut at the cap is a freeform beat of its text, and only an empty answer is no beat — see the as-built note in §3.)

G3 — v1 context-split default. Problem: the split is the experiment, but a starting point must ship. Resolution (as built): the starve is expressed as variables in the prose prompt template, not a separate reduced context-assembly. The beat reuses the full assembled story context (the prose's would-be context, flattened to a transcript) — character, persona, lorebook, journal, trackers, memory, history. The prose prompt is rebuilt from HybridPipelinePrompts.ProseSystemTemplate, which interpolates only the light variables ({{character}} brief + {{persona}} + a static craft framing baked into the text) and references nothing heavy — so the prose is starved by construction; the beat rides the last user turn as a user-role director's note. Widening/narrowing the split = editing that one template string (a compile-time constant in HybridPipelinePrompts.cs — see the UC-O2 as-built note; since 2026-07-12 this describes the fallback path — with HybridPipelineLlm.ProseModeId bound, the prose mode's provider-key set defines the split, see the §4 as-built note). v1 model pair (both independently lockable): beat = HybridPipelineLlm.*; prose = HybridPipelineLlm.Prose*. Unset, the prose falls back to the conversation's chat model (ProseSettingsOverride → Llm.*); the beat falls back to the chat model too (BeatLlmService.Chain: HybridPipelineLlm → Llm, since 2026-11-22, owner, Relay eod-421 — until then it walked TrackerEvalLlm → JournalEvalLlm → SummarizationLlm first and reached the chat model only indirectly) (G7: one model for both at first). So it runs with no hybrid-specific config — but the operator runs the intended pair (a cold beat reasoner + an uninhibited prose fine-tune) by setting HybridPipelineLlm.Model and HybridPipelineLlm.ProseModel. The prose override (ProseSettingsOverride) wraps the prose LLM call ONLY — the pipeline context, the beat call, and billing keep the chat settings, so the two legs genuinely run on two different models (the experiment's whole point). Extraction reads the beat, not the prose: the per-message tracker + journal evals read beat_json (the structural fields — npcs/environment/plot/situation — never the portrayal hints) via HybridBeatState.ToExtractionText() — the prose deliberately obscures clinical state, so reading it would be the lossy round-trip the story-of-record design deletes. Window/summarization extraction from beats (the beat_summary rollup) is also wired (WebSummarizationTriggerService carries BeatJson into the summarizer and persists beat_summary). Manual summary regeneration (the summaries-panel "Regenerate" button — distinct from turn regeneration in G4) preserves the beat-track too: the regen read rows carry each window's beat_json / each child's beat_summary, so the re-summarization reads the clinical beat (not the obscured prose) and re-derives beat_summary by the same windowHasBeats / rollupHasBeats rule — rather than refreshing the prose while the beat-track silently goes stale or null. And when the summarizer gets a fact wrong, the user can directly edit the beat-track: the Memory drawer surfaces an editable "Beat-track memory" field on Hybrid summaries/memories (alongside the prose summary), saved through fn_update_summary_authorized as a three-state field (omit/clear/set) that never touches the prose embedding.

G4 — Regeneration of a hybrid turn. Problem: regenerate exists today (version groups) but is unspecified for hybrid. Resolution: v1 — regenerate re-runs the whole turn (new beat + new prose) into a new version row, exactly as Classic regenerate does; the new beat_json rides the new version row. IsRegeneration flows through unchanged, no new mechanism. Prose-only / beat-only regen is the Phase 2 refinement already noted in Open questions.

As built (2026-09-20) — prose-only regeneration shipped; beat-only did not. The request carries regenerateMode: "full" | "prose_only" alongside isRegeneration; "full" (or absent) is byte-for-byte the v1 behaviour above. On "prose_only" the server resolves which beat — it reads it off GetLastAssistantMessageAsync, the same read WebMessagePersistence uses to pick the row it versions, so the beat re-rendered and the row the new version attaches to cannot diverge. The client only names the mode; it never supplies beat content, so a beat the user corrected in the panel is the one re-rendered rather than one the client made up. It travels as IPipelineContext.ReusedBeat (HybridBeatReuse { BeatJson, BeatRaw }), and BeatDirectionStage — same stage, same beat_direction factory key — parses the stored beat_json instead of calling the director, then performs the identical starved prose rebuild. Only the model call is dropped.

Four consequences, each deliberate:

G5 — A surface to read the experiment. Problem: the stage discriminator records data but nothing lets the operator see the comparison. Resolution: v1 reuses two existing surfaces — (a) the per-message info modal (today one call's model/tokens/timing) renders both stat rows for a hybrid turn, keyed by stage; (b) the in-chat collapsible beat panel makes the beat inspectable, so output comparison is "open a Classic and a Hybrid chat with the same character." A dedicated Hybrid-vs-Classic analytics view is Phase 2.

G6 — Moderation of the beat. Problem: what content-checking applies to the beat? Resolution: moderation is non-blocking and pipeline-agnostic (dev decision) — the planned message-moderation checks flag content for review, never block generation, and treat Classic and Hybrid identically. Hybrid therefore needs no special moderation path: it inherits the same message flagging as Classic. The beat is internal content the same flagging can extend to (a beat flag is just another review signal); nothing about Hybrid blocks a turn on content grounds, and no beat-stage "gate" is built or planned.

G7 — Which two models. Problem: the "locked pair" is never named. Resolution: the pair is runtime settings config (HybridPipelineLlm.Model / HybridPipelineLlm.ProseModel + preset families). Recommended shape: Beat = a cold, structurally-strong reasoner where clinical framing survives the positivity bias; Prose = an uninhibited open fine-tune on the Featherless flat rail. The concrete pick is the experiment's variable; local dev can bring the pipeline up on one model for both, then differentiate the beat.

Edge cases folded in: a greeting (assistant turn with no preceding user turn) has no beat — the history interleave tolerates a missing beat_json the same way the empty-beat contract (G2) does. Editing a hybrid message in v1 is Classic-equivalent (edits the prose content; the beat is untouched).

Non-Goals (v1)

Deliberately out of scope for v1 — several of these a reader would reasonably assume are in:

Acceptance Criteria (v1)

The feature is not done until every box below is verified ✅ against the running product. There are two users: the Writer (end user) and the Operator (running the experiment — a real user of an experimental feature). A hybrid turn is billed its real two-call cost (prose + embedding + evals + beat; the beat is billed, not absorbed — revised 2026-06-25); Hybrid is free to choose in v1, never an access gate.

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

Behavior (exercise the mechanism):

Invariants that must stay true (carve-outs a reviewer can break if regressed):

Edges (empty / failure / unauthorized / boundary):

The raw beat — always kept, and editable

Shipped 2026-09-19. The beat model's verbatim response used to be parsed into beat_json and then discarded: BeatLlmResult.RawContent had zero consumers, so a beat the parser couldn't structure left nothing behind but a Warning log line — the writer saw an empty panel and had no way to find out what the director actually said, let alone fix it.

It is now persisted on every hybrid turn as web_messages.beat_raw, beside the beat_json it was parsed into, and the chat's Story-beat panel renders and edits it.

Why it is NOT on the eval stats row. The journal and tracker evals keep their raw response on their per-call *_eval_stats row, gated to non-ok parses by EvalRawResponse.ForStatsRow — a diagnostics crumb for debugging model misbehaviour. That policy is deliberately not applied here, on both halves:

The display is generic, and so is the editing. The panel shows the structured beat when beat_json parses and falls back to the raw when it doesn't — and the owner can edit in whichever state they are looking at, rather than one surface standing in for both:

Both write through one path: the edit is serialized to text, PATCHed, reparsed server-side by the same BeatParser the beat stage runs, and the stored pair comes back. A field edit sends the whole beat re-serialized, never a partial patch — the server reparses whatever it is handed, so a partial send would blank the other four. This is also why beat_raw and beat_json cannot drift: every writer produces both from one parse.

A field edit serializes to labeled text (readable if the writer later opens the source view), with one carve-out: the labeled-text tier requires two distinct labels — a deliberate guard so a stray colon in prose can't masquerade as a beat — so a beat edited down to a single field is sent as JSON instead, which has no such bar. Without that, a one-field beat would collapse wholesale into npcs.

The beat's rendered forms became an input format. Before this, nothing typed beat text back in, so it never mattered that the panel says Portrayal, the direction block says How to portray it, and the parser only knew portrayal_hints. Once a human edits the beat, the vocabulary the product shows is the vocabulary they will type — and an unknown label doesn't error, it glues the line onto the previous section. BeatParser is now the single tolerant boundary that accepts all of them. Treat this as a standing rule: a label printed anywhere in the product must be readable by the parser.

Editing is a reparse, not a text swap. The writer edits the raw because that is what they were shown, but nothing downstream reads it — journal / tracker / summary extraction and later turns' direction block all read beat_json. So PATCH /api/conversations/{id}/messages/{messageId}/beat-raw runs the edited text back through the same BeatParser the beat stage uses and writes the pair atomically (fn_set_message_beat_raw_authorized). Storing only the raw would have made the correction cosmetic; storing only the JSON would have thrown away what the writer typed. Blanking the raw clears both — "no beat here" is a coherent state, a raw with a stale structured twin is not. Like the tracker inline edit, it does not bump updated_at: correcting a beat is not editing the prose.

Acceptance Criteria — raw beat

User use cases — satisfiable + accessible (verified by driving the chat, 2026-09-19):

Behavior:

Invariants:

Edges:

Acceptance Criteria — prose-only regeneration

User use cases — satisfiable + accessible (verified by driving the chat, 2026-09-20):

Behavior:

Invariants that must stay true (carve-outs a reviewer can break if regressed):

Edges: