How Claude Code's agentic loop fills your context window
Claude Code runs a gather→act→verify loop that fills context before you type. Compaction, /clear, and subagents are the official levers for what sticks.
Curating what enters the context window each turn - the discipline that keeps agents reliable as windows grow: lean CLAUDE.md, compaction, subagents.
Claude Code runs a gather→act→verify loop that fills context before you type. Compaction, /clear, and subagents are the official levers for what sticks.
Claude Code runs up to a 1M-token window, but a bigger window doesn't fix a cluttered one - every turn replays history and quality drops before the cap.
A bloated CLAUDE.md gets filtered out as noise. Keep it to universal instructions and move everything else behind progressive disclosure.
Managing what a coding agent keeps in context - not window size - cut agent cost over 50% on SWE-bench Verified with no solve-rate drop, per JetBrains.
A minimal Claude Code harness in ten files: a lean CLAUDE.md, a definition-of-done loop, read-only subagents, and credential deny rules. One npx install.
On the adversarial task its line-36 rule existed to prevent, a 129-instruction CLAUDE.md gave the same one-word reply as a harness with no instructions.
A rule in Claude Code's auto memory held 3/3 runs until the user contradicted it, then failed 0/3 - the same score the identical rule got in CLAUDE.md.
I ran claude plugin eval on obra/superpowers vs no plugin: it changed how Claude worked on 3 of 7 tasks, improved the result on 1, and cost 1.33x per task.
Anthropic's 5.5 guides name four prompt habits that now backfire. /doctor prompt-audit found none in my repo - it found subagents for another workspace.