Codex · Series · Part 3 of 8

Fewer tokens, faster onboarding: making AGENTS.md pay for itself

Khairul Alam·October 2026·~31 min read
CodexTokensOnboardingTeam workflow

By now you have an AGENTS.md (Part 2). Two questions remain. Does it really save tokens, or does it just add more? And can it help when you join a new project or start a new feature? The honest answers: yes, if you keep it lean, and yes, and this is where I find it most valuable.

Part 3 in 60 seconds
  • Usage in Codex depends on the model, the size and complexity of the task, the context it holds, reasoning, tool use and caching. Prompt length alone is not a reliable estimate.
  • Check what you are spending with /status, /usage, the footer set up by /statusline, and the usage dashboard.
  • AGENTS.md costs tokens in every session, but saves more by cutting repeated explanations and blind exploration. The official usage tips even say: reduce the size of your AGENTS.md on a big project.
  • A new chat starts with what is written down, not with what you did yesterday. Day 10 is cheaper because your notes remove steps and wrong turns.
  • Pair the file with habits: /new between tasks, /compact for long ones, the lightest model and reasoning effort that meets your quality bar.
  • For onboarding, ask Codex to explore and run /init, then have a human correct the result.
  • For a new feature, add a short feature note and link it, then remove it when the feature is done.

Codex changes quickly. Plans, limits, credit rates and model names move often. This series was checked against the official documentation on 18 October 2026; always confirm details on the official pages. Every number in this part is quoted from the docs on that date, and I say so where a figure is only an estimate.

Contents of Part 3
  1. Tokens and the context window
  2. How usage is measured and limited
  3. How to check what you are spending
  4. How AGENTS.md saves tokens
  5. Does Codex get better after 10 days?
  6. When it costs more than it saves
  7. Habits that save more
  8. Onboarding onto a new project
  9. Starting a new feature
  10. Making it a team habit
  11. Pitfalls and a checklist

1. Tokens and the context window

Everything Codex sees is text, counted in tokens. The official pricing page describes them as small units of information that are read and written: your prompt, files, chat history, tool results and the model's response all use tokens. As a rough guide a token is a short chunk of a word. Your usage allowance, the speed of replies and the size of the context window (how much the model can hold in mind at once) are all measured in them. A chat spends tokens in four places:

One chat's context window AGENTS.mdloaded at start Files Codex readsgrows as it explores The conversationgrows every turn Free spacefor the reply Where you have control • AGENTS.md: you choose its size, once • Files read: a good map means fewer wasted reads • Conversation: /new and /compact keep it from ballooning
The window is a shared budget. Every part competes for the same space.

The docs add a warning that is worth remembering: even with large context windows, models have limits. If the main chat fills with noisy output (exploration notes, test logs, stack traces), the docs say the session can become less reliable over time. They name two effects, context pollution (useful information gets buried under noise) and context rot (performance degrades as the chat fills with less relevant detail). So a lean context is not only cheaper. It is also better.

Analogy: the context window is your desk. A tidy desk with the three papers you need lets you work fast. A desk buried under every paper you ever opened slows you down, and you still pay to carry the pile around.

2. How usage is measured and limited

How Codex is billed depends on how you sign in (Part 1). The details below come from the official Pricing page, and I will not invent any numbers that are not there. Prices and limits change, so treat this section as a snapshot of 18 October 2026.

Two ways to pay

Sign-inHow usage works
ChatGPT plan (Free, Go, Plus, Pro, Business, Enterprise or Edu)Usage is included in the plan, within limits. Plus is listed at $20 per month, Go at $8, Pro from $100, Business at $20 per user per month (billed annually, with a note about monthly billing on the page). Plans differ in which Codex surfaces and features they include, so check the Pricing page.
API keyYou pay for Codex usage at API pricing. The page lists no cloud-based features (such as GitHub code review or Slack) for the API key option, and model availability follows the API models available to your key.

The docs also say ChatGPT Work and Codex share usage: they use the same pricing, credits and usage limits.

