| applyTo | **/* |
|---|---|
| description | Procedures for updating AI agent instructions from the centralized repository |
These instructions are self-contained for update procedures but assume familiarity with Git. For general workflow guidance, see agent-workflow.instructions.md.
Repositories control AIM behavior through aim.config.json in the repository root:
{
"version": "latest",
"modules": {
"include": ["agent-workflow", "powershell", "markdown"],
"exclude": []
},
"externalSources": {
"enabled": true,
"repositories": [
{
"name": "awesome-copilot",
"url": "https://github.com/github/awesome-copilot",
"path": "instructions",
"description": "Community-contributed instructions from GitHub"
}
]
}
}Configuration fields:
version- Target AIM version:"latest"or specific version (e.g.,"0.8.0")modules.include- List of modules to include (without.instructions.mdextension)modules.exclude- List of modules to exclude (takes precedence over include)externalSources.enabled- Enable fetching from external repositoriesexternalSources.repositories- List of external instruction sources
When updating AI agent instructions in a repository that uses AIM, AI agents should:
- Check if
aim.config.jsonexists in the repository root - If it exists, read all configuration fields
- If it doesn't exist, use defaults: version=latest, all modules, externalSources disabled
- Clone:
git clone https://github.com/tablackburn/ai-agent-instruction-modules.git - If targeting a specific version (not "latest"), checkout that tag:
git checkout v0.8.0 - Use
AGENTS.template.mdfrom the cloned repository, NOTAGENTS.md - The file
AGENTS.mdin the centralized repository is that repository's own implementation - The file
AGENTS.template.mdis the template for downstream repositories
- Read the current version from the downstream repository's
AGENTS.mdheader (e.g., "Template Version: 0.7.0") - Read
CHANGELOG.mdfrom the cloned upstream repository - Extract all version sections between the current version and the target version
- Provide the user with a brief summary of what has changed, noting any breaking changes
- If the current version equals the target version, inform the user they are already up to date
Based on aim.config.json:
- If
modules.includeis specified, only sync those modules - If
modules.excludeis specified, exclude those from the sync - Core modules (
agent-workflow,update) should always be included unless explicitly excluded repository-specific.instructions.mdis NEVER copied from upstream
For each instruction file in the upstream instruction-templates/ folder:
- Check if the module should be synced based on configuration
- Check if the file already exists in the downstream
instructions/folder - If the file exists, ask the user:
- "File X already exists. Overwrite with upstream version? (yes/no/diff)"
- If "diff", show the differences between local and upstream versions
- Only overwrite if the user confirms
- If the file is new, copy it without prompting
If externalSources.enabled is true and a needed language/framework instruction is not found in
AIM:
- Check each configured external repository in order
- For awesome-copilot, look in the
instructions/path for matching.instructions.mdfiles - Download the instruction file and copy to the downstream
instructions/folder - Inform the user which files were fetched from external sources
Example external fetch:
Fetching python.instructions.md from github/awesome-copilot...
Fetching react.instructions.md from github/awesome-copilot...
- Replace the HTML comment block at the top (the comment starting with
<!-- THIS IS THE TEMPLATE) - Update the sync date to today's date
- Update the template version to match the upstream version
- Preserve any "Repository-Specific" sections from the existing file
If new modules were added or configuration changed during the update:
- Update
aim.config.jsonto reflect the current module selection - Ask the user if they want to enable/disable any modules going forward
- List all files in the local instructions directory
- Verify file structure matches expected configuration
- Remove the cloned repository folder to prevent nested Git repositories
When the user requests a new instruction module that doesn't exist locally:
- Check if the module exists in
instruction-templates/ - If found, copy to
instructions/and updateaim.config.json
- If not in AIM and
externalSources.enabledis true: - Search configured external repositories for matching instruction files
- Download and copy to
instructions/ - Add the module name to
aim.config.jsonmodules.include
If the user adds new source files in a language not currently covered:
- Detect new file extensions (e.g.,
*.pyfiles added) - Check if corresponding instruction exists locally
- If not, suggest fetching from external sources
- Ask user: "Python files detected but no python.instructions.md found. Fetch from awesome-copilot?"
- Configuration read from
aim.config.json - Target version determined (latest or pinned)
- Correct version/tag checked out from upstream
- Change summary provided to user (from CHANGELOG)
- Module list determined based on configuration
- User prompted before overwriting existing files
- New modules copied without prompting
- External sources checked for missing modules (if enabled)
- AGENTS.md updated with new version and sync date
- Repository-specific content preserved
- Configuration updated with any changes
- Cloned repository folder cleaned up
- The file
repository-specific.instructions.mdmust NEVER be copied from upstream - Repository-specific sections in AGENTS.md should be preserved
- Local customizations to instruction files should be flagged before overwriting
- Template sync date should be updated to current date
- Template version should match the centralized repository version
When upstream structural changes occur (e.g., renamed files, moved directories):
- Review the upstream changelog for breaking changes
- Compare file structure between current and target versions
- If
instruction-templates/replacesinstructions/as the source folder, adapt accordingly - Rename local files to match upstream naming
- Update
aim.config.jsonif module names changed
- Current version: Stored in
AGENTS.mdheader as "Template Version: X.Y.Z" - Target version: Configured in
aim.config.jsonversion field (defaults to "latest") - Change history: Available in upstream
CHANGELOG.md, follows semantic versioning - Use version pinning for stability in production repositories
- Use "latest" for repositories that want to stay current with upstream changes