Answers
Codex shares instructions across repos only through ~/.codex/AGENTS.md, one person at a time
Published
Codex shares instructions across repositories through one place: the global ~/.codex/AGENTS.md (or $CODEX_HOME/AGENTS.md), which loads first in every project, for the person whose machine it is on. OpenAI documents no organization-wide or managed instructions setting, so a team that wants the same rules everywhere has to put AGENTS.md in each repo and keep the copies in sync.
For Codex. Vendor facts are from the pages linked below, read on November 18, 2026.
The free ways
- For yourself: write cross-repo habits in
~/.codex/AGENTS.md. It loads in every project, untrusted ones included, and does not count toward the 32 KiB project budget. - For a team: keep the shared AGENTS.md in one repo and push it to the others with a sync action, or pull it with rulesync and a lockfile.
- Keep repo-specific lines in a nested AGENTS.md so the synced root file stays identical everywhere.
- Use
AGENTS.override.mdfor a temporary local change; it replaces only its own folder’s AGENTS.md. - If
CODEX_HOMEis set, the global file is in that folder, not~/.codex. Runecho $CODEX_HOMEwhen edits seem to have no effect.
# ~/.codex/AGENTS.md (loads first, in every project)
- Use pnpm, never npm.
- Open a PR; never push to main.The numbers
| Measure | Value | Source |
|---|---|---|
| Global instruction files Codex reads | 1, ~/.codex/AGENTS.md (or AGENTS.override.md) | Codex AGENTS.md docs |
| Project instruction budget | 32 KiB; the global file is not counted | Codex AGENTS.md docs |
| Public AGENTS.md files on GitHub | 1,142,784 | Harbor study, 18 Oct 2026 |
Study figures are weighted estimates from 1,935 CLAUDE.md and 1,970 AGENTS.md files sampled from public GitHub repositories on 18 October 2026, with GitHub's own counts for the totals. Every figure is in the study's CSV, and the method is in the study.
What the docs say
- Codex: Custom instructions with AGENTS.md: The global scope defaults to ~/.codex unless you set CODEX_HOME, so every repository inherits your working agreements. Codex reads AGENTS.override.md first and falls back to AGENTS.md. The page documents no organization or managed instructions.
Where Harbor fits
Harbor connects Claude Code, Codex, Cursor and GitHub Copilot (the CLI and VS Code agent mode; the cloud agent is not supported yet) through hooks and an MCP server. Through Codex’s hooks it serves the team’s rules in every repo and every teammate’s session, picked for the task, with nothing to sync. Codex runs a hook only after you trust it; harbor init records that trust. Each rule shows how often it was served and how often an answer cited it. A citation is evidence a rule was used, not proof it was obeyed.
Read next
- Sync AGENTS.md across repos
- Why Codex ignores AGENTS.md
- Share memory across Claude Code, Cursor and Codex
- Share CLAUDE.md rules across repos with ~/.claude/rules, a symlinked .claude/rules, or a managed CLAUDE.md
- Copilot organization instructions reach every repo, but only on GitHub.com and in code review
- Gemini CLI reads AGENTS.md only if context.fileName lists it; Antigravity CLI reads it by default
- Share Windsurf rules across repos with ~/.devin/rules, and with other agents through AGENTS.md
- Every answer, by agent and problem
Questions
Does Codex have global instructions?
Yes. ~/.codex/AGENTS.md, or AGENTS.md in the folder CODEX_HOME points to, loads first in every project, before the project files.
Can an organization set AGENTS.md for every Codex user?
OpenAI’s AGENTS.md page documents no organization or managed instructions setting as of 18 November 2026. Its managed configuration covers settings such as approvals and sandboxing, not instructions.
How do I share AGENTS.md across many repositories?
Sync it: push one file to every repo with a GitHub Action, or pull it with rulesync from a shared rules repo. Keep repo-specific lines in nested files so the shared one stays identical.