CheeseDB v0.3.0 本地实测:删掉来源,记忆跟着消失
2026 年 11 月 16 日发布的 CheeseDB v0.3.0 加入按语义搜索和两步撤销确认。本文在本机安装命令行工具,跑通来源登记、记忆依赖、Fair/Strict 撤销与磁盘擦除,并记录没有配置嵌入模型时的边界。
2026 年 11 月 16 日,GitHub 项目 govinargo-labs/cheesedb 发布 v0.3.0(preview),发布标题写的是「search by meaning, and recall that asks first」。项目主页把它定位成给 AI 智能体用的嵌入式记忆数据库:每条记忆都要登记来源,撤销一个来源时,从它学来的记忆也一起处理。本篇记录 2026 年 11 月 18 日在本机的一次命令行实测:安装 v0.3.0、登记来源和记忆、撤销并核对磁盘内容,最后清理测试目录。本文只使用命令行工具,没有运行需要大模型的 demo、ask 或 learn。

发布说明里写了什么
更新日志把 v0.3.0 的关键变化列为:向量搜索(preview);命令行与 MCP 应用可以按语义搜索;MCP 的 recall 改成两次调用,第一次只列出将被移除的内容并给出确认码,第二次带确认码才真正撤销;WouldRecall 可以让程序先预览影响而不写入。更新日志还写明,v0.3.0 的索引格式仍可能变化。
项目 README 写明当前状态是 preview:尚未经过独立安全审查,API 与磁盘格式在 v1.0 之前可能改变,不建议用于生产数据。README 给出的基准数字来自作者自己的 Apple M1 Max 测试环境,本篇没有复现这些数字,也没有配置嵌入模型,因此不验证语义搜索的排序效果。
流程
flowchart TD
A[安装 cheesedb v0.3.0 并核对版本] --> B[建立测试 agent,登记三个来源]
B --> C[写入带依赖关系的记忆]
C --> D[撤销错误来源,核对存活记忆与磁盘文本]
D --> E[用第二个 agent 对比 Fair 与 Strict]
E --> F[检查无嵌入模型时的行为,清理本机目录]
安装与版本核对
README 要求 Go 1.26.5 或更新版本;本机是 Go 1.27.3。安装时把 Go 的模块缓存、构建缓存和输出目录都指向本次临时目录,避免写到工作目录之外。实际执行的安装命令与版本输出如下:
export GOPATH="$PWD/gopath" GOMODCACHE="$PWD/gopath/pkg/mod" \ GOCACHE="$PWD/gocache" GOBIN="$PWD/bin" GOENV=offgo install github.com/govinargo-labs/cheesedb/cmd/cheesedb@v0.3.0./bin/cheesedb versiongo: downloading github.com/govinargo-labs/cheesedb v0.3.0cheesedb v0.3.0cheesedb help 显示,数据默认放在 ~/.cheesedb;本次通过 CHEESEDB_DIR 改到临时目录,测试不碰默认目录。
一次完整的撤销实测
测试沿用 README 里的「花生」故事:用户说自己花生过敏,医生确认过敏,网页却说某家店的沙嗲酱不含花生。三条来源分别登记为 lot 1、2、3,三条记忆按不同的依赖关系写入。其中「4,5」表示这条记忆同时依赖 4 和 5,而「1 2」表示分别依赖 1 或 2:
export CHEESEDB_DIR="$PWD/store" PATH="$PWD/bin:$PATH"cheesedb agent create storycheesedb lot story user_message "I am allergic to peanuts"cheesedb lot story doctor_note "Allergy test result: peanut allergy confirmed"cheesedb lot story web_page "Spice Garden menu: our satay sauce is peanut-free"cheesedb remember story "The user is allergic to peanuts" 1 2cheesedb remember story "Spice Garden's satay sauce has no peanuts" 3cheesedb remember story "The satay at Spice Garden is safe for the user" 4,5cheesedb active storycreated "story"; token saved in /workspace/blog-daily-20261118/tmp/store/tokens/73746f7279.tokenlot 1lot 2lot 3memory 4memory 5memory 6[4] memory alive "The user is allergic to peanuts"[5] memory alive "Spice Garden's satay sauce has no peanuts"[6] memory alive "The satay at Spice Garden is safe for the user"find 会在数据目录里逐字节查找文本。撤销前,它能找到网页原文;撤销来源 3 时选择 fair erase:Fair 规则下,只要还有一条依赖链有效,记忆就保留;erase 会把被撤销的记录及死记忆的文本从文件中擦掉。
cheesedb find story "peanut-free"cheesedb recall story 3 fair erasecheesedb active storycheesedb find story "peanut-free"cheesedb get story 3 found in 000001.seg at byte 660: …menu: our satay sauce is peanut-free.......s..........;q..]..…recalled 3; memories removed: [5 6][4] memory alive "The user is allergic to peanuts" "peanut-free": not found anywhere in /workspace/blog-daily-20261118/tmp/store/data/73746f7279 (searched every file, byte by byte)[3] lot DEAD (text erased from disk)靠医生记录仍然成立的记忆 4 没有跟随来源 1 消失。随后撤销来源 1,移除列表为空;再核对日志哈希链:
cheesedb recall story 1 fair erasecheesedb active storycheesedb verify storycheesedb show storyrecalled 1; memories removed: [][4] memory alive "The user is allergic to peanuts"OK. head fingerprint: 7c4d9290f06c1234300078dd95ad813bf9e277f76079dcd4cb9d4258c20e920a[1] lot DEAD (text erased from disk)[2] lot alive "Allergy test result: peanut allergy confirmed"[3] lot DEAD (text erased from disk)[4] memory alive "The user is allergic to peanuts"[5] memory DEAD (text erased from disk)[6] memory DEAD (text erased from disk)Fair 与 Strict 的差别
README 对两种规则的定义是:Fair 在任意一条依赖链仍有效时保留记忆,Strict 在来源出现在任意历史路径中时就移除记忆。本次又建了一个 agent 作对照:来源 1 是错误信息,来源 2 是网页;记忆 4 的依赖写成「1 2」,即两个来源各自单独支撑这条记忆。

