openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Stabilize the CortexDB-based memory engine in OpenHuman: validate hosted recall, cut over from tinycortex, then prove imports, context, efficiency and production readiness

Open Al629176 opened this issue 2 months ago • 10 comments

Description

Validate recall and the surrounding memory functionality against the hosted CortexDB engine (tinyhumansai/cortexdb-saas), then adopt it in TinyMemory as the engine, retiring the embedded tinycortex dependency.

Less of this is greenfield than it looks. tinymemory-remote/src/cortex_provider/ already adapts "CortexDB's native v1 experience, recall, and answer routes to TinyMemory's provider contracts", covering the mandatory key/value, recall and portability surface plus document, conversation, learning, raw-event and grounded-answer capabilities. A tinymemory-conformance crate with a suite and reference already exists as the vehicle for proving a provider equivalent. The work is to exercise that provider against the hosted service properly, then cut tinymemory-core over to it.

Repos: cortexdb-saas (Rust, private) · TinyMemory (vendor/tinymemory) · consumed by OpenHuman Type: Migration task — the bug-report headings do not apply, so this uses Scope / Approach / Risks in their place

Current state

Piece Where Status
Hosted engine + proxy, meter, credit gate cortexdb-saas/src/{proxy,meter,scope,tenant,billing}.rs Exists; engine is a closed third-party binary (cortexdb/cortexdb, pinned by digest)
CortexDB provider for TinyMemory tinymemory-remote/src/cortex_provider/ Exists — protocol translation in operations.rs, response validation in test.rs
Conformance suite tinymemory-conformance/{suite,reference} Exists; the natural place to prove equivalence
Embedded engine being replaced tinymemory-tinycortex/ adapter + direct tinycortex = { version = "0.1", features = ["obsidian","persona","people","sync"] } in tinymemory-core/Cargo.toml To retire
Coupling 101 .rs files under crates/ reference tinycortex To assess — most should route through the adapter

Scope

Phase 1 — prove the hosted engine. Run the conformance suite against a live cortexdb-saas deployment through CortexProvider, and establish parity with the embedded tinycortex reference for: recall (including recall_relevant_by_vector), key/value, portability, documents, conversations, learning, raw events, and grounded answers. Record recall quality and latency against the embedded engine, not just pass/fail.

Phase 2 — integrate and cut over. Make the hosted provider selectable in TinyMemory, then remove the direct tinycortex dependency from tinymemory-core and retire the tinymemory-tinycortex adapter.

Phase 3 — stabilise it in OpenHuman. Proving the engine and cutting over is not the same as the feature being production-ready in the app. This phase covers four areas:

Imports. Every ingest path exercised against the hosted engine, not just store: documents (including blob_ref extraction — Tika for documents, the chat model for images), conversations, learnings and raw events. Bulk ingest matters most and is currently broken — tinysweeper#147, POST /v1/experience/bulk answers 408 on very large conversations. Idempotency keys are payload-derived, so re-ingest and backfill need testing for conflicts rather than silent duplication.

Context handling. TinyMemory compiles a token-budgeted context.md from whatever is stored, and that text lands in the model request. Two things need to hold: it must respect its budget under a large store, and it must be stable across turns within a conversation. If context.md is recompiled differently each turn it rewrites the prompt prefix and destroys the KV cache — which is the same defect class as #6655 and directly undercuts #6999's 92% cache-hit target. Memory that improves answers while tripling cost is not a win.

Efficiency. Measure what memory costs per turn: added latency on recall, tokens contributed to the prompt, and the enrichment lag. The hosted engine derives facts, beliefs and understanding in the background — with production's CORTEX_ENRICHMENT_DELAY_SECONDS=5 and CORTEX_V1_LAYERS_TICK_SECS=15, beliefs appear roughly 30–45 s after a write. A list taken right after a write is therefore empty rather than wrong, and OpenHuman must not present that as "you have no memory".

Production readiness. Memory becomes a network call with a credit gate in front of it. The failure modes need to be distinguishable in the app: a genuine miss, a 402 balance refusal, an unreachable engine, and a still-deriving layer are four different things and currently would look alike.

