Context windows and tokens
An agent only knows what's in its context window. Managing it is most of the skill.
What fills it
Each time the agent answers, it reads, in order: its own system prompt, your rules files, the list of skill names and descriptions, the tool lists of any MCP servers, the files it opened, the conversation so far, and your new message. All of it is counted in tokens, roughly three quarters of a word each.
The window is large (around 200,000 tokens in current tools) but not free. More tokens cost more, make answers slower, and bury the details that matter under ones that don't.
Keep it lean
- Mention the files that matter with
@path. An agent that has to search reads far more than it needs. - Keep rules short: they're loaded into every single conversation.
- Move long procedures into skills, which only load when used.
- Remove MCP servers you don't use. Each one adds its whole tool list to every session.
- Start a fresh session for a new task. The old conversation is noise for the new one.
When it fills up
Claude Code, Codex and Gemini CLI can summarise the conversation to free space (/compact). Summaries lose details, so a new session with a clear prompt is often the better reset. In Claude Code, /context shows what's taking room right now.