Concepts
Containers, documents, memories, relations, provenance, traces and profiles.
- container tag
- Whose memory this is:
user:123,customer:acme,project:billing. A hard boundary — nothing crosses between containers, in the engine or over HTTP. Every call takes a scope built withscopeOf(tag). - document
- Raw input: a conversation (
{ role, content }turns), markdown or text. Split into chunks, searchable immediately. - customId
- A stable id for a document. Re-sending with the same id makes a new version, and in batched mode documents sharing it form one session.
- memory
- One atomic, self-contained fact, with a kind (
fact,preference,episode), a confidence, an optional expiry, and links to the documents it came from. - latest / not-latest
- When a memory is updated the new version is latest; the old one is kept, and no longer served.
- forgotten
- A soft delete by a person. Out of search and profiles at once, still visible in history for audit.
- expiry
validUntil. "The meeting is at 3pm today" stops being served once it passes, without anyone deleting it.- reinforcement
- A fact stated twice is not stored twice: the existing memory's
reinforcementCountgrows and it gains another source. - provenance
- Every memory points back to the document and extraction run that produced it. Stores refuse a memory without one, direct writes included.
- extraction run
- The log of one extraction job: candidates, decisions with reasons, and rejections (redacted).
memnest runsshows them. - trace
- Returned by every search: each candidate's lexical and vector rank, fused score, token cost, and whether it was included or why not.
- profile
- A cached, prompt-ready summary of a container: durable facts plus recent activity, each line citing the memories it states.
A memory's states
| State | Served by search? | Visible to a person? | How it gets there |
|---|---|---|---|
| latest | Yes | Yes | Written, and nothing has replaced it |
| not-latest | No | Yes, as history | A newer version supersedes it |
| forgotten | No | Yes, as a hollow node | forget(), by a person |
| expired | No | Yes | Its validUntil has passed |
| erased | No | No | deleteContainer(), a hard delete |
How a new fact is resolved
For each candidate, Memnest retrieves up to 10 similar current memories and then decides. Identical text is caught without a model call, and a candidate with nothing similar is written as new without one either.
Nothing similar exists.
"Priya wants incident updates by email."The same fact again: reinforce, don't duplicate.
"The team is still six engineers."A change: new version served, old one kept.
Postgres → MySQLMore detail about the same thing.
"…and it runs in eu-west-1."If the model's answer is invalid, Memnest retries once and then writes the fact as new. A missed relation can be repaired later; a wrong updates would hide a true fact.
Errors
Every error is a MemnestError with a code: validation, not_found, scope_violation, provenance, configuration, provider, unauthorized. Over HTTP, asking for another container's row is 403 and a row that does not exist is 404, so another container's ids behave exactly like ids that were never there.