Sonith Manakkat

Claude AI, part 6 of 127 min read9 visuals

Context explained: what Claude knows right now

What goes into Claude's context, why long chats get worse and cost more, what survives compaction, and practical ways to give Claude exactly the right context.

  • Context is everything on the page Claude sees right now
  • Long sessions degrade, so summarise, compact or start fresh
  • Put lasting facts in files Claude re-reads, not only in chat

Share on LinkedIn

Share
Reading level

"Context" is the most useful word in working with Claude, and the least understood. It decides what Claude can use, how good its answers are, and how fast your usage runs down. This part explains it with one picture (a desk) and then gives experts the exact mechanics from Anthropic's documentation, including what survives when a long session is compacted.

What context is

Claude does not remember you the way a colleague does. Each time it answers, it works from one "page": everything in its context window at that moment. That page includes your instructions, the files it has read, its own earlier replies, and results from tools. Anything not on the page does not exist for Claude.

Instructionssystem prompt, CLAUDE.mdFileswhat Claude has readConversationearlier messages and repliesTool resultssearch, commands, connected appsYour new messagethe question right now
What sits on the desk, from standing instructions to your newest message.
Expert viewWhat Anthropic says is in the window

Anthropic's documentation defines the context window as all the text a model can reference when generating a response, including the response itself, and distinguishes it from the large corpus the model was trained on. It describes it as a working memory. Everything in the request counts: the system prompt, every message (including tool results, images and documents), tool definitions, and the output including extended thinking.

The window is up to 1M tokens on the current Claude models. Claude Code's docs add that Fable models, Sonnet 5 and later, Haiku 5.5, Opus 4.6 and later and Sonnet 4.6 support a 1M window, with availability depending on plan.

Window limit (illustrative)12345
  1. Start-up CLAUDE.md, auto memory, MCP tool names and skill descriptions load before you type.
  2. Files read Every file Claude reads adds its contents.
  3. Conversation Your messages and Claude's replies accumulate.
  4. Tool results Search output and command output add up fast.
  5. Replies Claude's own answers also fill the window. Near the limit, compaction summarises the conversation.

Takeaway. Start-up content is a fixed cost, and the rest grows with the work.

A Claude Code session filling up. The proportions are illustrative, and /context shows your real numbers.

What loads before you type anything

In Claude Code, the desk is not empty when a session starts. Anthropic's context-window page lists what loads automatically.

  • CLAUDE.mdYour written instructions (part 7)
  • Auto memoryNotes Claude saved itself, up to a size limit
  • MCP tool namesConnected services, with full details deferred
  • Skill descriptionsOne short description each (part 8)
Loaded at session start in Claude Code.
Expert viewStart-up costs are real

Each of these costs context on every request. Anthropic's extension guide gives the loading rules: CLAUDE.md loads in full at session start; skills load only their descriptions at start and the full body when used; MCP servers load tool names with schemas deferred until needed (tool search is on by default); hooks cost nothing unless they return output; subagents get their own isolated context. You can see the real numbers with the /context command, which gives a live breakdown by category, and open memory files with /memory.

Why long chats get worse and cost more

Early in a chat

  • Little on the desk, so Claude can focus
  • Small input each turn

Hundreds of messages later

  • A crowded desk, so details get missed
  • The whole history is re-sent every turn
The same chat, early and late.
  • 1turn: the entire history is re-read
  • rotaccuracy and recall can fall as context grows
The two effects.
Expert viewContext rot, and why curation beats capacity

Anthropic's documentation says more context is not automatically better: as token count grows, accuracy and recall degrade, a phenomenon it calls context rot, which makes curating what is in context as important as how much space is available. It also notes that chat interfaces such as claude.ai can manage the window on a rolling first-in, first-out basis, so very old material may simply fall off the desk.

Compaction and summaries

When a session fills up, Claude Code compacts it: the conversation is replaced by a summary. Anthropic's documentation says the automatic pass runs as you approach the limit, so a full window does not end your session.

LongconversationSummarisedInstructionsre-read fromdiskWorkcontinues
Compaction in one picture.
Expert viewWhat survives compaction

Per Anthropic's context-window page, after compaction: the system prompt and output style still apply; project-root CLAUDE.md and unscoped rules are re-injected from disk; auto memory is re-injected from disk; skill descriptions are rebuilt and re-injected (requires Claude Code v2.1.304 or later); Claude re-reads up to five of the most recently modified files, and a file over 5,000 tokens comes back as a path reference without content; invoked skill bodies are re-injected but capped at 5,000 tokens per skill and 25,000 total, oldest dropped first (so put the most important instructions near the top of SKILL.md); rules with paths: frontmatter and nested CLAUDE.md files reload on demand; background commands keep running.

The memory page adds the practical lesson: if an instruction disappeared after compaction, it was given only in conversation, so add it to CLAUDE.md to make it persist.

  1. 1The window nears its limitClaude Code compacts automatically, so a full window does not end the session.
  2. 2The conversation becomes a summaryThe history is replaced by a structured summary.
  3. 3Instructions return from diskProject-root CLAUDE.md, auto memory and skill descriptions are re-injected.
  4. 4Recent files are re-readUp to five, most recently modified first. A file over 5,000 tokens comes back as a path only.
  5. 5Invoked skills are cappedSkill bodies are re-injected, at most 5,000 tokens each and 25,000 in total.
  6. 6Work continuesAnything said only in chat was summarised, so put lasting rules in CLAUDE.md.

Takeaway. What lives in a file survives compaction. What lived only in chat may not.

What happens when a session fills up, per the context-window documentation.

Fresh sessions and other ways to clean the desk

  1. /compactSummarise now, optionally with a focus such as "focus on the auth bug fix"
  2. /clearStart clean when switching to unrelated work
  3. /rewindSummarise from or up to a chosen message
  4. SubagentsSend large reads to a separate context and get a summary back
Tools in Claude Code for managing context (names from Anthropic's documentation).
Expert viewOther controls Anthropic documents

/autocompact with a token count sets how full the window gets before the automatic pass runs. The documentation says to compact with a focus before a long new task so the summary keeps what you choose, and to clear between tasks because old conversation "crowds out" the files you need next and costs tokens on every message. For API users, server-side compaction (beta) and context editing (clearing old tool results or thinking blocks) serve the same purpose, and the token counting endpoint estimates a request before you send it.

Ways to give Claude the right context

  • In the chatFor this conversation only
  • In CLAUDE.mdFacts every session needs
  • In a skillProcedures and reference needed sometimes
  • In a file you point toA document Claude reads when asked
  • In a ProjectKnowledge files reused across chats in the Claude app
Match the context to how long it needs to live.

Put lasting facts in a file Claude re-reads, not only in the chat.

Frequently asked questions

Is a bigger context window always better?

No. Anthropic's documentation warns that accuracy and recall can degrade as context grows, so curate what is included.

Will Claude forget my instructions after compaction?

Instructions in project-root CLAUDE.md are re-read from disk. Instructions given only in chat may be summarised away.

How do I see what is using my context?

In Claude Code, run /context for a live breakdown.

Sources

Last checked: 2026-10-21. These are official pages. Check them for anything that may have changed since.

  1. Explore the context window, Claude Code documentation
  2. Context windows, platform documentation
  3. How Claude remembers your project (memory)
  4. Extend Claude Code (features overview)

Back to all articles