Risks and open questions

  • Scope enforcement is a known gap. The cortexdb-saas README states that CortexDB v0.9.9 "does not enforce scope membership consistently", measured against a live engine, and documents which probes leak. The proxy compensates. Any conformance run must include cross-tenant and cross-scope probes so we are testing the boundary the proxy provides, not just the happy path.
  • Recall semantics may differ. The embedded engine and the hosted v1 recall routes are not guaranteed to rank identically. We need to decide whether parity means identical results or acceptable-quality results, and write that down before the cutover.
  • Write semantics differ by design. Per the provider README, writes wait for CortexDB's indexed barrier and are attempted once because an ambiguous retry could duplicate an append; recall may retry. Behaviour under partial failure needs explicit coverage.
  • Idempotency keys are payload-derived. Documents and conversation messages derive idempotency from their complete lossless payload, and CortexDB rejects a reused key with a different body as a conflict. Worth testing against real re-ingest and backfill paths.
  • Network dependency. Memory becomes a network call. Offline and degraded-network behaviour needs a defined story — today the embedded engine cannot fail this way.
  • links = "git2". tinymemory-core/Cargo.toml notes that a tinycortex major-version conflict becomes a hard cargo error via links = "git2". Removing the dependency should relieve this, but check nothing else in the tree relies on that link.
  • Billing is now in the path. The credit gate and meter mean a recall can be refused for balance reasons. TinyMemory and its callers need to surface that distinctly from a genuine miss.
  • Data migration is now tracked separately in #7005 — free migration of current subscribers' local TinyCortex store to the hosted engine. The decision that affected this issue (migrate vs new-data-only) is answered there: migrate, client-side, canonical Markdown with indexes re-derived. Sequencing matters — the importer should target whichever engine this issue settles on.
  • Per-user scoping is tracked in #7002. The scope-enforcement gap noted above has its own issue, including the finding that TinyMemory's CortexEngine::direct wire bypasses the proxy entirely. No subscriber data should move before its cross-user isolation check passes.

Observed in QA, 5 October

Three stabilisation defects visible in a running build's logs today. All three are quiet failures — the app carries on and the user is told nothing:

1. Memory sources are invisible until restart.

[core-context] workspace rebound to ~/.openhuman/users/<id>/workspace while the memory module is
already loaded. The module keeps the source registry it was given when it loaded and cannot be
rebound in this process, so memory sources registered under this profile will not be visible to
it until the app is restarted.

2. Segments silently stay unsummarised when no summariser answers.

[archivist] summarize_entries: LLM recap failed (non-fatal) … no summarization provider
[archivist] no LLM recap for segment=seg-18da… (2 turns) — summary NOT persisted, NOT embedded,
NOT sent to goals enrichment; the segment stays unsummarised so a later pass can recap it once a
summariser answers

The log is admirably explicit, but nothing surfaces to the user, and nothing guarantees the later pass happens.

3. PII redaction is active on the ingest path — one insert recorded pii_redactions=8. Redaction is correct behaviour, but it rewrites what gets stored, so its effect on later recall needs measuring rather than assuming.

Acceptance Criteria

  • [ ] tinymemory-conformance runs green against a live cortexdb-saas deployment through CortexProvider, covering key/value, recall, portability, documents, conversations, learning, raw events and grounded answers
  • [ ] Cross-tenant and cross-scope probes are part of that run, asserting the proxy denies what the engine does not
  • [ ] Recall quality and latency are measured against the embedded tinycortex reference and the results recorded on this issue; an explicit parity bar is agreed before cutover
  • [ ] Retry and partial-failure behaviour is covered: write-once semantics, recall retry, and idempotency-key conflicts on re-ingest
  • [ ] A credit-gate refusal surfaces distinctly from an empty recall, end to end into OpenHuman
  • [ ] Offline / unreachable-engine behaviour is defined and tested
  • [ ] tinymemory-core no longer declares tinycortex as a dependency
  • [ ] tinymemory-tinycortex is removed, or retained only as a documented fallback with a stated support horizon
  • [ ] A decision on migrating existing embedded memory is recorded, and implemented if the answer is yes
  • [ ] OpenHuman builds and passes its memory E2E suite (tests/memory_roundtrip_e2e.rs, tests/memory_sources_e2e.rs, tests/memory_graph_roundtrip_e2e.rs, tests/memory_tree_health_e2e.rs) against the hosted engine
  • [ ] Verified on an OpenHuman build after the cutover with memory persisting across a restart

