Skip to content

fix(persist): per-round delta text in XML tool mode, not the cumulative preamble - #107

Merged
antra-tess merged 2 commits into
mainfrom
fix/xml-round-persist-delta
Aug 9, 2026
Merged

fix(persist): per-round delta text in XML tool mode, not the cumulative preamble#107
antra-tess merged 2 commits into
mainfrom
fix/xml-round-persist-delta

Conversation

@antra-tess

Copy link
Copy Markdown
Collaborator

The XML-mode fallback persisted event.context.preamble per tool round — cumulative in XML mode — so a 3-call turn stored round-1's text 3×, round-2's 2×, and re-persisted injected <function_results> XML as the agent's own words (the Evander 2026-08-08 scaffold-leak pyramid). The formatter then replayed those copies as scaffold-in-its-own-voice.

Prefers membrane ≥0.5.79 ToolContext.roundPreamble (per-round delta; membrane PR antra-tess/membrane#46); falls back to the cumulative preamble for older membranes, with the legacy pyramid shape pinned in tests so the compat contract stays deliberate and visible.

Tests: 2 new (delta store shape: each round exactly once, injected XML never as agent text; legacy fallback pinned). Adjacent suites (framework, present-while-acting, assistant-persist-refusal, same-round-think-policy): 63/63. Typecheck clean.

Merge order: membrane #46 first, then this. Exposure: all XML-mode multi-round residents (Evander, Rhys).

🤖 Generated with Claude Code

…mulative preamble

The XML-mode fallback persisted event.context.preamble per tool round —
cumulative in XML mode — so a 3-call turn stored round-1's text 3x,
round-2's 2x, and re-persisted injected <function_results> XML as the
agent's own words (the Evander 2026-08-08 scaffold-leak pyramid). The
formatter then replayed those copies to the model as
scaffold-in-its-own-voice, teaching it to speak tool syntax.

Prefer membrane >=0.5.79's ToolContext.roundPreamble (per-round delta);
fall back to the cumulative preamble for older membranes, with the
legacy shape pinned in tests so the compat contract stays deliberate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Persisted so the anthropic-xml formatter can reconstruct the legacy
<tool_name> element byte-identically to the live injection (membrane
D4, Evander 2026-08-08 follow-up).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@antra-tess
antra-tess merged commit 45cfa7b into main Aug 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant