| name | wiring |
| description | Wiring Verification |
| user-invocable | false |
Wiring Verification
When building infrastructure components, ensure they're actually invoked in the execution path.
Pattern
Every module needs a clear entry point. Dead code is worse than no code - it creates maintenance burden and false confidence.
The Four-Step Wiring Check
Before marking infrastructure "done", verify:
- Entry Point Exists: How does user action trigger this code?
- Call Graph Traced: Can you follow the path from entry to execution?
- Integration Tested: Does an end-to-end test exercise this path?
- No Dead Code: Is every built component actually reachable?
DO
Verify Entry Points
grep -r "orchestration" .claude/settings.json
grep -r "skill-name" .claude/skill-rules.json
ls -la scripts/orchestrate.py
grep -r "from orchestration_layer import" .
Trace Call Graphs
.claude/hooks/pre-tool-use.sh
↓
npx tsx pre-tool-use.ts
↓
spawn('scripts/orchestrate.py')
↓
from orchestration_layer import dispatch
↓
dispatch(agent_type, task)
Test End-to-End
pytest tests/unit/orchestration_layer_test.py
echo '{"tool": "Task"}' | .claude/hooks/pre-tool-use.sh
Document Wiring
## Wiring
- **Entry Point**: PreToolUse hook on Task tool
- **Registration**: `.claude/settings.json` line 45
- **Call Path**: hook → pre-tool-use.ts → scripts/orchestrate.py → orchestration_layer.py
- **Test**: `tests/integration/task_orchestration_test.py`
DON'T
Build Without Wiring
Create Parallel Routing
Assume Imports Work
from orchestration_layer import dispatch
uv run python -c "from orchestration_layer import dispatch; print('OK')"
Skip Integration Tests
pytest tests/unit/
pytest tests/integration/
Common Wiring Gaps
Hook Not Registered
{
"hooks": {
"PreToolUse": []
}
}
Fix: Add hook registration:
{
"hooks": {
"PreToolUse": [{
"matcher": ["Task"],
"hooks": [{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/orchestration.sh"
}]
}]
}
}
Script Not Executable
-rw-r--r-- scripts/orchestrate.py
chmod +x scripts/orchestrate.py
Module Not Importable
from orchestration_layer import dispatch
sys.path.insert(0, str(Path(__file__).parent.parent))
Router Has No Dispatch Path
AGENT_MAP = {
"implement": ImplementAgent,
"research": ResearchAgent,
}
def route(task):
return "general-purpose"
def route(task):
agent_type = classify(task)
return AGENT_MAP[agent_type]
Wiring Checklist
Before marking infrastructure "complete":
Real-World Examples
Example 1: DAG Orchestration (This Session)
What was built:
opc/orchestration/orchestration_layer.py (500+ lines)
opc/orchestration/dag/ (DAG builder, validator, executor)
- 18 agent type definitions
- Sophisticated routing logic
Wiring gap:
- No hook calls orchestration_layer.py
- No script imports the DAG modules
- Agent routing returns hardcoded "general-purpose"
- Result: 100% dead code
Fix:
- Create PreToolUse hook for Task tool
- Hook calls
scripts/orchestrate.py
- Script imports and calls
orchestration_layer.dispatch()
- Dispatch uses AGENT_MAP to route to actual agents
- Integration test: Submit Task → verify correct agent type used
Example 2: Artifact Index (Previous Session)
What was built:
- SQLite database schema
- Indexing logic
- Query functions
Wiring gap:
- No hook triggered indexing
- Files created but never indexed
Fix:
- PostToolUse hook on Write tool
- Hook calls indexing script immediately
- Integration test: Write file → verify indexed
Detection Strategy
Grep for Orphans
find . -name "*.py" -type f
for file in $(find . -name "*.py"); do
module=$(basename $file .py)
grep -r "from.*$module import\|import.*$module" . || echo "ORPHAN: $file"
done
Check Hook Registration
ls .claude/hooks/*.sh
for hook in $(ls .claude/hooks/*.sh); do
basename_hook=$(basename $hook)
grep -q "$basename_hook" .claude/settings.json || echo "UNREGISTERED: $hook"
done
Verify Script Execution
find scripts/ -name "*.py"
for script in $(find scripts/ -name "*.py"); do
uv run python -c "import sys; sys.path.insert(0, 'scripts'); import $(basename $script .py)" 2>/dev/null || echo "IMPORT FAIL: $script"
done
Source
- This session: DAG orchestration wiring gap - 500+ lines of dead code discovered
- Previous sessions: Artifact Index, LMStudio integration - wiring added after initial build