What is a context window?

A context window is the token budget a model can hold in one request. In a coding agent it is spent on the system prompt, CLAUDE.md or AGENTS.md, tool definitions, file reads, command output and conversation, all reread every turn. When it fills, the agent compacts older material and instructions it was following can quietly disappear. Its size depends on the model and the host.

Last updated
By
Published
In Polish
Okno kontekstu
First set up at
All levels, free guide
Also searched as
context length, token limit

$59.99 once for 12 months of access. Nothing renews on its own. 30-day refund on a first purchase.

On this page Why it mattersWhat fills the windowCompact, clear, fork or delegateHow each tool does itQuestions

Why it matters.

A larger window postpones compaction; it does not make the model attend equally well to everything in it. Instructions from early in a very long session compete with hundreds of thousands of tokens of file contents and logs, so treat the window as a budget you spend on the task, not as storage.

What fills the window

The window is not only your conversation: every turn resends everything the agent currently holds, so the largest consumers are the ones you do not see in the terminal.

What takes space in a coding agent’s context window, when it loads, and how to shrink it
What takes the spaceLoaded whenHow to shrink it
System prompt, environment info Always, first You cannot; it is fixed overhead
CLAUDE.md / AGENTS.md and rules At session start, and again after compaction Prune the file; move reference material into skills or path-scoped rules
MCP tool definitions At start or on demand, depending on the tool Remove servers you do not use
File reads Each time the agent opens a file Name the exact files; ask for the one function, not the whole file
Command output Each test, build or grep run Filter output (--silent, pipe logs through tail -50); fail fast
Conversation history Grows every turn Compact with a focus, or clear between tasks

Claude Code’s own context documentation names file reads as the largest consumer in a typical session (checked 2026-09-26). Source: Context windows guide, 2026-09-26.

Compact, clear, fork or delegate

Decide by what you still need, not by how full the meter is.

What to do when the context window fills, per situation and tool
Situation and actionClaude CodeCodexCursor
Same task, long history, decisions still matter: compact with a focus /compact <what to keep> /compact Write the handoff note, then start a new chat
Only part of the history is noise: summarise a slice /rewind, then Summarize from here or Summarize up to here No slice summary in Codex CLI 0.157.1: write the handoff note, then /compact or /new Write the handoff note, then start a new chat
The next task is unrelated: clear /clear /new New chat
Try another approach without losing this one: branch /branch /fork Start a new chat from the handoff note
A side task would flood the window with reads or logs: delegate A subagent: its reads stay in its own window and only the summary returns Subagents (/subagents switches between them) A subagent (Cursor docs, checked 2026-08-28)
A quick question about the session: ask on the side /btw <question>, which does not add to the conversation /btw <question> (a side conversation in an ephemeral fork; Ctrl+C returns to the main thread) Ask in a separate chat
Compact before a phase change, not when the meter forces you, and keep anything that must outlive a reset on disk: plans, acceptance criteria and progress notes survive compaction, /clear and a new session; decisions made only in the conversation do not.

Source: Context windows guide, 2026-09-26.

How each tool does it.

Cursor, Claude Code and Codex each name this their own way. Each note carries the date it was checked.

Cursor

Check the model picker for the current window; subagents keep large exploratory reads out of the main chat.

The guide does not name Cursor’s context indicator or its summarisation thresholds, because they change by model.

Cursor docs, 2026-08-28

Claude Code

Opus 5.5, the default model from v2.1.280 (both release channels on 2026-10-12), has a 1M-token window on the Anthropic API; /context shows what fills it.

By default a session on a 1M-window model auto-compacts at about 967K tokens. /compact <what to keep> compacts on demand, and /autocompact 500k makes automatic compaction start earlier.

Context windows guide, 2026-09-26

Codex

A default working window of 272K tokens, raised with model_context_window up to 872K for the GPT-6 and GPT-5.6 models (the 0.157.1 catalog, and again the 0.162.1 catalog, checked 2026-10-12).

Input above 272K is billed at a higher tier, so raise the window only for the sessions that need it, for example with -c model_context_window=400000 on one run.

Models hub, Codex CLI 0.157.1, 2026-09-26

Questions about the context window.

Is a bigger context window always better?

No. A larger window postpones compaction, but it does not make the model attend equally well to everything in it. Instructions from early in a very long session compete with hundreds of thousands of tokens of file contents and logs, so treat the window as a budget you spend on the task, not as storage.

Why can the working window be smaller than the model’s limit?

Because the host decides how much to use. Codex gives its default model a working window of 272K tokens although the GPT-6 and GPT-5.6 models allow up to 872K, and a Claude Code session on a 1M-window model auto-compacts at about 967K tokens by default. The system prompt, instruction files and tool definitions take their share before your prompt does.

What does compaction do to my instructions?

It summarises older material to free space, so detail is dropped. In Claude Code the project-root CLAUDE.md is re-read from disk afterwards, subdirectory files and path-scoped rules come back when Claude next reads a matching file, and instructions you gave only in the chat are gone. Compact on demand with /compact, ideally before a phase change, and keep anything that must survive in a file.

How do I see what is in the window?

In Claude Code run /context: it draws usage by category (system prompt, memory files, tools, messages) and suggests savings. In Codex run /status for the session configuration and token usage. For Cursor, check the model picker for the current window.

Does this page answer your questions?

One tap, no sign-in.

not at all fully

Read the guides in the same words.

Open every guide with the Toolkit. Each term is defined once here, and the guides use it the same way.

$59.99 once for 12 months of access. Nothing renews on its own. 30-day refund on a first purchase.