Rust .me
Rust ground for the modern .me semantic kernel.
This crate is the Rust port of the TypeScript .me kernel, kept faithful to the
same semantic model: append-only memories, hash-chain integrity, path grammar,
operators, secret/noise scopes, derivations, inspection, proofs, key wrapping,
snapshots, and live runtime events.
The goal is not to invent a second .me. The goal is to carry the same kernel
meaning into a smaller, stricter runtime that can eventually live closer to
hardware: a daemon, a local gateway, a Raspberry Pi, a vehicle computer, an
embedded agent, or a future monad.ai host.
What Exists
The Rust kernel currently includes:
- hash-chained semantic memory,
- public and owner projections,
- canonical path parsing with selectors such as
items[],items[0], anditems[field >= 10], - the main
.meoperators:@identity,_secret scope,~noise scope,__pointer,=derivation,?query/collect,-remove/tombstone,
- operator registry and semantic replay,
- eager and lazy derivation recompute modes,
inspect()andexplain()traces,- secret value encryption using the v3 blob material model,
- WrappedSecretV1 key wrapping with P-256 ECDH and AES-GCM,
- Ed25519
.prove()identity proofs, - canonical
me://execute dispatch, - JSON snapshot storage,
- a reusable
KernelRuntimehost with write-through persistence, - live runtime events with path filtering,
- runtime receipts for host integrations,
- a small
meCLI, - Rust contract tests against TypeScript fixtures,
- and release-mode benchmark binaries.
Install And Verify
From this directory:
That is the standard gate for this crate. A green run means formatting, compilation, semantic contracts, CLI contracts, fixture parity, and clippy all pass.
Documentation Layout
Rust documentation intentionally mirrors the broader .me repo structure:
../docs/
Global .me docs. Language-agnostic.
../Typescript/typedocs/
TypeScript-specific docs generated with the TypeScript/VitePress stack.
docs/
Rust-specific manual docs: quickstart, runtime host, CLI, benchmarks, parity,
and integration notes.
https://docs.rs/this-me
Rust API reference generated by rustdoc from the Rust source.
Start with docs/. Release notes live in CHANGELOG.md.
Quick Kernel Example
use ;
let mut me = new;
me.postulate?;
me.postulate?;
me.postulate?;
me.derive?;
assert_eq!;
The memory log remains append-only. Reads are the latest projection of that history.
Runnable Examples
The crate ships with small, tested examples under examples/:
Keep them honest with:
Runtime Host
Kernel is the semantic core. KernelRuntime<S> is the host wrapper: it loads a
kernel from a MemoryStore, performs writes or me:// executions, persists the
snapshot, and returns live events.
use ;
use JsonFileStore;
let store = new;
let mut runtime = load?;
let receipt = runtime.write_with_receipt?;
let json = runtime_receipt_to_json;
println!;
Receipts have a stable host-facing shape:
That shape is meant for HTTP/WS hosts: execute once, persist once, broadcast the events generated by that operation.
CLI
Use the local CLI against an optional JSON snapshot file:
Without --state, the CLI runs an ephemeral kernel. With --state, it uses the
same KernelRuntime host path used by embedders.
Produce a branch-scoped proof:
Equivalent seed mode:
Use about as a readable expression-binding prefix. It keeps --who and
--secret as the identity/seed, then binds the active .me expression for the
command that follows:
Quote expressions containing shell operators such as > so the terminal passes
them to me instead of treating them as redirection.
Events
Runtime events are live process state. They are intentionally not persisted in snapshots. Snapshots persist semantic memory, not transient notification queues.
Drain all events:
Read or drain events matching a path:
Filters use the same ancestor/descendant rule as monad's NRP path stream:
subscribing to apps.fulltrailer receives changes at that path, below it, or
replacing one of its ancestors.
Storage
JsonFileStore persists owner snapshots as JSON:
use ;
let store = new;
let kernel = store.load_kernel?;
store.save_kernel?;
Hydration verifies the memory hash chain. Tampered snapshots fail closed.
Cryptography
The Rust port includes two cryptographic surfaces:
- Ed25519 proofs for
.prove()identity signatures. - WrappedSecretV1 using P-256 ECDH key agreement and AES-GCM wrapping.
Secret branches use the same v3 material model as the TypeScript kernel fixtures covered by the test suite.
Contracts
The test suite is contract-first. Important files:
tests/axioms_contract.rs- algebraic invariants.tests/kernel_contract.rs- core kernel behavior.tests/path_contract.rs- path and selector grammar.tests/execute_contract.rs- canonicalme://dispatch.tests/event_contract.rs- live event queue and filters.tests/runtime_contract.rs- host persistence, receipts, event behavior.tests/storage_contract.rs- JSON snapshot storage.tests/proof_contract.rs- Ed25519 proofs.tests/keyspace_contract.rs- keyspace manifest and wrapped keys.tests/wrapped_secret_contract.rs- WrappedSecretV1 crypto.tests/typescript_fixture_contract.rs- parity with TypeScript memory fixtures.
Benchmarks
See BENCHMARKS.md for the benchmark map.
The current crate release is this-me v0.3.3. The current recorded standalone
benchmark run is this-me v0.3.0 Run #001 from Aug 26, 2026.
See BENCHMARK_COMPARISON.md for the
Rust-vs-TypeScript mirror suite. Run #002 records the this-me v0.3.1
source-versioned lazy invalidation fix.
Run benchmarks in release mode:
Benchmarks are not hard pass/fail thresholds yet. They are there to keep the shape honest: O(k) recompute behavior, sustained mutation, fan-out, cold/warm hydration, explain overhead, secret cost, and eager/lazy write/read tradeoffs.
Module Map
src/kernel/mod.rs core memory, operators, projections
src/kernel/path.rs path and selector grammar
src/kernel/evaluator.rs derivation expression evaluator
src/kernel/execute.rs me:// dispatch
src/kernel/json.rs JSON codecs
src/kernel/proof.rs Ed25519 proof support
src/kernel/secret_material.rs secret/noise material derivation
src/kernel/wrapped_secret.rs WrappedSecretV1
src/storage.rs MemoryStore + JsonFileStore
src/runtime.rs KernelRuntime host + receipts
src/me_uri.rs canonical me:// URI parser/projection
src/main.rs me CLI
Current Status
This is now a real Rust kernel, not boilerplate.
It is ready for deeper parity testing and host integration work. It is not yet a
drop-in replacement for the TypeScript kernel inside monad.ai; that next phase
needs an explicit integration layer, packaging decision, and HTTP/WS host
surface.
The rule remains simple: Rust can improve mechanics, memory safety, and runtime
shape, but it must not change .me meaning to chase a number.