The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(memory): wire up remote memory engine switching with live rebind and migration
Steven Enamakel23e85c035738
diff --git a/README.md b/README.mdindex e9ade45ecc..d69fcfe812 100644--- a/README.md+++ b/README.md@@ -82,7 +82,7 @@ Every engine OpenHuman calls out to is chosen by config, not hardcoded:- LLM: the managed TinyHumans route, Ollama, LM Studio, MLX, any local OpenAI-compatible server, Claude Code or the Claude Agent SDK, and 26 bring-your-own-key providers including OpenRouter, OpenAI, Anthropic, Google, Groq, Mistral, DeepSeek, Together, and Fireworks. See [local models and BYOK](https://tinyhumans.gitbook.io/openhuman/features/model-routing/local-and-byok-models).- Embeddings: the managed Voyage-backed route, or your own Voyage, OpenAI, Cohere, Ollama, or OpenAI-compatible endpoint.-- Memory: [Memory Trees](https://tinyhumans.gitbook.io/openhuman/features/memory-tree) on TinyCortex, mirrored as an [Obsidian vault](https://tinyhumans.gitbook.io/openhuman/features/obsidian-wiki) on your machine, is what every install runs today. The shared `tinymemory` contract already ships adapters for six remote engines (Supermemory, Mem0, Cognee, CortexDB, AgentMemory, LivingBrain) and a `[subsystems.memory] driver` config key for picking one; the host binding that would actually switch a live install to one of them is not wired up yet.+- Memory: [Memory Trees](https://tinyhumans.gitbook.io/openhuman/features/memory-tree) on TinyCortex, mirrored as an [Obsidian vault](https://tinyhumans.gitbook.io/openhuman/features/obsidian-wiki) on your machine, is the default and stays fully local. Settings > Memory Engine switches a live install, with no restart, to CortexDB hosted by TinyHumans (billed in credits, signed in with your account), or to Supermemory, Mem0, Cognee, CortexDB or AgentMemory with your own endpoint and key, and can copy your existing memories across. Remote engines need the `memory-remote` gate, which the shipped product includes.- Web search: managed search included with a subscription, or your own key for Parallel, Brave, Querit, Exa, Tavily, or a self-hosted SearXNG instance.Engine details: [engines](./gitbooks/developing/engines.md).diff --git a/crates/openhuman-core/src/memory/driver/README.md b/crates/openhuman-core/src/memory/driver/README.mdindex 65ccb85e02..4bd818aa7f 100644--- a/crates/openhuman-core/src/memory/driver/README.md+++ b/crates/openhuman-core/src/memory/driver/README.md@@ -19,26 +19,41 @@ workspace-keyed `for_config` lookup that resolves which driver backs a givenworkspace, reached through `CoreContext::memory_binding`). Both are describedin the top-level [`memory/README.md`](../README.md#wiring).-## Pluggable engines, and how far that goes today--Memory is one of this project's pluggable-engine subsystems, and the config-shape for it already exists: `[subsystems.memory] driver` (or the-`OPENHUMAN_MEMORY_DRIVER` env override) names which driver a workspace should-bind to. `tinymemory-api` (vendored at `vendor/tinymemory/`) defines a-driver-neutral `MemoryProvider` trait and ships adapter crates for six remote-engines under `vendor/tinymemory/crates/tinymemory-remote/`: Supermemory,-Mem0, Cognee, CortexDB, AgentMemory, and LivingBrain.--What `binding::admit` actually accepts is narrower than that adapter list. It-only binds the compiled TinyMemory module (registry id `tinymemory`, with-`tinycortex` kept as a legacy config alias) or the `null` fallback provider. A-driver id configured under `[subsystems.memory.drivers.<id>]` for one of the-remote engines above is refused with "external driver transport is not-implemented yet." TinyCortex is the memory engine every OpenHuman install-actually runs; the config surface for the rest is in place ahead of the-wiring that will make it switch engines. See-[engines.md](../../../../../gitbooks/developing/engines.md) for how engine-selection works across subsystems.+## Pluggable engines++`[subsystems.memory] driver` (or the `OPENHUMAN_MEMORY_DRIVER` env override)+names which driver a workspace binds. The user-facing switch is the+`memory.engines_list` / `engine_get` / `engine_set` / `engine_migrate` /+`engine_migrate_status` RPCs (`memory/ops/engine.rs`,+`memory/ops/engine_migrate.rs`), behind the `memory-remote` Cargo gate.++`binding::admit` accepts:++- the compiled TinyMemory module (`tinymemory`, with `tinycortex` kept as a+ legacy alias) and the `null` provider, as before;+- `tinyhumans`, first-party: no `drivers` entry, implicitly trusted, endpoint+ forced to the backend origin, credential a live bearer read from the host's+ API key or session on every request (`memory/binding_remote.rs`);+- `supermemory`, `mem0`, `cognee`, `cortex`, `agentmemory` configured+ `class = "external"` with `trust_state = "trusted"`, endpoint and deployment+ from the entry and the key from the keychain through+ `credential_ref = "keychain:memory-<id>"`.++Everything else, and every external driver in a build without `memory-remote`,+is refused and falls back to `null` loudly (`MemoryDriverBindFailed`, the+fallback in `provider_status`). `binding::rebind` applies a switch in process+and publishes `MemoryDriverChanged`.++### What degrades on a remote engine++The remote engines advertise the three mandatory families plus what their+dialect adds (CortexDB and TinyHumans: document/conversation/learning/event+ingest and `answer`; Mem0: conversation ingest and graph; Cognee: graph). The+module-only surfaces (`documents`, `tree`, `sources`, `entities`, `people`,+`maintenance`, `goals`, `tool_memory`) are absent from those engines. Their RPCs+are capability-gated out of the registry when a context is ambient, and answer+"memory driver does not support the ... family" otherwise. `provider_status`,+the engine RPCs and the mandatory core/recall RPCs are never gated.## Where nextdiff --git a/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs b/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rsindex cf17bd7dc1..11ca959383 100644--- a/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs+++ b/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs@@ -342,6 +342,16 @@ Capability {status: CapabilityStatus::Beta,privacy: LOCAL_RAW,},+Capability {+ id: "intelligence.memory_engine",+ name: "Memory Engine",+ domain: "intelligence",+ category: CapabilityCategory::Intelligence,+ description: "Choose which engine stores and recalls the assistant's memory: the built-in local TinyCortex (default), CortexDB hosted by TinyHumans (billed in credits, uses your signed-in session), or your own Supermemory, Mem0, Cognee, CortexDB or AgentMemory service. Switching applies immediately without a restart, and existing memories can be copied to the new engine first. Keys live in the OS keychain, never in config. Local-only capabilities such as the memory tree and document store are only available on the local engine.",+ how_to: "Settings > Memory Engine. Pick an engine, enter its endpoint and key if it needs them, then switch or migrate.",+ status: CapabilityStatus::Beta,+ privacy: MEMORY_TO_REMOTE_ENGINE,+ },Capability {id: "intelligence.memory_workspace",name: "Memory Workspace",diff --git a/crates/openhuman-core/src/platform/about_app/catalog_data.rs b/crates/openhuman-core/src/platform/about_app/catalog_data.rsindex c4553efb86..b0e094d9ba 100644--- a/crates/openhuman-core/src/platform/about_app/catalog_data.rs+++ b/crates/openhuman-core/src/platform/about_app/catalog_data.rs@@ -8,6 +8,17 @@ const LOCAL_RAW: Option<CapabilityPrivacy> = Some(CapabilityPrivacy {destinations: &[],});+// A remote memory engine receives the memories the assistant stores and the+// recall queries it runs. Local TinyCortex (the default) sends nothing.+const MEMORY_TO_REMOTE_ENGINE: Option<CapabilityPrivacy> = Some(CapabilityPrivacy {+ leaves_device: true,+ data_kind: PrivacyDataKind::Raw,+ destinations: &[+ "TinyHumans-hosted CortexDB (when selected)",+ "User-configured Supermemory, Mem0, Cognee, CortexDB or AgentMemory service (when selected)",+ ],+});+const DESKTOP_TO_JEV: Option<CapabilityPrivacy> = Some(CapabilityPrivacy {leaves_device: true,data_kind: PrivacyDataKind::Raw,diff --git a/gitbooks/developing/engines.md b/gitbooks/developing/engines.mdindex a46abae949..eb4fa73b7d 100644--- a/gitbooks/developing/engines.md+++ b/gitbooks/developing/engines.md@@ -64,21 +64,46 @@ lists the providers; `factory.rs` builds the client; `schemas.rs` defines the## MemoryThe memory contract (`tinymemory-api`, vendored at `vendor/tinymemory/`)-defines a driver-neutral `MemoryProvider` trait and ships adapter crates for-six remote engines: Supermemory, Mem0, Cognee, CortexDB, AgentMemory, and-LivingBrain (`vendor/tinymemory/crates/tinymemory-remote/`).--What actually binds today is narrower than that adapter list. OpenHuman's-host-side binding (`crates/openhuman-core/src/memory/binding.rs`, function-`admit`) only accepts the compiled TinyMemory module (id `tinymemory`, with-`tinycortex` kept as a legacy config alias) or the `null` driver; an external-driver configured under `[subsystems.memory.drivers.<id>]` is refused with-"external driver transport is not implemented yet." TinyCortex is the memory-engine every OpenHuman install actually runs. The `[subsystems.memory]`-config block (`driver`, `hooks`, `drivers`, and the `OPENHUMAN_MEMORY_DRIVER`-env var) already parses and persists, ahead of the wiring that will make a-non-default `driver` value actually switch engines; nothing reads it at-runtime yet beyond the module/null choice above.+defines a driver-neutral `MemoryProvider` trait. Engines are built by+`tinymemory::factory` (`list_engines`, `build_provider`), and+`tinymemory::migrate::copy` moves every record between two of them.++What the user can pick (Settings > Memory Engine, or `openhuman.memory_engine_*`+over RPC):++| id | what | endpoint | key |+| --- | --- | --- | --- |+| `tinymemory` | the compiled local TinyCortex module (default, nothing leaves the device) | none | none |+| `tinyhumans` | CortexDB hosted by the TinyHumans backend, billed in credits | the backend origin, forced | the signed-in session (or API key), read live on every call |+| `supermemory`, `mem0`, `cognee`, `cortex`, `agentmemory` | the user's own service | from the form | from the form, kept in the OS keychain |++The switch is applied in process: `memory::ops::engine` validates the request,+stores any key under the keychain entry `memory-<id>`, writes+`[subsystems.memory] driver` plus `drivers.<id>` (`class = "external"`,+`transport = "http"`, `credential_ref = "keychain:memory-<id>"`,+`trust_state = "trusted"` because the user chose it in the UI), and calls+`memory::binding::rebind`, which drops the stale bindings, re-points the+context and publishes `MemoryDriverChanged`. Bindings already held by a running+agent session or the learning facet cache keep the previous engine until that+session or the app restarts. Migration (`engine_migrate`) copies first and+switches only after a clean copy; the source is never modified, and a failed+run leaves the active engine alone. `OPENHUMAN_MEMORY_DRIVER` pins the engine+and makes the switch RPCs refuse.++`binding::admit` admits `tinymemory` (with `tinycortex` kept as a legacy+alias), `null`, the first-party `tinyhumans` (no `drivers` entry, implicitly+trusted) and any factory engine configured `class = "external"` with+`trust_state = "trusted"`. An untrusted external driver, or an id the factory+does not know, is still refused, and a build without the `memory-remote` gate+refuses every external driver ("external driver transport is not implemented+yet"). A driver that fails to build falls back to `null` with the reason+surfaced in `memory.engine_get` and on the event bus, never silently.++Not every engine advertises every capability family. The hosted and CortexDB+engines have no `documents`, `tree`, `sources` or `graph` families, so the+document, tree and source RPCs answer a clean "does not support" error on them+(see the [`memory/driver` README](../../crates/openhuman-core/src/memory/driver/README.md)+for the full table).Related pages: [Memory](../features/obsidian-wiki/README.md) and itssub-pages for what TinyCortex actually does (memory tree, scoring, retrieval,