AGENTS.md convention, so a repository set up for other coding agents works without changes.
Which files o4 reads
o4 looks for these files in the directory you start it in (or the one you pass with-C):
It also reads your personal instructions from
~/.o4/instructions.md, which apply to every project.
All the files that exist are used. None replaces another.
o4 reads these files only from that one directory. It doesn’t look in parent directories or subdirectories, so an AGENTS.md in a subfolder is ignored. If you start o4 in a subdirectory of a repository, the files at the repository root aren’t read. Start o4 at the root, or pass the root with -C.
How they reach the model
o4 puts the instructions near the end of the system prompt, in two sections:- User Instructions: the content of
~/.o4/instructions.md. The prompt tells the model these may be overridden by the project instructions. - Project Instructions: the content of the project files, joined in the order
AGENTS.md,CLAUDE.md,.o4.md,.o4/instructions.md. The prompt tells the model these take precedence over user instructions and o4’s defaults.
AGENTS.md and CLAUDE.md contain the same text, the model sees it twice. To keep a single copy, make one file refer to the other, or keep the shared guidance in only one of them.
You can see exactly what o4 sends with --print-system-prompt, which prints the assembled system prompt and exits without calling a model:
README.md, Cargo.toml and package.json.
Limits
- o4 reads up to 50 KB of each instruction file. It cuts a longer file at that point and adds a warning to the system prompt, such as
[WARNING: instruction file truncated at 50KB limit: /path/to/AGENTS.md]. - A file that isn’t valid UTF-8 is skipped with a warning.
- A project instruction file that is a symlink to somewhere outside the project is skipped.
.o4.md are the exception: they run only in a trusted workspace. The whole of .o4.md, including its hooks blocks, still goes to the model as instructions.
Create an AGENTS.md with /init
Run/init to have the model write the project’s instructions for you. o4 asks the model to study the repository (its build files, CI config, README and any existing instruction files, including .cursorrules and .github/copilot-instructions.md) and create or improve AGENTS.md at the project root. It edits only AGENTS.md. If the file already exists, the model makes targeted improvements instead of replacing it.
The model uses its normal tools to do this, so file edits go through the usual permission prompts.
Reload after editing
o4 reads instruction files when a session starts. After you edit them, run/reload to read them again and rebuild the system prompt in the current session. With auto memory on (the default), /reload also reloads memory and shows Reloaded project instructions and memory.; otherwise it shows Reloaded project instructions. If the model is working, /reload waits until the turn finishes.