/install cron-cost-guard
Cron Cost Guard
Prevent silent token budget burns from misconfigured AI agent cron jobs.
Quick Audit
Run this checklist on every cron setup or when investigating a cost spike:
1. Session Isolation (Critical)
Check every cron job for session binding conflicts:
cron list (includeDisabled: true)
Red flags:
sessionKey: "agent:main:main"withsessionTarget: "isolated"→ stale binding, will cause model conflictsagentIdpointing to a different agent than the session owner → cross-agent model contaminationconsecutiveErrors >= 3→ likely stuck in a retry looplastErrorcontainingLiveSessionModelSwitchError→ model-switch loop confirmed
Fix: Remove and recreate the job without sessionKey. Set sessionTarget: "isolated".
2. Model Conflicts
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.
- Set
agentIdexplicitly on every cron job - Set
modelexplicitly in the payload when available - Never let Agent B's cron inherit Agent A's session model
3. System Prompt Size
Audit injected workspace files:
wc -c MEMORY.md SOUL.md AGENTS.md TOOLS.md USER.md QUEUE.md
Target: \x3C 20KB total injected. Move large files (playbooks, heartbeat templates, reference docs) to references/ for on-demand reading.
| Size | Status |
|---|---|
| \x3C 20KB | Healthy |
| 20-40KB | Trim soon |
| > 40KB | Trim now — every API call is bloated |
4. Cost Monitoring
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) | \x3C $0.50 | $0.50-2.00 | > $2.00 |
| Model switch retries | 0 | 1-2 | ≥3 |
Diagnosis: Token Spike
For detailed diagnosis steps and post-incident checklist, read references/diagnosis.md.
Prevention Rules
- Every cron job:
sessionTarget: "isolated", no stalesessionKey - Every cron job: explicit
timeoutSeconds(never unlimited) - Multi-agent: explicit
agentIdmatching the agent that should run it - After changing default model: audit all cron jobs for conflicts
- Weekly: check
consecutiveErrorsacross all jobs — anything ≥ 3 needs investigation
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install cron-cost-guard - After installation, invoke the skill by name or use
/cron-cost-guard - Provide required inputs per the skill's parameter spec and get structured output
What is Cron Cost Guard?
Audit AI agent cron jobs for token cost risks, model-switch loops, and session isolation failures. Use when setting up new cron jobs, debugging unexpected to... It is an AI Agent Skill for Claude Code / OpenClaw, with 104 downloads so far.
How do I install Cron Cost Guard?
Run "/install cron-cost-guard" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Cron Cost Guard free?
Yes, Cron Cost Guard is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Cron Cost Guard support?
Cron Cost Guard is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Cron Cost Guard?
It is built and maintained by pouria3 (@pouria3); the current version is v1.0.0.