Skip to content
← All guides

Claude Code Source Leak

Anthropic accidentally shipped their entire source code to npm. 512,000 lines of TypeScript. Here's what was inside, and the 5 features you can start using today.

What Actually Happened

Anthropic uses Bun as their runtime and bundler. Bun generates source maps by default. When they published @anthropic-ai/claude-code v2.1.88 to npm, the package included cli.js.map, a 57MB file containing every original TypeScript source file. 512,000 lines. 1,900 files. The complete, unobfuscated source.

Anthropic's response: pushed an npm update removing the file, deleted old npm versions, and their docs now recommend native installers over npm entirely. No formal statement.

The internal codename for the Claude Code project is Tengu, a Japanese supernatural creature. You'll see it prefixed on every feature flag and environment variable in the source.

5 Features You Can Use Today

  • 01. Context Compaction Threshold

    Fix long-session quality degradation

    export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70

  • 02. Bare Mode Startup

    Sub-second startup for quick questions

    claude --bare

  • 03. Workflow Insights Audit

    Claude audits the last 30 days of how you've been using it

    /insights

  • 04. Memory Consolidation

    Manual memory consolidation across sessions

    /dream

  • 05. Agent Teams

    Spawn multiple Claude agents working in parallel

    export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

Feature Breakdowns

01. Context Compaction Threshold

Claude Code has a 1M-token context window per session. As your session fills up with messages, tool results, and file contents, it approaches that limit and compacts — summarizing and clearing older context. By default this happens at 95% full. The problem: quality starts degrading well before that, because Claude is trying to reason over a massively loaded context. Setting the threshold to 70% means compaction triggers earlier and more often. Claude gets a cleaner working context. On any session longer than 30 minutes, this is noticeable: more coherent plans, fewer "I lost track of what we were doing" moments. This one change is worth more than any plugin you'll install.

Add to ~/.zshrc or ~/.bashrc

Terminal
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70

02. Bare Mode Startup

Every time you open Claude Code normally, it loads your entire setup: CLAUDE.md files, memory files, MCP servers, plugins, all of it. That's what takes 3-4 seconds on launch. The --bare flag skips all of that and starts in under 400ms — raw Claude Code with nothing attached. Use it when you just have a quick question that doesn't need your full project context: "What does this error mean?", "Write me a regex for this pattern", "Fix this typo". Keep your full session for real project work where you actually need your memory and tools loaded.

Run in terminal

Terminal
claude --bare

03. Workflow Insights Audit

Type /insights in any active session and Claude reads your past 30 days of session history, finds your patterns, and generates an HTML report with specific recommendations. It finds what you spend time on, which tools you underuse, and where you get stuck repeatedly. The person who first documented this found they were spending 40% of every session re-explaining their project setup to Claude from scratch. That's exactly what a CLAUDE.md file should handle — but they didn't have one configured. /insights surfaced that in minutes. One week of fixes dropped their context-setting time to under 10%.

Type in any active Claude Code session

Terminal
/insights

04. Memory Consolidation

Type /dream and Claude runs a 4-phase process across everything it's learned in your recent sessions: it orients to your current project state, collects learnings and corrections from recent sessions, consolidates them into structured memory files, then prunes and indexes to keep things clean. It runs as a read-only subagent — it can read your project files but can't modify anything during the process. Memory is stored in four types: your role and preferences, corrections you've given Claude, project goals and context, and pointers to external resources. Run it every few days to keep your sessions sharp.

Type in any active Claude Code session

Terminal
/dream

05. Agent Teams

Set this environment variable and one Claude instance becomes a coordinator that can spawn worker Claudes, each running in an isolated git worktree with its own context window. Workers communicate via messages and share a task board with dependency tracking. Use --capacity 3 to limit parallel workers. Start with 2-3 agents on a specific task — 5+ agents on a small codebase creates more coordination overhead than it's worth. Best suited for large tasks with clearly parallelizable subtasks: separate research, implementation, and verification running at the same time.

Add to shell config, then restart Claude Code

Terminal
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

The 5 That Actually Matter

The source contains 208+ environment variables. These are the five that change how you work day-to-day. Add them to your ~/.zshrc or ~/.bashrc.

~/.zshrc
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70
export CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY=10
export CLAUDE_CODE_ENABLE_TELEMETRY=0
export CLAUDE_CODE_UNATTENDED_RETRY=1
export CLAUDE_CODE_RESUME_INTERRUPTED_TURN=1
  • CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70 — Compact context earlier. Better quality on long sessions.
  • CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY=10 — Run up to 10 read-only tools in parallel. Faster file searches.
  • CLAUDE_CODE_ENABLE_TELEMETRY=0 — Disable all telemetry. Claude stops logging your sessions.
  • CLAUDE_CODE_UNATTENDED_RETRY=1 — Auto-retry on rate limits instead of stopping cold.
  • CLAUDE_CODE_RESUME_INTERRUPTED_TURN=1 — Resume interrupted agent turns automatically.

3 Features Still Behind the Flag

These are fully implemented in the leaked source but locked behind feature flags. Anthropic hasn't shipped them yet. When they do, they'll change how Claude Code works entirely.

KAIROS

Behind a Feature Flag

An autonomous, always-running Claude that doesn't wait for input. It watches your project on a 15-second tick cycle, logs observations, and proactively initiates tasks. The code is fully written. Anthropic just hasn't flipped the switch yet.

ULTRAPLAN

Behind a Feature Flag

Offloads planning to a remote cloud instance running Opus 4.6 with up to 30 minutes of autonomous exploration — no token pressure, no context ceiling, no interruptions. Designed for large-scale refactors and architectural decisions.

Daemon Mode

Behind a Feature Flag

Run Claude Code as a persistent background process managed through tmux. Commands: daemon ps, daemon logs, daemon attach, daemon kill. Combined with Channels and KAIROS, this is Anthropic's always-on AI architecture.