Install
openclaw skills install @mmthebest/long-running-tasksAutonomously orchestrate multi-phase background coding projects with crash recovery, stall detection, progress reporting, and sequential task execution.
openclaw skills install @mmthebest/long-running-tasksRun multi-phase projects autonomously using coding agents as workers and cron jobs as the orchestrator.
Coding agents are one-shot: they complete a task, exit, and nothing spawns the next one. Without orchestration, work stalls silently between tasks until a human notices.
Orchestrator (cron, every 10-30 min)
│
├─ Stale lock? → clean up, continue
├─ Live lock? → another orchestrator running, exit
├─ .pause file? → skip spawning, report paused
├─ Worker PID alive? → check for stall, report status
└─ No worker? → read TODO.md → spawn next task
│
▼
Worker (coding agent session)
- Read project context + TODO.md
- Implement one task
- Run tests
- Commit + push
- Update TODO.md
- Exit
All runtime files use a project slug to avoid collisions when orchestrating multiple projects:
/tmp/lrt-<project>-worker.pid # worker PID
/tmp/lrt-<project>-orchestrator.lock # orchestrator lock (contains orchestrator PID)
/tmp/lrt-<project>-last-commit # last reported commit hash
/tmp/lrt-<project>-worker.log # worker stdout/stderr
Choose a short, unique slug per project (e.g., myapp, ra, blog).
Structured task queue. Each task must be self-contained enough for a cold-start agent:
# TODO
## Phase 1 — Name (IN PROGRESS)
- [x] Completed task
- [ ] **Task title**
What to do, which files to touch, acceptance criteria.
- [ ] BLOCKED: Task waiting on external input
## Phase 2 — Name (QUEUED)
- [ ] Task...
Tasks prefixed with BLOCKED: are skipped by the orchestrator.
Cold-start context for agents (commonly named CLAUDE.md or AGENTS.md). Include: stack, architecture, runnable commands, current phase, environment setup. Keep under 100 lines.
See assets/context-file-template.md for a starter template to copy into your project.
Use the OpenClaw cron tool with sessionTarget: "isolated" and payload.kind: "agentTurn".
Read references/orchestrator-cron.md for the full cron configuration, prompt template, and lock/stall logic.
Start the first task yourself in safe (default) mode. The orchestrator takes over after this:
cd /path/to/project && nohup <agent-command> '<task prompt>' > /tmp/lrt-<project>-worker.log 2>&1 &
echo $! > /tmp/lrt-<project>-worker.pid
Use the agent's default permission mode for initial runs. See references/orchestrator-cron.md for agent command examples and security guidance.
Every worker prompt must include these instructions. See references/worker-prompt-template.md for a copy-paste template.
openclaw system event --text "Done: <summary>" --mode nowNote: worker self-cleanup of the PID file is best-effort. The orchestrator is the real safety net — it checks whether the PID is still alive regardless of whether the file was cleaned up.
touch /path/to/project/.pause # pause — orchestrator skips spawning
rm /path/to/project/.pause # resume
The orchestrator still runs on schedule but reports "paused" instead of spawning.
/tmp/lrt-<project>-last-commitgit diff --stat HEAD~1), not a full inventoryreferences/orchestrator-cron.md for details.git push in worker prompts during initial runs. Let workers commit locally; review the commits manually, then push. Enable auto-push only after you trust the output.pgrep pattern matching hits false positives from unrelated processes/tmp paths — running two projects without unique slugs causes PID/lock collisionsprocess poll in a loop; let the cron handle scheduling