Glossary

Context Window: An AI Model's Working Memory

Checked 2026-10-31

Loading poll...

A context window is the amount of text a language model can look at while it writes its next reply: your prompt, the earlier conversation, files it has read and its own earlier output. It is the model's working memory for one session, separate from what it learned in training. Current frontier models list windows from hundreds of thousands to about a million tokens. Checked 31 October 2026.

At a glance

Item

Detail

What it is

The text a model can reference when generating a reply

Unit

Tokens, which are chunks of text, not words

Includes

Instructions, conversation, files, tool results, the model's own output

Separate limit

Maximum output tokens per reply

What happens at the limit

The tool compacts, truncates or errors, depending on the product

Cost link

You pay for the tokens you send each turn, so a fuller window costs more

Related

Subagents, CLAUDE.md, quantization

The definition

Anthropic's glossary describes the context window as the amount of text a language model can look back on and reference when generating new text. It is different from the large corpus the model was trained on and acts as working memory. A larger window lets the model handle more complex and lengthy prompts, while a smaller one limits long prompts and coherence over extended conversations.

Claude Code's glossary applies the idea to a coding session. The window holds the conversation history, file contents, command outputs, CLAUDE.md, auto memory, loaded skills and system instructions. As you work it fills until compaction summarises it, and you can run /context to see what is using space.

Tokens, briefly

Models read tokens, not letters or words. A token is a piece of text, often part of a word. Providers count them differently, so the same page can be a different number of tokens in different models. Prices and limits are quoted per token, usually per million. Do not convert tokens to words with a fixed rule when planning a budget; use the usage numbers an API returns for your own text. Anthropic's token counting docs give a concrete case: Claude 4.7 and later models use a newer tokenizer that produces about 30 percent more tokens for the same text than earlier models, with the exact increase depending on the content.

Context sizes on this site

All figures below come from our model pages, which read vendor pages on 31 October 2026.

Model or family

Context

Notes

Claude Opus 5.5, Sonnet 5.5, Haiku 5.5

1M tokens

128K max output (300K on Batch with a beta header); Haiku 5.5 prices change above 100K prompt tokens

OpenAI GPT-6 line

Max input 922,000

Sol 6.1 defaults to 500K in Codex and ChatGPT Work

GPT-5.3-Codex

400K

Deprecated, removal 1 April 2027

Mistral Large 4

1M

Qwen3.8-27B

262,144 native

Open weights

See Claude models, GPT models, Mistral models and Qwen models. The listed size is a maximum. What you can use in practice depends on the product, the plan and the settings.

What fills the window

In a coding agent the window fills faster than people expect. Claude Code's context explainer lists what loads before you type anything: CLAUDE.md, auto memory, MCP tool names and skill descriptions. After that:

  • File reads. Each file Claude opens enters context in full.
  • Command output. Test logs and build output can be long.
  • Tool results. A search or a web fetch returns text that stays.
  • Your messages and its replies. The whole conversation is resent each turn.
  • Rules and hooks. Path-scoped rules load next to matching files, and hook output can add text.

Worked example (made-up numbers). Say a session starts with 6,000 tokens of instructions and tool names. Claude reads ten files at 3,000 tokens each, 30,000 in all. Three test runs print 8,000 tokens each, 24,000 more. The conversation adds 10,000. The total is 70,000 tokens. On a 200,000-token window you are at 35%. On a 1,000,000-token window you are at 7%. Either way, each new turn pays to resend all 70,000, which is why long sessions cost more per turn than short ones. See Claude API pricing for the per-token rates.

What happens when it fills

Tools differ. In Claude Code the answer is compaction: automatic summarisation of the conversation as the window approaches its limit, or manually with /compact, optionally with a focus such as the API changes. The docs say what survives:

Item

After compaction

Project-root CLAUDE.md and unscoped rules

Re-injected from disk

Auto memory

Re-injected from disk

Skill descriptions

Rebuilt and re-injected

Files Claude read or edited

Up to five re-read, most recent first; a file over 5,000 tokens comes back as a path

Invoked skill bodies

Re-injected, capped at 5,000 tokens each and 25,000 in total

Instructions given only in chat

Summarised with the rest, and may be lost

The last row explains a common complaint: a rule that you said in chat disappears. The cure is to put lasting rules in CLAUDE.md or AGENTS.md.

Bigger is not automatically better

A big window removes one problem, running out, and adds others.

  • Cost. You pay for every token you send each turn.
  • Focus. A model searching 800,000 tokens for the relevant line can miss it. Vendors test long-context recall, and results vary by model. NVIDIA's table for its Nemotron Ultra, for example, highlights its long-context score as the strength. See Nemotron models.
  • Speed. Longer inputs mean slower first responses.
  • Noise. Old, irrelevant text can pull the model off course.

Good practice is to give the model what it needs and little else.

Ways to save context

Technique

How it helps

Subagents

Heavy reading happens in a separate window; only a summary returns

Skills

Long procedures load only when relevant

Short CLAUDE.md

Fewer standing tokens each session

Deferred tool definitions

Claude Code defers MCP tool definitions so only names enter context until a tool is used

/compact with a focus

Summarises on your terms before the window fills

New session per task

A clean window for unrelated work

Precise requests

Ask for one function, not the whole module

For add-ons, the MCP servers entry explains why each connected tool has a context cost, and Claude Code's docs say a command-line tool such as gh can be more context-efficient than a server.

Context window and running models yourself

If you host a model, the window affects memory as well as price. The attention state a model keeps for each token (its key-value cache) grows with the window and sits in GPU or system memory, on top of the weights. A model that loads fine at a short window can fail at a long one. Plan for both, and see GPU requirements for LLMs and quantization. The memory per token depends on the model's architecture, so read the model card for your model.

Context window vs memory vs RAG

Concept

What it is

Context window

What the model can see right now

Memory files

Text saved between sessions and loaded into the window

RAG (retrieval)

Searching an outside store and pasting only relevant parts into the window

Fine-tuning

Changing the model's weights, not its working text

A bigger window does not replace retrieval for large knowledge bases: you still pay per token and focus can slip. See MCP vs RAG for how tools and retrieval differ.

Our take

Treat the window like a desk. A bigger desk helps, and a messy one still slows you down. Look at the limit on the model page, keep standing instructions short, push noisy work into subagents and put rules that must survive into a file. We state sizes from vendor pages on the check date, and they change with each release.

Questions

What is a context window?

The amount of text a language model can look back on and reference when generating new text. Anthropic's glossary calls it the model's working memory, as distinct from the data it was trained on.

Is a bigger context window always better?

No. A larger window lets a model hold more, but it costs more tokens per turn and a crowded window can hurt focus. Many tools compact or summarise before the window fills.

What happens when the window fills up?

In Claude Code, compaction summarises the conversation. The project-root CLAUDE.md and auto memory are re-injected afterwards, but instructions given only in chat may be lost.

Are context window and output limit the same?

No. The context window covers what the model reads, and models also have a separate maximum for what they write in one reply. Claude 5.5 models list 1M context and 128K max output.

Loading poll...

Sources

  1. platform.claude.com/docs/en/about-claude/glossary
  2. code.claude.com/docs/en/context-window
  3. code.claude.com/docs/en/glossary
  4. platform.claude.com/docs/en/about-claude/pricing
  5. developers.openai.com/api/docs/models
  6. huggingface.co/Qwen/Qwen3.8-27B
  7. platform.claude.com/docs/en/build-with-claude/token-counting

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com