Skip to content

feat(memory): install tinymemory and source driver admission from it - #5487

Merged
senamakel merged 7 commits into
tinyhumansai:mainfrom
senamakel:tinymemory-vendor
Aug 10, 2026
Merged

feat(memory): install tinymemory and source driver admission from it#5487
senamakel merged 7 commits into
tinyhumansai:mainfrom
senamakel:tinymemory-vendor

Conversation

@senamakel

@senamakel senamakel commented Aug 10, 2026

Copy link
Copy Markdown
Member

Installs tinymemory as a submodule and moves the memory subsystem's driver-admission rules onto it. Phase 1 of re-targeting docs/specs/plan-memory.md so the engine-neutral memory layer lives in its own repository rather than inside the engine's.

Depends on tinyhumansai/tinymemory#1 — merge that first, then this PR's gitlink moves to main.

Why

plan-memory.md was written when TinyCortex was the only engine in view, so it named vendor/tinycortex as the destination for everything that moves. That conflates two different things. Engine internals belong in the engine. The contract, capability negotiation, driver admission, the conformance corpus and the per-engine adapters do not — a second engine (Supermemory, mem0, an HTTP backend) cannot be reached through a crate named after the first.

This PR moves the first slice of the second category out and wires it up. No behaviour change.

What changed

Driver admission now comes from tinymemory::registry. binding.rs loses ~90 lines of decision table and keeps what is genuinely host-side: the per-workspace cache, the conversion into the kernel's generic DriverClass/BoundDriver vocabulary, and guard construction. It becomes a projection from this host's config shape onto the crate's decision.

Only class and trust_state cross into the crate. credential_ref and endpoint cannot, because DriverEntry has no such fields — so "no secret can appear in an operator-facing refusal" is structural rather than a rule someone has to remember. fallback_reason_never_contains_credential_ref_or_endpoint still passes.

EMBEDDED_DRIVER_ID is re-exported from the registry rather than declared a second time. Two string literals that must agree is exactly the pair that silently stops agreeing, and the failure mode is quiet: admit would stop recognising the driver and every bind would fall back to the null placeholder — loud in the logs, but discarding memory writes for the whole run.

Two contracts, converted at one seam — a deliberate deviation, recorded in the spec. tinycortex-api was not turned into a re-export of tinymemory-api, so OpenHuman stays on tinycortex-api as its contract and the ~200 tinycortex_api:: references are untouched. tinymemory-tinycortex converts between the two. The cost is real: values crossing the seam are rebuilt, and the contracts can drift. The mitigation is that every conversion destructures exhaustively, so a field added on either side is a compile error naming it. If a tinymemory_api:: type ever appears outside memory/driver/, that is the boundary leaking.

Dependency wiring. Path dependency with no [patch.crates-io] entry, so app/src-tauri/Cargo.toml needs no change — verified by building the Tauri world. tinymemory-tinycortex names tinycortex by version requirement, so this checkout's existing patch unifies it: cargo metadata shows exactly one tinycortex and one tinycortex-api, both resolved to vendor/tinycortex.

CI. vendor/tinymemory added to the two release submodule lists and to the targeted inits in ci-lite.yml / test-reusable.yml. --recursive matters — tinymemory pins its own nested engine. vendor/tinybus was already missing from both release lists; fixed here, since a missing entry fails the same way.

Testing

Check Result
cargo check (core) and cargo check (Tauri shell) clean, no manifest change needed for the shell
cargo test --lib openhuman::memory 1483 passed, 0 failed
openhuman::memory::binding 28 passed — unchanged, including all 12 admit_* rule tests
bypass ratchet, both directions 6 passed
cargo test --lib core::all 90 passed
cargo test --lib --no-default-features core:: 648 passed — the gate CI's cargo check-only smoke lane cannot see

Pre-existing flakiness, not introduced here. The full --lib suite is order-dependent in this environment: it fails 1–2 tests per run, a different set each time, clustered in agent::harness::archivist, plus stack overflows in agent::harness::session under the default test stack. I verified this against the merge base with tinymemory removed from Cargo.toml entirely and all three source files reverted — the baseline fails the same way. RUST_MIN_STACK=33554432 clears the overflows. None of it touches memory, and every memory-scoped suite above is deterministic and green.

Not in this PR

