# openclaw-babysit

Adopt this skill: https://proskills.md/skills/other/pejmanjohn-openclaw-admin-skills-skills-openclaw-babysit

Page: https://proskills.md/skills/other/pejmanjohn-openclaw-admin-skills-skills-openclaw-babysit
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/openclaw-babysit/SKILL.md
size: 8032
upstream: https://github.com/pejmanjohn/openclaw-admin-skills/blob/main/skills/openclaw-babysit/SKILL.md

````text
---
name: openclaw-babysit
description: Use when the user wants to monitor OpenClaw channel health on a recurring basis and either alert or auto-fix when channels degrade. Designed to run inside `/loop` (e.g. `/loop 5m /openclaw-babysit` for alert mode, `/loop 5m /openclaw-babysit --auto-fix` for autonomous repair). Triggers on natural-language phrasings like "babysit my openclaw", "watch openclaw", "keep openclaw running", "make sure my agents stay reachable", "auto-fix openclaw if it breaks", "monitor my channels". One tick = one health check; a streak of healthy ticks closes any open incident, a degraded reading either alerts or invokes `/openclaw-troubleshooting` in authorized mode.
---

# OpenClaw Babysit

A monitoring skill that runs as a recurring health check over OpenClaw's channels (Slack, Discord, Telegram, BlueBubbles, etc.) and decides — based on its mode — whether to alert the user or invoke autonomous repair. Designed to be wrapped by Claude Code's `/loop` so each tick is a single health check.

The success criterion is **channels working** — the user can reach their agents through the channels they have enabled. Gateway-level health is a means to that end, not the end itself.

## Modes

This skill supports two modes, selected by the loop command:

| Mode | Invocation | Behavior on degradation |
| --- | --- | --- |
| Alert | `/loop <interval> /openclaw-babysit` | Print a clear summary of what's wrong and stop. The user runs `/openclaw-troubleshooting` interactively if they want to dig in. |
| Auto-fix | `/loop <interval> /openclaw-babysit --auto-fix` | Invoke `/openclaw-troubleshooting` with `OPENCLAW_TROUBLESHOOTING_AUTHORIZED=1`, let it apply allowlisted fixes, verify, and iterate up to the cap. On give-up, drop to alert. |

Default is alert-only. Auto-fix is opt-in and explicit.

## Finding the repo root

The skill must resolve the source repo root before reading or writing any `local/` path:

```bash
REPO_ROOT=""
for d in \
  ~/.claude/skills/openclaw-babysit \
  ~/.claude/skills/openclaw-troubleshooting \
  ~/.openclaw/skills/openclaw-babysit \
  ~/.codex/skills/openclaw-babysit \
  ~/src/openclaw-skills/skills/openclaw-babysit; do
  if [ -e "$d" ]; then
    resolved="$(readlink "$d" 2>/dev/null || echo "$d")"
    candidate="$(cd "$resolved/../.." 2>/dev/null && pwd)"
    if [ -d "$candidate/local" ] && [ -d "$candidate/skills" ]; then
      REPO_ROOT="$candidate"
      break
    fi
  fi
done
echo "${REPO_ROOT:?Could not find openclaw-skills repo root}"
```

The result must contain both `local/` and `skills/` directories. Use `$REPO_ROOT` for all paths below.

## Quick start

- **PREFLIGHT — Load the instance registry.** Read `$REPO_ROOT/local/state/instances.json` for the default instance. If the file is missing or malformed, exit with a one-line message asking the user to run `/openclaw-troubleshooting` (which auto-triggers discovery). Do not invoke discovery from babysit itself — registry repair is interactive.
- **Load tick state.** Read `$REPO_ROOT/local/state/babysit-<instance-id>.json` if it exists. If not, this is a fresh start; treat all counters as unset.
- **Run one health check.** See `playbooks/health-check.md`.
- **Decide.** Healthy → record stable-tick streak; if streak ≥ 2 and an incident was open, mark it closed. Degraded → branch on mode (alert vs auto-fix).
- **Write tick state.** Always update the state file with current counters and current incident state before exiting the tick.
- **One line of output when healthy.** Verbose output only on state change (degraded → alerting, alerting → recovered, auto-fix → applied X, auto-fix → giving up).

