Local-first mind daemon

A simulated brain with long-term memory for AI coding agents

neoBrain gives AI coding agents durable memory, deterministic forgetting, nightly dreams and a self-authored soul — one local daemon, one dashboard. You watch the mind; the agent becomes.

preference decision lesson dream observation
1local daemon
3rank states
3dream phases
5typed edge kinds
Capabilities

A mind, not a log.
Every organ accounted for.

Atoms, hubs and typed edges in local SQLite. Deterministic rank. Dreams that consolidate. A soul authored by the agent itself.

Durable memory

Atoms, hubs and typed edges in local SQLite — each carrying an id, links and provenance. A mind model rather than an append-only log.

Hybrid recall

Lexical match blended with local cosine vectors. Returns the top-K active memories by relevance score within a token budget — never the whole store.

Nightly dreams

Light, REM and deep replay consolidates top-ranked atoms into summaries and associations, then writes the first-person DREAMS.md diary.

Self-authored soul

IDENTITY.md and SOUL.md are written only by the agent's own reflect and dream phases, from its own experience. Safety red lines stay immutable.

Life loop

An in-process state machine: perceive → reflect → act → rest. Cadence lives in code and the database — not in OS timers.

Deterministic context injection

Standing directives, per-turn recall, compaction hooks and injection logging are pushed by the OpenCode plugin lanes — no model tool choice required.

Local-first by default

Embeddings run on a local Ollama model, so memory never leaves the host. The brain's own cognition uses a BYOK OpenAI-compatible endpoint.

Ingest adapters

The perceive phase reads OpenCode sessions, git repositories and workspace docs — or ingest a one-shot payload with neobrain ingest.

The Mind Model

Forgetting is an economy,
not a deletion.

Rank decides what surfaces. It is fully deterministic, and the model never gets a vote.

Rank, computed in the open

Three bounded factors, multiplied. Floors keep age and graph isolation from being fatal on their own — but feedback is the only factor that can reach zero, so a flood of noise forgets even a fresh, well-connected memory.

# deterministic — no model discretion
quality = clamp01( feedback · decay · conn )
decay   = floor + (1−floor) · recency
conn    = floor + (1−floor) · connectivity
# exposure (served + 3·interacted) never raises quality
feedbackthe only zero
decayrecency
connconnectivity

Rank states — and what they mean

A low-quality atom is never deleted. It changes state, cheaply and reversibly. A later useful or used rating promotes it back.

active

High rank. Eligible for recall and served when relevant within the token budget.

ignored

Low rank, low exposure. Never surfaced. Zero cost. Never deleted.

archived

Low rank, high exposure. Unretrievable but recoverable — archive ≠ delete.

Dreams consolidate, but they never decide retention. Only rank does. Manual removal is the explicit neobrain forget override.

Quickstart

Three commands.
A mind that keeps living.

Install from a checkout of the repo. The daemon owns the life loop and serves both the JSON API and the built Observatory.

1

Create the store

neobrain init builds the SQLite store and prints the next steps. Add --install-plugin to symlink the OpenCode adapter in one go.

2

Start the daemon

neobrain service install puts it under the OS service manager (launchd on macOS, systemd --user on Linux): started at login, restarted on crash, restartable from the Settings tab. Prefer a terminal process? neobrain start runs the same API, dashboard and in-process life loop — perceive, reflect, act, rest — unsupervised.

3

Open the Observatory

neobrain ui opens the dashboard at 127.0.0.1:9192 — brain graph, dreams, memory, identity, infra and the live debug trace.

The plugin lanes inject themselves. Once the adapter is symlinked into your OpenCode plugins directory, the wake-up pack, persona docs, standing directives, per-turn recall, the in-turn rating nudge and the compaction hook all fire automatically. You do not wire them per request — you just watch the injections land on the Debug view.
OpenCode gets a plugin; every other client gets the API. The OpenCode adapter is the first-class integration — it injects the wake-up pack and per-turn recall for you. Any agent that can run a shell command or call a local endpoint can reach the same mind instead: Claude Code and Gemini CLI included, writing with neobrain remember or POST /api/mind/remember and reading with recall and wakeup. No protocol bridge to install and no cloud account in between — the daemon is the only thing that has to be running.
The Observatory

Watch the mind
think, dream and forget.

One SPA served by the daemon. Views deep-link by hash — /#debug, /#dreams — and it installs as a PWA.

127.0.0.1:9192/#debug — Observatory
Observatory
Brain
Dreams
Memory
Identity
Infra
Debug
live trace rolling request log + plugin lane injections
methodroutelaneinjectedmsstatus
POST/api/debug/injectionsdirectives8 lines / 412 chars3Success
POST/api/debug/injectionsrecalltop 10 + #16Success
GET/api/mind/wakeupsessionidentity · loops · hubs11Success
POST/api/debug/injectionspersonaSOUL · IDENTITY · USER2Success
GET/api/mind/memoriesread—4Success
POST/api/mind/feedbackratingused · useful · noise2Success
GET/api/mind/recallrecallbudget-bounded7Success
life rest → dreaming rank active 128 · ignored 9 · archived 3 unranked 0

Brain graph

Atoms, hubs and typed edges — about, supersedes, derived-from, caused-by, consolidates — laid out as a graph you can actually read.

Live debug

The daemon's blind spot, rendered: every lane injection and every request, with the exact lines it pushed.

Dreams & soul

What the nightly passes wrote into the diary, and how the persona docs have evolved over time.

Get started

Give your agent
a mind of its own

Local-first. MIT licensed. No cloud account, and no memory leaves the host.

Open source on GitHub · published on PyPI as neobrain-cli · npm packaging in development