Three Context Tactics
Compaction, structured notes, sub-Agent architecture — three context management strategies for long tasks
THE QUESTION THIS PAGE ANSWERS
ANSWER FIRSTWhat is the key idea behind “Three Context Tactics”?
Compaction, structured notes, sub-Agent architecture — three context management strategies for long tasks
Make the claim earn its place. Use this page as a decision aid, not a definition to memorize. Connect the idea to one real task, one observable result, and one failure that would change your mind.
Write one question you could answer with evidence after trying this idea.
A conclusion that sounds complete but leaves the key assumption untested.
Option A: Start a new window — but the new window remembers nothing and the Agent repeats work already done.
Option B: Continue in the old window — but as Tokens accumulate, the model's attention is diluted and performance degrades.
This is not a theoretical problem. Claude Code, Cursor, and Devin face this every day in production.
- The Key Decision: What to keep and what to discard. This is an information-theory problem — not all Tokens are equal, and some information is irrecoverable once lost.
- Low-Risk Operations: Pruning old tool call results (e.g., file listings, search outputs) — these generally don't affect downstream reasoning.
- High-Risk Operations: Discarding the reasoning behind architectural decisions or unsolved bug descriptions — if dropped, the Agent will repeat past mistakes.
- Claude Code in Practice: Retains architectural decisions and unresolved bug information; discards redundant file content output and intermediate steps of completed tasks.
- Core Idea: Externalize short-term memory (context window) into long-term memory (file system), enabling information continuity across windows.
- Claude Code in Practice: Maintains a TODO list file, updating it after each step — so even if the context is compressed or reset, opening TODO immediately shows progress.
- Claude Plays Pokémon Case Study: The Agent maintained a game notes file recording map position, collected items, and next steps. Each new conversation began by reading this file to resume memory.
- Key Design Principle: Note format must be fixed and structured — free-form prose requires extra Tokens to interpret when read back.
- Core Value: Separation of concerns + context isolation. A sub-agent's working drafts don't pollute the orchestrator's context.
- Token Economics: A sub-agent may internally consume 30,000 Tokens reading code, analyzing dependencies, and reasoning — but reports only 1,500 Tokens of conclusions upstream. The orchestrator's context stays lean.
- Parallelism Advantage: Multiple sub-agents can work simultaneously, each exploring a different direction, with the orchestrator synthesizing results. This is far faster than a single Agent exploring serially.
- Real-world Examples: Cursor's background agent and Claude Code's Task tool are both implementations of sub-agent architecture.
- CLAUDE.md / Rules files loaded directly
- User preferences, project configuration
- Frequently used context information
- Pro: Immediately available, no extra calls
- Con: Consumes Tokens every time, whether needed or not
- Use glob/grep to search files on demand
- Use RAG to retrieve relevant documents
- Call APIs for real-time data
- Pro: Context stays lean, only contains what's needed now
- Con: Adds one tool-call round-trip of latency
Analogous to browser caching: hot data in memory cache (preload), cold data fetched from disk or network (JIT). The goal is to maximize context hit rate — most information needed for reasoning is already in the window, with dynamic fetching reserved for occasional needs.
| Strategy | Core Idea | Best For | Examples |
|---|---|---|---|
| Compaction | Compress old context, retain critical info and continue | Continuous long sessions without interruption | Claude Code auto-compact |
| Note-taking | Actively write notes externally, read back across windows | Tasks that may be interrupted or span multiple sessions | Claude Code TODO, Cursor Rules |
| Sub-agent | Sub-agent explores deeply, returns only a summary | Deep exploration without polluting the orchestrator's context | Cursor Task, Claude Code spawn |
Why “The Core Challenge” can find relevant content
“Compaction, structured notes, sub-Agent architecture — three context management strategies for long tasks” moves retrieval beyond storing material: the real question is how to find what is relevant. That decision shapes the input quality of RAG, recommendation, and image-search systems.
Similarity is not the answer
In the flow described by “Compaction, structured notes, sub-Agent architecture — three context management strategies for long tasks”, embeddings place items in a comparable semantic space and a neighbor index narrows the search. The final answer still depends on whether the retrieved chunks cover the question, whether the distance metric fits, and whether the evidence is current.
- The Key Decision: What to keep and what to discard. This is an information-theory problem — not all Tokens are equal, and some information is irrecoverable once lost
- Low-Risk Operations: Pruning old tool call results (e.g., file listings, search outputs) — these generally don't affect downstream reasoning
- High-Risk Operations: Discarding the reasoning behind architectural decisions or unsolved bug descriptions — if dropped, the Agent will repeat past mistakes
Separate findable from relevant
Turn “Compaction, structured notes, sub-Agent architecture — three context management strategies for long tasks” into a small test: prepare queries with known answers, record relevance, misses, and distractors, then decide whether chunking, the index, or reranking needs to change.
From “The Core Challenge” to “Strategy 1”
“The Core Challenge” grounds the problem in “The Amnesia Problem in Long Tasks A complex coding task may require the Agent to perform dozens of steps, generating tens of thousands of Tokens of conversation history. As the context window fills up, the syst…”. “Strategy 1” then moves it toward “1 Compaction Context Compression When the conversation is approaching the context window limit, make a single LLM call to summarize the existing conversation: retain critical information, discard redundant deta…”. Together, they show that the lesson is not just a conclusion to remember, but a claim with conditions.
Carry the judgment into the next situation
The same logic applies to retrieval: define what counts as relevant, check whether recall covers the question, and then inspect whether ranking, chunking, or freshness pushed useful evidence out.
- “The Core Challenge”: The Amnesia Problem in Long Tasks A complex coding task may require the Agent to perform dozens of steps, generating tens of thousands of Tokens of conversation history. As the context window fills up, the syst…
- “Strategy 1”: 1 Compaction Context Compression When the conversation is approaching the context window limit, make a single LLM call to summarize the existing conversation: retain critical information, discard redundant deta…
- “The closing point”: Core Idea: Externalize short-term memory (context window) into long-term memory (file system), enabling information continuity across windows
The final “The closing point” brings the discussion to “Core Idea: Externalize short-term memory (context window) into long-term memory (file system), enabling information continuity across windows”. The useful thing to carry forward is knowing which judgments must be revisited when input, scale, or risk changes.
I turned one judgment from this article into a small experiment I could run today. Knowing what to observe next is more useful than simply remembering the conclusion.
After reading this, I first looked for the conditions behind the idea instead of copying the method into a project. That order made the later trade-offs much clearer.
When this judgment reaches real work, which constraint should be added first? I am curious which step matters most between reading and the first practical attempt.
No discussion on this article yet.