no_std Rust memory engine for on-device LLM agents: provenance-gated recall that stops a model's own output becoming its evidence. 66.6% -> 0% self-echo, 801 B/fact, Cortex-M4.
0
stars
0
commits
Rust
primary language
Sep 4, 2026
updated
A no_std Rust memory engine for AI agents that run on small hardware. It does two things a
vector store does not:
Around 35 KB of code, ~800 bytes per stored fact, no cloud calls, no runtime dependencies. Cross-compiles to Cortex-M4 and RISC-V; a C-ABI is included.
| MATURITY.md | What this is not. Research prototype: no hardware testing, no fuzzing, no soak, and running out of heap hangs the device. Read before anything else. |
| RESULTS.md | Every measurement, with the method and the command to re-run it |
| INTEGRATION.md | Building it, feeding it, the rules that bite if ignored |
include/astrum_memory.h | The C API |
examples/agent_loop.rs | What using it looks like — facts in with their provenance, a question, the prompt block that comes out. cargo run --example agent_loop |
ctest/main.c | The same from C — 32 checks against the real library |
cargo test # 29 tests, and again with --features capi-int8
cargo rustc --release --features std --crate-type staticlib
cc ctest/main.c -Iinclude -Ltarget/release -lastrum_memory -o ctest/ctest && ./ctest/ctest
On Linux the C test needs -lm -lpthread -ldl after -lastrum_memory. On macOS with
Homebrew's Rust installed next to rustup, put rustup's toolchain first — otherwise cargo
picks a rustc with no cross-compilation targets and the MCU builds fail with "can't find
crate for core":
export PATH=~/.rustup/toolchains/stable-*/bin:$PATH
The QEMU benchmarks need qemu-system-arm; every command is listed in
INTEGRATION.md §6.
CI runs the rest on every push: both test suites, clippy -D warnings, rustfmt, the two
cross-compile targets, the C test under ASan + UBSan, and Miri with strict provenance. The
QEMU benchmarks are not in CI — they report numbers rather than pass/fail, and pinning them
needs a regression tolerance that has not been agreed.
Facts carry provenance — who said this: the user, an external document, the model itself. Provenance sets a ceiling on how important a fact may become and decides whether it is eligible for recall at all. Facts may be marked canon, which makes them immune to eviction however old or rarely read. A human can confirm or reject a recall, and that verdict moves how long a fact survives — never how it ranks, because folding value into relevance was measured to cost 86% → 29% recall@1. Retrieval is cosine similarity weighted by provenance, over an exact linear scan, with an optional int8 index that trades ~16% query time for 59% of the memory.
No signal derived from the engine's own behaviour is ever treated as evidence. That restriction is the product.
Prototype under active development, single author. The measurements are honest and reproducible; the code around them has never run on real hardware. The sensible next step with a partner is a joint evaluation on their target, not a binary drop into a product — see MATURITY.md.
Apache-2.0. See LICENSE.
Rust
89.0%
C
10.9%
no_std Rust memory engine for on-device LLM agents: provenance-gated recall that stops a model's own output becoming its evidence. 66.6% -> 0% self-echo, 801 B/fact, Cortex-M4.
0
stars
0
commits
Rust
primary language
Sep 4, 2026
updated
A no_std Rust memory engine for AI agents that run on small hardware. It does two things a
vector store does not:
Around 35 KB of code, ~800 bytes per stored fact, no cloud calls, no runtime dependencies. Cross-compiles to Cortex-M4 and RISC-V; a C-ABI is included.
| MATURITY.md | What this is not. Research prototype: no hardware testing, no fuzzing, no soak, and running out of heap hangs the device. Read before anything else. |
| RESULTS.md | Every measurement, with the method and the command to re-run it |
| INTEGRATION.md | Building it, feeding it, the rules that bite if ignored |
include/astrum_memory.h | The C API |
examples/agent_loop.rs | What using it looks like — facts in with their provenance, a question, the prompt block that comes out. cargo run --example agent_loop |
ctest/main.c | The same from C — 32 checks against the real library |
cargo test # 29 tests, and again with --features capi-int8
cargo rustc --release --features std --crate-type staticlib
cc ctest/main.c -Iinclude -Ltarget/release -lastrum_memory -o ctest/ctest && ./ctest/ctest
On Linux the C test needs -lm -lpthread -ldl after -lastrum_memory. On macOS with
Homebrew's Rust installed next to rustup, put rustup's toolchain first — otherwise cargo
picks a rustc with no cross-compilation targets and the MCU builds fail with "can't find
crate for core":
export PATH=~/.rustup/toolchains/stable-*/bin:$PATH
The QEMU benchmarks need qemu-system-arm; every command is listed in
INTEGRATION.md §6.
CI runs the rest on every push: both test suites, clippy -D warnings, rustfmt, the two
cross-compile targets, the C test under ASan + UBSan, and Miri with strict provenance. The
QEMU benchmarks are not in CI — they report numbers rather than pass/fail, and pinning them
needs a regression tolerance that has not been agreed.
Facts carry provenance — who said this: the user, an external document, the model itself. Provenance sets a ceiling on how important a fact may become and decides whether it is eligible for recall at all. Facts may be marked canon, which makes them immune to eviction however old or rarely read. A human can confirm or reject a recall, and that verdict moves how long a fact survives — never how it ranks, because folding value into relevance was measured to cost 86% → 29% recall@1. Retrieval is cosine similarity weighted by provenance, over an exact linear scan, with an optional int8 index that trades ~16% query time for 59% of the memory.
No signal derived from the engine's own behaviour is ever treated as evidence. That restriction is the product.
Prototype under active development, single author. The measurements are honest and reproducible; the code around them has never run on real hardware. The sensible next step with a partner is a joint evaluation on their target, not a binary drop into a product — see MATURITY.md.
Apache-2.0. See LICENSE.
Rust
89.0%
C
10.9%