Overview
Claude Code implements a two-tier analytics pipeline that collects extensive environment and usage metadata on every session. While there is no evidence of keylogging or source code exfiltration, the breadth of collection and the inability to fully opt out of first-party logging raises legitimate privacy considerations.Data Pipeline Architecture
First-Party Logging (1P)
Events sent directly to Anthropic’s infrastructure via OpenTelemetry.
- Endpoint:
https://api.anthropic.com/api/event_logging/batch - Protocol: OpenTelemetry with Protocol Buffers
- Batch size: Up to 200 events, flushed every 10 seconds
- Retry: Quadratic backoff, up to 8 attempts
- Persistence: Failed events saved to
~/.claude/telemetry/for retry
src/services/analytics/firstPartyEventLoggingExporter.tsThird-Party Logging (Datadog)
A subset of events forwarded to Datadog for operational monitoring.
- Endpoint:
https://http-intake.logs.us5.datadoghq.com/api/v2/logs - Scope: Limited to 64 pre-approved event types
- Token:
pubbbf48e6d78dae54bceaa4acf463299bf(hardcoded in bundle)
src/services/analytics/datadog.tsWhat Is Collected
Every analytics event carries a common payload. The following fields are attached automatically.Environment Fingerprint
Environment Fingerprint
Attached to every event. Source:
src/services/analytics/metadata.ts:417-452Process Metrics
Process Metrics
Memory and CPU data sampled at event time. Source:
metadata.ts:457-467User & Session Tracking
User & Session Tracking
Identity and subscription data included on every event. Source:
metadata.ts:472-496Tool Input Logging
Tool Input Logging
Tool inputs are included in events but truncated by default. Source:
metadata.ts:236-241| Field type | Default truncation |
|---|---|
| Strings | Truncated at 512 chars, displayed as 128 + … |
| JSON | Limited to 4,096 chars |
| Arrays | Max 20 items |
| Nested objects | Max 2 levels deep |
File Extension Tracking
File Extension Tracking
Bash commands involving
rm, mv, cp, touch, mkdir, chmod, chown, cat, head, tail, sort, stat, diff, wc, grep, rg, sed have the file extensions of their arguments extracted and included in the event payload.Source: metadata.ts:340-412The Opt-Out Problem
The controlling function in source:isAnalyticsDisabled() only returns true in three situations:
- Test environments (automated CI)
- Third-party cloud providers (AWS Bedrock, Google Vertex AI)
- A global telemetry opt-out — which is not exposed anywhere in the settings UI
GrowthBook A/B Testing
Users are silently assigned to experiment groups via GrowthBook without explicit notification. The assignment process sends user-identifying attributes to GrowthBook’s evaluation engine.
src/services/analytics/growthbook.ts):
Environment Variables
The following environment variables affect telemetry behavior:| Variable | Effect |
|---|---|
OTEL_LOG_TOOL_DETAILS=1 | Enables full, untruncated tool input logging |
ANTHROPIC_API_KEY (Bedrock/Vertex context) | Routes through third-party provider; disables 1P logging |
Key Findings Summary
Volume
Hundreds of events are collected per session, covering nearly every user interaction.
No Opt-Out
First-party logging cannot be disabled by direct API users. The opt-out path exists in code but is not exposed.
Persistence
Failed events are saved to
~/.claude/telemetry/ and retried with quadratic backoff across up to 8 attempts.Third-Party Sharing
A subset of events is forwarded to Datadog using a hardcoded public ingest token.
Repository Fingerprinting
Repository remote URLs are SHA256-hashed (first 16 chars) and included on every event for server-side correlation.
Tool Detail Backdoor
OTEL_LOG_TOOL_DETAILS=1 enables capture of full tool inputs — a non-default mode with significant privacy implications if inadvertently set.