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
docs(memory): describe memory identity as explicit run-context state
Steven Enamakel1722202705f6
diff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.mdindex 59b8bda8cb..45d3827f25 100644--- a/crates/openhuman-core/src/core/runtime/README.md+++ b/crates/openhuman-core/src/core/runtime/README.md@@ -204,8 +204,8 @@ Three guards keep SaaS work from falling back to process-wide state:(`config/schema/load/saas_scope.rs`). It never resolves`OPENHUMAN_WORKSPACE`, `active_user.toml` or `~/.openhuman`.- **Scoped spawns.** `runtime/spawn.rs`'s `spawn_scoped` /- `spawn_blocking_scoped` carry the caller's `CoreContext` and memory identity- into the spawned task. `scripts/ci/check-saas-ambient.mjs` (`pnpm+ `spawn_blocking_scoped` carry the caller's `CoreContext` into the spawned task+ (the memory identity is explicit and is handed to spawned work as a value). `scripts/ci/check-saas-ambient.mjs` (`pnpmsaas:ambient`) ratchets the bare spawns, direct `load_or_init` calls,environment writes and `home_dir()` lookups that remain.`CoreContext::propagate` follows the same rule in SaaS.diff --git a/crates/openhuman-core/src/memory/README.md b/crates/openhuman-core/src/memory/README.mdindex 46badeb78c..c2fbb0b872 100644--- a/crates/openhuman-core/src/memory/README.md+++ b/crates/openhuman-core/src/memory/README.md@@ -66,8 +66,12 @@ Memory follows TinyMemory's standard layout (`tinymemory_tools::MemoryLayout`):```A `MemoryIdentity` (in [`scope.rs`](./scope.rs)) is the acting agent definition and, for a-team member, its team. The host scopes one around every agent turn with-`scope::within_agent` or `scope::within`, which set a task-local.+team member, its team. It is explicit, never ambient: a turn's+`OpenHumanRunContext::memory_identity` carries it (`MemoryIdentity::child` for+each sub-agent, `team_member` from the team runtime through+`HostTurnEnv::memory_identity`), the RPC handlers and the embed facade pass+`MemoryIdentity::root()`, and the `confine`, `brain`, `lifecycle` and `ops`+entry points take a `&MemoryIdentity`.`MemoryIdentity::resolve` turns it into a `ResolvedIdentity` (layout root plusmemory agent id), first match wins:@@ -148,7 +152,8 @@ has a 120-second background deadline. When capacity is exhausted, automaticwork is skipped without making the turn wait. The cache itself stays in process memory.Content invalidation clears packs and rejects stale completions whilepreserving queued logs; engine/credential invalidation also clears pending-refreshes. Scoped spawns retain the caller's core and memory identity.+refreshes. Scoped spawns retain the caller's core context; the key carries the+resolved identity, so queued work needs nothing ambient.The explicit/manual `hooks::pre_turn` and `hooks::compaction` retain theirconfigured `pre_turn_timeout_ms` and `compaction_timeout_ms` deadlines; they@@ -275,7 +280,7 @@ The agent `memory` tool applies the same confinement and overwrites any| [`mod.rs`](./mod.rs) | Module declarations and re-exports (`memory_is_on`, `MemoryTool`, the controller aggregators, `register_memory_subscribers`). || [`engine.rs`](./engine.rs) | `resolve` binds the configured engine or says why memory is off; per-fingerprint cache; host engine install; CortexDB key storage. || [`guard.rs`](./guard.rs) | `ScrubbingEngine`: scrubs every write and times every engine call. |-| [`scope.rs`](./scope.rs) | `MemoryIdentity`, `ResolvedIdentity`, resolution order, `within` / `within_agent`, layout v3 roots. |+| [`scope.rs`](./scope.rs) | `MemoryIdentity`, `ResolvedIdentity`, resolution order, layout v3 roots. || [`local_root.rs`](./local_root.rs) | The persistent install-id root of a signed-out session. || [`lifecycle/mod.rs`](./lifecycle/mod.rs) | Builds `AgentMemory` for an identity under the `[memory.recall]` policy. || [`lifecycle/hooks.rs`](./lifecycle/hooks.rs) | Lifecycle operations and bounded manual wrappers; `TurnPack`, `MemoryTurn`. |@@ -312,8 +317,8 @@ The agent `memory` tool applies the same confinement and overwrites any`BoundEngine`, or learn that memory is off.- `engine::install_host_engine` (`engine.rs`): lets an embedder or testsupply its own `MemoryEngine`.-- `scope::within_agent` and `scope::resolve_current` (`scope.rs`): set and- read the acting identity around a turn.+- `MemoryIdentity::child` and `MemoryIdentity::resolve` (`scope.rs`): derive+ and resolve the acting identity a turn's run context carries.- `lifecycle::prefetch::pre_turn` and `compaction`(`lifecycle/prefetch.rs`): synchronous reads of completed packs plus scopedbackground refresh. `lifecycle::hooks` contains the underlying operations;diff --git a/docs/gitbooks/en/developing/architecture/memory.md b/docs/gitbooks/en/developing/architecture/memory.mdindex 8de38ff8bf..81312d456e 100644--- a/docs/gitbooks/en/developing/architecture/memory.md+++ b/docs/gitbooks/en/developing/architecture/memory.md@@ -52,7 +52,7 @@ The behavior is specified in [`docs/specs/memory-v2.md`](https://github.com/tinyAutomatic packs are keyed by CoreContext, workspace, config fingerprint, resolved memory identity and thread. They expire after 60 seconds. The cache holds at most 64 entries per context and 64 KiB per pack; eight workers globally process bounded queues of at most 16 pending operations per entry, with a 120-second deadline per operation. Saturation skips best-effort automatic work rather than waiting. Packs identify themselves as results of an earlier lookup, not authoritative answers to the current question.-Successful content changes clear cached packs and advance a revision, preserving queued conversation logs while rejecting older in-flight results. Engine or credential invalidation clears the caches and pending refreshes. Scoped background tasks retain both CoreContext and memory identity.+Successful content changes clear cached packs and advance a revision, preserving queued conversation logs while rejecting older in-flight results. Engine or credential invalidation clears the caches and pending refreshes. Scoped background tasks retain the CoreContext; the memory identity is an explicit value on the run context, not task-local state.The agent tool allows 15 seconds per call, 30 seconds of aggregate reserved time and eight attempts per retained run record. The tracker keeps 128 records; idle eviction under churn can reset the budget for that run, while outstanding reservations cannot be evicted. `learn`/`forget` acknowledge durable local admission, not remote completion. Their scrubbed outbox entries contain trusted scope rather than credentials, and retry under the matching owner on background/auth ticks. Direct RPC, UI and import/deletion workflows keep their explicit behavior.diff --git a/docs/specs/memory-v2.md b/docs/specs/memory-v2.mdindex 776f978370..1f4d4328af 100644--- a/docs/specs/memory-v2.md+++ b/docs/specs/memory-v2.md@@ -34,9 +34,11 @@ With no usable engine (signed out and no CortexDB key), memory is **off**:## Who is acting (`memory::scope`)A `MemoryIdentity` (an agent definition and, for a team member, its team) is-scoped around every turn: by the session host and channel dispatch for-top-level agents, the sub-agent runner for children, the team runtime for-members. Memory resolves it against the config of whoever reads or writes,+carried explicitly on every turn's run context (`OpenHumanRunContext::memory_identity`):+set by the session host and channel dispatch for top-level agents, derived with+`child` by the sub-agent runner for children, and handed down by the team+runtime for members. RPC handlers and the embed facade act as the root+identity. Memory resolves it against the config of whoever reads or writes,first match wins:| | memory agent id | layout root |