What decides how fast you use your allowance

The FAQ is direct about this. The number of messages you can send depends on the model, the size and complexity of your tasks, and whether you run them locally or in the cloud. Small scripts or routine functions may use only a fraction of your allowance, while larger projects, long-running tasks, or sessions where the agent holds more context use significantly more per message. Tasks that look similar can consume different amounts. Model choice, context, reasoning, tool use, retrieval and caching all affect usage, so prompt length alone is not a reliable estimate.

For Plus and Standard Business, the page gives these estimates of local messages per five-hour period. It stresses they are not fixed message limits, and that your usage dashboard has the real limits and reset times. Pro plans currently have no five-hour limit, and weekly limits may also apply.

ModelPlus (est. local messages per 5 hours)Standard Business (same)
GPT-6 Astra5-455-45
GPT-6.1 Sol15-16015-160
GPT-6 Sol15-15015-150
GPT-6 Luna350-3,000350-3,000

Read the shape, not the digits: the lighter the model, the more messages the same allowance buys. Local messages and cloud chats share one allowance, and cloud tasks may use more of it than local messages.

Credits and what happens at the limit

The token rate card, for credit-based usage

The Pricing page lists Standard-speed credit rates per million tokens. A few rows, copied as written:

ModelInputCached inputOutput
GPT-6 Astra250 credits25 credits1,250 credits
GPT-6.1 Sol50 credits2.5 credits250 credits
GPT-6 Luna2.5 credits0.25 credits12.5 credits

Three things to take from it. Output costs more than input, per token. Cached input is much cheaper than fresh input (for GPT-6.1 Sol, 2.5 against 50). And the page notes that Codex credit billing has no separate cache-write charge. The page also says the credit rates alone do not decide your included subscription usage, and that API token prices are separate from subscription usage, so do not use them to estimate how many tasks your plan includes. It lists more models than the three above; see the page for the full table.

3. How to check what you are spending

Saving tokens only works if you can see them. These are the views the docs describe.

Where to look

You want to know…Look here
Is Codex working where and how I expect, and how much has this session used/status in an interactive session. The docs say it shows the active model, approval policy, writable roots and current token usage.
My remaining plan limits during a CLI session/status too: the Pricing FAQ says you can use it to see remaining limits during an active CLI session.
My token activity over time/usage opens the usage menu. /usage daily, /usage weekly and /usage cumulative open a view directly. It needs a session with Codex service account auth and otherwise shows a sign-in requirement.
Context and limits all the time/statusline opens a picker to toggle and reorder footer items. The docs list model, model plus reasoning, context stats, rate limits, git branch, token counters, session id, directory and Codex version. The choice is saved to tui.status_line in config.toml.
Whether Fast mode is onA Fast mode item in the same footer, added through /statusline.
My current limits and reset timesThe usage dashboard at chatgpt.com/codex/settings/usage, which is what the Pricing FAQ points to.
A catch-up on a long chat without spending context/recap (when Codex is idle) generates a summary of the conversation. Unlike /compact it does not free context.

The docs give this advice about the dashboard: check it every week or two to understand your pace and remaining capacity, and if usage is higher than expected, consider whether a smaller model or tighter task scope would still produce a useful result.

A worked estimate you can do by hand

You can check the order of magnitude yourself with the rate card above. Suppose one request sends 100,000 input tokens and gets 5,000 tokens back from GPT-6.1 Sol, with nothing cached:

input : 100,000 / 1,000,000 x 50  credits = 5.00 credits
output:   5,000 / 1,000,000 x 250 credits = 1.25 credits
total                                      = 6.25 credits   (Standard speed, no caching)

Now suppose 90,000 of those input tokens were a cache hit:

fresh input : 10,000 / 1,000,000 x 50  = 0.500 credits
cached input: 90,000 / 1,000,000 x 2.5 = 0.225 credits
output      :  5,000 / 1,000,000 x 250 = 1.250 credits
total                                  = 1.975 credits

