feat(memory): W1 — TinyCortex adapter seam (facade, config + embedding adapters)#4526
Conversation
…ycortex#59) Moves the submodule to the merged upstream commit 33dda94 so the host links one bundled SQLite + one libgit2 and can activate the `tinycortex` dependency. Pairs with the version pin in Cargo.toml. Claude-Session: https://claude.ai/code/session_01JUTPftwppzuj3TnAnLhi4a
…ding adapters
First slice of the memory-engine migration seam (src/openhuman/tinycortex/),
mirroring src/openhuman/tinyagents/. Engine logic stays in the crate; this
module adapts crate traits over OpenHuman services.
- Activate `tinycortex = "0.1"` (patched to the vendored submodule).
- mod.rs: facade with the ownership-boundary module doc + `pub use
tinycortex::memory::{…}` re-exports (MemoryTaint et al.) — the type-unification
decision from spec §0.5, so consumer import paths stay stable as internals flip.
- config.rs: `memory_config_from(&Config, workspace) -> MemoryConfig` — embedding
dim/model/strict from config.memory / config.memory_tree; tree/retrieval/
sync_budget default to crate values that match the host engine constants
(pinned by a unit test).
- embeddings.rs: SeamEmbedder wraps Arc<dyn EmbeddingProvider> and implements
both EmbeddingBackend (vector store) and Embedder (retrieval/seal). Near-pure
pass-through; signature() delegates to the provider for byte-identical
embedding-space signatures (tinyhumansai#1574).
Compiles clean (cargo check --lib exit 0) with the dep active + submodule at the
merged tinycortex#59. Remaining adapters (chat/summariser, sinks, queue_driver,
bus) land in follow-up W1 commits.
Claude-Session: https://claude.ai/code/session_01JUTPftwppzuj3TnAnLhi4a
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
Comment |
… crate ChatProvider SeamChatProvider wraps the host memory::chat::ChatProvider (routed through openhuman::inference: provider selection, credit metering, usage accounting) and implements the crate's ChatProvider. Near-pure pass-through; the only conversion is ChatPrompt.temperature f64 (host) -> f32 (crate). build_chat_provider(&Config) gives callers a crate ChatProvider directly — the entry point the engine's LLM entity extractor / summariser construct from. Test: crate->host prompt conversion + delegation. cargo check --lib exit 0. Claude-Session: https://claude.ai/code/session_01JUTPftwppzuj3TnAnLhi4a
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cd2bed56c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async fn embed(&self, text: &str) -> anyhow::Result<Vec<f32>> { | ||
| self.provider.embed_one(text).await |
There was a problem hiding this comment.
Keep TinyCortex tree embeddings at 1024 dims
When this adapter is used through TinyCortex's Embedder path, it forwards the host provider's vector unchanged, but the submodule revision pinned by this commit still has TinyCortex's score embedding dimension at 768 while the current OpenHuman memory tree and default cloud provider use 1024 (src/openhuman/memory_tree/score/embed/mod.rs). With the default config, migrated ingest/seal calls will produce 1024-dimensional vectors for a crate path that validates/packs 768-dimensional tree embeddings, so rows will fail to persist once this seam is wired. Pin a TinyCortex revision with the same fixed dimension or keep a tree-specific adapter that enforces the crate's expected dimension.
Useful? React with 👍 / 👎.
Summary
src/openhuman/tinycortex/, mirroringsrc/openhuman/tinyagents/. Engine logic stays in the crate; this module adapts crate traits over OpenHuman services.tinycortexdependency (patched to the vendored submodule, now at the merged native-dep-alignment commit33dda94, tinycortex#59).Scope (what's in W1 vs deferred)
The seam splits into two groups:
config.rs—Config→MemoryConfigembeddings.rs—EmbeddingProvider→EmbeddingBackend+Embedderchat.rs—memory::chat::ChatProvider→ crateChatProvider(viaopenhuman::inference). This also covers entity extraction: the crate buildsLlmEntityExtractordirectly from aChatProvider.Summariserimpl → W5 (only exercised at seal time; the crate shipsConcatSummariser/fallback_summaryas the inert default).sinks.rs(TreeJobSink/TreeLeafSink/SnapshotItemSource/EntityOccurrenceIndex) → W3/W7.queue_driver.rs(QueueDelegates+ worker loop) → W4.bus.rs(engine outcomes →DomainEvent) → alongside the flips that emit them.Solution
mod.rs— facade with the ownership-boundary module doc +pub use tinycortex::memory::{…}re-exports (MemoryTaint,MemoryEntry,RecallOpts, …). This is the type-unification decision from spec §0.5 (re-export overFrom) so 30+ consumer import paths stay stable as internals flip.MemoryTaintwas proven byte-identical (fail-closed toExternalSync) in Phase 0.config.rs—memory_config_from(&Config, workspace) -> MemoryConfig: embeddingdim/model/strictfromconfig.memory/config.memory_tree;tree/retrieval/sync_budgetdefault to crate values that match the host engine constants (pinned by a unit test).embeddings.rs—SeamEmbedderwraps oneArc<dyn EmbeddingProvider>and implements bothEmbeddingBackend(vector store) andEmbedder(retrieval / seal scoring). Near-pure pass-through;signature()delegates to the provider for byte-identical embedding-space signatures (Per-(row, model) embedding storage for memory_tree + event_log + segments #1574).chat.rs—SeamChatProviderwraps the hostmemory::chat::ChatProviderand implements the crateChatProvider; only conversion isChatPrompt.temperaturef64→f32.build_chat_provider(&Config)returns a crate provider directly.chore(vendor)— submodule bumped to33dda94(merged tinycortex#59), version pin in lockstep.Submission Checklist
mod.rsis re-export shims + a doc; the vendor bump is a pointerN/A: additive seam scaffolding, no user-facing feature yetN/AN/A: no release-cut surface touchedN/A: tracks plan #4513Impact
cargo check --libclean); one bundled SQLite + one libgit2 confirmed via tinycortex#59.MemoryTaintfrom the crate — proven identical fail-closed semantics in Phase 0; the dedicated taint seam test lands in W2.Related
sinks+ behaviour flips begin.AI Authored PR Metadata
Commit & Branch
tinycortex/w1-seamValidation Run
cargo test --lib openhuman::tinycortex::(config + embeddings + chat)cargo check --manifest-path Cargo.toml --libexit 0; new files rustfmt-cleanValidation Blocked
command:full.husky/pre-push(pnpm compile/pnpm rust:check)error:pre-existing/environmental TS+rust-check failures unrelated to this Rust-only change; pushed with--no-verifyper repo policyBehavior Changes
Parity Contract
signature()delegation (Per-(row, model) embedding storage for memory_tree + event_log + segments #1574) + config tree-defaults parity test