← 返回
未分类

TOKEN审计

Audit QClaw/OpenClaw token consumption and detect waste across 6 dimensions: cache, overstuffing, skill bloat, redundancy, session bloat, and aborted runs. Triggers on "usage audit", "waste audit", "token waste", "消耗审计", "用量分析".
分析 QClaw/OpenClaw 的 token 消耗数据,找出 6 类浪费源头。只读工具,不修改任何文件。 https://github.com/eluckydog/
eluckydog
未分类 community v1.0.0 1 版本 96666.7 Key: 无需
★ 0
Stars
📥 29
下载
💾 0
安装
1
版本
#latest

概述

Token Waste Auditor

Audit QClaw/OpenClaw token consumption and pinpoint waste. Outputs an anonymized report with concrete optimization estimates.

Quick Start

# Full audit (daily + session deep scan)
python scripts/auditor.py --days 30

# Lite audit (daily summary only, no session scan)
python scripts/auditor.py --days 30 --lite

# JSON output for CI
python scripts/auditor.py --days 7 --json

Data Sources

SourceWhatCost
--------------------
openclaw gateway usage-cost --jsonDaily input/output/cache totals0 (built-in)
Session .jsonl filesPer-message + tool-call audit0 (local)
Skill SKILL.md filesPrompt size measurement0 (local)

Waste Dimensions

CodeWaste TypeDetection
----------------------------
W01Low Cache EfficiencycacheRead / total < 90% — context changes too often
W02Context Overstuffinginput / output > 20:1 — too much context for too little output
W03Skill Prompt BloatSKILL.md > 20KB — diminishing returns on instruction length
W04Skill Prompt RedundancyDuplicate blocks found across multiple SKILL.md files
W05Session BloatSingle session > 100K tokens without recent compaction
W06Aborted RunsAssistant messages truncated mid-generation

Output Structure

══════════════════════════════════════════════
  Token Waste Audit Report
  Period: 2026-05-01 ~ 2026-05-21 (21 days)
══════════════════════════════════════════════

[1/6] Cache Efficiency
  read:  347.5M (96.6%)
  input:  10.9M  (3.0%)
  waste:  1.2M   (0.3%) ← cache-miss overhead
  Status: ✅ healthy

[2/6] Context Overstuffing
  avg input:output ratio = 7.9:1
  worst day: 2026-05-12 → 16.1:1
  Status: ✅ within bounds (< 20:1)

[3/6] Skill Prompt Bloat (top 3)
  1. skill-07    48KB  ⚠️  suggests split
  2. skill-03    42KB  ⚠️  suggests split  
  3. skill-12    31KB  — acceptable
  Est. waste: ~800K tokens/load × loads/week

[4/6] Skill Prompt Redundancy
  7 duplicate blocks found across 4 skill files
  Est. savings: ~140K tokens/week if deduplicated

[5/6] Session Bloat (top 3)
  1. session-01  14.2MB  ⛰️ ⛰️  active 24d, 2 compactions
  2. session-02   2.5MB  ⛰️  active 1d, 7 compactions
  3. session-03   2.0MB  active 1d, 8 compactions
  Suggests: archive long-lived sessions

[6/6] Aborted Runs
  Count: 2 aborted assistant responses
  Est. waste: ~45K tokens (negligible)
  Status: ✅ healthy

══════════════════════════════════════════════
  Summary
══════════════════════════════════════════════
  Total tokens (period):  359.8M
  Est. waste:               11.5M  (~3.2%)
  Est. savings potential:  4-8M/month
══════════════════════════════════════════════

Constraints

  • Anonymity: All skill/agent/session names are hashed or replaced with generic labels. No path, name, or methodology from the user's setup ever appears in output.
  • Privacy: The report contains only token metrics and waste estimates. No conversation content is extracted or reproduced.
  • Safety: Read-only. Never modifies session files, skill files, or system config.

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-06-02 22:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,057 📥 796,789
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,211 📥 266,256
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,351 📥 317,806