A /loop command for OpenClaw: repeat any
instruction — or any shell command — on a schedule, from chat.
/loop 20m check whether the nightly build finished and summarize new errors
/loop 1h run df -h /
/loop at +45m remind me to restart the router
/loop list
/loop stop loop-check-nightly-build
Loops are backed by the gateway's own cron, not by anything session-bound,
so they keep firing after gateway restarts and reboots and their run history is
inspectable (openclaw cron runs).
git clone https://github.com/phastings503cm/openclaw-loop-skill
cd openclaw-loop-skill && ./install.sh # copies to ~/.openclaw/skills/loopStart a new chat session so the skill is picked up, then type /loop ....
The skill (see SKILL.md) maps chat commands onto openclaw cron:
| You type | Agent runs |
|---|---|
/loop 20m <instruction> |
openclaw cron add "loop-<slug>" "<instruction>" --every 20m --announce |
/loop 1h run <shell> |
openclaw cron add --every 1h --command '<shell>' --display-name "loop-<slug>" |
/loop at +2h <instruction> |
openclaw cron add ... --at +2h --delete-after-run --announce |
/loop list |
openclaw cron list |
/loop stop <name> / stop all |
openclaw cron rm <name> (only loop-* jobs for all) |
/loop pause/resume <name> |
openclaw cron disable/enable <name> |
Guardrails built into the skill: intervals under 30s are refused (each run is a
full agent turn — a sub-30s loop will bury a local model), stop all never
touches cron jobs the skill didn't create, and failures from cron add are
shown, not swallowed.
scripts/loop.sh is the identical interface for a terminal:
./scripts/loop.sh add 20m "summarize new errors in ~/proj build"
./scripts/loop.sh add 1h --cmd "df -h /"
./scripts/loop.sh list
./scripts/loop.sh stop allPlus a gateway-less fallback (loop.sh bg 20m "df -h /") that runs a plain
background while-loop — clearly worse (dies on reboot), which is exactly why
the skill prefers cron.
- OpenClaw with a running gateway (
openclaw gateway start) - The
openclawCLI on PATH for the agent's shell
MIT.