These are arithmetic illustrations of how the published rates combine, not a prediction of your usage. Real tasks make many requests, and on a ChatGPT plan the credits only matter once you are past your included limits. For scale, the Pricing page itself says a typical GPT-5.6 Sol task may use 2-15 credits.

Why usage climbs in a long chat

4. How AGENTS.md saves tokens

Think about what Codex does on a project it has never seen. To answer “how do I run the tests?” it must search, open the build files, read the README, maybe try a wrong command first. Each step reads files (tokens in), reasons (tokens out), and adds to the conversation. A one-line note in AGENTS.md replaces all of that.

Without notes: “run the tests” search repo read README read build file try wrong cmd try again, works ↑ lots of tokens spent finding out With notes AGENTS.md has the command run it. Done. ← a fraction of the cost
The saving is not magic. It comes from replacing searching with knowing.

Four separate savings add up:

One more fact from the AGENTS.md guide matters for cost: Codex builds its instruction chain once per run (in the TUI, once per launched session) and includes a limited amount of project guidance in the first turn. It stops adding files once the combined size reaches project_doc_max_bytes, 32 KiB by default. So the file is a bounded, one-time cost per session, and the cap protects you from a runaway file. It does not mean 32 KiB is a good target (section 6).

5. Does Codex get better after 10 days?

This is the question I get asked most, so let me answer it straight. What carries from one chat to the next is what is written down, not what happened in yesterday's chat. The docs say a chat keeps its own transcript and recorded working directory, while Codex reads files from the current working tree, and they tell you to keep durable project guidance in AGENTS.md or checked-in documentation so it is available to future chats. A fresh chat on day 10 starts as blank as on day 1, apart from the files you have written.

Yet day 10 can feel cheaper and faster. The difference is in your notes and your habits.

Day 1: no notes yet search read files read more wrong try retry do the task Day 10: the lessons are written down read AGENTS.md do the task Same model on both days. The saving is fewer steps and fewer wrong turns, not a smarter or faster Codex.
An illustrative example, not measured data. Notes remove steps; they do not change the model.

What does and does not get faster

ThingAfter 10 days of use
The model itselfUnchanged by your sessions.
How fast it writes each replyUnchanged. It depends on the model, reasoning effort and speed mode.
Steps needed to finish a taskFewer, if your notes remove searching and guessing.
Wrong attempts and retriesFewer, if gotchas are recorded.
Context size at the startSmaller and more focused, if you prune and start fresh chats.
Your own promptsBetter: you learn to name files and ask for small, clear tasks.

So a task takes less time not because each reply streams faster, but because it needs fewer replies. A large, stale context does the opposite.

Things that do not give you savings

A two-minute end-of-day habit

  1. Write down what surprised you. A wrong turn, a command that failed, a rule you had to repeat. Add it to AGENTS.md or the feature note.
  2. Delete one stale line. Anything that is no longer true or no longer needed.
  3. Save the plan, not the chat. If tomorrow continues today's work, write a handoff note (below) so the next step is in a file.

Do this for ten days and day 10 really is easier, because you taught the next chat. The honest way to put it: Codex does not get smarter or faster, it gets less lost.

The handoff note: what “remember this session” should really be

It is tempting to end a day by typing “remember this”. That alone saves nothing unless a file gets written. A reliable version is an explicit handoff note. Chats can be continued (/resume, codex resume, or codex resume --last for the most recent chat in the current directory), but a note in the repository is smaller, readable, reviewable and shared with your team.

Prompt to run before you close the chat
Before I close this chat, write a handoff note to docs/notes/2026-10-18.md:
- what we finished
- decisions made, and why
- what is still broken or unfinished
- the exact next step
Then add one line to AGENTS.md pointing to that file.

Next morning, start a new chat with: “Read docs/notes/2026-10-18.md and continue.” That starts small, and you can read and correct the note first.

6. When it costs more than it saves

The file is loaded at the start of every session, even for a tiny question. A huge AGENTS.md pays that price on “what does this function do?” as well. The balance depends on how long and how relevant it is:

