Guide
How can I check whether Codex loaded my AGENTS.md file?
Updated
Short answer
Start a fresh Codex task in the intended working directory, ask which instructions apply, and compare the response with a harmless, distinctive rule in your file. Verify the documented discovery path, override precedence, fallback names and size limits. The response is a useful diagnostic, not proof of an enforced security boundary.
Confirm the working directory first#
A file in a repository is not automatically applicable to every Codex task. Confirm the directory and project root used by the session. Record the Codex version and relevant configuration before investigating a missing instruction. Keep the check read only and avoid exposing private file contents in a public transcript.
The current Codex AGENTS.md documentation explains global guidance and project discovery. Use it for the installed product and configuration. Do not assume another coding agent uses the same filenames or precedence.
Check which file wins at each level#
The documented discovery behavior checks global guidance in the configured Codex home and walks from the project root toward the current working directory for project instructions. At each directory, AGENTS.override.md takes precedence over AGENTS.md; configured fallback names can apply when the standard files are absent. At most one applicable file is included from a directory.
Inspect the actual files without modifying unrelated guidance. An override can explain why editing AGENTS.md appears to have no effect. A nested instruction can also change the applicable rule for work in its own scope. Preserve the path and order instead of assuming one repository-root file is the whole instruction chain.
Use a harmless distinctive rule#
Choose a convention that is easy to identify and has no security consequence, such as asking the agent to mention a particular local test command before proposing code changes. Start a fresh task in the target directory and ask the agent to summarize the active guidance and its sources.
Compare the response with the expected files and documented ordering. If the agent omits the rule, inspect discovery and configuration before concluding that the feature is broken. Do not use an instruction to reveal credentials, ignore safety controls or contact an external service as a diagnostic.
The agent's account is evidence about what it reports. For a stronger operational check, inspect whether a safe representative task follows the expected convention. Neither result proves that every future instruction will be followed or that a forbidden operation is technically unavailable.
Investigate limits and stale sessions#
Check project_doc_max_bytes and project_doc_fallback_filenames in the current configuration against the documentation. Large instruction chains can exceed the configured project-document limit. Keep essential guidance concise and scoped, and verify the loaded sources again after changes.
Use a new task when checking changed instructions so an earlier instruction snapshot does not confuse the result. Preserve the exact working directory, filenames, configuration and observed response in the troubleshooting record. If the behavior remains unexpected, compare that bounded reproduction with current official documentation before changing unrelated settings.
Keep instructions separate from enforcement#
AGENTS.md communicates working conventions and task guidance. It does not remove filesystem permissions, revoke credentials or independently constrain a remote API. Enforce sensitive boundaries through identity, native permissions, isolation and the systems that execute operations.
Harden evaluates supported pending agent calls using relevant task context and policy. Verify the supported Codex integration and actual tool path separately from instruction loading. Our access-control guide helps map those distinct responsibilities. Use Control for a scoped evaluation when the workflow needs a separate action boundary.
FAQ
Related questions
Is AGENTS.override.md different from AGENTS.md?
The documented discovery order gives the override filename precedence at the same directory level. Inspect the actual files and configuration. Editing a lower-priority file may not change the applicable guidance for that scope.
Can I ask Codex which instructions it loaded?
Yes, as a diagnostic. Compare its response with the documented path, applicable files and a harmless distinctive rule. Treat the response as reported context, not a security attestation or proof of future compliance.
Why might a nested file not affect the current task?
Check the actual working directory, project-root discovery, applicable scope and overriding files. Match those facts to current documentation. A file's presence somewhere in the repository does not establish that it belongs to the current instruction chain.
Can a long instruction file be truncated?
Check the configured project-document size limit and the combined guidance against current documentation. Keep essential instructions concise and scoped. Record the configuration and expected files rather than assuming a universal limit for every installation.
Does loading AGENTS.md prevent unsafe commands?
Loading guidance does not independently remove execution authority. Verify credentials, permissions, isolation and supported action controls separately. A successful convention check is not evidence that every prohibited effect is technically constrained.