Skip to content

Give multi-repo Codex runs every repository's AGENTS.md - #2077

Open
ppXD wants to merge 1 commit into
fix/point-claude-runs-at-scoped-rules-and-nested-memoryfrom
fix/give-multi-repo-codex-every-agents-md
Open

ppXD wants to merge 1 commit into
fix/point-claude-runs-at-scoped-rules-and-nested-memoryfrom
fix/give-multi-repo-codex-every-agents-md

Conversation

@ppXD

@ppXD ppXD commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • The gap. Codex 0.142.2 reads a project doc from its cwd and the directories above it, never from one below. A multi-repo run works at the workspace root, which is no repository, so no repository's AGENTS.md reached the model. Claude runs at the same root load every repository's memory.
  • The fix. When the cwd is not itself a repository, CodexRepositoryGuides gives each repository strictly inside it the doc Codex itself would pick at its root.
    • An AGENTS.override.md wins over AGENTS.md, whether it is a file or a link, even an empty one.
    • The doc is cut at 32 KiB (project_doc_max_bytes) and decoded lossily.
    • CodexHarness appends each doc after the persona and the operating contract in CODEX_HOME/AGENTS.md, under --- project-doc (<repository>/<file>) ---. There it reaches the model in the same instruction block as a single-repo project doc.
    • An @ path, ~ path or $skill in a doc attaches nothing.
  • Containment.
    • A doc that resolves outside the workspace is left out, checked with PhysicalPath, the walker Claude's memory guard uses. So is one whose repository path holds characters the separator cannot carry.
    • Files open no-follow, non-blocking and only if regular.
    • What was left out or cut is said once through the launch notices.
    • A run whose cwd is a repository writes the same AGENTS.md as before.

Test plan

  • Unit: the full suite passes (12083 passed, 1 skipped). Cases cover:
    • single-repo AGENTS.md byte-identical;
    • appendix format and order;
    • override precedence;
    • the truncation notice;
    • an outside link refused;
    • MaxProjectDocBytes pinned.
  • Integration (Postgres): RealHarnessCodexMultiRepoGuidesTests with RealHarnessWorkspaceMemoryTests, 9/9.
  • E2E on macOS, real Codex 0.142.2 and Claude 2.1.263: RepositoryConfigE2ETests 15/15. The workflow's repository-config gate, run against the TRX, prints All 15 repository-config E2E cases and 15 markers ran and passed.
    • A_multi_repo_codex_run_reads_every_repositorys_agents_md requires the first repository's doc and the second's override in the first request's instruction block, after the contract, each once.
    • The second repository's plain doc and the third's outside-linked doc reach no request. The outside target now sits under /etc, where a confined run could still read it, so in the root lane too its absence is the containment check's doing.
    • The single-repo Codex arm requires its repository's doc exactly once.
  • CI root sandbox lane: floor 108, marker agents-md codex-cli multi-repo

Codex reads a project doc from its cwd and the directories above it,
never from one below. A multi-repo run works at the workspace root,
which holds each repository in a folder of its own and is no
repository itself, so since such runs can start no repository's
AGENTS.md reached the model. Claude runs at the same root load every
repository's memory.

When the cwd is not itself a repository, each repository strictly
inside it now gives the doc Codex itself would pick at its root, and
that doc is appended to the run's CODEX_HOME/AGENTS.md after the
persona and the operating contract, under
"--- project-doc (<repository>/<file>) ---". Against 0.142.2 that file
reaches the model in the same instruction block as a single-repo
run's project doc, and an @ path, a ~ path or a $skill in it attaches
nothing. The pick and the cut mirror the pinned CLI as observed: an
AGENTS.override.md wins whenever it is a file or a link, even an
empty one, and a doc is cut at 32 KiB (project_doc_max_bytes), decoded
lossily.

A doc that resolves outside the workspace is left out, checked with
the same physical-path walker as Claude's memory guard. So is one
whose repository's path holds characters the separator could not
carry. Files are opened no-follow, non-blocking and only if regular.
What was left out or cut is said once on the run's timeline through
the launch notices. A run whose cwd is a repository, single-repo or
at the primary repository, writes the same AGENTS.md as before:
Codex loads that doc itself.

The real-CLI E2E starts Codex at a root holding three repositories
and requires the first one's doc and the second one's override in
the first request's instruction block after the contract, each once.
The second's plain doc and the third's doc, linked to a file where a
confined run could still read it, must reach no request. The
single-repo arm now also requires its repository's doc exactly once.
Dropping the appendix, the containment check or the override
precedence fails the new arm, and appending the cwd repository's own
doc fails the single-repo arm. The sandbox lane's root floor moves to
108 and requires the new arm's marker.
@ppXD
ppXD force-pushed the fix/point-claude-runs-at-scoped-rules-and-nested-memory branch from 0af35b9 to a7c0bfb Compare October 6, 2026 18:49
@ppXD
ppXD force-pushed the fix/give-multi-repo-codex-every-agents-md branch from 0ba2b0c to 3b90677 Compare October 6, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant