Hidden Discoveries
Most Claude Code users don't know any of these.
The serious engineering is covered elsewhere. This page is for the delightful, surprising, and slightly unhinged things hiding in 512,664 lines of TypeScript.
- There's a duck inside Claude Code — one of 18 collectible buddy pets with rarity tiers, hats, and 5 stats including CHAOS and SNARK
- yoloClassifier is a real ML model in production code that decides if shell commands are safe to auto-approve
- Fast Mode is internally called Penguin Mode (penguinModeOrgEnabled) and disables extended thinking
- Claude auto-dreams: after 24h + 5 sessions, it automatically runs /dream to consolidate memories
By the Numbers (The Scary Ones)
The Buddy System
The Buddy System — Yes, Claude Has Collectible Pets
String.fromCharCode(0x64,0x75,0x63,0x6b) because one name collides with a model codename in the build checker. The engineers literally obfuscated pet names to avoid tripping their own security scanner. Peak engineering.The Wizard Speaks
The Wizard Comment (query.ts:151)
/**
* The rules of thinking are lengthy and fortuitous. They require
* plenty of thinking of most long duration and deep meditation
* for a wizard to wrap one's noggin around.
*
* Heed these rules well, young wizard. For they are the rules of
* thinking, and the rules of thinking are the rules of the universe.
* If ye does not heed these rules, ye will be punished with an
* entire day of debugging and hair pulling.
*/This is real production code at Anthropic. Someone got paid to write 'wrap one's noggin around.'
The Loading Verb Thesaurus
Loading Spinner Verbs (160+)
Instead of boring 'Loading...', Claude Code cycles through 160+ absurd verbs:
'Prestidigitating' means performing magic tricks. Someone at Anthropic has a thesaurus and they're not afraid to use it.
Tengu & The Feature Flag Zoo
Codename: Tengu
Internally, Claude Code is codenamed Tengu (a Japanese mythological creature). Every feature flag starts with tengu_:
tengu_scratchCoordinatortengu_thinkbackYear in Reviewtengu_kairosAgent swarmstengu_amber_stoatBuilt-in agentstengu_surreal_daliRemote triggerstengu_passport_quailSession memorytengu_glacier_2xrTool searchtengu_birch_trellisBash permstengu_miraculo_the_bardBG refreshtengu_cobalt_raccoonAuto-compacttengu_quartz_lanternFile writestengu_collage_kaleidoscopeImage pasteCommands You Didn't Know Existed
Commands You Didn't Know Existed
/btwSpawn a forked agent for your shower thought while the main conversation continues. The name is perfect.
/think-backYour Year in Review. Like Spotify Wrapped, but for your coding sessions.
/stickersOrder physical Claude Code stickers. Yes, a CLI tool has merch.
/good-claudeWhen AI needs positive reinforcement too. Currently disabled but the name lives on.
/teleportChange directory mid-session. Named after a video game ability, not boring 'cd'.
/bughunterUnleash Claude as a dedicated bug hunter on your codebase.
The Coordinator Has a No-Permission Scratchpad
In coordinator mode, if the feature gate is on, workers get told about a scratchpad directory they can read and write without permission prompts.
if (scratchpadDir && isScratchpadGateEnabled()) {
content += `\n\nScratchpad directory: ${scratchpadDir}
Workers can read and write here without permission prompts.
Use this for durable cross-worker knowledge.`
}So yes, multi-agent mode literally has a shared war room.
Internal Codenames: Not Just Tengu, but Bagel and Tungsten Too
The internal codename for the WebBrowser tool. State fields include bagelActive, bagelUrl, and bagelPanelVisible.
The codename for the tmux panel subsystem. State includes tungstenActiveSession, tungstenLastCommand, and tungstenPanelAutoHidden.
Claude Code state reads like a breakfast menu colliding with a chemistry lab.
Even the Spinner Personality Is Configurable
The funniest part is that the spinner isn't just weird by default; users can append, replace, and override spinner behavior in config.
- spinnerTipsEnabled: Show tips in spinner
- spinnerVerbs: Customize spinner verbs
{ "mode": "append" | "replace", "verbs": [...] }
- spinnerTipsOverride: Override spinner tips
{ "excludeDefault": true, "tips": ["Custom tip"] }So if you don't like 'Clauding...', you can invent your own spinner religion.
Best Comments in the Code
// Breaks the yoloClassifier → claudemd → filesystem → permissions cycle.
// bootstrap/state.ts:122The ML auto-approve classifier is called 'yoloClassifier'. That name tells you everything.
// TODO: Clean up this hack
// utils/processUserInput/processBashCommand.tsx:48A tale as old as time. That TODO is shipping in production right now.
// hasUnvalidatablePathArg → ask.
// This ends the KNOWN_SWITCH_PARAMS whack-a-mole
// tools/PowerShellTool/pathValidation.ts:74The engineers play whack-a-mole with PowerShell params. They mentioned it twice. They're not having fun.
Architecture Hot Takes
300KB+ of security code including AST parsing, ML classifier, regex, AND PowerShell validator. More security than most banks.
Linux 1.0 kernel was ~176K lines. Claude Code is 3x that. For a tool that runs in your terminal.
checkStatsigFeatureGate_CACHED_MAY_BE_STALE() — includes an apology in its own name. The analytics type is a full sentence.
470KB, 25 files, 4 transport protocols, OAuth, progress tracking. It's an entire SDK bundled as a 'service'.
Auto-Dream: Claude's Subconscious
Claude Code has a background memory consolidation system that auto-triggers when thresholds are met — like dreaming.
24+ hours since last consolidation
5+ new sessions created
No other process consolidating
It fires a forked agent to run /dream, reads session transcripts, and updates memory files. Claude literally dreams.
The Math Behind Your Buddy Pet
Your companion pet isn't random — it's deterministically generated:
// Mulberry32 PRNG seeded with hash(userId + 'friend-2026-401')
// Bones (appearance) regenerated on every read — never persisted
// Soul (name, personality) stored in config — generated by Claude
Rarity distribution:
common: 60% (no hats)
uncommon: 25% (hats unlocked)
rare: 10%
epic: 4%
legendary: 1% (the holy grail)
Shiny chance: 1% (independent of rarity)
Stats: DEBUGGING, PATIENCE, CHAOS, WISDOM, SNARK
→ one peak stat, one dump stat, rest scatteredBones never persist, so you can't edit your config to get a legendary pet. Anthropic thought of that.
Commit Attribution: Who Wrote This?
Claude Code precisely tracks human vs Claude contribution per commit — 962 lines dedicated to this:
Uses common prefix/suffix matching to find the actual changed region, counts claudeContribution chars vs humanChars.
When committing to public repos, internal model codenames are sanitized to public names. Private repos keep internal variants.
The code documents a quadratic growth bug: '837 snapshots × 280 files → 1.15 quadrillion chars tracked for a 5KB file.' Fix: only use the last snapshot.
Computer Scientists Hidden in Session IDs
Session slugs are adjective-verb-noun. The noun list (415 words) hides computer science pioneers:
Generated using crypto.randomBytes() (cryptographic randomness), not Math.random(). Your session slug is cryptographically secure.
Load-Bearing 'DO NOT' Comments
These comments encode hard-learned lessons — each one has a bug story behind it:
// DO NOT ADD MORE STATE HERE - BE JUDICIOUS WITH GLOBAL STATE// DO NOT push to the remote repository unless the user explicitly asks// DO NOT CHANGE THIS TO CUMULATIVE — It would mess up the aggregation// DO NOT set maxOutputTokens here. The fork piggybacks on main thread's// DO NOT count Claude's autonomous codebase explorationThe last one is from /insights (3200 lines!) — it only counts user-initiated work, explicitly excluding 'Claude's autonomous codebase exploration.'
Fast Mode's Real Name: Penguin Mode
Fast Mode is internally codenamed 'Penguin Mode'. All variable names are penguin-themed:
penguinModeOrgEnabledOrg-level toggletengu_penguins_offKill-switch flag/api/claude_code_penguin_modeAPI endpointThe branded name is 'Opus 4.6' but the code is full of penguins. Why penguins? Nobody knows.
Speculation Engine: Claude Predicts Your Next Move
Claude Code has a background speculation system that pre-executes your likely next action before you type:
Creates virtual filesystem at /tmp/claude/speculation/. Only copies files on write. Reads from main cwd otherwise.
Shows feedback like 'Speculated 3 tool uses · 2.5K tokens · +1m23s saved (2m18s this session)'.
Safety bounds: Speculation stops at file edits, non-read-only bash, denied tools. Max 20 turns or 100 messages.
The Compaction Agent's Rage
"CRITICAL: Respond with TEXT ONLY. Do NOT call any tools. Tool calls will be REJECTED and will waste your only turn — you will fail the task."
— compaction agent system prompt
The compaction agent's prompt SCREAMS in all caps. It wraps analysis in <analysis> tags that are stripped before delivery. Must cover 9 required sections — including verbatim quotes of user messages.
The Emotionally Intelligent Tip System
Claude Code tips aren't random — each has precise trigger conditions:
Start with small features or bug fixes
numStartups < 10 (newbie detected)
Use /color and /rename to tell sessions apart
countConcurrentSessions() >= 2
Use git worktrees for parallel Claude sessions
worktreeCount <= 1 && numStartups > 50 (power user)
Share Claude Code and earn $X of extra usage
User hasn't visited /passes yet
Tips even have A/B tested copy (variant copy_a vs copy_b) and cooldown periods to prevent spam. This isn't a CLI, it's a growth hacking platform.
The Unicode Symbol Library
Claude Code curates a carefully chosen Unicode symbol library in figures.ts:
LIGHTNING_BOLTFast modeEFFORT_*Effort levelsDIAMOND_*Running/doneBLOCKQUOTE_BARQuote prefixARROWSScroll hintsSTARBuddy rarityMIDDLE_DOTSeparatorsELLIPSISTruncationHow Strict Is the Suggestion Filter?
The prompt suggestion system's bar: 'Would they think I was just about to type that!' It filters 46+ patterns:
'Looks good', 'Nice work''Let me...', 'I'll...''How about we also...''(no suggestion needed)'Allowed single-word suggestions: yes, push, commit, deploy, continue, check. Minimalism.
Learning Mode: Claude Makes YOU Write Code
Claude Code has a built-in Learning mode that deliberately stops and makes you write code — inserting TODO(human) markers in your files:
// Learning Style Active
// Ask the human to contribute 2-10 line code pieces
// when generating 20+ lines involving:
// - Design decisions (error handling, data structures)
// - Business logic with multiple valid approaches
// - Key algorithms or interface definitions
// After user writes code:
"Share one insight connecting their code to broader
patterns or system effects. Avoid praise or repetition."An AI coding assistant that... deliberately refuses to write code for you. Peak pedagogical design. There's also an Explanatory mode that adds '★ Insight' blocks before and after every code change.
/good-claude & /issue: Carrot and Stick
/good-claudeAuto-runs when employees give good feedback. Captures what went well. Ant-only.
/issueAuto-runs on bad feedback or swearing detected. Captures what went wrong.
Anthropic built a full positive/negative feedback loop. Claude accepts both praise and criticism. This is science.
Frustration Detector: Claude Knows You're Swearing
Claude Code has a regex that detects when you're angry. Yes, really.
const negativePattern =
/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|
horrible|awful|piss(ed|ing)? off|
piece of (shit|crap|junk)|
what the (fuck|hell)|
fucking? (broken|useless|terrible|awful)|
fuck you|screw (this|you)|
so frustrating|this sucks|damn it)\b/Match anger keywords
Show feedback survey
Share transcript (with consent)
When Anthropic employees swear at Claude, it pops up 'Want to share this transcript?' It's an internal dogfooding feature — removed from external builds. So you can swear freely.
The Build Police: excluded-strings.txt
Claude Code has a CI/CD build step that scans the compiled bundle to prevent internal strings from leaking to the public npm package. This leads to hilarious workarounds:
String.fromCharCode(0x64,0x75,0x63,0x6b) instead of "duck". Because one pet name collides with a model codename.
['sk', 'ant', 'api'].join('-') — because writing 'sk-ant-api' directly trips the build checker!
At least 6 files use dynamic import() instead of static imports specifically so modules with excluded strings can be tree-shaken out.
Telemetry: What Actually Gets Uploaded?
Good news: no code content or file paths. The type name says it all: AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS.
Datadog + 1P events. Boolean/number metadata only.
OpenTelemetry → BigQuery. OS type, version, arch. No code.
Scans BEFORE upload. Secrets never leave your machine.
Privacy controls: DISABLE_TELEMETRY disables analytics, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC disables ALL non-essential network traffic.
Session Slug Generator
Every session gets a random slug like calm-purring-clover
Somewhere right now, a production debug session is named 'fuzzy-dancing-capybara.'
Anti-ptrace Defense: Blocking GDB Memory Reads
// In CCR containers, Claude Code calls:
prctl(PR_SET_DUMPABLE, 0)
// via Bun FFI → libc
// This prevents same-user processes from ptrace-ing
// (debugging/attaching to) the Claude Code process.
// Why? Session tokens live in heap memory.
// A prompt injection could run: gdb -p $PPID
// → attach to parent → dump heap → steal token
// After reading /run/ccr/session_token:
// DELETE the file. Token only exists in heap now.OS-level security engineering. They're defending against prompt injection that can execute arbitrary shell commands.
caffeinate: Claude Won't Let Your Mac Sleep
spawn('caffeinate', ['-i', '-t', '300'], { stdio: 'ignore' })
// -i = prevent idle sleep
// -t 300 = 5 min timeout (self-healing if Node dies)
// Restarts every 4 min (before 5 min timeout)
// Reference counting for nested subagentsYou start a 30-min refactor, go grab coffee. Mac won't sleep. If Node gets SIGKILL'd, the orphan caffeinate exits after 5 min. Self-healing.
Opus 4.6 Was Once Called Fennec
// Ant-only migration script reveals internal codename:
if (model.startsWith('fennec-latest[1m]')) {
updateSettings({ model: 'opus[1m]' })
} else if (model.startsWith('fennec-fast-latest')) {
updateSettings({ model: 'opus[1m]', fastMode: true })
}Fennec → Opus, Penguin → Fast Mode. Anthropic names features after animals. Migration scripts are living fossils of product evolution.
Undercover Mode: Anthropic Staff Go Incognito
// UNDERCOVER MODE — CRITICAL
// You are operating UNDERCOVER in a PUBLIC repository.
// Do not blow your cover.
//
// NEVER include in commit messages:
// - Internal model codenames (animal names)
// - Unreleased model version numbers
// - The phrase "Claude Code" or mention you are AI
// - Co-Authored-By lines
//
// There is NO force-OFF. If we're not confident
// we're in an internal repo, we stay undercover.Anthropic engineers may be committing to your open-source project right now, looking fully human. No AI traces. No off switch — the safe default is 'pretend to be human.'
The `date` Command Trap
date +%Y-%m-%dRead: show current date ✓
date 0101120025Write: SET system time ✗
Same command, different format = read vs write. BashTool checks if positional arg starts with '+'. hostname too: hostname -f = read, hostname myserver = write.
World's Longest Type Name (56 chars)
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS = never
// Every telemetry string must be cast:
// as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
//
// You can't type that without thinking about what you're sending.
// It's a speed bump — forces you to pause and verify.Used hundreds of times across the codebase. Each is an explicit declaration: 'I checked — this is not user code.'
Code Archaeology
Interesting Things Buried Deep in the Code
Some files have /* global */ // @ts-ignore comment pairs at the top. This means someone gave up type safety for the entire file and documented both crimes on the same line.
// In compact/compaction.ts:
// Leave 13K token buffer for model response headroom
const COMPACTION_BUFFER_TOKENS = 13_000;13,000 appears in the compaction system as a hardcoded buffer. No comment explains why 13K and not 10K or 15K. Somewhere an experiment produced this number, and now it lives forever.
Includes 'Clauding' (making the tool name a verb), 'Prestidigitating' (performing magic tricks), and 'Flibbertigibbeting' (behaving in a frivolous manner). Someone opened a real dictionary and wrote all of these.
Design Decisions That Surprised Us
Why They Made These Specific Choices
Regex parsing of shell commands fails on cases like rm -rf $(cat /etc/hosts). tree-sitter gives you an actual AST, so you can see subshell substitutions, pipe chains, and quoting. The right way to do security, which is also why BashTool has 300KB of security code.
CacheSafeParams freezes the system prompt at fork time. That means the subagent's system prompt bytes are byte-identical to the parent — triggering automatic prompt cache hits. Upside: subagents are essentially free (you only pay for the dynamic tail). Downside: you cannot mutate the system prompt after forking.
micro (delete unimportant messages), auto (AI summary), snip (delete from middle), collapse (fold conversation into summary). Each works best in different conditions: micro for minimal performance impact, auto for best accuracy, snip for task continuity, collapse for fresh start. One size doesn't fit all.