# How to sync AGENTS.md and CLAUDE.md across all your repos

> Source: <https://gethrbr.com/blog/sync-agents-md-across-repos>
> Published: 2026-11-13 00:00:00+00:00

Blog

# How to sync AGENTS.md and CLAUDE.md across all your repos

Published: November 13, 2026

To sync `AGENTS.md` and `CLAUDE.md` across repos, keep the shared rules in one repository and send them to every other repo as a pull request: either a GitHub Action that copies the file out on each push, or rulesync, which installs rules from a shared repo and writes each agent's file. Put the shared text in `AGENTS.md`, and have each `CLAUDE.md` import it, so you sync one file, not two.

## Sync one file: AGENTS.md

Codex, Cursor and Copilot read `AGENTS.md`. Claude Code reads it when the repo has no `CLAUDE.md`, and otherwise through a line that says `@AGENTS.md` at the top of the `CLAUDE.md` ([Does Claude Code read AGENTS.md?](https://gethrbr.com/blog/does-claude-code-read-agents-md)). So the shared rules belong in `AGENTS.md`, and `CLAUDE.md` keeps the import plus anything only Claude needs. Which file each tool reads is in [AGENTS.md vs CLAUDE.md](https://gethrbr.com/blog/agents-md-vs-claude-md).

## Push: a GitHub Action that opens a pull request in every repo

[repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) runs in the rules repo on every push and copies the files you list into the repos you list. By default it opens a pull request in each one, so every team still decides what merges:

```
# .github/sync.yml in your rules repo
group:
  - files:
      - source: AGENTS.md
        dest: AGENTS.md
    repos: |
      acme/payments
      acme/web
      acme/api
```

- **It needs its own token.** The default`GITHUB_TOKEN` cannot write to other repos. Its README asks for a personal access token with full repo scope, or a GitHub App installation token.
- **It copies the whole file.** A repo's own root rules are overwritten on the next sync, so this suits repos whose root rules are all shared. To mix in each repo's own, use rulesync, below.
- **Check it is still maintained.** Its last release, v1.21.1, is from May 2024. A short workflow of your own with`gh pr create` does the same job.

## Pull: rulesync and a shared rules repo

[rulesync](https://github.com/dyoshikawa/rulesync) is a command-line tool that writes the rules file for each agent (Claude Code, Codex, Cursor, Copilot and dozens more) from one source in a `.rulesync/` folder. It can also pull rules from another GitHub repo and pin them in a lockfile:

```
# in each repo, once
npx rulesync add acme/ai-standards --rules team-rules
npx rulesync install && npx rulesync generate

# in CI: fail when this repo is behind the shared rules
npx rulesync install --outdated
```

Each repo keeps its own rules next to the shared ones, and rulesync combines them into one `AGENTS.md`, so nothing is overwritten. The pull runs when someone runs it, so add the `--outdated` check to CI to see which repos are behind.

## Without touching the repos: each vendor's admin setting

An admin setting reaches every repo on a machine or in an organization, one tool at a time:

| Tool | Organization-wide instructions | Reaches | 
|---|---|---|
| Claude Code | A managed `CLAUDE.md` at`/Library/Application Support/ClaudeCode/` (macOS) or`/etc/claude-code/` (Linux), or a`claudeMd` key in managed settings | Every session on that machine. You ship the file with MDM or similar | 
| Codex | None documented. Managed configuration covers approvals, sandbox, network and telemetry | Each person's `~/.codex/AGENTS.md` is the closest thing | 
| Cursor | [Team Rules](https://gethrbr.com/blog/cursor-team-rules) , on Teams and Enterprise | Every member, and an admin can enforce them | 
| Copilot | Organization custom instructions, in the organization’s Copilot settings | Cloud sessions on GitHub and code review, not local sessions in an editor | 

That is three admin consoles, each on its own plan, and nothing for Codex, which is why most teams end up syncing a file anyway.

## What a sync does not do

- **Edits in one repo do not travel back.** Someone fixes a rule in`acme/web` , and the next sync either overwrites it or conflicts with it. Only edits made in the rules repo reach everyone.
- **Nobody writes the new rule down.** A correction typed in an agent session, or a review comment on a pull request, stays where it was said unless a person copies it into the rules repo.
- **A file grows until it stops working.** One shared file for every repo gets long, and agents follow a long file less well ([why a growing CLAUDE.md stops working](https://gethrbr.com/blog/why-growing-claude-md-stops-working) ).

## With Harbor: one source the agents read, no copies

Harbor keeps the team's rules in one place and hands them to Claude Code, Codex, Cursor and Copilot at the start of each session, through hooks that `npx harborloop init` installs, so there is no file in each repo to keep in step. Each session gets the rules that apply to its repo and task, not the whole set. New rules come from where the team already decides (agent sessions, pull request reviews, Slack threads and docs), and you set the gate on which go live without a person. The `AGENTS.md` and `CLAUDE.md` files you already have are imported when you set it up, and each of their rules waits for a person to review it ([rules files](https://gethrbr.com/docs/rules-files)). The steps are in the [quickstart](https://gethrbr.com/docs/quickstart), and the wider picture in [sharing memory across Claude Code, Codex and Cursor](https://gethrbr.com/blog/share-memory-claude-code-cursor-codex).

## Questions

### How do I share one AGENTS.md across many repositories?

Keep it in a rules repo and send it out as pull requests. A GitHub Action such as repo-file-sync-action copies the file into each repo you list on every push. rulesync instead lets each repo pull named rules from the shared repo, pins them in a lockfile and combines them with the repo's own.

### Do I need to sync CLAUDE.md as well as AGENTS.md?

No. Put the shared rules in AGENTS.md and start each CLAUDE.md with a line that says @AGENTS.md. Claude Code then reads the shared file, and CLAUDE.md keeps only what Claude alone needs. Claude Code also reads AGENTS.md by itself when a repo has no CLAUDE.md.

### Can an admin set CLAUDE.md for the whole organization?

Yes, per machine. Claude Code reads a managed CLAUDE.md from /Library/Application Support/ClaudeCode/ on macOS or /etc/claude-code/ on Linux, or a claudeMd key in managed settings, shipped to each machine with MDM or a similar tool. Developers cannot exclude it.

### Does Codex have organization-wide instructions?

Not in its docs as of 13 November 2026. Codex managed configuration covers approvals, sandbox, network and telemetry. Each person can keep ~/.codex/AGENTS.md for their own repos, and the shared text otherwise has to be in each repo's AGENTS.md.
