this-me 0.3.3

Rust ground for the modern .me semantic kernel.
Documentation
---
layout: readme
title: Rust .me Runtime Host
image: https://neurons-me.github.io/docs/assets/img/me.png
---

# Runtime Host

`KernelRuntime<S>` wraps a `Kernel` with a `MemoryStore`.

It is the Rust host shape intended for daemons, gateways, embedded processes,
and future `monad.ai` integration. It owns the lifecycle:

1. load a kernel,
2. apply a write or `me://` execution,
3. persist the snapshot,
4. return the operation result,
5. expose the runtime events generated by that operation.

## Write-Through Runtime

```rust
use this_me::runtime::KernelRuntime;
use this_me::storage::JsonFileStore;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let store = JsonFileStore::new("/tmp/me-state.json");
    let mut runtime = KernelRuntime::load(store)?;

    runtime.write("profile.name", "Jabellae")?;

    Ok(())
}
```

## Receipts

Hosts normally want the result and the events together:

```rust
use this_me::runtime::{runtime_receipt_to_json, KernelRuntime};
use this_me::storage::JsonFileStore;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let store = JsonFileStore::new("/tmp/me-state.json");
    let mut runtime = KernelRuntime::load(store)?;

    let receipt = runtime.write_with_receipt(
        "apps.fulltrailer.home.count",
        3_u64,
    )?;

    let json = runtime_receipt_to_json(&receipt);
    println!("{json}");

    Ok(())
}
```

Receipt shape:

```json
{
  "result": "...",
  "events": [
    {
      "path": ["apps", "fulltrailer", "home", "count"],
      "operator": null,
      "value": 3.0,
      "memoryHash": "..."
    }
  ]
}
```

`write_with_receipt` and `execute_with_receipt` drain only the events created by
that operation. Older pending events stay in the runtime queue.

Runtime events are not persisted in snapshots. Semantic memory persists;
notification queues do not.