AI Rules Sync (AIS) Synchronize, manage, and share your agent rules (Cursor rules, Cursor commands, Cursor skills, Cursor agents, Copilot instructions, Claude skills and agents, Trae rules and skills) with ease.
AIS allows you to centrally manage rules in Git repositories and synchronize them across projects using symbolic links. Say goodbye to copy-pasting .mdc files and drifting configurations.
- 🧩 Multi-Repository & Decentralized: Mix and match rules from various sources—company standards, team-specific protocols, or open-source collections—without conflict.
- 🔄 Sync Once, Update Everywhere: Define your rules in one place. AIS ensures every project stays in sync with the latest standards automatically.
- 🤝 Seamless Team Alignment: Enforce shared coding standards and behaviors across your entire team. Onboard new members instantly with a single command.
- 🔒 Privacy First: Need project-specific overrides or private rules? Use
ai-rules-sync.local.jsonto keep sensitive rules out of version control. - 🛠️ Integrated Git Management: Manage your rule repositories directly through the CLI. Pull updates, check status, or switch branches without leaving your project context using
ais git. - 🔌 Plugin Architecture: Built with a modular adapter system, making it easy to add support for new AI tools in the future.
| Tool | Type | Default Source Directory | Target Directory |
|---|---|---|---|
| Cursor | Rules | .cursor/rules/ |
.cursor/rules/ |
| Cursor | Commands | .cursor/commands/ |
.cursor/commands/ |
| Cursor | Skills | .cursor/skills/ |
.cursor/skills/ |
| Cursor | Agents | .cursor/agents/ |
.cursor/agents/ |
| Copilot | Instructions | .github/instructions/ |
.github/instructions/ |
| Claude | Skills | .claude/skills/ |
.claude/skills/ |
| Claude | Agents | .claude/agents/ |
.claude/agents/ |
| Trae | Rules | .trae/rules/ |
.trae/rules/ |
| Trae | Skills | .trae/skills/ |
.trae/skills/ |
npm install -g ai-rules-syncBy default, AIS looks for rules in the official tool configuration paths:
.cursor/rules/for Cursor rules.cursor/commands/for Cursor commands.cursor/skills/for Cursor skills.cursor/agents/for Cursor agents.github/instructions/for Copilot instructions.claude/skills/for Claude skills.claude/agents/for Claude agents.trae/rules/for Trae rules.trae/skills/for Trae skills
You can customize these paths by adding an ai-rules-sync.json file to your rules repository:
{
"rootPath": "src",
"sourceDir": {
"cursor": {
"rules": ".cursor/rules",
"commands": ".cursor/commands",
"skills": ".cursor/skills",
"agents": ".cursor/agents"
},
"copilot": {
"instructions": ".github/instructions"
},
"claude": {
"skills": ".claude/skills",
"agents": ".claude/agents"
},
"trae": {
"rules": ".trae/rules",
"skills": ".trae/skills"
}
}
}rootPath: Optional global prefix applied to all source directories (default: empty, meaning repository root)sourceDir.cursor.rules: Source directory for Cursor rules (default:.cursor/rules)sourceDir.cursor.commands: Source directory for Cursor commands (default:.cursor/commands)sourceDir.cursor.skills: Source directory for Cursor skills (default:.cursor/skills)sourceDir.cursor.agents: Source directory for Cursor agents (default:.cursor/agents)sourceDir.copilot.instructions: Source directory for Copilot instructions (default:.github/instructions)sourceDir.claude.skills: Source directory for Claude skills (default:.claude/skills)sourceDir.claude.agents: Source directory for Claude agents (default:.claude/agents)sourceDir.trae.rules: Source directory for Trae rules (default:.trae/rules)sourceDir.trae.skills: Source directory for Trae skills (default:.trae/skills)
Note: The old flat format (
cursor.rulesas string) is still supported for backward compatibility.
All commands support the following global options:
-t, --target <repo>: Specify the target rule repository to use (name or URL).
ais use [git repository url | repo name]If [git repository url] is not provided, it will search the repo name in the ~/.ai-rules-sync/config.json file.
ais listais cursor add [rule name] [alias]
# or explicitly:
ais cursor rules add [rule name] [alias]This command must be run in the root of your project.
It will generate a symbolic link from the rules git repository .cursor/rules/[rule name] folder to the project .cursor/rules/[rule name] folder.
If you provide an [alias], it will be linked to .cursor/rules/[alias]. This is useful for renaming rules or handling conflicts.
Adding Private Rules:
Use the -l or --local flag to add a rule to ai-rules-sync.local.json instead of ai-rules-sync.json. This is useful for rules that you don't want to commit to git.
ais cursor add react --localThis command will also automatically add ai-rules-sync.local.json to your .gitignore file.
Examples:
# Add 'react' rule as 'react'
ais cursor add react
# Add 'react' rule as 'react-v1'
ais cursor add react react-v1
# Add 'react' rule from a specific repo as 'react-v2'
ais cursor add react react-v2 -t other-repo
# Add 'react' rule directly from a Git URL
ais cursor add react -t https://github.com/user/rules-repo.gitais cursor commands add [command name] [alias]This syncs command files from the rules repository .cursor/commands/ directory to .cursor/commands/ in your project.
# Add 'deploy-docs' command
ais cursor commands add deploy-docs
# Add command with alias
ais cursor commands add deploy-docs deploy-docs-v2
# Remove a command
ais cursor commands remove deploy-docs-v2
# Install all commands from config
ais cursor commands installais cursor skills add [skill name] [alias]This syncs skill directories from the rules repository .cursor/skills/ directory to .cursor/skills/ in your project.
# Add 'code-review' skill
ais cursor skills add code-review
# Add skill with alias
ais cursor skills add code-review my-review
# Remove a skill
ais cursor skills remove my-review
# Install all skills from config
ais cursor skills installais cursor agents add [agent name] [alias]This syncs agent directories from the rules repository .cursor/agents/ directory to .cursor/agents/ in your project. Cursor agents are subagents defined with Markdown files containing YAML frontmatter.
# Add 'code-analyzer' agent
ais cursor agents add code-analyzer
# Add agent with alias
ais cursor agents add code-analyzer my-analyzer
# Remove an agent
ais cursor agents remove my-analyzer
# Install all agents from config
ais cursor agents installais copilot add [name] [alias]Default mapping: rules repo .github/instructions/<name> → project .github/instructions/<alias|name>.
Suffix matching:
- You may pass
foo,foo.md, orfoo.instructions.md. - If both
foo.mdandfoo.instructions.mdexist in the rules repo, AIS will error and you must specify the suffix explicitly. - If
aliashas no suffix, AIS preserves the source suffix (e.g.ais copilot add foo ymay createy.instructions.md).
ais claude skills add [skillName] [alias]Default mapping: rules repo .claude/skills/<skillName> → project .claude/skills/<alias|skillName>.
ais claude agents add [agentName] [alias]Default mapping: rules repo .claude/agents/<agentName> → project .claude/agents/<alias|agentName>.
ais trae rules add [ruleName] [alias]Default mapping: rules repo .trae/rules/<ruleName> → project .trae/rules/<alias|ruleName>.
ais trae skills add [skillName] [alias]Default mapping: rules repo .trae/skills/<skillName> → project .trae/skills/<alias|skillName>.
# Remove a Cursor rule
ais cursor remove [alias]
# Remove a Cursor command
ais cursor commands remove [alias]
# Remove a Cursor skill
ais cursor skills remove [alias]
# Remove a Cursor agent
ais cursor agents remove [alias]
# Remove a Copilot instruction
ais copilot remove [alias]
# Remove a Claude skill
ais claude skills remove [alias]
# Remove a Claude agent
ais claude agents remove [alias]
# Remove a Trae rule
ais trae rules remove [alias]
# Remove a Trae skill
ais trae skills remove [alias]
This command removes the symbolic link, the ignore entry, and the dependency from ai-rules-sync.json (or ai-rules-sync.local.json).
Import existing files/directories from your project to the rules repository:
# Import a Cursor rule
ais import cursor rules [name]
# or
ais cursor rules import [name]
# Import a Cursor command
ais import cursor commands [name]
# Import a Cursor skill
ais import cursor skills [name]
# Import a Cursor agent
ais import cursor agents [name]
# Import a Copilot instruction
ais import copilot instructions [name]
# Import a Claude skill
ais import claude skills [name]
# Import a Claude agent
ais import claude agents [name]
# Import a Trae rule
ais import trae rules [name]
# Import a Trae skill
ais import trae skills [name]Options:
-m, --message <message>: Custom git commit message-f, --force: Overwrite if entry already exists in repository-p, --push: Push to remote repository after commit-l, --local: Add to ai-rules-sync.local.json (private)
Examples:
# Import a local rule to the rules repository
ais import cursor rules my-custom-rule
# Import with custom commit message and push
ais import cursor rules my-rule -m "Add my custom rule" --push
# Overwrite existing entry in repository
ais cursor rules import my-rule --forceThe import command will:
- Copy the entry from your project to the rules repository
- Create a git commit with the entry
- Optionally push to remote (with
--push) - Replace the original with a symbolic link
- Add the dependency to your project config
The ai-rules-sync.json file stores Cursor rules, commands, and Copilot instructions separately. It supports both simple string values (repo URL) and object values for aliased entries.
{
"cursor": {
"rules": {
"react": "https://github.com/user/repo.git",
"react-v2": { "url": "https://github.com/user/another-repo.git", "rule": "react" }
},
"commands": {
"deploy-docs": "https://github.com/user/repo.git"
},
"skills": {
"code-review": "https://github.com/user/repo.git"
},
"agents": {
"code-analyzer": "https://github.com/user/repo.git"
}
},
"copilot": {
"instructions": {
"general": "https://github.com/user/repo.git"
}
},
"claude": {
"skills": {
"code-review": "https://github.com/user/repo.git"
},
"agents": {
"debugger": "https://github.com/user/repo.git"
}
},
"trae": {
"rules": {
"project-rules": "https://github.com/user/repo.git"
},
"skills": {
"ai-rules-adapter-builder": "https://github.com/user/repo.git"
}
}
}You can use ai-rules-sync.local.json to add private rules/instructions that are not committed to git. This file uses the same structure as ai-rules-sync.json and is merged with the main configuration (local takes precedence).
If you have an ai-rules-sync.json file in your project, you can install all entries with one command:
# Install all Cursor rules, commands, and skills
ais cursor install
# Install all Copilot instructions
ais copilot install
# Install all Claude skills and agents
ais claude install
# Install all Trae rules and skills
ais trae install
# Install everything (Cursor, Copilot, Claude, and Trae)
ais installIf your project has only one type (Cursor or Copilot) in the config file, you can omit the mode:
ais install
ais add <name>
ais remove <alias>This will automatically configure repositories and link entries.
Use git commands to manage the rules git repository.
ais git [command]Example: check status of a specific repository:
ais git status -t [repo name]- If
ai-rules-sync*.jsondoes not exist butcursor-rules*.jsonexists, AIS will read it temporarily (Cursor rules only). - Once you run a write command (e.g.
ais cursor add/remove), it will migrate and writeai-rules-sync*.jsonfor easy future removal of legacy code.
AIS supports shell tab completion for bash, zsh, and fish.
On first run, AIS will detect your shell and offer to install tab completion automatically:
🔧 Detected first run of ais
Shell: zsh (~/.zshrc)
Would you like to install shell tab completion?
[Y]es / [n]o / [?] help:
You can also install completion manually at any time:
ais completion installIf you prefer to add it manually:
Bash (add to ~/.bashrc):
eval "$(ais completion)"Zsh (add to ~/.zshrc):
eval "$(ais completion)"Fish (add to ~/.config/fish/config.fish):
ais completion fish | sourceAfter enabling, you can use Tab to complete rule names:
ais cursor add <Tab> # Lists available rules
ais cursor commands add <Tab> # Lists available commands
ais cursor skills add <Tab> # Lists available skills
ais cursor agents add <Tab> # Lists available agents
ais copilot add <Tab> # Lists available instructions
ais claude skills add <Tab> # Lists available skills
ais claude agents add <Tab> # Lists available agents
ais trae rules add <Tab> # Lists available rules
ais trae skills add <Tab> # Lists available skillsNote: If you encounter compdef: command not found errors, ensure your shell has completion initialized. For zsh, add this to your ~/.zshrc before the ais completion line:
# Initialize zsh completion system (if not already done)
autoload -Uz compinit && compinitAIS uses a plugin-based adapter architecture with unified operations:
CLI Layer
↓
Adapter Registry & Lookup (findAdapterForAlias)
↓
Unified Operations (addDependency, removeDependency, link, unlink)
↓
Sync Engine (linkEntry, unlinkEntry)
↓
Config Layer (ai-rules-sync.json via addDependencyGeneric, removeDependencyGeneric)
Key Design Principles:
- Unified Interface: All adapters (cursor-rules, cursor-commands, cursor-skills, cursor-agents, copilot-instructions, claude-skills, claude-agents, trae-rules, trae-skills) implement the same operations
- Auto-Routing: The
findAdapterForAlias()function automatically finds the correct adapter based on where an alias is configured - Generic Functions:
addDependencyGeneric()andremoveDependencyGeneric()work with any adapter viaconfigPathproperty - Extensible: Adding new AI tools only requires creating a new adapter and registering it in the adapter registry
This modular design makes it easy to add support for new AI tools (MCP, Windsurf, etc.) in the future without duplicating add/remove logic.
To add support for a new AI tool, follow these steps:
- Create a new adapter file (
src/adapters/my-tool.ts):
import { createBaseAdapter } from './base.js';
export const myToolAdapter = createBaseAdapter({
name: 'my-tool',
tool: 'my-tool',
subtype: 'configs',
configPath: ['myTool', 'configs'],
defaultSourceDir: '.my-tool/configs',
targetDir: '.my-tool/configs',
mode: 'directory',
// Optionally override resolveSource and resolveTargetName
});- Register the adapter in
src/adapters/index.ts:
import { myToolAdapter } from './my-tool.js';
// In DefaultAdapterRegistry constructor:
this.register(myToolAdapter);- Update ProjectConfig in
src/project-config.tsto include your tool's config section:
export interface ProjectConfig {
// ... existing fields ...
myTool?: {
configs?: Record<string, RuleEntry>;
};
}That's it! Your new adapter will automatically support add, remove, link, and unlink operations through the unified interface.