Documentation

Locamem

Local-first memory for AI agents. The entire memory is one SQLite file on your machine — sub-10ms recall, zero network calls, zero per-recall cost. MIT.

Quickstart

One line. No account, no keys. It installs the engine and wires an MCP server into your detected agent clients.

curl -fsSL https://locamem.com/install | bash

That creates a local store at ~/.locamem and registers an MCP server named locamem. Restart your agent client and ask it to remember something, then recall it.

Concepts

Two layers, both local

A working buffer holds the live session in RAM (short-term attention, cleared on exit). The store is one durable SQLite file that keeps worth-remembering facts across sessions — copy it, diff it, back it up, or delete it.

How retrieval works

Recall runs three local signals in parallel — SimHash (64-bit LSH) for content similarity, FTS5 full-text, and optional on-device embeddings — and returns hits with a per-facet score breakdown (content · keyword · salience · temporal). No network round trip, no API key, no per-call cost.

Temporal validity & contradictions

Nothing is destructively overwritten. When a new fact contradicts an old one, the old record is closed with a valid_to timestamp and the new one opens with valid_from — leaving a full audit trail of what changed and when.

On the roadmap: explicit memory typing (episodic / semantic / procedural), RRF rank-fusion, and a local cross-encoder rerank — all on-device, no cloud. Tracked in the repo.

MCP setup

Locamem ships an MCP server with two transports. The installer wires stdio automatically; both are shown here.

# stdio (Claude Code, Claude Desktop, Codex, Cursor, any MCP client)
claude mcp add locamem -- python -m locamem.mcp.server

# streamable-HTTP (one server, many clients) — bind to localhost
python -m locamem.mcp.server --transport http --port 3100
# then point any MCP client at http://127.0.0.1:3100/mcp

Tools exposed: locamem_crystallize (store), locamem_recall, locamem_recent, locamem_why_did_we, locamem_explain_connection, locamem_lattice_walk, locamem_invalidate, locamem_forget, locamem_wake_up, locamem_stats.

Note: the installed MCP server is named locamem, and the module runs as python -m locamem.mcp.server over either transport.

CLI

# initialize a store and add / recall memories
locamem init ~/.locamem
locamem crystallize "We deploy on Tue-Thu, never Fridays" --salience 4
locamem recall "when do we deploy"

Python API

# pip install locamem
from locamem import Crystal
m = Crystal.open("~/.locamem")
m.crystallize("Chose Postgres over Mongo for transactions", salience=4)
hits = m.recall("what database did we choose")   # local, sub-10ms, 0 API calls
for h in hits:
    print(h.score, h.memory.content)              # per-facet breakdown on each hit

Self-host (default)

There is nothing to host — the store is a single SQLite file under your home directory. For a shared instance, run the HTTP transport behind your own network. A Dockerfile + compose for a shared MCP server is on the roadmap.

Air-gapped

Disable the optional embedding-model download and any opt-in sync, and Locamem runs with the network physically cut — the same SimHash + FTS5 ranker, the same recall. Built for SCIFs, regulated VPCs, and offline laptops. See the benchmarks for the egress-free numbers.

Docs v1 — expanding. File issues or PRs at TeamWilcoe/locamem.