claude-code-supervisorSupervise Claude Code sessions running in tmux. Uses Claude Code hooks with bash pre-filtering (Option D) and fast LLM triage to detect errors, stuck agents, and task completion. Harness-agnostic β works with OpenClaw, webhooks, ntfy, or any notification backend. Use when: (1) launching long-running Claude Code tasks that need monitoring, (2) setting up automatic nudging for API errors or premature stops, (3) getting progress reports from background coding agents, (4) continuing work after session/context limits reset. Requires: tmux, claude CLI.
Install via ClawdBot CLI:
clawdbot install johba37/claude-code-supervisorBridge between Claude Code's lifecycle hooks and your agent harness.
Claude Code (in tmux)
β Stop / Error / Notification
βΌ
Bash pre-filter (Option D)
β obvious cases handled directly
β ambiguous cases pass through
βΌ
Fast LLM triage (claude -p with Haiku, or local LLM)
β classifies: FINE | NEEDS_NUDGE | STUCK | DONE | ESCALATE
β FINE β logged silently
βΌ
Notify command (configurable)
β openclaw wake, webhook, ntfy, script, etc.
βΌ
Agent harness decides + acts
β nudge (send-keys to tmux), wait, escalate to human
{baseDir}/scripts/install-hooks.sh /path/to/your/project
Creates:
.claude/hooks/supervisor/ β hook scripts + triage.claude/settings.json β wired into Claude Code lifecycle.claude-code-supervisor.yml β configuration (edit this)Edit .claude-code-supervisor.yml:
triage:
command: "claude -p --no-session-persistence" # or: ollama run llama3.2
model: "claude-haiku-4-20250414"
notify:
command: "openclaw gateway call wake --params" # or: curl, ntfy, script
Create ~/.openclaw/workspace/supervisor-state.json (or wherever your harness keeps state):
{
"sessions": {
"my-task": {
"socket": "/tmp/openclaw-tmux-sockets/openclaw.sock",
"tmuxSession": "my-task",
"projectDir": "/path/to/project",
"goal": "Fix issue #42",
"successCriteria": "Tests pass, committed",
"maxNudges": 5,
"escalateAfterMin": 60,
"status": "running"
}
}
}
SOCKET="/tmp/openclaw-tmux-sockets/openclaw.sock"
tmux -S "$SOCKET" new -d -s my-task
tmux -S "$SOCKET" send-keys -t my-task "cd /path/to/project && claude 'Fix issue #42'" Enter
Hooks fire automatically. Triage assesses. You get notified only when it matters.
Not every hook event needs an LLM call. Bash catches the obvious cases first:
| Signal | Bash decision | LLM triage? |
|--------|--------------|-------------|
| max_tokens | Always needs attention | β
Yes |
| end_turn + shell prompt back | Agent might be done | β
Yes |
| end_turn + no prompt | Agent is mid-work | β Skip |
| stop_sequence | Normal | β Skip |
| Signal | Bash decision | LLM triage? |
|--------|--------------|-------------|
| API 429 / rate limit | Transient, will resolve | β Log only |
| API 500 | Agent likely stuck | β Yes |
| Other tool error | Unknown severity | β Yes |
| Signal | Bash decision | LLM triage? |
|--------|--------------|-------------|
| auth_* | Internal, transient | β Skip |
| permission_prompt | Needs decision | β
Yes |
| idle_prompt | Agent waiting | β
Yes |
The LLM returns one of:
| Verdict | Meaning | Typical action |
|---------|---------|----------------|
| FINE | Agent is working normally | Log silently, no notification |
| NEEDS_NUDGE | Transient error, should continue | Send "continue" to tmux |
| STUCK | Looping or not progressing | Try different approach or escalate |
| DONE | Task completed successfully | Report to human |
| ESCALATE | Needs human judgment | Notify human with context |
Wake events arrive with the prefix cc-supervisor: followed by the classification:
cc-supervisor: NEEDS_NUDGE | error:api_500 | cwd=/home/user/project | ...
cc-supervisor: DONE | stopped:end_turn:prompt_back | cwd=/home/user/project | ...
tmux -S "$SOCKET" send-keys -t "$SESSION" "continue β the API error was transient" Enter
See references/escalation-rules.md for when to nudge vs escalate and quiet hours.
Hooks depend on Claude Code being alive. If the session hard-crashes, hits account
limits, or the process gets OOM-killed, no hooks fire. The watchdog catches this.
scripts/watchdog.sh is a pure bash script (no LLM, no Claude Code dependency) that:
supervisor-state.json for all "running" sessionslastWatchdogAt in state for trackingRun it on a timer. Choose your poison:
System cron:
*/15 * * * * /path/to/claude-code-supervisor/scripts/watchdog.sh
OpenClaw cron:
{
"schedule": { "kind": "every", "everyMs": 900000 },
"payload": { "kind": "systemEvent", "text": "cc-supervisor: watchdog β run /path/to/scripts/watchdog.sh and report" },
"sessionTarget": "main"
}
systemd timer, launchd, or whatever runs periodically on your box.
The watchdog is deliberately dumb β no LLM, no complex logic, just "is the process still
there?" This means it works even when the triage model is down, the API is melting, or
your account hit its limit. Belts and suspenders.
scripts/install-hooks.sh β one-command setup per projectscripts/hooks/on-stop.sh β Stop event handler with bash pre-filterscripts/hooks/on-error.sh β PostToolUseFailure handler with bash pre-filterscripts/hooks/on-notify.sh β Notification handler with bash pre-filterscripts/triage.sh β LLM triage (called by hooks for ambiguous cases)scripts/lib.sh β shared config loading and notification functionsscripts/watchdog.sh β dead session detector (pure bash, no LLM dependency)references/state-patterns.md β terminal output pattern matching guidereferences/escalation-rules.md β when to nudge vs escalate vs waitsupervisor.yml.example β example configurationGenerated Mar 1, 2026
Development teams use Claude Code Supervisor to monitor AI agents fixing critical bugs overnight. The system detects when agents get stuck on API errors or reach token limits, automatically nudging them to continue or escalating to on-call engineers. This ensures 24/7 progress on urgent issues without requiring constant human oversight.
Enterprises migrating legacy codebases use supervised Claude Code sessions to automate refactoring tasks. The supervisor monitors multiple parallel sessions, detecting when agents complete subtasks or encounter permission prompts that need human decisions. This enables continuous migration progress across large codebases with minimal manual intervention.
QA teams deploy Claude Code agents to automatically update and maintain test suites as codebases evolve. The supervisor watches for agents getting stuck on flaky tests or idle prompts, sending nudges to continue or escalating when human judgment is needed for complex test logic decisions.
Technical writing teams use supervised AI agents to generate and update API documentation from code changes. The system monitors for completion signals when documentation tasks are finished, automatically notifying teams to review and deploy updated documentation without manual status checking.
Development shops running multiple Claude Code agents on different project aspects use the supervisor to coordinate parallel work. It detects when one agent completes its task and needs handoff to another, or when agents get stuck in dependency loops, ensuring smooth workflow transitions between specialized AI agents.
Offer Claude Code Supervisor as a cloud service with web dashboard, alerting, and analytics. Charge monthly subscriptions based on number of monitored sessions, with enterprise tiers offering custom notification integrations and SLA guarantees. Revenue comes from recurring subscriptions with volume discounts for large development teams.
Provide consulting and integration services to large organizations implementing AI-assisted development workflows. Offer custom configuration, training, and ongoing support for integrating Claude Code Supervisor with existing CI/CD pipelines and monitoring systems. Revenue is project-based with ongoing maintenance contracts.
Distribute Claude Code Supervisor as part of a larger marketplace for AI development tools. Offer the core tool for free to drive adoption, then monetize through premium notification backends, advanced analytics plugins, and specialized triage models. Revenue comes from marketplace commissions and premium feature sales.
π¬ Integration Tip
Start by integrating with existing tmux sessions before adding notification backends, and use the watchdog script with system cron for reliable monitoring independent of AI service availability.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Provides a 7-step debugging protocol plus language-specific commands to systematically identify, verify, and fix software bugs across multiple environments.
A comprehensive skill for using the Cursor CLI agent for various software engineering tasks (updated for 2026 features, includes tmux automation guide).
Write, run, and manage unit, integration, and E2E tests across TypeScript, Python, and Swift using recommended frameworks.
Control and operate Opencode via slash commands. Use this skill to manage sessions, select models, switch agents (plan/build), and coordinate coding through Opencode.
Coding style memory that adapts to your preferences, conventions, and patterns for consistent coding.