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.shon every install andgit pullupdateensure-healthonSessionStart(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-restorefromcompact-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.shandensure-healthno longer race-condition on settings.json- Cosmetic flags (
--quiet,--warn) are stripped from identity so functionally-equivalent hooks dedup correctly cleanupPeriodDayswrite 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).