# Codex context window

> Choose how much conversation context a Codex agent can use.

- Area: Desktop, mobile and web
- Plans: All plans
- Last checked against the product: 2026-10-08
- Web page: https://agentsroom.dev/docs/codex-context-window

## What it does

Choose how much conversation context a Codex agent can use. AgentsRoom reads
the installed CLI's account-specific model catalogue and offers its advertised
extended size. An API model's advertised capacity is not necessarily the
default or maximum selected by the Codex CLI.

## Where to find it

Desktop: Add agent > Model > Context window, or Edit agent below the model.
Mobile: Add agent > Model > Context window, while connected to the desktop.

## How to use it

Maximum available is selected initially. Choose Standard globally or for a
project to change that default, or select a size on one agent to pin it. Advanced options allows a custom window
and a token threshold for automatic context compaction. The extended preset
sets compaction to 90 percent of the CLI's effective input window.

## Settings

- `cliOptions` (agent scope): stores `-c model_context_window=<tokens>` and
  `-c model_auto_compact_token_limit=<tokens>`. Maximum available by default, unless the project or account selects Standard.
- The catalogue is read from the selected local account. Unavailable means the
  desktop could not find usable capacity information for this model/account.
- Saving does not resize a running conversation. Relaunch the agent to apply.

## Agent tools (MCP)

Use `agents_save` or `settings_set` with agent scope and `cliOptions` to set
these native flags. Preserve other CLI options when changing either number.
For defaults, use `settings_set` with global scope and `contextWindowDefaults`:
`{"global":{"claude":"max","codex":"standard"},"projects":{"<repo-id>":{"codex":"max"}}}`.
Allowed modes are `max` and `standard`; an omitted project entry inherits the
account preference. Preserve entries not being changed.

## Providers

Codex only. Claude keeps its existing context selector. Other CLIs are unchanged.

## Mobile

The phone reads the desktop's catalogue and sends numeric preferences through
the existing agent creation bridge. The desktop validates, saves and launches.

## Limits

The maximum is model/account/installation dependent. A larger configured
window is not a guarantee that every request will be accepted by the provider.
More retained context can increase cost. Missing catalogues do not fall back
to an invented 1M maximum.

## Common questions

**Why does Astra show less than one million tokens?** Codex has its own model
catalogue and defaults. AgentsRoom displays the CLI values rather than API
marketing capacity; session usage reports the effective window after reserves.

**Are my preferences shared across computers?** Yes. Choose the default under
Settings > AI providers > Claude or Codex, and optionally override it under the
project's AI provider settings. Account and project defaults sync with your
account, including the phone. Explicit agent options still take priority.
Each computer resolves Maximum available from its own model/account catalogue.

## Related

- [Customize agents](customize-agents.md)
- [Multiple providers](multi-provider.md)
- [Session trace](session-trace.md)
