fix(persist): per-round delta text in XML tool mode, not the cumulative preamble - #107
Merged
Conversation
…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>
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The XML-mode fallback persisted
event.context.preambleper 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