Skip to content

feat(telemetry): add the Claude Code telemetry adapter (2/4, GRO-305) - #27

Merged
teallarson merged 6 commits into
mainfrom
cursor/telemetry-claude-a3a4
Oct 13, 2026
Merged

teallarson merged 6 commits into
mainfrom
cursor/telemetry-claude-a3a4

Conversation

@teallarson

@teallarson teallarson commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Part of GRO-305 · issue

What/why

Prepares Claude Code to measure when a prompt may benefit from Arcade and whether Arcade is used, including tool failures and operator completion status. These measurements would add client-side context that server call logs cannot provide. Collection stays disabled: this PR leaves shipped hooks unchanged and sends no telemetry.

Codebase changes

Adds a Claude Code adapter to the existing telemetry hook generator. It maps prompt, tool, and subagent callbacks into the shared event format, identifies Arcade versus other tools, and honors Claude-specific opt-outs. Fixtures and tests cover event mapping, turn scope, opt-outs, generated hook wiring, and the disabled runtime.

Additional notes

Current-head CI passes tests and all four client validators. Disabled-runtime tests verify that hooks emit no output or telemetry, with a positive control to confirm the test can detect a send. Live Claude delivery, Windows behavior, and production ingestion remain unverified. Enabling collection requires a separate reviewed change and privacy approval.

— Strider 🐦‍⬛, Teal's agent · approved by Teal.


Note

Medium Risk
Adds client-specific hook/telemetry wiring and classification logic that would run once enabled; behavior is heavily tested but production ingestion and live Claude delivery are still out of scope for this PR.

Overview
Adds a Claude Code telemetry adapter and registers it on the claude-code host so the shared hook generator can emit Claude-specific telemetry rows (prompt submit, Arcade/other MCP pre/post tool use, WebFetch/WebSearch, per-CLI Bash, subagent stop). The adapter normalizes hook payloads, maps plugin vs claude_ai Arcade MCP prefixes and third-party MCP servers into contract events, and treats Claude opt-out env vars as “any non-empty value disables.”

Shared event building gains otherServerToolProperties for non-plugin MCP tools (gateway tools vs service inferred from tool/server names). Tests and fixtures exercise the full event matrix, turn/scope behavior, opt-outs, golden enabled manifest wiring, and that the shipped Claude manifest still omits telemetry so collection stays off at runtime.

Test helpers now strip inherited telemetry env (hookEnv), defer temp dir cleanup until file end, and add assertSilentThenServerReachable so “no send” cases cannot pass by posting elsewhere.

Reviewed by Cursor Bugbot for commit a3fd91f. Bugbot is set up for automated code reviews on this repo. Configure here.

@teallarson

Copy link
Copy Markdown
Contributor Author

@BugBot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1c51f07. Configure here.

@teallarson teallarson left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent final review at 1c51f07f115d5b3965b133368e542b37b13719ae: ready for human review with telemetry OFF.

Independent mapping/opt-out review: 21 focused tests, typecheck, generation and all 19 literal enabled-fixture shell commands silent while OFF. No remaining code finding.

Ready-for-review CI passed tests, all four client checks and the required aggregate gate; current-head Cursor Bugbot is green. Final combined heads plus main 18c7c99 passed 170/170 tests, zero skips, typecheck, four validators and 13 generated outputs. Independent combined privacy/release/adapter-removal review found no new blocker.

Windows, live client delivery and production ingestion remain activation prerequisites. No merge, release or collection enablement is authorized by this review. Descriptions preserve own-base review maps and limitations; Teal will inspect and request human reviewers.

— Strider 🐦‍⬛, Teal's agent · approved by Teal

@teallarson teallarson changed the title Add the Claude Code telemetry adapter (2/4, GRO-305) feat(telemetry): add the Claude Code telemetry adapter (2/4, GRO-305) Oct 7, 2026
Base automatically changed from cursor/telemetry-foundation-a3a4 to main October 12, 2026 16:55
cursoragent and others added 2 commits October 12, 2026 19:08
Replays the net #27 slice (old foundation 2671030..1c51f07) onto main
6f4cdc7, which now contains the squash-merged foundation (#26).
Telemetry stays hard-OFF (TELEMETRY_ENABLED = false).

Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
…n gate

The 19 enabled-fixture commands were fed a SessionStart input, which maps to
no event, so the test passed even with TELEMETRY_ENABLED flipped true. Feed
a sendable prompt, clear inherited Claude opt-outs, and add a positive
control that the loopback capture server observes a direct send.

Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
cursoragent and others added 4 commits October 12, 2026 22:24
Move the gateway-on-another-server and service inference fallback into
otherServerToolProperties so adapters keep only their own name parsing.
Export hookEnv, spawnExitCode and assertSilentThenServerReachable from the
telemetry test helpers, and use captureTelemetry instead of hand-rolled
runTelemetry calls in the Claude tests.

Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
…checks

Register tempDataDir cleanup at module load; an after() hook created inside
the first test only ran after that test.

Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
@teallarson
teallarson requested review from kamath and laughnan October 13, 2026 18:18
@teallarson
teallarson merged commit f2bb5c9 into main Oct 13, 2026
7 checks passed
@teallarson
teallarson deleted the cursor/telemetry-claude-a3a4 branch October 13, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants