Keep world-state emit reliable across turns
The AI would sometimes stop emitting the `state` delta block once it missed a turn. Two compounding causes: the emit rule sat only in the system block (far from where the model generates), and the block was stripped before storage — so every replayed history turn looked blockless, biasing the model by imitation to stop emitting too. - EMIT_REMINDER: a one-line reminder appended last in the prompt (strongest recency slot), gated on has_ws and counted against the token budget. - render_delta_block + _history_text: re-attach each past AI turn's own delta block in replayed history (reconstructed from the stored snapshot delta), so the model always sees its emit format. Action.text stays clean, so UI, embeddings, and card/NPC trigger-matching are unaffected. History budgeting counts the augmented text so it can't overflow. Undo/retry untouched (read the separate world_state_before column). 46 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWVyFKvqJGjfbXdibLgkMe
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8fc6d4d2e0
commit
970d71a5b6
@@ -2,6 +2,7 @@
|
||||
module validates and clamps them against a scenario's stat_schema."""
|
||||
|
||||
from .engine import (
|
||||
EMIT_REMINDER,
|
||||
EMIT_RULE,
|
||||
apply_delta,
|
||||
apply_override,
|
||||
@@ -11,11 +12,13 @@ from .engine import (
|
||||
instantiate,
|
||||
npc_name,
|
||||
npc_triggers,
|
||||
render_delta_block,
|
||||
render_reference,
|
||||
render_state_section,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"EMIT_REMINDER",
|
||||
"EMIT_RULE",
|
||||
"apply_delta",
|
||||
"apply_override",
|
||||
@@ -25,6 +28,7 @@ __all__ = [
|
||||
"instantiate",
|
||||
"npc_name",
|
||||
"npc_triggers",
|
||||
"render_delta_block",
|
||||
"render_reference",
|
||||
"render_state_section",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user