Skip to main content
OrchestKit v6.7.1 — 67 skills, 38 agents, 77 hooks with Opus 4.6 support
OrchestKit
Skills

Doctor

OrchestKit doctor for health diagnostics. Use when running checks on plugin health, diagnosing problems, or troubleshooting issues.

Command low

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:

  1. Installed Plugins - Detects orkl or ork
  2. Skills Validation - Frontmatter, references, token budget (dynamic count)
  3. Agents Validation - Frontmatter, tool refs, skill refs (dynamic count)
  4. Hook Health - Registration, bundles, async patterns
  5. Permission Rules - Detects unreachable rules (CC 2.1.3 feature)
  6. Schema Compliance - Validates JSON files against schemas
  7. Coordination System - Checks lock health and registry integrity
  8. Context Budget - Monitors token usage against budget
  9. Memory System - Graph memory health
  10. Claude Code Version - Validates CC >= 2.1.47
  11. External Dependencies - Checks optional tool availability (agent-browser)
  12. 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 CI

CLI Options

FlagDescription
-v, --verboseDetailed output per check
--jsonJSON output for CI integration
--category=XRun 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

CategoryWhat It ChecksReference
0. Installed PluginsAuto-detects orkl or ork, counts skills/agentsdiagnostic-checks
1. SkillsFrontmatter, context field, token budget, linksskills-validation
2. AgentsFrontmatter, model, skill refs, tool refsagents-validation
3. Hookshooks.json schema, bundles, async patternshook-validation

Categories 4-5: System Health

CategoryWhat It ChecksReference
4. Memory.claude/memory/ exists, decisions.jsonl integrity, queue depthmemory-health
5. Buildplugins/ sync with src/, manifest counts, orphansdiagnostic-checks

Categories 6-9: Infrastructure

CategoryWhat It Checks
6. Permission RulesUnreachable rules detection (CC 2.1.3)
7. Schema ComplianceJSON files against schemas
8. CoordinationMulti-worktree lock health, stale locks
9. Context BudgetToken usage against budget

Categories 10-12: Environment

CategoryWhat It ChecksReference
10. CC VersionRuntime version against minimum requiredversion-compatibility
11. External DepsOptional tools (agent-browser)diagnostic-checks
12. MCP StatusEnabled/disabled state, credential checksmcp-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).

  • ork:configure - Configure plugin settings
  • ork:quality-gates - CI/CD integration
  • security-scanning - Comprehensive audits

References


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 plugin

1. 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 exist

2. 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 tools

3. 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/agents

6. 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-browser

MCP 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 startup

Output 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.json

Misconfigured (agentation enabled but not installed):

MCP Servers:
- agentation:         enabled  ✗  agentation-mcp package not found
                                  Fix: npm install -D agentation-mcp  or  set "disabled": true