Net benefit File size → Sweet spot empty: Codex explores too long: costs more than it saves
Conceptual, not measured data. The point is the shape: there is an optimum, and it is smaller than most people think.

Practical limits that keep you near the sweet spot:

Empty files are skipped, so a placeholder AGENTS.md costs nothing, but it saves nothing either. An AGENTS.md that is mostly a pasted README is the expensive end of the curve.

7. Habits that save more

The file is one lever. These habits matter just as much. They come from the Pricing FAQ, the best-practices guide, the speed page and the slash command reference:

HabitWhy it helps
/new between unrelated tasksStarts a fresh chat in the same CLI session (and /new bug bash names it). The docs advise one chat per coherent outcome: using one chat for an entire project leads to bloated context and worse results. /clear also starts a new chat, and clears the terminal first. Use /rename if you want to find the old one later with /resume.
/compact in a long taskSummarises earlier turns, freeing context while keeping critical details. Codex also compacts chats automatically. If you want to tune the automatic threshold, the config reference lists model_auto_compact_token_limit (unset uses model defaults).
Keep to the same chat while the problem is the sameThe guide says staying in one chat preserves the reasoning trail. /fork only when the work truly branches.
/side for a detourStarts an ephemeral fork whose transcript is separate from the main chat, so a quick question does not pollute the main context.
Point at files by nameType @ to mention a file or use /mention src/lib/api.ts. The docs list files, folders, docs, examples and errors as the context that matters. “Look at app/chat/ChatViewModel.kt” beats “find the chat code”.
Prompt with four partsGoal, context, constraints and done-when. The guide says this helps Codex stay scoped and make fewer assumptions.
Plan first for hard tasks/plan (or Shift+Tab) lets Codex gather context and ask questions before it implements. A wrong assumption fixed in a plan costs a sentence, not twenty rewritten files.
Give a way to verifyTell Codex how to run the tests and what good looks like, so it can check itself.
Right-size the model and effortSee the next subsection.
Turn off what you are not usingMCP servers add context to every message.
commands for a long task (illustrative)
> /compact          summarise earlier turns, free context
> /status           check model, approvals, token usage
> /new payments     next task: fresh named chat
> /resume           come back to an older chat if needed
The commands are real; the layout is an illustration, not captured output. After /compact the docs say Codex confirms before it summarises the chat so far.

Model, reasoning effort and speed

Three dials trade quality, time and usage. All are set per chat or in config, and the details of the models are in Part 4.

The cost of speed, from the Pricing page, relative to Standard mode for the same model:

Speed modeIncluded subscription usagePurchased credits and Enterprise pay-as-you-go
Fast2.5x2x
GPT-6 Astra Ultrafast8x6x
GPT-6.1 Sol Ultrafast8x6x

Fast mode is faster, not cheaper. If you are not waiting on the result, Standard speed lets the allowance last longer. With an API key, the page says API token pricing applies and ChatGPT credit multipliers do not.

The page's own advice on experimenting is a good rule: compare results on the same inputs and keep the lightest setting that meets your quality bar. Ask yourself how often the workflow runs, how quickly you need the result, how the output will be used, and how much its quality matters.

8. Onboarding onto a new project

Joining a project is the same problem Codex has every morning: lots of unknowns, little context. The file helps both of you. There are two situations.

You are new to the project

If the project already has an AGENTS.md, reading it is the fastest tour you will get: commands, structure and traps in one page. If it does not, you can use Codex to build the tour, then correct it with a teammate. Start Codex from the project directory (the CLI treats the directory where you start it as the project, or pass --cd / -C).

1. /initdraft the file 2. Exploreask how it works 3. Verifyteam reviews 4. Commitshared with all 5. Keepit fresh
The loop turns your learning curve into a document that helps the next person too.

/init creates an AGENTS.md scaffold in the directory where you run it; the docs say to review it and edit it to match your repository conventions. Then use a repeatable recipe. Note that it follows the four-part prompt (goal, context, constraints, done-when) from the best-practices guide:

