Skip to main content
Glama

rag-kb — 本地 Agent 记忆服务 + 多 Agent 协作系统

License: Apache-2.0 Glama MCP score English | 中文

本地优先、完全离线可用的 Agent 记忆与知识服务——REST + MCP 双协议,混合检索(向量 + BM25 归一化加权融合),文档/网页入库与 RAG 问答;无 LLM 时存取与检索完整可用。

本仓库含两个子系统(ROADMAP):

子系统

一句话定位

状态

kb

本地优先、完全免费的 Agent 记忆与知识服务(核心产品,开发主线,当前测试开发阶段)

测试开发中

agent-orchestra

基于 kb 共享任务板的跨任务多 Agent 协作系统(❄️ 维护模式,自用脚手架)

B1-B3 收口冻结

开源协议:Apache-2.0(含专利授权,可商用)。

kb — 本地优先的 Agent 记忆与知识服务

Windows 单进程常驻(python -m kb serve),REST + MCP 双协议,向 Claude Code / Cursor / TraeWork / 自建 Agent 提供记忆写入、文档与网页入库、混合检索 (向量 + BM25 归一化加权融合)与 RAG 问答。

无 LLM 时存取与检索完整可用——记忆写入、文档入库、混合检索不依赖任何大模型; 配置本地 Ollama 或云端 API 后,/ask 问答能力自动启用。

Related MCP server: mnemostack

