Claude Code Buddy மாற்றம் வழிகாட்டி: எவ்வாறு மின்ன闪传说 நிலை செல்லப்பிராணிகளை பெறுவது
Claude Code Buddy மாற்றம் வழிகாட்டி: எவ்வாறு மின்ன闪传说 நிலை செல்லப்பிராணிகளை பெறுவது
2026年4月1日,Anthropic 在 Claude Code 2.1.89 版本中悄然上线了一个彩蛋功能——/buddy 宠物系统。在终端输入 /buddy 后,一只 ASCII 风格的小动物会"孵化"在你的输入框旁边,陪你写代码、吐槽 bug。
每只 Buddy 由账号 ID 通过确定性算法生成,意味着同一个账号永远获得同一只宠物。但通过修改配置文件中的 userID,我们可以"重ROLL"出心仪的宠物。本文将详细介绍算法原理和完整的修改脚本。
一、Buddy 系统概览
18 种物种
系统目前包含 18 种可爱的物种:
- duck - காகம்(சாதாரண Rubber Duck Debugging)
- goose - குஞ்சு(குழப்பம் செய்யும்)
- blob - ஜெல்லி(மென்மையான மற்றும் வடிவமற்ற)
- cat - பூனை(உயர்ந்த மற்றும் காம்பிய)
- dragon - டிராகன்(அதிகாரமான பாதுகாப்பு)
- octopus - ஆமி(பல திசைகளில் சிந்தனை)
- owl - குருவி(அறிவான ஆசிரியர்)
- penguin - பிங்க்வின்(சரியான உடையில் வருகை)
- turtle - குரங்கு(நம்பகமான மற்றும் நிலையான)
- snail - புழு(மெதுவாக வேலை செய்கிறது)
- ghost - ஆவிகள்(திடீரென தோன்றும்)
- axolotl - அசோலோட்(அழகான மற்றும் குணமாக்கும்)
- capybara - நீர்க்குரங்கு(புத்திசாலி மாஸ்டர்)
- cactus - காகிதம்(உற்சாகமான செடி)
- robot - ரோபோட்(அறிவியல் முதன்மை)
- rabbit - முட்டை(செயல்பாட்டில்)
- mushroom - காளான்(அமைதியாக கவனிக்கிறது)
- chonk - கொழுப்பான(சுற்றிலும்)
5 级稀有度
- Common(சாதாரண) - 60% சாத்தியம், தொப்பி அலங்காரம் இல்லை
- Uncommon(அசாதாரண) - 25% சாத்தியம், தொப்பி திறக்கிறது
- Rare(விலகிய) - 10% சாத்தியம், மேலும் அலங்காரங்கள்
- Epic(கோட்பாடு) - 4% சாத்தியம், தனிப்பட்ட அலங்காரம்
- Legendary(கதைகள்) - 1% சாத்தியம், உச்ச அலங்காரம்
二、算法原理深度解析
Buddy 的生成采用确定性随机算法,核心流程如下:
1. 种子字符串拼接
const SALT = "friend-2026-401"; // 4月1日愚人节彩蛋 const key = userId + SALT;
Salt 值 friend-2026-401 中的 401 代表 4月1日——一个精心设计的愚人节彩蛋。
2. FNV-1a 32-bit 哈希
将种子字符串转换为 32 位整数:
function hashString(s) { let h = 2166136261; // FNV offset basis for (let i = 0; i < s.length; i++) { h ^= s.charCodeAt(i); h = Math.imul(h, 16777619); // FNV prime } return h >>> 0; }
3. Mulberry32 PRNG
用哈希值初始化伪随机数生成器:function mulberry32(seed) { 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; }; }
Mulberry32 என்பது விளையாட்டு உருவாக்கத்தில் பொதுவாகப் பயன்படுத்தப்படும் எளிய PRNG ஆகும், இது திட்டமிடப்பட்ட உருவாக்கம் மற்றும் போர் வெற்றிகள் விழுப்புரைகள் உருவாக்குவதற்கு ஏற்றது.
4.稀有度抽取(关键!)
const RARITIES = ["common", "uncommon", "rare", "epic", "legendary"]; const RARITYWEIGHTS = { common: 60, uncommon: 25, rare: 10, epic: 4, legendary: 1 };
function rollRarity(rng) { const total = 60 + 25 + 10 + 4 + 1; // = 100 let roll = rng() total; for (const rarity of RARITIES) { roll -= RARITYWEIGHTS[rarity]; if (roll < 0) return rarity; } return "common"; }
重要:RARITIES 数组的顺序必须是从低到高,这是加权随机选择的标准实现。
三、完整 Reroll 脚本
以下脚本可以搜索并生成闪光传说级 Buddy 的 userID:
// Claude Code Buddy Reroll 脚本 // 基于 Claude Code 源码逆向分析
// FNV-1a 32-bit hash function hashString(s) { let h = 2166136261; for (let i = 0; i < s.length; i++) { h ^= s.charCodeAt(i); h = Math.imul(h, 16777619); } return h >>> 0; }
// Mulberry32 PRNG function mulberry32(seed) { 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; }; }
const SPECIES = [ "duck", "goose", "blob", "cat", "dragon", "octopus", "owl", "penguin", "turtle", "snail", "ghost", "axolotl", "capybara", "cactus", "robot", "rabbit", "mushroom", "chonk" ];const RARITIES = ["common", "uncommon", "rare", "epic", "legendary"]; const RARITYWEIGHTS = { common: 60, uncommon: 25, rare: 10, epic: 4, legendary: 1 }; const SALT = "friend-2026-401"; function pick(rng, arr) { return arr[Math.floor(rng() arr.length)]; } function rollRarity(rng) { const total = Object.values(RARITYWEIGHTS).reduce((a, b) => a + b, 0); let roll = rng() total; for (const rarity of RARITIES) { roll -= RARITY_WEIGHTS[rarity]; if (roll < 0) return rarity; } return "common"; } function testUserId(userId) { const key = userId + SALT; const seed = hashString(key); const rng = mulberry32(seed); const rarity = rollRarity(rng); const species = pick(rng, SPECIES); const shiny = rng() < 0.01; return { rarity, species, shiny }; } function randomUserId() { let id = ""; for (let i = 0; i < 64; i++) { id += Math.floor(Math.random() 16).toString(16); } return id; } // ஒளிரும்Legendary ஐ தேடுங்கள் console.log("ஒளிரும்Legendary Buddy ஐ தேடுங்கள்...\n"); const targetSpecies = process.argv[2] || null; while (true) { const userId = randomUserId(); const result = testUserId(userId); if (result.rarity === "legendary" && result.shiny) { if (!targetSpecies || result.species === targetSpecies) { console.log("கண்டுபிடிக்கப்பட்டது!"); console.log("வகை:", result.species); console.log("அதிக rarity: Legendary"); console.log("ஒளிரும்: ஆம்!"); console.log("userID:", userId); break; } } }- கட்டமைப்பை மாற்றவும்: # ~/.claude.json ஐ தொகுக்கவும் cat ~/.claude.json | jq '.userID = "உங்கள் புதிய userID" | del(.companion)' > /tmp/claude-new.json && mv /tmp/claude-new.json ~/.claude.json
- Claude Code ஐ மறுதொடக்கம் செய்யவும்,
/buddyஎன உள்ளீடு செய்தால் புதிய செல்லப்பிராணியை காணலாம்!
ஐந்து, மோசடி தடுப்பு வடிவமைப்பு கொள்கை
Claude Code இன் வடிவமைப்பு மிகவும் புத்திசாலித்தனமாக உள்ளது, எலும்புகள் (Bones) மற்றும் ஆன்மா (Soul) பிரிக்கப்பட்ட கட்டமைப்பைப் பயன்படுத்துகிறது:
- Bones(எலும்புகள்):வகை, அரிதானது, தோற்றம், பண்புகள்——userID இல் இருந்து மீண்டும் கணக்கிடப்படுகிறது, எப்போதும் நிலைத்திருக்காது
- Soul(ஆன்மா):பெயர், குணவியல் விவரணம்——உள்ளூர் config இல் நிலைத்திருக்கிறது
roll(userID) இன் முடிவை மேற்படி overwrite செய்யும். கருத்துரை மிகவும் நேரடியாக எழுதப்பட்டுள்ளது:editing config.companion can't fake a rarity。
ஆனால் userID தானாகவே மாற்றப்படலாம், இது இந்த கட்டுரையின் முறையின் அடிப்படையாக உள்ளது.
ஆறு, சுருக்கம்
Claude Code Buddy என்பது ஒரு கவனமாக வடிவமைக்கப்பட்ட கலைச்சொல் செயல்பாடு, இது இணைக்கிறது:
- தெளிவான சீரான:FNV-1a + Mulberry32 இன் klassik கூட்டணி
- கார்டு çekme முறை:5 நிலை அரிதானது + 1% மின்ன闪光,Gacha விளையாட்டின் ஆதாரம்
- மோசடி தடுப்பு வடிவமைப்பு:எலும்புகள்/ஆன்மா பிரிப்பு, நீதிமன்றத்தை உறுதி செய்கிறது
- முட்டாள் நாளுக்கான கலைச்சொல்:salt மதிப்பு 4月1日 的时间戳隐藏
குறிப்பு资料:
- Claude Code 2.1.89 源码泄露(npm source map 事故)
- 掘金:《深扒 Claude Code Buddy 模式:一只仙人掌背后的确定性随机算法》- DEV.to: நான் கிளோட் குறியீட்டு மூலக் குறியீட்டை உடைத்தேன்

