Claude Code context management: when to /clear and when to /compact
I'll pull the source article so the paragraphs stay factual and match the title and HN summary you gave.Tim Schipper’s guide on Claude Code context…
By Dillip Chowdary • Aug 07, 2026 • Source: HN Claude/Codex/Fable
I'll pull the source article so the paragraphs stay factual and match the title and HN summary you gave.Tim Schipper’s guide on Claude Code context management argues that session quality decays long before the free-space meter looks empty. Running /context can still show a large free window while answers and code edits get worse than they were earlier the same day. The piece frames /clear versus /compact as a deliberate hygiene choice, not something to leave to auto-compact when the window is nearly full.
The technical case rests on context-rot research and agent coding studies. Chroma’s work across 18 frontier models found reliability drops as input grows, even on simple recall; LongMemEval showed a large gap between answering from a focused ~300-token prompt and the same fact buried in a ~113k-token conversation. NoLiMa reported that of 13 models advertising at least 128k context, 11 fell below half their short-context baseline at 32k tokens—for example GPT-4o from 99.3% to 69.7%. Anthropic’s attention-budget framing (n tokens imply n² pairwise relationships) matches the advice to keep only high-signal tokens. On agent code, SlopCodeBench (arXiv 2603.24755) had agents extend their own prior work across 93 checkpoints with evolving specs: no agent solved a problem end to end, best checkpoint solve rate was 17.2%, final strict solve rates fell to 0.5%, cost grew 2.9× without correctness gains, structural erosion rose in 80% of trajectories, and verbosity rose in 89.8%. Quality-aware prompting improved the start (e.g. 34.5% less initial verbosity on GPT-5.4) but the decline slope stayed the same—session length remained the lever.
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
For builders, the free-space line on /context is the wrong sole health signal. Claude Code 2.1.220 breaks the window into system prompt, tools, MCP, agents, memory, messages, free space, and an Autocompact buffer reserved so the model can still write a self-summary. Usable context is smaller than the advertised window. /compact is a model summarizing itself into a fixed eight-section brief (intent, concepts, files/code, errors, problem-solving, user messages, pending tasks, current work); anything not nominated is dropped, security instructions can evaporate unless preserved, and the resumption prompt hides the seam so you may not notice loss.
Market and product context makes the tension sharper. Vendors ship large windows (including million-token marketing) while guidance still favors the smallest high-signal set. A separate March 2026 result that coding agents beat prior long-context SOTA by 17.3% on huge corpora did so by keeping bulk on disk and tools on a working set—not by stuffing the chat window. That aligns with treating the filesystem and CLAUDE.md as durable memory, not the transcript.
Practical rule from the post: clear early, compact rarely, write the brief yourself. After an unrelated task, /clear and start a fresh brief. When the same task is filling with tool noise, /compact while you still have headroom—not when “% until auto-compact” is in single digits and the session is already past the ~32k reliability cliff. If the model keeps a wrong assumption, /clear; a summary will often carry the error forward. Prefer a two-minute hand-written brief and CLAUDE.md conventions over auto-generated memory you cannot audit. Parallel work belongs in git worktrees for file isolation, not one ever-growing session.
Advertisement