ENZH

I Used Claude to Reroll My Claude Code Pet

📊 Slides

If you've played any gacha game, you know the ritual. You start a new account, pull your initial draw, see three-star garbage, delete the account, and start over. Repeat until the golden legendary drops.

I did the same thing with my AI coding assistant's virtual pet.

The Buddy System

Claude Code v2.1.89 shipped a /buddy command as an April Fools' Easter egg. Type it, and a little pixel-art companion hatches next to your input box. It sits there while you code, occasionally reacting to what you're doing — cheering on clean diffs, wincing at stack traces.

The system is surprisingly deep. There are 18 species (dragon, phoenix, unicorn, jellyfish, octopus, and more), five rarity tiers from Common up to Legendary (five stars), and an independent 1% chance for any pet to be "shiny" — a sparkly variant with alternate colors.

Here's the catch: your pet is deterministic. Your account ID gets hashed, and the hash decides your species, rarity, and shiny status. One account, one pet, forever.

Mine was a rare penguin. Not terrible — blue-tier at least. I could live with it.

Then I got curious and tried my other account.

Another penguin. But this time: Common. The rarity actually went down.

Two accounts. Same species. Downgraded rarity. The RNG gods weren't ignoring me — they were taunting me.

The Gacha Brain Activates

Look. I am a strength player. In every RPG, every card game, every gacha — I reroll. I min-max my starting conditions before the game even begins. Two penguins with declining rarity is not a starting condition I accept.

The community figured out the internals fast. Within hours of the feature shipping, reverse engineering threads popped up on linux.do breaking down the hashing algorithm, the species list, and the exploit path. Someone even built cc-buddy, an open-source tool to preview what pet any given ID would produce.

Credit where it's due — the community cracked this wide open. Another detailed breakdown walked through the full internals. I read both threads, understood the system, and thought: I don't need a lookup tool. I need a brute-force script.

And I have the perfect tool to write one.

Using Claude to Hack Claude

The irony was not lost on me.

I opened Claude Code, pointed it at the compiled Bun binary that ships with the CLI, and asked it to extract the hashing algorithm. Within minutes it had pulled out the key pieces:

  • FNV-1a hash feeds into a Mulberry32 PRNG
  • The salt is "friend-2026-401" (April 1st — cute)
  • Species and rarity are derived from sequential PRNG draws off the seeded state
  • Shiny is a separate 1/100 roll

The 18 species were encoded as char codes in the binary. Claude decoded them all: duck, goose, blob, cat, dragon, octopus, owl, penguin, turtle, snail, ghost, axolotl, capybara, cactus, robot, rabbit, mushroom, chonk.

Then I asked Claude to write a brute-force script: iterate random user IDs, hash each one, check if the result is a Shiny Legendary Dragon.

0.2 seconds. Hit.

A golden legendary dragon, just like that. But my script only searched species + rarity + shiny — no control over the hat or eye style. The dragon's appearance was still up to chance.

The Community Version: Pixel-Perfect

Then I found the community's cc-buddy tool, which lets you specify everything — species, rarity, shiny, hat, eye style. I wanted a dragon with a crown and specific eyes.

Bigger search space, so it took longer. The counter climbed from 500K to 1M, 2M, 3M, 4M...

Iteration 4,547,133. 9.75 seconds. Hit.

cc-buddy brute-force searchcc-buddy brute-force search

This time every detail was exactly what I chose. I swapped my config, hatched the dragon, and felt the dopamine hit of a golden pull without spending a single primo.

Shiny Legendary Dragon — MurmuxShiny Legendary Dragon — Murmux

Bones and Soul

Here's the part that surprised me: the pet has layers.

The bones layer is the immutable part — species, rarity, shiny status, the visual appearance. This is what the hash determines, and what I had just brute-forced.

The soul layer is mutable. When you first hatch your pet, Claude generates a personality for it — a name, a backstory, behavioral quirks. The pet has five stats: debugging, patience, chaos, wisdom, and snark.

My dragon Murmux has PATIENCE 100 (maxed out) and a personality description that still calls it "a perpetually unimpressed penguin" — because the soul was generated back when I had the penguin. The bones changed, but the soul remembered what I used to be. Accidentally poetic.

The Subscription Plot Twist

I thought I was done. I was wrong.

For subscription users (Claude Max, Claude Pro), the CLI writes an accountUuid on login. This UUID takes priority over the local userID for buddy calculation. So every time I launched Claude Code, it would re-authenticate, write the real account UUID, and my carefully crafted pet would revert to... the rare penguin.

The fix: a shell wrapper. Before every launch, strip the accountUuid from the config file, then start the CLI. The buddy system falls back to userID, which I control.

# In .zshrc — the buddy persists across sessions
alias claude='sed -i "" "/accountUuid/d" ~/.claude/config.json 2>/dev/null; command claude'

Three lines. Problem solved permanently.

The Numbers

Total time from "what is /buddy" to permanent shiny legendary pet: 36 minutes.

Time spent on the brute-force: 0.2 seconds (Claude's script, species+rarity+shiny only), then 9.75 seconds (cc-buddy, full customization down to hat and eyes).

Time spent on everything else (reading community research, extracting the algorithm, writing the wrapper, deciding on the exact eye style and hat): 35 minutes and 50 seconds.

Lines of code I personally wrote: zero. Claude wrote all of it — the extraction script, the brute-force search, the shell wrapper. I just described what I wanted and made aesthetic decisions.

What This Actually Is

It's a silly story about hacking a virtual pet. But think about what Anthropic's Claude Code team actually built here: a full gacha system — 18 species, 5 rarity tiers, shiny mechanic, hats, eyes, five-stat personality, a bones-and-soul dual-layer architecture — hidden inside a general-purpose coding agent. This isn't a lazy Easter egg. This is a team of engineers lovingly building something completely useless inside one of the most serious developer tools on the market.

That's the kind of team culture that makes products people actually love.

It's also a clean example of what "coding with AI" actually feels like day to day.

The interesting work wasn't writing hash functions or PRNG implementations. It was knowing what to ask for: understanding the system architecture from community research, specifying the brute-force constraints, recognizing the subscription UUID problem, designing the persistence wrapper. The human contribution was taste and systems thinking. The AI contribution was the mechanical parts — reading binaries, writing scripts, iterating fast.

Thirty-six minutes of doing something completely unnecessary. Zero regret. And my dragon has a crown and the soul of a penguin.


© Xingfan Xia 2024 - 2026 · CC BY-NC 4.0