github alexgreensh/token-optimizer v5.0.1
v5.0.1 — Auto-Heal Hooks

latest releases: v5.7.3, v5.7.2, v5.7.1...
one month ago

Auto-heal hooks for script installs

v5.0.0 shipped the Active Compression features but script-install users (via install.sh) weren't getting the full hook set because the installer only set up the quality-bar hook. v5.0.1 fixes that.

What's new

setup-all-hooks command: Merges all canonical hooks from hooks/hooks.json into settings.json idempotently. Called automatically by:

  • install.sh on every install and git pull update
  • ensure-health on SessionStart (throttled to once per 24h)
  • Manually via measure.py setup-all-hooks

Self-healing drift detection: If you're missing any v5 hooks for any reason (manual edits, corrupted settings, upgrade from v4.x), they'll be automatically restored on your next session start.

Safety hardening from compound engineering review

Seven issues found by adversarial + security reviewers and fixed before ship:

  • Identity function now distinguishes compact-restore from compact-restore --new-session-only (would have silently disabled new-session context restore)
  • Async/timeout hook fields are preserved when merging (SessionEnd hooks stay async)
  • Plugin paths with shell metacharacters (quotes, backticks, etc.) are rejected
  • Settings.json corruption protection: refuses to write over a non-empty file that parses to empty
  • Stale path replacement: old install paths get upgraded in-place
  • install.sh and ensure-health no longer race-condition on settings.json
  • Cosmetic flags (--quiet, --warn) are stripped from identity so functionally-equivalent hooks dedup correctly
  • cleanupPeriodDays write path now uses atomic write with file lock

Privacy language polish

Structure Map Beta label updated from "Telemetry Only" to "Local Measurement" everywhere. All v5 telemetry has always been 100% local; this release makes that clearer in the dashboard, CLI, and docs.

For existing users

Marketplace plugin users: Auto-update will pull v5.0.1 on your next session. The new self-heal hook will verify all your hooks are correctly wired on your next SessionStart after that.

Script install users (install.sh): Run bash ~/.claude/token-optimizer/install.sh to upgrade. The installer will detect and install any missing hooks automatically.

Anyone who manually wrote hooks in settings.json: The self-heal is non-destructive — it only adds missing hooks, it never removes or modifies existing ones (except to fix stale paths from old install locations).

Don't miss a new token-optimizer release

NewReleases is sending notifications on new releases.