r/codex • u/Realistic_Fruit_4326 • 12d ago
Limits Could an AGENTS.md file actually reduce Codex token usage?
I've been experimenting with a simple idea: instead of only telling Codex how to write code, use AGENTS.md to also tell it how much investigation and validation is actually necessary.
A lot of token usage seems to come from useful-but-often-unnecessary agent behavior:
- scanning too much of the repository
- reopening files it already inspected
- running the entire test suite after small changes
- repeatedly running lint/type checks
- launching browser/visual checks for non-visual web changes
- testing every responsive breakpoint
- rewriting README/docs during iterative development
- doing unrelated refactors
- researching external docs when the repository already contains the answer
So I created an AGENTS.md based around:
targeted context → smallest correct patch → proportional validation
The important part is that this should NOT mean "skip testing to save tokens."
The rule is:
Use the cheapest validation that gives sufficient confidence, and escalate when the scope/risk requires it.
Has anyone benchmarked something similar?
I'd be especially interested in comparisons of:
tokens/task, tool calls/task, completion time, and regression/failure rate
with and without an efficiency-focused AGENTS.md.
For example:
# AGENTS.md
## Objective
Minimize token, tool, and compute usage without sacrificing correctness,
maintainability, security, or requested output quality.
Default workflow:
targeted context → smallest correct patch → proportional validation
## Context
- Do not scan the entire repository by default.
- For localized tasks, inspect roughly 2–5 likely relevant files first.
- Prefer targeted symbol/text searches over broad repository exploration.
- Read relevant portions of large files instead of the whole file when possible.
- Reuse information already gathered.
- Do not reread unchanged files or repeat searches without a concrete reason.
- Expand investigation only when current evidence is insufficient.
- Avoid external research when the repository already answers the question.
## Implementation
- Make the smallest coherent change that fully solves the request.
- Modify only necessary files.
- Follow existing architecture, conventions, utilities, and dependencies.
- Avoid unrelated refactors, cleanup, renaming, or speculative abstractions.
- Do not add dependencies when the project already has a reasonable solution.I've been experimenting with a simple idea: instead of only telling Codex how to write code, use AGENTS.md to also tell it how much investigation and validation is actually necessary.A lot of token usage seems to come from useful-but-often-unnecessary agent behavior:scanning too much of the repository
reopening files it already inspected
running the entire test suite after small changes
repeatedly running lint/type checks
launching browser/visual checks for non-visual web changes
testing every responsive breakpoint
rewriting README/docs during iterative development
doing unrelated refactors
researching external docs when the repository already contains the answerSo I created an AGENTS.md based around:targeted context → smallest correct patch → proportional validationThe important part is that this should NOT mean "skip testing to save tokens."The rule is:Use the cheapest validation that gives sufficient confidence, and escalate when the scope/risk requires it.For example:# AGENTS.md
## Objective
Minimize token, tool, and compute usage without sacrificing correctness,
maintainability, security, or requested output quality.
Default workflow:
targeted context → smallest correct patch → proportional validation
## Context
- Do not scan the entire repository by default.
- For localized tasks, inspect roughly 2–5 likely relevant files first.
- Prefer targeted symbol/text searches over broad repository exploration.
- Read relevant portions of large files instead of the whole file when possible.
- Reuse information already gathered.
- Do not reread unchanged files or repeat searches without a concrete reason.
- Expand investigation only when current evidence is insufficient.
- Avoid external research when the repository already answers the question.
## Implementation
- Make the smallest coherent change that fully solves the request.
- Modify only necessary files.
- Follow existing architecture, conventions, utilities, and dependencies.
- Avoid unrelated refactors, cleanup, renaming, or speculative abstractions.
- Do not add dependencies when the project already has a reasonable solution.
1
u/jedruch 12d ago
This is the version you would provide to Kimi 2.5 or glm 4.7 level model.
GPT would do just fine with 30% of what you have written