Harden the state-emit rule to reduce under-reporting

Rewrite the global emit rule to be directive: treat narration as
authoritative and record numeric changes (damage, healing, time, emotion
shifts, fights intensifying), not just easy on/off flags — updating every
stat the scene affected. Also firm up the demo scenario's AI instructions
to reflect combat outcomes in the numbers each turn. Helps weaker free
models emit numeric deltas; the emit rule applies live so all RPG
adventures benefit immediately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parththakkar106
2026-07-21 16:52:20 +05:30
co-authored by Claude Opus 4.8
parent 279110f75b
commit 8c18541d4e
2 changed files with 13 additions and 9 deletions
@@ -4,7 +4,7 @@
"prompt": "Dawn breaks grey over the treeline as you and Gwen crouch at the edge of the bandit camp. Smoke curls from a dying fire; three bedrolls lie empty. Somewhere ahead, the stolen caravan strongbox waits.\n\nGwen checks her bowstring and looks to you. \"Quiet, or loud?\"", "prompt": "Dawn breaks grey over the treeline as you and Gwen crouch at the edge of the bandit camp. Smoke curls from a dying fire; three bedrolls lie empty. Somewhere ahead, the stolen caravan strongbox waits.\n\nGwen checks her bowstring and looks to you. \"Quiet, or loud?\"",
"memory": "The player and Gwen, a loyal ranger ally, are raiding a bandit camp to recover a stolen strongbox. The player is a capable adventurer. This is a dangerous but winnable encounter.", "memory": "The player and Gwen, a loyal ranger ally, are raiding a bandit camp to recover a stolen strongbox. The player is a capable adventurer. This is a dangerous but winnable encounter.",
"authors_note": "Keep it tense and consequential. Reckless moves should cost health; clever ones should pay off. Gwen reacts to how the player treats her.", "authors_note": "Keep it tense and consequential. Reckless moves should cost health; clever ones should pay off. Gwen reacts to how the player treats her.",
"ai_instructions": "Write in second person, present tense. End each reply where the player can act. Let the world state guide the fiction — if the player is badly hurt, show it.", "ai_instructions": "Write in second person, present tense. End each reply where the player can act. Let the world state guide the fiction — if the player is badly hurt, show it. In any fight, reflect the outcome in the numbers every turn: reduce the health of whoever is struck, raise the bandit leader's aggression as he is pressed, and adjust Gwen's trust based on how the player treats her.",
"tags": "demo, rpg, world-state, combat, short", "tags": "demo, rpg, world-state, combat, short",
"stat_schema": { "stat_schema": {
"world": { "world": {
+12 -8
View File
@@ -19,14 +19,18 @@ STAT_SECTIONS = ("world", "player")
# Appended once to the system prompt so the model knows how to report changes. # Appended once to the system prompt so the model knows how to report changes.
EMIT_RULE = ( EMIT_RULE = (
"After your narration, if and ONLY IF something in the world state changed this " "You maintain a numeric world state. Treat your own narration as authoritative: "
"turn, append a fenced code block labelled `state` containing a JSON object of " "whenever what you write implies a change — someone takes damage or heals, time "
"the CHANGES ONLY, as deltas (not new totals). Use paths like " "passes, an emotion or relationship shifts, a fight intensifies, an item is gained "
'"player.hp", "world.day", "npc.<id>.<stat>" (use the exact npc id shown in the ' "or lost, or an objective is completed — you MUST record it, including the numbers, "
'world state, e.g. npc.gwen.trust); "flags.<name>": true or false to toggle an ' "not just on/off flags. After your narration, append a fenced code block labelled "
'on/off state; and "milestones.<id>": true when an objective is completed. Send ' "`state` with a JSON object of the CHANGES ONLY, as deltas (not new totals). Update "
"only things that actually changed; never restate unchanged values. If nothing " "every stat the scene affected this turn, not only the easy ones. Use the paths "
"changed, omit the block entirely. Example:\n" 'exactly as shown in the world state: "player.hp", "world.day", "npc.<id>.<stat>" '
'(e.g. npc.gwen.trust — use the id in parentheses, not the display name); '
'"flags.<name>": true or false to toggle an on/off state; and "milestones.<id>": '
"true when an objective is completed. Send only things that actually changed and "
"never restate unchanged values; if truly nothing changed, omit the block. Example:\n"
'```state\n{"player.hp": -15, "npc.gwen.trust": 5, "milestones.escaped": true}\n```' '```state\n{"player.hp": -15, "npc.gwen.trust": 5, "milestones.escaped": true}\n```'
) )