Memory that
thinks over time.
Extract facts from conversations, deduplicate and supersede them over time. Hybrid semantic + BM25 retrieval. User profiles. MCP server. A clean Python API.
Fact Extraction
LLM-backed extraction from conversation turns. OpenRouter by default. No API key required for tests.
Temporal Validity
Facts are superseded, not deleted. Answer 'what did we know before?' with full historical context.
Hybrid Search
FAISS semantic recall + BM25 rerank, fused with confidence and recency scores.
User Profiles
Incremental O(1) profile updates on every add(). Always up-to-date agent context.
Entity Graph
Optional NetworkX graph of entities and relationships built automatically from memory.
MCP Server
Six tools for Cursor, Claude Desktop, or any MCP client. Stdio transport, drop-in config.
Up and running
in minutes.
Works without an API key in test mode — uses a random embedder and stores raw conversation as a single fact. Drop in your OpenRouter key for full extraction and dedup.
import asyncio
from anima import Config, Memory
async def main():
mem = Memory(config=Config.from_env())
await mem.add(
"User: I moved to Berlin last week.",
user_id="alice"
)
result = mem.search(
"Where does Alice live?",
user_id="alice"
)
print(result.injected_prompt)
page = mem.list("alice", limit=20)
print(f"{len(page.items)} of {page.total} memories")
asyncio.run(main())Conversation Turn
Pass a raw conversation string with a user_id. Works offline with no API key.
LLM Extraction
Facts extracted via OpenRouter. Contradictions detected and old facts superseded.
Hybrid Index
Embeddings stored in FAISS. BM25 index updated. Confidence and recency tracked.
Profile Update
User profile updated incrementally in O(1). Entity graph edges added.
Search & Inject
Hybrid FAISS + BM25 retrieval with confidence decay. Returns injected_prompt ready for your LLM.
Python API
mem.add()Extract and store from conversationmem.search()Hybrid recall + injected promptmem.list()Paginated memory listingmem.pin()Mark permanent — no decay/TTLmem.export()Full JSON snapshotmem.import_memories()Restore from exportEnv Config
OPENROUTER_API_KEYLLM extraction + profilesDATABASE_URLSQLite or PostgreSQL URLVECTOR_STORE_PATHFAISS index directoryDECAY_RATE_PER_WEEK0.05 defaultEMBEDDING_DIM1536 — match your modelStructured memory for
every AI agent.
Free and open-source. Hybrid retrieval, temporal supersession, MCP server. Plug into any Python agent in minutes.
uv add anima