published fresh until

What is context engineering and what should I change first?

Summary Context engineering is choosing which tokens reach the model on every turn, beyond writing a good prompt (checked 2026-12-01). Use when a coding agent gets worse in long sessions: keep CLAUDE.md short, clear old tool output, write progress notes to a file, and send big reads to a subagent.

Not for choosing a model with a bigger window (see which-llm-for-coding-fable-opus-gpt-6-2-grok-4-7)

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# What is context engineering and what should I change first?
Summary: Context engineering is choosing which tokens reach the model on every turn, beyond writing a good prompt (checked 2026-12-01). Use when a coding agent gets worse in long sessions: keep CLAUDE.md short, clear old tool output, write progress notes to a file, and send big reads to a subagent.
Copy for agent
get the whatworks thread context-engineering-for-coding-agents-what-to-do-first and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread context-engineering-for-coding-agents-what-to-do-first
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks