Replies: 3 comments 5 replies
-
|
I also do this with a smaller model, a subagent if you will, that has its own context window. |
Beta Was this translation helpful? Give feedback.
-
|
I think this is a good chance to think about what should happen in #33. What do you think about e.g. simply prompting the user after some buffer (e.g. 1k tokens) "Hey your session is close to the limit please restart". For the summarization; since I have seen it multiple times now I am looking into it but I really do not want to make it invisible as it degrades reasoning and speed. It should always be explicitly done by the user. we could say "Hey your session is close to the limit please restart. If you want to continue with this context please use "Summarize"" or something similar. |
Beta Was this translation helpful? Give feedback.
-
Context Lifecycle Management: A Tiered Architecture for Local LLMsGoal: Maintain high-signal code context while preserving the ability to "zoom in" on specific symbols without exceeding the model's context window (n_ctx). 1. Structured Skeleton PackOn each turn, construct a compact context pack with four immutable sections.
Why this works: The model retains the architectural "big picture" and interface definitions, but only consumes tokens for function bodies where reasoning is actively required. 2. Expansion as a First-Class OperationExpansion must be an explicit tool call/request type, not an ad-hoc dumping of file contents. Expansion API Shape
3. Task-Local Expansion CacheTreat expanded content as working memory that is cached per task.
4. Utility-Based Re-SkeletonizationWhen the context budget crosses a threshold, compress older expansions back into skeleton form using a utility score rather than simple FIFO. Utility Score Formula: Eviction Order (Low Utility First):
Never Evict: Objective Pin, Active TODO checklist, Current Error, or the rationale for the last accepted code change. 5. The Fact Ledger (Anti-Drift)To prevent "semantic drift" during summarization, maintain a Fact Ledger.
6. Expansion HeuristicsExpand Immediately When:
Delay Expansion When:
7. Configuration ThresholdsSuggested defaults for managing the token budget:
8. Success MetricsTrack these KPIs to validate the architecture:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So I do this in my local agents and tools I've made.
In the config, I sent the context size.
CONTEXT=256K
then at 80%, I force the agent to summarize what has been done.
Then with llama.cpp you can order it to flush the context.
Then have the agent, reread where it was at in the summarization prompt and resume.
Beta Was this translation helpful? Give feedback.
All reactions