buddy-reset

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Buddy Reset

伙伴重置

Reset your Claude Code coding buddy so you can hatch a new one.
重置你的Claude Code编程伙伴,这样你就可以孵化一个新的伙伴了。

What This Skill Does

该技能的功能

  1. Reads the current season seed (
    fk_
    ) from
    cli.js
  2. Generates a random new seed automatically
  3. Replaces the seed in
    cli.js
  4. Removes the
    companion
    field from
    ~/.claude.json
  5. Reminds you to restart and run
    /buddy
  1. 读取
    cli.js
    中的当前季节种子(
    fk_
  2. 自动生成随机新种子
  3. 替换
    cli.js
    中的种子
  4. 删除
    ~/.claude.json
    中的
    companion
    字段
  5. 提醒你重启并运行
    /buddy

Instructions

使用说明

When this skill is invoked, follow these steps exactly:
调用该技能时,请严格遵循以下步骤:

Step 1: Locate cli.js and read current seed

步骤1:定位cli.js并读取当前种子

Find the Claude Code
cli.js
file. It is typically at:
~/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js
Use Bash to extract the current
fk_
value:
bash
grep -o 'fk_="[^"]*"' "$HOME/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js"
Show the user the current seed value.
找到Claude Code的
cli.js
文件,它通常位于:
~/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js
使用Bash提取当前的
fk_
值:
bash
grep -o 'fk_="[^"]*"' "$HOME/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js"
向用户展示当前的种子值。

Step 2: Generate a random seed and replace in cli.js

步骤2:生成随机种子并替换到cli.js中

Generate a random seed string using the format
buddy-YYYYMMDD-XXXXXX
where
YYYYMMDD
is the current date and
XXXXXX
is a random 6-character alphanumeric string. Use Bash:
bash
NEW_SEED="buddy-$(date +%Y%m%d)-$(cat /dev/urandom | tr -dc 'a-z0-9' | head -c 6)"
echo "$NEW_SEED"
Then use
sed
to replace the old seed with the new one in
cli.js
:
bash
sed -i "s/fk_=\"OLD_VALUE\"/fk_=\"NEW_VALUE\"/" "$HOME/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js"
Verify the replacement succeeded by grepping again.
按照
buddy-YYYYMMDD-XXXXXX
格式生成随机种子字符串,其中
YYYYMMDD
为当前日期,
XXXXXX
为6位随机字母数字字符串。使用Bash执行:
bash
NEW_SEED="buddy-$(date +%Y%m%d)-$(cat /dev/urandom | tr -dc 'a-z0-9' | head -c 6)"
echo "$NEW_SEED"
然后使用
sed
将cli.js中的旧种子替换为新种子:
bash
sed -i "s/fk_=\"OLD_VALUE\"/fk_=\"NEW_VALUE\"/" "$HOME/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js"
再次执行grep验证替换是否成功。

Step 3: Remove companion from ~/.claude.json

步骤3:从~/.claude.json中删除companion字段

Use python to remove the
companion
field:
bash
python -c "
import json
path = '$HOME/.claude.json'.replace('$HOME', __import__('os').path.expanduser('~'))
with open(path, 'r', encoding='utf-8') as f:
    data = json.load(f)
removed = data.pop('companion', None)
if removed:
    print('Removed companion:', json.dumps(removed, ensure_ascii=False)[:200])
else:
    print('No companion field found - already clean')
with open(path, 'w', encoding='utf-8') as f:
    json.dump(data, f, indent=2, ensure_ascii=False)
    f.write('\n')
"
Also remove
companionMuted
if present:
bash
python -c "
import json, os
path = os.path.expanduser('~/.claude.json')
with open(path, 'r', encoding='utf-8') as f:
    data = json.load(f)
data.pop('companionMuted', None)
with open(path, 'w', encoding='utf-8') as f:
    json.dump(data, f, indent=2, ensure_ascii=False)
    f.write('\n')
"
使用python删除
companion
字段:
bash
python -c "
import json
path = '$HOME/.claude.json'.replace('$HOME', __import__('os').path.expanduser('~'))
with open(path, 'r', encoding='utf-8') as f:
    data = json.load(f)
removed = data.pop('companion', None)
if removed:
    print('Removed companion:', json.dumps(removed, ensure_ascii=False)[:200])
else:
    print('No companion field found - already clean')
with open(path, 'w', encoding='utf-8') as f:
    json.dump(data, f, indent=2, ensure_ascii=False)
    f.write('\n')
"
如果存在
companionMuted
字段也一并删除:
bash
python -c "
import json, os
path = os.path.expanduser('~/.claude.json')
with open(path, 'r', encoding='utf-8') as f:
    data = json.load(f)
data.pop('companionMuted', None)
with open(path, 'w', encoding='utf-8') as f:
    json.dump(data, f, indent=2, ensure_ascii=False)
    f.write('\n')
"

Step 4: Notify the user

步骤4:通知用户

Tell the user:
  • The season seed has been changed from
    OLD
    to
    NEW
  • The companion data has been removed
  • They need to restart Claude Code (exit and reopen)
  • Then run
    /buddy
    to hatch their new companion
  • Remind them that
    npm update
    will reset the seed back to the original value
告知用户以下内容:
  • 季节种子已从
    OLD
    修改为
    NEW
  • 伙伴数据已删除
  • 需要重启Claude Code(退出后重新打开)
  • 然后运行
    /buddy
    来孵化新的伴生角色
  • 提醒用户
    npm update
    会将种子重置为原始值