Memnest
Start here

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 with scopeOf(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 reinforcementCount grows 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 runs shows 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

StateServed by search?Visible to a person?How it gets there
latestYesYesWritten, and nothing has replaced it
not-latestNoYes, as historyA newer version supersedes it
forgottenNoYes, as a hollow nodeforget(), by a person
expiredNoYesIts validUntil has passed
erasedNoNodeleteContainer(), 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.

new

Nothing similar exists.

"Priya wants incident updates by email."
duplicate

The same fact again: reinforce, don't duplicate.

"The team is still six engineers."
updates

A change: new version served, old one kept.

Postgres → MySQL
extends

More 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.