No. 134 Instruction files
~/.codex/AGENTS.md
Use when later sessions should inherit a written instruction
- Claude Code
- Codex
- Cursor
- Instruction files
# ~/.codex/AGENTS.md ## Working agreements - Always run `npm test` after modifying JavaScript files. - Prefer `pnpm` when installing dependencies. - Ask for confirmation before adding new production dependencies.
When to use
“/.codex/AGENTS.md” fits when later sessions should inherit a written instruction, because it says “/.codex/AGENTS.md”, and it is written to stay in force on later turns rather than to finish one task.
With “/.codex/AGENTS.md” loaded, the user message can be as small as “fix the empty-cart total in src/cart.js and do not touch the test runner”, because “/.codex/AGENTS.md” is already in force.
When not to use
Leave “/.codex/AGENTS.md” unused when you are fixing one bug tonight and you do not want tomorrow's session to inherit the words, because “/.codex/AGENTS.md” points the other way
How to run it
Claude Code
Claude Code loads “/.codex/AGENTS.md” from .claude/rules on later sessions, so “/.codex/AGENTS.md” survives a new chat, which a one-off paste does not.
Codex
Codex keeps “/.codex/AGENTS.md” only if you put “/.codex/AGENTS.md” in AGENTS.md, or in AGENTS.override.md beside the directory that should inherit it. A paste that is not saved is gone next thread.
Cursor
Cursor keeps “/.codex/AGENTS.md” by saving “/.codex/AGENTS.md” as .cursor/rules. The chat transcript alone will not reload it tomorrow.
Comparison
对比待补
This before-and-after was not run on this machine.
Related
- Stage: Instruction files
- Same stage: Repository expectations
来源:OpenAI · https://developers.openai.com/codex/guides/agents-md · 2026-12-01