Install
openclaw skills install cron-cost-guardAudit AI agent cron jobs for token cost risks, model-switch loops, and session isolation failures. Use when setting up new cron jobs, debugging unexpected token usage spikes, auditing multi-agent cron configurations, or after a cost anomaly. Triggers on "audit crons", "check cron costs", "token budget", "cron safety", "cost spike", "model switch error", "session isolation", "cron health check".
openclaw skills install cron-cost-guardPrevent silent token budget burns from misconfigured AI agent cron jobs.
Run this checklist on every cron setup or when investigating a cost spike:
Check every cron job for session binding conflicts:
cron list (includeDisabled: true)
Red flags:
sessionKey: "agent:main:main" with sessionTarget: "isolated" → stale binding, will cause model conflictsagentId pointing to a different agent than the session owner → cross-agent model contaminationconsecutiveErrors >= 3 → likely stuck in a retry looplastError containing LiveSessionModelSwitchError → model-switch loop confirmedFix: Remove and recreate the job without sessionKey. Set sessionTarget: "isolated".
In multi-agent setups (e.g., Agent A on Claude, Agent B on GPT), each agent's crons must be scoped to that agent only.
agentId explicitly on every cron jobmodel explicitly in the payload when availableAudit injected workspace files:
wc -c MEMORY.md SOUL.md AGENTS.md TOOLS.md USER.md QUEUE.md
Target: < 20KB total injected. Move large files (playbooks, heartbeat templates, reference docs) to references/ for on-demand reading.
| Size | Status |
|---|---|
| < 20KB | Healthy |
| 20-40KB | Trim soon |
| > 40KB | Trim now — every API call is bloated |
sessions_list (limit: 10, messageLimit: 1)
Look for sessions with high estimatedCostUsd but low output tokens — that's a retry loop signature.
| Metric | Healthy | Warning | Critical |
|---|---|---|---|
| Cron consecutive errors | 0 | 1-2 | ≥3 |
| Session cost (cron) | < $0.50 | $0.50-2.00 | > $2.00 |
| Model switch retries | 0 | 1-2 | ≥3 |
For detailed diagnosis steps and post-incident checklist, read references/diagnosis.md.
sessionTarget: "isolated", no stale sessionKeytimeoutSeconds (never unlimited)agentId matching the agent that should run itconsecutiveErrors across all jobs — anything ≥ 3 needs investigation