# How to Sync Agent Rules Across Multiple Platforms Using ai-website-cloner-template

> Easily sync agent rules across platforms with ai-website-cloner-template sync scripts. Maintain a single source of truth and automatically generate platform-specific agent rule files.

- Repository: [JCodesMore/ai-website-cloner-template](https://github.com/JCodesMore/ai-website-cloner-template)
- Tags: how-to-guide
- Published: 2026-06-29

---

**The ai-website-cloner-template repository maintains a single-source-of-truth in [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/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`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/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`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/scripts/sync-agent-rules.sh)** processes [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) and generates the standard agent instruction files used by most platforms.

The script performs three core operations:

1. **Import Resolution**: Reads [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) and expands any `@…` import statements into the actual referenced content, storing the result in `RESOLVED_CONTENT`.
2. **Multi-Platform Generation**: Writes the resolved content (prepended with an auto-generated header) to four platform-specific locations:
   - [`.github/copilot-instructions.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.github/copilot-instructions.md) for GitHub Copilot Chat
   - `.clinerules` for Cline and Roo Code
   - [`.continue/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.continue/rules/project.md) for Continue (includes a platform-specific front-matter block)
   - [`.amazonq/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.amazonq/rules/project.md) for Amazon Q
3. **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.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.claude/skills/clone-website/SKILL.md) for Claude Code
- [`GEMINI.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/GEMINI.md) for 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:

1. **Edit the source**: Modify [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) or any file it imports (e.g., `@docs/research/INSPECTION_GUIDE.md`).

2. **Generate platform files**: Run the rule synchronization script:

   ```bash
   bash scripts/sync-agent-rules.sh
   ```

3. **Generate skill files** (if applicable): If you modified Claude Code or Gemini-specific skills, run:

   ```bash
   node scripts/sync-skills.mjs
   ```

4. **Review changes**: Verify the generated files reflect your updates:

   ```bash
   git status
   git diff .github/copilot-instructions.md
   ```

5. **Commit and push**: Store both the source and generated files in version control:

   ```bash
   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`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.github/copilot-instructions.md) | GitHub Copilot Chat | Chat-scoped instructions |
| `.clinerules` | Cline / Roo Code | Project-wide behavior rules |
| [`.continue/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.continue/rules/project.md) | Continue IDE | Project-specific guides with front-matter |
| [`.amazonq/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.amazonq/rules/project.md) | Amazon Q | IDE-integrated assistant rules |
| [`.claude/skills/clone-website/SKILL.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.claude/skills/clone-website/SKILL.md) | Claude Code | Structured skill definition |
| [`GEMINI.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/GEMINI.md) | Gemini CLI | Command-line assistant instructions |

## Summary

- **Single source of truth**: All agent configurations originate from [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) in the repository root.
- **Automatic import resolution**: The scripts expand `@…` references so you can maintain modular documentation.
- **Two-script system**: Use [`scripts/sync-agent-rules.sh`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/scripts/sync-agent-rules.sh) for standard agents and `scripts/sync-skills.mjs` for 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`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.github/copilot-instructions.md), `.clinerules`, or other generated files will be overwritten the next time you run [`scripts/sync-agent-rules.sh`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/scripts/sync-agent-rules.sh). Always modify [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/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`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/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`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.continue/rules/project.md). The script handles these platform-specific formatting requirements while keeping the substantive rule content identical to other assistants.