Skip to main content
Glama
orneryd

M.I.M.I.R - Multi-agent Intelligent Memory & Insight Repository

by orneryd
system-design.mdโ€ข14.3 kB
# NornicDB Architecture **Version:** 0.1.4 **Last Updated:** December 1, 2025 ## Overview NornicDB is a **drop-in replacement for Neo4j** designed for LLM agent memory systems. It maintains full compatibility with Mimir's existing API while providing: - **MCP Server** - Native LLM tool integration (6 tools) - **Auto-Embedding** - Server-side embedding for vector queries - **GPU Acceleration** - 10-100x speedup (Metal/CUDA/OpenCL/Vulkan) - **Hybrid Search** - RRF fusion of vector + BM25 ## System Architecture Diagram ```mermaid %%{init: {'theme':'dark', 'themeVariables': { 'darkMode': true }}}%% graph TB subgraph Client["๐ŸŒ Client Layer"] Neo4jDriver["Neo4j Driver<br/>(JavaScript/Python/Go)"] HTTPClient["HTTP/REST Client"] MCPClient["MCP Client<br/>(Cursor, Claude, etc.)"] end subgraph Security["๐Ÿ”’ Security Layer"] TLS["TLS 1.3 Encryption"] Auth["Authentication<br/>โ€ข Basic Auth<br/>โ€ข JWT tokens<br/>โ€ข RBAC (Admin/ReadWrite/ReadOnly)"] end subgraph Protocol["๐Ÿ“ก Protocol Layer"] BoltServer["Bolt Protocol<br/>:7687"] HTTPServer["HTTP/REST<br/>:7474"] MCPServer["MCP JSON-RPC<br/>/mcp endpoint<br/>โ€ข store/recall/discover<br/>โ€ข link/task/tasks"] end subgraph Embedding["๐Ÿง  Embedding Layer"] EmbedQueue["Embed Worker<br/>โ€ข Pull-based processing<br/>โ€ข Chunking (512/50 overlap)<br/>โ€ข Retry with backoff"] EmbedCache["Embedding Cache<br/>โ€ข LRU (10K default)<br/>โ€ข 450,000x speedup"] EmbedService["Embedding Service<br/>โ€ข Ollama/OpenAI/Local GGUF<br/>โ€ข String query auto-embed"] end subgraph Processing["โš™๏ธ Query Processing (CPU)"] CypherParser["Cypher Parser<br/>โ€ข Multi-line SET with arrays<br/>โ€ข Parameter substitution"] QueryExecutor["Query Executor<br/>โ€ข MATCH/CREATE/MERGE<br/>โ€ข Vector procedures<br/>โ€ข String auto-embedding"] TxManager["Transaction Manager<br/>โ€ข WAL durability<br/>โ€ข ACID guarantees"] end subgraph Storage["๐Ÿ’พ Storage Layer"] BadgerDB["BadgerDB Engine<br/>โ€ข Streaming iteration<br/>โ€ข LSM-tree storage"] Schema["Schema Manager<br/>โ€ข Vector indexes<br/>โ€ข BM25 fulltext indexes<br/>โ€ข Unique constraints"] Persistence["Persistence<br/>โ€ข Write-ahead log<br/>โ€ข Incremental snapshots"] end subgraph GPU["๐ŸŽฎ GPU Acceleration"] GPUManager["GPU Manager<br/>โ€ข Metal (Apple Silicon)<br/>โ€ข CUDA (NVIDIA)<br/>โ€ข OpenCL/Vulkan"] VectorOps["Vector Operations<br/>โ€ข Cosine similarity<br/>โ€ข Batch processing<br/>โ€ข K-Means clustering"] end subgraph Search["๐Ÿ” Search & Indexing"] VectorSearch["Vector Search<br/>โ€ข HNSW index O(log n)<br/>โ€ข GPU-accelerated"] FulltextSearch["BM25 Search<br/>โ€ข Token indexing<br/>โ€ข Prefix matching"] HybridSearch["Hybrid RRF<br/>โ€ข Vector + BM25 fusion<br/>โ€ข Adaptive weights"] end %% Client connections Neo4jDriver --> TLS HTTPClient --> TLS MCPClient --> TLS %% Security flow TLS --> Auth Auth --> BoltServer Auth --> HTTPServer Auth --> MCPServer %% MCP to embedding MCPServer --> EmbedService MCPServer --> QueryExecutor %% Embedding flow EmbedService --> EmbedCache EmbedCache --> EmbedQueue EmbedQueue --> Storage %% Protocol to processing BoltServer --> CypherParser HTTPServer --> CypherParser CypherParser --> QueryExecutor QueryExecutor --> EmbedService QueryExecutor --> TxManager TxManager --> BadgerDB %% Storage interactions BadgerDB --> Schema BadgerDB --> Persistence Schema --> VectorSearch Schema --> FulltextSearch %% GPU acceleration VectorSearch --> GPUManager GPUManager --> VectorOps VectorOps --> VectorSearch %% Hybrid search VectorSearch --> HybridSearch FulltextSearch --> HybridSearch %% Styling classDef clientStyle fill:#1a5490,stroke:#2196F3,stroke-width:2px,color:#fff classDef securityStyle fill:#7b1fa2,stroke:#9C27B0,stroke-width:2px,color:#fff classDef protocolStyle fill:#0d47a1,stroke:#2196F3,stroke-width:2px,color:#fff classDef embedStyle fill:#00695c,stroke:#009688,stroke-width:2px,color:#fff classDef processingStyle fill:#1b5e20,stroke:#4CAF50,stroke-width:2px,color:#fff classDef storageStyle fill:#e65100,stroke:#FF9800,stroke-width:2px,color:#fff classDef gpuStyle fill:#880e4f,stroke:#E91E63,stroke-width:2px,color:#fff classDef searchStyle fill:#004d40,stroke:#009688,stroke-width:2px,color:#fff class Neo4jDriver,HTTPClient,MCPClient clientStyle class TLS,Auth securityStyle class BoltServer,HTTPServer,MCPServer protocolStyle class EmbedQueue,EmbedCache,EmbedService embedStyle class CypherParser,QueryExecutor,TxManager processingStyle class BadgerDB,Schema,Persistence storageStyle class GPUManager,VectorOps gpuStyle class VectorSearch,FulltextSearch,HybridSearch searchStyle ``` ## Design Philosophy **NornicDB = Smart Storage. Mimir = Intelligence Layer.** | NornicDB Does | Mimir Does | |---------------|------------| | Store nodes/edges with embeddings | File discovery and reading | | Vector similarity search | VL image descriptions | | BM25 full-text search | PDF/DOCX text extraction | | Auto-embed string queries | Multi-agent orchestration | | GPU-accelerated operations | Content-to-text conversion | | MCP tool interface | Chunk strategy decisions | ## Data Flow ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MIMIR โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ File Indexer โ”‚โ”€โ”€โ”€โ–บโ”‚ Content โ†’ Text โ”‚โ”€โ”€โ”€โ–บโ”‚ Graph Operations โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Discovery โ”‚ โ”‚ โ€ข VL โ†’ images โ”‚ โ”‚ โ€ข CreateNode โ”‚ โ”‚ โ”‚ โ”‚ โ€ข .gitignore โ”‚ โ”‚ โ€ข PDF โ†’ text โ”‚ โ”‚ โ€ข CreateEdge โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Filtering โ”‚ โ”‚ โ€ข DOCX โ†’ text โ”‚ โ”‚ โ€ข Search โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ Cypher/Bolt โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ NORNICDB โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Protocol Layer: Bolt :7687 | HTTP :7474 | MCP /mcp โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ–ผ โ–ผ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Cypher โ”‚ โ”‚ Embedding โ”‚ โ”‚ MCP Tools โ”‚ โ”‚ โ”‚ โ”‚ Executor โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ Service โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ 6 tools โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Parse โ”‚ โ”‚ โ€ข Auto-emb โ”‚ โ”‚ โ€ข store โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Executeโ”‚ โ”‚ โ€ข Cache โ”‚ โ”‚ โ€ข recall โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Vector โ”‚ โ”‚ โ€ข Queue โ”‚ โ”‚ โ€ข discoverโ”‚ โ”‚ โ”‚ โ”‚ procs โ”‚ โ”‚ โ”‚ โ”‚ โ€ข link โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ€ข task(s) โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Storage: BadgerDB + WAL + Vector Index + BM25 Index โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ## API Compatibility ### Protocol Support | Operation | Protocol | Port | Status | |-----------|----------|------|--------| | Cypher queries | Bolt | 7687 | โœ… | | HTTP/REST | HTTP | 7474 | โœ… | | MCP Tools | JSON-RPC | 7474/mcp | โœ… | | Authentication | Basic/JWT | Both | โœ… | ### Vector Search Features | Feature | Neo4j GDS | NornicDB | |---------|-----------|----------| | Vector array queries | โœ… | โœ… | | String auto-embedding | โŒ | โœ… | | Multi-line SET with arrays | โŒ | โœ… | | Native embedding field | โŒ | โœ… | | Server-side embedding | โŒ | โœ… | | GPU acceleration | โŒ | โœ… | | Embedding cache | โŒ | โœ… | ## Core Components ### MCP Server (`pkg/mcp`) LLM-native tool interface with 6 tools: ``` store - Create/update knowledge nodes recall - Retrieve by ID, type, tags, date discover - Semantic search with graph traversal link - Create relationships between nodes task - Create/update tasks with status tasks - Query tasks by status/priority ``` ### Embedding Layer (`pkg/embed`) - **Pull-based worker** - Processes nodes without embeddings - **Chunking** - 512 chars with 50 char overlap - **LRU Cache** - 10K entries, 450,000x speedup for repeated queries - **Providers** - Ollama, OpenAI, Local GGUF ### Cypher Executor (`pkg/cypher`) - **Vector Procedures** - `db.index.vector.queryNodes` with string auto-embedding - **Multi-line SET** - Arrays and multiple properties in single SET - **Native embedding** - Routes `embedding` property to `node.Embedding` field ### Search Service (`pkg/search`) - **Vector** - HNSW index, GPU-accelerated similarity - **BM25** - Full-text with token indexing - **Hybrid RRF** - Reciprocal Rank Fusion of both ### GPU Acceleration (`pkg/gpu`) | Backend | Platform | Performance | |---------|----------|-------------| | Metal | Apple Silicon | Excellent | | CUDA | NVIDIA | Highest | | OpenCL | Cross-platform | Good | | Vulkan | Cross-platform | Good | ## Configuration ### Environment Variables ```bash # Server NORNICDB_HTTP_PORT=7474 NORNICDB_BOLT_PORT=7687 # MCP (disable with false) NORNICDB_MCP_ENABLED=true # Embedding NORNICDB_EMBEDDING_ENABLED=true NORNICDB_EMBEDDING_API_URL=http://localhost:11434 NORNICDB_EMBEDDING_MODEL=mxbai-embed-large NORNICDB_EMBEDDING_DIMENSIONS=1024 NORNICDB_EMBEDDING_CACHE_SIZE=10000 # Auth (default: disabled) NORNICDB_AUTH=admin:password ``` ### CLI ```bash # Start with defaults ./nornicdb serve # Custom ports ./nornicdb serve --http-port 8080 --bolt-port 7688 # Disable MCP ./nornicdb serve --mcp-enabled=false # With auth ./nornicdb serve --auth admin:secret ``` ## File Structure ``` nornicdb/ โ”œโ”€โ”€ cmd/nornicdb/ # CLI entry point โ”œโ”€โ”€ pkg/ โ”‚ โ”œโ”€โ”€ nornicdb/ # Main DB API โ”‚ โ”œโ”€โ”€ mcp/ # MCP server (6 tools) โ”‚ โ”œโ”€โ”€ embed/ # Embedding service + cache โ”‚ โ”œโ”€โ”€ storage/ # BadgerDB + WAL โ”‚ โ”œโ”€โ”€ search/ # Vector + BM25 + RRF โ”‚ โ”œโ”€โ”€ cypher/ # Query parser/executor โ”‚ โ”œโ”€โ”€ bolt/ # Bolt protocol โ”‚ โ”œโ”€โ”€ server/ # HTTP server โ”‚ โ”œโ”€โ”€ auth/ # Authentication/RBAC โ”‚ โ”œโ”€โ”€ gpu/ # GPU backends โ”‚ โ”‚ โ”œโ”€โ”€ metal/ # Apple Silicon โ”‚ โ”‚ โ”œโ”€โ”€ cuda/ # NVIDIA โ”‚ โ”‚ โ”œโ”€โ”€ opencl/ # Cross-platform โ”‚ โ”‚ โ””โ”€โ”€ vulkan/ # Cross-platform โ”‚ โ”œโ”€โ”€ index/ # HNSW vector index โ”‚ โ”œโ”€โ”€ linkpredict/ # Topological link prediction โ”‚ โ”œโ”€โ”€ inference/ # Auto-relationship engine โ”‚ โ”œโ”€โ”€ decay/ # Memory decay system โ”‚ โ”œโ”€โ”€ temporal/ # Temporal data handling โ”‚ โ””โ”€โ”€ retention/ # Data retention policies โ”œโ”€โ”€ data/ # Persistence directory โ”œโ”€โ”€ ui/ # React admin UI โ””โ”€โ”€ docs/ # Documentation ``` ## Testing ```bash # All tests cd nornicdb && go test ./... -count=1 # Specific package go test ./pkg/mcp/... -v # Benchmarks go test ./pkg/search/... -bench=. # Integration tests go test ./pkg/mcp/... -run Integration ``` --- _See also: [Vector Search Guide](../user-guides/vector-search.md) | [User Guides](../user-guides/) | [API Reference](../api-reference/)_

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/orneryd/Mimir'

If you have feedback or need assistance with the MCP directory API, please join our Discord server