Codex CLI 0.34.0 ignores global preamble_path/instructions in interactive sessions; only repo-local AGENTS.md is honored

Resolved 💬 3 comments Opened Sep 13, 2025 by kstueve1 Closed Dec 1, 2025

Summary

  • Interactive Codex sessions do not load a global preamble from config or env. Only repo-local AGENTS.md is injected, which makes it impractical to enforce a single global policy across many repos.

Environment

  • Codex CLI: 0.34.0 (Homebrew), /opt/homebrew/bin/codex
  • macOS
  • Config: ~/.codex/config.toml with profile defaulted; preamble_path="/Users/Kevin.Stueve/gitrepositories/AGENTS.md"
  • Env: AGENTS_POLICY_HINT=/Users/Kevin.Stueve/gitrepositories/AGENTS.md
  • AGENTS.md sha256: c878c07901fcdd177dd9620edd737b49738024d63a72835b862b49128f87e7ed

Repro

  1. Ensure no repo-local AGENTS.md.
  2. Run codex in any repo.
  3. Send proof:42.

Expected

  • Preamble applied (optionally bannered); reply “AGENTS OK”.

Actual

  • No preamble is applied; reply is not “AGENTS OK”.
  • Adding a repo-local AGENTS.md does enforce the rules, confirming global injection is ignored.

What doesn’t work

  • preamble_path in ~/.codex/config.toml
  • ~/.codex/instructions.md
  • AGENTS_POLICY_HINT environment variable

Workaround that does work (partial)

  • Inject at launch: -c initial_messages=[{\"role\":\"system\",\"content\":\"<AGENTS.md content>\"}]
  • This allows textual routines like “proof:42” to work but does not trigger AGENTS on_start/rules/tool gating.

Request

  • Honor preamble_path (and/or ~/.codex/instructions.md) for all interactive session types (codex, exec, proto).
  • Respect AGENTS_POLICY_HINT as a fallback.
  • Add --preamble-path <file> flag to override per-run.
  • Avoid double-injection on resume.

Acceptance criteria

  • With only preamble_path set (no repo-local AGENTS.md), new interactive session injects the global preamble and “proof:42” yields exactly “AGENTS OK”.
  • Resume/continue doesn’t inject twice.
  • Parity across codex, codex exec, and codex proto.

Happy to test a pre-release that implements this and confirm with the “AGENTS OK” check.

View original on GitHub ↗

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