Phase 3 — stabilisation (added 5 October)

  • [ ] Every ingest path is exercised against the hosted engine: documents, blob_ref extraction for documents and images, conversations, learnings, raw events
  • [ ] tinysweeper#147 is fixed and bulk ingest verified on a genuinely large conversation
  • [ ] Re-ingest and backfill are tested for idempotency-key conflicts — a repeat never silently duplicates or silently drops
  • [ ] context.md respects its token budget against a large store, with the measured size recorded
  • [ ] context.md is byte-stable across turns within a conversation, verified from captured request bodies — memory must not rewrite the prompt prefix
  • [ ] Memory's cost per turn is measured: recall latency, tokens added to the prompt, and the effect on cache hit rate
  • [ ] A read taken during the 30–45 s enrichment window is presented as "still deriving", never as "no memory"
  • [ ] Four failure modes are distinguishable in the app: empty recall, 402 credit refusal, unreachable engine, and layers still deriving
  • [ ] Memory sources registered after module load are visible without an app restart, or the restart requirement is surfaced to the user
  • [ ] An unsummarised segment is retried and eventually summarised, or the gap is visible — a silent permanent gap is not acceptable
  • [ ] Recall quality is measured with PII redaction active, so redaction's cost to recall is known
  • [ ] A soak run over a realistic store size shows no unbounded growth in prompt size, latency or cost across a long conversation

Al629176 avatar Sep 28 '26 08:09 Al629176

Status update. A large part of this issue landed via tinymemory#169 (v1.17.0: the tinyhumans driver over the backend's /memory/*, per-request bearer, tinymemory::factory, tinymemory::migrate::copy) and openhuman#6777 (Settings › Memory engine, host-side binding, copy-then-switch migration, INSUFFICIENT_CREDITS: / SESSION_EXPIRED: prefixes). Thanks @senamakel.

