# Anamnema: an open-source memory for Claude Code where every note keeps its source lines

> Source: <https://discuss.huggingface.co/t/anamnema-an-open-source-memory-for-claude-code-where-every-note-keeps-its-source-lines/192495#post_1>
> Published: 2026-11-24 19:30:04+00:00

**Recommendation:** Store agent memory outside the model as source-linked notes in a graph with vector search, and inject them through hooks before requests and actions so conversation-only facts survive context resets.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

Anamnema is a self-hosted memory layer for Claude Code, under Apache-2.0. An assistant that works with the same person for months starts again at every context reset; Anamnema keeps the history outside the model.

**Notes with their source.** A small local model (Gemma 4 12B, QAT Q4_0, one 8 GB card is enough) reads the conversation and writes short notes, each with a pointer to the exact lines it came from.

**Storage and search.** Notes live in a graph with vector search (Neo4j); e5-small-v2 encodes and an ms-marco MiniLM-L6 reranker orders, both on the CPU.

**Delivery.** What fits comes back through Claude Code’s hooks: before a request, before an action, when a name is mentioned.

**Correction.** A doubtful note is checked against its source lines and corrected, and the archived record stays as it was.

**A measurement**, taken on the system Anamnema was copied from: 15 new questions, each asked in two fresh sessions with the memory on and two with it off. The off sessions could still read the project’s documents and code. Where a file held the answer, they mostly found it. For the 4 questions whose answer had only ever been said in conversation, all 8 answers were right or partly right with the memory, and at most one was partly right without it. Small numbers, one user, and two LLM judges, one of them the same model as the system.

It installs on one Debian 13 machine. I would value criticism of the evaluation, and reports from anyone who tries it.

This post was written with AI tools, like much of the project; Aura and Elian, the AI assistants who built it with me, are named in the paper.
