Openclaw Waste Audit
/install waste-audit
OpenClaw Recurring Waste Audit
Trigger
MUST use this skill (NOT openclaw-comprehensive) when user asks about:
- "帮我查 openclaw 里面有哪些浪费的工作" / "what openclaw jobs are wasting tokens"
- "帮我查 openclaw 有哪些浪费" / "which openclaw jobs are wasting money"
- "帮我查 waste"
- "which job is burning tokens"
- "cron 有没有问题" / "any cron waste"
- "cron waste audit"
- "token waste"
- "/audit"
- "哪些 cron 在烧钱" / "which cron jobs are burning tokens"
DO NOT use this for: general openclaw operations, job management, dispatch rules — use openclaw-comprehensive for those.
Action
Step 1 — Verify token burn from JSONL runs (use usage.total_tokens, NOT top-level totalTokens)
JSONL top-level totalTokens is always 0. Real data lives at usage.total_tokens:
python3 -c "
import json, glob, os
runs_dir = os.environ.get('OPENCLAW_HOME', os.path.expanduser('~/.openclaw'))
runs_dir = os.path.join(runs_dir, 'cron', 'runs')
for f in sorted(glob.glob(f'{runs_dir}/*.jsonl')):
total = 0; count = 0
with open(f) as fh:
for line in fh:
try:
d = json.loads(line)
total += d.get('usage',{}).get('total_tokens',0); count += 1
except: pass
if total > 0:
print(f'{f.split(\"/\")[-1]}: {count} runs, {total:,} tokens')
"
Step 2 — Run ClawSetup diagnostic (complementary classification + error rates)
python3 ~/.hermes/scripts/clawsetup_diagnostic.py
# or: python3 ~/.hermes/hermes-agent/scripts/clawsetup_diagnostic.py
Gives: token cost, error rate per job, job classification (EXEC_SCRIPT / LLM_NEEDED / UNCLEAR).
Step 3 — Deep-dive on top candidates (summary_len, delivery rate)
For D8 candidates, check summary size pattern — tiny summaries every run = silent loop:
Note: Use summary field (persisted in run-log schema), NOT response which does not exist in cron run JSONL.
python3 -c "
import json, glob, os
runs_dir = os.environ.get('OPENCLAW_HOME', os.path.expanduser('~/.openclaw'))
runs_dir = os.path.join(runs_dir, 'cron', 'runs')
f = os.path.join(runs_dir, '\x3Cjob_id>.jsonl')
total=0;count=0;errors=0;delivered=0;summary_lens=[]
with open(f) as fh:
for line in fh:
try:
d=json.loads(line)
total+=d.get('usage',{}).get('total_tokens',0)
count+=1
if d.get('error'): errors+=1
if d.get('delivered'): delivered+=1
summary_lens.append(len(str(d.get('summary','') or '')))
except: pass
import statistics as s
print(f'runs={count} tokens={total:,} errors={errors} delivered={delivered}')
if summary_lens: print(f'summary_len: min={min(summary_lens)} median={s.median(summary_lens):.0f} max={max(summary_lens)}')
"
D8 signals:
summary_lenmedian ≤ 20 = job producing trivial summaries every time (CLEAN_LOOP pattern)delivered=0on external channel = structurally silenterrors \x3C 10%butdelivered=0= "everything is fine" loop
Step 4 — Verify model for EXEC_SCRIPT jobs
EXEC_SCRIPT tag is name-based — it doesn't mean "no LLM cost." A job named "Health Check" may still call LLM internally.
# Get model from jobs.json (file-based, always works)
cat ~/.openclaw/cron/jobs.json | python3 -c "
import json,sys
d=json.load(sys.stdin)
for j in d.get('jobs',[]):
model=j.get('payload',{}).get('model','null')
if model and model not in ('null','None',''):
print(f'{j[\"name\"]}: {model}')
"
# Check recent runs (requires gateway)
openclaw-env cron runs --id \x3Cjob_id> --limit 3
Note: openclaw cron show requires gateway auth. If you see gateway token mismatch, use jobs.json + JSONL runs instead.
Delivery Mode Rules
| delivery.mode | Meaning | Waste? |
|---|---|---|
"none" |
Internal job, no external delivery | NO — by design |
"announce" |
Announces to own session only | NO — by design |
| external channel | Sends to Telegram, Discord, etc. | Check deliveryStatus |
Only delivered=false on an external channel = actual waste. Internal jobs with mode=none are not waste — they are designed that way.
Output Format
Concise — max 3 candidates. No raw dumps. No verbose explanations.
Structure:
- Top 3 waste candidates: Job ID, schedule (parsed), runs, tokens (daily estimate), error rate, delivery evidence, response length signal, waste reason, confidence, recommended fix
- Other notable jobs (optional, brief)
- Cost breakdown: top jobs by token burn + daily estimate + % of total
- Fix commands — wrapped in "⚠️ read-only until approved" block
# OpenClaw Recurring Waste Audit
## Top 3 Waste Candidates
1. [D8 - CLEAN_LOOP] \x3CJob Name>
- Job ID: \x3Cid>
- Schedule: \x3Ccron_expr> (every N hours/days)
- Runs: \x3CN> | Tokens: \x3CN>
- Error rate: \x3CY>%
- Delivery: delivered=\x3CN> — \x3Ctypical_summary>
- Summary: median_len=\x3CN> chars (\x3Ctypical_summary_excerpt>)
- Waste reason: \x3Cwhy it's burning tokens — be specific, name the pattern>
- Confidence: High/Medium/Low
- **Recommended fix:** \x3Cspecific actionable fix>
2. ...
3. ...
## Cost Breakdown
\x3Ctop job by tokens>
• Job: \x3Cname>
• Tokens: \x3CN>
• Daily Est.: ~\x3CN> tokens/day
...
Total tracked: \x3CN>M tokens (~\x3CN> jobs)
---
⚠️ **Read-only until approved.** Run the fix commands below only after you confirm.
**Fix commands (run only after BG approval):**
```bash
# Job 1 — reduce hourly → every 6 hours
openclaw-env cron edit \x3Cjob_id> --cron "0 */6 * * *"
# Job 2 — reduce to once daily
openclaw-env cron edit \x3Cjob_id> --cron "0 8 * * *"
# Job 3 — disable (not needed)
openclaw-env cron disable \x3Cjob_id>
⚠️ CLI pitfall: use --cron, NOT --schedule. The openclaw-env cron edit command uses --cron \x3Cexpr> for cron expressions. Using --schedule will error with unknown option '--schedule'.
Schedule Parsing Reference
| schedule.kind | schedule.expr / everyMs | Actual frequency |
|---|---|---|
cron |
"0 */3 * * *" |
every 3 hours |
cron |
"0 */6 * * *" |
every 6 hours |
cron |
"0 3 * * *" |
once daily at 3am |
cron |
"*/15 * * * *" |
every 15 minutes |
cron |
"0 * * * *" |
once per hour (整点) |
every |
everyMs: 180000 |
every 3 minutes |
every |
everyMs: 45000 |
every 45 seconds |
at |
one-time scheduled | not recurring |
Rule: everyMs \x3C 60000 = high frequency. cron expr with */N = every N minutes.
Pattern Classification (D1-D9)
| Rule | Condition | Signal |
|---|---|---|
| D1 | Error rate ≥ 80% | Failure loop |
| D3 | Premium model (5x+ ref) + simple task | Over-paying for check job |
| D4 | Agent-turn + schedule \x3C 60min | LLM agent on cron work |
| D6 | totalRuns > 0 but totalTokens = 0 | Token counting failed |
| D8 | totalRuns ≥ 50 + delivered=false + status=ok + has LLM model | Chronic "everything is fine" loop (CLEAN_LOOP) — only for LLM jobs; pure EXEC_SCRIPT/batch jobs excluded |
| D9 | Schedule \x3C 30min + error rate \x3C 20% | Over-scheduled check job |
| D2 | Burst: 3+ jobs, $50+ in 60min window | Concentrated spending spike |
| D7 | Duplicate model + schedule + task | Redundant billing |
Safety Rules
FORBIDDEN before approval:
openclaw cron run / disable / edit / deleteopenclaw-env cron run / disable / edit / delete
Only read-only:
openclaw-env cron show \x3Cjob_id>
openclaw-env cron runs --id \x3Cjob_id> --limit 5
cat ~/.openclaw/cron/jobs.json | python3 -m json.tool | grep -A5 '\x3Cjob_name>'
Workflow
- Run JSONL token burn query → get per-job totals from
usage.total_tokens - Run ClawSetup diagnostic → classification + error rates
- Deep-dive top candidates: response_len + delivery rate
- Verify model for EXEC_SCRIPT jobs
- Generate fix recommendation for each top candidate (see Fix Suggestion Rules below)
- Present top 3 + cost breakdown + fix commands
Fix Suggestion Rules
For each candidate, suggest the most impactful fix based on the rule. Be specific — not generic:
| Rule | Primary Fix |
|---|---|
| D1 (failure loop) | openclaw-env cron disable \x3Cid> — 80%+ error rate; disable until root cause is fixed |
| D3 (premium model) | openclaw-env cron edit \x3Cid> --model MiniMax-M2.5 — switch to cheaper model |
| D4 (agent cron) | openclaw-env cron edit \x3Cid> --cron "0 3 * * *" — reduce to daily |
| D6 (zero tokens) | Investigate — not a direct waste issue; may be counting bug or job is broken |
| D8 (silent loop) | If job has value: reduce frequency. If redundant: openclaw-env cron disable \x3Cid> |
| D9 (over-scheduled) | openclaw-env cron edit \x3Cid> --cron "*/30 * * * *" — halve frequency |
Be specific in the recommended fix — e.g., "reduce from hourly to every 6 hours" not just "reduce frequency." Include actual cron expression in the fix command.
Only suggest commands that have been verified to exist for this OpenClaw version. If edit is unavailable, say "contact admin to manually adjust schedule in jobs.json."
ALWAYS wrap fix commands in a "⚠️ read-only until approved" block. Never auto-execute.
Related Skills
openclaw— OpenClaw cron/job management referencehermes-infrastructure— Hermes system operations
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install waste-audit - 安装完成后,直接呼叫该 Skill 的名称或使用
/waste-audit触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Openclaw Waste Audit 是什么?
OpenClaw recurring waste audit — run when user wants to find token waste, cron waste, burning tokens, or which job is wasting money. NOT for general openclaw... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 50 次。
如何安装 Openclaw Waste Audit?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install waste-audit」即可一键安装,无需额外配置。
Openclaw Waste Audit 是免费的吗?
是的,Openclaw Waste Audit 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Openclaw Waste Audit 支持哪些平台?
Openclaw Waste Audit 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Openclaw Waste Audit?
由 choosenobody(@choosenobody)开发并维护,当前版本 v1.3.1。