Memory Brain is a local-first personal memory service that keeps conversation lines verbatim in a traceable SQLite store, with a 3D memory view, a control panel and a DSH plugin.
- v0.2.12
- Published at
- 5d ago
- 198
- Stars
- 607
- Download
- Synced at
- 8h ago
Latest release
v0.2.12Nov 21, 2026, 11:56 AMREADME
Project Overview
Memory Brain turns the raw lines of a conversation into a local memory store you can trace back to its source, with storage, indexing and recall staying on your own machine. A Python service owns the SQLite database, /brain renders the 3D memory view while /panel holds the control panel, and a DSH plugin adapter folds retrieval results into the current request. Every message is kept verbatim with speaker, time, session and provenance, summaries and facts are derived asynchronously into a separate index, the service binds to localhost only, and other hosts can be attached through the same small HTTP protocol.
| Item | Value |
|---|---|
| Shape | Local HTTP service plus a DSH plugin |
| Kernel version | 0.2.0a17 |
| Storage | SQLite |
| Language | Python 3.10+ |
| License | AGPL-3.0 |
Verbatim records are the source of truth; summaries are only a way into them, and the two stay separate in the database.
Core Commands
init:python -m xiaojiu_brain --config ./private/config.json init --data-dir ./datacreates a dedicated data directoryserve: addserve --open-panelto the same command to start the local service and open the panelimport-legacy: migrates an oldbrain.db, printing a preview until you add--applyunittest:python -m unittest discover -s tests -p "test_*.py"runs the kernel suite andnode tests/test_plugin.mjschecks the adapter- Windows scripts:
install.cmd,open-panel.cmd,stop-brain.cmd,connect-dsh.cmdanddsh-compat-check.cmdwrap those steps as double-click entries
Key Features
- Verbatim storage: every message keeps speaker, timestamp, session and provenance, and is searchable the moment it lands without model rewriting
- Background derivation: batches of raw lines become summaries and facts in a separate index, while the originals are never overwritten
- Four-way recall: a natural question hits four base candidate paths plus one-hop
entity_relationcandidates, then ranking, deduplication and a read back of the original evidence - 3D memory view:
/brainplots the owner's memory index as cortex highlights and switches between the last 7, 30 or 90 days and all time - Control panel:
/panelshows service state, background jobs, degradation reasons and model status, and lets you write memories, change importance, pin or archive - Local life layer: rules-based sleep schedule, sourced life events, todos and local UTF-8 text books, off by default and kept out of the fact store
- Mood signals: optional PAD values decay by half-life, and the panel shows the basis and cooldown of each change
- Backup and export: online SQLite backup and JSON export, with an optional decay policy that only touches derived memories
- Semantic index: optional embedding models such as
bge-m3, indexed independently without waiting for derivation batches
Indexing and Derivation
Derivation runs in batches. Each batch holds at most 12 messages by default, roughly 6 complete turns, and when a batch never fills the maximum wait time triggers the model anyway. Raw lines are stored immediately, the vector index advances on its own, and neither waits for the other.
| Setting | Default | Range |
|---|---|---|
| Messages per batch | 12 | 1 to 12 |
| Maximum wait | 900 seconds | 30 to 86400 |
| Check interval | 5 seconds | 1 to 600 |
The memory view loads 200 records at a time, caps a page at 600 points and shows both the loaded count and the filtered total. Life-layer checks run every 1200 seconds by default, adjustable from 300 to 86400, with 08:00 and 23:30 as wake and rest times in the service time zone, and the daily digest is a deterministic roll-up of local records.
Target Audience
- Long-term AI companion users
- People who keep data local
- Writers who need quoted sources
- DSH host plugin users
- Developers building personal knowledge bases
Quick Start
- Install the kernel with
python -m pip install .; Python 3.10 or newer is required and 3.11 is recommended - Run
python -m xiaojiu_brain --config ./private/config.json init --data-dir ./datato create the database - Run
python -m xiaojiu_brain --config ./private/config.json serve --open-panelto start the service and open the panel - Fill in the model URL, model name and key environment variable in the setup card,
DEEPSEEK_API_KEYin the example; verbatim storage and lexical search work without any model - On Windows double-click
install.cmdto build the isolated environment, then point the DSH plugin manager at that folder withlink: - Before migrating an old store run
import-legacyfor a preview, then repeat with--apply
System Requirements
| Item | Requirement |
|---|---|
| OS | Windows 10/11 for the full first-run flow; Linux and macOS run the Python kernel, host installation unverified |
| Python | 3.10 or newer, 3.11 recommended |
| Embedding model | Optional, bge-m3 in the shipped example |
| Storage | SQLite, data directory kept apart from the code |
Notes
- Offline preparation: the isolated environment is only created when you click prepare, and that step downloads no Python and starts no collection
- Secrets: the admin passphrase is generated locally, and on Windows model keys are encrypted with the current user's DPAPI and never read back into the page
- Cross-session search off: recall defaults to the same owner and the same session, so cross-session retrieval must be enabled in the panel
- Batch delay: originals are searchable at once, while summaries and facts wait for 12 messages or the 900-second limit
- Legacy names: the
xiaojiu_brainpackage andXIAOJIU_*variables are kept for compatibility with existing installs and differ from the public name