Still open against the acceptance criteria

  • No live conformance run yet; the suite skips kv/documents on hosted and never exercises the five ingest/answer families.
  • No cross-tenant / cross-scope probes.
  • No recall quality/latency comparison with the embedded engine, and no agreed parity bar.
  • Keyed writes and tombstones are single-attempt (the open CodeRabbit finding on tinymemory#169).
  • Auto-recall swallows a credit refusal, so it reads as "nothing relevant".
  • No defined offline behaviour.
  • tinymemory-core still depends on tinycortex; no recorded migration decision.
  • The four memory E2E suites named here are module-only.

Issues found on the shipped hosted path

  1. The health probe's prefix=zz_health fails memory-api's type:id scope grammar, so health is a 400 against the real stack. The test double accepts any prefix.
  2. Hosted recall carries no scores; the host maps a missing score to 0.0 and the 0.35 floors then drop every auto-recalled note and preference.
  3. Composio sync on hosted reads pages, then finds no Sources sink and drops them.
  4. A memory 401/403 maps to SESSION_EXPIRED:, which the app treats as confirmed auth expiry (sign-out).
  5. Indexed event text is a JSON envelope; ingestion writes the content twice (c and x), with eager embedding and extraction over it.
  6. migrate::copy into hosted goes through single-attempt keyed writes, and one failed record aborts an import batch.

Plan

  • Now: one tinymemory PR (health probe, keyed-write retries under one claim, conformance for the ingest/answer families, live isolation probes, a recall parity harness, migration robustness) and one openhuman PR (unscored recall, credit/auth surfacing without sign-out, sink-before-fetch sync, offline behaviour, hosted variants of the memory E2E suites). I'm picking these up now; flagging here so we don't overlap.
  • Next: the missing families on the tinyhumans wire (Sources, Retrieval, Documents, Maintenance, …) so the E2E suites can run hosted; then decoupling tinymemory-core from tinycortex, keeping the local engine as a documented fallback.

Questions for @senamakel

  1. Unscored recall: OK for the host to skip absolute similarity floors for drivers whose scores_recall() is false and take the engine's rank order (small cap), still behind the auto-recall gate?
  2. Indexed text: open to plain content + labels instead of the JSON envelope if the parity harness shows a quality/cost gain (old envelopes stay readable)?
  3. Serving facts/beliefs/understanding (currently a non-goal in docs/specs/tinyhumans-hosted-cortex.md) to back the Brain graph on hosted?

YellowSnnowmann avatar Sep 30 '26 17:09 YellowSnnowmann

Status, 2026-10-01

Done

  • Phase 1. Hosted CortexDB can be selected as the memory engine (tinyhumansai/tinymemory#175, #6841).

  • Phase 2. Hosted memory serves the same families as the local engine (tinyhumansai/tinymemory#176, released in tinymemory v1.20.0; #6843):

    • goals, tool rules and documents;
    • the source sink and maintenance;
    • retrieval, the learned profile and episodic memory;
    • scoring and the summary tree.
  • Copy on switch. tinyhumansai/tinymemory#178 is merged; #6869 is in draft. Switching engines now copies:

    • document titles and tags;
    • goals and the learned profile;
    • the conversation history;
    • optionally, synced content, re-sent so the new engine rebuilds its summaries. This is billed on hosted memory, and the user chooses it in the dialog.

    The dialog lists what moves, shows the step under way, and names anything the new engine cannot take.

  • #6843 follow-ups, also in #6869:

    • The learning rebuild writes back only the facets that changed. It no longer rewrites every facet every 30 minutes.
    • A file deleted from a host-synced folder is forgotten from hosted memory on the next sync.
    • Hosted segment recaps are written by the host's model, instead of being left empty.
    • memory_sources.remove no longer reports a failure after the source was already removed.

Next

  • Release tinymemory v1.21.0, re-pin #6869 to it, and take #6869 out of draft.
  • A live parity run on production test accounts.
  • Run the hosted end-to-end suites and decouple the core from the embedded engine.
  • Decide how migration credits are presented: granted to the user, or shown as an estimated cost.

YellowSnnowmann avatar Oct 01 '26 06:10 YellowSnnowmann

Filed #7005 for the data-migration half of this retirement: moving current subscribers' existing TinyCortex memory into hosted CortexDB, free of charge. This issue covers validating hosted recall and swapping the engine; #7005 covers moving the data, which retiring tinycortex otherwise strands.

Al629176 avatar Oct 05 '26 08:10 Al629176

Added Phase 3 — stabilise it in OpenHuman, covering memory imports, context handling, efficiency and production readiness. Proving the engine and cutting over is not the same as the feature being production-ready in the app, so this phase is explicitly separate from Phases 1 and 2.

Also folded in three stabilisation defects seen in a running build's logs on 5 October — memory sources invisible until restart, segments silently staying unsummarised when no summariser answers, and active PII redaction whose effect on recall is unmeasured. All three are quiet failures.

Two cross-references updated: data migration is now answered in #7005 (migrate, client-side, Markdown with indexes re-derived) rather than listed as undecided, and the scope-enforcement gap now points at #7002, including the finding that CortexEngine::direct bypasses the proxy entirely.

One thing worth highlighting from the new scope: context.md must be byte-stable across turns. If it recompiles differently each turn it rewrites the prompt prefix and destroys the KV cache — the same defect class as #6655, and it would undercut #7007's 92% cache-hit target. Memory that improves answers while tripling cost is not a win, so that is now an acceptance criterion verified from captured request bodies.

Al629176 avatar Oct 05 '26 14:10 Al629176

This is a large migration task: validate hosted CortexDB recall and memory functionality via the conformance suite, integrate the hosted engine into TinyMemory, retire the embedded tinycortex dependency, and stabilise the hosted path in OpenHuman (ingest paths, context stability, cost measurement, distinct failure modes). It is explicitly labelled a migration task, not a bug report. Partial progress has landed (hosted engine selectable, same families served, copy-on-switch), with substantial acceptance criteria still open. It is not a duplicate of #7005 — that issue covers only the data-migration half and is explicitly tracked separately, and #7002 covers only the per-user scoping gap. Priority p2: it is a significant engineering effort with workaround state (embedded engine still works) rather than a broken core path.

Labelled priority: p2.

tinysweeper avatar Oct 05 '26 14:10 tinysweeper

Status after memory v2, 2026-10-06

Memory v2 (#6949, #6993, merged 4 October) replaced the memory system underneath this issue, so several criteria have changed meaning. Reconciled against main at 6c8c7ad93f:

Criterion Now
tinymemory-core no longer depends on tinycortex; adapter retired Done by v2. TinyCortex and the embedded engines are deleted; the engines are tinyhumans and cortexdb, and memory is off without one. There is no local fallback.
The four memory E2E suites Superseded. Those files are deleted; the equivalents are tests/memory_v2_e2e.rs and tests/memory_cortexdb_live.rs.
QA 1: sources invisible until restart No longer applies. The TinyBus memory module is gone; the source registry is [[memory.sources]], read by the host.
QA 2: unsummarised segments No longer applies (archivist deleted). A related gap: lifecycle/jobs.rs drops a belief build after 5 failed attempts, so ~25 min without credits leaves a silent permanent gap.
context.md byte-stable across turns Changed shape. The cron context.md is gone; a per-turn pack rides a request-only tail via push_ephemeral_instruction (DeepSeek handled per #6962). Still to verify from captured request bodies.
Live conformance, isolation probes, recall parity numbers, soak, cost per turn Still open
tinyhumansai/tinysweeper#147 Still open

Regressions from the rewrite. Two #6841 fixes did not carry over:

  • memory/error.rs folds Conflict, Unavailable and Engine into one ENGINE code. The hosted 402 arrives as Engine with [USER_INSUFFICIENT_CREDITS], and nothing in openhuman calls tinymemory's is_insufficient_credits. So a credit refusal, an outage and an engine bug are one state again.
  • A failed pre-turn recall (lifecycle/hooks.rs) logs a warning and the turn runs with no pack, so a credit refusal reads as "nothing in memory".

Picking up now: distinct INSUFFICIENT_CREDITS / UNAVAILABLE codes end to end (RPC, pre-turn recall, UI in all locales), and failed background jobs kept visible instead of silently dropped. Flagging so we don't overlap.

CodeGhost21 avatar Oct 05 '26 20:10 CodeGhost21

Update, 2026-10-06: #7013 is merged. It restores what memory v2 dropped from #6841:

  • Memory RPCs now fail with INSUFFICIENT_CREDITS (the hosted 402) or UNAVAILABLE (unreachable, timed out, overloaded), not the generic ENGINE. The Memory tabs show translated text for both.
  • A pre-turn recall refused for the whole account now gives the turn a short notice saying memory is unavailable and why, so the model no longer reads it as "nothing is stored". holistic_recall reports a failed section as a skip reason rather than an error, so the hook reads refusals from there too.
  • Source sync stops on an account-wide refusal instead of failing each item.
  • A background job no longer uses up an attempt on an account-wide refusal, so a belief build waits for credits instead of being dropped after five runs.

Of the four failure modes, empty recall, credit refusal and unreachable engine are now distinct. Still open: "layers still deriving" (a read in the 30–45 s enrichment window), prompt-cache stability of the per-turn pack from captured request bodies, the live conformance/parity/isolation runs, tinyhumansai/tinysweeper#147, and the soak run. #7011 (v1 import) can adopt the new codes after it lands.

CodeGhost21 avatar Oct 05 '26 21:10 CodeGhost21

Split and reconciled, 2026-10-06. The code-side work is done; what's left is live validation and measurement, now split into two sub-issues:

  • #7022: validate hosted memory live (conformance, recall-quality bar, hosted E2E, restart persistence)
  • #7023: measure per-turn cost and stability (ingest paths, re-ingest, pack budget, prompt cache, PII, soak)
  • tinyhumansai/tinysweeper#147: bulk ingest 408 (engine side), unchanged

9 of the 23 criteria are done or no longer apply. The other 14 are now carried by the issues above. Below is the checklist with each item annotated.

@Al629176, I can't edit this issue's body. Could you paste this checklist over the existing one, or tick the ✅ items, so the issue shows its real state?

Acceptance criteria, annotated

  • [ ] tinymemory-conformance runs green against a live cortexdb-saas deployment through CortexProvider, covering key/value, recall, portability, documents, conversations, learning, raw events and grounded answers — → #7022
  • [x] Cross-tenant and cross-scope probes are part of that run, asserting the proxy denies what the engine does not — ✅ done in #7002: tinyhumansai/cortexdb-saas#12 plus an isolation CI job running cross-tenant probes against the real engine on every deploy
  • [ ] Recall quality and latency are measured against the embedded tinycortex reference and the results recorded on this issue; an explicit parity bar is agreed before cutover — → #7022. There is no embedded engine left to compare against, so this is now an agreed absolute bar
  • [x] Retry and partial-failure behaviour is covered: write-once semantics, recall retry, and idempotency-key conflicts on re-ingest — ✅ at the driver level: tinyhumansai/tinymemory#175 (keyed writes and tombstones retried under one claim, refused import records counted) and tinyhumansai/tinymemory#184 (re-import skips held records); jobs in #7013. Live re-ingest is in #7023
  • [x] A credit-gate refusal surfaces distinctly from an empty recall, end to end into OpenHuman — ✅ #7013: INSUFFICIENT_CREDITS code, plus a refusal notice in the turn's memory pack
  • [x] Offline / unreachable-engine behaviour is defined and tested — ✅ #7013: UNAVAILABLE code; the turn is told memory is unreachable, sync stops, queued jobs wait
  • [x] tinymemory-core no longer declares tinycortex as a dependency — ✅ memory v2 (#6949 / #6993) removed TinyCortex
  • [x] tinymemory-tinycortex is removed, or retained only as a documented fallback with a stated support horizon — ✅ removed in memory v2; there is no embedded fallback
  • [ ] A decision on migrating existing embedded memory is recorded, and implemented if the answer is yes — decision recorded in #7005 (migrate, client-side); implementation in progress in #7011
  • [ ] OpenHuman builds and passes its memory E2E suite (tests/memory_roundtrip_e2e.rs, tests/memory_sources_e2e.rs, tests/memory_graph_roundtrip_e2e.rs, tests/memory_tree_health_e2e.rs) against the hosted engine — superseded: memory v2 deleted these suites. The replacements are tests/memory_v2_e2e.rs and tests/memory_cortexdb_live.rs; the hosted run is in #7022
  • [ ] Verified on an OpenHuman build after the cutover with memory persisting across a restart — → #7022

Phase 3: stabilisation

  • [ ] Every ingest path is exercised against the hosted engine: documents, blob_ref extraction for documents and images, conversations, learnings, raw events — → #7023
  • [ ] tinysweeper#147 is fixed and bulk ingest verified on a genuinely large conversation — open: tinyhumansai/tinysweeper#147
  • [ ] Re-ingest and backfill are tested for idempotency-key conflicts — a repeat never silently duplicates or silently drops — → #7023
  • [ ] context.md respects its token budget against a large store, with the measured size recorded — → #7023. Memory v2 replaced context.md with a per-turn memory pack under [memory.recall]
  • [ ] context.md is byte-stable across turns within a conversation, verified from captured request bodies — memory must not rewrite the prompt prefix — → #7023. The pack is a request-only tail (push_ephemeral_instruction) and is never persisted; still to be verified from request bodies
  • [ ] Memory's cost per turn is measured: recall latency, tokens added to the prompt, and the effect on cache hit rate — → #7023
  • [x] A read taken during the 30–45 s enrichment window is presented as "still deriving", never as "no memory" — ✅ #7014: only beliefs lag in v2 (writes are WaitFor::Visible); an empty Learnings list says beliefs are still building while a build is pending
  • [x] Four failure modes are distinguishable in the app: empty recall, 402 credit refusal, unreachable engine, and layers still deriving — ✅ #7013 + #7014
  • [ ] Memory sources registered after module load are visible without an app restart, or the restart requirement is surfaced to the user — → #7022. Memory v2 removed the loadable module that caused this; still to confirm on a real build
  • [x] An unsummarised segment is retried and eventually summarised, or the gap is visible — a silent permanent gap is not acceptable — ✅ no longer applies: the archivist was deleted in memory v2. The related permanent-gap risk, dropped belief builds, was fixed in #7013
  • [ ] Recall quality is measured with PII redaction active, so redaction's cost to recall is known — → #7023
  • [ ] A soak run over a realistic store size shows no unbounded growth in prompt size, latency or cost across a long conversation — → #7023

CodeGhost21 avatar Oct 06 '26 06:10 CodeGhost21

Status, 2026-10-07: one item is left open, hosted recall latency. Everything else on this issue is done, obsolete under Memory v2, or moved to a named follow-up. OpenHuman now runs on hosted memory by default (engine tinyhumans, the backend's /memory/* proxy to CortexDB), and the Memory v2 rewrite (#6949, #6993) replaced much of the design this issue was written against. Below, each acceptance criterion is marked done, obsolete under v2, or moved to a named follow-up, so nothing is dropped.

Done

Criterion Where
Conformance runs green against the live hosted engine Through the tinyhumans wire in tinyhumansai/tinymemory#202 (#7022): full conformance suite passed on production
Recall quality measured against the local reference #7022: quality matched the local baseline exactly. Latency is the open item below
Credit-gate refusal distinct from an empty recall, end to end #7013: INSUFFICIENT_CREDITS and UNAVAILABLE codes, and a refusal notice in the turn pack instead of silence. Restored by #7058 after #7044 reverted it
Offline / unreachable-engine behaviour defined and tested #7013: an_unreachable_engine_is_named_as_unreachable
Four failure modes distinguishable: empty, 402, unreachable, still deriving #7013 (402, unreachable) and #7014 (deriving)
A read during the enrichment window shows "still deriving", never "no memory" #7014 (Learnings tab, from the pending build_beliefs job)
Sources registered after module load work without a restart Verified live (#7022); an account-wide refusal now stops a sync instead of dropping its data (#7013)
Memory persists across a restart Verified live on a hosted build (#7022)
Retry and partial failure: write-once and recall retry Jobs no longer burn retries on an account-wide refusal (#7013); holistic_recall skips a failed section with its reason instead of failing the turn
context.md within budget against a large store #7034 (1500 learnings: 257 of 1200 tokens) and #7063 (resumed turn: 877 tokens with 9 repeated lines before, 470 with none after)
Context byte-stable across turns, prompt prefix kept #7034: the pack is a per-turn tail instruction, so the previous transcript stays the cached prefix (a_new_turn_reuses_the_whole_previous_transcript_as_cached_prefix)
Document ingest via blob_ref extraction #7034: PDF, Word, PowerPoint and Excel into the brain
One pack per resumed session (found during this work) tinyhumansai/tinymemory#206 and #7063

Obsolete under Memory v2

  • tinymemory-core dropping tinycortex, and removing or retaining tinymemory-tinycortex: the v2 rewrite removed the embedded engine path this targets. Engines are now tinyhumans and cortexdb.
  • The named E2E files (memory_roundtrip_e2e.rs, memory_sources_e2e.rs, memory_graph_roundtrip_e2e.rs, memory_tree_health_e2e.rs): replaced by tests/memory_v2_e2e.rs and the in-process memory suites, which run in CI.
  • Migrating embedded v1 memory: v1 import is part of v2. A legacy backend profile is turned off with a diagnostic rather than silently bound to hosted memory (#7041).
  • "An unsummarised segment is retried": v2 has no segment summariser. Belief builds are queued jobs with bounded retries, and a dropped job keeps its reason.

Moved to follow-ups

Criterion Tracked in
Cost per turn (latency, prompt tokens, cache-hit effect) #7023
Recall quality with PII redaction active #7023
Soak over a realistic store and long conversation #7023
Conversation, learning, raw-event and v1-import ingest exercised live #7023
Re-ingest and backfill idempotency-key conflicts #7023
Bulk ingest of very large conversations tinyhumansai/tinysweeper#147
Cross-tenant and cross-scope probes tinyhumansai/cortexdb-saas#16 (needs the engine vendor)
Image ingest (blob_ref for images) #7066
Explicit parity bar agreed before cutover Quality parity held on every scenario (#7022). The latency bar (p95 ≤ 2 s) is not met yet; see below

Latency (the one open item)

Still open. The target is pre_turn p95 ≤ 2 s. Measured with the TinyMemory eval through api.tinyhumans.ai /memory/* (scenario brain_lookup, n=16):

Oct 6 Oct 7, before fixes Oct 7, after fixes
pre_turn p50 2.5 s 17.2 s 5.9 s
pre_turn p95 26.5 s 34.7 s 9.0 s
Document ingest until visible, p50 95.4 s 9.5 s 4.9 s
Recall quality (pack hits) 8/8 8/8 8/8

What was slow. Every hosted recall made two model calls ("recall expansion") on the enrichment ladder before searching, and that ladder's cheapest seller was failing.

What changed:

  • tinyhumansai/k8s#114 turned recall expansion off for all seven question types. tinyhumansai/k8s#105 had listed only four.
  • The seller recovered around the same time, so the improvement can't be credited to #114 alone.

What's left is inside the closed engine: about 2.3 s of coordinator_recall per recall while enrichment is running. That is tracked with the vendor in tinyhumansai/cortexdb-saas#14. A possible OpenHuman-side mitigation is fewer recall calls per turn; that would be a separate change.

Also found and fixed along the way

  • #7044's merge reverted about 32 merged PRs on main, including #7013, #7014 and #7034. #7058 restored them.
  • #7060 fixed four CI lanes that were red on main.

CodeGhost21 avatar Oct 07 '26 11:10 CodeGhost21

Closing note, 2026-10-09. Closed as completed: every acceptance criterion is now done, obsolete under Memory v2, or tracked in a named follow-up (see the 2026-10-07 status above). Closing it does not mean hosted memory has met all its targets. One target is still missed, and that is recorded below so it isn't lost.

Landed, and confirmed still on main

Where
Credit refusal (INSUFFICIENT_CREDITS) and unreachable engine (UNAVAILABLE) are shown as distinct from an empty recall #7013 (restored by #7058 after #7044 reverted it)
"Still deriving" state while a belief build is pending #7014
PDF and Office ingest; memory pack within budget; previous transcript kept as the cached prefix #7034
Legacy backend profile disabled with a diagnostic #7041
One memory pack per resumed session (877 → 470 tokens, 0 repeated lines) #7063, tinyhumansai/tinymemory#206
Live validation: conformance on production, hosted E2E, memory persisting across a restart #7022 (closed)

Not met yet: recall latency. pre_turn p95 is 9.0 s against a 2 s target (p50 5.9 s). Recall quality is at parity (8/8). About 2.3 s per recall is spent inside the closed engine while enrichment runs. That is with the vendor in tinyhumansai/cortexdb-saas#14. An OpenHuman-side mitigation (fewer recall calls per turn) would be a separate change.

Open follow-ups

  • #7023: per-turn cost, cache-hit effect, PII effect on recall, soak run, re-ingest idempotency
  • #7066: image ingest into the brain
  • tinyhumansai/cortexdb-saas#14: hosted recall latency
  • tinyhumansai/cortexdb-saas#16: cross-tenant synthesis in the engine (needs the vendor)
  • tinyhumansai/tinysweeper#147: bulk ingest returns 408 on very large conversations

Migration closed alongside this in #7005.

CodeGhost21 avatar Oct 09 '26 09:10 CodeGhost21