核心特性

  • 单进程常驻:一个 python -m kb serve 同时提供 REST API 与 MCP 端点,无需额外组件

  • 混合检索:BGE-M3 向量检索 + BM25 关键词检索,归一化加权融合排序(每路 min-max 归一化后按生效路数均权,N32/N33),中文分词友好

    • 可选精排:KB_RERANK_ENABLED=true 启用 bge-reranker-v2-m3 交叉重排(默认关)

    • 可选三路:KB_SPARSE_ENABLED=true 启用 BGE-M3 稀疏向量第三路(默认关,失败自动降级双路)

  • 记忆管理:写入 / 更新 / 删除 / 列表,支持 namespace、tags、type 过滤

  • 记忆全共享(v3):所有记忆/知识与任何客户端、任务、AI 全共享——本地单用户定位,跨 agent、跨任务读到同一份用户记忆;client/project 仅用于审计归类与元数据(不再隔离读写);主键服务端生成

  • 存取审计:每次写/读/改/删/检索/问答记 JSON 到 logs/agent-audit/<客户端>__<项目>.log(按 client+project 分文件);用户可查:REST GET /api/v1/audit?client=<客户端>[&project=<项目>] 或 CLI kb audit --client <客户端>

  • 知识入库:本地文档(txt/md/pdf/docx 等)上传或路径导入,网页正文抓取入库

  • 目录监听:指定目录内新增/删除文件自动入库/清理(KB_WATCH_DIR

  • CLI 工具kb add/search/stats/ask/eval/forget/dedup——终端直接完成写入、检索、统计与 RAG 问答

  • 隐私护栏:敏感 namespace 强制本地回答不出网;/ask 智能路由(本地优先,难题可选云端)

  • 断网可用:模型与数据全部落本地,无网络时存取与检索功能完整

快速开始(Windows / Linux / macOS)

Windows PowerShell:

# 1. 创建并激活虚拟环境
python -m venv venv
.\venv\Scripts\Activate.ps1

# 2. 安装依赖
pip install -r requirements.txt

# 3. 启动服务(默认监听 http://127.0.0.1:8000)
python -m kb serve

Linux / macOS:

# 1. 创建并激活虚拟环境
python3 -m venv venv
source venv/bin/activate

# 2. 安装依赖
pip install -r requirements.txt

# 3. 启动服务
python -m kb serve

重要:kb 命令只装在虚拟环境内。每个新终端都要先激活虚拟环境 (Windows .\venv\Scripts\Activate.ps1,Linux/macOS source venv/bin/activate), 否则会提示 kb:未找到命令。改用 python -m kb <子命令> 可绕过激活。

快速安装备选(免虚拟环境,Python 3.10+):pip install --user -r requirements.txt 后 用 python -m kb serve 运行,但建议优先使用 venv 隔离依赖。

启动后健康检查:

curl http://127.0.0.1:8000/api/v1/healthz

首次启动会加载本地嵌入模型(默认 BAAI/bge-m3,约 2GB,需提前下载缓存); 未配置 LLM 时服务照常启动,/ask 返回 503 与配置指引。

LLM 默认关闭(KB_LLM_MODE=off:服务启动不会探测/加载/调用任何大模型, 零显存、零成本、纯离线;记忆写入、文档入库、混合检索完整可用。 需要 RAG 问答(/ask)时再按下面方式配置本地或云端 LLM。

配置 LLM(可选,/ask 问答需要)

KB_LLM_MODE 默认 off(不加载不调用);四个档位:

档位

行为

off(默认)

完全不加载/不调用 LLM;记忆存取与检索完整可用

local

仅本地 Ollama(完全离线,隐私零出网)

auto

本地优先,云端降级:本地 Ollama 可用走本地,无本地但有云端 Key 走云端

cloud

全部走云端(本地仅做压缩与隐私隔离)

本地 LLM(Ollama):

# 1. 安装并启动 Ollama(Windows 从开始菜单/托盘启动,不要从 AI 沙箱终端拉起)
# 2. 拉取一个适合你电脑的模型(按显存/内存选择,如 qwen3:4b 约 3.2GB、
#    qwen3:1.7b 约 1.8GB;国内可用魔搭加速,拉完 ollama cp 改成短名)
ollama pull <你的模型名>
# 3. 在 .env 配置后重启服务:
#    KB_LLM_MODE=local            # 仅本地
#    KB_LLM_MODEL=<你的模型名>    # 以 `ollama list` 输出的名称为准
#    KB_OLLAMA_BASE_URL=http://localhost:11434

云端 LLM(任意 OpenAI 兼容服务商,不绑定 DeepSeek): DeepSeek / OpenAI / 通义千问 / 硅基流动 / Moonshot 等均可,通用三键:

# .env
KB_LLM_MODE=auto                 # 本地优先、云端降级;或 cloud 全云端
KB_LLM_API_KEY=sk-xxx            # 服务商 API Key
KB_LLM_BASE_URL=https://api.deepseek.com   # 换成你所用服务商的 OpenAI 兼容端点
KB_LLM_CLOUD_MODEL=deepseek-v4-flash       # 云端模型名

验证:GET /api/v1/healthzllm 字段——local/cloud 表示 LLM 已就绪,disabled 表示未启用。

常见问题:嵌入模型下载失败

  • 中国大陆直连 huggingface.co 会超时。设置 HF 镜像后重启即可:

    export HF_ENDPOINT=https://hf-mirror.com   # 或写入 ~/.bashrc 永久生效
    python -m kb serve

    模型会自动从镜像下载并缓存到 ~/.cache/huggingface/hub/,之后断网也能离线加载。

  • 模型已在本机缓存,但无外网kb 采用离线优先(先命中本地缓存,失败才联网), 只要缓存目录完整即可完全离线运行。

让 Agent 接入 kb(客户端无关)

把 kb 的接入规约交给 AI 客户端(TraeWork / Claude Code / Cursor / 自建 Agent), 让它们知道怎么读写记忆、按什么身份规约、怎么查审计。两种方式,任选其一

  1. skill(推荐,能自动触发)——可选的独立步骤:仓库内 skills/kb-memory/SKILL.md 是客户端无关的 Anthropic 开格式 skill。把它安装到你所用客户端的用户级 skills 目录后, 该客户端的任何项目会话都会在读写记忆/RAG 问答/审计查询时自动识别并触发。 安装 = 把 skills/kb-memory 目录复制过去即可(有脚本,也可手动复制,无需任何依赖); 更新(重新覆盖)、卸载、以及装好后的使用说明见 scripts/README.md

    不装也不影响 kb 服务:skill 只是给 AI 客户端的「提示词包装」,与服务的安装、 启动无关——跳过这一步,服务照常运行,你随时可用方法 2 的纯文本提示词接入; skill 安装是一次性、按需、独立执行的,不会随 kb serve 自动触发, 也不会写入你的任何客户端目录以外的文件。

  2. 纯文本提示词(兜底,任何客户端通用):整段复制 docs/AGENT_PROMPT.md 粘贴给 Agent 即可,不依赖 skill 机制。

.trae-cn/skills / .claude/skills / .cursor/skills 是任何客户端都认的「标准」吗?——不是。 这些只是各家客户端各自的用户级约定目录SKILL.md 本身是统一的 Anthropic 开格式, 但「装到哪个目录、能否自动触发」由各客户端自行决定,支持程度不一:

客户端

用户级 skills 目录

自动加载

TraeWork

~/.trae-cn/skills/

自动发现

Claude Code

~/.claude/skills/

高版本支持

Cursor

~/.cursor/skills/

逐步跟进

其他 / 自建 Agent

无统一约定

需手动加载或不支持

不存在「所有客户端都遵循」的统一目录;你的客户端若不支持 skill,永远有方法 2 兜底 (粘贴 AGENT_PROMPT.md,纯文本任何客户端可用)。安装方法、各客户端目录差异与加载机制、 相互引用关系:详细见 scripts/README.md(此处不重复)。

MCP 挂载

MCP 端点(streamable HTTP):http://127.0.0.1:8000/mcp/

Claude Code:本仓库已内置项目级 .mcp.json,在本目录启动 Claude Code 即自动挂载; 也可全局添加:

claude mcp add --transport http kb http://127.0.0.1:8000/mcp/

Cursor / TraeWork 及其他支持 MCP 的客户端:在 MCP 配置中加入以下 JSON (Cursor 放 ~/.cursor/mcp.json 或项目 .cursor/mcp.json;TraeWork 在设置中添加 MCP 服务器):

{
  "mcpServers": {
    "kb": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp/"
    }
  }
}

挂载后可用的 MCP 工具:write_memory / search_memory / read_memory / update_memory / delete_memory / add_document / add_webpage / ask_kb

启用 KB_API_KEY 鉴权后,MCP 客户端需在连接配置加 headersAuthorization: Bearer <key>); 仓库内 .mcp.json 模板不含真实 key(JSON 不支持注释),配法见 USER_GUIDE §5.2

