Synchronize rules across AI coding assistants (Claude Code, Cursor, Gemini, OpenCode)
Project description
Agent Rules Sync
Synchronize your rules across Claude Code, Cursor, Gemini, and OpenCode in real-time.
Edit rules in any AI agent → they automatically sync to all other agents.
Installation
Works on macOS, Linux, and Windows (native + WSL).
Quick Install
Using pip:
pip install agent-rules-sync
Using uv (faster):
uv pip install agent-rules-sync
From source:
pip install git+https://github.com/dhruv-anand-aintech/agent-rules-sync.git
That's it! The daemon installs and starts automatically.
What Happens During Installation
- Daemon is installed as a system service (auto-starts on boot)
- Service starts immediately and runs in the background
- Rules sync automatically every 3 seconds
Platform-Specific Installation
macOS:
- Installs as launchd service (
com.local.agent-rules-sync) - Auto-starts on login
- Logs to
~/.config/agent-rules-sync/ - File:
~/Library/LaunchAgents/com.local.agent-rules-sync.plist
Linux:
- Installs as systemd user service (
agent-rules-sync.service) - Auto-starts on login
- Logs to
~/.config/agent-rules-sync/daemon.log - File:
~/.config/systemd/user/agent-rules-sync.service
Windows:
- Installs batch file to startup folder
- Auto-starts on next login
- Logs to
~/.config/agent-rules-sync/ - File:
~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/agent-rules-sync.bat
Usage
The daemon is already running!
After installation, the daemon runs automatically in the background. Just start editing.
1. Edit Rules Anywhere
Pick any location and edit:
# Edit Claude Code rules
nano ~/.claude/CLAUDE.md
# Edit Cursor rules
nano ~/.cursor/rules/global.mdc
# Edit Gemini rules
nano ~/.gemini/GEMINI.md
# Edit OpenCode rules
nano ~/.config/opencode/AGENTS.md
Just add or remove lines starting with -:
- rule 1
- rule 2
- rule 3
2. Changes Sync Automatically
Within 3 seconds, your changes appear in all other agents! No manual sync needed.
How It Works
- Daemon monitors all agent config files every 3 seconds
- Detects changes in any file (master or agents)
- Merges rules from all sources
- Syncs to all agents automatically
- Deduplicates identical rules
No User Master File
The master rules file is stored hidden in ~/.config/agent-rules-sync/RULES.md — you never need to touch it. Just edit your agent files!
Commands
The daemon runs automatically. These commands are for management:
# Check daemon status
agent-rules-sync status
# Watch mode (foreground, useful for debugging)
agent-rules-sync watch
# Stop daemon (it will auto-restart on next login)
agent-rules-sync stop
Backups
Every file change is automatically backed up with a timestamp.
View your backups:
ls -lah ~/.config/agent-rules-sync/backups/
Restore a previous version:
cp ~/.config/agent-rules-sync/backups/claude_20260125_014532.md ~/.claude/CLAUDE.md
For detailed backup information, see BACKUPS.md
To completely uninstall:
curl -fsSL https://raw.githubusercontent.com/dhruv-anand-aintech/agent-rules-sync/main/uninstall.sh | bash
When Changes Take Effect
Important: Different agents load configuration at different times. After Agent Rules Sync updates files, you may need to restart your agent for changes to take effect:
| Agent | What to Do |
|---|---|
| Claude Code | Restart the application or start a new session |
| Cursor | Changes apply automatically in new conversations |
| Gemini Antigravity | Run /memory refresh command or restart |
| OpenCode | Restart or start a new session |
For detailed technical information, see AGENT_FILE_RELOAD.md
Example Workflow
Terminal 1:
$ agent-rules-sync
Starting Agent Rules Sync daemon...
✓ Daemon started (PID: 12345)
Terminal 2:
$ echo "- use pydantic for validation" >> ~/.claude/CLAUDE.md
Within 3 seconds, the rule appears in:
~/.cursor/rules/global.mdc~/.gemini/GEMINI.md~/.config/opencode/AGENTS.md
✓ Done! No manual sync needed.
Features
✓ Bidirectional sync — rules can be added anywhere ✓ Auto-deduplication — same rule doesn't appear twice ✓ Automatic backups — timestamped backups before every change ✓ Fire and forget — daemon auto-starts and runs in background ✓ Zero config — works out of the box ✓ Real-time — syncs within 3 seconds ✓ Safe recovery — restore any previous version from backups
Merging Behavior
Rules are merged, not replaced. If you have:
Master: - rule A, - rule B
Claude: - rule A, - rule B, - rule C
After sync, all agents get: - rule A, - rule B, - rule C
No rules are lost!
Architecture
Your edits in any agent file
↓
Daemon detects change
↓
Merge all rules
↓
Update all agents
↓
Done! (rules synced everywhere)
Monitoring
Check status anytime:
$ agent-rules-sync status
======================================================================
Agent Rules Sync Status
======================================================================
📂 Config directory: ~/.config/agent-rules-sync
📄 Master Rules: ~/.config/agent-rules-sync/RULES.md
Hash: acfa47839976...
🤖 Claude Code
Path: ~/.claude/CLAUDE.md
Status: ✓ In sync
🤖 Cursor
Path: ~/.cursor/rules/global.mdc
Status: ✓ In sync
🤖 Gemini Antigravity
Path: ~/.gemini/GEMINI.md
Status: ✓ In sync
🤖 OpenCode
Path: ~/.config/opencode/AGENTS.md
Status: ✓ In sync
======================================================================
Logs
Daemon logs are stored in:
~/.config/agent-rules-sync/daemon.log
View recent activity:
tail -f ~/.config/agent-rules-sync/daemon.log
Troubleshooting
Daemon not syncing?
# Check status
agent-rules-sync status
# Check logs
tail ~/.config/agent-rules-sync/daemon.log
# Restart
agent-rules-sync stop
agent-rules-sync # Start again
Want to debug in foreground?
# Run in foreground instead of daemon
agent-rules-sync watch
Need to see what's backed up?
ls -la ~/.config/agent-rules-sync/backups/
How do I uninstall?
One-liner:
curl -fsSL https://raw.githubusercontent.com/dhruv-anand-aintech/agent-rules-sync/main/uninstall.sh | bash
Or manually:
agent-rules-sync stop # Stop daemon
pip uninstall -y agent-rules-sync # Remove package
rm -rf ~/.config/agent-rules-sync # Clean up config
Your agent rule files are preserved and not deleted!
Requirements
- Python 3.8+
- Claude Code, Cursor, Gemini, or OpenCode installed (at least one)
License
MIT License - see LICENSE file
Contributing
Contributions welcome! Feel free to submit issues and pull requests.
Support
- 🐛 Found a bug? Open an issue
- 💡 Have a feature idea? Start a discussion
- ❓ Questions? Check existing issues or create a new one
Repository
https://github.com/dhruv-anand-aintech/agent-rules-sync
Keep your AI agent rules in sync. Edit anywhere. Sync everywhere.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_rules_sync-1.0.0.tar.gz.
File metadata
- Download URL: agent_rules_sync-1.0.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d3ef91521bb0c736c16e11957bcd0dd7ffac5f5ef80f654710d74df6f79d38d
|
|
| MD5 |
3f8dfe62f21f5b6e7935f859f2d5de01
|
|
| BLAKE2b-256 |
4aeb0b953459434c5770ad2a0f105ae1fa39a03df7d03b63cff7ca2882ea13c6
|
File details
Details for the file agent_rules_sync-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agent_rules_sync-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
226688569cade70f2cd3abc84224f117d9d08af48fe081a6bf77caea429be96f
|
|
| MD5 |
190d3489897bf2df5b1868c0fdab1077
|
|
| BLAKE2b-256 |
5960715183fcc78a70813b76e6133c688c2cd0edc2f65704cee4760f3024d225
|