cheesedb agent create rulescheesedb lot rules user_message "user says allergic to peanuts"cheesedb lot rules web_page "menu says peanut-free"cheesedb remember rules "user is allergic" 1cheesedb remember rules "satay is safe" 1 2cheesedb recall rules 1 strict erasecheesedb active rulescheesedb verify rulescreated "rules"; token saved in /workspace/blog-daily-20261118/tmp/store/tokens/72756c6573.tokenlot 1lot 2memory 3memory 4recalled 1; memories removed: [3 4](no live memories)OK. head fingerprint: 14ea863c2d6701b34eead4095ef0c75d3bc86ea8c382494e9d132f258799fbab同样的数据若用 fair erase 撤销来源 1,记忆 4 会靠来源 2 留下;这里用 strict erase,记忆 4 也一并移除。
没有嵌入模型时的边界
v0.3.0 的语义搜索需要在数据目录的 llm.conf 里配置嵌入模型,或设置 EMBED_BASE_URL 与 EMBED_MODEL。本次没有配置,直接运行索引和搜索命令,得到的是:
cheesedb index storycheesedb search story "can the user eat the satay?"no indexes (cheesedb embed <agent> creates one)error: search needs an embedding model. Add to /workspace/blog-daily-20261118/tmp/store/llm.conf, for example: embed_base_url = http://localhost:11434/v1 embed_model = nomic-embed-text(or set EMBED_BASE_URL and EMBED_MODEL), then run: cheesedb embed <agent>也就是说,本次验证的是来源登记、依赖撤销、逐字节擦除和哈希链校验;没有验证向量索引、语义搜索排序,也没有验证 MCP 两次确认的完整交互。README 另写明,没有嵌入模型时,来源、记忆、撤销、擦除、校验、按 id 读取、列出存活记忆和 MCP 的其他工具仍可用,且不会向外发送数据。
清理
测试进程结束后,删除本次的 store/、bin/、gopath/、gocache/、venv/、images/ 和脚本,不保留本机副本;本次没有启动常驻服务,也没有改动仓库配置。~/.cheesedb 未被使用。上传到公开图床的图片不在此列。
边界
README 写明,依赖链由调用方声明:如果一条记忆确实来自某个来源、但没有写下对应的 leg,撤销该来源不会移除它。文件防篡改不等于不可篡改:能写文件的人可以改记录并重算后续哈希;verify 给出的是头部指纹,需要另外保存一份才能比对。项目仍是 preview,索引格式与磁盘格式可能变化,且尚未做独立安全审查。本篇的退出码与指纹只对应上面这次本机运行,不能推广到其他机器或更大规模的数据。