REST 端点速查

方法

路径

说明

POST

/api/v1/memories

写入记忆 {content, tags?, source?, namespace?}

GET

/api/v1/memories

记忆列表,支持 type/tag/source/q/limit/offset 过滤

GET

/api/v1/memories/{id}

读取单条记忆

PATCH

/api/v1/memories/{id}

更新内容或标签

DELETE

/api/v1/memories/{id}

删除单条记忆

POST

/api/v1/search

混合检索 {query, top_k?, mode?, type?, tag?},mode: hybrid/vector/keyword

POST

/api/v1/documents

文档入库:multipart file 字段或 JSON {"path": "本地路径"}

GET

/api/v1/documents

已入库文档列表(按 source 聚合)

DELETE

/api/v1/documents/{source}

按 source 删除该文档全部记录

POST

/api/v1/ingest/web

网页入库 {url},抓取正文切分入库

POST

/api/v1/ask

RAG 问答 {question};未配置 LLM 返回 503

GET

/api/v1/healthz

健康检查与服务统计

GET

/api/v1/governance/stats

记忆治理统计:total_count/avg_access_count/stale_90d_count(只读)

GET

/api/v1/governance/config

治理配置:衰减+新鲜度开关与参数(只读)

POST

/api/v1/memories409

启用语义去重(KB_DEDUP_ENABLED=true)后写入命中重复返回 409:{"error":"DUPLICATE","duplicate_of":"<已有记录id>","similarity":<相似度>}(不写入)

记忆治理(去重/衰减/新鲜度)均默认关闭、零行为变化;用法见 USER_GUIDE §3.5

示例:

