The filing cabinet, one more time
In A Category Is an Event I argued that most agent memory ships a filing cabinet. An item arrives, gets a category once at write time, and carries that label forever, the same way it carries its id.
My claim was the opposite: a category is something that happens. It happens in a context, at a time, for a reason, and it can happen again, differently, tomorrow.
That post ended with an argument. This one ends with code. Tiramemsu, the embedded graph database I designed and built on SQLite in September, gives me a place to test whether the claim survives contact with a schema.
A triple cannot say anything about a triple
Take a memory: (alice, note, "met at the Lisbon offsite"). Now the agent decides it is a travel memory.
In a plain triple store that is one more triple, (memory, category, travel). But the subject is the memory, and the memory is itself a triple, which has no identity to point at. So you reach for reification, or an invented blank node, or you give up and write category into a property of the node. That last move is the filing cabinet again.
An event carries more than a value. It has a context (what was the agent doing?), a confidence, a time. Those are statements about the categorization, which is a statement about the memory. That is two levels of “about”, and a store that cannot name its own statements cannot take the first step.
Tiramemsu in thirty seconds
Tiramemsu is an embedded graph database on SQLite, with a Rust core and a typed Python binding (pip install tiramemsu, alpha). It speaks SPARQL and openCypher. Three properties matter here.
Every fact has its own id. A fact can carry a confidence, a source, or a belief about it, layer on layer.
It never forgets. The SQLite file rejects
DELETE. Forgetting means retracting, and the past stays exact.Two clocks. Every change records when the database learned it and when it was true in the world.
The first property answers the previous section. The other two turn out to matter more than I expected for categories, as the next two sections show. Source and docs are on GitHub.
A category is a statement about a statement
The memory is a statement. The category is a statement whose subject is that statement. The context and the confidence are statements about the category.
from tiramemsu import Database, Iri, Stmt
V = "urn:tiramemsu:v:"
alice, note, category, context, confidence = (
Iri(V + n) for n in ("alice", "note", "category", "context", "confidence")
)
db = Database("memory.db")
# 1. The memory, then the first categorization event, with its own layers.
with db.transact() as tx:
memory = tx.assert_(alice, note, "met at the Lisbon offsite")
cat = tx.assert_(memory, category, "travel")
tx.assert_(cat, context, "planning the next offsite")
tx.assert_(cat, confidence, 0.7)
memory_id = tx.report.asserted[0]
first_cat_id = tx.report.asserted[1]Nothing about “travel” lives on the memory. The memory is untouched.
Weeks later the agent is reconciling receipts. Same memory, a different question, so a new categorization event. The first one is not edited.
# 2. A second event, in another context.
with db.transact() as tx:
cat2 = tx.assert_(Stmt(memory_id), category, "expense")
tx.assert_(cat2, context, "reconciling travel receipts")
tx.assert_(cat2, confidence, 0.9)
second_cat_id = tx.report.asserted[0]Later still, we decide the first call was wrong. We correct it instead of overwriting it.
# 3. Correct the first event. Its layers follow the new statement.
with db.transact() as tx:
tx.supersede(first_cat_id, o="work-event")supersede replays the layers on the corrected statement, so the context and the confidence stay attached to the new category. The old one stays in history.
One memory, three questions
It helps to see why a single label is the wrong shape. Here is the same memory, met at the Lisbon offsite, met by three different questions. The rows are an illustration, not output from a run.
What the agent was doing
Category it assigns
Confidence
Why that category
Planning the next offsite
travel
0.7
The memory is about a place and a trip
Reconciling travel receipts
expense
0.9
The memory dates a cost
Preparing a team retrospective
team-event
0.6
The memory is about who was in the room
A filing cabinet has to pick one row, once, before it knows which question will come. It picks the most likely one at write time and the other two are lost to every query that needed them.
The event model keeps all three, and each is dated and carries its own context. None of them is more true than the others. They are answers to different questions, which is the point of the title.
The payoff: the history of how you categorized
With a field on the item, you can ask what the category is. With events, you can also ask how it got there.
# What did we believe right after the first transaction?
db.as_of(tx=1).triples(s=Stmt(memory_id), p=category)
# What do we believe now?
db.now().triples(s=Stmt(memory_id), p=category)
# Every categorization ever made, retracted and superseded ones included.
db.history().triples(s=Stmt(memory_id), p=category)Each returned statement carries t_add, t_ret and ret_kind, so you can see whether a category was retracted or superseded. This is the second clock doing something a filing cabinet cannot: it separates what the agent believed from when it believed it. The docs explain bitemporality in full.
There is a cost. If categories are events, the cheap move is to compute them when a question arrives, and that is slower than reading a label. Tiramemsu has a mechanism that looks like the right answer: saved answers. A saved query is marked stale when a statement it cited is retracted or superseded, and marked for recheck after other writes. A cached categorization would then say when it needs recomputing, instead of never knowing. I have not wired categorization into this yet.
Agreement and disagreement are first-class
When a category is a bare field, the only way to say “I am not sure” is another field. When it is a statement, the store already has verbs for belief.
Tiramemsu’s confirm(eid) records that another source agrees with a statement. If a second process, another agent, or the user independently lands on expense for the same memory, that is not a duplicate write. It is evidence on the existing categorization. Text recall already ranks hits by confidence, confirmations and authors, so agreement shows up in retrieval, not only in the audit log.
# Another source reaches the same conclusion about the second category.
with db.transact() as tx:
tx.confirm(second_cat_id)Disagreement has a verb too. view.conflicts(s=, p=) lists overlapping, distinct values for the same subject and predicate, with the evidence behind each statement, and writes nothing. For a categorization system this is a review queue: the places where the agent’s own past events pull in different directions. The earlier caveat applies, since two live categories in different contexts can be legitimate, but the tool is the right shape for the cases that are not.
Try a recategorization before you commit it
Recategorizing a whole memory store is the kind of change you want to rehearse. Tiramemsu gives you three tools for it.
A dry run reports what a transaction would do and commits nothing:
with db.transact(dry_run=True) as tx:
tx.supersede(first_cat_id, o="work-event")db.speculate(ops, queries) goes further. It applies changes hypothetically, runs your queries on the result, and keeps nothing. That is a direct way to ask “if I recategorize these memories, what would the agent retrieve for the retrospective question?” before the answer is real.
The third tool is about consequences. view.dependents(eid) returns the statements that stand on a given statement, which is what retracting it would cascade to. Retracting a category ends belief in it and every layer about it, so its context and confidence go with it. Retracting the memory itself ends belief in every categorization of it. The engine has a max_cascade limit, so a retraction that would touch too many statements fails instead of quietly deleting a large part of the graph.
This is a safety property the filing cabinet cannot offer. Overwriting a field has no preview and no blast radius you can inspect.
A categorization is a tiny decision trace
In The Book Was About Space. The Year Was About Why. I wrote that the industry’s new phrase, “decision trace”, quietly admits that what we want to store is histories of choices and consequences, not facts. I called that causal memory under another name.
A categorization event is the smallest decision trace there is. The agent chose a category, in a context, with some confidence, at a moment when it believed something. Later, something happened because of that choice: a memory was retrieved, an answer was given, a receipt was filed.
If the category is an event with its own id, the next step is natural. The consequence can point back at the choice that caused it. When an answer turns out wrong, you do not only correct the answer. You walk back to the categorization that surfaced the memory, and you can ask whether that was the mistake.
A label on an item cannot support that walk. There is nothing to point at. Once the category is a statement, the causal edge is one more statement about it.
This is the real reason I care about the question. Whether travel or expense sits on a memory matters little. What matters is whether the agent can later explain why it believed one of them, and find out what that belief cost.
Where it still hurts
Three open problems, because a model that only has upsides is a pitch.
- 1.
Two live categories look like a disagreement. Tiramemsu can review conflicts: overlapping, distinct values for the same subject and predicate. Two live categories on one memory are exactly that, yet here they are answers to two different questions. The context may belong in a named graph or in the predicate, not in a layer. I have not settled this.
- 2.
The database does not decide when an event fires. It records categorization well. Whether the agent should categorize again is a policy question, and the store has no opinion.
- 3.
I have no cost numbers yet. A label read is cheap. An event is a write, plus layers. How much slower that is, at what scale, is a benchmark I owe you.
The claim from the earlier post holds up so far: once a fact has its own id, a category stops being a property and becomes something you can date, contextualize, doubt and correct.
Next I want to look at the human side of the same problem: typed edges in Obsidian notes with Typed Graph, and what it takes to get a note’s links into a store like this.
Originally published on Sovereign Agentic AI on Substack.