Talegorithm 8afbe0f982 fix: chinese query for knowhub 3 giorni fa
..
IMPLEMENTATION.md 8afbe0f982 fix: chinese query for knowhub 3 giorni fa
README.md 8afbe0f982 fix: chinese query for knowhub 3 giorni fa
config-examples.md 8afbe0f982 fix: chinese query for knowhub 3 giorni fa
index.test.ts 6f7b389355 feat: openclaw knowhub plugin 4 giorni fa
index.ts 6f7b389355 feat: openclaw knowhub plugin 4 giorni fa
openclaw.plugin.json 8afbe0f982 fix: chinese query for knowhub 3 giorni fa
package.json 6f7b389355 feat: openclaw knowhub plugin 4 giorni fa
tsconfig.json 6f7b389355 feat: openclaw knowhub plugin 4 giorni fa

README.md

KnowHub OpenClaw Plugin

KnowHub 知识管理插件,为 OpenClaw Agent 提供知识搜索、保存和自动提醒功能。

功能

  • kb_search: 搜索 KnowHub 知识库
  • kb_save: 保存新知识到 KnowHub
  • kb_update: 更新知识的有效性反馈
  • 自动提醒: 定期提醒 Agent 使用 KnowHub
  • 服务端提取: 可选的消息历史自动提取功能

安装

  1. 将插件目录放到 OpenClaw 可以访问的位置
  2. 在 OpenClaw 配置中启用插件

配置

~/.openclaw/config.json 中配置:

{
  "plugins": {
    "entries": {
      "knowhub": {
        "enabled": true,
        "config": {
          "apiUrl": "http://43.106.118.91:9999",
          "submittedBy": "user@example.com",
          "reminderMode": "normal",
          "enableServerExtraction": true,
          "privacyMode": "strict"
        }
      }
    }
  }
}

配置选项

选项 类型 默认值 说明
apiUrl string http://43.106.118.91:9999 KnowHub Server 地址
submittedBy string "" 提交者标识(邮箱)
reminderMode enum normal 提醒频率:off, minimal, normal, aggressive
enableServerExtraction boolean true 启用服务端消息历史提取
privacyMode enum strict 隐私模式:strict, relaxed

提醒模式

  • off: 关闭提醒
  • minimal: 每 5 次 LLM 调用提醒一次
  • normal: 每 3 次(默认)
  • aggressive: 每 2 次

隐私模式

  • strict: 自动脱敏敏感信息(路径、邮箱、API Key 等)
  • relaxed: 不脱敏,完整上传

使用示例

搜索知识

kb_search({
  query: "使用 Vitest 运行测试",
  top_k: 5,
  min_score: 3,
  types: ["tool", "best-practice"]
})

保存知识

kb_save({
  task: "使用 Vitest 运行测试",
  content: "使用 vitest --run 执行单次测试,避免 watch 模式阻塞 CI",
  types: ["tool", "best-practice"],
  score: 4,
  source_name: "vitest",
  source_urls: ["https://vitest.dev"]
})

更新反馈

kb_update({
  knowledge_id: "knowledge-xxx",
  is_helpful: true,
  feedback: "这个方法确实有效"
})

知识类型

  • user_profile: 用户偏好、习惯、背景
  • strategy: 执行经验(从反思中获得)
  • tool: 工具使用方法、优缺点、代码示例
  • usecase: 用户背景、方案、步骤、效果
  • definition: 概念定义、技术原理、应用场景
  • plan: 流程步骤、决策点、方法论

安全特性

  • Prompt Injection 检测
  • 内容转义
  • 数据脱敏(strict 模式)
  • 配置灵活(支持本地或远程服务器)

故障排查

搜索失败

检查 KnowHub Server 是否运行:

curl "http://43.106.118.91:9999/api/knowledge/search?q=test"

保存失败

检查配置中的 apiUrl 是否正确,确保 Server 可访问。

提醒太频繁

调整 reminderModeminimaloff

开发

插件使用 TypeScript 编写,依赖:

  • @sinclair/typebox: 参数验证
  • openclaw/plugin-sdk/core: OpenClaw 插件 API

许可证

MIT