refactor(kernel): restrict tape-anchor to topic-switch only (#1355)#1356
Merged
refactor(kernel): restrict tape-anchor to topic-switch only (#1355)#1356
Conversation
Remove code paths that pushed the LLM to anchor on large tool outputs, conflating anchor (topic boundary marker) with context compression (auto-fold's job). GPT models were especially susceptible, destroying context and KV cache with excessive anchoring. Removed: - `should_remind_tape_anchor` function + LARGE/MEDIUM_TOOL_RESULT_CHARS constants - `did_create_anchor` (dead code, never called in production) - `needs_anchor_reminder` variable and dynamic injection block - 4 associated tests Changed: - context_contract now frames anchor as topic-switch checkpoint only Closes #1355
69d1880 to
356e5ad
Compare
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.
Summary
should_remind_tape_anchor+ constants that injected anchor reminders on large tool outputs — large output ≠ topic switchdid_create_anchor(dead code, never called in production)needs_anchor_remindervariable and dynamic injection blockcontext_contractto frame anchor as topic-boundary checkpoint only, not a compression toolType of change
refactorComponent
coreCloses
Closes #1355
Test plan
cargo check -p rara-kernelpassescargo test -p rara-kernel— 397 tests pass, 0 failurescargo clippycleancargo +nightly fmtclean🤖 Generated with Claude Code