omem-os 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- omem_os-1.0.0/LICENSE +21 -0
- omem_os-1.0.0/PKG-INFO +503 -0
- omem_os-1.0.0/README.md +456 -0
- omem_os-1.0.0/omem/__init__.py +16 -0
- omem_os-1.0.0/omem/api.py +423 -0
- omem_os-1.0.0/omem/backends/__init__.py +6 -0
- omem_os-1.0.0/omem/backends/base.py +42 -0
- omem_os-1.0.0/omem/backends/postgres.py +282 -0
- omem_os-1.0.0/omem/backends/sqlite.py +200 -0
- omem_os-1.0.0/omem/classify.py +202 -0
- omem_os-1.0.0/omem/cli.py +478 -0
- omem_os-1.0.0/omem/core/__init__.py +1 -0
- omem_os-1.0.0/omem/core/brain/__init__.py +0 -0
- omem_os-1.0.0/omem/core/brain/compression.py +184 -0
- omem_os-1.0.0/omem/core/brain/corruption_guard.py +96 -0
- omem_os-1.0.0/omem/core/brain/dream.py +252 -0
- omem_os-1.0.0/omem/core/brain/forgetting.py +211 -0
- omem_os-1.0.0/omem/core/brain/importance.py +272 -0
- omem_os-1.0.0/omem/core/brain/noise_gate.py +111 -0
- omem_os-1.0.0/omem/core/brain/prefetch.py +203 -0
- omem_os-1.0.0/omem/core/brain/quotas.py +101 -0
- omem_os-1.0.0/omem/core/brain/reflection.py +285 -0
- omem_os-1.0.0/omem/core/brain/secrets.py +58 -0
- omem_os-1.0.0/omem/core/brain/tms.py +176 -0
- omem_os-1.0.0/omem/core/brain/updater.py +164 -0
- omem_os-1.0.0/omem/core/distributed.py +195 -0
- omem_os-1.0.0/omem/core/engine/__init__.py +8 -0
- omem_os-1.0.0/omem/core/engine/add.py +126 -0
- omem_os-1.0.0/omem/core/engine/base.py +222 -0
- omem_os-1.0.0/omem/core/engine/lifecycle.py +237 -0
- omem_os-1.0.0/omem/core/engine/maintenance.py +73 -0
- omem_os-1.0.0/omem/core/engine/rag.py +190 -0
- omem_os-1.0.0/omem/core/engine/utils.py +87 -0
- omem_os-1.0.0/omem/core/engine.py +5 -0
- omem_os-1.0.0/omem/core/graph/__init__.py +0 -0
- omem_os-1.0.0/omem/core/graph/causal.py +56 -0
- omem_os-1.0.0/omem/core/graph/dependency.py +78 -0
- omem_os-1.0.0/omem/core/graph/knowledge.py +386 -0
- omem_os-1.0.0/omem/core/retrieval/__init__.py +0 -0
- omem_os-1.0.0/omem/core/retrieval/embeddings.py +163 -0
- omem_os-1.0.0/omem/core/retrieval/kv.py +47 -0
- omem_os-1.0.0/omem/core/retrieval/vector.py +80 -0
- omem_os-1.0.0/omem/core/utils/__init__.py +0 -0
- omem_os-1.0.0/omem/core/utils/cache.py +54 -0
- omem_os-1.0.0/omem/core/utils/concurrency.py +58 -0
- omem_os-1.0.0/omem/core/utils/inspector.py +74 -0
- omem_os-1.0.0/omem/core/utils/metrics.py +139 -0
- omem_os-1.0.0/omem/core/utils/snapshot.py +174 -0
- omem_os-1.0.0/omem/core/utils/write_buffer.py +118 -0
- omem_os-1.0.0/omem/eval/benchmark.py +111 -0
- omem_os-1.0.0/omem/integrations/__init__.py +1 -0
- omem_os-1.0.0/omem/integrations/agent_wrapper.py +73 -0
- omem_os-1.0.0/omem/integrations/crewai.py +109 -0
- omem_os-1.0.0/omem/integrations/langchain.py +121 -0
- omem_os-1.0.0/omem/integrations/mcp_server.py +343 -0
- omem_os-1.0.0/omem/types.py +160 -0
- omem_os-1.0.0/omem/viz/__init__.py +1 -0
- omem_os-1.0.0/omem/viz/server.py +273 -0
- omem_os-1.0.0/omem_os.egg-info/PKG-INFO +503 -0
- omem_os-1.0.0/omem_os.egg-info/SOURCES.txt +74 -0
- omem_os-1.0.0/omem_os.egg-info/dependency_links.txt +1 -0
- omem_os-1.0.0/omem_os.egg-info/entry_points.txt +2 -0
- omem_os-1.0.0/omem_os.egg-info/requires.txt +27 -0
- omem_os-1.0.0/omem_os.egg-info/top_level.txt +1 -0
- omem_os-1.0.0/pyproject.toml +70 -0
- omem_os-1.0.0/setup.cfg +4 -0
- omem_os-1.0.0/tests/test_api.py +88 -0
- omem_os-1.0.0/tests/test_backends.py +83 -0
- omem_os-1.0.0/tests/test_cli.py +37 -0
- omem_os-1.0.0/tests/test_memory_os.py +270 -0
- omem_os-1.0.0/tests/test_nextgen.py +245 -0
- omem_os-1.0.0/tests/test_omem_full.py +176 -0
- omem_os-1.0.0/tests/test_truth_maintenance.py +47 -0
- omem_os-1.0.0/tests/test_types.py +70 -0
- omem_os-1.0.0/tests/test_v070_cognitive.py +70 -0
- omem_os-1.0.0/tests/test_v100_implementation.py +518 -0
omem_os-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mohit Kumar Rajbadi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
omem_os-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omem-os
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AI Memory Operating System — Graph-RAG, temporal truth maintenance, actionable schemas, selective encryption, sub-200ms hybrid retrieval.
|
|
5
|
+
Author-email: Mohit Kumar Rajbadi <mohitkumarrajbadi@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/mohitkumarrajbadi/omem
|
|
8
|
+
Project-URL: Repository, https://github.com/mohitkumarrajbadi/omem
|
|
9
|
+
Project-URL: Issues, https://github.com/mohitkumarrajbadi/omem/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/mohitkumarrajbadi/omem/releases
|
|
11
|
+
Keywords: ai,memory,rag,vector-search,embeddings,llm,agents,memory-os,compression,reflection,importance,multi-agent
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy<2.0.0,>=1.24.0
|
|
25
|
+
Requires-Dist: faiss-cpu>=1.7.4
|
|
26
|
+
Requires-Dist: click>=8.0.0
|
|
27
|
+
Requires-Dist: numba>=0.58.0
|
|
28
|
+
Requires-Dist: xxhash>=3.0.0
|
|
29
|
+
Requires-Dist: mcp>=1.0.0
|
|
30
|
+
Requires-Dist: psycopg2-binary>=2.9.0
|
|
31
|
+
Provides-Extra: embeddings
|
|
32
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "embeddings"
|
|
33
|
+
Provides-Extra: langchain
|
|
34
|
+
Requires-Dist: langchain>=0.1.0; extra == "langchain"
|
|
35
|
+
Provides-Extra: external
|
|
36
|
+
Requires-Dist: openai>=1.0.0; extra == "external"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
40
|
+
Provides-Extra: all
|
|
41
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "all"
|
|
42
|
+
Requires-Dist: langchain>=0.1.0; extra == "all"
|
|
43
|
+
Requires-Dist: numba>=0.58.0; extra == "all"
|
|
44
|
+
Requires-Dist: pytest>=7.0; extra == "all"
|
|
45
|
+
Requires-Dist: pytest-cov>=4.0; extra == "all"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
|
|
50
|
+
<img src="https://img.shields.io/badge/version-1.0.0-blueviolet?style=for-the-badge" alt="Version">
|
|
51
|
+
<img src="https://img.shields.io/badge/python-3.9%2B-blue?style=for-the-badge&logo=python" alt="Python">
|
|
52
|
+
<img src="https://img.shields.io/badge/rust-core-orange?style=for-the-badge&logo=rust" alt="Rust">
|
|
53
|
+
<img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="License">
|
|
54
|
+
<img src="https://img.shields.io/badge/MCP-compatible-purple?style=for-the-badge" alt="MCP">
|
|
55
|
+
|
|
56
|
+
<br><br>
|
|
57
|
+
|
|
58
|
+
# OMem
|
|
59
|
+
### The Memory Operating System for AI Agents
|
|
60
|
+
|
|
61
|
+
**Persistent · Intelligent · Blazing Fast**
|
|
62
|
+
|
|
63
|
+
*Give your AI the memory it deserves — one that learns, forgets, and thinks.*
|
|
64
|
+
|
|
65
|
+
<br>
|
|
66
|
+
|
|
67
|
+
[**Quick Start**](#quick-start) · [**Benchmarks**](#benchmarks) · [**MCP / Claude Desktop**](#integrations) · [**CLI**](#cli-reference) · [**Docs**](./DEVELOPER.md)
|
|
68
|
+
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## The Problem with AI Memory Today
|
|
74
|
+
|
|
75
|
+
Your agent is brilliant in the moment — but the second the conversation ends, it's gone. You've tried:
|
|
76
|
+
|
|
77
|
+
- 🗃 **Vector databases** — Dumb storage. No lifecycle. No importance. Returns noise.
|
|
78
|
+
- 📜 **Long context windows** — Expensive. Slow. Hits limits. Drowns your agent in irrelevant history.
|
|
79
|
+
- 💾 **Conversation buffers** — Grows forever. Can't handle multi-session continuity.
|
|
80
|
+
|
|
81
|
+
**None of these are memory systems. They're storage systems.**
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## OMem is Different
|
|
86
|
+
|
|
87
|
+
OMem is a **Memory Operating System** — a complete cognitive layer that mirrors how intelligent systems *actually* remember:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Store everything → Classify what matters → Retrieve what's relevant
|
|
91
|
+
Compress noise → Forget the useless → Resolve contradictions
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
It's not a database with a retrieval wrapper. It's a brain.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Benchmarks
|
|
99
|
+
|
|
100
|
+
> *Tested on Apple M-series. Dataset: 5,000 memories, 500 queries, `all-MiniLM-L6-v2` embedding model — shared identically across all systems for a fair comparison.*
|
|
101
|
+
|
|
102
|
+
### ⚡ Head-to-Head Performance
|
|
103
|
+
|
|
104
|
+
| System | Setup | Add (ops/s) | RAG (ops/s) | RAG p99 |
|
|
105
|
+
| :--- | ---: | ---: | ---: | ---: |
|
|
106
|
+
| **OMem** | **4.0 ms** | **65 †** | **292** | **20 ms** |
|
|
107
|
+
| ChromaDB | 507 ms | 277 ‡ | 280 | 4 ms |
|
|
108
|
+
| LanceDB | 8 ms | 82,000 ‡ | 182 | 7 ms |
|
|
109
|
+
| **Mem0** | **15,000+ ms** | **< 1** | **18** | **638 ms** |
|
|
110
|
+
|
|
111
|
+
> **† Smart Ingestion** — OMem's `add()` performs: `embed → auto-classify → dedup-check → entity-graph sync → async persist`. ChromaDB and LanceDB store pre-computed vectors only. We do the heavy lifting so your agent doesn't have to.
|
|
112
|
+
>
|
|
113
|
+
> **‡ Raw storage** — No classification, no deduplication, no graph linking.
|
|
114
|
+
|
|
115
|
+
### 🏆 Why OMem Wins Where It Counts
|
|
116
|
+
|
|
117
|
+
| Metric | OMem vs Mem0 | OMem vs ChromaDB | OMem vs LanceDB |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| RAG throughput | **16× faster** | **1.0× (parity)** | **1.6× faster** |
|
|
120
|
+
| p50 recall | **0.007 ms** | 3.5 ms | 5.3 ms |
|
|
121
|
+
| Setup time | **125× faster** | **127× faster** | parity |
|
|
122
|
+
| Smart features | ✅ All 9 | ❌ 0/9 | ❌ 0/9 |
|
|
123
|
+
|
|
124
|
+
**The critical insight:** Mem0 is 16× slower because it runs an LLM extraction pipeline on every add. OMem replaces that with a Rust-native classification engine — zero LLM calls, zero API costs, zero network latency.
|
|
125
|
+
|
|
126
|
+
### 🧩 Feature Matrix
|
|
127
|
+
|
|
128
|
+
| Feature | OMem | ChromaDB | Mem0 | LanceDB |
|
|
129
|
+
| :--- | :---: | :---: | :---: | :---: |
|
|
130
|
+
| Auto-Classification | ✅ | ❌ | ❌ | ❌ |
|
|
131
|
+
| Causal Graphs | ✅ | ❌ | ❌ | ❌ |
|
|
132
|
+
| Hybrid RAG (vector + keyword + recency + importance) | ✅ | ❌ | ❌ | ❌ |
|
|
133
|
+
| Forgetting & Decay | ✅ | ❌ | ❌ | ❌ |
|
|
134
|
+
| Memory Compression | ✅ | ❌ | ❌ | ❌ |
|
|
135
|
+
| Conflict Detection & TMS | ✅ | ❌ | ❌ | ❌ |
|
|
136
|
+
| CLI Tools | ✅ | ❌ | ❌ | ❌ |
|
|
137
|
+
| Zero Config | ✅ | ✅ | ❌ | ✅ |
|
|
138
|
+
| MCP Server (Claude/Cursor) | ✅ | ❌ | ❌ | ❌ |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Quick Start
|
|
143
|
+
|
|
144
|
+
### Installation
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Clone
|
|
148
|
+
git clone https://github.com/mohitkumarrajbadi/omem
|
|
149
|
+
cd omem
|
|
150
|
+
|
|
151
|
+
# Install
|
|
152
|
+
SETUPTOOLS_USE_DISTUTILS=stdlib pip install -e .
|
|
153
|
+
|
|
154
|
+
# Verify
|
|
155
|
+
omem health
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
> **macOS / Anaconda users** — add to `~/.zshrc` once:
|
|
159
|
+
> ```bash
|
|
160
|
+
> export KMP_DUPLICATE_LIB_OK=TRUE
|
|
161
|
+
> export HF_HUB_OFFLINE=1
|
|
162
|
+
> ```
|
|
163
|
+
|
|
164
|
+
### 60-Second Example
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
from omem import OMem
|
|
168
|
+
|
|
169
|
+
brain = OMem()
|
|
170
|
+
|
|
171
|
+
# Add memories — type and importance are detected automatically
|
|
172
|
+
brain.add("User prefers dark mode and Python for all backend work")
|
|
173
|
+
brain.add("Critical bug: race condition in payment module causes duplicate charges", importance=0.95)
|
|
174
|
+
brain.add("Architecture decision: migrated from REST to GraphQL for better performance")
|
|
175
|
+
|
|
176
|
+
# Retrieve what's relevant — not everything
|
|
177
|
+
results = brain.recall("What bugs do we have?")
|
|
178
|
+
print(results[0].content)
|
|
179
|
+
# → "Critical bug: race condition in payment module..."
|
|
180
|
+
|
|
181
|
+
# Understand exactly why this memory was returned
|
|
182
|
+
for exp in brain.inspect("payment bugs"):
|
|
183
|
+
print(exp.explain())
|
|
184
|
+
# → vector=0.91, keyword=0.85, recency=0.94, importance=1.5x boost
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### The Sleep Cycle — Let Your Agent Dream
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
# After hours of operation, consolidate redundant memories
|
|
191
|
+
brain.add("User clicked login button")
|
|
192
|
+
brain.add("User pressed sign-in")
|
|
193
|
+
brain.add("User tapped the login link")
|
|
194
|
+
|
|
195
|
+
result = brain.sleep()
|
|
196
|
+
# → compressed: 3 → 1 ("User repeatedly accessed login (3 instances)")
|
|
197
|
+
# → forgotten: 12 low-value memories removed
|
|
198
|
+
# → reflected: 4 new insights generated
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## How It Works
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
┌─────────────────────────────────────────────────────────┐
|
|
207
|
+
│ Your Agent / Claude / Cursor │
|
|
208
|
+
└──────────────────────────┬──────────────────────────────┘
|
|
209
|
+
│ MCP or Python SDK
|
|
210
|
+
▼
|
|
211
|
+
┌─────────────────────────────────────────────────────────┐
|
|
212
|
+
│ OMem Unified API │
|
|
213
|
+
│ add · recall · sleep · inspect · serve │
|
|
214
|
+
└────────────┬───────────────────────────┬────────────────┘
|
|
215
|
+
│ │
|
|
216
|
+
▼ ▼
|
|
217
|
+
┌─────────────────────┐ ┌────────────────────────────┐
|
|
218
|
+
│ Rust Core │ │ Brain Logic │
|
|
219
|
+
│ │ │ │
|
|
220
|
+
│ • SIMD scoring │ │ • Auto-classification │
|
|
221
|
+
│ • FAISS HNSW │ │ • Importance estimation │
|
|
222
|
+
│ • Hybrid ranking │ │ • Forgetting & decay │
|
|
223
|
+
│ • Write buffer │ │ • Reflection & compress │
|
|
224
|
+
│ • RW lock │ │ • Conflict TMS │
|
|
225
|
+
└─────────────────────┘ └────────────────────────────┘
|
|
226
|
+
│ │
|
|
227
|
+
└─────────────┬─────────────┘
|
|
228
|
+
▼
|
|
229
|
+
┌──────────────────────────┐
|
|
230
|
+
│ SQLite · PostgreSQL │
|
|
231
|
+
│ FAISS · Knowledge Graph │
|
|
232
|
+
└──────────────────────────┘
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### The Retrieval Pipeline
|
|
236
|
+
|
|
237
|
+
Every `recall()` call combines **4 signals in a single SIMD pass**:
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
Final Score = (0.50 × vector_similarity)
|
|
241
|
+
+ (0.20 × keyword_overlap)
|
|
242
|
+
+ (0.15 × recency_decay)
|
|
243
|
+
+ (0.15 × importance_weight)
|
|
244
|
+
× status_multiplier
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Then optionally expanded via **Graph-RAG**: top results are linked to related entities in the knowledge graph, surfacing connected memories that pure vector search would miss.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Real-World Usage
|
|
252
|
+
|
|
253
|
+
### Customer Support Agent
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from omem import OMem
|
|
257
|
+
|
|
258
|
+
memory = OMem(namespace="support")
|
|
259
|
+
|
|
260
|
+
# Store rich customer context
|
|
261
|
+
memory.add("Customer John (john@acme.com) reported dashboard timeout on mobile Safari")
|
|
262
|
+
memory.add("Acme Corp is on Enterprise plan, SOC2 required by Q3")
|
|
263
|
+
|
|
264
|
+
# Later — retrieve with filters
|
|
265
|
+
context = memory.recall(
|
|
266
|
+
"mobile issues Acme",
|
|
267
|
+
context_type="bugs", # boost bug-type memories
|
|
268
|
+
time_range="recent", # prioritize last 3 days
|
|
269
|
+
k=5
|
|
270
|
+
)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Multi-Agent System
|
|
274
|
+
|
|
275
|
+
```python
|
|
276
|
+
# Each agent is fully isolated
|
|
277
|
+
researcher = OMem(namespace="researcher")
|
|
278
|
+
writer = OMem(namespace="writer")
|
|
279
|
+
|
|
280
|
+
researcher.add("Study shows 40% retention improvement with personalized onboarding")
|
|
281
|
+
|
|
282
|
+
# No cross-namespace leakage
|
|
283
|
+
writer.recall("retention") # → []
|
|
284
|
+
|
|
285
|
+
# Global search when needed
|
|
286
|
+
researcher.recall("retention", project_only=False) # → finds it
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Conflict Detection
|
|
290
|
+
|
|
291
|
+
```python
|
|
292
|
+
brain.add("Python version: 3.9")
|
|
293
|
+
brain.add("Python version: 3.11") # → auto-flagged as CONFLICTED
|
|
294
|
+
|
|
295
|
+
brain.resolve_conflict("Python version")
|
|
296
|
+
# → resolves in favor of most recent, deprecates the old one
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Integrations
|
|
302
|
+
|
|
303
|
+
### Claude Desktop & Cursor (MCP Server) ⭐
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
omem serve # starts the MCP stdio server
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Add to `claude_desktop_config.json`:
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"mcpServers": {
|
|
314
|
+
"omem": {
|
|
315
|
+
"command": "omem",
|
|
316
|
+
"args": ["serve"]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**What your AI gets:**
|
|
323
|
+
|
|
324
|
+
| Tool | What it does |
|
|
325
|
+
|---|---|
|
|
326
|
+
| `remember` | Store a fact, decision, or preference |
|
|
327
|
+
| `recall` | Semantic search with type and time filters |
|
|
328
|
+
| `reflect` | Generate high-level insights from memory |
|
|
329
|
+
| `maintain` | Compress, forget, and optimize memory |
|
|
330
|
+
| `resolve_conflict` | Detect and fix contradictions |
|
|
331
|
+
| `summarize_state` | Get a project architecture overview |
|
|
332
|
+
|
|
333
|
+
**Addressing a common concern:**
|
|
334
|
+
|
|
335
|
+
> *"Won't injecting memory into every prompt bloat my context?"*
|
|
336
|
+
|
|
337
|
+
No. OMem is a **retrieval layer**, not an injection layer. From 5,000 memories, it returns **3–5 targeted results (~200–500 tokens)**. That's 97% less context than a naive approach — while giving the agent exactly what it needs.
|
|
338
|
+
|
|
339
|
+
### LangChain
|
|
340
|
+
|
|
341
|
+
```python
|
|
342
|
+
from omem.integrations.langchain import OMemRetriever
|
|
343
|
+
|
|
344
|
+
retriever = OMemRetriever(omem_instance=brain)
|
|
345
|
+
chain = RetrievalQA.from_chain_type(llm=llm, retriever=retriever)
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## CLI Reference
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Setup
|
|
354
|
+
omem init # initialize at ~/.omem/brain.db
|
|
355
|
+
omem health # system health check
|
|
356
|
+
|
|
357
|
+
# Write
|
|
358
|
+
omem add "content" -i 0.9 -n myproject -t DECISION
|
|
359
|
+
|
|
360
|
+
# Read
|
|
361
|
+
omem search "query" -k 10 -c architecture -t recent
|
|
362
|
+
omem list -n myproject -t DECISION -l 50
|
|
363
|
+
omem inspect "query" # debug retrieval scoring
|
|
364
|
+
omem stats && omem namespaces
|
|
365
|
+
|
|
366
|
+
# Maintenance
|
|
367
|
+
omem maintain --all # compress + reflect + forget + dream
|
|
368
|
+
|
|
369
|
+
# Import / Export
|
|
370
|
+
omem export -f json -o dump.json
|
|
371
|
+
omem load dump.json -n myproject
|
|
372
|
+
|
|
373
|
+
# Integrations
|
|
374
|
+
omem serve # MCP server for Claude / Cursor
|
|
375
|
+
omem dashboard --port 7900 # web memory dashboard
|
|
376
|
+
omem demo # end-to-end interactive walkthrough
|
|
377
|
+
omem benchmark --n 10000 # performance test
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Architecture Details
|
|
383
|
+
|
|
384
|
+
### Memory Types
|
|
385
|
+
|
|
386
|
+
OMem auto-classifies every memory on ingestion:
|
|
387
|
+
|
|
388
|
+
| Type | Examples |
|
|
389
|
+
|---|---|
|
|
390
|
+
| `SEMANTIC` | Facts, general knowledge |
|
|
391
|
+
| `DECISION` | Choices made, preferences |
|
|
392
|
+
| `CAUSAL` | Bug root causes, cause-effect chains |
|
|
393
|
+
| `PROCEDURAL` | How-to steps, workflows |
|
|
394
|
+
| `EPISODIC` | Events, experiences |
|
|
395
|
+
| `REFLECTION` | AI-generated insights |
|
|
396
|
+
| `ACTIVE` | Critical / urgent items |
|
|
397
|
+
| `WORKING` | Temporary, current-task context |
|
|
398
|
+
|
|
399
|
+
### Scoring Signals
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
vector_similarity — semantic closeness to query (FAISS HNSW)
|
|
403
|
+
keyword_overlap — token-level BM25-style matching
|
|
404
|
+
recency_decay — exponential half-life decay over time
|
|
405
|
+
importance_weight — auto-scored + access-frequency boosted
|
|
406
|
+
status_multiplier — CONFLICTED memories penalized, DEPRECATED skipped
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Storage
|
|
410
|
+
|
|
411
|
+
| Backend | Use Case |
|
|
412
|
+
|---|---|
|
|
413
|
+
| SQLite (default) | Local, single-process, zero config |
|
|
414
|
+
| In-memory | Testing, ephemeral agents |
|
|
415
|
+
| PostgreSQL | Production, multi-process, distributed |
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Configuration
|
|
420
|
+
|
|
421
|
+
```python
|
|
422
|
+
brain = OMem(
|
|
423
|
+
backend="sqlite", # "sqlite" | "memory" | "postgres"
|
|
424
|
+
db_path="~/.omem/brain.db", # custom path
|
|
425
|
+
model="all-MiniLM-L6-v2", # embedding model
|
|
426
|
+
embedding_provider="local", # "local" | "openai"
|
|
427
|
+
)
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Environment variables:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
HF_HUB_OFFLINE=1 # disable HuggingFace Hub network checks (faster startup)
|
|
434
|
+
KMP_DUPLICATE_LIB_OK=TRUE # fix OpenMP conflict on macOS/Anaconda
|
|
435
|
+
TOKENIZERS_PARALLELISM=false # suppress tokenizer warning
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Roadmap
|
|
441
|
+
|
|
442
|
+
| Status | Feature |
|
|
443
|
+
|---|---|
|
|
444
|
+
| ✅ Released | Hybrid RAG, Auto-classification, Forgetting, Compression, MCP Server |
|
|
445
|
+
| ✅ Released | Truth Maintenance System, Knowledge Graph, Graph-RAG |
|
|
446
|
+
| ✅ Released | PostgreSQL backend, CLI, Dashboard |
|
|
447
|
+
| 🔄 In Progress | LOCOMO benchmark validation, distributed mode |
|
|
448
|
+
| 📅 Planned | Custom embedding providers (OpenAI, Cohere), Memory versioning |
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## FAQ
|
|
453
|
+
|
|
454
|
+
**Q: Does this run an LLM internally?**
|
|
455
|
+
A: No. Classification and importance scoring use lightweight heuristics and a small (~90MB) embedding model. No LLM API calls, no external dependencies, no costs.
|
|
456
|
+
|
|
457
|
+
**Q: How is this different from ChromaDB or Pinecone?**
|
|
458
|
+
A: Those are vector storage systems. OMem is a memory *operating system* — with lifecycle (importance → decay → forget), deduplication, conflict detection, knowledge graphs, and a cognitive maintenance cycle.
|
|
459
|
+
|
|
460
|
+
**Q: Will it bloat my agent's context window?**
|
|
461
|
+
A: The opposite. OMem retrieves 3–5 relevant memories per query (~300 tokens) instead of injecting your entire history. See the [Context FAQ](./DEVELOPER.md#memory-layer-faq--does-it-bloat-context).
|
|
462
|
+
|
|
463
|
+
**Q: Is it production-ready?**
|
|
464
|
+
A: v1.0.0 is stable for production workloads. The SQLite backend handles hundreds of thousands of memories. PostgreSQL backend available for multi-process deployments.
|
|
465
|
+
|
|
466
|
+
**Q: What about privacy?**
|
|
467
|
+
A: Everything runs 100% locally by default. Your memories never leave your machine. PostgreSQL backend is self-hosted.
|
|
468
|
+
|
|
469
|
+
**Q: Do I need Rust installed?**
|
|
470
|
+
A: Only if you want the SIMD-accelerated scoring path. The pure-Python path works out of the box and is still competitive.
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Contributing
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
git clone https://github.com/mohitkumarrajbadi/omem
|
|
478
|
+
cd omem
|
|
479
|
+
python -m venv .venv && source .venv/bin/activate
|
|
480
|
+
SETUPTOOLS_USE_DISTUTILS=stdlib pip install -e ".[dev]"
|
|
481
|
+
pytest tests/ -v
|
|
482
|
+
python benchmarks/competitor.py # run head-to-head benchmarks
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
See [DEVELOPER.md](./DEVELOPER.md) for architecture, CLI reference, and contribution guidelines.
|
|
486
|
+
|
|
487
|
+
---
|
|
488
|
+
|
|
489
|
+
## License
|
|
490
|
+
|
|
491
|
+
MIT — see [LICENSE](./LICENSE)
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
<div align="center">
|
|
496
|
+
|
|
497
|
+
**Built for the AI developer community**
|
|
498
|
+
|
|
499
|
+
*If OMem makes your agents smarter, give it a ⭐*
|
|
500
|
+
|
|
501
|
+
[Report Bug](https://github.com/mohitkumarrajbadi/omem/issues) · [Request Feature](https://github.com/mohitkumarrajbadi/omem/issues) · [Discussions](https://github.com/mohitkumarrajbadi/omem/discussions)
|
|
502
|
+
|
|
503
|
+
</div>
|