## Workflow

A single tick is structured as:

```
1. Resolve repo root, instance, prior state.
2. Run health check (playbooks/health-check.md). Output: { status: healthy|degraded, evidence: {...} }.
3. Reconcile against prior state:
   - prior healthy + now healthy: increment consecutive-healthy counter, write state, emit one-line OK.
   - prior healthy + now degraded: open new incident in state, branch on mode.
   - prior degraded + now degraded: same incident, branch on mode (with iteration counters).
   - prior degraded + now healthy: increment consecutive-healthy. If ≥ 2, close the incident and emit a recovery line.
4. Mode branch:
   - Alert mode: print degradation summary, stop. Do NOT invoke troubleshooting.
   - Auto-fix mode: see "Auto-fix loop" below.
5. Write tick state.
```

## Auto-fix loop

When degraded in auto-fix mode:

1. **Check iteration cap.** If the current incident's `fixesTried` length ≥ 3, or the same fix was just attempted in the previous tick and didn't recover, drop to alert mode for this incident: emit a "tried X, Y, Z; giving up; need manual intervention" message and stop applying fixes for the rest of this incident. Do not retry until the user clears the state or recovery is observed independently.

2. **Invoke `/openclaw-troubleshooting` in authorized mode.** Set `OPENCLAW_TROUBLESHOOTING_AUTHORIZED=1` in the shell environment for any commands the troubleshooting skill runs, and pass the diagnosis hint (the symptoms babysit observed). The troubleshooting skill will diagnose, check `playbooks/auto-fix-allowlist.md`, and either:
   - Apply an allowlisted fix and report the verification result.
   - Emit a one-paragraph diagnosis and exit (no fix applied).

3. **Record the attempt.** Append to the current incident's `fixesTried` with the signature matched and the fix applied (or "no allowlisted fix"). Update `lastFixAt` to now.

4. **Re-run the health check.** A single tick can include the apply-and-verify cycle; do not wait for the next loop interval. If healthy: emit a "fix X applied; channels back" message and continue; the next tick will confirm stability. If still degraded: stop here for this tick — the next loop interval will pick up where this one left off (the iteration cap counts the cumulative attempts, not per-tick).

5. **Never apply config edits in auto-fix mode.** This rule is enforced by the troubleshooting skill's allowlist; babysit relies on it. If the troubleshooting skill returns "no allowlisted fix" because the matched signature is config-shaped, treat this as a give-up signal and drop to alert mode for this incident.

## State file

Path: `$REPO_ROOT/local/state/babysit-<instance-id>.json`. One per OpenClaw instance.

Schema:

```json
{
  "version": 1,
  "instanceId": "default",
  "lastTickAt": "<ISO-8601 UTC timestamp>",
  "lastRunsCounter": 1,
  "consecutiveHealthyTicks": 4,
  "currentIncident": null
}
```

When an incident is open, `currentIncident` is:

```json
{
  "id": "incident-<UTC timestamp slug>",
  "startedAt": "<ISO-8601 UTC timestamp>",
  "lastSignature": "<verbatim primary signature from the health check>",
  "fixesTried": [
    { "appliedAt": "<ISO-8601 UTC timestamp>", "signature": "<allowlist entry id, e.g. A1>", "result": "verified-healthy" }
  ],
  "lastFixAt": "<ISO-8601 UTC timestamp>",
  "givenUp": false
}
```

The state file is written atomically (write to `<path>.tmp`, then rename) to avoid partial writes if a tick is interrupted. The file is gitignored under the existing `local/state/*` pattern.

## Per-tick output discipline

Loops generate a lot of text. Babysit must keep its per-tick output proportional to what changed:

