Skip to content

Commit 8a541e5

Browse files
committed
feat: v5.6.0 — activity intelligence, savings measurement, output waste detection
Savings measurement: loop detection and quality nudges now estimate tokens saved per event (was logging 0, making dashboard show $0.02 when real value is $2K+/mo). New detectors (100% original): - output_waste: flags excessive output tokens via 3 signals (output/input ratio, verbose responses after simple ops, repeated explanations via Jaccard similarity) - cache_instability: detects CLAUDE.md patterns that break Anthropic's prefix-based prompt cache (timestamps, auto-generated sections, volatile imports) Activity intelligence: - 10-tool sliding window classifies session mode (code/debug/review/infra/general) - Mode-aware dynamic compact instructions adapt to what you're doing - Structured decision extraction: detects "decided/chose/going with" patterns, stores incrementally with atomic read-modify-write (BEGIN IMMEDIATE) - Anchored iterative compact state persists intent/changes/decisions/errors across compaction cycles, preventing detail drift OpenClaw v2.4.0: output_waste detector ported to TypeScript CE review fixes: catastrophic regex backtracking eliminated (split-then-filter), activity_log bounded with pruning, vacuous truth on empty tool lists fixed, dead code removed, rollback guard on transaction failure. Claude Code plugin: 5.5.1 → 5.6.0 | OpenClaw: 2.3.1 → 2.4.0
1 parent 35c5dd2 commit 8a541e5

18 files changed

Lines changed: 769 additions & 46 deletions

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"name": "token-optimizer",
1414
"source": "./",
1515
"description": "Audit, fix, and monitor Claude Code context window usage. Find the ghost tokens.",
16-
"version": "5.5.1",
16+
"version": "5.6.0",
1717
"author": {
1818
"name": "Alex Greenshpun",
1919
"url": "https://linkedin.com/in/alexgreensh"

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"homepage": "https://github.com/alexgreensh/token-optimizer",
99
"repository": "https://github.com/alexgreensh/token-optimizer",
10-
"version": "5.5.1",
10+
"version": "5.6.0",
1111
"license": "PolyForm-Noncommercial-1.0.0",
1212
"keywords": ["token", "optimization", "context", "audit", "cost", "coach"]
1313
}

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Tell it your goal. Get back specific, prioritized fixes with exact token savings
485485

486486
### Waste Detectors
487487

488-
9 automated detectors analyze your session patterns and surface actionable findings:
488+
11 automated detectors analyze your session patterns and surface actionable findings:
489489

490490
| Detector | What it catches |
491491
|---|---|
@@ -498,6 +498,8 @@ Tell it your goal. Get back specific, prioritized fixes with exact token savings
498498
| Weak model | Haiku on complex tasks needing a stronger model |
499499
| Bad decomposition | Monolithic 500+ word prompts doing too much |
500500
| Wasteful thinking | Extended thinking >2x output for small edits |
501+
| Output waste | Verbose responses to simple operations, repeated explanations |
502+
| Cache instability | CLAUDE.md patterns that break Anthropic's prompt cache prefix |
501503

502504
### Fleet Auditor
503505

