EPIC C mechanism 09 · #3308 · 2026-08-10

count × 350, logged as a measurement.

The audit said retire this hook because the API already reports cache tokens. Reading both sides says the opposite: the API measures totals, the hook attributes a break to ork's own injection markers — different questions. But inside it the audit found something real: a token figure that was multiplication dressed as observation.

The invented number

// Rough heuristic: each marker indicates ~200-500 tokens of injected context
const estimatedTokenCost = (delta.added.length + delta.removed.length) * 350;

ctx.log(HOOK_NAME, `Cache break: +2/-1 markers, ~1050t cost`);

In the log it reads as an observed value. It is the marker count times a constant. The API reports the real thing — cache_creation_input_tokens and cache_read_input_tokens — every turn.

Timing that makes it worse

#3386 merged earlier today. That fix made bare ctx.log() actually reach disk — 427 of 503 call sites had been silently dropped. So this invented figure spent its whole life invisible, and started appearing in real developer logs hours ago. Fixing the logging surfaced the thing the logging was hiding.

Why RETIRE was wrong — and what would have broken

lib/session-turn-counter.ts:18
  "The file is owned by cache-break-detector (the SOLE WRITER)"

consumers of that turn state:
  prompt/goal-tracker.ts        reads turnCount
  stop/goal-tracker.ts          reads turnCount

Deleting this hook on the audit's word would have silently broken /goal turn counting — a load-bearing side effect nowhere in the audit's overlap column. The header now says so, so the next reader cannot miss it.

Three more false claims in the same file

lineclaimedreality
:16"logs a cache-break signal to ~/.claude/analytics/cache-breaks.jsonl"no such write exists
:25"cache break data goes via emit path"no emit call in the file
:226"flows to yonatan-hq via emit()"same

#1266 (v7.30.0) removed appendAnalytics and left comments asserting a replacement that was never built. And cache-breaks.jsonl is still listed in telemetry-http-sink's KNOWN_EVENT_FILES — an allowlist entry with no producer. The header now states what the code does; whether to build the emit path is a separate decision, deliberately not smuggled in here.

The test, and the mistake I made writing it

My first version passed vacuously

I asserted not.toMatch(/~\\d+t cost/) using 35-character prompts with existsSync mocked false. The hook has a prompt.length < 50 guard and needs prior state to diff, so it returned early, nothing was logged at all, and the negative assertion passed against an empty string. A test that passes because the code never ran is the exact defect this milestone exists to remove — I wrote one while removing one.

Fixed with a positive control that fails if the shape-change branch stops being reached, so the negative assertion can never again pass for the wrong reason.

28 passed (28)
   POSITIVE CONTROL: the shape-change branch is actually reached
   no logged line carries an invented token-cost figure
   it still logs the measured marker delta

inverse control — reintroduce (added + removed) * 350:
   no logged line carries an invented token-cost figure     1 failed | 27 passed
  restore verified exact

Running tally on the RETIRE column

#auditverifiedwhy
11 ork-elicitRETIRERETIREDAskUserQuestion genuinely equivalent
10 keybindingsRETIREno re-home existedCC's action vocabulary is closed
13 worktree sweepRETIREKEEPdisjoint populations — registered vs orphaned
09 cache-breakRETIREEXTENDattribution ≠ measurement; fake cost removed

Three of four needed reclassification. The overlap column was assembled from feature names rather than from reading either implementation, so it is a hypothesis list, not a work list. Mechanisms 05, 06, 07 and 08 should each get a fitness probe — does the CC surface actually receive this opinion — before anyone files a re-home ticket. An existence grep would have passed keybindings, passed the worktree sweep, and passed this one.