@@ -27,17 +27,21 @@ CortexaDB exists to provide a **middle ground**: a hard-durable, embedded memory
2727from cortexadb import CortexaDB
2828from cortexadb.providers.openai import OpenAIEmbedder
2929
30- # 1. Open database with an embedder for automatic text-to-vector
30+ # 1. Open database with an embedder
3131db = CortexaDB.open(" agent.mem" , embedder = OpenAIEmbedder())
3232
33- # 2. Store facts and connect them logically
34- mid1 = db.remember (" The user prefers dark mode." )
35- mid2 = db.remember (" User works at Stripe." )
33+ # 2. Add facts
34+ mid1 = db.add (" The user prefers dark mode." )
35+ mid2 = db.add (" User works at Stripe." )
3636db.connect(mid1, mid2, " relates_to" )
3737
38- # 3. Query with semantic and graph intelligence
39- hits = db.ask(" What are the user's preferences?" , use_graph = True )
40- print (f " Top Hit: { hits[0 ].id} (Score: { hits[0 ].score} ) " )
38+ # 3. Fluent Query Builder
39+ hits = db.query(" What are the user's preferences?" ) \
40+ .limit(5 ) \
41+ .use_graph() \
42+ .execute()
43+
44+ print (f " Top Hit: { hits[0 ].id} " )
4145```
4246
4347---
@@ -52,77 +56,30 @@ pip install cortexadb
5256pip install cortexadb[docs,pdf] # Optional: For PDF/Docx support
5357```
5458
55- ** Rust**
56- ``` toml
57- [dependencies ]
58- cortexadb-core = { git = " https://github.com/anaslimem/CortexaDB.git" }
59- ```
60-
6159---
6260
6361### Core Capabilities
6462
63+ - ** 100x Faster Ingestion** : New batch insertion system allows processing 5,000+ chunks/second.
6564- ** Hybrid Retrieval** : Search by semantic similarity (Vector), structural relationship (Graph), and time-based recency in a single query.
66- - ** Ultra-Fast Indexing** : Uses ** HNSW (USearch)** for sub-millisecond approximate nearest neighbor search with 95%+ recall.
67- - ** Hard Durability** : A Write-Ahead Log (WAL) and segmented storage ensure zero data loss, even after a crash.
68- - ** Smart Document Ingestion** : Built-in recursive, semantic, and markdown chunking for TXT, MD, PDF, and DOCX files.
69- - ** Privacy First** : Completely local and embedded. Your agent's data never leaves its environment unless you want it to.
70- - ** Deterministic Replay** : Capture session operations for debugging or syncing memory across different agents.
65+ - ** Ultra-Fast Indexing** : Uses ** HNSW (USearch)** for sub-millisecond approximate nearest neighbor search.
66+ - ** Fluent API** : Chainable QueryBuilder for expressive searching and collection scoping.
67+ - ** Hard Durability** : WAL-backed storage ensures zero data loss.
68+ - ** Privacy First** : Completely local. Your agent's memory stays on your machine.
7169
7270---
7371
7472<details >
7573<summary ><b >Technical Architecture & Benchmarks</b ></summary >
7674
77- ### Rust Architecture Overview
78-
79- ```
80- ┌──────────────────────────────────────────────────┐
81- │ Python API (PyO3 Bindings) │
82- │ CortexaDB, Namespace, Embedder, chunk(), etc. │
83- └────────────────────────┬─────────────────────────┘
84- │
85- ┌────────────────────────▼─────────────────────────┐
86- │ CortexaDB Facade │
87- │ High-level API (remember, ask, etc.) │
88- └────────────────────────┬─────────────────────────┘
89- │
90- ┌────────────────────────▼─────────────────────────┐
91- │ CortexaDBStore │
92- │ Concurrency coordinator & durability layer │
93- │ ┌────────────────┐ ┌────────────────────────┐ │
94- │ │ WriteState │ │ ReadSnapshot │ │
95- │ │ (Mutex) │ │ (ArcSwap, lock-free) │ │
96- │ └────────────────┘ └────────────────────────┘ │
97- └───────┬──────────────────┬───────────────┬───────┘
98- │ │ │
99- ┌───────▼─────┐ ┌───────▼───────┐ ┌────▼───────────┐
100- │ Engine │ │ Segments │ │ Index Layer │
101- │ (WAL) │ │ (Storage) │ │ │
102- │ │ │ │ │ VectorIndex │
103- │ Command │ │ MemoryEntry │ │ HnswBackend │
104- │ recording │ │ persistence │ │ GraphIndex │
105- │ │ │ │ │ TemporalIndex │
106- │ Crash │ │ CRC32 │ │ │
107- │ recovery │ │ checksums │ │ HybridQuery │
108- └─────────────┘ └───────────────┘ └─────────────────┘
109- │
110- ┌──────────▼──────────┐
111- │ State Machine │
112- │ (In-memory state) │
113- │ - Memory entries │
114- │ - Graph edges │
115- │ - Temporal index │
116- └─────────────────────┘
117- ```
118-
11975### Performance Benchmarks (v0.1.7)
120- Measured with 10 ,000 embeddings (384-dimensions) on a standard SSD .
76+ Measured on M2 Mac with 1 ,000 chunks of text .
12177
122- | Mode | Query (p50) | Throughput | Recall |
123- | ------| -------------| -----------| --------|
124- | Exact (baseline) | 1.34ms | 690 QPS | 100% |
125- | HNSW | 0.29ms | 3,203 QPS | 95% |
78+ | Operation | v0.1.6 (Sync) | v0.1.7 (Batch) | Improvement |
79+ | -----------| ---------------| ----------------| -------------|
80+ | Ingestion | 12.4s | ** 0.12s** | ** 103x Faster** |
81+ | Memory Add| 15ms | 1ms | 15x Faster |
82+ | HNSW Search| 0.3ms | 0.28ms | - |
12683
12784</details >
12885
0 commit comments