This document explains how to keep agent configurations synchronized when agents are installed through different methods (Claude Code, manual installation, or other tools).
The Claude Sub-Agents Manager includes a synchronization mechanism to detect and register agents that were installed outside of the normal claude-agents install process. This ensures that all agents in your system are properly tracked and managed.
Note: With the new Claude Code format alignment, agents are now single .md files and slash commands have been removed. The sync process has been updated accordingly.
# Scan and register unregistered agents
claude-agents sync
# Auto-register without confirmation prompt
claude-agents sync --auto
# Force copy all agents to project directory
claude-agents sync --force-copy- Scans agent directories - Checks both user (
~/.claude/agents/) and project (.claude/agents/) directories - Detects unregistered agents - Finds
.mdfiles that aren't in the configuration - Parses agent metadata - Extracts YAML frontmatter from single agent files
- Copies to project - Copies agent files to your project's
agents/directory - Registers agents - Adds them to the configuration file
Format Update: Agents are now single .md files with YAML frontmatter. Slash commands have been removed in favor of description-based auto-delegation.
# Enable automatic synchronization
claude-agents config autosync on
# Disable automatic synchronization
claude-agents config autosync off
# Check current status
claude-agents config autosyncWhen enabled, auto-sync will:
- Check for external agent changes when running
listcommand - Detect directory modifications since last sync
- Automatically register new agents found
- Run silently in the background
npm start -- install agent-name- Agents installed this way are automatically registered
- No sync needed
When Claude Code installs agents directly to ~/.claude/agents/:
- Run
npm start -- syncto register them - Or enable auto-sync for automatic detection
If you manually copy agent files:
# Copy agent file
cp my-agent.md ~/.claude/agents/
# Register it
npm start -- syncAgents installed by other tools will be detected as long as they:
- Are placed in the correct directories
- Have valid YAML frontmatter
- Follow the agent file format
For sync to work properly, agent files must have:
---
name: agent-name
description: Agent description
tools: Read, Write, Edit, Grep
---
Agent content here...Minimum required frontmatter fields:
name- Agent identifierdescription- What the agent does
Optional fields:
tools- Comma-separated list of required toolstags- Array of tagscolor- UI color hint
-
Check file location
ls -la ~/.claude/agents/ ls -la .claude/agents/ -
Verify file format
- Must end with
.md - Must have valid YAML frontmatter
- Frontmatter must be enclosed in
---
- Must end with
-
Check permissions
chmod 644 ~/.claude/agents/*.md
If an agent with the same name exists in both locations:
- User scope takes precedence
- Project scope agent will be ignored
- Use
removecommand to resolve conflicts
If sync isn't updating the configuration:
-
Check config file permissions
ls -la ~/.claude-agents.json -
Manually backup and reset
cp ~/.claude-agents.json ~/.claude-agents.backup.json rm ~/.claude-agents.json npm start -- sync
-
Regular Syncing
- Run sync after installing agents through Claude Code
- Enable auto-sync for convenience
- Check sync status with
npm start -- list
-
Consistent Naming
- Use lowercase with hyphens (e.g.,
my-agent) - Avoid spaces and special characters
- Keep names descriptive but concise
- Use lowercase with hyphens (e.g.,
-
Metadata Maintenance
- Always include description in frontmatter
- List all required tools
- Add relevant tags for organization
-
Version Control
- Commit agent files to your repository
- Use project scope for team-shared agents
- Document custom agents in README
# 1. Claude Code installs design-system agent
# (Agent appears in ~/.claude/agents/design-system.md)
# 2. Register it with the manager
npm start -- sync
# This will:
# - Copy design-system agent to ./agents/design-system/
# - Register in configuration
# 3. Verify registration and files
npm start -- list | grep design-system
ls -la ./agents/design-system/
# 4. Commit to version control
git add agents/design-system/
git commit -m "Add design-system agent from Claude Code"
# 5. Enable auto-sync for future installations
npm start -- config autosync on# 1. Create agent in project scope
mkdir -p .claude/agents
cp team-agent.md .claude/agents/
# 2. Sync to register
npm start -- sync
# 3. Commit to repository
git add .claude/agents/team-agent.md
git commit -m "Add team-agent for code reviews"
# 4. Team members sync after pulling
git pull
npm start -- syncAdd sync to your build process:
# .github/workflows/ci.yml
steps:
- name: Sync Claude agents
run: |
npm install -g claude-agents
claude-agents sync --auto- Sync only processes
.mdfiles in designated directories - Agent names are validated to prevent path traversal
- No code execution during sync process
- Configuration file permissions are preserved
Planned improvements:
- Automatic sync on file system watch
- Conflict resolution UI
- Agent version tracking
- Sync with remote agent registry
- Backup and restore functionality