Command Palette

Search for a command to run...

Назад к скиллам
скилл № 47259

babysit

Run long-running tasks under babysit — supervised background runner with cgroup-enforced memory/CPU caps and observability-stall kill. Use BEFORE any…

БесплатноЗапускает вложенные скрипты
archibateот archibate★ 42 звезды на GitHub

Установить babysit в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

babysit — Supervised Background Task Runner

!command -v babysit || (mkdir -p "$HOME/.local/bin" && install -m755 "${CLAUDE_SKILL_DIR}/scripts/babysit.py" "$HOME/.local/bin/babysit" && echo "babysit installed to ~/.local/bin") || echo "babysit installation failed, consider use self-contained scripts/babysit.py" # auto-install CLI tool on skill load !command -v babysit && (babysit ping 2>&1 || babysit daemon-start 2>&1 || echo "babysit daemon failed to start") # auto-start daemon on skill load

When to Use

  • Non-interactive long-running tasks expected to run for >2 minutes
  • Compute-intensive tasks: per-task cgroup caps (mem ≤40%, cpu ≤90%) prevent runaway resource use
  • Long-running tasks that must survive the Claude session: daemon runs detached under user systemd

When NOT to Use

  • Short tasks (<2 minutes): run in Bash directly
  • Interactive commands: use /tmux instead
  • IO-bound tasks (e.g. web servers, async loops): babysit's scheduler won't help
  • Lightweight (low CPU + low memory) tasks fine to die with Claude: Bash run_in_background: true

Hard Guardrail — Don't Bypass

/babysit is the cost guardrail for compute-intensive work on this host — not an optional tool. If a task is heavy (CPU-bound, memory-bound, multi-process), it MUST run under babysit so the cgroup caps and observability watchdog can stop runaway cost. Anti-patterns:

  • Routing heavy work through built-in run_in_background: true to dodge the queue → no one monitors footprint; the host can thrash and lock the user out of SSH.
  • Inflating --estimated_mem_bytes / --estimated_cpu_cores to pass the soft-deny gate while you don't actually need the headroom → starves other tasks and defeats fair-scheduling.
  • Auto-backgrounded long Bash commands (e.g. tools that fork into daemons): if they're heavy, kill and re-launch under babysit run.

When your task hits the resource cap, the first reflex is NOT to raise the limit. It is to:

  1. Audit the script — profile, drop unused intermediates, rolling / partial read, subsampling, reduce space / time complexity, optimize nested loops, lower batch size / n_jobs / parallelism.
  2. Re-run footprint-optimized; confirm the demand is genuinely unavoidable.
  3. Only then raise estimates and babysit wait_for_capacity for moderation.

Workflow

0. Smoke test

Before launching heavy work, smoke test on small scale for correctness and performance whenever appliable. Only proceed full-scale after the program is verified working and effcient in time and space.

1. Enqueue

babysit run \
  --name="<unique-name>" \
  --command="uv run python -u path/to/script.py" \
  --estimated_time="10m" \
  --estimated_mem_bytes="4G" \
  --estimated_cpu_cores=4

Provide best-effort estimates for time, peak memory, and peak CPU cores — by extrapolation of smoke test (if linear complexity appliable) plus prior live experience (if any). Never over-estimate without clue (starves other tasks). You'll get a runaway_risk notification when any actual exceeds its estimate. Pick estimation wisely.

The call is non-blocking: returns immediately with queued: <name>. The daemon dispatches as soon as system has capacity.

Required: --name (unique), --command (single shell string). Optional: --estimated_time (default 10m), --kill_timeout (default 2× estimated), --observability_interval (default 5m), --mem_pct_limit (default 40), --cpu_pct_limit (default 90), --estimated_mem_bytes (default 4G), --estimated_cpu_cores (default 4), --cwd (default current shell cwd).

Override the defaults to match your workload — under system memory/CPU pressure the daemon kills estimate-exceeders before within-estimate tasks, so accurate predictions protect long-running work. Hard kill fires at 2× sustained (daemon, graceful) or 3× instant via cgroup OOM. If the pressure is caused by an external (non-babysit) process — when the sum of all managed tasks' usage is smaller than the excess over threshold — the daemon logs and skips the kill rather than punishing its own tasks for someone else's load.

If capacity is tight, babysit run may soft-deny with capacity_exceeded (exit 2, JSON on stderr) — run the babysit wait_for_capacity --mem_bytes=… --cpu_cores=… (blocks until room exists) to wait for room, reduce estimates, or pass --force to override.

2. Wait for completion (background)

babysit wait --name="<unique-name>"

Run with run_in_background: true and attach Monitor for runaway risk notifications. You get:

  • a mid-flight {"event":"runaway_risk","dim":"elapsed|mem|cpu", ...} JSON line on stderr the first time an actual exceeds its declared estimate (elapsed > estimated_time, mem > estimated_mem_bytes, or cpu_cores > estimated_cpu_cores) — inspect the log and decide whether to keep waiting or babysit kill. Daemon hard-kills for mem/cpu at 2× sustained for the monitor tolerance window; elapsed hard-kills at --kill_timeout
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

  1. 01Bash(babysit:*)
  2. 02Read

Вложенные файлы

  • hooks/no-sleep-babysit.sh
  • references/babysit.md
  • scripts/babysit.py

FAQ

Что делает скилл babysit?

Run long-running tasks under babysit — supervised background runner with cgroup-enforced memory/CPU caps and observability-stall kill. Use BEFORE any long-running task (>2 min), compute-intensive jobs (e.g. builds/benchmarks/renders/training), background work, or when the user says "run in background", "use babysit". This skill defines guardrails and the mandatory workflow, not just a how-to.

Как установить скилл babysit?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл babysit запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить babysit с