Doctor
OrchestKit doctor for health diagnostics. Use when running checks on plugin health, diagnosing problems, or troubleshooting issues.
Related Skills
OrchestKit Health Diagnostics
Overview
The /ork:doctor command performs comprehensive health checks on your OrchestKit installation. It auto-detects installed plugins and validates 12 categories:
- Installed Plugins - Detects orkl or ork
- Skills Validation - Frontmatter, references, token budget (dynamic count)
- Agents Validation - Frontmatter, tool refs, skill refs (dynamic count)
- Hook Health - Registration, bundles, async patterns
- Permission Rules - Detects unreachable rules (CC 2.1.3 feature)
- Schema Compliance - Validates JSON files against schemas
- Coordination System - Checks lock health and registry integrity
- Context Budget - Monitors token usage against budget
- Memory System - Graph memory health
- Claude Code Version - Validates CC >= 2.1.47
- External Dependencies - Checks optional tool availability (agent-browser)
- MCP Status - Active vs disabled vs misconfigured, API key presence for paid MCPs
When to Use
- After installing or updating OrchestKit
- When hooks aren't firing as expected
- Before deploying to a team environment
- When debugging coordination issues
- After running
npm run build
Quick Start
/ork:doctor # Standard health check
/ork:doctor -v # Verbose output
/ork:doctor --json # Machine-readable for CICLI Options
| Flag | Description |
|---|---|
-v, --verbose | Detailed output per check |
--json | JSON output for CI integration |
--category=X | Run only specific category |
Health Check Categories
Detailed check procedures: See rules/diagnostic-checks.md for bash commands and validation logic per category.
MCP-specific checks: See rules/mcp-status-checks.md for credential validation and misconfiguration detection.
Output examples: See references/health-check-outputs.md for sample output per category.
Categories 0-3: Core Validation
| Category | What It Checks | Reference |
|---|---|---|
| 0. Installed Plugins | Auto-detects orkl or ork, counts skills/agents | diagnostic-checks |
| 1. Skills | Frontmatter, context field, token budget, links | skills-validation |
| 2. Agents | Frontmatter, model, skill refs, tool refs | agents-validation |
| 3. Hooks | hooks.json schema, bundles, async patterns | hook-validation |
Categories 4-5: System Health
| Category | What It Checks | Reference |
|---|---|---|
| 4. Memory | .claude/memory/ exists, decisions.jsonl integrity, queue depth | memory-health |
| 5. Build | plugins/ sync with src/, manifest counts, orphans | diagnostic-checks |
Categories 6-9: Infrastructure
| Category | What It Checks |
|---|---|
| 6. Permission Rules | Unreachable rules detection (CC 2.1.3) |
| 7. Schema Compliance | JSON files against schemas |
| 8. Coordination | Multi-worktree lock health, stale locks |
| 9. Context Budget | Token usage against budget |
Categories 10-12: Environment
| Category | What It Checks | Reference |
|---|---|---|
| 10. CC Version | Runtime version against minimum required | version-compatibility |
| 11. External Deps | Optional tools (agent-browser) | diagnostic-checks |
| 12. MCP Status | Enabled/disabled state, credential checks | mcp-status-checks |
Report Format
See references/report-format.md for ASCII report templates (ork and orkl), JSON CI output schema, and exit codes.
Interpreting Results & Troubleshooting
See references/remediation-guide.md for the full results interpretation table and troubleshooting steps for common failures (skills validation, build sync, memory).
Related Skills
ork:configure- Configure plugin settingsork:quality-gates- CI/CD integrationsecurity-scanning- Comprehensive audits
References
- Diagnostic Checks
- MCP Status Checks
- Remediation Guide
- Health Check Outputs
- Skills Validation
- Agents Validation
- Hook Validation
- Memory Health
- Permission Rules
- Schema Validation
- Report Format
- Version Compatibility
Rules (2)
Diagnostic Checks — CRITICAL
Diagnostic Check Procedures
Detailed procedures for each health check category in /ork:doctor.
0. Installed Plugins Detection
Auto-detects which OrchestKit plugins are installed:
# Detection logic:
# - Scans for .claude-plugin/plugin.json in plugin paths
# - Identifies orkl or ork
# - Counts skills/agents per installed plugin1. Skills Validation
Validates skills in installed plugins (count varies by installation):
# Checks performed:
# - SKILL.md frontmatter (name, description, user-invocable)
# - context: fork field (required for CC 2.1.0+)
# - Token budget compliance (300-5000 tokens)
# - Internal link validation (references/ paths)
# - Related Skills references exist2. Agents Validation
Validates agents in installed plugins:
# Checks performed:
# - Frontmatter fields (name, description, model, tools, skills)
# - Model validation (opus, sonnet, haiku only)
# - Skills references exist in src/skills/
# - Tools are valid CC tools3. Hook Health
Verifies hooks are properly configured:
# Checks performed:
# - hooks.json schema valid
# - Bundle files exist (12 .mjs bundles)
# - Async hooks use fire-and-forget pattern (9 async)
# - Background hook metrics health (Issue #243)
# - Windows-safe spawning (PR #645)4. Memory System
Validates graph memory with file-level integrity checks:
# Automated checks:
# - Graph: .claude/memory/ exists, decisions.jsonl valid JSONL, queue depth
# Run these commands to gather memory health data:
wc -l .claude/memory/decisions.jsonl 2>/dev/null || echo "No decisions yet"
wc -l .claude/memory/graph-queue.jsonl 2>/dev/null || echo "No graph queue"
ls -la .claude/memory/ 2>/dev/null || echo "Memory directory missing"Read .claude/memory/decisions.jsonl directly to validate JSONL integrity (each line must parse as valid JSON). Count total lines, corrupt lines, and report per-category breakdown.
See Memory Health for details.
5. Build System
Verifies plugins/ sync with src/:
# Checks performed:
# - plugins/ generated from src/
# - Manifest counts match actual files
# - No orphaned skills/agents6. Permission Rules
Leverages CC 2.1.3's unreachable permission rules detection.
7. Schema Compliance
Validates JSON files against schemas.
8. Coordination System
Checks multi-worktree coordination health (active instances, stale locks).
9. Context Budget
Monitors token usage against budget.
10. Claude Code Version
Validates runtime version against the Version Compatibility Matrix.
11. External Dependencies
Checks optional tool availability:
# Checks performed:
# - agent-browser: installed globally via skills CLI
# - Validates symlink exists at ~/.claude/skills/agent-browserMCP Status Checks — HIGH
MCP Status Checks
Validates .mcp.json entries for enabled/disabled state and required credentials.
Check Procedure
# Checks performed:
# - Parse .mcp.json, list each server with enabled/disabled state
# - For tavily: check TAVILY_API_KEY env var OR op CLI availability
# - For memory: check MEMORY_FILE path is writable
# - For agentation: check agentation-mcp package is installed (npx --yes dry-run)
# - Flag any enabled MCP whose process would likely fail at startupOutput Examples
Healthy:
MCP Servers:
- context7: enabled ✓
- memory: enabled ✓
- sequential-thinking: disabled ○
- tavily: disabled ○ (enable: set TAVILY_API_KEY, see /ork:configure)
- agentation: disabled ○Misconfigured (Tavily enabled but no key):
MCP Servers:
- context7: enabled ✓
- memory: enabled ✓
- tavily: enabled ✗ TAVILY_API_KEY not set — MCP will fail at startup
Fix: set TAVILY_API_KEY or set "disabled": true in .mcp.jsonMisconfigured (agentation enabled but not installed):
MCP Servers:
- agentation: enabled ✗ agentation-mcp package not found
Fix: npm install -D agentation-mcp or set "disabled": trueReferences (10)
Agents Validation
Agents Validation
Overview
OrchestKit includes 36 specialized agents validated against CC 2.1.47 frontmatter format.
Agent Structure
src/agents/
├── backend-system-architect.md
├── code-quality-reviewer.md
├── frontend-ui-developer.md
└── ... (36 total)Validation Checks
1. Frontmatter Fields
Required fields:
name- Agent identifier (used in Task subagent_type)description- Purpose and auto-mode keywordsmodel- opus, sonnet, or haikutools- Array of allowed CC toolsskills- Array of skill names to auto-inject
Optional fields:
context- fork or inheritcolor- Display colorhooks- Agent-specific hooks
2. Model Validation
Only valid models:
# Check model values
grep "^model:" src/agents/*.md | sort | uniq -cExpected: opus, sonnet, haiku
3. Skills References
All skills in agent frontmatter must exist:
# Check skill references
for agent in src/agents/*.md; do
grep -A100 "^skills:" "$agent" | grep "^ - " | \
sed 's/.*- //' | while read skill; do
[ -d "src/skills/$skill" ] || echo "Missing: $agent -> $skill"
done
done4. Tools Validation
Valid CC tools:
- Bash, Read, Write, Edit, MultiEdit
- Grep, Glob
- Task, Skill
- WebFetch, WebSearch
- NotebookEdit
- AskUserQuestion
- TaskCreate, TaskUpdate, TaskGet, TaskList
Quick Validation
# Run full agent validation
npm run test:agents
# Or directly
./tests/agents/test-agent-frontmatter.shCommon Issues
Invalid model
model: sonnet # Valid: opus, sonnet, haikuMissing skill reference
Ensure skill exists in src/skills/ directory.
Invalid tool name
Check tool spelling matches CC tool names exactly.
Agent Registration Check (CC 2.1.50+)
Run claude agents to list all registered agents and compare against the expected count from manifests.
Gate: Only run if CC >= 2.1.50 (feature: claude_agents_cli). Skip with a note if version is older.
# Check registered agent count matches expected
expected_count=$(grep -c '"agents/' manifests/ork.json 2>/dev/null || echo 0)
registered_count=$(claude agents 2>/dev/null | wc -l | tr -d ' ')
if [ "$registered_count" -ne "$expected_count" ]; then
echo "WARN: Agent count mismatch — expected $expected_count, got $registered_count"
# List missing agents for investigation
claude agents 2>/dev/null | sort > /tmp/ork-registered.txt
ls src/agents/*.md 2>/dev/null | xargs -I{} basename {} .md | sort > /tmp/ork-expected.txt
echo "Missing agents:"
comm -23 /tmp/ork-expected.txt /tmp/ork-registered.txt
fiCheck: claude agents | wc -l should match expected agent count (37).
Fail action: List missing agents for manual investigation. Common causes:
- Plugin not installed or not rebuilt after adding agents
- Agent frontmatter parse error preventing registration
- CC version too old (< 2.1.50) to support
claude agentsCLI
Health Check Outputs
Health Check Output Examples
Reference output examples for each /ork:doctor check category.
Installed Plugins
orkl:
Installed Plugins: 1
- orkl: 46 skills, 38 agents, 87 hook entriesork (full):
Installed Plugins: 1
- ork: 68 skills, 38 agents, 87 hook entriesSkills Validation
Full ork:
Skills: 67/67 valid
- User-invocable: 24 commands
- Reference skills: 38orkl only:
Skills: 46/46 valid
- User-invocable: 24 commands
- Reference skills: 21Agents Validation
Agents: 36/36 valid
- Models: 12 sonnet, 15 haiku, 8 opus
- All skill references validHook Health
Hooks: 87/87 entries valid (12 bundles)
- Global: 66 (PreToolUse: 14, PostToolUse: 6, SubagentStart: 7, SubagentStop: 7,
Setup: 6, SessionStart: 5, UserPromptSubmit: 5, PermissionRequest: 3, ...)
- Agent-scoped: 22, Skill-scoped: 1
- Async hooks: 7 (fire-and-forget)
- Error Rate: 0.3%Memory System
Memory System: healthy
- Graph Memory: 42 decisions, 0 corrupt, queue depth 3Build System
Build System: in sync
- Skills: 67 src/ = 67 plugins/
- Agents: 36 src/ = 36 plugins/
- Last build: 2 minutes agoPermission Rules
Permission Rules: 12/12 reachableSchema Compliance
Schemas: 15/15 compliantCoordination System
Coordination: healthy
- Active instances: 1
- Stale locks: 0Context Budget
Context Budget: 1850/2200 tokens (84%)Claude Code Version
OK:
Claude Code: 2.1.47 (OK)
- Minimum required: 2.1.47
- All 15 features availableDegraded:
Claude Code: 2.1.44 (DEGRADED)
- Minimum required: 2.1.47
- Missing: last_assistant_message, added_dirs, Windows hooks, worktree discovery
- Upgrade: npm install -g @anthropic-ai/claude-code@latestExternal Dependencies
Installed:
External Dependencies:
- agent-browser: installed (OK)Not installed:
External Dependencies:
- agent-browser: NOT INSTALLED (optional - install with: npx skills add vercel-labs/agent-browser)Hook Validation
Hook Validation
Overview
OrchestKit uses 66 global hook entries across 15 event types, compiled into 12 bundles. This reference explains how to validate and troubleshoot hooks.
Hook Architecture
hooks.json (63 global + 22 agent-scoped + 1 skill-scoped entries)
↓
12 TypeScript bundles (dist/*.mjs)
↓
9 async hooks use fire-and-forget patternPlatform Support
| Platform | Hook Status | Notes |
|---|---|---|
| macOS | Full support | Native execution |
| Linux | Full support | Native execution |
| Windows | Full support (CC 2.1.47+) | Uses Git Bash instead of cmd.exe |
Windows support history:
- Before CC 2.1.47: All hooks silently failed on Windows (cmd.exe incompatible)
- CC 2.1.47: Fixed by executing hooks via Git Bash instead of cmd.exe
- PR #645: OrchestKit added Windows-safe spawning (no console flashing, no ENAMETOOLONG)
Cross-platform safety measures in OrchestKit hooks:
paths.tsprovides cross-platform path handling (os.homedir(),os.tmpdir(),path.join())- CRLF normalization (
\r\n→\n) in subagent-validator, decision-history, common.ts - Windows backslash path normalization in structure-location-validator
- Windows-specific test cases for paths, CRLF, and permission handling
Hook Categories
| Event Type | Count | Purpose |
|---|---|---|
| PreToolUse | 14 | Before tool execution |
| SubagentStart | 7 | Before agent spawn |
| SubagentStop | 7 | After agent completes |
| PostToolUse | 6 | After tool execution |
| Setup | 6 | Plugin initialization |
| SessionStart | 5 | Session initialization |
| UserPromptSubmit | 5 | Prompt enhancement |
| PermissionRequest | 3 | Auto-approval logic |
| SessionEnd | 3 | Session cleanup |
| TeammateIdle | 3 | Teammate idle handling |
| Stop | 2 | Conversation end |
| Notification | 2 | Desktop/sound alerts |
| PostToolUseFailure | 1 | Failed tool handling |
| PreCompact | 1 | Before context compaction |
| TaskCompleted | 1 | Task completion handling |
| Total Global | 66 |
Bundle Structure
| Bundle | Handlers | Async |
|---|---|---|
| agent.mjs | Agent hooks | No |
| hooks.mjs | Core dispatching | No |
| lifecycle.mjs | Session lifecycle | Yes |
| notification.mjs | Alerts | Yes |
| permission.mjs | Auto-approve | No |
| posttool.mjs | Post-execution | Yes |
| pretool.mjs | Pre-execution | No |
| prompt.mjs | Prompt enhancement | Yes |
| setup.mjs | Initialization | Yes |
| skill.mjs | Skill-scoped hooks | No |
| stop.mjs | Conversation end | Yes |
| subagent.mjs | Agent lifecycle | No |
Validation Checks
1. hooks.json Schema
# Validate hooks.json structure
cat src/hooks/hooks.json | jq '.hooks | keys'2. Bundle Existence
# Check all bundles exist
ls -la src/hooks/dist/*.mjs3. Async Hook Pattern
Async hooks use fire-and-forget scripts:
# 9 fire-and-forget scripts required (updated CC 2.1.47)
ls src/hooks/bin/*-fire-and-forget.mjs4. Matcher Syntax
Valid matcher patterns:
{
"matcher": "Bash", // Exact tool name
"matcher": "Write|Edit", // Multiple tools
"matcher": "*", // All tools
"matcher": "mcp__*" // Wildcard prefix
}Debug Mode (Issue #243)
Silent hooks run in detached background processes. Enable debug mode to monitor them.
Enable Debug Logging
Create .claude/hooks/debug.json:
{
"enabled": true,
"verbose": false,
"includeInput": false,
"hookFilters": []
}View Debug Logs
# Recent background hook activity
tail -f .claude/logs/background-hooks.log
# Filter by hook name
grep "unified-dispatcher" .claude/logs/background-hooks.logHook Metrics
Execution metrics tracked in .claude/hooks/metrics.json:
{
"hooks": {
"posttool/unified-dispatcher": {
"totalRuns": 42,
"successCount": 41,
"errorCount": 1,
"avgDurationMs": 150
}
}
}PID Tracking
# Check for orphaned processes
for f in .claude/hooks/pids/*.pid; do
pid=$(jq -r '.pid' "$f" 2>/dev/null)
if [ -n "$pid" ] && ! kill -0 "$pid" 2>/dev/null; then
echo "Orphaned: $f"
rm "$f"
fi
doneTroubleshooting
Hook not firing
- Check matcher pattern matches tool name
- Verify bundle exists in dist/
- Check hooks.json registration
Hook timing out
Default timeout: 120s (bash), 600s (CC 2.1.3+)
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success / Allow |
| 1 | Error (logged, continues) |
| 2 | Block (stops execution) |
Memory Health
Memory Health
Overview
OrchestKit uses graph memory for knowledge persistence. Doctor validates it with automated checks.
Automated Health Check
The memory-health.ts library provides checkMemoryHealth() which returns a MemoryHealthReport:
interface MemoryHealthReport {
overall: 'healthy' | 'degraded' | 'unavailable';
timestamp: string;
graph: {
status: TierStatus;
memoryDir: boolean; // .claude/memory/ exists
decisions: FileHealth; // decisions.jsonl analysis
graphQueue: FileHealth; // graph-queue.jsonl depth
};
}Each FileHealth includes: exists, lineCount, corruptLines, sizeBytes, lastModified.
Status Meanings
| Status | Meaning |
|---|---|
healthy | Graph memory operational, no issues |
degraded | Working but with issues (corrupt data, high queue depth) |
unavailable | Not configured or missing critical components |
Graph Memory
Local knowledge graph stored in .claude/memory/.
Validation Commands
# Check directory exists
ls -la .claude/memory/
# Count decisions
wc -l .claude/memory/decisions.jsonl
# Check graph queue depth
wc -l .claude/memory/graph-queue.jsonl 2>/dev/null
# Validate JSONL integrity (each line must be valid JSON)
while IFS= read -r line; do
echo "$line" | python3 -m json.tool > /dev/null 2>&1 || echo "CORRUPT: $line"
done < .claude/memory/decisions.jsonlHealth Indicators
- Directory exists:
.claude/memory/ decisions.jsonl: Valid JSONL, no corrupt linesgraph-queue.jsonl: Queue depth < 50 (high depth = sync backlog)- No corruption: every line parses as valid JSON
Degraded Conditions
- Corrupt lines: One or more JSONL lines fail to parse
- High queue depth: >50 pending graph operations (sync backlog)
- Missing directory: Graph memory never initialized
Troubleshooting
Graph memory missing
# Initialize graph
mkdir -p .claude/memoryThe first /ork:remember call will create decisions.jsonl.
Corrupt JSONL lines
# Find corrupt lines
python3 -c "
import json, sys
with open('.claude/memory/decisions.jsonl') as f:
for i, line in enumerate(f, 1):
try: json.loads(line)
except: print(f'Line {i}: {line.strip()[:80]}')
"High queue depth
Queue items accumulate if the stop dispatcher doesn't run (e.g., session crash). The queue-recovery hook processes orphaned queues on the next session start.
Permission Rules
Permission Rules Analysis
Overview
CC 2.1.3 added detection for unreachable permission rules. This reference explains how to diagnose and fix permission issues.
Common Issues
1. Unreachable Rules
A rule is unreachable when a more general rule already matches:
// PROBLEM: Second rule never matches
{
"permissions": [
{ "path": "**/*.md", "action": "allow" },
{ "path": "README.md", "action": "deny" } // Unreachable!
]
}Fix: Order rules from specific to general:
{
"permissions": [
{ "path": "README.md", "action": "deny" },
{ "path": "**/*.md", "action": "allow" }
]
}2. Shadowed Rules
When two rules match the same pattern with different actions:
// PROBLEM: Both match, but first wins
{
"permissions": [
{ "matcher": "Bash", "action": "allow" },
{ "matcher": "Bash", "commands": ["rm"], "action": "deny" }
]
}Fix: Use more specific matchers:
{
"permissions": [
{ "matcher": "Bash", "commands": ["rm", "rm -rf"], "action": "deny" },
{ "matcher": "Bash", "action": "allow" }
]
}3. Invalid Patterns
Glob patterns that will never match:
// PROBLEM: Typo in pattern
{
"permissions": [
{ "path": "**.md", "action": "allow" } // Should be **/*.md
]
}Validation Commands
# Check for unreachable rules
jq '.permissions // [] | to_entries | map(select(.value.action == "allow"))' \
.claude/settings.json
# List all permission matchers
jq '.permissions // [] | map(.matcher) | unique' .claude/settings.jsonBest Practices
- Order rules from most specific to least specific
- Use explicit deny rules before catch-all allow rules
- Test rules with actual tool invocations
- Review rules after plugin updates
Remediation Guide
Remediation Guide
Quick remediation steps for common /ork:doctor findings.
Interpreting Results
| Status | Meaning | Action |
|---|---|---|
| All checks pass | Plugin healthy | None required |
| Skills warning | Invalid frontmatter | Run npm run test:skills |
| Agents warning | Invalid frontmatter | Run npm run test:agents |
| Hook error | Missing/broken hook | Check hooks.json and bundles |
| Memory warning | Graph unavailable | Check .claude/memory/ directory |
| Build warning | Out of sync | Run npm run build |
| Permission warning | Unreachable rules | Review .claude/settings.json |
Troubleshooting
"Skills validation failed"
# Run skill structure tests
npm run test:skills
./tests/skills/structure/test-skill-md.sh"Build out of sync"
# Rebuild plugins from source
npm run build"Memory unavailable"
# Check graph memory
ls -la .claude/memory/Report Format
Doctor Report Format
ASCII Report
Full ork plugin:
+===================================================================+
| OrchestKit Health Report |
+===================================================================+
| Version: {version} | CC: {cc_version} | Plugins: ork |
+===================================================================+
| Skills | 67/67 valid |
| Agents | 37/37 valid |
| Hooks | 87/87 entries (12 bundles) |
| Memory | Graph memory healthy |
| MCP | context7 ✓ memory ✓ tavily ○ agentation ○ |
| Permissions | 12/12 reachable |
| Schemas | 15/15 compliant |
| Context | 1850/2200 tokens (84%) |
| Coordination | 0 stale locks |
| CC Version | {cc_version} (OK) |
+===================================================================+
| Status: HEALTHY (10/10 checks passed) |
+===================================================================+Note:
\{version\}is read frompackage.jsonat runtime.\{cc_version\}is detected from Claude Code. Counts reflect installed plugin — dynamic, not hardcoded.
orkl plugin (lite):
+===================================================================+
| OrchestKit Health Report |
+===================================================================+
| Version: {version} | CC: {cc_version} | Plugins: orkl |
+===================================================================+
| Skills | 45/45 valid |
| Agents | 36/36 valid |
| Hooks | 87/87 entries (12 bundles) |
| Memory | Graph memory healthy |
+===================================================================+JSON Output (CI Integration)
/ork:doctor --json{
"version": "{version}",
"claudeCode": "{cc_version}",
"status": "healthy",
"plugins": {
"installed": ["ork"],
"count": 1
},
"checks": {
"skills": {"passed": true, "count": 67, "perPlugin": {"ork": 67}},
"agents": {"passed": true, "count": 37, "perPlugin": {"ork": 37}},
"hooks": {"passed": true, "entries": 87, "bundles": 12, "source": "ork"},
"memory": {"passed": true, "available": ["graph"]},
"mcp": {"passed": true, "servers": {"context7": "enabled", "memory": "enabled", "sequential-thinking": "disabled", "tavily": "disabled", "agentation": "disabled"}},
"permissions": {"passed": true, "count": 12},
"schemas": {"passed": true, "count": 15},
"context": {"passed": true, "usage": 0.84},
"coordination": {"passed": true, "staleLocks": 0},
"ccVersion": {"passed": true, "version": "2.1.47"}
},
"exitCode": 0
}Exit Codes
| Code | Meaning |
|---|---|
| 0 | All checks pass |
| 1 | One or more checks failed |
Schema Validation
Schema Validation
Overview
OrchestKit uses JSON schemas to validate configuration files. This reference explains how to validate and fix schema issues.
Schemas
Located in .claude/schemas/:
| Schema | Validates |
|---|---|
plugin.schema.json | plugin.json |
skill files | All SKILL.md files |
context.schema.json | Context protocol files |
coordination.schema.json | Work registry and decision log |
Validation Commands
Validate All
./tests/schemas/validate-all.shValidate Specific File
# Using ajv
npx ajv validate \
-s .claude/schemas/skill files \
-d .claude/skills/doctor/SKILL.md
# Using jq for basic structure check
jq empty .claude/skills/doctor/SKILL.mdCommon Schema Errors
Missing Required Field
// ERROR: Missing "description"
{
"name": "my-skill",
"version": "1.0.0"
}Fix: Add all required fields:
{
"$schema": "../../schemas/skill files",
"name": "my-skill",
"version": "1.0.0",
"description": "Description of the skill",
"capabilities": ["capability-1"]
}Invalid Type
// ERROR: capabilities must be array
{
"capabilities": "single-capability"
}Fix: Use correct type:
{
"capabilities": ["single-capability"]
}Pattern Mismatch
// ERROR: version must match semver
{
"version": "1.0"
}Fix: Use proper semver:
{
"version": "1.0.0"
}Batch Validation
# Validate all SKILL.md files
for category in skills/*/.claude/skills; do for f in "$category"/*/SKILL.md; do
npx ajv validate \
-s .claude/schemas/skill files \
-d "$f" || echo "INVALID: $f"
doneCreating Valid Files
Use schema as a template:
# View required fields
jq '.required' .claude/schemas/skill files
# View property types
jq '.properties | to_entries | map({key: .key, type: .value.type})' \
.claude/schemas/skill filesSkills Validation
Skills Validation
Overview
OrchestKit includes 68 skills validated against frontmatter requirements and content standards.
Skill Types
| Type | Count | Frontmatter |
|---|---|---|
| User-invocable | 24 | user-invocable: true |
| Reference | 38 | user-invocable: false |
Validation Checks
1. Frontmatter Fields
Required fields:
name- Skill identifierdescription- Brief description with triggersuser-invocable- Boolean for command availability
Optional fields:
context- fork (recommended), inheritagent- Associated agent nametags- Keywords for discoveryversion- Semver versionallowedTools- Tool whitelist
2. Token Budget
Skills must stay within token limits:
- Minimum: 300 tokens
- Maximum: 5000 tokens
# Check skill size
wc -c src/skills/*/SKILL.md | sort -n3. Reference Links
All internal links must resolve:
# Check for broken references
for skill in src/skills/*/SKILL.md; do
grep -o 'references/[^)]*' "$skill" | while read ref; do
dir=$(dirname "$skill")
[ -f "$dir/$ref" ] || echo "Broken: $skill -> $ref"
done
done4. Related Skills
All skills in "Related Skills" section must exist:
# Validate related skill references
grep -h "^- " src/skills/*/SKILL.md | grep -v "http" | \
sed 's/.*`\([^`]*\)`.*/\1/' | sort -uQuick Validation
# Run full skill validation
npm run test:skills
# Or directly
./tests/skills/structure/test-skill-md.shCommon Issues
Missing frontmatter
---
name: my-skill
description: Does something useful
user-invocable: false
---Token budget exceeded
Split into SKILL.md + references/ directory.
Broken reference link
Ensure file exists at references/filename.md.
Version Compatibility
CC Version Compatibility Matrix
Overview
OrchestKit requires Claude Code >= 2.1.47. This matrix documents which CC features OrchestKit depends on and their minimum version requirements.
Feature Matrix
| Feature | Min CC Version | OrchestKit Usage | Degradation if Missing |
|---|---|---|---|
subagent_type in SubagentStart | 2.1.7 | Agent type detection in all SubagentStart hooks | Hooks fall back to prompt scanning (removed in v6.0) |
session_id guaranteed | 2.1.9 | Session tracking in all hooks | Session-scoped features fail |
Hook continue field | 2.1.7 | All hook responses | Hooks silently ignored |
| Permission rules detection | 2.1.3 | Doctor unreachable rules check | Permission check skipped |
sonnet-4-6 model | 2.1.45 | Agent model field in frontmatter | Falls back to older sonnet |
| Plugin hot reload | 2.1.45 | Live plugin updates without restart | Must restart CC after changes |
last_assistant_message | 2.1.47 | Stop/SubagentStop context capture | Missing assistant context |
added_dirs statusline field | 2.1.47 | Multi-directory project support | Single-dir only in statusline |
| Deferred SessionStart (500ms) | 2.1.47 | Hooks fire after env is ready | Race conditions on cold start |
| Agent model in Teams | 2.1.47 | Model field respected in team spawns | Model ignored, uses default |
| Worktree discovery | 2.1.47 | Skills/agents found from worktrees | Worktree sessions miss plugins |
| Background tasks in worktrees | 2.1.47 | Task tool from worktrees | Background agents fail silently |
| Windows hook execution | 2.1.47 | All 87 hooks on Windows | Hooks silently fail on Windows |
| Windows worktree sessions | 2.1.47 | Drive letter casing match | Worktree sessions not matched |
| Improved agent memory | 2.1.47 | Higher context limits | Conservative limits apply |
Ctrl+F find in output | 2.1.47 | Search through session output | No search capability |
Shift+Down multi-line input | 2.1.47 | Multi-line prompt entry | Single-line input only |
| Memory leak fixes (8 leaks) | 2.1.50 | Stable long-running sessions | Memory grows unbounded over time |
claude_agents_cli | 2.1.50 | Doctor agent registration check | Agent registration check skipped |
Version Detection
The doctor skill checks the CC version at runtime:
# CC reports version via environment or CLI
claude --version # Returns e.g. "2.1.47"Compatibility Levels
| CC Version | Support Level | Description |
|---|---|---|
| < 2.1.7 | Unsupported | Core hook protocol missing |
| 2.1.7 - 2.1.44 | Degraded | Missing memory improvements, worktree fixes, Windows support |
| 2.1.45 - 2.1.46 | Partial | Missing 2.1.47 features but functional |
| 2.1.47 - 2.1.49 | Full | All features available, memory leak risk in long sessions |
| >= 2.1.50 | Full + Stable | All features available, memory leaks fixed |
Doctor Check Implementation
The doctor skill validates CC version in category 10:
Claude Code: 2.1.47 (OK)
- Minimum required: 2.1.47When CC version is below 2.1.47, doctor should show:
Claude Code: 2.1.44 (DEGRADED)
- Minimum required: 2.1.47
- Missing features:
- last_assistant_message (Stop/SubagentStop context)
- added_dirs (multi-directory support)
- Windows hook execution
- Worktree discovery
- Deferred SessionStart
- Upgrade: npm install -g @anthropic-ai/claude-code@latestMemory Leak Warning (CC < 2.1.50)
CC 2.1.50 fixed 8 memory leaks affecting long-running sessions:
- Agent teams: completed teammate tasks never garbage collected
- Task state objects never removed from AppState
- TaskOutput retained data after cleanup
- CircularBuffer cleared items retained in backing array
- Shell execution: ChildProcess/AbortController refs retained after cleanup
- LSP diagnostic data never cleaned up after delivery
- File history snapshots: unbounded growth
- Internal caches not cleared after compaction
Recommendation: If CC version < 2.1.50, warn user to upgrade for long sessions.
Doctor should display when CC < 2.1.50:
Claude Code: 2.1.4x (MEMORY LEAK RISK)
- 8 memory leaks fixed in 2.1.50 affect long-running sessions
- Symptoms: increasing memory usage, slower responses over time
- Upgrade: npm install -g @anthropic-ai/claude-code@latestOrchestKit Version History
| OrchestKit | Min CC | Key Changes |
|---|---|---|
| v6.0.x | 2.1.47 | Full CC 2.1.47 adoption, relaxed context limits |
| v5.x | 2.1.34 | Agent Teams support, unified dispatchers |
| v4.x | 2.1.9 | Session tracking, TypeScript hooks |
Distributed Systems
Distributed systems patterns for locking, resilience, idempotency, and rate limiting. Use when implementing distributed locks, circuit breakers, retry policies, idempotency keys, token bucket rate limiters, or fault tolerance patterns.
Domain Driven Design
Domain-Driven Design tactical patterns for complex business domains. Use when modeling entities, value objects, domain services, repositories, or establishing bounded contexts.
Last updated on