Command reference Β· Codex CLI
/init
Generates an AGENTS.md scaffold for the current project.
/init generates an AGENTS.md scaffold for the current project or directory. AGENTS.md holds project-specific instructions and context that Codex automatically reads at every session β the counterpart to CLAUDE.md in Claude Code. According to the docs, the file captures persistent instructions for the repository or the subdirectory you're currently working in.
/init is documented both in the pure terminal CLI command list and in the general Codex command reference and works identically there β unlike /worktree or /cloud, it's therefore not a desktop-app-exclusive feature, but a regular terminal CLI command. The command only creates the basic scaffold; you have to add the actual content β project rules, coding conventions, test commands β yourself afterward or have Codex fill it in specifically.
π THE SAME TASK (βEDIT PROJECT CONFIG/INSTRUCTIONSβ) ON OTHER PLATFORMS
β WHEN TO USE IT?
Set up a new project for Codex
/init
Have the project rules recaptured after a major structural change in the repo
call /init, then manually add new test commands to the generated scaffold
β WHEN NOT TO?
AGENTS.md already exists and is maintained
/init creates a fresh scaffold and can overwrite existing, carefully maintained project notes.
Better: edit the existing AGENTS.md directly instead of having it regenerated
SOURCES
- Codex CLI docs: Slash Commands β learn.chatgpt.com
MORE COMMANDS Β· Codex CLI