Context engineering guides

Context engineering is the practice of controlling what an AI agent loads into its context window: instruction files, skills, history, tool output.

All context engineering guides

It decides both halves of agent work that matter — output quality and cost — because a model can only reason over what is in the window, and you pay for everything in the window on every request. This page collects the budgets, audits and file-design guides that make that control deliberate.

Start with a context budget audit

You cannot budget what you have not measured. The context budget audit walks a real setup and prices every always-loaded element — a large CLAUDE.md can run to roughly 2,500 tokens per request, while a skill description costs around 33 tokens until the skill fires — so the waste shows up as arithmetic, not vibes. Run it once and most builders find the same three leaks: instructions duplicated across CLAUDE.md and AGENTS.md, task procedures stored as always-on rules instead of skills, and sessions kept alive long past the point where their history helps. The free context-budget worksheet turns the audit into a sheet you rerun monthly.

CLAUDE.md and instruction files

CLAUDE.md and AGENTS.md look like documentation and behave like configuration. The guides here treat them that way: what belongs in the always-loaded layer (facts, commands, hard rules), what belongs in skills (procedures for specific jobs), what belongs in subagent briefs (one task, one context), and what belongs nowhere near the window (history the agent can re-derive from the repo). Teams get their own layer — nested files, personal overrides, shared conventions — because a file that works for one builder becomes a tax on five. The Claude Code page applies all of this inside one tool; this page keeps the principles portable.

Context management for long projects

A weekend project forgives sloppy context. A three-month build does not: memory patterns decide what survives between sessions, handoff summaries decide whether a fresh agent continues or restarts, and debugging agent loops — the same wrong fix attempted five times — is usually a context failure wearing a model failure's clothes. The long-projects guide sequences budgets, compaction and handoffs into one operating pattern, and the memory-patterns piece separates what should persist (decisions, constraints, state) from what should be re-read fresh (code, data, anything that changes).