梁典典的 OpenClaw 插件
这是一个可扩展的 OpenClaw 增强插件。当前先内置语音回复策略,并已经改成按功能模块拼装系统提示的结构,后面继续扩展更多能力时,不需要再把主入口重写一遍。
当前内置能力
- 注册
before_prompt_build插件钩子 - 只对指定的消息渠道生效,默认是
feishu - 通过语音回复模块,引导智能体调用指定技能触发词,例如
$feishu-tts - 通过本地脚本能力模块,告诉智能体当前环境里有哪些文本转语音脚本可以使用
- 通过补充提示规则模块,追加全局业务规则或回复风格约束
- 所有能力统一走模块化配置结构
结构
src/index.js:插件入口,只负责注册 hook 和拼装结果src/config.js:配置 Schema 和标准化逻辑src/features/script-capabilities.js:本地脚本能力提示模块src/features/voice-reply.js:语音回复功能模块src/features/prompt-rules.js:补充提示规则功能模块src/features/index.js:功能模块注册与系统提示拼装入口
建议的插件配置
{
"plugins": {
"entries": {
"liangdiandian-openclaw-plugin": {
"enabled": true,
"config": {
"enabledProviders": ["feishu"],
"globalInstruction": "默认使用简洁、专业的中文回复。",
"features": {
"voiceReply": {
"enabled": true,
"skillTrigger": "$feishu-tts",
"fallbackToText": true
},
"scriptCapabilities": {
"enabled": true,
"ttsScriptPath": "C:\\Users\\Administrator\\.openclaw\\workspace\\scripts\\send_voice.py",
"ttsCommandTemplate": "python {scriptPath} \"{text}\" --receive-id {receiveId}",
"ttsExampleCommand": "python C:\\Users\\Administrator\\.openclaw\\workspace\\scripts\\send_voice.py \"老板,我现在是 DeepSeek V4 Flash 模型,比较轻量,响应快。有什么需要处理的,直接说就行。\" --receive-id ou_422c2039d8e327534280dce1160c286d",
"notes": [
"如果需要发送语音,优先考虑调用这个脚本。",
"执行前要把示例里的文本替换为当前这轮真正的回复内容。"
]
},
"promptRules": {
"enabled": true,
"instructions": [
"如果信息不确定,先明确说明限制,不要编造。",
"涉及操作步骤时,优先给出最短可执行方案。"
]
}
}
}
}
}
}
}
配置约束
- 当前版本不保留旧配置兼容层
- 所有能力都应通过
features.*结构配置 - 插件
id为liangdiandian-openclaw-plugin
后续扩展方式
- 新增一个功能模块文件到
src/features/ - 在
src/features/index.js里注册这个模块 - 在
src/config.js和openclaw.plugin.json里补充对应配置项
说明
- 这个插件本身不会直接合成或上传音频,它负责通过提示词引导智能体调用已有能力
- 所选技能必须已经安装,并且当前智能体运行时可以正常调用
- 如果后面你要接入审批、消息改写、工具路由、渠道策略这类能力,可以继续沿用现在这套模块化结构