# 写入一条记忆
curl -X POST http://127.0.0.1:8000/api/v1/memories `
  -H "Content-Type: application/json" `
  -d '{"content": "用户偏好深色主题", "tags": ["偏好"]}'

# 混合检索
curl -X POST http://127.0.0.1:8000/api/v1/search `
  -H "Content-Type: application/json" `
  -d '{"query": "用户界面偏好", "top_k": 5}'

# RAG 问答(需配置 LLM)
curl -X POST http://127.0.0.1:8000/api/v1/ask `
  -H "Content-Type: application/json" `
  -d '{"question": "用户喜欢什么主题?"}'

配置项简表

全部配置以 KB_ 前缀的环境变量或 .env 文件提供;完整键名见 .env.example (复制为 .env 后填写,.env 已被 gitignore,真实密钥只放本机,严禁入库)。

配置项

默认值

说明

KB_LLM_MODE

off

LLM 模式:off(默认,不加载/不调用 LLM,零显存零成本)/ local(仅本地 Ollama)/ auto(本地优先,云端降级)/ cloud

KB_DEVICE

嵌入模型设备:空=自动检测,可显式设 cpu / cuda

KB_WATCH_DIR

data

serve 模式监听目录,文件变动自动入库;空串或 . = 不启动

KB_DATA_DIR

kb_data

运行数据根目录(ChromaDB、运行时状态等)

KB_API_HOST / KB_API_PORT

127.0.0.1 / 8000

REST 与 MCP 监听地址

KB_EMBED_MODEL

BAAI/bge-m3

嵌入模型

KB_LLM_MODEL

本地 Ollama 模型名(默认空=不配;配 KB_LLM_MODE=local/auto 时须按自己电脑选模型,以 ollama list 为准)

KB_OLLAMA_BASE_URL

http://localhost:11434

Ollama 端点

KB_LLM_API_KEY / KB_LLM_BASE_URL / KB_LLM_CLOUD_MODEL

云端 LLM(可选):任意 OpenAI 兼容服务商(DeepSeek / OpenAI / 通义 / 硅基流动等),仅填在本机 .env

KB_CHUNK_SIZE / KB_CHUNK_OVERLAP

500 / 100

文档切分参数

KB_SENSITIVE_NAMESPACES

逗号分隔的敏感 namespace,命中强制本地回答不出网

KB_API_KEY

空=不鉴权(本地回环零摩擦);非空=启用 Bearer/X-API-Key 鉴权;orchestra 客户端自动带 X-API-Key

KB_RERANK_ENABLED / KB_RERANK_MODEL / KB_RERANK_TOP_N

false / BAAI/bge-reranker-v2-m3 / 20

检索精排(A3.5):融合候选送 CrossEncoder 重排,默认关

KB_SPARSE_ENABLED

false

稀疏第三路(A3.5):BGE-M3 稀疏向量 + 倒排索引参与归一化加权融合,默认关

CLI 速查(无需启动服务)

python -m kb add "记忆内容" --tags 偏好 --client TraeWork                       # 写入(project 缺省自动取当前目录名)
python -m kb search "查询词" --client TraeWork                                 # 混合检索(v3:全共享,不分客户端/项目)
python -m kb stats                            # 统计:类型分布 / 访问热度 / 陈旧分布
python -m kb ask "问题" --client TraeWork      # 终端 RAG 问答(LLM 不可用时输出检索命中)
python -m kb audit --client TraeWork --days 7   # 查某客户端/项目存过/读过什么
python -m kb eval --file tests/eval_zh_50.jsonl   # 检索质量评测(Recall@1/@5 + MRR)
python -m kb forget --stale --days 90         # 清理超期未命中记忆
python -m kb dedup --threshold 0.92           # 语义去重

kb ask 直连本地服务逻辑(不经 HTTP);建议 serve 停止时使用,避免双进程写库竞争。

agent-orchestra — 多 Agent 协作系统(实验)

让多个 AI 助手(不同 TraeWork 任务 / Claude Code 会话,模型可不同)通过 kb 共享任务板 协作开发:协调者 AI 拆卡分发,worker AI 领卡执行、单卡单轮、回写结果,协调者核验流转。

# 前置:kb serve 已运行。开一个新 TraeWork 任务,粘贴以下引导语即可唤醒一个 worker:
venv\Scripts\python.exe orchestra\board.py new-worker worker-1

完整使用方法(协调者怎么拆卡、多个 worker 怎么并行、协作纪律与已知限制) 见 用户使用手册 第 4 节。

目录结构

kb/            kb 服务源码(config / models / embedder / storage / bm25 / retriever /
               service / llm / ingest / watcher / api / mcp / cli + reranker / sparse / eval)
tests/         kb 验收测试(375 项,含 eval_zh_50.jsonl 检索评测数据集)
orchestra/     多 Agent 协作系统(board.py CLI + 协议三件套 + skill + 245 项测试)
docs/          设计文档、节点计划、用户使用手册
kb_data/       kb 运行数据(gitignore)
_archive/      旧学习项目归档(仅保留历史,禁止参考)

更多文档

  • 用户使用手册(人类用户入口)docs/USER_GUIDE.md

  • AI 接力文档(AI 助手入口)PROJECT.md(项目状态 / 进度看板 / 接手指南)

  • 设计文档(需求、架构、API、里程碑):docs/superpowers/specs/2026-08-23-kb-memory-service-design.md

  • P2 日志设计:docs/superpowers/specs/2026-08-24-logging-design.md

  • P2 路线图:docs/superpowers/plans/2026-08-24-p2-roadmap.md

  • 节点开发计划:docs/superpowers/plans/2026-08-23-kb-dev-nodes.md

  • AI 协作规范:AGENTS.md

Available Tools

8 tools
add_documentA

导入本地文档(PDF/DOCX/MD/TXT 及 Office 格式)切分入库; 返回 {"source": 文件名, "chunks": 块数};文件不存在或格式不支持时 返回 {"error": "FILE_NOT_FOUND" | "UNSUPPORTED_FORMAT", "message": 原因}。 project/client:仅用于审计归类;文档 chunk 为共享知识,所有客户端可检索。 client:来源客户端(可选,缺省从 clientInfo 自动识别)。 English: Import a local document (PDF/DOCX/MD/TXT and Office formats), split and ingest it; returns {"source": filename, "chunks": count}; when the file is missing or the format is unsupported returns {"error": "FILE_NOT_FOUND" | "UNSUPPORTED_FORMAT", "message": reason}. project/client: audit bucketing only; document chunks are shared knowledge, searchable by all clients.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
clientNo
projectNo

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and largely meets it: it discloses the split-and-ingest side effect, the two error modes with exact error codes, and the shared-knowledge behavior. It does not mention permissions or idempotency, but it is still substantially transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the verb, formats, and return contract, and the bilingual duplication is structured rather than rambling. It is longer than necessary because of the translation, but every section carries useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there is no output schema, the description supplies the return shape and error contract. Given there are no annotations, it also discloses the shared-knowledge side effect. A small gap remains around path qualification and prerequisites, but the agent has enough context to call the tool and interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does add useful meaning for project/client: audit bucketing only and optional client auto-detection from clientInfo. However, the required path parameter is never explicitly described, and its format is only implied by 'local document' and FILE_NOT_FOUND.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific action: import and ingest a local document. It names supported formats, states the exact return shape, and contrasts naturally with the sibling add_webpage by requiring a local path.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description tells the agent this is for local files, that project/client are audit-only, and that ingested chunks become shared knowledge searchable by all clients. It does not explicitly name alternatives or state when not to use it, but the local-file requirement and the presence of add_webpage imply the boundary.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

add_webpageA

抓取网页正文并切分入库;返回 {"source": url, "chunks": 块数}; 抓取/正文提取失败时返回 {"error": "WEB_FETCH_FAILED", "message": 原因}。 project/client:仅用于审计归类;web chunk 为共享知识,所有客户端可检索。 client:来源客户端(可选,缺省从 clientInfo 自动识别)。 English: Fetch a webpage body and ingest it after splitting; returns {"source": url, "chunks": count}; on fetch/body-extraction failure returns {"error": "WEB_FETCH_FAILED", "message": reason}. project/client: audit bucketing only; web chunks are shared knowledge, searchable by all clients.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes
clientNo
projectNo

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral disclosure burden. It clearly specifies success return shape, failure error code, project/client's audit-only role, and that web chunks are shared knowledge searchable by all clients, while also noting client auto-detection.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The main action and return behavior are front-loaded and the structure is logical, but the content is duplicated across Chinese and English sections, making it longer than strictly necessary. Each sentence does not fully earn its place because of the near-verbatim repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description provides crucial invocation details: success/error returns, parameter roles, and sharing semantics. Minor gaps remain around url parameter documentation and any size/format constraints, but the core usage context is sufficiently complete for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description must compensate. It explains that client is optional and defaults from clientInfo, and that project/client are audit-only, but it does not describe the url format or project individually beyond the grouped statement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('抓取网页正文并切分入库' / 'Fetch a webpage body and ingest it after splitting') with a clear resource: a webpage. This distinguishes it from siblings like add_document and write_memory, which handle documents and memory respectively.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for ingesting web pages into shared knowledge, and clarifies that project/client are only for audit bucketing. However, it does not explicitly compare against alternatives like add_document, nor state when one should choose this tool over them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ask_kbA

基于知识库的 RAG 问答(检索 → 上下文拼装 → 护栏生成),返回 answer 与 sources; v2:检索按当前 (client, project) 隔离 memory(doc/web 共享),并写 ask 存取审计; client:来源客户端(可选,缺省从 clientInfo 自动识别); LLM 不可用时返回 {"error": "LLM_DISABLED", "message": 配置指引}。 English: Knowledge-base RAG Q&A (retrieve → build context → guarded generation), returning answer and sources; v2: retrieval isolates memory by the current (client, project) (doc/web shared); an ask access-audit is emitted; client: source client (optional; auto-detected from clientInfo when omitted); returns {"error": "LLM_DISABLED", "message": setup guidance} when the LLM is unavailable.

ParametersJSON Schema
NameRequiredDescriptionDefault
clientNo
projectNo
questionYes

TDQS

A3.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden, and it is notably forthcoming: it discloses the retrieve-to-generation pipeline, retrieval scoping by (client, project) with doc/web memory shared, an emitted ask access-audit, client auto-detection from clientInfo, and the exact shape of the LLM-unavailable error response. These are concrete behavioral traits beyond a basic read, especially the audit side effect and error contract.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core purpose is front-loaded and the content is logically segmented into pipeline, v2 behavior, client semantics, and error handling. However, the entire description is duplicated in Chinese and English, which roughly doubles the length without adding information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and sparse input schema, the description covers the important operational details: return shape (answer and sources), memory scoping, the audit side effect, and LLM-unavailable error handling. It does not specify the exact structure of sources or how the current (client, project) is fully resolved, but these are minor relative to what is disclosed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must add parameter meaning, and it does so only partially. It clearly explains client (optional, auto-detected from clientInfo) and indirectly ties project to memory isolation, but it does not define project's role directly nor describe the expected form/content of the required question parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a concrete action and resource: 'Knowledge-base RAG Q&A' / '基于知识库的 RAG 问答', with a described pipeline and return values (answer and sources). It is far from a tautology, but it does not explicitly contrast itself with sibling tools such as search_memory or read_memory.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Knowledge-base RAG Q&A' and the memory-isolation note imply use for natural-language questions grounded in the KB rather than for memory CRUD or document ingestion. However, the description offers no explicit when-to-use, when-not-to-use, or alternative-tool guidance, so an agent must infer the decision.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

delete_memoryA

按 ID 删除一条记忆;成功返回 {"ok": true},记录不存在返回 {"error": "NOT_FOUND"}; 非 (client, project) 归属返回 {"error": "FORBIDDEN"}。 client:来源客户端(可选,缺省从 clientInfo 自动识别)。 English: Delete a memory by ID; returns {"ok": true} on success and {"error": "NOT_FOUND"} when it does not exist; non-(client, project) owners get {"error": "FORBIDDEN"}.

ParametersJSON Schema
NameRequiredDescriptionDefault
clientNo
projectNo
record_idYes

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does well by specifying success and error return shapes, including NOT_FOUND and FORBIDDEN ownership restrictions. It could further disclose that the deletion is permanent and irreversible, but the core behavioral surface is covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded with the core operation and return values. The bilingual repetition adds some length but is acceptable given multilingual context. No filler or irrelevant details are present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple delete tool with no output schema and no annotations, the description covers the main operation, the three return states, the ownership restriction, and the optional client parameter. Minor gaps remain around project semantics and explicit irreversibility, but overall an agent has enough to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds useful meaning for client by saying it is the source client and optional, defaulting from clientInfo. It does not explain project beyond its role in ownership, and record_id is only implicitly described as 'by ID'. Partial compensation but not full.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action: deleting a memory by ID. It uses a specific verb and resource, and the tool name itself distinguishes it from siblings like write_memory and read_memory. However, it does not explicitly contrast itself with sibling tools, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: use this tool to delete a memory by ID. It does not provide explicit when-to-use versus when-not-to-use guidance, nor does it mention alternatives such as update_memory for modifying existing memories. The context is clear but implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_memoryA

按 ID 读取单条记忆完整内容;记录不存在返回 {"error": "NOT_FOUND"}; 非 (client, project) 归属的 memory 返回 {"error": "FORBIDDEN"};共享知识可读。 client:来源客户端(可选,缺省从 clientInfo 自动识别)。 project:项目归属(可选,缺省=该客户端默认桶)。 English: Read the full content of a single memory by ID; returns {"error": "NOT_FOUND"} when absent; a memory not owned by the (client, project) returns {"error": "FORBIDDEN"}; shared knowledge is readable.

ParametersJSON Schema
NameRequiredDescriptionDefault
clientNo
projectNo
record_idYes

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It transparently discloses NOT_FOUND and FORBIDDEN error responses, ownership rules, that shared knowledge is readable, and the default behavior for optional client/project parameters. This gives the agent a strong behavioral model without needing to invoke the tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded with the core action and error semantics. It includes bilingual text that duplicates the same information, adding minor redundancy, but the content remains well-organized and scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-by-ID tool with no output schema, the description adequately covers error scenarios, ownership, and optional parameter defaults. It doesn't detail the success response shape, but 'full content of memory' conveys the expected return. Overall, enough for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains that client is optional and auto-detected from clientInfo, and project defaults to the client's default bucket. record_id is self-explanatory as the ID. This adds meaningful semantics beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states a specific action: read the full content of a single memory by ID. It distinguishes itself from search_memory (which searches rather than reads a single record) and other sibling write/update/delete tools. The error cases further clarify the scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies when to use: when you have a memory ID and want its full content. It explains optional client/project defaults and ownership constraints. However, it doesn't explicitly name alternatives or state when not to use this tool versus search_memory.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_memoryA

混合检索记忆与知识(向量语义 + BM25 关键词,RRF 融合); 返回命中列表,每项含 id/content/score/type/source。 v2:个人记忆(memory)只返回归属当前 (client, project) 的; 共享知识(doc/web chunk)所有客户端可见。top_k 小于 1 时返回 {"error": "INVALID_ARGUMENT", "message": 原因}。 client:来源客户端(可选,缺省从 clientInfo 自动识别)。 English: Hybrid retrieval over memories and knowledge (vector semantics + BM25 keywords, RRF-fused); returns a hit list, each item having id/content/score/type/source. v2: memory records only return those owned by the current (client, project); shared knowledge (doc/web chunks) is visible to all clients. Returns {"error": "INVALID_ARGUMENT", "message": reason} when top_k is less than 1. client: source client (optional; auto-detected from clientInfo when omitted).

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
top_kNo
clientNo
projectNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With zero annotations, the description carries the full burden and delivers substantially: hybrid retrieval mechanism, RRF fusion, response item fields, ownership scoping, the INVALID_ARGUMENT error contract for top_k < 1, and client auto-detection from clientInfo. It does not cover every possible trait (auth, rate limits), but the core behavioral contract an agent needs before calling is well disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core function and every sentence conveys a distinct fact, but the full bilingual duplication doubles the length for any single-language reader. The top_k error contract and client parameter note are appended after the main body rather than integrated with a parameter section, making the structure slightly scattered.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter hybrid-retrieval tool with a bare schema and no annotations, the description covers nearly everything an agent needs: retrieval method, return fields, scope behavior, error contract, and the client shortcut. The remaining gaps — a semantic definition of top_k and a dedicated project explanation — are minor because the parameter names are reasonably self-descriptive and the default of 5 is present in the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It does well for client (optional, auto-detected from clientInfo), partially for top_k (only the error condition is stated; no explicit 'maximum number of results' definition), and not at all for project, which appears only inside the ownership scoping rule rather than as a parameter definition. This is meaningful but incomplete compensation for a fully undocumented schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource pair — '混合检索记忆与知识' / 'Hybrid retrieval over memories and knowledge' — and specifies the mechanism (vector + BM25 keywords, RRF-fused) and result shape (hits with id/content/score/type/source). This clearly distinguishes it from the CRUD memory siblings (write/read/update/delete_memory) by positioning it as cross-source retrieval, and the v2 scope rule further differentiates personal memory from shared knowledge.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the v2 scoping rule (personal memory only for current client/project, shared knowledge visible to all) and the error contract, but it never explicitly states when to choose search_memory over read_memory or ask_kb. There are no 'use X instead' statements or exclusions. An agent can infer this is the retrieval/search tool among its siblings, but the guidance remains implicit rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

update_memoryA

按 ID 更新记忆内容(变更后自动重新嵌入);记录不存在返回 {"error": "NOT_FOUND"}; 非 (client, project) 归属返回 {"error": "FORBIDDEN"}; 内容为空串或纯空白时返回 {"error": "INVALID_ARGUMENT", "message": 原因}。 client:来源客户端(可选,缺省从 clientInfo 自动识别)。 English: Update a memory's content by ID (auto re-embed on change); returns {"error": "NOT_FOUND"} when absent; non-(client, project) owners get {"error": "FORBIDDEN"}; empty content returns {"error": "INVALID_ARGUMENT", "message": reason}.

ParametersJSON Schema
NameRequiredDescriptionDefault
clientNo
contentYes
projectNo
record_idYes

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the burden of behavioral disclosure. It usefully reveals that content is auto-re-embedded on change, and it documents the main error responses (NOT_FOUND, FORBIDDEN, INVALID_ARGUMENT) and the optional client defaulting from clientInfo. Some detail around ownership determination and success return is missing, but the core behavior is well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the primary purpose and includes important error behavior. However, it duplicates the same content in Chinese and English, which adds length without adding new information; the English section is mostly a redundant translation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there is no output schema, the description does not specify what a successful response looks like, and the project parameter remains ambiguous. It covers primary errors and behavior well, but for a mutation tool with no structured annotations or output schema, a bit more detail would be needed for full completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for the client parameter by explaining it is optional and auto-detected from clientInfo, and content/record_id are reasonably inferable from the main action. However, the project parameter is essentially unexplained beyond the ownership error mention.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool updates a memory's content by ID, which is a specific verb+resource action. It inherently distinguishes itself from siblings like write_memory, read_memory, and delete_memory by referencing an existing record via ID.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The update-by-ID behavior implies when to use it, and the error conditions provide some context for expected failures. However, there is no explicit statement about when to prefer this tool over write_memory or other alternatives, so usage guidance is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

write_memoryA

写入一条记忆短文本(事实/笔记/摘要),可选标签与归属项目;返回 {"id": 记录ID}。 内容为空串或纯空白时返回 {"error": "INVALID_ARGUMENT", "message": 原因}。 v2(2026-08-30):身份由环境承载——client 自动从 MCP 握手 clientInfo 识别 (TraeWork / Claude Code / Cursor),project 为项目/任务归属(连接配置声明, 可空=该客户端默认桶);记录主键由服务端生成。共享知识(add_document/add_webpage) 所有客户端可见。 English: Write a memory short text (fact/note/summary) with optional tags and project; returns {"id": record_id}. Returns {"error": "INVALID_ARGUMENT", "message": reason} when content is empty or blank. v2: identity comes from the environment — client is auto-detected from the MCP clientInfo handshake (TraeWork / Claude Code / Cursor), project is the project/task bucket (declared in the connection config; empty = this client's default bucket). The record primary key is generated server-side. Shared knowledge (add_document/add_webpage) is visible to all clients.

ParametersJSON Schema
NameRequiredDescriptionDefault
tagsNo
clientNo
contentYes
projectNo

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and does it well: it discloses the success return format ({"id": ...}), the error case for empty/blank content, how identity is derived from the MCP handshake, that the primary key is server-generated, and that shared knowledge is separately namespaced. This is far more transparent than typical tool descriptions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The key purpose and return format are front-loaded, and the v2 notes are useful. However, the description duplicates nearly all information in Chinese and English, roughly doubling the length. The structure is organized but not optimally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a write tool with no output schema and no annotations, the description is quite complete: it covers return values, validation errors, identity/resolution, key generation, and boundary with shared knowledge tools. Minor missing pieces are explicit guidance on when to prefer read/update/delete siblings and any permission requirements.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains content as the memory text, tags as optional, project as the project/task bucket with empty meaning default, and client as auto-detected from MCP clientInfo. This adds real meaning beyond the bare schema, though it does not specify tag element constraints or content length limits.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear verb and resource: '写入一条记忆短文本' (write a memory short text) with optional tags and project, and specifies the return shape. It also distinguishes itself from add_document/add_webpage by noting that shared knowledge is visible to all clients, which implies this tool is for non-shared memory.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context on when the tool is appropriate by explaining the client/project identity model and contrasting shared knowledge tools (add_document/add_webpage) as visible to all clients. It does not explicitly state 'when not to use' or name alternatives for read/update/delete, but the context is clear enough for an agent to choose correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct resource and action: CRUD operations for memories are clearly separated from hybrid retrieval, and the two ingestion tools are differentiated by source type (local file vs URL). search_memory and ask_kb are distinguishable by their outputs—raw hits versus a generated answer with sources.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern (write_memory, read_memory, update_memory, delete_memory, search_memory, add_document, add_webpage, ask_kb). The only slight deviation is ask_kb's abbreviated noun, but it still fits the verb_noun structure and is readable.

Tool Count5/5

8 tools is well-scoped for a memory/knowledge server: full CRUD for memories, two ingestion tools for shared knowledge, hybrid search, and RAG Q&A each earn their place. The count is neither sparse nor bloated.

Completeness4/5

The memory lifecycle is fully covered (write/read/update/delete), and knowledge ingestion plus retrieval and Q&A are present. Minor gaps exist—there is no list/delete operation for shared documents or webpages—but agents can work around these since shared knowledge is append-only.

Maintenance

ActivityActive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Persistent memory MCP server for AI coding agents (Claude Code, Codex, Gemini CLI). Hybrid retrieval (vector + BM25), cross-encoder reranking, knowledge graph, session checkpoint/resume, and multi-scope isolation. Local-first with LanceDB.
    30
    276
    15
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Durable hybrid memory for AI agents. Combines vector search, BM25, temporal retrieval, and optional Memgraph knowledge graph via reciprocal rank fusion. 6 MCP tools: health, search, answer, feedback, graph_query, graph_add_triple. Self-hosted with Qdrant backend.
    7
    7
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server that enables persistent, hybrid, local memory for LLM agents, with vector + BM25 search, knowledge graph, and policy-driven retention, providing token-budgeted context injection for AI assistants.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fish827-08/rag-kb'

If you have feedback or need assistance with the MCP directory API, please join our Discord server