Skip to content
NOTES
MenuClose
NOTES // concept

Context engineering

LAST_MODIFIED
2026.07.08
CATEGORY
concept

Context engineering is the practice of curating what enters a model’s context window each turn - instead of relying on a larger window to absorb clutter. Input quality drives output quality; a bigger window does not.

Why it matters

Every turn in an agent loop resends the full state: prior messages, model responses, tool results, file reads, and fetched docs - not just the latest prompt. Tokens accumulate, and answer quality degrades before the hard limit (see lost in the middle).

It is also a financial lever, not just a quality one: always-loaded static context is the expensive tier, on-demand dynamic context is the cheap one - the cost framing in vibe coding vs agentic engineering. The discipline holds model-agnostically, too: JetBrains Research measured the same payoff on SWE-bench Verified, cutting coding-agent cost over 50% (see prune the log, not the window).

The moves

  • Lean instructions - keep CLAUDE.md to universal facts only (see keep CLAUDE.md to universal instructions).
  • /compact - summarize the conversation; append an instruction for what to preserve.
  • /clear - reset to zero tokens when switching to unrelated work.
  • Plan outside, paste in - do exploratory back-and-forth elsewhere; inject only the final plan.
  • Subagents - push heavy reads into isolated context and return a summary (see subagent context isolation).
  • Skill composition - load only the skill stages the current task needs; each Skill-tool hop is more context (see Claude Code skill composition).
contextclaude-codetokens

Related_Notes