mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-16 18:12:29 +02:00
Desktop-spawned Claude Code sessions (cowork/dispatch) pin ANTHROPIC_BASE_URL to the production endpoint (headroom #869), so the transparent proxy never sees their traffic and compression depended on the model voluntarily calling the headroom MCP tools. A managed PostToolUse hook now compresses Bash/Grep/Glob/WebFetch outputs over ~4000 chars in every session type with Headroom's rule-based pipeline, swapping them in via hookSpecificOutput.updatedToolOutput with a retrieval marker. Originals live in the shared CCR SQLite store, so mcp__headroom__headroom_retrieve recovers them; savings land in the durable ledger (client "posttooluse-hook"). The hook fails open, never compresses stderr, skips sub-50-token savings, and registers idempotently in ~/.claude/settings.json only after a --self-test gate; new headroom_auto_compress option (default true) removes the managed entry cleanly when disabled. Measured: 10781->2964 tokens (73%) on a representative HA states dump, ~1.7 s hook overhead, <100 ms pass-through. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>