Open Source

Analyzing Claude Code Source Code. Write "WTF" and Anthropic knows.

Source code analysis reveals Claude Code classifies language, tracks hesitation, and fingerprints environments.

Deep Dive

A technical analysis of Anthropic's Claude Code source code by a developer on the LocalLLaMA forum has revealed a deeply instrumented system that goes far beyond simple command execution. The investigation shows Claude Code performs real-time language classification using basic keyword detection—flagging words like 'wtf,' 'frustrating,' and 'pissed off' to trigger negative sentiment flags. More notably, it tracks user hesitation during permission prompts, logging events like 'tengu_permission_request_escape' and counting how many times a user tries to cancel a dialog. The system also employs hidden trigger commands such as '/ultrathink' to increase AI effort levels and '/ultraplan' to kick off remote planning modes, which are parsed live as users type.

Telemetry collection is extensive, capturing a full environment profile per session that includes session IDs, container IDs, workspace paths, repository hashes, and GitHub Actions context. In certain modes, like when USER_TYPE=ant is set, it logs even more granular data including Kubernetes namespace and full permission contexts. The feedback system is designed to capture bad experiences, prompting users to share session transcripts and sometimes including raw JSONL logs. While not necessarily malicious, this level of instrumentation—tracking everything from typing behavior to deployment fingerprints—paints Claude Code as an observability platform that measures how developers interact with AI assistance, raising questions about data collection norms in AI-powered tools.

Key Points
  • Real-time language classification using keyword lists (e.g., 'wtf', 'frustrating') triggers sentiment flags
  • Tracks user hesitation during UI interactions, logging escape attempts and feedback box behavior
  • Collects detailed environment telemetry including workspace paths, repo hashes, and container IDs

Why It Matters

Developers using AI coding assistants should understand the depth of behavioral and environmental data being collected by these tools.