fix(claude-code): filter injected harness turns from retention - #3024
Closed
runbgp wants to merge 1 commit into
Closed
fix(claude-code): filter injected harness turns from retention#3024runbgp wants to merge 1 commit into
runbgp wants to merge 1 commit into
Conversation
Claude Code records an invoked skill's full SKILL.md as a user message and injects <system-reminder>/<task-notification> blocks into user turns. Both were retained verbatim, storing harness output as if the user had written it and producing very large retain payloads. Mirrors the Codex fix in vectorize-io#1346.
Collaborator
|
Closing: superseded by Coding Agents, which handles this class structurally — and your report is part of why it now handles it properly. Measured against 400 real transcripts there: skill bodies arrive with
|
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.
Fixes #3023.
Claude Code records an invoked skill's full
SKILL.mdas an ordinary user message, and injects<system-reminder>/<task-notification>blocks into user turns. Both were retained verbatim. On my transcripts that was ~50% of everything sent to extraction, and one skill invocation alone was a single 566 KB user message.Same shape as the Codex fix in #1346:
is_synthetic_user_message()— skips user turns starting withBase directory for this skill:, applied once inprepare_retention_transcript()so it covers both the text and JSON formats.strip_harness_blocks()— removes the two block types, alongside the existingstrip_memory_tags()call on the retain path.Recall query composition is left alone; this only touches retention.
Tests added for both functions and for the retention path.
uv run pytest testspasses (213). No new ruff findings — the two pre-existingF541s insetup_hooks.pyand the import-sort intest_content.pyare untouched.