Cron Worker Guardrails
Use when: hardening OpenClaw cron/background workers (POSIX shells: bash/sh) against brittle quoting, cwd/env drift, and false pipeline failures (SIGPIPE, pi...
phenomenoner
@phenomenoner
What This Skill Does
Provides a hardening checklist and safe patterns for POSIX cron/background workers to prevent brittle quoting, cwd/env drift, and false pipeline failures like SIGPIPE. Outputs a scripts-first approach with deterministic execution and silent-on-success conventions.
Replaces ad-hoc cron debugging by enforcing reliable execution patterns that eliminate common failures from shell quoting, environment drift, and pipeline edge cases.
When to Use It
- Harden a cron job that fails intermittently with shell quoting errors
- Replace a multi-line bash -lc command in cron with a single script call
- Prevent false pipeline failures when using pipefail with head or similar commands
- Ensure a cron worker runs with a deterministic working directory and environment variables
- Adopt a silent-on-success convention to reduce noise from unattended automation
- Debug a cron job that works locally but fails in production due to environment drift
Install
$ openclaw skills install @phenomenoner/cron-worker-guardrailsCron Worker Guardrails (POSIX)
A reliability-first checklist for OpenClaw cron workers and any unattended automation.
Scope (important)
- This skill is POSIX-focused (bash/sh examples).
- The principles are portable, but if you're on Windows/PowerShell you'll need equivalent patterns.
The NO_REPLY convention
Many OpenClaw setups treat emitting exactly NO_REPLY as "silent success" (no human notification).
- If your runtime does not support
NO_REPLY, interpret it as: print nothing on success.
Quick Start
- Scripts-first: move logic into a repo script (recommended:
tools/<job>.pyortools/<job>.sh). - One command in cron: cron should run one short command (no multi-line
bash -lc '...'). - Deterministic cwd/env:
cdto the repo (or have the script do it), and document required env vars. - Silent on success: print nothing (or exactly
NO_REPLY) when OK; only emit a short alert when broken.
Also see:
references/cron-agent-contract.mdreferences/pitfalls.md
Why this skill exists
Cron failures are rarely "logic bugs". In practice they're often:
- brittle shell quoting (
bash -lc '...'nested quotes) - command substitution surprises (
$(...)) - one-liners that hide escaping bugs (
python -c "...") - cwd/env drift ("works locally, fails in cron")
- pipelines that fail for the wrong reason (
pipefail+head/ SIGPIPE)
The fix is boring but effective: scripts-first + deterministic execution + silent-on-success.
Portability rules (still apply)
Even on POSIX, do not hardcode deployment-specific absolute paths tied to one machine.
Prefer:
- repo-relative paths
- environment variables you document
- minimal wrappers that
cdinto the repo
Common failure patterns -> fixes
1) unexpected EOF while looking for matching ')'
Likely causes:
- unclosed
$(...)from command substitution - broken nested quotes in
bash -lc ' ... '
Fix pattern:
- Replace the whole multi-line shell block with a script.
- Cron calls exactly one short command, for example:
python3 tools/<job>.py
2) False failure from pipefail + head (SIGPIPE)
Symptom:
- command exits non-zero even though the output you wanted is fine
Fix pattern:
- avoid
pipefailwhen piping intohead - or better: do the filtering in a script (read only what you need)
3) "Works locally, fails in cron"
Common causes:
- wrong working directory
- missing env vars
- different PATH
Fix pattern:
cdinto the repo (or have the script do it)- keep dependencies explicit and documented
Git footgun: git push rejected (non-fast-forward)
Symptom:
! [rejected] ... (non-fast-forward)when automation pushes to a long-lived PR/feature branch.
Conservative fix (no force-push):
- On rejection, fetch the remote branch, transplant your new local commits onto it (cherry-pick), then retry push once.
Copy/paste hardening header (portable)
Use this near the top of a cron prompt (2 lines, low-noise):
- Hardening (MUST): follow
references/cron-agent-contract.md(scripts-first, deterministic cwd, silent-on-success). - Also apply the
cron-worker-guardrailsskill. If parsing/multi-step logic is needed, write/run a smalltools/*.pyscript.
Top skills in this category
Agent Browser
@matrixyHeadless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection
Auto-Updater Skill
@maximepradesAutomatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Free Ride - Unlimited free AI
@shaivpidadiManages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates opencla...
Automation Workflows
@jk-0001Design and implement automation workflows to save time and scale operations as a solopreneur. Use when identifying repetitive tasks to automate, building workflows across tools, setting up triggers and actions, or optimizing existing automations. Covers automation opportunity identification, workflow design, tool selection (Zapier, Make, n8n), testing, and maintenance. Trigger on "automate", "automation", "workflow automation", "save time", "reduce manual work", "automate my business", "no-code automation".
Desktop Control
@matagulAdvanced desktop automation with mouse, keyboard, and screen control