Memnest
Run it

Security and privacy

Container isolation, scoped keys, redaction and erasure.

Memory holds the most personal data an agent touches. These are the guarantees Memnest makes, and how each is tested.

A container is a hard boundary

Every store method takes a Scope; there is no unscoped query path. Over HTTP, the scope is resolved once in middleware from the API key, and handlers never read a container tag from the request body, path or query.

How it is tested. The store contract suite has one leakage probe per store method, keyed by the method list, so adding a method without a probe fails typecheck. The server suite calls every route with a key scoped to one container, and again with a session from that key, trying to reach another container through the path, query, body and ids. Both run on the in-memory, SQLite and Postgres stores.

Keys and sessions

  • Keys look like mnk_<id>_<secret>. Only an argon2id hash of the secret is stored (19 MiB, 2 iterations).
  • Unknown, wrong and revoked keys return the same error, and an unknown key id still costs a hash verification, so a key cannot be probed for existence by timing.
  • --container scopes a key to one container. Revoking a key also ends every session issued from it.
  • Dashboard sessions are random 256-bit tokens in an HttpOnly, SameSite=Strict, Secure cookie; only their SHA-256 is stored. Cookie-authenticated writes also require an x-memnest-csrf header, which a cross-site form cannot set.

Secrets never reach storage

Redaction runs before hashing, chunking or persistence, on content and metadata: JWTs, bearer tokens, sk-/rk- keys, AWS access key ids, GitHub tokens, Memnest's own keys, and "my password is …". Extraction candidates carrying one are rejected by the screen, whatever the model returned.

How it is tested. The suite ingests credential fixtures, then greps the raw SQLite file, its write-ahead log and shared memory for them. secure_delete is on, so tombstoned documents and deleted containers leave no residue on disk either.

Prompt injection

Memory is a place text you did not write ends up, so treat it as untrusted input to your prompts. Memnest narrows the blast radius:

  • The container is never a tool argument. In the MCP server it comes from configuration or the key's scope, so text the model reads cannot point the tools at another container.
  • Memories are atomic sentences, screened for pronouns and secrets, not raw pasted text.
  • Writes are recoverable. A bad memory can be forgotten, and everything it affected is traceable to the document it came from.
  • Read-only mode (--read-only) lets an assistant recall without being able to write at all.

Deletion

CallEffect
forget(scope, id)Soft delete: out of search and profiles at once, kept for audit.
deleteDocument(scope, id)Tombstone: content and chunks erased, the row kept so memories keep a traceable source.
deleteContainer(scope)Hard delete of everything in the container, including vectors. The path for an erasure request.

A scoped key may delete its own container: deleting your own data is exactly what that path exists for.

Where data goes

  • Self-hosted by default. SQLite on your machine, or your own Postgres. There is no Memnest service.
  • Model providers see what you send them. Extraction sends conversation text to your completion provider, and embeddings send chunk and memory text to your embedding provider. With Ollama, both stay local.
  • Partial graphs are never written. Writes run in a transaction, and a store without transactions refuses to write at all.

Not included yet

Rate limiting, CORS (serve the dashboard from the API's origin), and per-key permissions finer than container scope. Put a reverse proxy in front for the first two if you expose the server publicly.