Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(guard): update README to reflect current code and contract state

Steven Enamakele47b88ee7ff3
diff --git a/crates/openhuman-core/src/memory/guard/README.md b/crates/openhuman-core/src/memory/guard/README.md
index 5fa6dbec45..0fca5fd869 100644
--- a/crates/openhuman-core/src/memory/guard/README.md
+++ b/crates/openhuman-core/src/memory/guard/README.md
@@ -1,18 +1,21 @@
# guard
-The taint/scope/budget policy gate over every memory-provider call
-(`docs/specs/plan-memory.md` §3.4, `docs/specs/kernel.md` §3.4,
-`docs/specs/memory-guard-allowlist.md`). [`MemoryGuard`] implements
+The taint/scope/budget policy gate over every memory-provider call. The
+rustdoc cites `docs/specs/plan-memory.md` §3.4, `docs/specs/kernel.md` §3.4
+and `docs/specs/memory-guard-allowlist.md`; those files were removed from the
+tree in `0017c58d86`, so the citations are historical and the code comments
+are what remains of the argument. `MemoryGuard` implements
`MemoryProvider` over the bound driver, so it is the only handle product code
should hold — a caller writes the same code against the guard as against the
raw driver, and there is no second, unguarded shape to reach for instead.
## Public surface
-- `pub struct MemoryGuard` (`provider.rs`) — the decorator. Fourteen `as_*`
- overrides hand back guarded family handles instead of the inner driver's;
- see `families.rs` for why that has to be an owned field per family rather
- than a value built on demand.
+- `pub struct MemoryGuard` (`provider.rs`) — the decorator. Its `as_*`
+ overrides (one per optional family, twenty-three today) hand back guarded
+ family handles instead of the inner driver's; see `families.rs` for why
+ that has to be an owned field per family rather than a value built on
+ demand.
- `pub struct GuardPolicy` (`policy.rs`) — the resolved policy bundle the
guard and all family decorators share: `enforce_read` / `enforce_write`
(the `SecurityPolicy` tier check), `ambient_scope` (source-scope query
@@ -20,10 +23,12 @@ raw driver, and there is no second, unguarded shape to reach for instead.
(driver id, `DriverClass`, hook budgets, trust state) are cached at bind
time; the `SecurityPolicy` itself is re-read live on every call so an
autonomy change takes effect immediately.
-- Family decorators (`families.rs` + `families_part_0{1..4}.rs`) — ten
- optional-capability decorators (e.g. `GuardedTree`, `GuardedProfile`,
- `GuardedGraph`), present exactly when the bound driver advertises that
- family.
+- Family decorators (`families.rs` + `families_part_0{1..4}.rs`) — one
+ `decorator!`-generated struct per optional capability family (`GuardedTree`,
+ `GuardedProfile`, `GuardedGraph`, … — 23 of the contract's 26 families),
+ each present exactly when the bound driver advertises that family. The
+ "ten decorators" / "thirteen families" figures in the rustdoc predate the
+ contract growing.
- `mandatory.rs` — the three families every driver has (`MemoryCore`,
`MemoryRecall`, `MemoryPortability`), where steps 3, 4 and 6 land for the
always-present surface.
@@ -49,9 +54,10 @@ raw driver, and there is no second, unguarded shape to reach for instead.
| 7 | audit + tracing | `audit.rs` |
See `mod.rs` for the full argument behind each departure from a naive reading
-of the milestone brief, and its "Honesty clause" section for what is
-deliberately *not* covered yet (`ProfileStore`'s direct SQL access to
-`user_profile` has no guarded family).
+of the milestone brief, and its "Honesty clause" section for what the guard
+still does not cover: the engine's own `ProfileStore` reads and writes, which
+sit beneath the module contract (the guarded `MemoryProfile` family exists;
+the allowlist test tracks what has not moved onto it).
## Calls into
@@ -60,13 +66,13 @@ deliberately *not* covered yet (`ProfileStore`'s direct SQL access to
- `crate::security::SecurityPolicy` — the tier check in step 1.
- `crate::memory::source_scope` — the ambient per-turn source allowlist read
in step 2.
-- `crate::config`'s `MemoryHooksConfig` — the budgets read in step 6.
+- `crate::config::schema::MemoryHooksConfig` — the budgets read in step 6.
## Called by
-- `crate::memory::ops::guard::active_memory_guard` — the guarded-driver
- lookup RPC handlers use instead of `ops::helpers::active_memory_client`
- when the operation has a typed contract twin.
+- `crate::memory::ops::guard::active_memory_guard` — how a memory RPC
+ handler reaches the guarded driver (the unguarded
+ `helpers::active_memory_client` it used to sit beside is gone, #5560).
- `CoreContext::memory` (`crate::core::runtime::context`) — resolves
`memory_binding()` and returns its `.guard()`; this is additive next to
`CoreContext::memory_binding()`, which still hands out the bare driver for
@@ -78,7 +84,9 @@ deliberately *not* covered yet (`ProfileStore`'s direct SQL access to
- `budget_tests.rs`, `families_tests.rs`, `policy_tests.rs`,
`provider_tests.rs` — unit coverage per file above.
-- `../bypass_allowlist_tests.rs` — the ratchet lint: enumerates the production
- files that still reach the driver around the guard (all of them into
- `ProfileStore`/`MemoryClient`, none of them into a `MemoryProvider` family)
- and fails if that set grows.
+- `../bypass_allowlist_tests.rs` — the ratchet lint: a needle list
+ (`binding::for_workspace(`, `.memory_binding(`, `.unguarded_provider(`,
+ `.profile_store(`, …) scanned over production files, with an `ALLOWED`
+ list carrying a reason per entry (the CLI and `CoreContext` bind sites, the
+ `ops::provider` health probe, the guard's own forwarding). It fails if the
+ set grows or an entry goes stale.