# Send Claude Code Supervisor to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "claude-code-supervisor",
    "name": "Claude Code Supervisor",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/johba37/claude-code-supervisor",
    "canonicalUrl": "https://clawhub.ai/johba37/claude-code-supervisor",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/claude-code-supervisor",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claude-code-supervisor",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "assets/supervisor-state.template.json",
      "references/escalation-rules.md",
      "references/state-patterns.md",
      "scripts/hooks/on-error.sh"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "claude-code-supervisor",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T11:29:37.971Z",
      "expiresAt": "2026-05-08T11:29:37.971Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claude-code-supervisor",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=claude-code-supervisor",
        "contentDisposition": "attachment; filename=\"claude-code-supervisor-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "claude-code-supervisor"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/claude-code-supervisor"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/claude-code-supervisor",
    "downloadUrl": "https://openagent3.xyz/downloads/claude-code-supervisor",
    "agentUrl": "https://openagent3.xyz/skills/claude-code-supervisor/agent",
    "manifestUrl": "https://openagent3.xyz/skills/claude-code-supervisor/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/claude-code-supervisor/agent.md"
  }
}
```
## Documentation

### Claude Code Supervisor

Bridge between Claude Code's lifecycle hooks and your agent harness.

### Architecture

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

### 1. Install hooks into a project

{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)

### 2. Configure

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

### 3. Register a supervised session

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"
    }
  }
}

### 4. Launch Claude Code in tmux

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.

### How the Pre-Filter Works (Option D)

Not every hook event needs an LLM call. Bash catches the obvious cases first:

### on-stop.sh

SignalBash decisionLLM triage?max_tokensAlways needs attention✅ Yesend_turn + shell prompt backAgent might be done✅ Yesend_turn + no promptAgent is mid-work❌ Skipstop_sequenceNormal❌ Skip

### on-error.sh

SignalBash decisionLLM triage?API 429 / rate limitTransient, will resolve❌ Log onlyAPI 500Agent likely stuck✅ YesOther tool errorUnknown severity✅ Yes

### on-notify.sh

SignalBash decisionLLM triage?auth_*Internal, transient❌ Skippermission_promptNeeds decision✅ Yesidle_promptAgent waiting✅ Yes

### Triage Classifications

The LLM returns one of:

VerdictMeaningTypical actionFINEAgent is working normallyLog silently, no notificationNEEDS_NUDGETransient error, should continueSend "continue" to tmuxSTUCKLooping or not progressingTry different approach or escalateDONETask completed successfullyReport to humanESCALATENeeds human judgmentNotify human with context

### Handling Notifications (for agent harness authors)

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

### Nudging via tmux

tmux -S "$SOCKET" send-keys -t "$SESSION" "continue — the API error was transient" Enter

### Escalation format

See references/escalation-rules.md for when to nudge vs escalate and quiet hours.

### Watchdog (Who Watches the Watchman?)

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:

Reads supervisor-state.json for all "running" sessions
Checks: is the tmux socket alive? Is the session there? Is Claude Code still running?
If something is dead and no hook reported it → notifies via the configured command
Updates lastWatchdogAt in state for tracking

Run 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.

### Files

scripts/install-hooks.sh — one-command setup per project
scripts/hooks/on-stop.sh — Stop event handler with bash pre-filter
scripts/hooks/on-error.sh — PostToolUseFailure handler with bash pre-filter
scripts/hooks/on-notify.sh — Notification handler with bash pre-filter
scripts/triage.sh — LLM triage (called by hooks for ambiguous cases)
scripts/lib.sh — shared config loading and notification functions
scripts/watchdog.sh — dead session detector (pure bash, no LLM dependency)
references/state-patterns.md — terminal output pattern matching guide
references/escalation-rules.md — when to nudge vs escalate vs wait
supervisor.yml.example — example configuration
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: johba37
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-01T11:29:37.971Z
- Expires at: 2026-05-08T11:29:37.971Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/claude-code-supervisor)
- [Send to Agent page](https://openagent3.xyz/skills/claude-code-supervisor/agent)
- [JSON manifest](https://openagent3.xyz/skills/claude-code-supervisor/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/claude-code-supervisor/agent.md)
- [Download page](https://openagent3.xyz/downloads/claude-code-supervisor)