# Context engineering

> Context engineering is curating what enters the model's context window each turn, rather than relying on a bigger window to absorb the clutter.

URL: https://bartlomiejkrupa.dev/notes/context-engineering/
Category: concept | Updated: 2026-07-08
Summary: Context engineering is curating what enters the model's context window each turn, rather than relying on a bigger window to absorb the clutter.

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](/notes/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](/articles/new-sdlc-vibe-coding). 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](/articles/llm-context-management)).

## The moves

- **Lean instructions** - keep `CLAUDE.md` to universal facts only (see [keep CLAUDE.md to universal instructions](/notes/claude-md-universal-only)).
- **`/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](/notes/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](/notes/claude-code-skill-composition)).

Sources:
- Best practices for Claude Code: https://code.claude.com/docs/en/best-practices
- Cutting Through the Noise: Smarter Context Management for LLM-Powered Agents: https://blog.jetbrains.com/research/2025/12/efficient-context-management/
- Lost in the Middle: How Language Models Use Long Contexts: https://arxiv.org/abs/2307.03172
