Native memory scoring, similarity, and traversal for Nodus
Project description
nodus-native-memory-engine
Rust-accelerated memory scoring, similarity, and traversal for Nodus agents.
Provides native implementations of the hot-path operations from nodus-memory:
cosine similarity, weight scoring, causal chain traversal, and combined ranking.
Installation
pip install nodus-native-memory-engine
After installation, nodus-memory automatically detects and uses the native engine.
Operations
| Function | Description |
|---|---|
cosine_similarity(a, b) |
Single-pair cosine similarity |
batch_cosine_similarity(query, matrix) |
One query vs many embeddings |
compute_weight(impact, usage, success, fail) |
Memory node ranking weight |
batch_compute_weights(nodes) |
Batch weight computation |
argsort_by_weight(nodes) |
Sort indices by weight descending |
traverse_chain(id_to_parent, start, depth) |
Causal chain walk + cycle detection |
would_create_cycle(id_to_parent, child, parent) |
Cycle pre-check |
rank_by_similarity(query, embeddings, ...) |
Top-k by cosine similarity |
rank_blended(nodes, query, sim_weight, top_k) |
Combined weight + similarity ranking |
is_native() |
True if Rust extension is loaded |
All functions have pure-Python fallbacks — the package works even without the compiled extension.
Status
v0.1.0 — PREPARED, NOT RELEASED.
Pure Python fallback
The native Rust extension is optional. When not installed (or when the Rust
build fails), all operations fall back to pure Python implementations
automatically. Use is_native() to check which path is active:
from nodus_native_memory_engine import is_native
print(is_native()) # True = Rust extension, False = pure Python
The fallback has the same API but is slower on large batches.
Auto-detection by nodus-memory
Once installed, nodus-memory automatically detects and uses the native engine
for hot-path operations. No configuration needed.
Build requirements (Rust extension)
- Rust 1.93.1+
- maturin 1.12.6+
- Python 3.11+
# Install with Rust extension (development)
VIRTUAL_ENV="C:/dev/Coding Language/.venv" maturin develop --release
# Install wheel only (pure Python fallback, no Rust needed)
pip install nodus-native-memory-engine
Development
# Build and install Rust extension for development
maturin develop --release
# Run tests (works with or without Rust extension)
pytest tests/ -q
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nodus_native_memory_engine-0.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: nodus_native_memory_engine-0.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 131.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fce3b509ac4cfb2512f63611fff57d17e021d6e50ef15e01bf04179309ccf548
|
|
| MD5 |
0df44307fc8036f5f3edb446b4fe19ad
|
|
| BLAKE2b-256 |
687d7ad9792fa091f8939fde341afc1f9ba759acf4511a9a221313383a80df4a
|