Allow pointing codex to specific AGENTS.md / prevent reading AGENTS.md file from folder above where codex-cli started
Resolved 💬 3 comments Opened Nov 3, 2025 by bornio Closed Feb 23, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.53.0
What subscription do you have?
Pro
Which model were you using?
gpt-5-codex
What platform is your computer?
Darwin 25.0.0 arm64 arm
What issue are you seeing?
Agents.md: ../../../AGENTS.md, AGENTS.md
I would like to prevent it auto loading the first AGENTS.md file
What steps can reproduce the bug?
Uploaded thread: 019a4943-0eac-72e2-a0fe-adcd4d0a8eac
What is the expected behavior?
_No response_
Additional information
_No response_
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Hey @bornio, looks like this issue closely resembles my feature request! Just wanted to share with you a "workaround" which achieves roughly the results you're looking for:
AGENTS.override.mdto your project's.gitignoresource shell.sh activate.codex --disable-git-root-agents [OPTIONAL_ARGS]The pros:
~~The cons (and the reason I created my issue in the first place):
AGENTS(.override)?.mdis read after you send your first prompt, not when you launch codex!)Anyways, there's a workaround! I use similar mechanics in my workflow, taking advantage of that override for various reasons. Another option is to
ln -s ../../../.git .gitwhich drops a symbolic link to the real git root into the working folder (you'd also add.gitto.gitignoreso it doesn't end up committed by accident). Codex-CLI's logic for detecting the repo root is simply "does a file or directory named.gitexist here?" so you can fool it into thinking the repo root is the subfolder. All of these options are somewhat brittle and convoluted. Hope that helps while we wait for feedback on our ideas!~~Update: The way AGENTS.md is loaded has changed a lot since that recommendation. Now at the start of every turn it loads the AGENTS.md if it changed, so this workaround is outdated.
This feature request hasn't received enough upvotes, so I'm closing it.