What context is
What fills an agent’s context window in Claude Code, instructions, messages, tool output, and why it is a shared budget, not infinite memory.
In Claude Code, context is everything the model can see on this turn: system instructions, CLAUDE.md and loaded rules, your messages, tool results (file reads, grep, terminal output, subagent summaries), and sometimes compacted history from earlier in the same session.
It is not a database. The model does not “store” your repo in its head; it gets tokens representing text you and the tools put in front of it. When the budget is tight, quality drops, missed details, wrong file chosen, repeated questions, before anything literally “breaks.”
What usually consumes context
- Always-on instructions: project memory, rules, skills injected for this turn.
- Your prompts: including pasted logs and long explanations.
- Attachments:
@files, folders, selections, terminal buffers (see References with@). - Tool output: full file contents, search hits, command stdout. A single huge read can dominate the window.
- Prior turns: unless summarized or dropped, earlier chat stays in the thread.
Why this matters for the workshop
Every pattern you learn, skills instead of pasting novels, @ precise paths, markdown plans in the repo, subagents for side exploration, exists partly to keep the useful signal inside a finite budget.
Subtopics in this section
Context size and limits
Rough scale, 1M windows, cost intuition, and the fill-the-window trap.
Context placement and retrieval
How position can affect long-context retrieval.
Cleaning and compacting
/compact, /clear, and habits that free space without losing the thread.