How brianluby/rusty-brain works
rusty-brain is a local-first memory service for AI coding agents, exposed through a CLI, MCP tools, and best-effort capture hooks. The main path sends a memory operation to the local daemon, where the engine enriches and embeds writes or performs hybrid recall against SQLite; recall combines keyword, vector, and graph signals into ranked results. Other documented capabilities include maintenance and review, optional loopback HTTP, portable operations, and agent-hook installation. Relationships below follow the README’s architecture and capability descriptions; unsampled internals are represented only at documented subsystem boundaries.
Main entry points: src/server.rs Daemon server · engine.rs Memory engine · cli.rs CLI · src/server.rs MCP server
Components 19
User Interfaces
- CLI
crates/rusty-brain/src/cli.rs - MCP server
crates/rb-mcp/src/server.rs - Capture hooks
crates/rb-hooks/src/capture.rs - Hook installer
crates/rb-install/src/engine.rs
Daemon Runtime
- Daemon server
crates/rb-daemon/src/server.rs - Loopback HTTP
crates/rb-daemon/src/http.rs - Socket protocol
crates/rb-proto/src/client.rs
Memory Processing
- Memory engine
crates/rb-engine/src/engine.rs - Memory enrichment
crates/rb-engine/src/enrich.rs - Embedding providers
crates/rb-embed/src/provider.rs - Hybrid retrieval
crates/rb-search/src/fusion.rs - Result ranking
crates/rb-search/src/rank.rs - Memory contracts
crates/rb-types/src/query.rs
Persistence
- SQLite memory store
crates/rb-store/src/store/core.rs
Operations
- Maintenance jobs
crates/rb-daemon/src/jobs/consolidation.rs - Runtime configuration
crates/rb-config/src/lib.rs - Import and export
crates/rusty-brain/src/import.rs
Other components
- CLI user
- MCP agent
Connections 19
- CLI user → CLI: uses
- MCP agent → MCP server: calls tools
- CLI → Daemon server: sends operations
- MCP server → Daemon server: proxies requests
- Capture hooks → Daemon server: captures via socket
- Hook installer → Capture hooks: installs hooks
- Daemon server → Memory engine: dispatches operations
- CLI → Socket protocol: uses socket client
- Socket protocol → Daemon server: sends framed requests
crates/rb-proto/src/client.rs - Loopback HTTP → Daemon server: serves local requests
crates/rb-daemon/src/http.rs - Memory engine → Memory enrichment: enriches writes
crates/rb-engine/src/engine.rs - Memory engine → Embedding providers: embeds memories
- Memory engine → SQLite memory store: stores and reads
- Memory engine → Hybrid retrieval: retrieves candidates
- Hybrid retrieval → Result ranking: fuses and ranks
- Result ranking → Memory contracts: returns results
- Daemon server → Maintenance jobs: runs maintenance
- Daemon server → Runtime configuration: resolves settings
crates/rb-config/src/lib.rs - CLI → Import and export: offers data operations