Agent Registry
The Agent Registry tracks 10 supported AI coding agents, detects which are installed, and enables cross-agent skill sharing via symlinks. It provides a unified interface for multi-agent skill distribution.
createAgentRegistry
Creates an agent registry instance.
import { createAgentRegistry } from 'auto-skill/core/agent-registry';
const registry = createAgentRegistry();
Custom list of agent configs. Defaults to 10 known agents.
Returns an object with agent lookup, detection, registration, and symlink methods
AgentConfig Type
Configuration for an AI coding agent.
interface AgentConfig {
id: string; // "claude-code" | "opencode" | "cursor" ...
name: string; // Human-readable name
skillDir: string; // Absolute path to agent's skill directory
envVar?: string | null; // Environment variable when running
configFile?: string | null; // Path to config file (can use ~/)
description: string; // Short description
}
Supported Agents
The registry includes 10 known AI coding agents:
| ID | Name | Skill Directory | Env Var | Description |
|---|
claude-code | Claude Code | ~/.claude/skills | CLAUDE_SESSION_ID | Anthropic’s CLI for Claude |
opencode | OpenCode | ~/.opencode/skills | - | Open-source coding agent |
codex | Codex CLI | ~/.codex/skills | - | OpenAI’s Codex CLI agent |
continue | Continue | ~/.continue/skills | - | Continue.dev IDE extension |
aider | Aider | ~/.aider/skills | - | AI pair programming tool |
cursor | Cursor | ~/.cursor/skills | - | AI-first code editor |
windsurf | Windsurf | ~/.windsurf/skills | - | Codeium’s AI IDE |
cline | Cline | ~/.cline/skills | - | AI coding agent for VS Code |
amp | Amp | ~/.amp/skills | - | Sourcegraph’s AI coding agent |
copilot | GitHub Copilot | ~/.copilot/skills | - | GitHub’s AI coding assistant |
Detection Strategy
Agents are detected as installed if ANY of the following are true:
- Environment variable is set (agent is currently running)
- Config file exists (agent has been configured)
- Skill directory exists (agent has been used for skills)
Methods
getAgent
Get an agent configuration by ID.
const agent = registry.getAgent('claude-code');
if (agent) {
console.log(`${agent.name}: ${agent.skillDir}`);
}
Agent identifier (e.g., “claude-code”, “cursor”, “aider”)
Agent configuration if found, otherwise null
listAgents
List all known agent configurations.
const agents = registry.listAgents();
console.log(`Known agents: ${agents.length}`);
agents.forEach(agent => {
console.log(` - ${agent.name} (${agent.id})`);
});
Array of all registered agent configs (default: 10 known agents)
detectInstalledAgents
Detect which agents are currently installed on this system.
const installed = registry.detectInstalledAgents();
console.log(`Found ${installed.length} installed agents:`);
installed.forEach(agent => {
console.log(` ✓ ${agent.name}`);
});
Array of agent configs for installed agents (based on detection strategy)
getAgentSkillDir
Get the skill directory path for a specific agent.
const skillDir = registry.getAgentSkillDir('claude-code');
if (skillDir) {
console.log(`Claude Code skills: ${skillDir}`);
}
Absolute path to the agent’s skill directory, or null if agent unknown
detectCurrentAgent
Detect which agent is currently running based on environment variables.
const current = registry.detectCurrentAgent();
if (current) {
console.log(`Running in: ${current.name}`);
} else {
console.log('No agent detected');
}
Config for the currently running agent, or null if undetectable
registerAgent
Register a new custom agent configuration.
registry.registerAgent({
id: 'my-agent',
name: 'My Custom Agent',
skillDir: '/home/user/.myagent/skills',
envVar: 'MY_AGENT_SESSION',
configFile: '~/.myagent/config.json',
description: 'My custom AI coding agent'
});
Agent configuration to register. If an agent with the same ID exists, it is replaced.
unregisterAgent
Remove an agent from the registry.
const removed = registry.unregisterAgent('my-agent');
if (removed) {
console.log('Agent removed');
}
Agent identifier to remove
true if agent was removed, false if not found
createSkillSymlinks
Create symlinks to a skill in all installed agents’ skill directories.
const created = registry.createSkillSymlinks(
'/home/user/.claude/skills/auto/typescript-debugger',
'typescript-debugger',
'claude-code' // exclude source agent
);
console.log(`Created ${created.length} symlinks:`);
created.forEach(link => console.log(` → ${link}`));
Canonical skill file or directory to link to. If a file path is provided, its parent directory is used.
Skill name (used as the symlink directory name)
Agent ID to exclude from symlinking (typically the source agent)
Array of created symlink paths. Empty if:
- Source path doesn’t exist
- No other agents installed
- Symlinks already exist
Behavior:
- Determines source directory (if file path given, uses parent directory)
- Creates symlink in each installed agent’s skill directory
- Skips if symlink already exists
- Creates parent directories as needed
- Best-effort: logs failures but continues
removeSkillSymlinks
Remove symlinks for a skill from all agent directories.
const removed = registry.removeSkillSymlinks('typescript-debugger');
console.log(`Removed ${removed} symlinks`);
Skill name to remove symlinks for
Number of symlinks successfully removed. Only removes actual symlinks (not real directories).
Usage Example
import { createAgentRegistry } from 'auto-skill/core/agent-registry';
const registry = createAgentRegistry();
// Detect installed agents
const installed = registry.detectInstalledAgents();
console.log(`Found ${installed.length} installed agents:`);
installed.forEach(agent => {
console.log(` ✓ ${agent.name} → ${agent.skillDir}`);
});
// Detect current agent
const current = registry.detectCurrentAgent();
if (current) {
console.log(`\nCurrently running: ${current.name}`);
}
// List all known agents
const all = registry.listAgents();
console.log(`\nAll known agents (${all.length}):`);
all.forEach(agent => {
const status = installed.some(a => a.id === agent.id) ? '✓' : ' ';
console.log(` [${status}] ${agent.name}`);
});
// Get specific agent
const claude = registry.getAgent('claude-code');
if (claude) {
console.log(`\nClaude Code:`);
console.log(` Skill dir: ${claude.skillDir}`);
console.log(` Env var: ${claude.envVar}`);
console.log(` Config: ${claude.configFile}`);
}
Cross-Agent Skill Sharing
import { createAgentRegistry } from 'auto-skill/core/agent-registry';
import path from 'node:path';
const registry = createAgentRegistry();
// Create skill in Claude Code
const claudeSkillDir = registry.getAgentSkillDir('claude-code');
const skillPath = path.join(claudeSkillDir!, 'auto', 'fix-types');
// Share with all other installed agents
const symlinks = registry.createSkillSymlinks(
skillPath,
'fix-types',
'claude-code' // exclude Claude Code (source agent)
);
console.log(`Shared skill with ${symlinks.length} agents:`);
symlinks.forEach(link => {
const agentId = path.basename(path.dirname(path.dirname(link)));
const agent = registry.getAgent(agentId);
console.log(` → ${agent?.name || agentId}: ${link}`);
});
Custom Agent Registration
import { createAgentRegistry } from 'auto-skill/core/agent-registry';
const registry = createAgentRegistry();
// Register custom agent
registry.registerAgent({
id: 'my-agent',
name: 'My Custom Agent',
skillDir: '/home/user/.myagent/skills',
envVar: 'MY_AGENT_SESSION',
configFile: '~/.myagent/config.json',
description: 'My custom AI coding agent'
});
// Verify registration
const myAgent = registry.getAgent('my-agent');
if (myAgent) {
console.log(`Registered: ${myAgent.name}`);
}
// Check if installed
const installed = registry.detectInstalledAgents();
const isInstalled = installed.some(a => a.id === 'my-agent');
console.log(`My agent installed: ${isInstalled}`);
// Unregister
registry.unregisterAgent('my-agent');
Skill Distribution Workflow
import { createAgentRegistry } from 'auto-skill/core/agent-registry';
import fs from 'node:fs';
import path from 'node:path';
function distributeSkill(skillName: string, skillPath: string) {
const registry = createAgentRegistry();
const current = registry.detectCurrentAgent();
if (!current) {
console.error('Cannot detect current agent');
return;
}
console.log(`Distributing '${skillName}' from ${current.name}...`);
// Create symlinks in other agents
const symlinks = registry.createSkillSymlinks(
skillPath,
skillName,
current.id // exclude current agent
);
if (symlinks.length === 0) {
console.log('No other agents installed');
return;
}
console.log(`\n✓ Distributed to ${symlinks.length} agents:`);
symlinks.forEach(link => {
const agentName = path.basename(path.dirname(path.dirname(link)));
console.log(` → ${agentName}`);
});
}
distributeSkill('typescript-debugger', '~/.claude/skills/auto/typescript-debugger');
Source Reference
src/core/agent-registry.ts:23-379