Answers
Share CLAUDE.md rules across repos with ~/.claude/rules, a symlinked .claude/rules, or a managed CLAUDE.md
Published
Claude Code has three documented ways to share rules across repositories: ~/.claude/rules/ and ~/.claude/CLAUDE.md for one person on one machine, a shared rules folder symlinked into each repo’s .claude/rules/, or a managed CLAUDE.md that IT deploys to every developer machine. None of them reaches a teammate on Codex or Cursor.
For Claude Code. Vendor facts are from the pages linked below, read on November 18, 2026.
Pick by who needs the rules
- Just you, every repo: put rules in
~/.claude/rules/*.mdor~/.claude/CLAUDE.md. They load in every project on that machine. - The team, chosen repos: keep a shared rules repo and symlink it into each repo’s
.claude/rules/. Claude asks once per project to approve external imports, and only rules without apathsfield load. - The whole company: deploy a managed CLAUDE.md with MDM or Ansible. Developers cannot exclude it with
claudeMdExcludes. - Or import a shared file from each CLAUDE.md with an absolute path, such as
@/opt/team-rules/rules.md; imports take relative and absolute paths. - Network paths do not work: a symlink to a UNC share or a path under /net is not followed.
# macOS managed CLAUDE.md
/Library/Application Support/ClaudeCode/CLAUDE.md
# Linux and WSL
/etc/claude-code/CLAUDE.md
# Windows
C:\Program Files\ClaudeCode\CLAUDE.mdThe numbers
| Measure | Value | Source |
|---|---|---|
| Import depth | Up to four hops | Claude Code memory docs |
| Root AGENTS.md files with a CLAUDE.md beside them, two files to keep per repo | 36.5% (weighted) | Harbor study, 18 Oct 2026 |
| Public CLAUDE.md files on GitHub | 839,680 | 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
- Claude Code memory docs, share rules across projects: The .claude/rules/ directory supports symlinks, so you can maintain a shared set of rules and link them into multiple projects. Linked rules outside the working directory load only after you approve external imports for the project.
- Claude Code memory docs, organization-wide CLAUDE.md: Organizations can deploy a centrally managed CLAUDE.md that applies to all users on a machine, distributed with MDM, Group Policy or Ansible. It cannot be excluded with claudeMdExcludes.
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. A rule saved once reaches every teammate’s session in every repo, in Claude Code and the other three agents, with nothing to symlink or deploy. Rules can be scoped to a Space, so a payments rule reaches only the people on that Space. 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 and CLAUDE.md across repos
- Claude Code team memory
- Should you commit CLAUDE.md?
- Codex shares instructions across repos only through ~/.codex/AGENTS.md, one person at a time
- 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
How do I share one CLAUDE.md across all my repositories?
For yourself, ~/.claude/CLAUDE.md or ~/.claude/rules/ loads in every project. For a team, symlink a shared rules folder into each repo’s .claude/rules/ or import it with @path. For a company, deploy a managed CLAUDE.md.
Where does the managed CLAUDE.md go?
macOS: /Library/Application Support/ClaudeCode/CLAUDE.md. Linux and WSL: /etc/claude-code/CLAUDE.md. Windows: C:\Program Files\ClaudeCode\CLAUDE.md. Managed settings can also carry the text in a claudeMd key.
Do symlinked rules in .claude/rules load automatically?
Not when the target is outside the working directory. Claude Code asks once per project to approve external imports, and after that only rules without a paths field load.
Does a shared CLAUDE.md reach teammates on Codex or Cursor?
Not on its own. Codex reads CLAUDE.md only if it is listed in project_doc_fallback_filenames. Put shared rules in AGENTS.md and import it from CLAUDE.md to cover both.