Keep your multiple AI agent documentation files in sync across repositories — without the overhead.
- Overview
- Features
- Installation
- Quick Start
- Configuration
- Usage
- Development
- Architecture
- Contributing
- License
- Support
AgentSync is a command-line tool built with OCaml that synchronizes multiple AI agent documentation files (e.g., CLAUDE.md, GEMINI.md) to a single canonical document (AGENT_GUIDE.md) using symbolic links. This ensures all agent files remain identical without duplication or drift.
When working with multiple AI agents (Claude, Gemini, Copilot, etc.), developers often need to maintain separate documentation files for each agent. This leads to:
- Content drift: Files become inconsistent over time
- Duplication: Same content maintained in multiple places
- Merge conflicts: Manual synchronization is error-prone
- Maintenance overhead: Updates must be applied to multiple files
AgentSync solves these problems by:
- Single source of truth: Only
AGENT_GUIDE.mdcontains actual content - Symbolic link synchronization: All agent files are symbolic links to the main guide
- Atomic updates: Changes to any agent file instantly reflect everywhere
- Automatic recovery: Detects and repairs broken links with content merging
| Feature | Description |
|---|---|
| Symbolic Link Synchronization | Uses filesystem symbolic links for atomic, safe, and efficient synchronization |
| System-wide Project Registry | JSON-based registry for tracking all agent-sync projects across the system |
| Automatic Project Registration | Projects are automatically registered during init and repair operations |
| TOML Configuration | Simple, human-readable .agent-sync.toml configuration file |
| Project-Aware CLI | Run commands from any subdirectory — automatically detects project root |
| Comprehensive Link Status | Detailed link verification and reporting for all agent files |
| Atomic Operations | Safe operations with proper error handling and rollback capabilities |
| Cross-Platform | Works on Linux, macOS, and other Unix-like systems |
| Minimal Dependencies | Lightweight implementation with few runtime dependencies |
| Type-Safe | Built with OCaml for reliability and performance |
- OCaml (5.0 or higher)
- Dune build system
- OPAM package manager
- Unix-like operating system (Linux, macOS, etc.)
# Clone the repository
git clone https://github.com/gowaylee/agent-sync.git
cd agent-sync
# Install dependencies
opam install dune cmdliner toml yojson ounit2
# Build the project
dune build
# Run tests
dune runtest
# Install locally
dune install# Check if agent-sync is installed
agent-sync --version
# Show help information
agent-sync help# Navigate to your project directory
cd /path/to/your/project
# Initialize agent-sync configuration
agent-sync initThis creates:
.agent-sync.tomlconfiguration fileAGENT_GUIDE.md(empty template)- Sets up the project for agent file management
- Automatically registers the project in the system-wide registry
# Add Claude agent documentation
agent-sync add claude "CLAUDE.md"
# Add Gemini agent documentation
agent-sync add gemini "GEMINI.md"
# Add multiple agents at once
agent-sync add copilot "COPILOT.md"
agent-sync add qwen "QWEN.md"# Check the status of all agent links
agent-sync status
# Expected output:
# Project: /path/to/your/project
# Main guide: AGENT_GUIDE.md
# Configured agents:
# claude -> CLAUDE.md [✓ Linked (target: AGENT_GUIDE.md)]
# gemini -> GEMINI.md [✓ Linked (target: AGENT_GUIDE.md)]
# copilot -> COPILOT.md [✓ Linked (target: AGENT_GUIDE.md)]
# qwen -> QWEN.md [✓ Linked (target: AGENT_GUIDE.md)]# Edit any agent file - changes reflect everywhere
echo "# Project Overview" > CLAUDE.md
# Verify all files are identical
cat CLAUDE.md GEMINI.md AGENT_GUIDE.md
# Check system-wide project registry
agent-sync status --allAgentSync uses a TOML configuration file named .agent-sync.toml in your project root:
[core]
main_guide = "AGENT_GUIDE.md"
[agents]
claude = "CLAUDE.md"
gemini = "GEMINI.md"
copilot = "COPILOT.md"
qwen = "QWEN.md"
crush = "CRUSH.md"| Section | Option | Description | Required |
|---|---|---|---|
[core] |
main_guide |
Path to the main guide file | Yes |
[agents] |
<agent_name> |
Mapping from agent name to filename | Yes |
[core]
main_guide = "AGENT_GUIDE.md"
[agents]
claude = "CLAUDE.md"
gemini = "GEMINI.md"[core]
main_guide = "AGENT_GUIDE.md"
[agents]
claude = "CLAUDE.md"
gemini = "GEMINI.md"
copilot = "COPILOT.md"
qwen = "QWEN.md"
crush = "CRUSH.md"
chatgpt = "CHATGPT.md"[core]
main_guide = "docs/AGENT_GUIDE.md"
[agents]
claude = "docs/agents/CLAUDE.md"
gemini = "docs/agents/GEMINI.md"
copilot = "docs/agents/COPILOT.md"Initialize a new AgentSync project.
# Initialize in current directory
agent-sync initAdd a new agent file mapping.
# Add a new agent
agent-sync add <agent_name> <filename>
# Examples
agent-sync add claude "CLAUDE.md"
agent-sync add gemini "docs/GEMINI.md"Show current project status and agent link status.
# Show current project status
agent-sync status
# Show all registered projects system-wide
agent-sync status --allRepair broken agent file links with content merging.
# Repair all agent files
agent-sync repairShow usage information and command help.
# Show general help
agent-sync help# 1. Navigate to project
cd my-new-project
# 2. Initialize AgentSync (automatically registers project)
agent-sync init
# 3. Add required agents
agent-sync add claude "CLAUDE.md"
agent-sync add gemini "GEMINI.md"
agent-sync add copilot "COPILOT.md"
# 4. Verify setup
agent-sync status
# 5. Start using your agent files
echo "# My Project" > AGENT_GUIDE.md
# 6. Check system-wide registry
agent-sync status --all# Check status
agent-sync status
# If links are broken, repair them (also registers project)
agent-sync repair
# Verify repair
agent-sync status
# Confirm project is in registry
agent-sync status --all# List all registered projects with validation status
agent-sync status --all
# Work on specific project
cd /path/to/project
agent-sync status
# Repair specific project (automatically registers in registry)
cd /path/to/project
agent-sync repair# Clone the repository
git clone https://github.com/gowaylee/agent-sync.git
cd agent-sync
# Create local OPAM switch
opam switch create . 5.0.0 --deps-only
# Build the project
dune build
# Run tests
dune runtest
# Install locally for development
dune install# Build the project
dune build
# Run all tests
dune runtest
# Run specific test
dune exec ./test/test_agent_sync.exe
# Format code
ocamlformat -i lib/*.ml test/*.ml
# Type check
dune build @check
# Generate documentation
dune build @doc- Use
ocamlformatwith Jane Street profile - Format before committing:
ocamlformat -i lib/*.ml test/*.ml - Use
.ocamlformatconfiguration file
- Modules:
PascalCase(e.g.,Config,LinkManager) - Functions:
snake_case(e.g.,load_config,create_link) - Variables:
snake_case - Constants:
UPPER_SNAKE_CASE
- Use
Resulttype for operations that can fail - Pattern match on results explicitly
- Provide meaningful error messages
Tests are located in the test/ directory and use the OUnit2 framework:
# Run all tests
dune runtest
# Run specific test file
dune exec ./test/test_config_load.exe
# Run test with verbose output
dune runtest --verbose| Module | Description | Key Responsibilities |
|---|---|---|
| Config | lib/config.ml |
TOML configuration parsing and validation |
| Project | lib/project.ml |
Project detection and root directory management |
| CLI | lib/cli.ml |
Command-line interface and command dispatch |
| LinkManager | lib/link_manager.ml |
Symbolic link operations and content merging |
| Registry | lib/registry.ml |
System-wide project indexing and tracking |
User Input → CLI → Config/Project → LinkManager → Filesystem Operations
↓
Registry ← Project Registration → System-wide Tracking
↓
Error Handling ← Result Types ← All Modules
- Single Source of Truth:
AGENT_GUIDE.mdis the only real file - Atomic Operations: Use symbolic links for filesystem-level atomicity
- Error Recovery: Graceful handling of broken links and conflicts
- System-wide Tracking: Automatic project registration and registry management
- Type Safety: Leverage OCaml's type system for reliability
- Minimal Dependencies: Keep runtime dependencies lightweight
- Runtime:
cmdliner,toml,yojson,unix - Development:
dune,ocaml,ounit2 - Build: OCaml build system with Dune
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Follow the code style guidelines
- Add tests for new functionality
- Ensure all tests pass:
dune runtest - Submit a pull request
- Description: Clearly describe the changes and why they're needed
- Testing: Include how you tested your changes
- Documentation: Update documentation if needed
- Format: Ensure code is properly formatted
- Review: Address review comments promptly
- Code Style: Follow existing conventions and use
ocamlformat - Testing: Add tests for new features and bug fixes
- Documentation: Update relevant documentation
- Breaking Changes: Clearly document any breaking changes
- Performance: Consider performance implications of changes
When reporting bugs or suggesting features:
- Use the GitHub issue tracker
- Provide clear, reproducible examples
- Include your environment information
- Check for existing issues first
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
This project depends on the following libraries:
- cmdliner: Command-line parsing
- toml: TOML configuration parsing
- yojson: JSON processing
- ounit2: Unit testing framework
Each library has its own license terms.
- Documentation: Read this README and project documentation
- Issues: Report bugs and request features on GitHub Issues
- Current Version: Check with
agent-sync --version - Compatibility: OCaml 5.0+ on Unix-like systems
- Updates: Follow the repository for updates and announcements
- Contributors: See the contributor list
- Stars: If you find this project useful, please consider giving it a star ⭐
- Share: Help spread the word about AgentSync
AgentSync - Keeping your AI agent documentation in sync, one symbolic link at a time.