| name | setup-reactive |
| description | Set up the Clean Claude Reactive System in the current project. Configures hooks, shared state, and scripts for the multi-agent feedback loop |
| user-invocable | false |
| context | conversation |
| allowed-tools | Read, Write, Bash, Glob |
Setup Reactive System
You are setting up the Clean Claude Reactive System in the current project.
What This Does
- Creates
.clean-claude/ directory for shared agent state
- Copies hook scripts to
scripts/clean-claude/
- Configures Claude Code hooks in
.claude/settings.json
- Sets up
docs/features/ for output artifacts
Setup Steps
Step 1: Create .clean-claude Directory
mkdir -p .clean-claude
cat > .clean-claude/state.json << 'EOF'
{
"workflow": null,
"feature": null,
"phase": "idle",
"retryCount": 0,
"maxRetries": 3,
"agents": {
"lastActive": null,
"history": []
},
"status": "ready"
}
EOF
touch .clean-claude/errors.jsonl
touch .clean-claude/events.jsonl
touch .clean-claude/learnings.jsonl
echo '{}' > .clean-claude/context.json
Step 2: Create Hook Scripts
Create scripts/clean-claude/clean-claude-router.sh:
mkdir -p scripts/clean-claude
Then create the router script that handles agent communication and routing.
Step 3: Configure Hooks
Add to .claude/settings.json:
{
"hooks": {
"SubagentStop": [
{
"matcher": "qa-engineer|frontend-engineer|architect|product-owner|devops-engineer",
"hooks": [
{
"type": "command",
"command": "./scripts/clean-claude/on-agent-stop.sh"
}
]
}
],
"PostToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "./scripts/clean-claude/check-test-results.sh"
}
]
}
]
}
}
Step 4: Create Output Directory
mkdir -p docs/features
Step 5: Update .gitignore
Add runtime files that shouldn't be committed:
# Clean Claude runtime state
.clean-claude/state.json
.clean-claude/events.jsonl
.clean-claude/context.json
.clean-claude/trigger
Keep errors.jsonl and learnings.jsonl as they contain valuable history.
After Setup
The reactive system is ready. Start with:
/reactive-loop
Or check system status:
./scripts/clean-claude/clean-claude-router.sh status
Directory Structure Created
project/
โโโ .clean-claude/
โ โโโ state.json # Current workflow state
โ โโโ errors.jsonl # Error history (keep in git)
โ โโโ events.jsonl # Event log
โ โโโ learnings.jsonl # Patterns learned (keep in git)
โ โโโ context.json # Current feature context
โโโ .claude/
โ โโโ settings.json # Hooks configuration
โโโ scripts/
โ โโโ clean-claude/
โ โโโ clean-claude-router.sh # Main routing logic
โ โโโ on-agent-stop.sh # SubagentStop hook
โ โโโ check-test-results.sh # PostToolUse hook
โโโ docs/
โโโ features/ # Feature documentation output
Verification
After setup, verify with:
cat .clean-claude/state.json | jq '.'
cat .claude/settings.json | jq '.hooks'
ls -la scripts/clean-claude/
Setup complete when all checks pass.