Use when user wants to view buddy experience/level status, award XP, or check their /buddy companion's growth. Also handles first-time setup. Triggers on "/buddy-exp", "/buddy-exp setup", "宠物经验", "宠物等级", "buddy 升级", "buddy level", "buddy xp", "pet exp", "pet level", "buddy exp setup", "install buddy exp".
Experience point system for the Claude Code /buddy companion pet. XP is tracked in ~/.claude/buddy-exp.json and updated automatically after each turn via a Stop hook.
Display language follows the user's Claude Code setting (language in ~/.claude/settings.json). Use Chinese if language matches chinese or zh, otherwise use English (default).
/buddy-exp setup)First-time installation helper. Registers the Stop hook so XP tracking starts automatically.
Steps:
~/.claude/settings.json (create {} if it doesn't exist)buddy-exp/award-exp.js already exists under hooks.Stophooks.Stop (merge — do not replace other hooks):
{
"hooks": [{
"type": "command",
"command": "node \"$HOME/.claude/skills/buddy-exp/award-exp.js\"",
"timeout": 15,
"statusMessage": "Buddy leveling up..."
}]
}
settings.json/hooks in Claude Code or restart to activate, then use /buddy-exp to check statusDo NOT install.sh or any external script — use the Read/Edit tools directly on ~/.claude/settings.json.
Read ~/.claude/buddy-exp.json and display in this format (English shown; use Chinese equivalents when applicable):
🐾 {name} Lv.{level} {species} [{rarity}]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXP: {exp} / {nextLevelXp} [{bar10}] 距升级还差 {toNext} XP
累计轮次: {totalTurns} 次
debugging {bar10} {val}
patience {bar10} {val}
chaos {bar10} {val}
wisdom {bar10} {val}
snark {bar10} {val}
最近记录:(log 最后3条,每条:日期 +XP edits/commands/tasks)
Progress bar: 10 chars using █ and ░, filled = floor(val / 10).
Mark the stat that changed most recently with ← 上次升级提升 (+N).
/buddy-exp award N)Add N to exp in ~/.claude/buddy-exp.json, apply level-up logic (loop: if exp >= level * 100, subtract and increment level, boost a random stat by 1–3, cap at 99), save, then display the updated panel.
/buddy-exp reset)Destructive — always confirm with the user before executing.
Reset progress while keeping buddy identity:
exp = 0, level = 1, totalTurns = 0, sessions = {}, log = []stats from baseStats (the values derived from userID on first run)The Stop hook outputs a systemMessage directly to the UI after each active turn — no action needed from Claude.