@@ -565,7 +567,7 @@ Hover help on every column explains `Cache`, `TTL`, `Pacing`, `Cache R`, and `Ca
565567
| Runtime output compression | 16 CLI handlers, credential-safe, individually toggleable | No | Yes | Yes, always-on (cannot disable) |
566568
| Measures if compression actually helped | Yes, local telemetry with before/after tokens | No | No | No |
567569
| Read deduplication and smart diff on re-reads | Yes | No | No | No |
568-
| Behavioral coaching and model routing | 9 detectors, cost-ranked subagent breakdown | Basic suggestions | No | No |
570+
| Behavioral coaching and model routing | 11 detectors, cost-ranked subagent breakdown | Basic suggestions | No | No |
569571
| CLAUDE.md and MEMORY.md structural health | 8 auditors plus attention-curve scoring | No | No | No |
570572
| Fleet-level waste detection across agents | Yes | No | No | No |
571573
| Zero context tokens consumed | Yes, external process | Adds ~200 tokens | MCP overhead | Injects instructions into context |
@@ -743,7 +745,7 @@ Inside OpenClaw, run `/token-optimizer` for a guided audit with coaching.
743745

744746
**Session audits and cost tracking.** Parses your OpenClaw session data, calculates per-turn costs against your configured pricing (falls back to built-in rates for 20+ models), surfaces costly prompts, and ranks subagents by spend so you can see which orchestrator-worker pairs are actually pulling their weight.
745747

746-
**9 waste detectors native to OpenClaw.** Idle burn detection, model misrouting, unused skills, retry churn, tool cascades, looping patterns, overpowered model use, weak model on complex tasks, and wasteful thinking. Each finding comes with a dollar estimate.
748+
**10 waste detectors native to OpenClaw.** Idle burn detection, model misrouting, unused skills, retry churn, tool cascades, looping patterns, overpowered model use, weak model on complex tasks, wasteful thinking, and output token waste. Each finding comes with a dollar estimate.
747749

748750
**Coach tab adapted for OpenClaw.** Scoring adapts to OpenClaw concepts (SOUL.md instead of CLAUDE.md, agent configs instead of hooks). Health score surfaces earned signals, neutral signals, and anti-patterns.
749751

openclaw/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Inside OpenClaw, run `/token-optimizer` for a guided audit with coaching.
3333
## What It Does
3434

3535
- **Scans** all agent sessions for token usage, cost, and topic extraction
36-
- **Detects** 15 waste patterns across 3 tiers with monthly $ savings and fix snippets
36+
- **Detects** 16 waste patterns across 3 tiers with monthly $ savings and fix snippets
3737
- **Dashboard** with 8-tab interactive HTML visualization
3838
- **Context audit** with per-skill and per-MCP-server token breakdown
3939
- **Quality scoring** with 7 signals (2-stage) and model-aware context windows (Claude 1M, GPT-5 400K, Gemini 2M)
@@ -93,7 +93,7 @@ Dashboard auto-regenerates on session end. Open manually with `npx token-optimiz
9393

9494
## Waste Patterns Detected
9595

96-
15 detectors across 3 tiers:
96+
16 detectors across 3 tiers:
9797

9898
### Tier 1: Config & Heartbeat Analysis
9999

@@ -116,6 +116,7 @@ Dashboard auto-regenerates on session end. Open manually with `npx token-optimiz
116116
| Tool Cascade | 5+ tool calls ending in failure (error chains) | $0.50-10/month |
117117
| Overpowered Model | Expensive model for simple tasks (low output, few tools) | $0.50-20/month |
118118
| Weak Model | Cheap model for complex tasks (causes errors/retries) | Quality impact |
119+
| Output Waste | Sessions with >40% output tokens vs total (verbose responses) | $0.50-15/month |
119120
| Bad Decomposition | 30+ messages with <2% output ratio (monolithic prompts) | $1-15/month |
120121

121122
### Tier 3: Context Composition

openclaw/dist/waste-detectors.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openclaw/dist/waste-detectors.js

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openclaw/dist/waste-detectors.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openclaw/openclaw.plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "token-optimizer-openclaw",
33
"name": "Token Optimizer",
44
"description": "Find the ghost tokens. Audit your OpenClaw setup, see where context goes, fix it.",
5-
"version": "2.3.1",
5+
"version": "2.4.0",
66
"skills": ["skills/token-optimizer"],
77
"configSchema": {
88
"type": "object",

openclaw/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openclaw/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "token-optimizer-openclaw",
3-
"version": "2.3.1",
3+
"version": "2.4.0",
44
"description": "Token waste auditor for OpenClaw. Detects idle burns, model misrouting, and context bloat with dollar savings.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)