Skip to main content

Synchronize rules and skills across AI coding assistants (Claude Code, Cursor, Gemini, OpenCode, Codex)

Project description

agent-sync

Synchronize rules, skills, and settings across Claude Code, Cursor, Gemini, OpenCode, and Codex — in real-time.

Edit rules or skills in any AI agent → they automatically sync to all others. Global Claude settings propagate to configured repos for Claude Code web access.

Installation

Works on macOS, Linux, and Windows (native + WSL).

pip install agent-rules-sync
uv pip install agent-rules-sync   # faster

The daemon installs and starts automatically as a system service.

CLI

agent-sync                         # start/ensure daemon is running
agent-sync sync                    # one-shot sync: rules + skills + settings
agent-sync sync rules              # sync only CLAUDE.md / rules files
agent-sync sync skills             # sync only skills directories
agent-sync sync settings           # sync only .claude/settings.json + hooks
agent-sync sync rules skills       # multiple scopes
agent-sync setup                   # TUI wizard to configure sync directions
agent-sync status                  # daemon and sync status
agent-sync stop                    # stop daemon
agent-sync watch                   # watch in foreground (debugging)

agent-rules-sync also works as an alias for backwards compatibility.

What Gets Synced

1. Rules (CLAUDE.md, GEMINI.md, etc.)

Rules sync bidirectionally across all agent config files. Changes from any agent propagate to all others within 3 seconds.

# Shared Rules
- use pydantic for validation      ← syncs to all agents

## Claude Code Specific
- claude-specific rule             ← stays in Claude only

Monitored locations:

Agent Path
Claude Code ~/.claude/CLAUDE.md
Cursor ~/.cursor/rules/global.mdc (merged output); also reads every *.md / *.mdc in the same ~/.cursor/rules/ dir (subfolders except imported/). Strip YAML frontmatter before parsing.
Cursor (legacy) ~/.cursorrules plus <repo>/.cursorrules for each path in repo_paths.json — same body as global.mdc; Cursor still loads these (docs)
Gemini Antigravity ~/.gemini/GEMINI.md
OpenCode ~/.config/opencode/AGENTS.md
Codex ~/.codex/AGENTS.md
+ 4 more ~/.config/agents/AGENTS.md, ~/.config/AGENTS.md, ~/.agent/AGENTS.md, ~/.agent/AGENT.md

Repo-specific CLAUDE.md files can be added via repo_paths.json (see Configuration).

2. Skills

Skills are directories containing a SKILL.md file. Synced across all frameworks:

Framework Path
Claude Code ~/.claude/skills/
Cursor ~/.cursor/skills/, ~/.cursor/skills-cursor/
Codex ~/.codex/skills/
Gemini Antigravity ~/.gemini/antigravity/skills/
OpenCode ~/.config/opencode/skills/
Shared ~/.agents/skills/

Newest version wins. Add a skill anywhere and it appears everywhere within 3 seconds.

3. Settings & Hooks (Claude Code)

Syncs a portable version of ~/.claude/settings.json to configured repos' .claude/settings.json:

  • Strips machine-specific keys (statusLine, spinnerVerbs, remote, etc.)
  • Strips permission rules with absolute paths
  • Rewrites hook commands from ~/.claude/hooks/foo.sh.claude/hooks/foo.sh
  • Copies hook scripts into the repo's .claude/hooks/

This enables full tool permissions and hooks when using Claude Code web on those repos.

Configuration

Repo Paths

Add repos to sync rules, skills, and settings into:

~/.config/agent-rules-sync/repo_paths.json
["~/Code/my-project", "~/Code/another-repo"]

Each repo gets:

  • <repo>/CLAUDE.md — synced from global rules
  • <repo>/.cursorrules — legacy Cursor rules file; mirrored from the same content as global.mdc (optional; Cursor prefers .cursor/rules/)
  • <repo>/.claude/skills/ — synced from master skills
  • <repo>/.claude/settings.json — portable settings (auto-generated)
  • <repo>/.claude/hooks/ — hook scripts (copied from ~/.claude/hooks/)

Sync Directions

Configure per-component direction via agent-sync setup (TUI wizard) or edit directly:

~/.config/agent-rules-sync/sync_config.json
{
  "mode": "default",
  "components": {
    "rules":    { "direction": "bidirectional", "enabled": true },
    "skills":   { "direction": "bidirectional", "enabled": true },
    "settings": { "direction": "push",          "enabled": true },
    "hooks":    { "direction": "push",           "enabled": true }
  }
}

Directions:

Direction Behavior
bidirectional Newest version wins, syncs everywhere (default for rules/skills)
push Master → agents only (master is source of truth)
pull Agents → master only (aggregate, don't push back)

Settings and hooks only support push (they are generated from global config).

Settings Strip Rules

Customize which keys/paths are stripped when generating portable settings:

~/.config/agent-rules-sync/settings_sync.json
{
  "strip_keys": ["statusLine", "spinnerVerbs", "remote"],
  "strip_path_prefixes": ["/Users/", "/home/", "/opt/homebrew/"],
  "sync_hooks": true,
  "hook_script_dir": ".claude/hooks"
}

Setup Wizard

Run agent-sync setup for a guided TUI to configure sync directions:

┌──────────────────────────────────────────────────────────┐
│ agent-sync  ·  Setup Wizard                              │
└──────────────────────────────────────────────────────────┘

  ── Sync Mode ───────────────────────────────────────────

  default       Rules/skills are bidirectional (newest wins).
                Settings/hooks push from global → repos.

  per_component Configure each component independently.

  Choice [1-2] (Enter = default):

Commands Reference

agent-sync sync [rules] [skills] [settings] [all]
Scope What it syncs
rules Rules files (CLAUDE.md, GEMINI.md, etc.) across all agents
skills Skill directories across all frameworks + configured repos
settings ~/.claude/settings.json → repo .claude/settings.json + hooks
all All of the above (default when no scope given)

How It Works

~/.claude/settings.json         ~/.claude/CLAUDE.md        ~/.claude/skills/
        │                               │                         │
        │  strip machine-specific       │  merge shared +         │  newest
        │  rewrite hook paths           │  agent-specific         │  version
        ▼                               ▼                         ▼
  repo/.claude/             all agent CLAUDE.md          all framework
  settings.json             GEMINI.md AGENTS.md          skills/ dirs
  hooks/                    (9+ locations)               (6+ locations)

Daemon watches all locations every 3 seconds. Changes trigger immediate sync.

Backups

Every file change is backed up with a timestamp:

~/.config/agent-rules-sync/backups/     ← rules backups
~/.config/agent-rules-sync/skill_backups/  ← skills backups

Restore any version:

cp ~/.config/agent-rules-sync/backups/claude_20260125_014532.md ~/.claude/CLAUDE.md

Troubleshooting

agent-sync status              # check daemon + sync status
tail -f ~/.config/agent-rules-sync/daemon.log   # live logs
agent-sync stop && agent-sync  # restart daemon
agent-sync watch               # run in foreground for debugging

Uninstall

curl -fsSL https://raw.githubusercontent.com/dhruv-anand-aintech/agent-rules-sync/main/uninstall.sh | bash

Or manually:

agent-sync stop
pip uninstall -y agent-rules-sync
rm -rf ~/.config/agent-rules-sync

Agent rule files and repos are not touched.

Requirements

  • Python 3.8+
  • macOS, Linux, or Windows

License

MIT — see LICENSE


Edit anywhere. Sync everywhere.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_rules_sync-1.4.6.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_rules_sync-1.4.6-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file agent_rules_sync-1.4.6.tar.gz.

File metadata

  • Download URL: agent_rules_sync-1.4.6.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_rules_sync-1.4.6.tar.gz
Algorithm Hash digest
SHA256 f16334ae10b2c2df3a67b53ffca79e755b0552bb9895c26a10b687ae55309ee8
MD5 304267ddeb7c8e6373656ed74902dc50
BLAKE2b-256 3a6af1fe0d8bf369804dbc640727dad372d0ac2c4485c25a9e7de5dca78c1e9f

See more details on using hashes here.

File details

Details for the file agent_rules_sync-1.4.6-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_rules_sync-1.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d5a79167122792e0d9b16ce3ff69e0a27139fb4cac97d4c5becd3f47f6f1f619
MD5 cef83a2bf9a6d93ed9a0ce878061e10c
BLAKE2b-256 d0df9377e1279824473459235fa757455871317e3544dc50f621dcbdd6098cf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page