References (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 keywords
  • model - opus, sonnet, or haiku
  • tools - Array of allowed CC tools
  • skills - Array of skill names to auto-inject

Optional fields:

  • context - fork or inherit
  • color - Display color
  • hooks - Agent-specific hooks

2. Model Validation

Only valid models:

# Check model values
grep "^model:" src/agents/*.md | sort | uniq -c

Expected: 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
done

4. 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.sh

Common Issues

Invalid model

model: sonnet  # Valid: opus, sonnet, haiku

Missing 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
fi

Check: 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 agents CLI

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 entries

ork (full):

Installed Plugins: 1
- ork: 68 skills, 38 agents, 87 hook entries

Skills Validation

Full ork:

Skills: 67/67 valid
- User-invocable: 24 commands
- Reference skills: 38

orkl only:

Skills: 46/46 valid
- User-invocable: 24 commands
- Reference skills: 21

Agents Validation

Agents: 36/36 valid
- Models: 12 sonnet, 15 haiku, 8 opus
- All skill references valid

Hook 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 3

Build System

Build System: in sync
- Skills: 67 src/ = 67 plugins/
- Agents: 36 src/ = 36 plugins/
- Last build: 2 minutes ago

Permission Rules

Permission Rules: 12/12 reachable

Schema Compliance

Schemas: 15/15 compliant

Coordination System

Coordination: healthy
- Active instances: 1
- Stale locks: 0

Context 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 available

Degraded:

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@latest

External 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 pattern

Platform Support

PlatformHook StatusNotes
macOSFull supportNative execution
LinuxFull supportNative execution
WindowsFull 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.ts provides 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 TypeCountPurpose
PreToolUse14Before tool execution
SubagentStart7Before agent spawn
SubagentStop7After agent completes
PostToolUse6After tool execution
Setup6Plugin initialization
SessionStart5Session initialization
UserPromptSubmit5Prompt enhancement
PermissionRequest3Auto-approval logic
SessionEnd3Session cleanup
TeammateIdle3Teammate idle handling
Stop2Conversation end
Notification2Desktop/sound alerts
PostToolUseFailure1Failed tool handling
PreCompact1Before context compaction
TaskCompleted1Task completion handling
Total Global66

Bundle Structure

BundleHandlersAsync
agent.mjsAgent hooksNo
hooks.mjsCore dispatchingNo
lifecycle.mjsSession lifecycleYes
notification.mjsAlertsYes
permission.mjsAuto-approveNo
posttool.mjsPost-executionYes
pretool.mjsPre-executionNo
prompt.mjsPrompt enhancementYes
setup.mjsInitializationYes
skill.mjsSkill-scoped hooksNo
stop.mjsConversation endYes
subagent.mjsAgent lifecycleNo

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/*.mjs

3. 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.mjs

4. 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.log

Hook 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
done

Troubleshooting

Hook not firing

  1. Check matcher pattern matches tool name
  2. Verify bundle exists in dist/
  3. Check hooks.json registration

Hook timing out

Default timeout: 120s (bash), 600s (CC 2.1.3+)

Exit Codes

CodeMeaning
0Success / Allow
1Error (logged, continues)
2Block (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

StatusMeaning
healthyGraph memory operational, no issues
degradedWorking but with issues (corrupt data, high queue depth)
unavailableNot 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.jsonl

Health Indicators

  • Directory exists: .claude/memory/
  • decisions.jsonl: Valid JSONL, no corrupt lines
  • graph-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/memory

The 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.json

Best Practices

  1. Order rules from most specific to least specific
  2. Use explicit deny rules before catch-all allow rules
  3. Test rules with actual tool invocations
  4. Review rules after plugin updates

Remediation Guide

Remediation Guide

Quick remediation steps for common /ork:doctor findings.

Interpreting Results

StatusMeaningAction
All checks passPlugin healthyNone required
Skills warningInvalid frontmatterRun npm run test:skills
Agents warningInvalid frontmatterRun npm run test:agents
Hook errorMissing/broken hookCheck hooks.json and bundles
Memory warningGraph unavailableCheck .claude/memory/ directory
Build warningOut of syncRun npm run build
Permission warningUnreachable rulesReview .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 from package.json at 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

CodeMeaning
0All checks pass
1One 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/:

SchemaValidates
plugin.schema.jsonplugin.json
skill filesAll SKILL.md files
context.schema.jsonContext protocol files
coordination.schema.jsonWork registry and decision log

Validation Commands

Validate All

./tests/schemas/validate-all.sh

Validate 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.md

Common 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"
done

Creating 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 files

Skills Validation

Skills Validation

Overview

OrchestKit includes 68 skills validated against frontmatter requirements and content standards.

Skill Types

TypeCountFrontmatter
User-invocable24user-invocable: true
Reference38user-invocable: false

Validation Checks

1. Frontmatter Fields

Required fields:

  • name - Skill identifier
  • description - Brief description with triggers
  • user-invocable - Boolean for command availability

Optional fields:

  • context - fork (recommended), inherit
  • agent - Associated agent name
  • tags - Keywords for discovery
  • version - Semver version
  • allowedTools - 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 -n

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
done

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 -u

Quick Validation

# Run full skill validation
npm run test:skills

# Or directly
./tests/skills/structure/test-skill-md.sh

Common Issues

Missing frontmatter

---
name: my-skill
description: Does something useful
user-invocable: false
---

Token budget exceeded

Split into SKILL.md + references/ directory.

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

FeatureMin CC VersionOrchestKit UsageDegradation if Missing
subagent_type in SubagentStart2.1.7Agent type detection in all SubagentStart hooksHooks fall back to prompt scanning (removed in v6.0)
session_id guaranteed2.1.9Session tracking in all hooksSession-scoped features fail
Hook continue field2.1.7All hook responsesHooks silently ignored
Permission rules detection2.1.3Doctor unreachable rules checkPermission check skipped
sonnet-4-6 model2.1.45Agent model field in frontmatterFalls back to older sonnet
Plugin hot reload2.1.45Live plugin updates without restartMust restart CC after changes
last_assistant_message2.1.47Stop/SubagentStop context captureMissing assistant context
added_dirs statusline field2.1.47Multi-directory project supportSingle-dir only in statusline
Deferred SessionStart (500ms)2.1.47Hooks fire after env is readyRace conditions on cold start
Agent model in Teams2.1.47Model field respected in team spawnsModel ignored, uses default
Worktree discovery2.1.47Skills/agents found from worktreesWorktree sessions miss plugins
Background tasks in worktrees2.1.47Task tool from worktreesBackground agents fail silently
Windows hook execution2.1.47All 87 hooks on WindowsHooks silently fail on Windows
Windows worktree sessions2.1.47Drive letter casing matchWorktree sessions not matched
Improved agent memory2.1.47Higher context limitsConservative limits apply
Ctrl+F find in output2.1.47Search through session outputNo search capability
Shift+Down multi-line input2.1.47Multi-line prompt entrySingle-line input only
Memory leak fixes (8 leaks)2.1.50Stable long-running sessionsMemory grows unbounded over time
claude_agents_cli2.1.50Doctor agent registration checkAgent 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 VersionSupport LevelDescription
< 2.1.7UnsupportedCore hook protocol missing
2.1.7 - 2.1.44DegradedMissing memory improvements, worktree fixes, Windows support
2.1.45 - 2.1.46PartialMissing 2.1.47 features but functional
2.1.47 - 2.1.49FullAll features available, memory leak risk in long sessions
>= 2.1.50Full + StableAll 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.47

When 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@latest

Memory 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@latest

OrchestKit Version History

OrchestKitMin CCKey Changes
v6.0.x2.1.47Full CC 2.1.47 adoption, relaxed context limits
v5.x2.1.34Agent Teams support, unified dispatchers
v4.x2.1.9Session tracking, TypeScript hooks
Edit on GitHub

Last updated on

On this page

Related SkillsOrchestKit Health DiagnosticsOverviewWhen to UseQuick StartCLI OptionsHealth Check CategoriesCategories 0-3: Core ValidationCategories 4-5: System HealthCategories 6-9: InfrastructureCategories 10-12: EnvironmentReport FormatInterpreting Results & TroubleshootingRelated SkillsReferencesRules (2)Diagnostic Checks — CRITICALDiagnostic Check Procedures0. Installed Plugins Detection1. Skills Validation2. Agents Validation3. Hook Health4. Memory System5. Build System6. Permission Rules7. Schema Compliance8. Coordination System9. Context Budget10. Claude Code Version11. External DependenciesMCP Status Checks — HIGHMCP Status ChecksCheck ProcedureOutput ExamplesReferences (10)Agents ValidationAgents ValidationOverviewAgent StructureValidation Checks1. Frontmatter Fields2. Model Validation3. Skills References4. Tools ValidationQuick ValidationCommon IssuesInvalid modelMissing skill referenceInvalid tool nameAgent Registration Check (CC 2.1.50+)Health Check OutputsHealth Check Output ExamplesInstalled PluginsSkills ValidationAgents ValidationHook HealthMemory SystemBuild SystemPermission RulesSchema ComplianceCoordination SystemContext BudgetClaude Code VersionExternal DependenciesHook ValidationHook ValidationOverviewHook ArchitecturePlatform SupportHook CategoriesBundle StructureValidation Checks1. hooks.json Schema2. Bundle Existence3. Async Hook Pattern4. Matcher SyntaxDebug Mode (Issue #243)Enable Debug LoggingView Debug LogsHook MetricsPID TrackingTroubleshootingHook not firingHook timing outExit CodesMemory HealthMemory HealthOverviewAutomated Health CheckStatus MeaningsGraph MemoryValidation CommandsHealth IndicatorsDegraded ConditionsTroubleshootingGraph memory missingCorrupt JSONL linesHigh queue depthPermission RulesPermission Rules AnalysisOverviewCommon Issues1. Unreachable Rules2. Shadowed Rules3. Invalid PatternsValidation CommandsBest PracticesRemediation GuideRemediation GuideInterpreting ResultsTroubleshooting"Skills validation failed""Build out of sync""Memory unavailable"Report FormatDoctor Report FormatASCII ReportJSON Output (CI Integration)Exit CodesSchema ValidationSchema ValidationOverviewSchemasValidation CommandsValidate AllValidate Specific FileCommon Schema ErrorsMissing Required FieldInvalid TypePattern MismatchBatch ValidationCreating Valid FilesSkills ValidationSkills ValidationOverviewSkill TypesValidation Checks1. Frontmatter Fields2. Token Budget3. Reference Links4. Related SkillsQuick ValidationCommon IssuesMissing frontmatterToken budget exceededBroken reference linkVersion CompatibilityCC Version Compatibility MatrixOverviewFeature MatrixVersion DetectionCompatibility LevelsDoctor Check ImplementationMemory Leak Warning (CC < 2.1.50)OrchestKit Version History