CheeseDB 发布可撤销记忆的智能体数据库

原标题:Show HN: CheeseDB – agent memory where deleting a source deletes what it taught
62AI 研判分

CheeseDB 是专为 AI 智能体记忆设计的嵌入式数据库,用 Go 标准库实现,采用追加写入与哈希链结构,让每条记忆都记录来源。删除某个来源时,由它衍生出的记忆会被一并撤销,从而应对错误数据、提示注入与用户数据删除请求。项目目前处于预览阶段,尚未经过独立安全审计,API 与磁盘格式在 v1.0 前可能变动,暂不建议用于生产数据。

报道正文

本文目录6 个章节

CheeseDB

A database engine purpose-built for AI memory. Native Go · Provenance-aware · Revocable · Embedded

Every memory knows its sources. Ask it anything in plain English. Recall a bad source, and everything learned from it goes too.

An embedded, append-only, hash-chained memory database for AI agents, written in Go with the standard library only. Use it from Go, from the cheesedb command, or from Claude Code, Cursor and other MCP apps.

Website: cheesedb.dev

Status: preview. cheesedb is in active development. It has not yet had an independent security review, and the API and on-disk format may change before v1.0, so it is not yet recommended for production data. See Limits and the changelog.

Why cheesedb

The problem

An agent's memory is built from sources it cannot fully trust: user messages, web pages, documents, tool results. Sooner or later one of them turns out to be:

  • wrong: a tool returned bad data;
  • malicious: a web page planted instructions or false facts (prompt injection, memory poisoning);
  • private: a user asks for their data to be deleted.

Deleting that source is not enough. Everything the agent learned from it stays in memory, and the agent keeps acting on it. A plain memory store cannot tell which memories came from where, so it cannot remove them. The demo shows this with a real LLM: after the bad source is deleted from a plain memory list, the model still gives the same wrong answer.

What cheesedb does

  • Every memory records its sources. A memory is stored with the sources (or other memories) it was learned from. The engine refuses a memory without one.
  • Recall removes exactly what depended on a source. One call removes the source and every memory built on it, however deep the chain goes. Memories that are still backed by another, independent source survive (Fair); or remove everything the source ever touched (Strict).
  • Ask it in plain English. With an embedding model of your choice, cheesedb finds memories by meaning (search), answers questions from them (ask), and forgets what you describe after you confirm (forget). A recalled memory is never found again. Without a model, everything else works the same.
  • Erase really erases. Recall(..., Erase) removes the text from the files on disk before it returns. cheesedb find searches the raw bytes to prove it.
  • The history cannot be edited silently. Every record is chained by hash to the one before. Damage or edits are detected on every open, and erasing text keeps the chain verifiable.
  • Agents are isolated by design. Each agent is reached only through its own token. No method takes another agent's name, so a prompt-injected tool holding one agent's handle has no way to reach another.
  • Embedded and dependency-free. A Go library and a folder on disk: no server, no external dependencies.

Why not SQLite, PostgreSQL or a graph database?

You can model sources and memories in SQL, or as a graph in Neo4j. We did both, to compare: the same data on all four engines, with the same durability (every write flushed to the physical disk before it is acknowledged).

Benchmarks with 1M memories per agent, median of 3 runs, on an Apple M1 Max (macOS, internal SSD), SQLite 3.53, PostgreSQL 17 and Neo4j Community 2026.10. Full results, method and caveats: BENCHMARKS.md; the raw output of the run: bench/results/v0.3.0.

cheesedbSQLitePostgreSQLNeo4j
Recall that removes 10,000 memories5.2 ms236 ms1.94 s68 ms
Recall that removes 20 memories4.9 ms7.2 ms10.1 ms6.5 ms
Read one memory by id1.8 µs7.4 µs59 µs211 µs
Durable write (one memory)4.6 ms5.5 ms6.8 ms6.1 ms
Startup, ready for the first query706 ms0.1 ms3.0 ms1.2 ms¹
Disk per memory314 B249 B546 B496 B
RAM per memory while open205 Bpage cache onlyshared buffers onlyJVM heap and page cache

¹ A new connection to a server that is already running; booting the Neo4j server took 6.5 to 8.2 s in an earlier run. PostgreSQL and Neo4j ran over TCP on localhost, which adds a round trip to each statement. We wrote the Neo4j model and queries ourselves, and an expert may do better.

  • Recall is where it wins. cheesedb keeps the dependency graph in memory and removes 10,000 memories with one write: about 13x faster than Neo4j, 45x faster than SQLite and 370x faster than PostgreSQL. The SQL versions run several statements for each affected memory. A graph database fits the job better, and Neo4j is the closest competitor, but it is still slower.
  • The rules live in the engine, not in your code. No memory without a source, no memory built on a recalled source, recalls are permanent, agents cannot see each other. With SQL or a graph database you write and test these yourself.
  • Erasure is built in. In a general database, a deleted row's bytes can stay in the files (free pages, the write-ahead log) until a vacuum or checkpoint. cheesedb's Erase rewrites the file without them before it returns.
  • Writes are about even, because the disk flush dominates for every engine.

When to use something else

  • You need SQL-style queries, filters or keyword search. cheesedb finds by id or by meaning. Keep other queries in your database, store only memory ids there, and check each result against cheesedb.
  • Startup time matters with very long histories. cheesedb replays its log when it opens an agent: about 0.7 s at 1M memories. SQLite opens instantly. Snapshots are planned.
  • An agent's memory does not fit in RAM. cheesedb keeps about 205 bytes per memory in memory, plus about 0.8 KB per searchable memory (768 values, one byte each).
  • You need production guarantees today. cheesedb is a preview; see Limits.

Install

文本
go get github.com/govinargo-labs/cheesedb                          # the library
go install github.com/govinargo-labs/cheesedb/cmd/cheesedb@latest  # the command

Requires Go 1.26.5 or newer. Developed and tested on macOS; Linux runs the same tests in CI. Windows is not supported yet.

(注:更多技术实现细节与完整 API 文档请查阅原项目 README)