What this thread does
Do first: open a fresh session, run your usual task, and note what already sits in context before you type (instructions, memory, tool names, skill descriptions). Cut what the task does not need, then add notes and subagents only if the session still degrades.
Facts are from Anthropic's engineering post on context engineering and the Claude Code context-window docs, read 2026-12-01.
What it means
Anthropic defines context engineering as the strategies for "curating and maintaining the optimal set of tokens" during inference, including information outside the prompt; prompt engineering is the narrower job of writing instructions [Anthropic post][ap]. It matters because accuracy of recall drops as the context grows ("context rot"), so context is a finite resource [Anthropic post][ap].
Steps for a coding agent
1. Shrink what loads first. In Claude Code, CLAUDE.md, auto memory, MCP tool names and skill descriptions load before you type [context docs][cw]. Trim them to what every session needs; Anthropic warns that bloated tool sets with overlapping functions confuse the agent [Anthropic post][ap]. 2. Let the agent fetch files when needed. Anthropic describes keeping lightweight references (paths, queries) and loading data at runtime with tools; Claude Code mixes both: CLAUDE.md up front, glob and grep just in time [Anthropic post][ap]. 3. Compact deliberately. /compact replaces the conversation with a structured summary; the docs list what survives (project CLAUDE.md, auto memory, skill descriptions) and what reloads on demand (nested CLAUDE.md, path-scoped rules) [context docs][cw]. Anthropic notes that over-aggressive compaction can lose context whose importance appears later [Anthropic post][ap]. 4. Write notes outside the window. Anthropic's example is a NOTES.md or to-do list the agent rereads after a reset [Anthropic post][ap]. 5. Send big reads to a subagent. In the docs' example the subagent's research used about 9,890 tokens in its own window while only a 420-token summary came back to the main session; the counts are illustrative [context docs][cw].
When to pick which
- Long back-and-forth chat: compaction. Milestone-driven work: notes. Wide research: subagents. This is Anthropic's own split [Anthropic post][ap].
What people report
- A user on r/PromptEngineering wrote "Context rot: why your AI gets worse after 200 messages (and a 5-line fix)" ([post][r1], u/sonyaromashka). Single report.
Limits
- 0 trials: WhatWorks has not tested these steps.
- Both sources describe Anthropic's tools; other agents expose different commands.
[ap]: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents [cw]: https://code.claude.com/docs/en/context-window.md [r1]: https://www.reddit.com/r/PromptEngineering/comments/1y139rq/context_rot_why_your_ai_gets_worse_after_200/
Started from a post by @Anthropic, packaged by the editor. Original post