How to Sync Agent Rules Across Multiple Platforms Using ai-website-cloner-template
The ai-website-cloner-template repository maintains a single-source-of-truth in AGENTS.md and uses two sync scripts to automatically generate platform-specific rule files for GitHub Copilot Chat, Cline, Continue, Amazon Q, Claude Code, and Gemini CLI.
Managing AI agent instructions across multiple coding assistants creates configuration drift and maintenance overhead. The ai-website-cloner-template solves this through an automated synchronization system that resolves imports and propagates changes from one central file to all supported platforms.
The Single-Source-of-Truth Architecture
At the heart of the synchronization system sits AGENTS.md, the canonical repository for all agent-specific rules and documentation. This file serves as the master record that feeds every AI assistant integration.
The file supports import statements using @… syntax (such as @docs/research/INSPECTION_GUIDE.md), which the sync scripts automatically resolve and inline during generation. This means you can modularize your documentation while still generating flat, platform-compatible rule files.
Sync Script Deep Dive
The repository provides two specialized scripts that handle different categories of AI assistants.
Rule Synchronization with sync-agent-rules.sh
The bash script at scripts/sync-agent-rules.sh processes AGENTS.md and generates the standard agent instruction files used by most platforms.
The script performs three core operations:
- Import Resolution: Reads
AGENTS.mdand expands any@…import statements into the actual referenced content, storing the result inRESOLVED_CONTENT. - Multi-Platform Generation: Writes the resolved content (prepended with an auto-generated header) to four platform-specific locations:
.github/copilot-instructions.mdfor GitHub Copilot Chat.clinerulesfor Cline and Roo Code.continue/rules/project.mdfor Continue (includes a platform-specific front-matter block).amazonq/rules/project.mdfor Amazon Q
- Idempotent Execution: Re-running the script overwrites existing generated files completely, ensuring no stale rules persist.
Skill Synchronization with sync-skills.mjs
The Node.js script at scripts/sync-skills.mjs handles the specialized skill formats required by Claude Code and Gemini CLI.
This script performs the same import resolution logic but targets different output paths:
.claude/skills/clone-website/SKILL.mdfor Claude CodeGEMINI.mdfor Gemini CLI
Both scripts preserve platform-specific formatting requirements (such as Continue's YAML front-matter) while ensuring the substantive rule content remains identical across all assistants.
Step-by-Step Workflow
To synchronize agent rules across all platforms after making changes:
-
Edit the source: Modify
AGENTS.mdor any file it imports (e.g.,@docs/research/INSPECTION_GUIDE.md). -
Generate platform files: Run the rule synchronization script:
bash scripts/sync-agent-rules.sh -
Generate skill files (if applicable): If you modified Claude Code or Gemini-specific skills, run:
node scripts/sync-skills.mjs -
Review changes: Verify the generated files reflect your updates:
git status git diff .github/copilot-instructions.md -
Commit and push: Store both the source and generated files in version control:
git add . git commit -m "Update agent rules" git push
Because the generated files are committed to the repository, CI/CD pipelines, Docker builds, and developer environments automatically receive the latest rule set upon cloning.
Generated Target Files
Running the sync scripts produces the following platform-specific outputs:
| Generated File | Platform | Purpose |
|---|---|---|
.github/copilot-instructions.md |
GitHub Copilot Chat | Chat-scoped instructions |
.clinerules |
Cline / Roo Code | Project-wide behavior rules |
.continue/rules/project.md |
Continue IDE | Project-specific guides with front-matter |
.amazonq/rules/project.md |
Amazon Q | IDE-integrated assistant rules |
.claude/skills/clone-website/SKILL.md |
Claude Code | Structured skill definition |
GEMINI.md |
Gemini CLI | Command-line assistant instructions |
Summary
- Single source of truth: All agent configurations originate from
AGENTS.mdin the repository root. - Automatic import resolution: The scripts expand
@…references so you can maintain modular documentation. - Two-script system: Use
scripts/sync-agent-rules.shfor standard agents andscripts/sync-skills.mjsfor Claude/Gemini skills. - Idempotent generation: Re-running scripts safely overwrites old generated files without manual cleanup.
- Version-controlled outputs: Committing generated files ensures all environments receive consistent rules automatically.
Frequently Asked Questions
What happens if I edit a generated file directly instead of AGENTS.md?
Any manual changes to .github/copilot-instructions.md, .clinerules, or other generated files will be overwritten the next time you run scripts/sync-agent-rules.sh. Always modify AGENTS.md or its imported dependencies to ensure changes persist.
Do I need to run both scripts every time I update AGENTS.md?
No. You only need to run scripts/sync-skills.mjs if you specifically modified the skill templates used by Claude Code or Gemini CLI. For standard rule updates affecting Copilot, Cline, Continue, or Amazon Q, running bash scripts/sync-agent-rules.sh is sufficient.
Can I use the sync scripts in a CI/CD pipeline?
Yes. Because the generated files are committed to the repository, CI runners automatically receive the latest rules when cloning the repo. However, you can also execute the scripts during build processes to verify that AGENTS.md parses correctly and all imports resolve before deployment.
Why does Continue use a different file format than other platforms?
Continue requires specific YAML front-matter headers in its rule files, which the sync script automatically injects when writing to .continue/rules/project.md. The script handles these platform-specific formatting requirements while keeping the substantive rule content identical to other assistants.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →