Wire context summarizer into hunter loop - #127
Merged
Merged
Conversation
whatever
marked this pull request as ready for review
August 4, 2026 19:40
Contributor
Author
|
can confirm that this still finds things at a lower cost: |
jorge-garcia-le
approved these changes
Aug 4, 2026
This was referenced Aug 5, 2026
whatever
force-pushed
the
context-shortener-node
branch
2 times, most recently
from
August 5, 2026 20:56
94a629f to
cac23a9
Compare
Wire ContextSummarizer into NativeHunter's step loop. All tool calls and tool results are kept verbatim through summarization; only plain assistant/user prose gets compressed by the LLM.
whatever
force-pushed
the
context-shortener-node
branch
from
August 5, 2026 21:03
cac23a9 to
d09e9fe
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
ContextSummarizerintoNativeHunter's step loop so deep hunts don't blow the context window[summary_ChatMessage, ...preserved_tool_msgs, ...recent_30%]Problem
The hunter's own
achatloop bypasses the agent runtime's summarization. Long hunts (~150k+ tokens) hit the context ceiling and fail. The existingContextSummarizerwas already in the codebase but wasn't wired into this path.Approach
Minimal — no new classes, no config objects. The summarizer now has one simple rule: if a message has
tool_callsor is atool_response, keep it. Everything else in the old 70% window gets LLM-summarized into a singleChatMessage("system", ...).Test plan
pytest tests/test_memory.py— 32/32 passing