Draining the memory/ops/* bypasses onto the guard. Reading each allowlist entry's recorded reason, 6 of the 16 ops/ entries are genuinely drainable, not the ~11 I first estimated — the rest are the guard resolver itself, the active_memory_client definition site, status/liveness probes, and two test-only scanner matches that are all correctly staying. Each of the 6 needs a typed contract method designed and added to tinycortex-api (a different repository), implemented in the driver family, decorated in the guard, and tested. That is its own focused pass.

profile_conn() / memory_handle() remain undecoratable, so "impossible to skip by construction" is still not true after this PR.

Summary by CodeRabbit

  • New Features

    • Added shared, engine-neutral memory support with TinyCortex integration.
    • Added consistent memory driver identification and configuration handling.
  • Bug Fixes

    • Improved driver admission checks, including validation, trust enforcement, and unknown-driver rejection.
    • Ensured testing and release builds initialize all required memory components.
  • Documentation

    • Clarified memory component ownership, adapter dependencies, and integration sequencing.

senamakel and others added 6 commits August 10, 2026 16:59
Add the tinymemory library as a vendored dependency via a git submodule to provide memory management utilities used by the project.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the tinymemory dependency to a new version, which includes improvements to memory binding behavior. The Cargo.lock and Cargo.toml files were updated accordingly to reflect the new dependency version.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the embedded memory driver encounters a binding that is not present in its registry, it now returns an appropriate error instead of panicking or silently failing. This ensures predictable error handling when the driver is used with an incomplete or mismatched binding configuration.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds vendor/tinymemory as a submodule and moves the memory subsystem's
driver-admission rules onto it. Those rules are the one part of binding with
the same correct answer for every host: a built-in id's class is fixed and an
explicit class line may only confirm it, an unknown id is refused rather than
guessed, and an external driver is fail-closed on trust.

binding.rs keeps what is genuinely host-side -- the per-workspace cache, the
conversion into the kernel's generic driver vocabulary, and guard construction
-- and becomes a projection from this host's config shape onto the crate's
decision. Only class and trust_state cross; credential_ref and endpoint
cannot, because DriverEntry has no such fields. That makes 'no secret can
appear in an operator-facing refusal' structural rather than a rule someone
has to remember.

EMBEDDED_DRIVER_ID is now re-exported from the registry rather than declared a
second time. Two string literals that must agree is exactly the pair that
silently stops agreeing, and the failure is quiet: admit would stop
recognising the driver and every bind would fall back to the null placeholder,
discarding memory writes for the whole run.

All 28 binding tests pass unchanged, including the twelve admit rule tests and
fallback_reason_never_contains_credential_ref_or_endpoint.

The dependency is a path dep with no [patch.crates-io] entry, so
app/src-tauri/Cargo.toml needs no change. tinymemory-tinycortex names
tinycortex by version requirement, so this checkout's existing patch unifies
it onto one engine copy -- verified: exactly one tinycortex resolves.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add the tinymemory vendored submodule to CI and release workflows, update the Cargo.lock with the new tinymemory crates, and document the memory subsystem architecture in AGENTS.md and the memory plan specification. This change integrates the engine-neutral memory layer alongside the existing tinycortex engine, enabling future support for multiple memory backends through a shared contract and driver admission system.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel requested a review from a team August 10, 2026 15:25
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 28cd2b8c-3609-4a55-924f-a004a0889aff

📥 Commits

Reviewing files that changed from the base of the PR and between 48e372e and e4a3513.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • app/src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .github/workflows/ci-lite.yml
  • .github/workflows/release-production.yml
  • .github/workflows/release-staging.yml
  • .github/workflows/test-reusable.yml
  • .gitmodules
  • Cargo.toml
  • docs/specs/plan-memory.md
  • src/openhuman/memory/binding.rs
  • src/openhuman/memory/binding_tests.rs
  • src/openhuman/memory/driver/embedded/mod.rs
  • vendor/tinymemory

📝 Walkthrough

Walkthrough

The change adds TinyMemory as a vendored dependency, routes memory-driver admission through its shared registry, reuses its canonical driver identifier, documents the boundary with TinyCortex, and updates test and release workflows to initialize the new submodule.

Changes

TinyMemory integration

Layer / File(s) Summary
TinyMemory foundation
.gitmodules, vendor/tinymemory, Cargo.toml, docs/specs/plan-memory.md
The repository adds the TinyMemory submodule, path dependencies, and documentation for the TinyMemory and TinyCortex API boundaries.
Registry-backed driver admission
src/openhuman/memory/binding.rs, src/openhuman/memory/driver/embedded/mod.rs, src/openhuman/memory/binding_tests.rs
Memory-driver admission now uses tinymemory::registry. The embedded driver ID reuses the registry constant, and tests import it directly.
Workflow submodule provisioning
.github/workflows/ci-lite.yml, .github/workflows/test-reusable.yml, .github/workflows/release-production.yml, .github/workflows/release-staging.yml
Test and release workflows initialize vendor/tinymemory with the required vendored dependencies.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenHumanBinding
  participant TinyMemoryRegistry
  participant Kernel
  OpenHumanBinding->>TinyMemoryRegistry: submit sanitized DriverEntry
  TinyMemoryRegistry->>TinyMemoryRegistry: validate admission and resolve driver class
  TinyMemoryRegistry-->>OpenHumanBinding: return admission result
  OpenHumanBinding->>Kernel: convert and apply driver classification
Loading

Possibly related PRs

Suggested labels: rust-core, memory

Suggested reviewers: al629176, codeghost21, giri-aayush, graycyrus, m3ga-mind

Poem

I’m a rabbit with a registry key,
TinyMemory hops in cleanly.
Drivers queue, their classes align,
Workflows fetch each submodule in time.
TinyCortex keeps its proper place—
A tidy burrow, a faster chase! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes adding TinyMemory and moving driver admission logic to it.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. labels Aug 10, 2026
@senamakel
senamakel merged commit 5c4186a into tinyhumansai:main Aug 10, 2026
20 of 28 checks passed
senamakel added a commit to senamakel/openhuman that referenced this pull request Aug 12, 2026
…y-vendor"

This reverts commit 5c4186a, reversing
changes made to 64f64f8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants