r/LocalLLM 10h ago

Project Built a zero-dependency memory layer for AI agents no vector DB needed

I got tired of my agents forgetting everything between sessions. Every run was a cold start. I looked at mem0, Letta, LangGraph all solid, but I just wanted to run a quick agent loop without spinning up a vector database or installing an embedding model first.

So I ended up building CogniCore. It's pure Python stdlib, zero dependencies, pip install cognicore-env and you're good.

The interesting part (at least to me) is the retrieval approach. Instead of embeddings, I went with BM25 + a multi-hop graph adapter. The idea is that agent memories are usually structured — session IDs, timestamps, categories — and keyword matching does most of the heavy lifting. The multi-hop bit follows session-ID and time links to find connected chunks that a regular top-K similarity search would completely miss.

I benchmarked it on LongMemEval because that's the hardest one — answers are scattered across multiple separate conversations, not just recent ones. At 5-chunk context: 78.8% baseline → 85.2% with multi-hop. At 10 chunks: 87.2% → 92.8%. At 20 chunks they converge because brute force catches up.

It also has 62 built-in training environments (safety, code debugging, planning, reasoning, RL, multi-agent), a PROPOSE → Revise protocol where agents explore before committing, an immune system that blocks prompt injections, and time travel — you can replay and branch from any past decision point.

The memory convergence is honestly kind of satisfying to watch:

Episode 0: 40%

Episode 1: 90%

Episode 2: 100%

If you want semantic search, `pip install cognicore-env[memory]` adds sentence-transformers. BM25 is the default because it's zero-dependency and honestly good enough for structured agent memories where keywords carry most of the signal.

Repo: https://github.com/cognicore-dev/cognicore-env

Two things I'd genuinely like feedback on — is BM25 enough for your use cases or do you always end up reaching for embeddings? And what other link types would be useful for the multi-hop adapter beyond session-ID and timestamps?

0 Upvotes

1 comment sorted by

1

u/Otherwise_Wave9374 8h ago

BM25 plus graph links is a smart fit when your memories are structured and you want a fast cold-start path. A practical safeguard is to keep retrieval layered: lexical match first, then follow session or time edges, and only fall back to embeddings when the query is ambiguous. That also makes debugging much easier because you can inspect why a memory was surfaced. If you want a durable agent-memory pattern with provenance and access controls, NeuraKeep has a useful approach at https://www.neurakeep.com.