Skip to content

Repository files navigation

brAIn

brAIn logo: neuroscience-inspired memory system for AI agents

AI platforms are adding memory, but it stays siloed inside each tool. brAIn gives agents a shared, structured memory modeled after the human brain: working, episodic, semantic, procedural, and contact memory, all in a single portable .brain file that works across Cursor, Claude Code, Codex, Gemini CLI, and more.

Episodic memory diagram
Episodic memory accumulated during the development of go-debug-skill.

Key features:

  • 5-type neuroscience-inspired memory — working, episodic, semantic, procedural, contact
  • Built-in consolidation (the "sleep cycle") — memories decay, promote, and emerge automatically
  • Semantic similarity search via embeddings
  • Agent-agnostic — works with Cursor, Claude Code, Codex, Gemini CLI, and other AI editors
  • Background daemon for automatic memory processing
  • Emergent skills — the agent learns how to do things from interaction

See Why brAIn for the full picture.

Demo

Demo.mov

Prerequisites

  • Go with CGO (for the SQLite driver). No database server required.
  • LLM connection (Ollama) required for consolidation, conversation encoding, and profile analysis. Read-only operations (query memories, list contacts) work without an LLM. The daemon requires an LLM to run. See LLM Integration and Environment variables.
  • brain-daemon for automatic background processing (install via brain install-service).

Quick start

  1. Install: run make install.
  2. Use: use any supported agent (Cursor, Claude Code, Codex, Gemini CLI, etc.); the agent uses brAIn when configured (see AI Editor Integration). The agent runs brain context at the start of each turn and brain encode after responding so memories stay in sync.
  3. Introduce yourself: when the agent asks who you are, say your name (e.g. "Hi! I'm Guillaume") so it can remember you across sessions.

Data directory (~/.brain)

After installation, brAIn uses a single directory under your home. Here is what lives there:

File or directory Purpose
agent.brain The main brain store: a single SQLite database holding all memory (working, episodic, semantic, procedural, contacts). Created by brain init; this is the only file you might want to back up manually.
config Optional daemon/config file. Key-value pairs (e.g. consolidation_interval = 10m, llm_model = ..., source_path = ...). Edit to change consolidation/profile intervals, LLM/embed models, or auto-update. See Configuration.
daemon.log Log output from the background daemon (consolidation, profile runs, ingest). Rotated by size; older files are kept as daemon.log.YYYYMMDD-HHMMSS.
brain.log Log output from CLI invocations (e.g. brain context, brain encode). Uses size-based rotation (lumberjack).
daemon.state.json Daemon bookkeeping (e.g. start count, last start time). Used by the service; safe to leave as-is.
backups/ Directory for timestamped backups created by brain backup (e.g. agent.brain.20250222-143022).
logs/ If the daemon manages Ollama, its stdout/stderr is written here (e.g. logs/ollama.log).

See Configuration and Daemon for details.

Documentation

If you want to… Read
Understand the model Why brAIn, How it maps to the brain
Compare with CLAUDE.md / AGENTS.md brAIn vs. static instruction files
Understand the lifecycle From short-term to long-term, Consolidation
Integrate AI Editor Integration, Daemon
Social memory & trust Social Memory
Agent loop & ingestion Agent inference loop, Conversation ingestion
Backup or move the brain Backup and restore
Fix problems or FAQ Troubleshooting
Browse all docs Documentation index
Reference & develop Configuration, CLI, SQLite, Reference (tests, example, project layout)

Running tests and example

make test
go run ./cmd/example/

See Reference for project layout, CLI vs daemon, and development (pre-commit hook, running the example).

About

An embedded, active, neuroscience-inspired memory system for AI agents

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages