Skip to main content

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();
agents
AgentConfig[]
Custom list of agent configs. Defaults to 10 known agents.
registry
object
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:
IDNameSkill DirectoryEnv VarDescription
claude-codeClaude Code~/.claude/skillsCLAUDE_SESSION_IDAnthropic’s CLI for Claude
opencodeOpenCode~/.opencode/skills-Open-source coding agent
codexCodex CLI~/.codex/skills-OpenAI’s Codex CLI agent
continueContinue~/.continue/skills-Continue.dev IDE extension
aiderAider~/.aider/skills-AI pair programming tool
cursorCursor~/.cursor/skills-AI-first code editor
windsurfWindsurf~/.windsurf/skills-Codeium’s AI IDE
clineCline~/.cline/skills-AI coding agent for VS Code
ampAmp~/.amp/skills-Sourcegraph’s AI coding agent
copilotGitHub Copilot~/.copilot/skills-GitHub’s AI coding assistant

Detection Strategy

Agents are detected as installed if ANY of the following are true:
  1. Environment variable is set (agent is currently running)
  2. Config file exists (agent has been configured)
  3. 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}`);
}
agentId
string
required
Agent identifier (e.g., “claude-code”, “cursor”, “aider”)
agent
AgentConfig | null
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})`);
});
agents
AgentConfig[]
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}`);
});
installed
AgentConfig[]
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}`);
}
agentId
string
required
Agent identifier
skillDir
string | null
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');
}
agent
AgentConfig | null
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
AgentConfig
required
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');
}
agentId
string
required
Agent identifier to remove
removed
boolean
true if agent was removed, false if not found
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}`));
skillPath
string
required
Canonical skill file or directory to link to. If a file path is provided, its parent directory is used.
skillName
string
required
Skill name (used as the symlink directory name)
excludeAgentId
string
Agent ID to exclude from symlinking (typically the source agent)
created
string[]
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
Remove symlinks for a skill from all agent directories.
const removed = registry.removeSkillSymlinks('typescript-debugger');
console.log(`Removed ${removed} symlinks`);
skillName
string
required
Skill name to remove symlinks for
removed
number
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

Build docs developers (and LLMs) love