Brain4Agent
SparkofSpike
Long-term memory for agents in one SQLite file, with CJK-first BM25 retrieval and no model call in the core path.
What is Brain4Agent?
A Python memory store that keeps an agent's conversation turns in a single SQLite file and retrieves them by session with BM25, with Chinese, Japanese and Korean text working out of the box through character bigrams. The core makes no model calls, and a search reports evidence instead of a verdict: which question words the corpus never contained and which words a given session lacked. It ships a CLI, a Python library and an MCP server with seven tools, including supersede and unsupersede for correcting stored facts.
| Fact | Value |
|---|---|
| Maintainer | SparkofSpike |
| GitHub stars | 178 (as of 2026-12-02) |
| Forks | 26 |
| License | Apache-2.0 |
| License type | OSI-open |
| Category | Agent memory and code knowledge |
| Status | Rising |
| Edition | 2026-12 |
| Last verified | 2026-12-02 |
Brain4Agent in depth
Most agent memory layers lean on an embedding model and a vector database, which means an API key, a cold start and a bill, and they are tuned for English. Brain4Agent, from the GitHub account SparkofSpike, takes the opposite route: long-term memory in a single SQLite file, retrieved with plain BM25 and designed first for Chinese, Japanese and Korean text. Its README states the stance directly: no model in the core path, and evidence instead of confidence scores. The repository is only a few weeks old, but its decision log already runs to D-054, which shows how much of the work is measurement rather than marketing.
Technically, the store keeps each conversation turn as a row and retrieves whole sessions. CJK text is indexed with character bigrams plus, optionally, dictionary words from jieba, while queries use words only and drop interrogatives, a split the author measured across a three-by-three grid of strategies. A search does not just return a ranked list: it reports corpus_missing, the question words that appear nowhere in the stored corpus, and per-session missing_terms, so the calling agent can decide to say it does not know. Memories can carry tags, a superseded_by link for corrections and bitemporal valid_from and known_from windows. It ships as a CLI, a Python library and an MCP server with seven tools, plus an agent skill.
The natural audience is developers building coding or personal agents that need to remember why a decision was made, which approach failed and where a deployment lives, especially in Chinese-language workflows where English-tuned memory tools perform poorly. Because everything runs in-process with single-digit-millisecond queries and no accelerator, it also suits offline setups and anyone who wants memory behaviour they can inspect and reproduce. The bench directory imports the shipping code, so the figures in the README can be rerun rather than taken on trust.
The caveats are mostly ones the project states itself. It is a one-person repository with no issues and no outside contributors, three weeks old, with five tags and no GitHub releases, although version 0.2.0 is on PyPI. Retrieval is lexical, so paraphrases can be missed, and the README shows the Chinese hit@1 of 0.950 falling to 0.000 when 300 same-topic sessions are added, with reading the top five results, weighting corpus_missing over the raw score and tagging memories at write time as the suggested remedy. The in-memory index costs about 145 bytes per token, roughly 1.2 GB at 100k memories. The benchmark numbers, including the PrecisionMemBench table in which it ranks best of the third-party systems, are the project's own runs and measure retrieval, not LLM-judged answer quality.
The verdict: Brain4Agent is a small, carefully measured and unusually honest answer to a real gap, agent memory that works for CJK text without a model in the loop. Adopt it if you want an offline, inspectable memory layer and can live with lexical retrieval and a single maintainer. It is too early if you need semantic recall, a very large store or the assurance of a team behind the project, and the claims about how it compares with Mem0 and others should be checked on your own data before you rely on them.
Pros & Cons
Pros
- No model, API key or accelerator in the core path: BM25 over SQLite with single-digit-millisecond queries, so it runs fully offline and adds no inference cost
- Reports evidence (corpus_missing, missing_terms) instead of a confidence score, so the caller decides when to refuse to answer
- Unusually candid README: it documents where its own Chinese hit@1 of 0.950 collapses to 0.000 on dense same-topic corpora and ships the bench scripts to reproduce every number
Cons
- One maintainer and no issues or outside contributors yet; the repo is three weeks old with five tags (v0.0.1 to v0.2.0) and no GitHub Releases, though 0.2.0 is on PyPI
- Lexical retrieval only, no embeddings: it can miss paraphrases, and the project's own test shows near-duplicate sessions can swamp the right one
- The in-memory index is the ceiling: the README puts it at about 145 bytes per index token, roughly 1.2 GB at 100k memories
- Benchmark figures (LongMemEval hit@10 0.966, LoCoMo session hit@1 0.705, PrecisionMemBench 42/43) are the project's own runs and are retrieval rates, not LLM-judged answer accuracy
License
Apache-2.0 (OSI-open)
When it is interesting
Agent builders who want a small, offline, inspectable memory for Chinese, Japanese or Korean conversations without running an embedding model or a vector database.
When it is too early
If you need semantic recall over paraphrases, a very large memory store, or a project with more than one maintainer and an established track record.
Commercial alternative & related
- Commercial counterpart: Mem0
This repo featured in the 2026-12 edition of the Open-Source AI Radar.
claude-mem
thedotmack
Persistent memory layer across agent sessions with automatic semantic summaries and token-cost transparency.
graphify
safishamsi
AI coding skill that turns a folder of code, docs and images into a queryable knowledge graph across 20+ agents.
memU
NevaMind-AI
Memory framework for proactive AI agents - typed memory graph from chats, docs and media.