Blog
How do I use the same CLAUDE.md in all my projects?
Published
Put the rules in ~/.claude/CLAUDE.md. Claude Code loads that user file in every project on your machine, alongside each repo's own CLAUDE.md. The other agents each have their own: ~/.codex/AGENTS.md for Codex, User Rules for Cursor, personal instructions for Copilot Chat on GitHub.com. None of them reaches a teammate.
That is the short answer. Below: where each agent keeps its user-level file, how to keep one copy for Claude Code and Codex, how to share a set with only some repos, and what goes wrong when the home file and the repo file disagree. Facts are from each vendor's docs, read on 18 November 2026.
Where each agent keeps rules for all your projects
| Agent | Where | What it covers |
|---|---|---|
| Claude Code | ~/.claude/CLAUDE.md, plus any .md files in ~/.claude/rules/ | “Personal preferences for all projects”, shared with “only you” (memory docs) |
| Codex | ~/.codex/AGENTS.md, or AGENTS.override.md there if it exists. CODEX_HOME moves the folder | Every session, read before the project files (AGENTS.md guide) |
| Cursor | User Rules, under Customize, then Rules | All projects, in Agent (chat) only. Rules do not affect Tab (rules docs) |
| GitHub Copilot | Personal instructions, from your profile picture in Copilot Chat | Every Copilot Chat conversation on the GitHub website, and nowhere else (GitHub docs) |
In VS Code, Copilot has user-level instruction files as well; its custom instructions page lists the locations your setup supports.
What goes in the home file, and what does not
The home file is for you, not for the repo: your shell aliases, “explain the plan before a large edit”, the test data you like, the way you want commit messages written. A rule the whole team should follow belongs in the repo's file, where a teammate's agent reads it and a reviewer sees it change. If it lives only in your home folder, your agent follows it and theirs never hears of it.
When the home file and the repo file disagree
Nobody wins cleanly. Claude Code loads user rules before project rules, and the memory docs say “neither set overrides the other: if a user rule and a project rule conflict, Claude may follow either one, so keep the two consistent.” Each agent orders the layers its own way:
| Agent | On a conflict |
|---|---|
| Claude Code | Both load; Claude may follow either |
| Codex | Files closer to the working directory come later in the prompt, so the repo file overrides the home file |
| Cursor | Team Rules, then Project Rules, then User Rules; earlier sources take precedence |
| Copilot (GitHub.com) | Personal instructions take the highest priority, then repository, then organization |
So a personal “use npm” beats the repo's “use pnpm” in Copilot Chat, loses to it in Codex and Cursor, and is a coin toss in Claude Code. Keep the home file to things no repo has an opinion on, and the question never comes up.
One home file for Claude Code and Codex
Keep a single file and point both agents at it. In Claude Code, an import in a user-scope file loads without the approval dialog, because it is a file you wrote yourself:
# one file you edit, read by both agents mkdir -p ~/.codex # append, so an existing ~/.claude/CLAUDE.md is kept echo '@~/agent-rules.md' >> ~/.claude/CLAUDE.md # only if ~/.codex/AGENTS.md does not exist yet ln -s ~/agent-rules.md ~/.codex/AGENTS.md # check each one sees it codex --ask-for-approval never "Summarize the current instructions." # and in Claude Code: /context all, under Memory files
Codex's docs say nothing about symlinks either way, which is why the snippet ends with its check: the summary should echo your global guidance first. If it does not, copy the file instead. Write the import as @~/agent-rules.md, not as a sentence. In our scan of 1,935 public CLAUDE.md files, 6.4 percent point at AGENTS.md in a sentence instead of importing it (the study, data). A sentence works only if Claude decides to open the file; an import puts the text in context.
One case where this breaks: in Cowork sessions on the desktop, Claude Code skips an import in a user file that points outside the session's working directory, and skips a ~/.claude/CLAUDE.md that is itself a symlink. That is why the snippet imports rather than links on the Claude side.
Rules for some of your repos, not all
For a set that belongs to a few projects, such as your company's backend repos, Claude Code lets .claude/rules/ hold a symlink:
# a set of rules for some of your repos, not all of them ln -s ~/shared-claude-rules .claude/rules/shared
Two catches, both from the memory docs:
- A link that points outside the project counts as an external import, so the rules do not load until you approve external imports for that project, once, in a dialog at the start of a session.
- After approval, only linked rules without a
pathsfield load. A path-scoped rule behind a link stays off.
If you work across several worktrees of one repo, note that a gitignored CLAUDE.local.md exists only in the worktree you made it in. The docs' fix is an import from home, such as @~/.claude/my-project-instructions.md, in the project's file.
What a home file cannot do
- It stays on one machine. A new laptop, a cloud agent or a teammate starts without it.
- It is one more copy to keep current. Four agents means four places, unless you link them as above.
- It holds what you remembered to write. A correction you typed in a session last week is not in it unless you added it.
For rules a whole team shares across many repos, the answers are a sync job or each vendor's admin setting, compared in how to sync AGENTS.md and CLAUDE.md across repos.
Questions
How do I make a CLAUDE.md apply to all my projects?
Write it at ~/.claude/CLAUDE.md, or as .md files in ~/.claude/rules/. Claude Code loads both in every project on your machine, alongside each repo's own CLAUDE.md. They are personal: no teammate's agent reads them.
Is there a global AGENTS.md for Codex?
Yes. Codex reads AGENTS.md from its home folder, ~/.codex unless CODEX_HOME points elsewhere, and reads AGENTS.override.md there instead if it exists. The global file comes first, so project files later in the prompt override it.
What happens when my global CLAUDE.md conflicts with the project one?
Both load, and neither overrides the other. Anthropic's docs say Claude may follow either rule, so keep the two consistent. Codex lets the closer file win, Cursor puts Team, then Project, then User Rules, and Copilot on GitHub.com puts personal instructions first.
Can Claude Code and Codex share one global rules file?
Yes. Keep one file, import it from ~/.claude/CLAUDE.md with a line like @~/agent-rules.md, and link or copy it to ~/.codex/AGENTS.md. Then ask Codex to summarize its current instructions and run /context all in Claude Code to check both see it.