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.md does not exist, /init creates it as today.
  • If AGENTS.md already exists, /init sends 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 /init when AGENTS.md exists.
  • Update the init prompt to say create or update.
  • Update /init command descriptions.
  • Add TUI test coverage for the existing-file case.

Validation:

  • just fmt
  • cargo test -p codex-tui slash_init_updates_when_project_doc_exists
  • just fix -p codex-tui

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