Components: - state/component-registry.json: Registry with all skills, commands, agents, workflows - automation/generate-registry.py: Auto-generate from directory scan - automation/validate-registry.py: Check for drift and TODO placeholders - system-instructions.json: Added component-lifecycle process Registry includes: - 6 skills with routing triggers - 10 commands with aliases - 12 agents with model info - 10 workflows with triggers - 2 delegation helpers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5.2 KiB
5.2 KiB
Component Registry Design
Date: 2026-01-01 Status: Approved
Overview
Build a component registry that PA reads at session start for routing awareness. Ensures PA knows all skills, commands, agents, and workflows immediately without discovery latency.
Goals
- Session awareness — PA knows all components at session start
- Accurate routing — Match user requests to correct components via triggers
- Maintenance discipline — Auto-generation + validation keeps registry in sync
Architecture
Component directories Registry PA Session
───────────────────── ───────── ──────────
skills/*/SKILL.md ──┐
commands/**/*.md ──┼──► generate-registry.py ──► component-registry.json
agents/*.md ──┤ │
workflows/**/*.yaml ──┘ ▼
validate-registry.py Read at init
│ │
▼ ▼
Warns on drift Route requests
Components
| File | Purpose |
|---|---|
~/.claude/state/component-registry.json |
Registry (read at session start) |
~/.claude/automation/generate-registry.py |
Auto-generate skeleton |
~/.claude/automation/validate-registry.py |
Check for drift |
system-instructions.json |
Component lifecycle rules |
Registry Format
{
"version": "1.0",
"generated": "2026-01-01T22:30:00-08:00",
"skills": {
"gmail": {
"description": "Email read access",
"triggers": ["email", "gmail", "inbox", "unread"]
},
"gcal": {
"description": "Calendar read access",
"triggers": ["calendar", "schedule", "meeting", "event"]
}
},
"commands": {
"/gcal": {
"description": "Google Calendar access",
"aliases": ["/calendar", "/cal"]
},
"/usage": {
"description": "View usage statistics",
"aliases": ["/stats"]
}
},
"agents": {
"linux-sysadmin": {
"description": "Workstation management",
"triggers": ["system", "linux", "package", "service"]
}
},
"workflows": {
"health/cluster-health-check": {
"description": "K8s cluster health check",
"triggers": ["cluster health", "k8s status"]
}
}
}
Field Definitions
| Field | Purpose |
|---|---|
description |
One-liner for context |
triggers |
Keywords that suggest this component (routing) |
aliases |
Alternate command names |
status |
Optional: "removed" for stale entries |
Auto-Generation Script
~/.claude/automation/generate-registry.py:
- Scans component directories
- Extracts names and descriptions from frontmatter
- Preserves existing manual hints (triggers)
- Adds
"triggers": ["TODO"]for new components - Marks removed components as
"status": "removed"
Scan Paths
| Directory | Component Type |
|---|---|
~/.claude/skills/*/SKILL.md |
skills |
~/.claude/commands/**/*.md |
commands |
~/.claude/agents/*.md |
agents |
~/.claude/workflows/**/*.yaml |
workflows |
Validation Script
~/.claude/automation/validate-registry.py:
Checks
- All components in directories are in registry
- All registry entries still exist on disk
- No "TODO" placeholders remaining
- Warns on stale entries (status: removed)
Output Example
Registry Validation
✓ 6 skills: all present
✓ 10 commands: all present
✗ 1 agent missing: new-agent (add to registry)
⚠ 1 stale entry: old-agent (marked removed)
Component Lifecycle
Add to system-instructions.json:
{
"component-lifecycle": {
"add": [
"Create component file",
"Run generate-registry.py",
"Add triggers/hints to registry",
"Commit both files"
],
"remove": [
"Remove component file",
"Run generate-registry.py (marks as removed)",
"Commit updated registry"
],
"validate": [
"Run validate-registry.py",
"Fix any warnings before commit"
]
}
}
PA Session Initialization
Update PA agent to read registry at session start:
Read these state files before executing tasks:
...
~/.claude/state/component-registry.json # Component index for routing
Routing Logic
- User request received
- Scan registry triggers for keyword matches
- Match found → invoke corresponding component
- No match → ask for clarification or use general reasoning
Example
User: "what's on my calendar tomorrow?"
│
▼
Scan triggers: "calendar" matches gcal.triggers
│
▼
Invoke skill:gcal with context "tomorrow"
Implementation Checklist
- Create
~/.claude/state/component-registry.json(initial) - Create
~/.claude/automation/generate-registry.py - Create
~/.claude/automation/validate-registry.py - Update
system-instructions.jsonwith component-lifecycle - Update PA agent instructions to read registry
- Test routing with registry
- Add future consideration for registry improvements