Component Audit Command
Purpose
Run a comprehensive audit of all framework components to identify:
- Missing
component_typein frontmatter - Unregistered components (in filesystem but not in registry)
- Components with invalid frontmatter
- Activation status inconsistencies
Usage
/component-audit # Run audit and show report
/component-audit --fix # Fix issues automatically where possible
/component-audit --report # Generate detailed report
Audit Checks
1. Frontmatter Validation
- ✅ Presence of
component_typefield - ✅ Valid component type value (agent, command, skill, script, hook)
- ✅ Required fields (title, description, version)
- ✅ Valid YAML syntax
2. Registry Consistency
- ✅ Filesystem count vs registry count
- ✅ Components in registry but missing files
- ✅ Components in filesystem but not registered
- ✅ Duplicate component IDs
3. Activation Status
- ✅ Active components have valid files
- ✅ Inactive components are properly archived
- ✅ Last activation timestamp is recent
Report Format
Component Audit Report
======================
Generated: 2026-01-29 14:30:00 UTC
SUMMARY
-------
Total Components: 2,648
Agents: 208
Commands: 325
Skills: 379
Scripts: 482
Hooks: 94
ISSUES FOUND
------------
Critical: 0
Warning: 7
Info: 12
DETAILS
-------
[WARNING] agents/missing-type-agent.md: Missing component_type
[WARNING] commands/orphan-cmd.md: Not in registry
...
Implementation
#!/usr/bin/env python3
"""Component audit implementation."""
from pathlib import Path
import yaml
import json
def audit_components():
"""Run full component audit."""
issues = []
# Check agents
for agent_file in Path('agents').glob('*.md'):
content = agent_file.read_text()
if 'component_type:' not in content:
issues.append({
'file': str(agent_file),
'type': 'missing_component_type',
'severity': 'warning'
})
# Check commands
for cmd_file in Path('commands').glob('*.md'):
content = cmd_file.read_text()
if 'component_type:' not in content:
issues.append({
'file': str(cmd_file),
'type': 'missing_component_type',
'severity': 'warning'
})
return issues
Exit Codes
| Code | Meaning |
|---|---|
| 0 | No issues found |
| 1 | Issues found (warnings) |
| 2 | Critical issues found |
Related Commands
/component-lifecycle- Full component lifecycle management/registry-regenerate- Regenerate framework registry/component-create- Create new component with proper frontmatter