Onboarding recipe: paste into a fresh chat in the project root
Goal: I am new to this codebase. Give me a one-page tour I can keep.
Context: start from the README, the build files and the top-level folders.
Constraints: read only, do not change any files yet. Mark anything
you are unsure about instead of guessing.
Done when: you have told me
1. what the project does and the main modules
2. how to build, test and lint (exact commands)
3. how a request or user action flows through the code, file by file
4. which parts look risky or fragile, and why
5. what you would add to AGENTS.md for the next person

Then, in the same chat, ask follow-ups such as “What do I need to know before changing the engine code?” or “Trace what happens when a user sends a chat message.” If you want a plan before any change, switch to /plan first. When the tour looks right, ask Codex to write the useful parts into AGENTS.md (a concise version: commands, folder map, two or three gotchas), and review it with /diff.

To confirm what Codex actually loaded, the AGENTS.md guide suggests running codex --ask-for-approval never "Summarize the current instructions." from the repository root. It should echo guidance from the global and project files in order of precedence. Once instructions are in a file, a new teammate asks Codex the same questions you did; the file answers them before they ask.

Verify before you trust

Codex's tour is a draft. It can misread intent or miss history that lives only in people's heads. Have someone who knows the project read the generated file and strike what is wrong. This is also a fast way to find out which parts of your project are poorly documented.

You are bringing someone (or Codex) into your project

If you maintain the project, AGENTS.md doubles as onboarding documentation that is actually kept current, because you use it daily. A new hire reads the same file their assistant does, and both start with the same understanding. The best-practices guide adds a related tip: personal skills live in $HOME/.agents/skills, and shared team skills can be checked into .agents/skills inside a repository, which is especially helpful for onboarding new teammates.

9. Starting a new feature

Features have a different problem from projects: the knowledge is temporary. The decisions you make this week (names, trade-offs, what is out of scope) matter until it ships and then mostly do not. Putting all of that in the permanent root file would bloat it.

Instead, write a short feature note and point to it:

docs/features/offline-fallback.md
# Feature: automatic offline fallback

## Goal
If the user picked Online but the internet is not reachable,
answer from the on-device model and tell the user why.

## Decisions
- Check VALIDATED network capability, not just "connected".
- If the online call fails before any text arrives, fall back.
- If it fails part-way, keep the text already received.

## Out of scope
- Switching back to online mid-conversation.

## Done when
- Unit tests for the decision logic pass.
- Manual test: airplane mode shows the fallback message.
AGENTS.md (while the feature is in progress)
## Current work
Working on automatic offline fallback.
Read docs/features/offline-fallback.md before changing the engine selection code.
Startwrite the note Link itfrom AGENTS.md Buildupdate as you decide Shipunlink, keep lessons Only lessons that stay true (a new convention, a gotcha) move into the permanent file.
Temporary knowledge gets a temporary home. The permanent file stays lean.

This also helps across chats. If you stop on Friday and start fresh on Monday, the new chat reads the feature note and picks up where you left off, without you retelling the story. For a long task, /goal (for example /goal Finish the migration and keep tests green) keeps an objective attached to the active chat. The docs say goal text is limited to 4,000 characters and that for longer instructions you should put the details in a file and point the goal at that file, which is exactly the feature-note pattern.

A worked example: the first week on a feature

Imagine you join an Android team and your first ticket is the offline fallback above. Here is how the pieces fit, with a rough token view of each step.

  1. Day 1 morning, tour. In the project root, run codex and paste the onboarding recipe. Codex reads the README and build files and reports. You run /init and trim the draft to build commands, a folder map and two gotchas. A teammate corrects one wrong claim. You commit. Cost: one exploratory chat, paid once.
  2. Day 1 afternoon, plan. /new offline-fallback to start clean, then /plan with the four-part prompt. You save the decisions as docs/features/offline-fallback.md and link it from AGENTS.md. The chat can now be thrown away; the plan is a file.
  3. Day 1 evening, build. Use a lighter model or lower effort for the well-scoped edits, and /status to check usage. When the chat grows long, /compact. Before closing, run the handoff prompt.
  4. Day 2, continue. New chat: “Read docs/notes/2026-10-18.md and continue.” No retelling and no old transcript. Use /side for a quick question about a library without touching the main context.
  5. Day 5, ship. Review with /diff and /review. Remove the “Current work” link, and move the one lasting lesson (“check VALIDATED network capability”) into the permanent notes. Delete stale notes.

