# How to keep CLAUDE.md, AGENTS.md and .cursorrules in sync

> Source: <https://gethrbr.com/blog/keep-claude-md-agents-md-cursorrules-in-sync>
> Published: 2026-11-16 00:00:00+00:00

Blog

# How to keep CLAUDE.md, AGENTS.md and .cursorrules in sync

Published

To keep `CLAUDE.md`, `AGENTS.md` and `.cursorrules` in sync, stop keeping three copies. Make `AGENTS.md` the one file and point `CLAUDE.md` at it, or generate every file from one source with ruler or rulesync and a pre-commit hook. Both fix the drift. Neither writes the rule a teammate taught their agent on Monday, which is the gap Harbor fills.

The drift is easy to miss. Someone fixes `CLAUDE.md`, nobody touches `.cursorrules`, and the teammate on Cursor keeps getting the old mistake. Here are the honest options, cheapest first.

## Option 1: one AGENTS.md, no tool

Make `AGENTS.md` the source of truth. Codex reads it natively, and Cursor and Copilot read it too. Put one line at the top of `CLAUDE.md`:

```
@AGENTS.md
```

Claude Code imports the file, so there is no second copy to drift, and `CLAUDE.md` keeps only what Claude alone needs ([does Claude Code read AGENTS.md?](https://gethrbr.com/blog/does-claude-code-read-agents-md)). Cursor treats the root `.cursorrules` file as legacy, so moving its lines into `AGENTS.md` removes a file instead of syncing it.

**Good fit if** you want zero tooling and the team is disciplined about editing one file. For many small teams this is all you need.

## Option 2: generate each file from one source

- [**Ruler**](https://github.com/intellectronica/ruler) keeps your rules in a`.ruler/` folder and writes each agent's file for you:`CLAUDE.md` ,`AGENTS.md` , Cursor rules and more. It can also hand out MCP server config.
- [**rulesync**](https://github.com/dyoshikawa/rulesync) does the same for rules, ignore files and MCP config, and can import the rule files you already have.

Pair either one with a **pre-commit**, **husky** or **lefthook** hook, or a CI job, that regenerates the files and fails when they drift. To carry the same rules to many repos, see [syncing AGENTS.md and CLAUDE.md across repos](https://gethrbr.com/blog/sync-agents-md-across-repos).

**Good fit if** you want a file per agent, your rules change rarely, and someone on the team is happy to own the source.

## What sync does not solve

- **Sync copies what someone wrote. It does not write the rule.** The lesson a teammate taught their agent on Monday is still in their head, or in their agent's memory on their laptop, until someone opens a file.
- **Every session loads the whole file.** A long rulebook goes into every session whether the task needs it or not, 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) ).

## Option 3: corrections that reach every agent, with Harbor

Harbor works from the other end. It does not generate rule files. When a teammate corrects their agent in a session, or the team decides something in a review thread, Slack or docs, Harbor keeps it as a rule, and every agent on the team gets it from then on: Claude Code, Cursor, Codex and Copilot, on any repo or machine the Space covers.

- **One command connects your agents:**`npx harborloop init` .
- **Only what fits.** Before each prompt, the agent gets at most three ranked rules matched to the task, plus any your team pinned as always on, not the whole rulebook.
- **You set the gate.** Every new rule can wait for a person to approve it, or only the ones that need one.
- **Checked on every pull request.** A GitHub App reviews each pull request against those rules and your`CLAUDE.md` ,`AGENTS.md` and`.claude/rules` files, read whole however long, from the base branch so a PR cannot rewrite them.

**Good fit if** your rules mostly come from fixing the agent, and you are tired of saying the same thing twice. See [what Harbor does](https://gethrbr.com/), or the [quickstart](https://gethrbr.com/docs/quickstart).

## Can I use both?

Yes. Keep `AGENTS.md`, ruler or rulesync for your checked-in files if you like them. Harbor imports the rule files you already have when you set it up, its reviewer reads them on every pull request, and it covers the corrections nobody got around to writing down.

## Quick pick

| You want | Use | 
|---|---|
| No tooling at all | One `AGENTS.md` , imported from`CLAUDE.md` | 
| A generated file per agent that never drifts | Ruler or rulesync, plus a pre-commit hook or CI | 
| Corrections that reach every agent without editing files, checked on PRs | Harbor | 

```
npx harborloop init
```

## Questions

### How do I keep CLAUDE.md, AGENTS.md and .cursorrules in sync across a small team?

Keep one copy. Make AGENTS.md the source of truth, which Codex, Cursor and Copilot read, and put @AGENTS.md at the top of CLAUDE.md so Claude Code imports it. Cursor treats .cursorrules as legacy, so move its lines into AGENTS.md. If you want a generated file per agent, use ruler or rulesync with a pre-commit hook or CI job that fails on drift.

### What is the best tool to share coding rules across Claude Code, Cursor and Codex?

For files: ruler keeps rules in a .ruler/ folder and writes each agent's file, and rulesync does the same and can import the files you have. For rules that come from correcting the agent: Harbor keeps each correction as a rule, through a gate you set, and serves it to Claude Code, Cursor, Codex and Copilot, at most three ranked rules per prompt.

### What is the difference between ruler and rulesync?

Both generate each agent's rule file from one source. Ruler works from a .ruler/ directory and can also hand out MCP server config. rulesync covers rules, ignore files and MCP config, and can import the rule files a repo already has.

### Can I use ruler or rulesync together with Harbor?

Yes. Keep your checked-in files generated as they are. Harbor imports them at setup, its GitHub App reviews each pull request against CLAUDE.md, AGENTS.md and .claude/rules read from the base branch, and it covers the corrections nobody wrote into a file.