- **Healthy, no incident open:** one line. e.g. `babysit: OK — 4 ticks healthy, channels: slack, discord, telegram, bluebubbles all ok`.
- **Healthy, recovery (incident just closed):** 2-3 lines. Note the closed incident, what fixed it (if known), and the tick streak.
- **Degraded, alert mode:** structured summary of evidence and the recommended next step (`/openclaw-troubleshooting`). No tail output beyond that.
- **Degraded, auto-fix mode:** report what was tried, the result, and whether the incident is open or closed at end of tick.

If babysit is producing more than ~10 lines per healthy tick, something is wrong with the implementation, not the install.

## Reference map

-
````

## File: README.md
upstream: https://github.com/pejmanjohn/openclaw-admin-skills/blob/main/README.md

````text
# 🦞 openclaw-admin-skills

Natural-language skills for running OpenClaw. Tell your AI harness to "update openclaw" or "fix my openclaw" in plain English, and get a safe, reviewable workflow — preflight checks, evidence-based diagnosis, explicit approval before any change, and per-user memory that makes every next run smarter.

## What's included

| Skill | Triggers on | What it does |
|---|---|---|
| **openclaw-update** | `"update openclaw"`, `"is there a new openclaw"`, `"time to upgrade"` | End-to-end update. Captures a baseline inventory, checks release notes for breaking changes, backs up, runs `openclaw update`, verifies every channel/cron/plugin still healthy after, and finishes with a **personalized highlights briefing** filtered against the features you actually use. |
| **openclaw-troubleshooting** | `"openclaw isn't working"`, `"not replying"`, `"won't start"`, `"fix my openclaw"` | Evidence-based diagnosis. Reads live CLI output, config, and logs before touching anything. Explicit approval required before any repair — diagnosis and repair are separate phases. |
| **openclaw-instance-discovery** | `"find my openclaw"`, `"rescan"` | Builds a registry of OpenClaw installs on this machine. Auto-triggered by troubleshooting on first run; you rarely invoke it directly. |
| **openclaw-troubleshooting-compound** | After an incident resolves | Drafts a tight incident-log entry + error signatures and writes them to your per-user local memory. Next session reads them back as context. |
| **openclaw-babysit** | `"babysit my openclaw"`, `"keep openclaw running"`, `"watch my channels"`. Designed to wrap with `/loop` (e.g. `/loop 5m /openclaw-babysit`). | Recurring channel-health monitor. Each tick checks every enabled channel and either alerts (default) or, with `--auto-fix`, invokes troubleshooting in authorized mode to apply allowlisted restart-family fixes autonomously. Bounded iterations, channels-as-success criterion. |

Non-technical users can fire up Claude Code in any directory, say "openclaw is broken", and these skills figure out which OpenClaw to target and what to do — without the user needing to know where OpenClaw is installed.

## Quick start (Claude Code)

```bash
mkdir -p ~/src
git clone https://github.com/pejmanjohn/openclaw-skills.git ~/src/openclaw-skills
~/src/openclaw-skills/scripts/install-claude-skill.sh
```

Then in any Claude Code session, just talk:

```
> update openclaw
> openclaw isn't responding
> find my openclaw
```

Or wrap a recurring health check around your channels with Claude Code's `/loop`:

```
> /loop 5m /openclaw-babysit              # alert mode — tells you when channels degrade
> /loop 5m /openclaw-babysit --auto-fix   # autonomous mode — applies allowlisted fixes and verifies
```

