Sophia MemoryPermanent, private memory for any LLM — that scales by disk, not RAM
Drop a permanent, encrypted memory layer behind any model. It stores facts once, recalls only the relevant ones, and keeps each call flat at ~20 tokens instead of re-sending the whole transcript. Runs on CPU. Memory grows on disk, not RAM.
$ pip install sophia-memory What it is
Memory that doesn't forget — and doesn't balloon.
Permanent memory
Facts persist across sessions — they don't fall out of a context window.
Encrypted at rest
The memory store is encrypted on disk. Private by default.
Runs on CPU
No GPU required. The memory layer is a lightweight library, not a model.
Behind any LLM
Drop it in front of OpenAI, Anthropic, a local model — provider-agnostic.
~20× fewer tokens
Recall a handful of relevant facts instead of re-sending the whole transcript.
Scales by disk, not RAM
Memory grows on disk. Your working set — and your bill — stays flat.
Why it's different
The two usual fixes both break. This one doesn't.
In long multi-turn tests, a sliding window forgets old facts and a strategy of stuffing the full history blows up the token count. Sophia Memory recalled old facts at 100% recall@1 while holding each call flat at ~20 tokens — ~20× fewer than re-stuffing history. These are measured proof-of-mechanism numbers from controlled long-context tests, not a SOTA leaderboard claim.
| approach | recall of old facts | tokens / call |
|---|---|---|
| Sliding window (forgets) | 33% — drops old facts | bounded |
| Stuffing full history | high, then blows up | grows every turn |
| Sophia Memory | 100% recall@1 of old facts | flat ~20 / call |
Memory scales by disk, not RAM — the working set stays flat as the store grows.
Compositional framework (CLM)
Route → specialist + memory → any LLM.
Memory is one piece of a larger compositional layer: a trainable Router picks the right Specialist Composer, which assembles the specialist together with recalled memory and hands the result to any LLM.
| layer | what it does | availability |
|---|---|---|
| Router | Picks the right specialist for an incoming request. | open · MIT |
| Specialist Composer | Assembles specialist + memory, then hands off to any LLM. | open · MIT |
| Memory layer | Permanent, encrypted, disk-backed recall. | open · MIT |
| Sealed specialist units | Production-trained domain experts. | SOPHIA XT |
| Production-trained router | The high-accuracy router head we ship in production. | SOPHIA XT |
| Anchor-token harvesting | The data pipeline behind the specialists. | SOPHIA XT |
Open-core. The framework — Router, Specialist Composer, and the memory layer — is open under MIT. The proprietary layer (sealed specialist units, the production-trained router, and anchor-token data-harvesting) is SOPHIA XT's closed offering.
Quickstart
Install, add a memory, recall it.
pip install sophia-memoryfrom sophia import Memory
mem = Memory() # encrypted, on-disk, CPU-only
mem.add("My name is Dana. I prefer metric units.")
print(mem.recall("What's my name?")) # -> the stored fact, not the whole historyfrom sophia import Memory, chat
mem = Memory()
mem.add("The project deadline is March 14.")
# chat() recalls the relevant memories and injects them into ANY LLM
answer = chat("when is the deadline?", memory=mem, model="gpt-4o-mini")
print(answer) # "The project deadline is March 14."You recall a handful of relevant facts and inject them into the call instead of re-sending the full transcript — that's where the ~20× token savings come from.
Research
The papers behind the framework.
The compositional layer is documented in three papers. Read them in the papers folder on GitHub, or browse the broader SOPHIA research index.
Give your LLM a memory that lasts.
MIT-licensed and free for any use. If it saves you tokens, a star or a coffee keeps the project moving.