cd /news/ai-agents/how-to-keep-claude-md-agents-md-and-… · home › topics › ai-agents › article
[ARTICLE · art-170731] src=gethrbr.com ↗ pub= topic=ai-agents verified=true sentiment=· neutral

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

A blog post outlines three approaches for keeping agent instruction files CLAUDE.md, AGENTS.md and .cursorrules in sync: making AGENTS.md the single source of truth with a one-line @AGENTS.md import in CLAUDE.md, generating each agent's file from one source using the open-source tools Ruler or rulesync paired with a pre-commit, husky, lefthook or CI hook, or using Harbor, which the post's author promotes as filling the gap sync leaves by capturing corrections made in sessions and serving at most three ranked rules per prompt. The post argues sync only copies what someone wrote and that every session loads the whole rulebook, and it pitches Harbor's npx harborloop init command and a GitHub App that reviews each pull request against those rules and the CLAUDE.md, AGENTS.md and .claude/rules files.

by read5 min views1 publishedNov 16, 2026
How to keep CLAUDE.md, AGENTS.md and .cursorrules in sync
Image: Gethrbr (auto-discovered)

Blog

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?). 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 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 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.

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 ).

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 yourCLAUDE.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, or the 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 fromCLAUDE.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.

── more in #ai-agents 4 stories · sorted by recency
── more on @.cursorrules 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-keep-claude-m…] indexed:0 read:5min 2026-11-16 · —