Notice what never happened: the same background was never typed twice, and no chat ran for days. That is where the savings in this part really come from.

10. Making it a team habit

  1. Commit the root AGENTS.md so everybody shares the same baseline.
  2. Review changes in pull requests like code. A bad line affects every future session.
  3. Add a line when something goes wrong. A bug caused by a missing convention becomes a one-line prevention for the next person. The guide's retrospective tip fits here.
  4. Prune on a schedule. Every month or so, delete lines that are no longer true or no longer needed.
  5. Keep personal taste personal. Preferences go in your global file at ~/.codex/AGENTS.md, not the shared one. Use AGENTS.override.md there only for a temporary override.
  6. Share the usage tips. Smaller models for routine work, fresh chats between tasks, fewer MCP servers. They help the whole workspace's allowance last longer.

11. Pitfalls and a checklist

PitfallWhat to do instead
Pasting the whole README and wiki inSummarise in a few lines and link the rest.
Rules that contradict each otherSearch the files for overlaps when you add a rule; closer files override earlier ones.
Vague advice (“write clean code”)Name the command, file or rule you actually mean.
Stale instructionsReview in pull requests; delete what is no longer true.
Secrets in the fileNever. Use environment variables.
One chat for the whole projectOne chat per coherent outcome, with notes in files.
Top model and high effort for everythingStart light and raise only when the result needs it.
Fast mode left on while nobody is waitingToggle /fast off; it uses allowance faster.
Treating it as a hard guaranteeUse approval and sandbox settings for rules that must hold.
Starter checklist
  • Run /init, then read every line of the result.
  • Make sure build, test and lint commands are correct and copy-pasteable.
  • Add a short folder map and the two or three biggest gotchas.
  • Move personal taste to ~/.codex/AGENTS.md.
  • Commit it, and ask a teammate to correct it.
  • Add /statusline items for context and limits, and glance at /status during long tasks.
  • Use /new between tasks, /compact inside long ones, and a handoff note at the end of the day.
  • Pick the lightest model and reasoning effort that meets your quality bar.

The whole series so far in one picture

Part 1Install, interfaces,sign-in and settings Part 2AGENTS.md: where itlives and what to write Part 3Token savings, onboarding,features, team habits A Codex that starts every chat informedless repeating, less guessing, faster results
A new chat starts without yesterday's conversation by design. A small, honest, maintained file is how you give it the context it needs.

Codex changes quickly. This series was checked against the official documentation on 18 October 2026; always confirm details on the official pages. These are the pages behind this part:

TermIn plain words
TokenA short chunk of text; the unit that usage and limits are counted in.
Context windowHow much text the model can hold in mind at once.
CreditsThe unit used to pay for eligible usage once included limits are used.
Cached inputRepeated input that is billed at a lower rate than fresh input.
/newStarts a fresh chat in the same CLI session.
/compactSummarises the chat so far to free up space.
Reasoning effortHow hard the model thinks; higher is slower and uses more tokens.
Fast modeFaster replies on supported models in exchange for higher usage.
Feature noteA short temporary doc holding the decisions for one feature.
Handoff noteA short file written at the end of a chat so the next one can continue.
OnboardingGetting a person (or Codex) productive on a project quickly.
Sweet spotA file big enough to help, small enough to be cheap and read.

What comes next

You now know where tokens go, how to watch them, and how to keep your notes lean. In Part 4 we look at the Codex models in more detail, the API route and the official links. If you want to revisit what goes into the file itself, go back to Part 2.

← Back to all writing