
How I Reverse-Engineered Claude Code's Hidden Pet System
I was poking around Claude Code's source one evening and found something I wasn't supposed to see: a full gacha companion pet system, hidden behind a compile-time feature flag. A little ASCII creature that sits beside your terminal input, occasionally comments in a speech bubble, and is permanently bound to your Anthropic account. Your buddy is deterministic. Same account, same pet, every single time. No rerolls. Naturally, I wanted a legendary dragon. Here's how I cracked it. What's Actually in There The buddy system lives across four files inside Claude Code's codebase: buddy/types.ts defines 18 species, 5 rarities, 6 eye styles, 8 hats, and 5 stats buddy/companion.ts implements the PRNG, hash function, roll algorithm, and tamper protection buddy/sprites.ts has ASCII art for every species (three animation frames each, a hat overlay system, and a render pipeline) buddy/prompt.ts holds a system prompt that gets injected into Claude so it knows how to coexist with the pet without impers
Continue reading on Dev.to JavaScript
Opens in a new tab


