Allow /init to update existing AGENTS.md
Open 💬 1 comment Opened May 9, 2026 by Serxo1
What variant of Codex are you using?
CLI and app
What feature would you like to see?
The current /init command only creates AGENTS.md when the file does not exist. If a repository already has AGENTS.md, /init reports that the file exists and skips the command.
I would like /init to support updating/improving an existing AGENTS.md, similar to Claude Code's init behavior. This would make /init useful for repositories that already have partial or outdated agent instructions.
Proposed behavior:
- If
AGENTS.mddoes not exist,/initcreates it as today. - If
AGENTS.mdalready exists,/initsends an update prompt instead of skipping. - The prompt should preserve accurate repository-specific guidance, refresh stale sections, and add missing contributor guidance.
I prepared a small proof-of-concept patch in my fork in case it is useful for discussion:
https://github.com/Serxo1/codex/tree/codex/update-init-agents-md
Patch summary:
- Remove the early return that skips
/initwhenAGENTS.mdexists. - Update the init prompt to say create or update.
- Update
/initcommand descriptions. - Add TUI test coverage for the existing-file case.
Validation:
just fmtcargo test -p codex-tui slash_init_updates_when_project_doc_existsjust fix -p codex-tui
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