How to Sync Agent Rules Across Multiple Platforms for AI Website Cloning

The AI Website Cloner template maintains consistent AI agent behavior by using a single AGENTS.md file as the source of truth and a Bash script to generate platform-specific rule files for Copilot, Claude, Continue, and Amazon Q.

Managing AI coding agents across different platforms requires a centralized configuration strategy to prevent divergent behaviors. The JCodesMore/ai-website-cloner-template repository implements a robust synchronization mechanism that propagates rules from one master document to every supported agent. This ensures that whether you are using GitHub Copilot Chat, Claude CLI, or Continue, every AI assistant follows the exact same Website Inspection Guide and design token specifications.

The Single Source of Truth Pattern

The repository designates AGENTS.md as the canonical configuration file containing all AI agent instructions. Located at the repository root, this file holds the complete rule set including the "Next.js agent rules" banner, project description, and the extensive Website Inspection Guide (sections 68-148). Any modification to cloning workflows, token lists, or design guidelines is made exclusively in this file, establishing a single source of truth that prevents configuration drift.

How the Sync Script Resolves Imports and Generates Files

The scripts/sync-agent-rules.sh script orchestrates the synchronization process through a resolve_imports function. This function processes AGENTS.md and expands any lines starting with @ (such as @docs/research/INSPECTION_GUIDE.md) by inlining the referenced content directly into the output. This modular approach keeps the master file concise while ensuring the generated output is self-contained and complete.

Header Insertion and Idempotency

Each generated file receives an auto-generated header (<!-- AUTO‑GENERATED … -->) to prevent manual edits and signal that the file is derived content. The script is fully idempotent—running bash scripts/sync-agent-rules.sh multiple times rewrites all target files with the latest AGENTS.md content, guaranteeing that every platform stays perfectly synchronized with the current rule set.

Platform-Specific Target Files

The script generates tailored rule files for each supported platform, mapping the master content to each agent's expected file location and format:

The script creates missing directories automatically, ensuring seamless setup for new platforms without manual folder creation.

Usage Workflow

To sync agent rules across multiple platforms, modify the master file and execute the synchronization script.

  1. Edit AGENTS.md – Add new rules, modify existing conventions, or insert @import directives for external documentation.
  2. Run the sync script:
bash scripts/sync-agent-rules.sh

The script resolves all @ imports, prepends the auto-generated header, and writes updated content to each platform's rule file.

  1. Commit the regenerated files – Because the generated files are tracked in the repository, they receive version control alongside the source AGENTS.md.

Example Workflow


# Add a new design token section to the master file

echo "## New Design Tokens" >> AGENTS.md

echo "- **Primary**: #ff5722" >> AGENTS.md

# Regenerate all platform files

bash scripts/sync-agent-rules.sh

# Output:

#   ✓ .github/copilot-instructions.md

#   ✓ .clinerules

#   ✓ .continue/rules/project.md

#   ✓ .amazonq/rules/project.md

All agents now share the updated token definition without any manual copying between platforms.

Summary

Frequently Asked Questions

What happens if I edit a generated file directly?

Manual edits to generated files (such as .clinerules or .github/copilot-instructions.md) will be overwritten the next time you run scripts/sync-agent-rules.sh. The auto-generated header explicitly marks these files as derived content. Always modify AGENTS.md to ensure changes persist across all platforms.

Does the sync script create missing directories automatically?

Yes, the script handles directory creation automatically. If paths like .continue/rules/ or .amazonq/rules/ do not exist, the script creates them before writing the generated files, eliminating setup friction when adding support for new platforms.

Can I import external documentation into AGENTS.md?

Yes, use @ directives to reference external files (for example, @docs/research/INSPECTION_GUIDE.md). The resolve_imports function expands these references inline during the sync process, allowing you to maintain modular documentation while generating comprehensive rule files for each platform.

Which platforms are supported by the AI Website Cloner template?

The template currently supports GitHub Copilot Chat, Claude CLI, Continue, Amazon Q, and other agents following the same configuration pattern. Each platform receives a dedicated rule file in its expected location, ensuring consistent AI behavior regardless of which coding assistant you use for website cloning.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →