Activation telemetry writer — orphaned vs registered

The subagent-stop/unified-dispatcher hook writes one JSONL line to ~/.claude/analytics/agent-usage.jsonl every time a sub-agent finishes (the SubagentStop event). It was present in source but unregistered in hooks.json from v7.30.0, so it never ran — freezing the file for ~78 days (2026-04-08 → 2026-06-25) until #2653 re-registered it. Toggle the wiring state below to see why the test suite stayed green the whole time.

SubagentStop write path

Last line of agent-usage.jsonl



  

Verdict:

Why the suite stayed green — and the guard that fixes it

The old wiring test only asserted the two flattened entries, never the dispatcher itself. This PR adds the missing registration assertion plus a real-filesystem write test.

// src/hooks/src/__tests__/e2e/dispatcher-registry-wiring.test.ts
+ it('should register subagent-stop/unified-dispatcher on SubagentStop', () => {
+   const hooks = (hooksConfig.hooks.SubagentStop || []).flatMap(g => g.hooks);
+   const dispatcher = hooks.find(h => commandPath(h).includes('subagent-stop/unified-dispatcher'));
+   expect(dispatcher).toBeDefined();   // ← would have failed for 78 days
+   expect(dispatcher?.async).toBe(true);
+ });

Verify it live (any session)

tail -1 ~/.claude/analytics/agent-usage.jsonl   # fresh ts = writer is alive