Usage wiki: when limits reset and how to save tokens

When limits reset and how to make them last longer. Browse by topic, with separate answers for Codex and Claude, based on official docs with quotes and links.

How many tokens do CLAUDE.md and AGENTS.md use, and how long should they be?

There is no fixed number: the file costs what its length costs, and it rides along with every message in the session. Anthropic suggests keeping each CLAUDE.md under 200 lines. Codex stops adding AGENTS.md files once they reach 32 KiB combined. Keep the rules you need every time and move the rest out.

Codex

AGENTS.md is read once at startup and stays in the session from then on. The combined limit is 32 KiB by default, and OpenAI says to keep it small.

At startup, Codex reads ~/.codex/AGENTS.md, then walks from the project root down to your current directory, taking at most one file per level and joining them into one block of the prompt. Once the block reaches 32 KiB (the project_doc_max_bytes setting), Codex stops adding files, so anything after that point is never read. On a large project, nest the files: keep a few project-wide rules at the root and put module rules in an AGENTS.md inside that module, where they load only when you start Codex from there.

What the official docs say

Reduce the size of your AGENTS.md. If you work on a larger project, you can control how much context you inject through AGENTS.md files by nesting them within your repository.
OpenAI Developers · Codex pricing
Codex builds an instruction chain when it starts (once per run; in the TUI this usually means once per launched session).
OpenAI docs · Custom instructions with AGENTS.md
Codex skips empty files and stops adding files once the combined size reaches the limit defined by project_doc_max_bytes (32 KiB by default).
OpenAI docs · Custom instructions with AGENTS.md
Codex concatenates files from the root down, joining them with blank lines. Files closer to your current directory override earlier guidance because they appear later in the combined prompt.
OpenAI docs · Custom instructions with AGENTS.md

Claude

CLAUDE.md is loaded in full at the start of every session. Anthropic suggests under 200 lines per file; /context shows what yours takes.

At launch, Claude Code reads ~/.claude/CLAUDE.md, the project CLAUDE.md (or .claude/CLAUDE.md), CLAUDE.local.md, and the same files in the directories above. Files in subdirectories load only when Claude reads a file there. Claude Code sends the full conversation with every request, so this content is counted again on every message. Anthropic puts it plainly: longer files consume more context and reduce adherence.

What the official docs say

CLAUDE.md files are loaded into the context window at the start of every session, consuming tokens alongside your conversation.
Claude Code docs · How Claude remembers your project
Size: target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.
Claude Code docs · How Claude remembers your project
Claude Code sends your full conversation with every request
Claude Code docs · Manage costs effectively

Where to move what you take out of CLAUDE.md

Claude Code has two ways to load instructions only when they are needed. Everything else, including @ imports, loads at launch.

  1. Long instructions for one workflow, such as releases, reviews or database migrations: move them into a skill. A skill loads only when it is used.

  2. Rules that apply to certain files only: put them in .claude/rules/ and start the file with a paths: block. They load when Claude reads a matching file.

  3. Notes meant for people: wrap them in an HTML comment. Claude Code strips block-level comments before the file enters context.

What the official docs say

If it contains detailed instructions for specific workflows (like PR reviews or database migrations), those tokens are present even when you're doing unrelated work. Skills load on-demand only when invoked, so moving specialized instructions into skills keeps your base context smaller. Aim to keep CLAUDE.md under 200 lines by including only essentials.
Claude Code docs · Manage costs effectively
Splitting into @path imports helps organization but doesn't reduce context, since imported files load at launch.
Claude Code docs · How Claude remembers your project
Block-level HTML comments (<!-- maintainer notes -->) in CLAUDE.md files are stripped before the content is injected into Claude's context. Use them to leave notes for human maintainers without spending context tokens on them.
Claude Code docs · How Claude remembers your project

Common misconceptions

  • The more detail in CLAUDE.md, the better Claude follows it

    No. Anthropic says the opposite: longer files consume more context and reduce adherence, and the more specific and concise the instructions, the more consistently Claude follows them. Extra length is a fixed cost you pay on every message.

  • Splitting CLAUDE.md into @ imports saves tokens

    It does not. Imported files load at launch too; imports only help you organize. What does save tokens is loading on demand: rules with a paths: block, and skills.

  • Claude ignores everything past line 200 of CLAUDE.md

    No. 200 lines is a target, not a cutoff: Claude Code loads the whole file unless it is over 4 MiB, and every extra line costs tokens. The first 200 lines or 25KB rule belongs to MEMORY.md, the auto memory file. The tool that does cut off is Codex, which stops adding AGENTS.md files at 32 KiB combined.

Tips

  • Claude Code: type /context to see how much Memory files take and which files were loaded.
  • Claude Code: type /memory to open those files and trim them. Edits apply from the next session; after /compact, Claude Code re-reads the project-root CLAUDE.md from disk.
  • Go through the file line by line. If a rule is not needed every time, delete it or move it out. Keep build commands, conventions, project layout and the always-do-this rules.
  • Codex: keep project-wide rules in the root AGENTS.md and put module rules in an AGENTS.md inside that module.
  • Codex: run codex --ask-for-approval never "Summarize the current instructions." to confirm what was read is what you meant.
  • Using both tools: keep one AGENTS.md. Recent versions of Claude Code read it directly when the project has no CLAUDE.md; if you have a CLAUDE.md as well, put one line in it, @AGENTS.md. Imported content still costs tokens, so keep AGENTS.md short.

Codex reset announcements · Claude reset announcements