Add config.toml option for explicit additional AGENTS.md paths
What variant of Codex are you using?
Codex CLI / app-server (and any client consuming the same configuration).
What feature would you like to see?
Add a supported config.toml option that lets users explicitly specify additional AGENTS.md files to load as native instruction sources.
For example:
agents_files = [
"/home/user/workspace/example-a/AGENTS.md",
"/home/user/workspace/example-b/AGENTS.md",
]
The exact key name is not important; agents_files, additional_agents_files, or similar would all work.
These files should be additive to normal AGENTS.md discovery rather than replacing it.
Use case
Consider a coordinator workspace containing multiple independent repositories:
/home/user/workspace/
├── example-a/
│ ├── .git/
│ └── AGENTS.md
└── example-b/
├── .git/
└── AGENTS.md
Codex is intentionally started from:
/home/user/workspace
so one thread can coordinate work across both repositories.
Current AGENTS.md discovery does not descend into arbitrary child repositories from that working directory, so neither repository-specific AGENTS.md is automatically part of the native instruction chain. A global AGENTS.md can tell the agent to manually read both files, but that is only a workaround: those files are then ordinary file reads rather than first-class instruction sources managed by the Codex harness.
An explicit path list would also be useful for nonstandard workspace layouts where automatic repository discovery is intentionally insufficient or undesirable.
Desired behavior
Configured files should:
- be read at thread/session initialization;
- be treated as native instruction sources, with the same instruction semantics as discovered
AGENTS.mdfiles; - be represented in
/statusalongside other loadedAGENTS.mdsources; - remain part of the effective instruction set after context compaction and thread resume, without relying on the model to remember to reread them;
- load in a deterministic documented order relative to global and automatically discovered
AGENTS.mdfiles; - produce a clear warning if a configured path is missing or unreadable.
The feature should not require recursive scanning. Explicit paths are sufficient and keep the behavior predictable.
Why configuration is useful even with multi-repository discovery
This is related to #38065, which requests automatic per-repository AGENTS.md resolution when work crosses repository boundaries.
That behavior would be valuable, but an explicit configuration mechanism solves a distinct problem: sometimes the user already knows exactly which instruction files must govern a coordinating thread and wants them loaded from the beginning, regardless of which repository is touched first or whether Codex can infer a repository boundary.
The two mechanisms could coexist:
- normal automatic
AGENTS.mddiscovery; - explicitly configured additional instruction files;
- optional dynamic per-repository discovery when work crosses boundaries.
Related: #38065, #27943.
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Notes on where this would slot in: discovery is centralized in
load_project_instructions/agents_md_paths(https://github.com/openai/codex/blob/1f41cc5d92/codex-rs/core/src/agents_md.rs#L52-L92) — it walks project-root → cwd per environment and appends each file as an entry under a sharedproject_doc_max_bytesbudget. An additiveagents_files = [...]option is a natural third source: prepend the configured absolute paths as entries before (or after) discovered ones, reusing the same byte budget and dedup-by-path so a listed file that discovery also finds isn't loaded twice.Two design points worth settling up front: (1) ordering/precedence — later entries effectively override earlier guidance for the model, so "global extras first, discovered files last" (most-specific-wins) matches the existing root→cwd ordering; (2) trust — config today only discovers files inside the project tree, while this option loads arbitrary paths, so it belongs in user config (
config.toml) semantics rather than anything a repo can set for you. Both~/.codex/AGENTS.md-style global instructions and per-project discovery stay untouched, which keeps the option purely additive as requested.