codex exec still injects AGENTS.md despite documented CODEX_DISABLE_PROJECT_DOC / --no-project-doc

Resolved 💬 3 comments Opened Apr 7, 2026 by jolestar Closed Apr 7, 2026

Summary

codex exec still includes AGENTS.md / project-doc instructions in the model-visible prompt even when the documentation says project docs can be disabled with --no-project-doc or CODEX_DISABLE_PROJECT_DOC=1.

I verified this on current main:

  • commit: 806e5f7c698595b5683da5e96335f4ce104424c5

Evidence

1. Documentation still advertises the setting

In codex-cli/README.md:

Disable loading of these files with --no-project-doc or the environment variable CODEX_DISABLE_PROJECT_DOC=1.

2. codex exec --help does not expose --no-project-doc

Running:

codex exec --help | rg "project-doc|AGENTS|no-project-doc|disable"

shows only generic --disable <FEATURE> and no --no-project-doc option.

3. I could not find the env var wired into the actual project-doc injection path

The project-doc injection path appears to be:

  • codex-rs/core/src/codex.rs -> get_user_instructions(&config)
  • codex-rs/core/src/project_doc.rs

get_user_instructions() / read_project_docs() appear to depend on config values like project_doc_max_bytes and cwd, but I could not find CODEX_DISABLE_PROJECT_DOC being consumed in that path.

4. Actual rollout still contains AGENTS instructions

I ran codex exec --json in a benchmark harness with:

  • isolated CODEX_HOME
  • CODEX_DISABLE_PROJECT_DOC=1
  • bundled skills disabled

The saved rollout still contains a model-visible user message beginning with:

# AGENTS.md instructions for /.../bench-0050-codex-openai

So at least in this path, the setting does not prevent AGENTS/project-doc injection.

Expected behavior

One of these should be true:

  1. CODEX_DISABLE_PROJECT_DOC=1 and/or --no-project-doc actually prevent project-doc / AGENTS.md injection for codex exec, or
  2. the docs should be corrected if this is no longer supported or only applies to a different entrypoint.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