cortex-rs
Pure compiled native Rust memory engine with vector search and SQLite WAL
Brought by drakestapleton
cortex-rs / README.md
| 1 | <p align="center"> |
| 2 | <img src="assets/avatar.jpg" width="140" height="140" alt="AIEN Sovereign Intelligence" style="border-radius: 50%; border: 2px solid #f59e0b;"> |
| 3 | </p> |
| 4 | |
| 5 | # cortex-rs |
| 6 | |
| 7 | [](https://github.com/aien-dev/cortex-rs/actions/workflows/ci.yml) |
| 8 | [](LICENSE) |
| 9 | [](SECURITY.md) |
| 10 | [](CONTRIBUTING.md) |
| 11 | [](https://drakestapleton.com) |
| 12 | |
| 13 | High-performance native Rust memory engine with SQLite FTS5 lexical recall, bi-encoder vector similarity, and hardware-secured loopback isolation. |
| 14 | |
| 15 | ## Overview |
| 16 | |
| 17 | `cortex-rs` is the canonical memory engine powering Atlas and the AIEN sovereign agent stack. Written entirely in native Rust (Axum), it replaces heavy interpreted memory servers with sub-millisecond lexical and semantic retrieval. |
| 18 | |
| 19 | It provides hybrid search combining BM25 full-text indexing with ONNX vector embeddings, enabling autonomous agents to recall procedures, lessons, and architectural discoveries across thousands of turns without context collapse. |
| 20 | |
| 21 | ## Features |
| 22 | |
| 23 | - **Sub-Millisecond Retrieval**: Pure compiled Rust using SQLite WAL mode and FTS5 inverted indexes with typical latency <1ms. |
| 24 | - **Hybrid Semantic Recall**: Direct integration with local bi-encoder vector servers for cosine similarity and dense embedding scoring. |
| 25 | - **Hardware Vault Security**: Zero plaintext secrets. All authentication uses bearer token validation bound to loopback interfaces (`127.0.0.1`). |
| 26 | - **Graph & Provenance Traversal**: Bidirectional relationship edges (`cortex_claims`, `cortex_entities`) for deep contextual graph traversal. |
| 27 | - **Unslop Standard**: Enforces clean technical facts without AI filler or hallucinated abstractions. |
| 28 | |
| 29 | ## Quick Start |
| 30 | |
| 31 | ### Build & Run |
| 32 | |
| 33 | ```bash |
| 34 | # Compile release binary |
| 35 | cargo build --release |
| 36 | |
| 37 | # Run Cortex-RS on local loopback |
| 38 | ./target/release/cortex-rs --port 18080 --db-path ~/.config/cortex/cortex.db |
| 39 | ``` |
| 40 | |
| 41 | ### Health Check |
| 42 | |
| 43 | ```bash |
| 44 | curl http://127.0.0.1:18080/health |
| 45 | # {"runtime":"native-arm64-rust","service":"cortex-rs","space":"atlas-memory","status":"ok","version":"0.1.0"} |
| 46 | ``` |
| 47 | |
| 48 | ### Hybrid Query |
| 49 | |
| 50 | ```bash |
| 51 | curl -G http://127.0.0.1:18080/api/cortex/search \ |
| 52 | --data-urlencode "q=tpm vault" \ |
| 53 | -H "Authorization: Bearer <TOKEN>" |
| 54 | ``` |