Releases: alexgreensh/token-optimizer
v5.6.13
Bug Fixes
-
Quality score stability: Enforce ResourceHealth monotonicity within a session. Score can only decrease (worsen) unless a compaction resets context. Prevents fill_pct measurement fluctuations from causing 10-20 point score swings in the statusline.
-
False tool call warnings suppressed: Tool call threshold scaling changed from linear (5x) to superlinear (x^1.3) for 1M context windows, raising thresholds from warn=125/crit=200 to warn=202/crit=324. Additionally, tool call warnings are now gated on context fill >= 50%, since tool calls at low fill don't degrade instruction adherence.
-
Two-row statusline: Status bar split into two rows for readability. Row 1: model, effort, project, context bar, ContextQ. Row 2: Eff, warnings, compactions, session duration, active agents. Session duration is now always visible (previously gated on quality < 75).
-
Edge case hardening: Duration display guards against invalid timestamps (epoch 0, negative values, >7 day sessions). Monotonicity clamp handles corrupted cache where compaction count regresses.
v5.6.12
Self-healing for malformed hook commands in settings.json.
Hooks written by Claude during interactive sessions using $(ls -d $HOME/...) subshell patterns or double-$HOME paths now get automatically detected and removed on next session start. Correct hooks are immediately re-provisioned.
- Identity matcher handles subshell-wrapped commands via regex fallback
- Word-boundary matching prevents false positives on similar path names
- macOS-only guard for double-home detection
- Immediate hook re-provisioning for script-install users (no 24h gap)
- Codex runtime unaffected (guarded)
v5.6.11
Context-aware tool call thresholds
The tool-call warning thresholds now auto-scale with your context window size:
| Context | Warn | Critical |
|---|---|---|
| 200K | 25 | 40 |
| 500K | 62 | 100 |
| 1M | 125 | 200 |
Previously, the hardcoded 25/40 thresholds (from COLM 2025 research on 200K models) fired false CRITICAL warnings on 1M context sessions that routinely hit 80-120 tool calls while staying coherent at 94+ quality scores.
Env var overrides (TOKEN_OPTIMIZER_TOOL_CALL_WARN / TOKEN_OPTIMIZER_TOOL_CALL_CRITICAL) still take precedence for manual tuning.
Thanks to @CodyLee117 whose PR #33 added the env var configurability that made this scaling possible.
v5.6.10
Codex: Global hooks - codex-install now writes to ~/.codex/hooks.json (global) by default. One install covers all projects.
Codex: Runtime isolation - Surgical guards prevent Claude Code settings writes under Codex while preserving dashboard/daemon/checkpoint operations.
Configurable tool-call thresholds - TOKEN_OPTIMIZER_TOOL_CALL_WARN and TOKEN_OPTIMIZER_TOOL_CALL_CRITICAL env vars. Defaults unchanged (25/40). Thanks to @CodyLee117 (#33).
Safe env-var parsing - All TOKEN_OPTIMIZER_* int/float configs warn on invalid values instead of crashing.
Fixes: Version alignment (was 5.6.7/5.6.8/5.6.9), install.sh sparse checkout, symlink guard on ~/.codex, dry-run no longer creates ~/.codex as a side effect.
v5.6.9
Fix stale model pricing in reference docs. Opus 4.5+ is $5/$25 per MTok, not $15/$75 (that was Opus 4.0/4.1). Haiku 4.5 is $1/$5, not $0.25/$1.25 (that was Haiku 3). Core pricing engine was already correct; only reference docs were stale. Recalculated all worked examples and cost ratios.
v5.6.8 - Security Hardening
Security Fixes
- Add post-clone integrity verification and commit SHA logging (High)
- Remove install/build commands from bash compression whitelist (High)
- Add log rotation (1MB cap) and remove sensitive command text from rewrite log (Medium)
v5.6.7
Quality score architecture split: ResourceHealth + SessionEfficiency
The rising-score bug is dead. The composite quality score has been split into two independent metrics:
ResourceHealth (displayed as ContextQ:) is now architecturally monotonic. It uses only fill percentage, compaction depth, and waste signals that cannot improve without compaction. This is the backward-compatible score value for all existing consumers.
SessionEfficiency (displayed as Eff:) tracks behavioral signals (stale reads, bloated results, decision density, tool call patterns) and can rise/fall freely, which is correct for those metrics.
New real-time signals:
- 40+ tool calls warning (CRITICAL threshold)
- 50% fill regime change detection
- Re-reading loop detection
Rolling window scoring from v5.6.6 is preserved. No changes needed for Codex or OpenClaw.
v5.6.6
Fix: Quality score monotonicity bug
The composite quality score could climb during sessions without compaction. Three ratio-based signals (stale_reads, bloated_results, decision_density = 48% combined weight) were computed over full session history, so denominators grew and scores improved even as context degraded.
Rolling window scoring: Ratio-based signals now use a sliding window of the last 20 operations instead of full session history. Context fill, compaction depth, and duplicates remain cumulative (correct by nature). Configurable via TOKEN_OPTIMIZER_QUALITY_WINDOW env var.
Independent fill warnings: New fill-percentage warnings at 75% (WARNING) and 85% (CRITICAL) fire in the statusline and as system messages regardless of composite score value. These cannot be masked by improving ratio signals.
No changes needed for Codex or OpenClaw -- Codex uses the same compute_quality_score function (fix applies automatically), and OpenClaw scoring uses only point-in-time signals (no denominator expansion possible).
v5.6.5 — read cache escape hatch, edit-blocking fix
Fixes a reported issue where the read cache could block file edits on Linux/Cursor environments.
What changed:
- Escape hatch: After 3 consecutive denials of the same file, the read cache allows a full re-read. Prevents models from getting stuck in deny loops.
- Belt-and-suspenders guard: main() validates tool_name before processing, catching environments where hook matchers are not enforced.
- Diagnostic telemetry: Unexpected tool invocations logged for debugging.
- Clearer denial messages: All deny responses tell the model it can still Edit or Read a specific range.
No configuration changes needed. Existing users on auto-update will get this automatically.
v5.6.4 — loop detection false-positive fix
Fixes
- Tightened live loop detection so short successful tool results no longer trigger
Possible retry loopwarnings. - Retry-churn warnings now require concrete failure signals and repeated failures from the same tool family.
- Added conservative guards for benign outputs such as
0 failedand normal search-styleexit code 1results.
Version sync
- Bumped Claude Code plugin metadata from
5.6.3to5.6.4. - Confirmed no
id-manifest.jsonis present in this marketplace tree.
OpenClaw check
- Checked the OpenClaw implementation: this exact live short-result detector is deferred/not present there, and the existing retry-churn detector is session-level and failure-outcome based.
- Synced OpenClaw patch metadata to
2.4.1and fixed stale README/CLI version strings.
Verification
python3 -m py_compile skills/token-optimizer/scripts/measure.py- Focused loop-detection regression checks
npm run buildinopenclaw/python3 -m pytest tests(141 passed)