The pages this wiki holds on agents and their context share one premise: that the context available to a language model during inference is a finite resource with diminishing marginal returns, rather than a container to be filled. This page is a way into that group — where the area starts, why the constraint is held to exist, what fills the window, what is done within a session and across sessions when a task outruns it, and where the accounts it rests on come from.
Where the area starts
Context engineering is the entry point. It names the practice of curating and dynamically managing what information occupies a model’s context window during inference, and it is the page that gathers the differing accounts of the practice side by side — including how each positions it against Prompt engineering: as its natural progression, as fundamentally different from it, or as containing it as a subset. Its “When It Applies” section states the premise this area rests on: the practice assumes context is a finite resource with diminishing marginal returns, grounded in context rot and the attention-budget framing rather than in any particular window size.
Why the window is treated as scarce
The case for the constraint is carried by an empirical page and an explanatory one.
- Context rot is the empirical side: a model’s ability to recall information from its context declines as the number of tokens grows. Anthropic attributes the concept to needle-in-a-haystack style benchmarking and describes the effect as a performance gradient rather than a hard cliff.
- Attention budget is the explanatory side: Anthropic’s framing of attention as a finite pool that every additional token depletes, which it traces to the pairwise relationships transformer attention creates between tokens, to training distributions in which shorter sequences are more common, and to the accuracy cost of techniques for extending context length.
Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering adds a second reason alongside uneven attention: context is ephemeral, so unless state is externalized elsewhere, every new session begins with partial amnesia. Long-running Agent names finite context, no persistent state and no self-verification together as the obstacles that stop ordinary agent designs working over hours or days.
Larger windows as an answer
Several pages record the position that a larger window does not remove the problem, each on its own grounds. Context rot and Context engineering carry Anthropic’s argument that windows of all sizes remain subject to context pollution and information-relevance concerns. Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering argues that expanding windows does not dissolve the underlying tension, citing the “lost in the middle” finding. Long-running Agent notes that even a large window fills, and that context rot degrades performance before the hard limit is reached. In 什么是「驾驭工程」(Harness Engineering)?, the author argues that a larger window would not have fixed a drifting slide deck, because the problem lay in how the task was organized. Token Caching adds a cost angle: a very large window is not free even at the same per-token price, because the cost of a cache miss scales with context length.
What fills the window
A group of pages is about what occupies context before or alongside the work itself.
- Standing instructions. AI IDE Rules and the study behind it, Rule Taxonomy and Evolution in AI IDEs: A Mining and Survey Study, recommend not spending limited context window on formatting and syntax that linters enforce more reliably, and report compliance with a rule declining after the commit that introduces it, which the study attributes partly to growing context-window complexity. Claude Code records Anthropic’s advice to keep CLAUDE.md brief, warning that a bloated file causes actual instructions to be ignored.
- Capabilities loaded on demand. Agent Skills describes Progressive Disclosure: a skill’s metadata is always loaded, its body when triggered, and bundled resources only when read, and bundled scripts run so that only their output enters context. 什么是「驾驭工程」(Harness Engineering)? reports its author measuring how much context each accumulated skill takes when loaded — context consumed before any work begins. Dive into Claude Code: The Design Space of Today’s and Future AI Agent Systems orders Claude Code’s extension mechanisms by what they cost in context.
- Tool and test output. Building a C compiler with a team of parallel Claudes designed its test output around context window pollution: print a few lines, log the rest to files, and put each error and its reason on one line for grep.
Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering, relayed on Harness Engineering, treats this competition as a harness-level coordination problem: memory retrieval, skill loading, protocol schemas, tool descriptions and the model’s own reasoning traces all draw on the same finite allocation, and the right split depends on the phase of execution.
What is done within a session
Anthropic’s post, Effective context engineering for AI agents, organises its responses to the constraint around a guiding principle — find the smallest possible set of high-signal tokens — applied to system prompts, tools and examples. It then turns to retrieval, describing a move toward Just-in-time context retrieval, and to three techniques for tasks that outrun the window: Compaction, Structured note-taking and Sub-agent architecture, each suited to a different task shape.
Lance Martin’s Context Engineering for Agents and LangChain’s Context Engineering group the strategies seen across popular agents into four buckets — write, select, compress and isolate — starting from the framing of the model as a CPU and its context window as RAM. The LangChain post additionally maps each bucket to features of its own LangGraph, which that page marks as vendor guidance.
Two pages describe one production agent’s handling of context from different angles. Claude Code records the documented behaviour — older tool outputs cleared first and the conversation summarised if needed, with /clear and /compact as session controls. Dive into Claude Code: The Design Space of Today’s and Future AI Agent Systems reads the source code and identifies the context window as the binding resource constraint, managed by a sequence of shapers that run before every model call and escalate only when cheaper strategies prove insufficient.
Isolation recurs as its own response. Dive into Claude Code: The Design Space of Today’s and Future AI Agent Systems describes subagents running in isolated context windows and returning only summary text to the parent. 什么是「驾驭工程」(Harness Engineering)? reports giving each unit of work to an independent agent with the full design rules, and states the author’s resulting view that an agent’s core value is context isolation rather than parallelism.
Context as a Tool (CAT) takes a different route: it makes context maintenance a callable tool within the agent’s own decision-making, so that the agent compresses its history at milestones rather than relying on append-only context or passively triggered compression.
What is done across sessions
Where a task runs longer than one window can hold, the pages describe moving state out of the window and starting fresh.
- Long-running Agent records Anthropic’s account that what a fresh context window needs most is a fast way to understand the state of the work, supplied by a progress file alongside the git history.
- Ralph Loop resets the agent’s context at every iteration of a pick–implement–validate–commit cycle, carrying state across resets on the filesystem instead of in the window.
- Building a C compiler with a team of parallel Claudes had each agent start in a fresh container with no context, and instructed the agents to maintain extensive READMEs and progress files.
- Externalization frames memory as externalizing state across time, rather than treating the context window as the sole carrier of history.
- DeepCode: Open Agentic Coding frames its whole problem as information overload against a finite context window, and compares a stateful summary-based memory of generated files against a naive sliding-window eviction baseline that lost foundational definitions to truncation.
Where the accounts come from
Most of what this area records is practitioners describing their own practice rather than measuring it. Context engineering states that none of its accounts is an independent evaluation. Effective context engineering for AI agents is written by Anthropic’s Applied AI team from its own engineering experience, and presents itself as a mental model rather than a set of benchmarks. The two write–select–compress–isolate posts present their buckets as a grouping of patterns already in use. 什么是「驾驭工程」(Harness Engineering)? and Building a C compiler with a team of parallel Claudes are first-hand accounts, and Ralph Loop’s reported limits come from Geoffrey Huntley’s own experience with the technique.
Measured results appear in a few places, each with its own scope: Context as a Tool (CAT) and DeepCode: Open Agentic Coding each report a single paper’s benchmark results, and Rule Taxonomy and Evolution in AI IDEs: A Mining and Survey Study is a mixed-methods study of rule files. Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering is a synthesis rather than a measured result, and Dive into Claude Code: The Design Space of Today’s and Future AI Agent Systems reads one static snapshot of source code, grading its own claims by evidence tier.
Related pages
Context poisoning, Context confusion, Tool Call Offloading, Context Reset, Initializer Agent, Agent Harness