AI-MemoryHub MCP Server
AI记忆中枢(AI-MemoryHub)
零依赖、模型无关的 AI Agent 长期记忆系统:Markdown 正文作权威源 + 薄 SQLite 索引,用确定性检索替代向量 RAG,把"理解"交给外层 AI、引擎只做检索与拒答。基于 CEMA(Cognitive Event-driven Memory Architecture,认知-事件驱动记忆架构)概念构建。
个人项目,vibe coding 独立开发:架构与需求设计由本人完成,代码由 AI 辅助实现。
项目介绍
AI记忆中枢(AI-MemoryHub)把"长期记忆"拆成两层:
后台正文(权威源):每个记忆是一个 Markdown 文件,带 YAML front-matter,存全部语义内容。永不参与检索,按需按 ID 取用(即"被遗忘的冷存储")。
前台索引(薄 SQLite 表):存
id / title / summary / aliases / tags / linked / anchors / created / updated+features(子实体变体归一)+ 四要素person / event_date / location / topic,可由所有.md的 front-matter 全量重建。检索只发生在这里,命中唯一 ID 后才取正文。
这套设计称为 CEMA(前台薄索引 + 后台正文,前后台严格 1:1、索引可由正文全量重建)——无状态检索、廉价存储不遗忘,且卸下了传统记忆系统的运维重量(无向量基建、无夜间 LLM 流水线、Agent 直写)。
设计为零第三方依赖(仅 Python 标准库),可对接任意 AI 大模型 API,理解层由 AI 客户端 / Agent / 付费 LLM 任一承担。
命名约定:本文档中「AI记忆中枢(AI-MemoryHub)」为本项目正式名称;「HMA」专指其底层架构 Hybrid Memory Architecture(混合记忆架构)。代码中的
hma包名、MCP server 名、HMA_LLM环境变量等标识符保持不变。
核心特性
事件化记忆:事件为唯一载体,不按短期/长期、情景/语义分类
前后台严格分离:薄 SQLite 索引 + Markdown 正文,索引可由 front-matter 全量重建
不遗忘、全保留:无重要性评分、无遗忘曲线,判断留给检索时
反向量猜测的确定性召回:零向量/零嵌入;F-stage 子实体变体归一 + C+A 章级消歧 + READ 取正文 + 循环查询
Tag 即 Mod 的包级装卸:复制/删除 memory 下文件夹 = 装卸一块认知
模型无关:通用 LLM 适配器,今天 Claude、明天 GPT、后天本地 Ollama 都不用改代码
查询契约强制:MCP 边界对每次检索做 QueryEnvelope 校验(缺
keywords/mode直接挡回)全生命周期工具化:新建(五类文本块模板 / 项目模块集)→ 修改(export/import fail-closed)→ 诊断(三层召回诊断),记忆包格式零手搓
架构哲学、检索分类与解决思路见
memory/项目/AIMH-design-journal/下的设计文档;MCP 工具清单、引擎 API、检索机制、适配器、设计不变量、基准口径 全部收敛到技术参考.md。本文档只讲「是什么 / 怎么跑」。
Related MCP server: mcp-ltm
项目结构
memory/是 AI记忆中枢(AI-MemoryHub)的单一权威存储。每个记忆包 = 一个.md事件文件(##标题树 + YAML front-matter)+ 包内index.db(薄索引缓存,可由.mdfront-matter 全量重建,删了不丢数据)。
AIMH/
├── hma/ # 引擎核心(零运行时依赖,仅标准库)
│ ├── hma_core.py # Memory 类:write/query/query_anchors/resolve_query/read_section/link/rebuild/orchestrate/list_all_in_scope/ingest + derive_anchors/query_features/recall_multihop
│ ├── envelope.py # QueryEnvelope 校验层(MCP 边界强制)
│ ├── cli.py # 命令行入口
│ ├── server.py # MCP server(stdio JSON-RPC,11 工具)
│ ├── engine/ # 分支接口 / CLI(dispatch + @register + handlers)
│ ├── ingest.py # AI 收录管线
│ ├── daylog.py / tree.py / llm_adapter.py
├── scripts/core/ # 独立确定性脚本(rebuild_index / new_package / relocate / migrate_*_memory / compact / deploy_mcp …)
├── skills/ # 技能(项目级副本,与用户级 ~/.workbuddy/skills 双副本;含召回失败三层诊断 aimh-recall-diagnose)
├── memory/ # 权威记忆库(单一真相)
├── 一键更新记忆索引.exe # 一键重建索引(rebuild_index.py 的 PyInstaller 打包,双击即用零 AI;旧版留存为「(已老旧)」文件)
├── pyproject.toml # 零运行时依赖声明
├── AGENTS.md # ZCode 工作区指南(指针式铁律 + 红线)
└── README.md执行流程
安装
pip install -e . # 提供 hma-mcp / hma 两个命令pyproject.toml 声明零运行时依赖(仅标准库)。无需任何向量库或外部服务。
三种用法
1. 命令行(人工 / 脚本)
python -m hma.cli --root memory write \
--id proj-rag --title "放弃 RAG 主记忆" --summary "改事件驱动分层" \
--tags project,decision --aliases "分层记忆" --body "# ...\n正文"
python -m hma.cli --root memory query "分层记忆" --top-k 5
python -m hma.cli --root memory link proj-rag todo-mcp
python -m hma.cli --root memory show proj-rag
python -m hma.cli --root memory list
python -m hma.cli --root memory rebuild # 删了 index.db 也能恢复2. MCP server(接任意 AI 客户端)⭐ 推荐
python -m hma.server --root memory
# 或 entry point: hma-mcp --root memorystdio 上的 JSON-RPC 2.0,暴露 11 个工具(对应三级检索漏斗 L1→L2→L3 + 写入/关联/重建/收录 + 聚合/时间/细节追问):
工具 | 作用 |
| 被动结构化写入一个事件包(id 存在则覆盖) |
| L1 包级确定性检索,返回 Top-K 候选(命中 ID) |
| L2 章级锚点检索,按 |
| 召回消歧统一入口:多实体时澄清,否则返回 Top-K;支持多跳 + 拒答闸 |
| L3 取正文:按 (id, heading) 只读该 |
| 双向关联两个事件包 |
| 从 |
| 主动收录:用户贴一段文本,AI 跑完整管线(见下) |
| 聚合统计:按 unit(包/实体等)计数或枚举 scope 内清单(只读护栏) |
| 时间意图硬过滤:解析模糊时间语("前天/去年10月"),返回月级命中的包列表 |
| 细节追问:不起眼物件 context-scope 三态锁章,章内局部倒排定段;路线一无果自动拒答、转路线二 C+A 卡片交人终审 |
Claude Desktop / Codex / Cline / WorkBuddy 等任何 MCP 客户端,加一段配置即可:
{
"mcpServers": {
"aimh": {
"command": "python",
"args": ["-m", "hma.server", "--root", "/path/to/.memory"]
}
}
}WorkBuddy 即插即用部署:仓库自带一键部署脚本,把启动器复制到 WorkBuddy 配置目录、合并写出 ~/.workbuddy/mcp.json(只动 aimh 连接器、保留其它、自动探测 python 版本、不写死路径),并登记 ~/.hma_home 指针:
python scripts/core/deploy_mcp.py # 部署(幂等,可重跑)
python scripts/core/deploy_mcp.py --dry-run # 只预览将写出的配置部署后在 WorkBuddy 连接器管理页点「信任」激活 aimh 连接器,新窗口即出现 mcp__aimh__* 工具。
⚠️ 改
server.py后需在连接器里禁用→启用 / 重新 Trust,长驻进程才加载新代码。
3. 作为库(Python import)
from hma.hma_core import Memory
m = Memory("memory")
m.write(id="x", title="X", summary="s", tags=["t"], body="# X\n正文")
for rid, title, summary, score in m.query("x"):
print(rid, score)写入与收录
主动收录(memory_ingest)——用户贴文本,AI 执行完整管线:读取现有包摘要做关联发现 → 按 CEMA 凝聚性+体积闸门拆分为事件包 → 为每个包生成元数据 → 写入 .md 权威源 + upsert 索引 → 与现有/新建包建立双向关联。未配置 LLM API 时退化为单包启发式,工具永远可用。
# 有 LLM:AI 自动拆分+关联
echo "周会:放弃 RAG,改事件驱动;下周三前完成 MCP 评审。" \
| python -m hma.cli --root memory ingest --scope 其他
# 无 LLM / 不想调模型:单包兜底
echo "随手记一条想法" | python -m hma.cli --root memory ingest --no-llm零成本路径(Agent 即理解层):未配置 key 时,让当前会话 Agent 充当理解层(加载 aimh-ingest 技能),由确定性引擎落库——与付费 LLM 路径同构可替换。当文本类型不确定时,先加载 aimh-intake 元路由技能做分类决策,再链式加载 oc-dossier / aimh-ingest / aimh-project / memory-import 对应技能落库,自己不写任何 memory/ 文件。
确定性落库 / 改包(scripts/core/new_package.py,推荐入口)——记忆包全生命周期格式零手搓:
# 新建:出类型 dict 模板(通用/对话记录/论文orig/论文review/疾病),AI 填好 JSON 后 fail-closed 落盘
python scripts/core/new_package.py --print-dict --type 疾病
python scripts/core/new_package.py --type 疾病 --path "memory/其他/医疗" --id 心包炎 \
--fill fm.json --body-file body.md
# 新建整项目:一键建齐 4 状态模块骨架(需求清单/项目结构/约定/架构,互链)
python scripts/core/new_package.py --module-set 项目 --path "memory/项目/新项目" --project 新项目
# 修改既有包:拆出 fm.json + body.md 编辑后 fail-closed 写回(pkage_updated 自动更新)
python scripts/core/new_package.py --export "memory/<路径>/<包>.md"
python scripts/core/new_package.py --import "memory/<路径>/<包>.md" --fill fm.json --body-file body.md校验渲染复用 fm_schema 权威实现(校验不过不落盘);默认拒绝覆盖、路径软检查(单存储 + R59 中文命名)。
付费/本地路径:设 HMA_LLM(并配好对应 key/端点)即自动改走 llm_adapter 真实 LLM,无需改任何代码;LLM 调用失败会自动退回启发式。
时间轴:单日记录包(daylog)
主记忆库按主题而非时间线组织;daylog 补上正交的时间轴,不破坏主题原则:
python -m hma.engine daylog add "一段叙事:这天发生的事" \
--linked 主题包id --tags 关键词1,关键词2 [--date 2026-07-25]
python -m hma.engine daylog show 2026-07-25 # 全天
python -m hma.engine daylog show 2026-07-25 --q 关键词 # 精准搜寻
python -m hma.engine daylog range --start d1 --end d2时间是过滤键不是权重(定位 = id 内嵌日期的确定性比较,不做新鲜度加权)。模糊时间语("前天/上周三")由 Agent 解析成 ISO 日期后再调命令。
上下文压缩归档(昼夜节律 · Agent 即理解层)
当上下文窗口将满时,把已讨论完、暂未落库、但以后可能要用的溢出内容,由 Agent 判定落点 + 生成冷凝摘要,确定性写交 scripts/core/compact.py:
python scripts/core/compact.py \
--root memory --sink <daylog|cache|progress> \
--summary "<冷凝摘要>" --source "<溢出来源>" \
[--date YYYY-MM-DD] [--id <eid> --title "<标题>"] [--project <pid>] \
[--linked a,b] [--tags x,y] [--conflict-event <id> --conflict-intro "<一句话>"]铁律:压缩 = 加法式冷摘要,权威原文一字不动;仅当新信息与某权威事件真正冲突时才覆盖并追加可审计 trail。
迁移外部记忆
scripts/core/ 下的 migrate_wb_memory / migrate_claude_memory / migrate_gemini_memory / migrate_codex_memory 把各 AI 客户端的原生长期记忆迁移进 AIMH,装上可检索的 CEMA 前台索引:
python scripts/core/migrate_wb_memory.py --wb-dir ".workbuddy/memory" --root memory/项目/AIMH-design-journal
python scripts/core/migrate_claude_memory.py --root memory --namespace 其他
python scripts/core/migrate_gemini_memory.py --root memory --namespace 其他
python scripts/core/migrate_codex_memory.py --root memory --namespace 其他进阶检索(scope / 拒答 / 多问 / 枚举)
聚焦
scope:传入目录路径只召回该子树,屏蔽跨子树干扰(29 包 → 11 包),只收束范围不替拒答。拒答层
allow_abstain:覆盖不足/域外查询显式返回拒答,避免编造(V1.0 已落地,默认开)。多问
sub_queries:AI 一次给子问清单,引擎确定性扇出合并,不单独往返。枚举
enumerate:列出 scope 子树内全部包(非 Top-K 排序)。多跳
multihop:沿写入时策展的linked边 BFS 扩簇,补关系/结构盲区(opt-in)。
所有检索类 MCP 调用都受 QueryEnvelope 契约约束(q/keywords/mode 必填,缺则 ENVELOPE_VIOLATION 挡回)。
当前状态
项目状态(2026-08-29):开发周期收官,进入使用/运维态。检索主线(打分框架、dK 裁切、拒答层、澄清反问、细节追问锁章)已全部落产,由
scripts/tests/下 14 项正式回归锁定(全绿,可一键复跑);网页控制台、医学/法律领域适配、记忆包全生命周期工具(new_package.py)与召回失败三层诊断(aimh-recall-diagnose)齐备。接下来以日常使用驱动维护:内容蒸馏回填、按需修病灶。挂起事项(LoCoMo 全量跑分)在有可用 LLM 资源时可随时恢复。
定位:零依赖参考实现 + 个人哲学试验场——把事件化记忆、前后台分离、不遗忘、反向量猜测等设计在零依赖下做了工程验证,并接入召回检索四要素、F+C+A+READ 三段式锚点管线、LoCoMo / MemoryStress 基准评测。
已兑现的哲学:事件化记忆 · 前后台严格分离 · 不遗忘全保留 · 反向量确定性召回 · Tag 即 Mod 包级装卸 · 跨窗口离线整合(昼夜节律)。
工程状态:
零第三方运行时依赖(仅 Python 标准库)
MCP server 暴露 11 工具(write / query / query_anchors / resolve / read_section / link / rebuild / ingest / aggregate / time_filter / obscure_recall)
打分常量单一调参面
hma/scoring_coeffs.py(六组系数);dK 关联度分差裁切(锚点级瀑布式)落产澄清反问(clarify,Venn 独有弧段)+ 细节追问三态锁章(obscure_recall / context-scope)落产,与拒答层共同构成对向量 RAG 的护城河
召回机械层收编
hma/recall_obscure.py(章级切分 / 局部倒排 / 重叠合并 / 瀑布裁切,零依赖)网页控制台(
网页控制台/):零依赖单文件前端 + vendored marked.js,只读浏览记忆库医学 / 法律领域适配规范落库(一病一包与分阶段筛查、法条引证变体归一)
记忆包全生命周期确定性工具
scripts/core/new_package.py:五类文本块模板新建、项目 4 模块集骨架、--export/--importfail-closed 改包(旧式 FM 自动归一)召回失败三层诊断技能
aimh-recall-diagnose(FM 字段 → index.db → 代码流程,案例皆真实病灶)仓库带 git 基线与
AGENTS.md(ZCode 工作区指南,指针式铁律)召回检索四要素(person / event_date / location / topic)已为一等字段,读取期软加权
锚点级检索已升级为 F+C+A+READ 三段式(生产引擎已闭环)
拒答层 V1.0 已落地(四道闸 +
corpus_missing_entity硬拒,allow_abstain默认开)QueryEnvelope 契约已落地(MCP 边界强制
q/keywords/mode,多问扇出sub_queries、枚举list_all_in_scope)技能作为即插即用客户端 + 常驻主动触发技能(aimh-always)
基准评测(已跑通真实数据闭环):
LoCoMo 1540 题:hit@30 ≈ 99.6% / recall@30 ≈ 99.5% / hit@5 89.7–92%
MemoryStress 300 题:
baseline77% /B_gold89.7%
完整口径(含红线:OMEGA 38.3% 不可并列、TrueMemory 93% 作对齐目标)见
技术参考.md§九。
已知缺口:
窗口内实时活文档整合重置(边对话边把碎片整合进既有正文)在当前 Transformer 架构下做不出完整版,留待非 TF 架构(持久状态 SSM/Mamba 类,或真 AGI)
MCP 连接器需在客户端点「信任」激活
引擎 API 直接调用绕过 MCP 边界的 QueryEnvelope 约束(预期隔离,测试脚本走 API 不受影响)
架构权衡(能力上限在 AI 层):CEMA 把理解力(归约/判 mode/抽 keywords/拆 sub_queries/策展 linked)集中押在 AI 层,引擎只做确定性执行。收益是引擎极小、可调试、随 AI 升级白赚;代价是 AIMH 的质量上限 = 配对 AI 的智能上限——AI 弱则退化为「偶尔用错的漂亮文件柜」。三道缓冲(信封硬校验/写时策展摊销/拒答闸兜底)把「AI 可能笨」变为「可控且可纠正」,但不消除该上限。详见《召回消歧的数学与语言哲学思路》§11.5。
License
MIT
Available Tools
7 toolsmemory_ingestA
主动收录:用户提供一段原始文本,AI 执行完整管线——理解并拆分为凝聚的事件包、生成结构化元数据、写入 .md 权威源 + 索引、与现有/新建包建立关联。模型由通用适配器决定(模型无关)。未配置 LLM API 时退化为单包启发式。
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 待收录的原始文本 | |
| model | No | 可选,覆盖默认模型名 | |
| scope | No | 作用域标签(如 user_global / workspace_x),会加进每个新包的 tags | |
| provider | No | 可选,覆盖默认 LLM 厂商:openai / anthropic | |
| auto_link | No | 是否自动建立关联,默认 true |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description fully discloses behavioral aspects: it performs multiple steps (splitting, metadata generation, writing to .md and index, linking), is model-agnostic, and falls back to a heuristic when no LLM API is configured. This is comprehensive and avoids surprises.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two concise sentences that front-load the purpose and cover key aspects without redundancy. Every sentence adds value, including fallback behavior and model-agnostic property.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description thoroughly covers input handling and internal behavior but omits any mention of return values or output format. Given the absence of an output schema, the agent is left without information on what the tool returns, which is a minor gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema covers 100% of parameters with descriptions, so the description does not need to add parameter details. It provides overall pipeline context but no additional parameter-level semantics beyond what the schema offers, meeting the baseline expectation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: accepting raw text and executing a full pipeline to split into event packets, generate metadata, write to authoritative source with indexing, and establish links. It distinguishes from sibling tools like memory_write (which likely writes a single packet) and memory_link (which creates associations) by describing a more comprehensive ingestion process.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implicitly indicates usage for ingesting raw text into the memory system, but does not explicitly state when to use this over alternatives or provide exclusion criteria. The context from sibling tools makes it clear this is for initial ingestion versus querying or linking, but explicit guidance is missing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
memory_linkA
双向关联两个事件包(更新两者 front-matter 的 linked 字段)。
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | 事件包 ID | |
| b | Yes | 事件包 ID |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses the bidirectional update to linked fields, but does not mention potential side effects, reversibility, or permission requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, front-loaded with action and effect, no extraneous information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (2 parameters, no output schema), the description is nearly complete. Could mention what 'bidirectionally link' means operationally, but overall sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with each parameter described as '事件包 ID'. The description does not add extra meaning beyond the schema, so baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'bidirectionally link' and the resource 'two event packages', specifying it updates the linked field in both front-matters. This distinguishes it from siblings like memory_write or memory_query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for linking event packages but provides no explicit guidance on when to use this tool versus alternatives like memory_write or memory_query. It lacks when-not-to-use or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
memory_queryA
确定性无状态检索:在 id/title/alias/tag/summary 上做关键词匹配,返回按确定性规则排序的 Top-K 候选(命中唯一 ID)。不依赖热度/权重。
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | 检索关键词 | |
| top_k | No | 返回条数,默认 5 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, description discloses statelessness, determinism, matching fields, sorting rules, and non-reliance on weights. It does not mention side effects or rate limits, but provides adequate behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is a single concise sentence with no redundant information, front-loading the core action and key characteristics.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple query tool with 2 parameters and no output schema, the description covers purpose, matching fields, sorting, and behavior. It could mention the return format explicitly but is otherwise complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with descriptions for both parameters. The description adds value by specifying the fields searched and sorting criteria beyond the schema's parameter descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it is a deterministic stateless retrieval tool for keyword matching on id/title/alias/tag/summary, and distinguishes itself from siblings by noting it does not rely on popularity/weights.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description implies use for deterministic keyword matching without popularity bias, but does not explicitly state when to use this tool versus siblings like memory_query_anchors or memory_read_section.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
memory_query_anchorsA
锚点层细粒度召回:在事件包的 anchors 子事件锚点上做关键词匹配,返回命中的子事件(包ID + 锚点标题 + 摘要 + 定位 + 分数)。用于故事包/长正文按剧情节点召回——当 memory_query 命中率低时,anchors 往往能把内容词召回(如「幽影核心」「圣保罗之焰」「纽约之战」)。
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | 检索关键词(剧情/事件/特征词) | |
| top_k | No | 返回条数,默认 5 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It explains the matching behavior and return fields, but does not disclose side effects, authorization needs, or limitations such as whether it is read-only or if it modifies data.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three concise sentences, with no fluff. The key information (what, how, when) is front-loaded and efficiently communicated.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with two parameters and no output schema, the description is fairly complete. It explains what the tool does, what it returns, and its typical use case. No major gaps are present.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, but the description adds context: the tool matches on anchor sub-events within story packages, clarifying the domain of the 'q' parameter. This goes beyond the schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: fine-grained recall on anchor sub-events via keyword matching, returning specific fields (package ID, anchor title, summary, location, score). It also distinguishes itself from siblings by mentioning its use for story packages/long texts and when memory_query has low hit rate.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says to use this tool when memory_query has low hit rate, providing a clear usage scenario. It implies alternatives (memory_query) but does not explicitly state when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
memory_read_sectionA
按小标题精准读取事件包正文的某一段(而非整包),节省上下文窗口。配合 memory_query_anchors 使用:先 query_anchors 拿到命中的 locator,再用本工具按 locator 取该段正文。heading 为正文里 ## / ### 小标题的片段(包含匹配),可直接用 locator 值。
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 事件包 ID | |
| heading | Yes | 小标题片段(##/### 标题的包含匹配,可用 query_anchors 返回的 locator) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It explains reading by heading and use of locator. Implies read-only operation, but not explicitly stated. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences in Chinese, front-loaded with purpose, then usage. No extraneous information. Efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Simple tool with 2 required params and no output schema. Description covers usage pattern and parameter meaning, mentions context saving. Not 5 because missing behavior on missing heading, but adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 100% coverage, so baseline 3. Description adds meaning: heading is a subtitle fragment and can be locator from query_anchors. Adds value beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states it reads a specific section of an event package body by subtitle, saving context window. Distinguishes from siblings like memory_query_anchors (which finds locators) and memory_query (likely retrieves full package). Verb '读取' and resource are specific.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly instructs to use with memory_query_anchors: first query_anchors to get locator, then this tool with locator. Provides clear when-to-use and usage pattern.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
memory_rebuildA
从所有 .md 的 front-matter 全量重建 index.db。索引损坏时调用——.md 是权威源,重建不丢数据。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It states that .md is authoritative and rebuild doesn't lose data, which reassures about safety. However, it doesn't detail whether existing index data is overwritten or merged, or if any permissions are needed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences in Chinese, extremely concise. It front-loads the action and condition, with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters and no output schema, the description covers purpose and usage condition adequately. It could mention the effect on other tools (e.g., index becomes current) but that's not critical.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are zero parameters, so schema coverage is 100% by default. The description adds no parameter details, but that's acceptable as no parameters exist. Baseline of 4 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: rebuilding index.db from all .md front-matter. It specifies the authoritative source (.md) and that data is not lost, distinguishing it from siblings like memory_write or memory_query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says 'call when index is corrupted', providing a clear usage condition. It implies not to use it for normal operations, though it doesn't list alternative tools or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
memory_writeA
写/改一个事件包:原子写 .md(权威源)+ 确定性 upsert 索引。id 存在则覆盖更新。tags/aliases/linked 为字符串数组。
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 事件包唯一 ID(文件名) | |
| body | No | Markdown 正文 | |
| tags | No | 标签;trivial 表示琐碎内容(检索降权) | |
| title | No | 标题 | |
| linked | No | 关联的其他事件包 ID | |
| aliases | No | 别名/同义词,用于检索命中 | |
| created | No | 创建日期 YYYY-MM-DD(可选) | |
| summary | No | 一句话摘要 | |
| updated | No | 更新日期 YYYY-MM-DD(可选) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses atomic write, upsert, and overwrite behavior, but lacks details on auth, rate limits, failure modes, or concurrency. Basic behavioral info is present but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, no wasted words. The description is front-loaded with the core action and efficiently covers key behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description does not explain return values. It also omits usage of optional body, trivial tag implications, and idempotency. Adequate but incomplete for a tool with 9 parameters.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All parameters have schema descriptions (100% coverage). The tool description does not add significant meaning beyond the schema; it merely confirms that tags/aliases/linked are string arrays. Baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool writes/modifies an event package with atomic write and upsert. It uses specific verbs and resource, and distinguishes from sibling tools like memory_query (query) and memory_read_section (read).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies this is the primary write tool but does not explicitly state when to use it vs alternatives like memory_ingest. No when-not-to-use guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
7 tool updates
v0.1.0- First observed
memory_ingest - First observed
memory_link - First observed
memory_query - First observed
memory_query_anchors - First observed
memory_read_section - First observed
memory_rebuild - First observed
memory_write
TDQS
All seven tools have clearly distinct purposes: writing/updating events, querying, linking, anchor-level search, section reading, index rebuilding, and intelligent ingestion. No overlap in functionality.
All tools follow a consistent 'memory_' prefix with a verb_noun pattern (e.g., memory_write, memory_query, memory_link). The naming is predictable and systematic.
With 7 tools, the server is well-scoped. Each tool addresses a specific need for managing memory events without unnecessary bloat or deficiency.
The set covers writing, querying, linking, section reading, and maintenance. However, it lacks an explicit deletion tool and a way to retrieve full event packages, which are notable gaps for a complete lifecycle.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
- memnodeOAuthdev.memnode
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Token-efficient MCP memory for Markdown vaults. Tiered search, GraphRAG, AI memories.
Related MCP Servers
- AlicenseAqualityBmaintenanceA local-first shared memory layer for MCP-aware agents like Claude, Codex, and Hermes, enabling persistent memory across chats and clients via Markdown files and SQLite FTS.62MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent long-term memory for AI assistants with tag-based retrieval, wiki-style linking, and source references, storing memories as markdown files with SQLite index.1MIT
- AlicenseBqualityAmaintenancePersonal multi-LLM memory repository using Markdown as source of truth, SQLite FTS5 for retrieval, and MCP tools for search, context, and write proposals.74Apache 2.0
- AlicenseAqualityBmaintenanceMCP server for persistent, cross-session, local-first memory for AI agents, storing memories as Markdown files with SQLite indexing for hybrid search.24Apache 2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Traceless-zero/AI-MemoryHub'
If you have feedback or need assistance with the MCP directory API, please join our Discord server