{"formatVersion":1,"storiesVersion":"2.6.58","actions":[{"type":"setFlag","group":"state","desc":"Set a boolean flag true.","params":"flag","wiring":"reducer"},{"type":"clearFlag","group":"state","desc":"Set a boolean flag false.","params":"flag","wiring":"reducer"},{"type":"incVar","group":"state","desc":"Add to a numeric variable (counters/clocks).","params":"var, by","wiring":"reducer"},{"type":"setVar","group":"state","desc":"Set a variable to a number or string.","params":"var, value","wiring":"reducer"},{"type":"tickClock","group":"state","desc":"Advance a declared clock by N.","params":"clock, by","wiring":"reducer"},{"type":"addClue","group":"state","desc":"Add a clue to the investigation board.","params":"clue","wiring":"reducer"},{"type":"setObjective","group":"state","desc":"Set a quest objective’s status.","params":"objective, to","wiring":"reducer"},{"type":"adjustRelationship","group":"state","desc":"Shift an NPC relationship score.","params":"npc, by","wiring":"reducer"},{"type":"grantAdvantageNext","group":"state","desc":"Advantage on the next check (or initiative).","params":"scope?","wiring":"reducer"},{"type":"grantDisadvantageNext","group":"state","desc":"Disadvantage on the next check (or initiative).","params":"scope?","wiring":"reducer"},{"type":"upsertVar","group":"state","desc":"Create a variable at a value, or add to it if it already exists.","params":"var, value, by","wiring":"reducer"},{"type":"unsetVar","group":"state","desc":"Remove a variable, so reads find nothing until it is written again.","params":"var","wiring":"reducer"},{"type":"applyDamage","group":"combat","desc":"Deal damage (dice or amount) to a target.","params":"target, dice?|amount?, damageType?","wiring":"reducer"},{"type":"applyHeal","group":"combat","desc":"Heal a target (dice or amount).","params":"target, dice?|amount?","wiring":"reducer"},{"type":"applyCondition","group":"combat","desc":"Apply a 5e condition to a target.","params":"target, condition","wiring":"reducer"},{"type":"clearCondition","group":"combat","desc":"Remove a condition from a target.","params":"target, condition","wiring":"reducer"},{"type":"requestCheck","group":"combat","desc":"Deprecated — author an ability/skill check as a skillCheck NODE (with outcome tiers), not a then-list action.","params":"ability?|skill?, dc, adv?","wiring":"engine"},{"type":"resolveAbility","group":"combat","desc":"Deprecated — not wired; apply effects via applyDamage/applyHeal/applyCondition (or an item), not this verb.","params":"elementId, targets?","wiring":"engine"},{"type":"startCombat","group":"combat","desc":"Deprecated — begin an encounter via a combat NODE (with onVictory/onDefeat/onFlee), not a then-list action.","params":"encounter","wiring":"engine"},{"type":"grantItem","group":"rewards","desc":"Give an item to the hero’s bag.","params":"itemId, qty?, note?","wiring":"reducer"},{"type":"grantGold","group":"rewards","desc":"Give gold (folds into the purse + ledger).","params":"gp, note?","wiring":"reducer"},{"type":"grantCoins","group":"rewards","desc":"Give mixed coins (cp/sp/ep/gp/pp).","params":"coins, note?","wiring":"reducer"},{"type":"spendCoins","group":"rewards","desc":"Deduct coins (gate with an affords condition).","params":"amount, note?","wiring":"reducer"},{"type":"grantLevel","group":"rewards","desc":"Level the hero up (milestone).","params":"—","wiring":"reducer"},{"type":"awardXp","group":"rewards","desc":"Award XP toward the next level.","params":"xp","wiring":"reducer"},{"type":"craftItem","group":"rewards","desc":"Craft from a recipe — consume the ingredients, grant the output (re-validated against the bag).","params":"recipeId","wiring":"engine"},{"type":"grantInspiration","group":"rewards","desc":"Grant real Heroic Inspiration — spendable at the combat roll windows (✨).","params":"amount?","wiring":"reducer"},{"type":"grantGate","group":"rewards","desc":"Pass a campaign gate for the carrier hero (its costs debit, its grant applies) when the rewards settle at quest end. A story run warns.","params":"gateId","wiring":"engine"},{"type":"buyItem","group":"rewards","desc":"Buy one item for a price - the coins, the item and the stock change together, or nothing does (sold out, can't afford, or locked).","params":"itemId, price, stockVar?, shopId?, note?","wiring":"engine"},{"type":"rest","group":"sheet","desc":"The party takes a short rest: an hour, and each hero may spend Hit Dice to heal. Not during a fight. Performed in an Arena encounter through the same rest the village uses; a story run rests at a rest node and warns.","params":"restType (short)","wiring":"engine"},{"type":"rollTable","group":"random","desc":"Roll a seeded weighted table and apply the picked entry.","params":"table[], note?","wiring":"engine"},{"type":"callScene","group":"flow","desc":"Jump to a node and push a return address (sub-scene).","params":"node","wiring":"engine"},{"type":"returnScene","group":"flow","desc":"Pop back to the caller of a sub-scene.","params":"—","wiring":"engine"},{"type":"ifThen","group":"flow","desc":"Run `then` (else `else`) by an inline condition — conditional effects inside a then-list.","params":"if, then, else?","wiring":"engine"},{"type":"forEach","group":"flow","desc":"Run `do` once for each creature in a region (an encounter only); target `each` inside it names that creature.","params":"group {inRegion}, do","wiring":"engine"},{"type":"repeat","group":"flow","desc":"Run `do` a set number of times (1–20; nested repeats multiply under the same cap).","params":"times, do","wiring":"engine"},{"type":"abilityCheck","group":"flow","desc":"The creature that set the rule off makes an ability check (rolled with the session's dice) against a DC, another creature's passive score, or both, then runs `then` on a success (else `else`). Performed by an encounter or Play; a story's checks are skillCheck nodes, so a story run warns.","params":"ability, skill?, dc?, passiveOf? {actorId, ability, skill}, then, else?","wiring":"engine"},{"type":"consumeItem","group":"sheet","desc":"Consume a single-use item the hero holds.","params":"itemId, qty?","wiring":"reducer"},{"type":"useItem","group":"sheet","desc":"Use an owned item — a PLAYER command from the bag/inventory (not an author then-list action).","params":"itemId","wiring":"command"},{"type":"spendResource","group":"sheet","desc":"Spend a resource/slot the hero actually has.","params":"key, amount?","wiring":"reducer"},{"type":"revealObject","group":"scene","desc":"Reveal a hidden scene object, or a hidden zone of the map. A zone is presentation only: an Arena encounter shows it to the players once its zone check passes; a story run has no map and warns.","params":"objectId | zoneId","wiring":"reducer"},{"type":"setObjectState","group":"scene","desc":"Set a scene object’s state key (drives layer swaps).","params":"objectId, key, value","wiring":"reducer"},{"type":"moveActor","group":"scene","desc":"Move an actor to a zone. In an Arena encounter, mode append queues the walk behind whatever the creature is already doing; the default replaces it.","params":"actorId, zoneId, mode?","wiring":"reducer"},{"type":"setActorVisibility","group":"scene","desc":"Set an actor visible/hidden/concealed.","params":"actorId, visibility, findDc?","wiring":"reducer"},{"type":"unlockObject","group":"scene","desc":"Unlock a door or chest on the encounter map (the rule is the key: no check, no action spent). It never opens it — a creature does. Performed in an Arena encounter; a story run holds no doors and warns.","params":"objectId","wiring":"engine"},{"type":"setDoorState","group":"scene","desc":"Open, close or lock a door on the encounter map (a lever, a ward, a trap slamming shut): the rule moves it, so no action and no check is spent. Locking an open door shuts it first. A door that is already in that state, or a lock that cannot hold, is refused and the rule records why. Performed in an Arena encounter; a story run holds no doors and warns.","params":"objectId, state (open | closed | locked)","wiring":"engine"},{"type":"joinCombat","group":"combat","desc":"Bring a creature the encounter placed into the running fight, on a side and at an initiative you state (reinforcements arrive). It never makes a creature. Performed in an Arena encounter; a story run holds no fight and warns.","params":"actorId, side, initiative","wiring":"engine"},{"type":"resolveRecipe","group":"combat","desc":"Resolve a recipe on one creature with the encounter's dice (a trap's needle: a saving throw, then damage and a condition on a failure, half on a success), in a fight or out of one. It comes from the rule, never from a made-up creature. Performed in an Arena encounter; a story run holds no session and warns.","params":"target, recipe","wiring":"engine"},{"type":"departCombat","group":"combat","desc":"A creature leaves the running fight (the cart horse bolts, a guard flees through a portal): it takes no further turn here. Cause fled or teleported. With no fight running, a creature that flees is taken off the board (a despawn) and the next fight does not seat it; teleported still needs a fight. Performed in an Arena encounter; a story run holds no board and warns.","params":"target, cause","wiring":"engine"},{"type":"setControl","group":"combat","desc":"A creature in the running fight answers to another creature's command (the charmed guard, the bought mercenary): the controller decides its turns and it fights for the controller's side, for some rounds, turns or minutes, or the whole encounter, then reverts. A side instead (or as well) puts it on that team (the surrendering bandit who joins the party), and the fight's victory counts it there while it holds; a second setControl with its own side puts it back. Performed in an Arena encounter; a story run holds no fight and warns.","params":"target, controller?, side?, duration?","wiring":"engine"},{"type":"setPerception","group":"combat","desc":"A creature in the running fight hunts differently for a while (the difficulty knob): a preset (aggressive, guard or hunter) or its own numbers set how far it strays from its post and how many rounds it searches for a hero it lost sight of, for some rounds, turns or minutes, or the whole encounter, then it goes back to its own. A second setPerception replaces the first. Performed in an Arena encounter; a story run holds no fight and warns.","params":"target, preset?, searchRounds?, leashFeet?, duration?","wiring":"engine"},{"type":"carry","group":"scene","desc":"Seat creatures on a carrier (two heroes on the cart a horse pulls): when the carrier walks they ride along behind it, and they do not walk on their own until they dismount. A fight beginning ends it. Performed in an Arena encounter; a story run holds no map and warns.","params":"carrierId, riderIds, vehicle?","wiring":"engine"},{"type":"dismount","group":"scene","desc":"The riders get down from their carrier, each staying on the square it rode to. Performed in an Arena encounter; a story run holds no map and warns.","params":"carrierId","wiring":"engine"},{"type":"dropItem","group":"scene","desc":"Put an item on the ground - under a creature (loot where a bandit fell) or on a square - for any creature to pick up, a coin pouch included. Picking it up is handling an object: within 5 ft, and in a fight the free object interaction or the Utilize action. Performed in an Arena encounter; a story run holds no map and warns.","params":"itemId, at ({cell} | {actorId}), quantity?","wiring":"engine"},{"type":"rollInitiative","group":"combat","desc":"Roll for initiative: the encounter's fight begins now, with every creature on the map on the side, and surprised or not, that the encounter set up. A surprised list adds creatures the rule adjudged surprised (they failed to notice the party): each rolls its Initiative with Disadvantage. Performed by an Arena encounter's Play session; in a fight already running it is refused; a story run begins fights with a combat node and warns.","params":"surprised? (creatures)","wiring":"runner"},{"type":"goto","group":"flow","desc":"Jump to another node.","params":"node","wiring":"engine"},{"type":"emitEvent","group":"io","desc":"Emit a domain event (analytics / AI / voice hook seam).","params":"name, props?","wiring":"runner"},{"type":"showScene","group":"io","desc":"Show a scene on the shared display.","params":"sceneRef","wiring":"runner"},{"type":"playAudio","group":"io","desc":"Play a soundboard clip.","params":"trackId","wiring":"runner"},{"type":"showToast","group":"io","desc":"Float a short message to the player (\"You found 10 silver\").","params":"text, ms?","wiring":"runner"},{"type":"equipItem","group":"sheet","desc":"Equip an item the hero OWNS (grant it first) — auto-picks the slot, or takes an explicit one. Runs through the same equip rules as the inventory.","params":"itemId, slot?","wiring":"runner"},{"type":"focusCamera","group":"io","desc":"Point the map camera at a cell, a creature or a zone, and optionally follow the creature as it moves. Presentation only: it changes nothing in the game. Performed by an Arena encounter's viewport; a story run has no map and warns.","params":"target ({cell} | {actorId} | {zoneId}), follow?, blend? ('cut' | {glideMs})","wiring":"runner"},{"type":"travel","group":"scene","desc":"Walk a creature along a zone's trail at a pace (walk, trot or gallop), one cell at a time, each step an ordinary move, so every zone on the way fires its own rules. The trail starts at the zone cell nearest the creature, then the nearest cell not yet walked, a tie going to the cell listed first. A refused step ends the travel there. Performed by an Arena encounter's Play session out of a fight; a story run has no map and warns.","params":"target, along ({zoneId}), pace","wiring":"runner"},{"type":"holdActor","group":"scene","desc":"Hold a creature where it stands (held true), or release it (held false): a held companion does not follow the party, and a walk it is ordered on ends in a hold. Performed in an Arena encounter out of a fight; a story run has no command channel and warns.","params":"target, held","wiring":"engine"},{"type":"followActor","group":"scene","desc":"A creature follows a leader: its standing order becomes follow that creature. Performed in an Arena encounter out of a fight; a story run has no command channel and warns.","params":"target, leader","wiring":"engine"},{"type":"teleportActor","group":"scene","desc":"A creature arrives at a square at once, without walking the squares between (a portal, a blink). A square another creature holds refuses it. Performed in an Arena encounter out of a fight; a story run has no map and warns.","params":"target, to ({cell})","wiring":"engine"}],"conditions":[{"key":"all","desc":"All sub-conditions are true (AND).","params":"all: Condition[]"},{"key":"any","desc":"Any sub-condition is true (OR).","params":"any: Condition[]"},{"key":"not","desc":"The sub-condition is false (NOT).","params":"not: Condition"},{"key":"flag","desc":"A flag equals a boolean.","params":"flag, is"},{"key":"hasFlag","desc":"A flag is truthy (shorthand).","params":"hasFlag"},{"key":"var","desc":"A variable compares (==,!=,>,>=,<,<=) to a value.","params":"var, op, value"},{"key":"bind","desc":"A live value read through a binding (e.g. creatures.g1.hp.pct) compares (==,!=,>,>=,<,<=) to a value.","params":"bind, op, value"},{"key":"clock","desc":"A clock is within gte/lte bounds.","params":"clock, gte?, lte?"},{"key":"hasClue","desc":"The hero has learned a clue.","params":"hasClue"},{"key":"objective","desc":"An objective has a given status.","params":"objective, is"},{"key":"relationship","desc":"An NPC relationship is within gte/lte bounds.","params":"relationship, gte?, lte?"},{"key":"hasItem","desc":"The hero holds an item (optional qty).","params":"hasItem, qty?"},{"key":"affords","desc":"The purse can afford a coin cost.","params":"affords: {cp?,sp?,ep?,gp?,pp?}"},{"key":"visited","desc":"A node has been entered at least once.","params":"visited: NodeId"},{"key":"visitCount","desc":"A node’s visit count is within gte/lte bounds.","params":"visitCount, gte?, lte?"},{"key":"inZone","desc":"The hero is in a given scene zone. With actor, a cast member is inside that map zone instead (an Arena encounter only; a story run reports it).","params":"inZone: zoneId, actor?: cast key"},{"key":"held","desc":"A cast member's standing order is hold (the Hold order, or a rule's holdActor). An Arena encounter only; a story run reports it.","params":"held: cast key"},{"key":"objectState","desc":"A scene object’s state key matches (default: revealed).","params":"objectState: {id, key?, is}"},{"key":"stat","desc":"Compare a character stat (level / xp / hp / maxHp).","params":"stat, op, value"},{"key":"passivePerception","desc":"The printed Passive Perception score (10 + Wisdom (Perception) bonus; SRD 5.2.1 p.186) is at least a DC — a score, not a roll.","params":"passivePerception: {gte}"},{"key":"stars","desc":"The best stars the account has earned on a level (a scenario id) are at least gte. Read from the campaign's view of the account; a story run cannot answer it and refuses.","params":"stars: levelId, gte"}],"triggers":[{"key":"onEnterNode","fires":true,"desc":"When a node is entered."},{"key":"onExitNode","fires":false,"desc":"When a node is left (reserved)."},{"key":"onChoice","fires":true,"desc":"With a choice anchor (Rule.choiceAnchor { sceneKey, choiceId }): on the step the host says that choice was taken in that scene (an Arena dialogue scene, or a Story node). hero/self is the creature who chose. Unanchored it is reserved."},{"key":"onCheckTier","fires":false,"desc":"When a check resolves to a tier (reserved)."},{"key":"onCombatEnd","fires":true,"desc":"With a battle anchor (Rule.battleAnchor, optional outcome victory/defeat/stalemate), in an encounter: once, on the step the victory door says the battle ended. Unanchored it is reserved."},{"key":"onFlagSet","fires":false,"desc":"When a flag is set (reserved)."},{"key":"onVarChange","fires":true,"desc":"With a variable anchor (Rule.varAnchor.varId), in an encounter: when another rule's write changes that scenario variable. Chains of these are capped and held rule_cascade_limit. Unanchored it is reserved."},{"key":"onZoneEnter","fires":true,"desc":"When the hero moves into a scene zone (gate with inZone) — or, with a spatial anchor (Rule.anchor.spatialZoneId), when a creature enters that MAP zone, fired from the engine's committed crossings."},{"key":"onAttacked","fires":false,"desc":"In-combat reaction window — reserved/deferred (task #52)."},{"key":"onZoneExit","fires":true,"desc":"When a creature leaves the MAP zone the rule is anchored to (Rule.anchor.spatialZoneId), fired from the engine's committed crossings. Needs an anchor: the scene band model has no exit event, so an unanchored onZoneExit rule is refused."},{"key":"onInteract","fires":true,"desc":"When a creature's interaction with the object the rule is anchored to (Rule.objectAnchor.objectId) commits: opening a chest, taking a key; objectAnchor.outcome 'failure' fires on a failed pick or force instead. objectAnchor.verb narrows it to one verb. Needs an object anchor."},{"key":"onCombatStart","fires":true,"desc":"With a battle anchor (Rule.battleAnchor, no outcome), in an encounter: once, on the step the host opens the encounter with, before that step's other rules (an opening briefing). Unanchored it is reserved."},{"key":"onTurnStart","fires":true,"desc":"With a creature anchor (Rule.creatureAnchor, subject party/anyCreature/nonParty), in an encounter: when that creature's turn begins. hero/self is the creature."},{"key":"onTurnEnd","fires":true,"desc":"With a creature anchor, in an encounter: when that creature's turn ends. hero/self is the creature."},{"key":"onRoundEnd","fires":true,"desc":"With a round anchor (Rule.roundAnchor, optional every N or at N), in an encounter: when a combat round ends. hero/self is the party lead."},{"key":"onCreatureDown","fires":true,"desc":"With a creature anchor (optional lifeState dying/stable/dead), in an encounter: when a creature drops to 0 HP. hero/self is the creature."},{"key":"onCreatureStabilized","fires":true,"desc":"With a creature anchor, in an encounter: when a dying creature is stabilised. hero/self is the creature."},{"key":"onDamageTaken","fires":true,"desc":"With a creature anchor (optional damageType), in an encounter: when damage lands on a creature (a fully resisted hit does not count). hero/self is the creature."},{"key":"onConditionGained","fires":true,"desc":"With a creature anchor (optional condition), in an encounter: when a creature gains a condition. hero/self is the creature."},{"key":"onConditionLost","fires":true,"desc":"With a creature anchor (optional condition), in an encounter: when a creature loses a condition. hero/self is the creature."},{"key":"onObjectDestroyed","fires":true,"desc":"With an object anchor (Rule.objectAnchor.objectId, no verb or subject), in an encounter: when that whole object is destroyed. hero/self is the destroyer, else the party lead."},{"key":"onSighted","fires":true,"desc":"With a sight anchor (Rule.sightAnchor.seers, the creatures whose eyes it watches) and once, on a map: after a step on which one of those creatures sees a party member - a clear line of sight, by the same read Hide uses. hero/self is the creature seen."}],"nodeKinds":[{"kind":"scene","desc":"Narrative beat: prose + optional interactables / passive onEnterCheck → next."},{"kind":"choice","desc":"A branch: a list of choices (each with optional requires / then / next)."},{"kind":"dialogue","desc":"A conversation: conditional lines + response choices in one node."},{"kind":"skillCheck","desc":"An ability/skill check with 5 outcome tiers + a failure model."},{"kind":"challenge","desc":"A skill challenge: reach N successes before M failures."},{"kind":"combat","desc":"An encounter → onVictory / onDefeat / onFlee."},{"kind":"loot","desc":"Grant rewards (then actions) → next."},{"kind":"transition","desc":"A conditional jump to another node."},{"kind":"gate","desc":"First matching branch wins; else a fallback node."},{"kind":"consequence","desc":"Apply effects (then actions) → next."},{"kind":"rest","desc":"A short/long rest (spend Hit Dice / refresh resources) → next."},{"kind":"hub","desc":"A revisitable hub with conditional exits."},{"kind":"ending","desc":"A terminal node (endingId + outcome + epilogue variants)."}],"wizardPatterns":[{"id":"relationship-domino","name":"Relationship Domino","purpose":"The signature companion arc: a bond you build early reads back as a rescue, a combat ally, and a stay-or-leave payoff.","whenToUse":"You want a companion whose relationship with the hero visibly changes outcomes across the story (the \"Mira chain\").","requiredAnchors":["influenceSceneId (bond starts — choice/dialogue)","assistSceneId (a skillCheck the companion can rescue)","combatSceneId (a fight they join)","payoffSceneId (the stay/leave moment)"],"optionalParams":["relationshipKind: trust|respect|debt|romance|rivalry","npcName","createMissingStubs (stub any missing anchor)"],"generatedState":["a relationship variable (e.g. <prefix>_trust) written at the bond + read at the assist, combat, and payoff"],"expectedPayoff":"The payoff beat’s DC bends on the relationship var, and the ending/late scene differs by whether the bond was earned — not a cosmetic flag.","examplePrompt":"\"Add a companion the player can earn the trust of, who saves them on a check, fights beside them, and reacts at the end.\"","exampleOutputShape":"1 relationship var + up to 4 wired beats (influence → assist allyAssist → combat ally → dcAdjust payoff) + a test preset."},{"id":"romance-rivalry","name":"Romance / Rivalry Turn","purpose":"A relationship escalation that turns on a check: a quiet moment builds it, a turn beat resolves it into devotion or a sworn rivalry.","whenToUse":"You want one charged relationship beat whose result (won-over vs turned-away) the story remembers.","requiredAnchors":["momentSceneId (the quiet-moment/rising-tension beat — choice/dialogue)","turnSceneId (the turn — a skillCheck)"],"optionalParams":["kind: romance|rivalry","npcName","createMissingStubs"],"generatedState":["a relationship flag/var raised at the moment + read (dcAdjust) at the turn + an outcome var set by the turn"],"expectedPayoff":"The turn’s DC is easier if the bond was built; the outcome var is available for later scenes/endings to read.","examplePrompt":"\"Give the rival a scene where the player can win them over or make an enemy for good.\"","exampleOutputShape":"1–2 relationship vars + 2 wired beats (moment → dcAdjust turn) + optional battle-respect consequence."},{"id":"faction-favor","name":"Faction Favor","purpose":"A faction ledger: do a job to earn favor, optionally get their forces in a fight, then spend the standing at a payoff.","whenToUse":"You want a faction whose regard for the player is earned and later cashed in (allies, prices, access).","requiredAnchors":["jobSceneId (the favor/job — a skillCheck)","payoffSceneId (collecting the debt — a favor-aware skillCheck)"],"optionalParams":["forcesRef (a stat block the faction sends to fight beside you)","combatSceneId (where they join)","createMissingStubs"],"generatedState":["a favor relationship var (e.g. <prefix>_favor) + a job-done flag"],"expectedPayoff":"The payoff DC reads the favor var and the job-done flag; faction forces appear in combat only once the job is done.","examplePrompt":"\"Add a thieves’ guild the player can do a job for, then call in a favor later.\"","exampleOutputShape":"1 favor var + 1 flag + 2–3 beats (job → optional combat ally → favor-aware payoff)."},{"id":"civilian","name":"Civilian Consequence","purpose":"A bystander moral choice the world remembers: help or exploit, and a later beat reflects it.","whenToUse":"You want a low-cost choice that proves the world reacts — cheap reactivity that seeds the \"choices matter\" feel.","requiredAnchors":["choiceSceneId (the help-or-exploit moment — a choice)","payoffSceneId (where the outcome shows — any prose beat)"],"optionalParams":["civilianName","createMissingStubs"],"generatedState":["an outcome var set to \"helped\" or \"harmed\" at the choice, read in conditional prose at the payoff"],"expectedPayoff":"The payoff prose changes on the outcome var (via {{ }} binding) — a remembered consequence, not a dead flag.","examplePrompt":"\"Let the player help or rob a refugee, and have it come back later.\"","exampleOutputShape":"1 outcome var + 2 beats (binary choice → conditional-prose payoff)."},{"id":"ending-callback","name":"Ending Callback (Montage)","purpose":"An epilogue montage: each thread the player resolved appends its own line to the ending.","whenToUse":"You have several setups (companions, factions, civilians) and want the ending to pay them ALL back in one montage.","requiredAnchors":["endingId (which ending carries the montage — defaults to the first ending)"],"optionalParams":["threads: [{ flagId, label }] (the setups to call back)","createMissingStubs"],"generatedState":["reads existing thread flags — declares none of its own (it is the payoff layer)"],"expectedPayoff":"Each thread flag conditionally appends a montage line to the ending body — the structural home for \"every setup pays off\".","examplePrompt":"\"At the end, show what happened to each companion and faction based on my choices.\"","exampleOutputShape":"Conditional prose lines appended to one ending, one per thread flag (no new schema)."}],"modules":[{"id":"store","name":"Shop / Merchant","purpose":"A full buy/sell/haggle/steal shop with a merchant purse, per-item stock, and a buy-back ledger.","whenToUse":"The party needs a place to spend/earn coin with real economy (finite merchant funds, price negotiation).","requiredAnchors":["a callScene entry from a hub/town beat"],"optionalParams":["merchant name","items[]","merchantGp (finite purse)","haggle","steal","discountPct/bestDiscountPct","exitTo"],"generatedState":["prefix-namespaced stock + buy-back + friendly-price vars (auto-scoped module-local)"],"expectedPayoff":"Coin becomes a real resource — the economy metric (currency_flow) reflects it; pairs with quest rewards + crafting.","examplePrompt":"\"Add a general store in town where you can buy gear, sell loot, and haggle.\"","exampleOutputShape":"A shop dialogue sub-scene (callScene/returnScene) + stock/purse vars + a module contract."},{"id":"quest-board","name":"Quest Board","purpose":"A board of postings that activate objectives (quest-log entries) with optional gated, rewarded turn-ins + chains.","whenToUse":"You want to hand the player optional quests with prerequisites and structured completion.","requiredAnchors":["a callScene entry from a hub/town beat"],"optionalParams":["board name","postings[] (each: objective, title, requires, turnInRequires, reward)","exitTo"],"generatedState":["one objective var per posting (hidden→active→done) — the quest log"],"expectedPayoff":"Objectives are optional-quest optionality the World model + health read; turn-ins grant real rewards.","examplePrompt":"\"Put a bounty board in the tavern with three side quests, one that needs proof to turn in.\"","exampleOutputShape":"A board sub-scene + N objective vars + gated take/turn-in choices + a module contract."},{"id":"crafting-station","name":"Crafting Station","purpose":"A forge/bench that offers recipes from deps.recipes, gating each on ingredient availability, firing craftItem.","whenToUse":"You want crafting: consume materials → produce an item, with honest \"you lack X\" locks.","requiredAnchors":["a callScene entry","recipes declared in deps.recipes"],"optionalParams":["station name","recipeIds[]","exitTo"],"generatedState":["no new vars — reads the bag; fires craftItem (consume → grant)"],"expectedPayoff":"Ties the economy loop together (store buys materials → craft → use); lint flags unobtainable ingredients.","examplePrompt":"\"Add a smithy where you can forge a silver sword if you have silver and a blade.\"","exampleOutputShape":"A forge sub-scene + one gated choice per recipe + a module contract."},{"id":"region","name":"Explorable Region (Dungeon / Woods)","purpose":"An explore hub: a weighted table rolls a random encounter (combat that loops back), a find (loot/clue), or nothing, with an anti-grind depth cap.","whenToUse":"You want a replayable explorable area (a crypt, a forest) rather than a fixed corridor.","requiredAnchors":["a callScene entry from the map/travel beat"],"optionalParams":["name","flavor","encounters[] (weighted stat blocks)","finds[] (weighted loot/clue)","nothingWeight","softCap (explores before exhaustion)","kind: dungeon|woods (re-skins labels)"],"generatedState":["a prefix-namespaced depth counter with a soft cap"],"expectedPayoff":"Non-linear optional content the reachability/never-visited metrics reward; encounters reuse deps.statBlocks.","examplePrompt":"\"Make the Sunken Crypt explorable with random undead fights and loot, that eventually empties out.\"","exampleOutputShape":"An explore hub sub-scene + rollTable encounters/finds + a depth counter + a module contract. (woods = same scaffold, forest skin.)"}],"note":"The closed authoring vocabulary, derived from the single-source catalog. Default-deny: any verb not in `actions` is rejected by the validator and cannot execute. `wizardPatterns` + `modules` are reusable recipes you can build from their contracts (purpose/whenToUse/requiredAnchors/generatedState/expectedPayoff) — prefer a recipe over hand-composing primitives when one fits. This is the grounding surface for AI authoring (so a model cannot invent a verb)."}