Babysit reports a one-line OK on healthy ticks; a degraded reading either alerts you (default) or, in `--auto-fix` mode, invokes troubleshooting non-interactively to apply restart-family fixes from a bounded allowlist. See [openclaw-babysit](#openclaw-babysit) below for the full contract.

Update the skill itself later with:

```bash
git -C ~/src/openclaw-skills pull
~/src/openclaw-skills/scripts/install-claude-skill.sh
```

## Install

Keep one canonical source checkout and install into whichever agents you use. The repo ships three install scripts that symlink back to the canonical checkout — so `git pull` picks up updates everywhere.

One-time clone, shared by all three flows below:

```bash
mkdir -p ~/src
git clone https://github.com/pejmanjohn/openclaw-skills.git ~/src/openclaw-skills
```

### Claude Code: Install

```bash
~/src/openclaw-skills/scripts/install-claude-skill.sh
```

Symlinks into `~/.claude/skills/`. The canonical entrypoint on disk is `~/.claude/skills/openclaw-troubleshooting/SKILL.md` (a symlink to the repo).

For project-local install instead of personal:

```bash
~/src/openclaw-skills/scripts/install-claude-skill.sh --dest "/path/to/project/.claude/skills"
```

### Codex: Install

```bash
~/src/openclaw-skills/scripts/install-codex-skill.sh
```

Symlinks into `$CODEX_HOME/skills` or `~/.codex/skills`. After install, restart Codex so it reloads.

### OpenClaw: Install

OpenClaw loads skills from these locations, highest precedence first:

- Workspace: `<workspace>/skills`
- Project agent skills: `<workspace>/.agents/skills`
- Personal agent skills: `~/.agents/skills`
- Managed/local: `~/.openclaw/skills`
- Bundled skills
- `skills.load.extraDirs`

```bash
~/src/openclaw-skills/scripts/install-openclaw-skill.sh
```

Symlinks into `~/.openclaw/skills`. For workspace-local install:

```bash
~/src/openclaw-skills/scripts/install-openclaw-skill.sh --dest "/path/to/workspace/skills"
```

### Updating

```bash
git -C ~/src/openclaw-skills pull
# then re-run the install script(s) for the agent(s) you use
```

## How it works

Three principles do most of the work:

**1. Local is runtime truth.** The agent and OpenClaw run on the same host, so local binary/help/config/state/logs are what actually govern behavior. Docs at [docs.openclaw.ai](https://docs.openclaw.ai) are procedural truth for the latest release, but if the local binary disagrees with the docs, trust the local binary. Every skill grounds in live `openclaw <subcommand> --help` output before acting.

**2. Skills chain together.** Troubleshooting auto-triggers instance discovery on first run. Update and troubleshooting both read the saved instance registry. After an incident, troubleshooting suggests the compound skill to capture learnings. Each skill is lean; together they're an end-to-end workflow.

**3. Local memory compounds.** Every install has a gitignored `local/` tree. Incident-log entries written by the compound skill, the instance registry written by discovery, and the upgrade-history ledger written by update — all live there, per machine, never pushed upstream. Future sessions read them as context, so the troubleshooting that took an hour the first time becomes a 30-second lookup the next time.

```
┌──────────────────────────┐     ┌──────────────────────────────┐
│ openclaw-troubleshooting │     │ openclaw-troubleshooting-    │
│                          │     │ compound                      │
│  1. Read incident log    │     │                              │
│  2. Diagnose & fix       │────▶│  1. Review conversation      │
│  3. Suggest /compound    │     │  2. Draft tight incident     │
│                          │     │  3. Draft new signatures     │
└──────────────────────────┘     │  4. Check for duplicates     │
                                 │  5. Write to local memory    │
                                 └──────────────────────────────┘
```

## The skills in depth

### openclaw-update

Safe, reviewable update from the installed version to the latest on your channel — one approval gate up front ("go from X to Y?"), then the skill runs through eight phases and stops only if something anomalous happens. A clean run lands on a personalized highlights briefing filtered to features you actually use.

Under the hood: eight phases (target → preflight → release-notes pre-check → backup → update → restart → verify → highlights). Anomaly stops: BREAKING release-note flag, backup verify failure, non-zero update exit, gateway doesn't return healthy, or a post-update gate yellow/red.

What makes it safe:
- Captures a full JSON inventory snapshot before the update (channels, crons, plugins, skills, doctor state) and diffs after, so silent regressions are caught.
- Always passes `--no-restart` to `openclaw update`; never restarts the gateway mid-session on an OpenClaw-native agent (which would kill the agent); emits manual commands for that case.
- On pnpm/npm installs where dep state is uncertain, checks bundled-extension staging completeness before advancing to restart (the `stageRuntimeDependencies: true` case) and offers a scoped per-extension repair if needed.
- Finishes with a highlights briefing filtered against the user's inventory — only sur
````
