An enterprise-grade hybrid storage engine designed for infinite, structured agentic memory. Integrates high-dimensional pgvector semantic searches, Neo4j topological relationships, and a low-latency Redis event bus with celery orchestration.
Quickstart • The Paradigm Shift • CLI Reference • Architecture • Subsystems • API Reference • Comparison Matrix • Roadmap
Autonomous agent swarms fail when their memory systems are fragmented. Semantic vector indexes are excellent at matching fuzzy phrases but fail at structural taxonomy (e.g., retrieving related components or tracking organizational hierarchy). Graph databases match connections perfectly but lack fuzzy conceptual search.
OmniMem bridges this divide by presenting a unified, high-performance hybrid memory system:
- Graph-Vector Convergence: Integrates pgvector semantic matching and Neo4j graph schemas to query and update both layers atomically.
- Asynchronous Ingestion: Utilizes Celery task queues backed by Redis to parse massive datasets, files, and codebases in the background.
- Canary-Token Security Firewall: Enforces a strict schema verification boundary (
security_contract.py) that filters out canary leak vectors, persona hijacks, and prompt injections. - Idempotent IPC WAL: Provides a transactional Write-Ahead Log wrapper with cross-platform OS file locks to ensure zero write loss under heavy concurrency.
- Python 3.11+
- Docker & Docker Compose
- uv (recommended for rapid dependency syncing)
git clone https://github.com/axtontc/OmniMem.git
cd OmniMem
# Sync virtual environment using uv
uv syncRun the 38-spec test suite locally (includes mocks for Redis, databases, and WAL logs):
uv run python -m pytest tests/ -vStart the entire database and networking stack (PostgreSQL with pgvector, Neo4j, Redis, workers, and FastAPI application) in Docker container mode:
omnimem upSpawns the local web server hosting ingestion and search HTTP endpoints:
omnimem server --port 8000Launches the asynchronous ingestion worker cluster:
omnimem workerflowchart TD
Client[External Agents / Swarms] -->|REST API Ingest| API[FastAPI Gateway]
API -->|Redis Event Bus| Bus[Redis Pub-Sub]
API -->|Enqueue Ingestion| TaskQueue[(Redis Broker)]
TaskQueue --> Worker[Celery Worker Cluster]
subgraph Ingestion Pipeline
Worker -->|1. Generate Embeddings| Pg[(PostgreSQL + pgvector)]
Worker -->|2. Map Entity Taxonomy| Graph[(Neo4j Database)]
end
API -->|Fuzzy Semantic Search| Pg
API -->|Topological Query| Graph
style API fill:#1a1a2e,stroke:#3776AB,color:#fff
style Bus fill:#16213e,stroke:#3776AB,color:#fff
style Worker fill:#16213e,stroke:#3776AB,color:#fff
style Pg fill:#2ea043,stroke:#2ea043,color:#fff
style Graph fill:#2ea043,stroke:#2ea043,color:#fff
| Subsystem | Folder / File | Responsibility |
|---|---|---|
| API Interface Gateway | omnimem/api.py |
FastAPI server hosting /search, /search_graph, and /ingest endpoints |
| CLI Entrypoint | omnimem/cli.py |
CLI route handling (up, server, worker routing commands) |
| pgvector Storage Layer | omnimem/pgvector_layer.py |
Database initializer, embedding search index creator, and Postgres writer |
| Neo4j Graph Layer | omnimem/neo4j_layer.py |
Connects bolt drivers and performs keyword-based topological subgraph retrievals |
| Write-Ahead Log (WAL) | omnimem/wal.py & ipc_wal.py |
Asynchronous file-locked transactional logging with idempotency keys |
| Canary Security Boundary | omnimem/security_contract.py |
Rigid validation models filtering Canary leakage, hijacks, and prompt injections |
| Queue Workers | omnimem/tasks.py |
Asynchronous Celery routines writing to graph and vector engines |
These functions handle vector-embedding relational storage:
| Function / Method | Parameters | Description |
|---|---|---|
MemoryDB.create(dsn) |
str |
Class method initializing database pools and creating the semantic_memory tables. |
search_semantic_memory(embedding, limit, max_distance) |
List[float], int, float |
Queries cosine similarity via HNSW index returning matching memory structures. |
These routines drive Neo4j graph storage and traversal:
| Function / Method | Parameters | Description |
|---|---|---|
Neo4jDatabase.execute_query(query, params) |
str, dict |
Runs arbitrary queries and transaction parameters asynchronously. |
search_graph(keywords, limit) |
List[str], int |
Runs Cypher queries matching node IDs containing keywords along with neighboring relationships. |
Provides transactional persistence guarantees:
| Function / Method | Parameters | Description |
|---|---|---|
FileLock.acquire() |
None | Cross-platform OS-level lock (msvcrt on Windows, fcntl on Unix) with timeouts. |
AsyncWAL.append(data, txid) |
dict, str |
Logs data asynchronously, flushing in batches to disk under file locking. |
| Feature | Standard PG | neo4j-only | pgvector-only | OmniMem |
|---|---|---|---|---|
| Semantic Ingestion Queue | ❌ | ❌ | ❌ | ✅ Yes (Celery + Redis) |
| Graph-Vector Joint Storage | ❌ | ❌ | ❌ | ✅ Yes (PgVector + Neo4j) |
| Canary Protection Firewall | ❌ | ❌ | ❌ | ✅ Yes (security_contract.py) |
| Transactional Write Lock | ✅ Yes (Cross-platform WAL) | |||
| Query Latency | Variable | <10ms | <5ms | ⚡ High performance (<5ms vector, <10ms graph) |
- API Engine: FastAPI / Uvicorn
- Task Queue: Celery / Redis
- Relational/Vector DB: PostgreSQL + pgvector
- Graph DB: Neo4j (bolt transport)
- Testing & Lints: pytest (with fakeredis), Ruff, mypy
- Model Inference: sentence-transformers (
all-MiniLM-L6-v2)
- Dual storage engine mapping (pgvector + Neo4j)
- Redis-based event bus publishing
- Pydantic-based Canary and Injection validation models
- Celery asynchronous batch pipeline ingestion
- Cross-platform file locking and Async WAL manager
- Dynamic Graph Construction — Automate node extraction from raw embeddings using LLM relationship discovery tasks
- WAL Compact Compaction — Implement CRDT Tombstones memory compaction on logs
- Kubernetes Helm Charts — Production-ready deployment manifest files for AWS/GCP clusters
OmniMem is the backbone memory storage provider for the Antigravity Swarm ecosystem:
| Project | Description |
|---|---|
| AUI | Zero-latency cross-process UI automation for Windows and Web |
| MemMCP | Stdio-transport memory server using SQLite WAL and FAISS RRF |
| The-Skillbrary | FastMCP skill execution server and registry |
| Multiverse-Planner | Brute-forces optimal plans via timeline expansion and pruning |
| Fractal-Swarm-v2 | Mathematically optimal state-machine agent swarm orchestration |
| AntiMem | SQLite compactor and local daemon mapping memories into context |
| The-Sentinel-Reviewer | Code quality gatekeeper running static audits, tests, and deep traces |
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details. Copyright (c) 2026 Axton Carroll.
⭐ If OmniMem helps scale your enterprise memory storage, consider giving it a star!
Built by Axton Carroll — "Nothing is impossible, we merely don't know how to do it yet."
