# How the Platform Sync Script Regenerates Agent Instructions for Different AI Tools

> Discover how the platform sync script regenerates agent instructions by reading AGENTS.md, expanding references, and writing formatted output to specific AI tool configurations.

- Repository: [JCodesMore/ai-website-cloner-template](https://github.com/JCodesMore/ai-website-cloner-template)
- Tags: internals
- Published: 2026-06-26

---

**The platform sync script regenerates agent instructions by reading the canonical [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) file, expanding `@file` references, and writing formatted output to tool-specific configuration paths.**

The `JCodesMore/ai-website-cloner-template` repository maintains AI assistant consistency through a single source of truth. When you need to synchronize behavior across multiple AI coding tools, the platform sync script regenerates agent instructions automatically, eliminating manual duplication and ensuring every assistant follows the same project conventions.

## The Source of Truth: [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md)

The repository stores canonical agent rules in **[`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md)** at the root directory. This file contains the master definitions that govern how AI assistants should interpret code, structure responses, and handle project-specific tasks.

### Locating Repository Paths

At the top of [`scripts/sync-agent-rules.sh`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/scripts/sync-agent-rules.sh), the script establishes its working context by defining two critical variables (lines 25-27):

- **`REPO_ROOT`**: The absolute path to the repository root
- **`SOURCE`**: The path to [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md)

These variables ensure the script operates from the correct base directory regardless of where it is invoked.

### Resolving `@file` Imports

The **`resolve_imports`** function (lines 33-50) enables modular documentation by processing [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) line by line. When the function encounters a line beginning with `@`, such as:

```markdown
@docs/research/INSPECTION_GUIDE.md

```

It treats the remainder of the line as a file path and replaces the reference with the full contents of that file using `cat`. This allows maintainers to split complex instruction sets across multiple files while the sync script composites them into unified outputs.

## Generating Platform-Specific Outputs

The script uses a **`write_file`** helper to standardize file generation. This helper creates target directories if they do not exist, prepends an auto-generation warning header (lines 55-57), and writes the resolved content. The script generates four distinct instruction files, each formatted for their specific AI tool:

- **GitHub Copilot Chat**: Writes to [`.github/copilot-instructions.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.github/copilot-instructions.md) (lines 69-71)
- **Cline / Roo Code**: Writes to `.clinerules` at the repository root (lines 72-74)
- **Continue**: Writes a YAML front-matter block followed by the resolved content to [`.continue/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.continue/rules/project.md) (lines 75-82)
- **Amazon Q Developer**: Writes to [`.amazonq/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.amazonq/rules/project.md) (lines 83-84)

Each generated file includes a header comment warning that the file is auto-generated and should not be edited directly, directing developers to modify [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) instead.

## Running the Sync Script

Execute the script from the repository root to regenerate all instruction files:

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

```

The script outputs confirmation messages for each platform file it creates and prints a final "Done" message upon completion (lines 86-89). After execution, all AI tools receive updated instructions derived from the current state of [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md).

## Summary

- The **[`scripts/sync-agent-rules.sh`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/scripts/sync-agent-rules.sh)** script maintains consistency across AI tools by reading from [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) as the single source of truth.
- The **`resolve_imports`** function handles modular documentation by inlining files referenced with `@` syntax.
- Generated files include warning headers indicating they are auto-generated and should not be edited manually.
- The script supports **GitHub Copilot**, **Cline/Roo Code**, **Continue**, and **Amazon Q Developer** with appropriate formatting for each platform's requirements.

## Frequently Asked Questions

### What is the purpose of the [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) file?

[`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) serves as the central repository for agent rules and conventions. It defines how AI assistants should interpret and interact with the codebase, acting as the single source of truth that feeds all platform-specific instruction files. When you update this file, the sync script propagates changes to every supported AI tool.

### How does the script handle file imports?

The `resolve_imports` function scans [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md) for lines starting with `@`, treating them as file path references. It replaces each reference with the actual contents of the specified file using standard shell commands, enabling modular organization of complex agent instructions without duplicating content across multiple files.

### Which AI tools are supported by the sync script?

The script generates instructions for **GitHub Copilot Chat** ([`.github/copilot-instructions.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.github/copilot-instructions.md)), **Cline / Roo Code** (`.clinerules`), **Continue** ([`.continue/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.continue/rules/project.md)), and **Amazon Q Developer** ([`.amazonq/rules/project.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/.amazonq/rules/project.md)). Each output is formatted according to the specific requirements of the target platform, such as front-matter for Continue or plain markdown for Copilot.

### How do I update agent instructions after editing [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md)?

Simply run `bash scripts/sync-agent-rules.sh` from the repository root after modifying [`AGENTS.md`](https://github.com/JCodesMore/ai-website-cloner-template/blob/main/AGENTS.md). The script regenerates all platform-specific files automatically, ensuring every AI tool receives the updated instructions without requiring manual copy-pasting or risking version drift between different configuration files.