I Tore Apart the Claude Code Source Code 3/3
More posts at radarlog.kr. The most surprising thing I found digging through Claude Code's source wasn't a tool or an architecture pattern. It was opening the buddy/ folder. There's a virtual pet s...

Source: DEV Community
More posts at radarlog.kr. The most surprising thing I found digging through Claude Code's source wasn't a tool or an architecture pattern. It was opening the buddy/ folder. There's a virtual pet system. It works like a gacha game. Five rarity tiers. Eighteen species. Buddy — A Gacha Virtual Pet Inside a Coding Agent src/buddy/ directory. Five files, 79KB. Gated behind the BUDDY feature flag, so it's not publicly available yet. But the implementation is complete. Characters are generated deterministically from the userId as a seed. Same user always gets the same character. The PRNG is Mulberry32. function mulberry32(seed: number): () => number { let a = seed >>> 0 return function () { a |= 0 a = (a + 0x6d2b79f5) | 0 let t = Math.imul(a ^ (a >>> 15), 1 | a) t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t return ((t ^ (t >>> 14)) >>> 0) / 4294967296 } } As a game developer, I recognize this instantly. Lightweight seeded random. Mulberry32 is