peon-ping-use
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesepeon-ping-use
peon-ping-use
Set which voice pack (character voice) plays for the current chat session.
设置当前聊天会话使用的语音包(角色语音)。
How it works
工作原理
When the user types , a beforeSubmitPrompt hook intercepts the command before it reaches the model and handles it instantly:
/peon-ping-use <packname>- Validates the requested pack exists
- Enables rotation mode in config.json
agentskill - Maps the current session ID to the requested pack in .state.json
- Returns immediate confirmation (zero tokens used)
When the hook blocks the message, Cursor keeps your cursor in the input field so you can type your next message right away.
The hook scripts ( and ) do all the work - this SKILL.md file exists solely for discoverability in the command autocomplete menu.
scripts/hook-handle-use.shscripts/hook-handle-use.ps1/当用户输入时,一个beforeSubmitPrompt钩子会在命令发送给模型之前拦截它并立即处理:
/peon-ping-use <packname>- 验证请求的语音包是否存在
- 在config.json中启用轮换模式
agentskill - 在.state.json中将当前会话ID映射到请求的语音包
- 返回即时确认(不消耗任何令牌)
当钩子拦截消息时,Cursor会保持光标在输入框中,让你可以立即输入下一条消息。
所有工作由钩子脚本(和)完成,这份SKILL.md文件仅用于在命令自动补全菜单中被发现。
scripts/hook-handle-use.shscripts/hook-handle-use.ps1/Usage
使用方法
Users can invoke this by typing:
/peon-ping-use peasant
/peon-ping-use glados
/peon-ping-use sc_kerriganIf the hook is not installed or fails, you can fallback to manual execution by following the instructions below.
用户可以通过输入以下命令调用:
/peon-ping-use peasant
/peon-ping-use glados
/peon-ping-use sc_kerrigan如果钩子未安装或运行失败,你可以按照以下说明手动执行。
Manual fallback (if hook fails)
手动回退方案(当钩子失效时)
If for some reason the hook doesn't intercept the command, follow these steps:
如果钩子无法拦截命令,请按照以下步骤操作:
1. Parse the pack name
1. 解析语音包名称
Extract the pack name from the user's request. Common pack names:
- — Warcraft Peon
peon - — Portal's GLaDOS
glados - — StarCraft Kerrigan
sc_kerrigan - — Warcraft Peasant
peasant - — Star Wars HK-47
hk47
从用户的请求中提取语音包名称。常见的语音包名称:
- — 魔兽争霸苦工
peon - — 《传送门》GLaDOS
glados - — 《星际争霸》凯瑞甘
sc_kerrigan - — 魔兽争霸农民
peasant - — 《星球大战》HK-47
hk47
2. List available packs
2. 列出可用语音包
Run this command to see installed packs:
bash
bash "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/peon-ping/peon.sh packs listParse the output to verify the requested pack exists.
运行以下命令查看已安装的语音包:
bash
bash "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/peon-ping/peon.sh packs list解析输出结果,验证请求的语音包是否存在。
3. Get session ID
3. 获取会话ID
The session ID is available in the environment variable . Read it:
CLAUDE_SESSION_IDbash
echo "$CLAUDE_SESSION_ID"If empty (Cursor users): Use as the key in . This applies the pack to all sessions without explicit assignment. Add .
"default"session_packssession_packs["default"] = {"pack": "PACK_NAME", "last_used": UNIX_TIMESTAMP}会话ID可通过环境变量获取。执行以下命令查看:
CLAUDE_SESSION_IDbash
echo "$CLAUDE_SESSION_ID"如果为空(Cursor用户): 在中使用作为键。这会将语音包应用到所有未明确分配的会话。添加。
session_packs"default"session_packs["default"] = {"pack": "PACK_NAME", "last_used": UNIX_TIMESTAMP}4. Update config to enable agentskill mode
4. 更新配置以启用agentskill模式
Read the config file:
bash
cat "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/peon-ping/config.jsonRequired: Set to . The pack must exist in the packs directory; if the assigned pack is missing or invalid, peon-ping falls back to and removes the stale assignment. The hook also adds the pack to (manual fallback can do the same).
pack_rotation_mode"agentskill"active_packpack_rotationExample config after setup:
json
"pack_rotation_mode": "agentskill",
"pack_rotation": ["peasant", "peon", "ra2_kirov"]If is or , change it to . If the requested pack is not in , add it.
pack_rotation_mode"random""round-robin""agentskill"pack_rotation读取配置文件:
bash
cat "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/peon-ping/config.json必填操作: 将设置为。语音包必须存在于语音包目录中;如果分配的语音包缺失或无效,peon-ping会回退到并删除无效的分配记录。钩子还会将语音包添加到中(手动回退也可以执行此操作)。
pack_rotation_mode"agentskill"active_packpack_rotation设置后的配置示例:
json
"pack_rotation_mode": "agentskill",
"pack_rotation": ["peasant", "peon", "ra2_kirov"]如果为或,请将其改为。如果请求的语音包不在中,请添加进去。
pack_rotation_mode"random""round-robin""agentskill"pack_rotation5. Update state to assign pack to this session
5. 更新状态以将语音包分配给当前会话
Read the state file:
bash
cat "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/peon-ping/.state.jsonUpdate the object to map this session to the requested pack. If doesn't exist, create it:
session_packssession_packsjson
{
"session_packs": {
"SESSION_ID_HERE": "pack_name_here"
}
}Use StrReplace or edit the JSON to add/update the entry:
- If exists: add or update the session ID key
session_packs - If doesn't exist: add it after the opening brace
session_packs
读取状态文件:
bash
cat "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/peon-ping/.state.json更新对象,将当前会话映射到请求的语音包。如果不存在,请创建它:
session_packssession_packsjson
{
"session_packs": {
"SESSION_ID_HERE": "pack_name_here"
}
}使用字符串替换或编辑JSON来添加/更新条目:
- 如果已存在:添加或更新会话ID对应的键
session_packs - 如果不存在:在左大括号后添加该对象
session_packs
6. Confirm to user
6. 向用户确认
Report success with a message like:
Voice set to [PACK_NAME] for this session
Rotation mode: agentskill发送如下消息告知操作成功:
本次会话已设置为使用[PACK_NAME]语音
轮换模式: agentskillError handling
错误处理
- Pack not found: List available packs and ask user to choose one
- No session ID: Inform user this feature requires Claude Code
- File read/write errors: Report the error and suggest manual config editing
- 语音包未找到: 列出可用语音包并请用户选择
- 无会话ID: 告知用户此功能需要Claude Code
- 文件读写错误: 报告错误并建议手动编辑配置
Example interaction
交互示例
User: Use GLaDOS voice for this chat
Assistant: [Lists packs to verify glados exists]
Assistant: [Gets session ID]
Assistant: [Updates config.json to set pack_rotation_mode: "agentskill"]
Assistant: [Updates .state.json to set session_packs[session_id] = "glados"]
Assistant: Voice set to GLaDOS for this session
Rotation mode: agentskill用户: 本次聊天使用GLaDOS语音
助手: [列出语音包以验证glados存在]
助手: [获取会话ID]
助手: [更新config.json,设置pack_rotation_mode: "agentskill"]
助手: [更新.state.json,设置session_packs[session_id] = "glados"]
助手: 本次会话已设置为使用GLaDOS语音
轮换模式: agentskillCursor compatibility note
Cursor兼容性说明
Cursor doesn't expose session IDs. Use instead: when doing the manual fallback, add to . This applies the voice to sessions without explicit assignment (including Cursor chats).
session_packs["default"]"default": {"pack": "peasant", "last_used": 0}session_packsCursor不会暴露会话ID。请改用:在手动回退时,向中添加。这会将语音包应用到所有未明确分配的会话(包括Cursor聊天)。
session_packs["default"]session_packs"default": {"pack": "peasant", "last_used": 0}Reset to default
重置为默认设置
To stop using a specific pack for this session, remove the session ID from in , or change back to or .
session_packs.state.jsonpack_rotation_mode"random""round-robin"要停止为当前会话使用特定语音包,请在.state.json的中删除对应的会话ID,或者将改回或。
session_packspack_rotation_mode"random""round-robin"