Story Contract v6 — which episode a node belongs to

World API 1.60.0. Shaped by an integrator's answers to a design draft (handoff reply 53, and the answers that came back, 2026-11-20). Two optional node fields, one rule a role is held to, one rejection code, one write switch.

The fields

  • nodes[i].episodeId — the series.episodes[].episodeId this node belongs to. Refused in a package with no series, or naming an undeclared episode. Absent: the node belongs to no episode and behaves exactly as before v6.
  • nodes[i].episodeOpening: true — the node that opens its episode. At most one per episode, optional, and only together with episodeId. false is refused, so "not an opening" has one byte representation.

Written on the NODE, not as a list on the episode, at the integrator's request: authors add and delete nodes one at a time, and a field that travels with its node leaves nothing dangling when the node is deleted — "a node belongs to at most one episode" then holds by construction.

A package that uses episodeId is v6, under the lineage discipline v2–v5 established: earned by use, a v6 head stays v6, and storyContentMatchesContract refuses the field in a v1–v5 row. It needs a version by the doctrine in story-package.ts — would an older reader that SHRUGGED at the field get the outcome wrong? Yes: it would tell roles every episode's nodes and accept them, so a role could open the next episode early, which is the one thing the author declared the field to prevent.

What it changes — for a ROLE only

The episode a beat is in is the instance's episode row; before the first commit of a serial there is none yet, and the beat is in episode one (the single writer seeds that row on that commit). While a worldline plays an episode, for a package that declares membership:

  1. What a role is told. The effect brief's node lists — the first six as declared and the six opened most recently — hold only nodes of that episode and nodes of no episode, and so do the scenes the brief OFFERS, because they are derived from the same ready set. Offering is all it is: a role's request_scene_transition is still accepted for any declared scene, as before v6 — scenes carry no episode.
  2. What a role may do. A role's complete_objective on another episode's node is refused with code episode_boundary, before the prerequisite check, so the reason names the boundary even for a node that is not ready.
  3. The opening counts as opened when its episode starts, so a role is told it among the nodes opened most recently even when nothing points at it. "Starts" is read on the clock the brief already uses — positions in completedNodes — as just after the last completed node of an EARLIER episode. Not "just before this episode's first completion": the provider may complete a node of episode two during episode one, and that would date the opening back behind everything episode one opened afterwards.

Not changed: what the CALLER may write (proposedPatches may complete any node, checked against prerequisites only), nextOptions, ending rules, and every package without membership, which is told and accepts exactly what it did before.

The rejection code

episode_boundary is the second code, after narrative_conflict, that is not a defect — and it is not drama either. It is a gate the author declared, working. GATE_REJECTION_CODES in effect-reason.ts names it, so a second gate joins a list rather than another special case; isDefectRejection returns false for it; the quality evaluation takes it out of the defect count, the narrative-conflict count and the repair rate's defect-refused beats, and says how many there were. (One rider in the same evaluation: the drama suite's "other refusals are defects" note now also leaves out pre-taxonomy refusals, as the npc suite's already did — they are unknown, not defects.)

The write switch

POUCHY_STORY_CONTRACT_V6_WRITE=1, per deployment, read at call time. Off by default, like v2–v5: a pre-1.60.0 server cannot read a v6 row at all (unsupported_contract), so the reader must be deployed everywhere before a row is written. With it off, a publish that uses the field answers 409 story_contract_v6_write_disabled with the field intact. GET /api/version reports storyContractWrites.v6.

A rollback

Once a v6 row exists, a deployment older than 1.60.0 refuses it as unsupported_contract — a story that will not load, not one that loads wrong. Turning the switch off stops new v6 rows and leaves existing ones readable by this build — and, because a v6 package stays v6 whatever its content later says, it also refuses every REPUBLISH of an existing v6 package (409), even one that has removed all membership.