Repository navigation
feat(memory): deterministic durable-memory recall injection for app sessions (QA 4A) - #90
Merged
Merged
Conversation
…essions Report 4A: a goal saved in one app chat was not recalled in a new chat. Saving works (verified: add_episode succeeded + search_memory_facts returns the fact); the gap is retrieval — it is discretionary and the slim app prompt often skips search_memory_facts at the start of a new chat. Mirror the proven app_profile bootstrap: fetch the user's top durable facts server-side and inject them as a synthetic MEMORY_RECALL.md context file every turn (app sessions only), so recall no longer depends on the model searching. - graphiti-recall-client.ts: read-only search_memory_facts over the streamable -HTTP MCP endpoint, mirroring the graphiti-proxy capability boundary — the only scope input is a server-derived groupId, unsafe ids fail closed, the call hard -sets group_ids:[groupId] and no caller group_id/group_ids/center_node_uuid can pass through. node:http (Host: localhost:8000) like the proxy; timeboxed. - memory-recall-context.ts: appendMemoryRecallBootstrapFile — group id derived byte-identically to the life-memory-scope hook; ~2s timebox + fail-open; NO cross-turn cache (codex P2: avoid stale recall right after a write). - bootstrap-files.ts: chain after appendAppProfileBootstrapFile (post-shaping). - agents-md-memory-section.md: note that MEMORY_RECALL.md is pre-injected. - 27 vitest (incl. wire/scope/timebox + hook group-id parity + fail-open + no -stale-cache). pnpm check (format + tsgo + lint) green. Implements Issue 2 of docs/experiments/plans/qa-fixes-2026-06-26.md (#89). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
oxfmt 0.33.0 flags two files this branch does not otherwise touch (SKILL.md, the cron-generated bug_list.md) — identical to main, whose older CI run passed. Reformat them so the `check` gate is green here. Note: the daily bug_list autoscan cron will re-drift bug_list.md unless it also formats / is ignored (separate follow-up). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
cryptolir
added a commit
that referenced
this pull request
Jun 27, 2026
#91) STATUS.md: new Last Session entry for the deterministic durable-memory recall roll — PR #90, image v2026.06.27.1 (sourceSha ed9f2a5), pinned to life only, rollback v2026.06.20.3; prod E2E smoke confirmed (new chat recalls the saved goal on the first message). INFRASTRUCTURE.md: bump the life-ahead pin to v2026.06.27.1. Co-authored-by: Liran Peretz <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes Issue 2 of the QA-fix plan (#89): durable memory not recalled across chats (report 4A). A goal saved in one app chat ("build a daily writing routine") was not recalled in a new chat — the agent asked the user to remind it.
Root cause (verified, not guessed)
add_episodesucceeded for the test user, and a livesearch_memory_factsagainst that group returns the exact fact:"טל shares that her goal for this month is to establish a daily writing routine."search_memory_facts, and under the slim app prompt it often skips that at the start of a new chat. There was no deterministic recall (unlikeapp_profile, which is injected every turn).Fix — deterministic recall injection (mirrors the proven
app_profilebootstrap)src/agents/graphiti-recall-client.ts— read-onlysearch_memory_factsover the streamable-HTTP MCP endpoint. Preserves thegraphiti-proxycapability boundary (codex P1): the only scope input is a server-derivedgroupId; unsafe/missing ids fail closed; the outbound call hard-setsgroup_ids:[groupId]and there is no parameter by which a caller could passgroup_id/group_ids/center_node_uuid. Usesnode:httpwithHost: localhost:8000(the server requires it), exactly like the proxy. Timeboxed viaAbortController.src/agents/memory-recall-context.ts—appendMemoryRecallBootstrapFile: resolves the appUserId (resolveAppUserId→appUserIdFromSessionKeyfallback), derives the group id byte-identically to thelife-memory-scopehook (app_<sanitized>), fetches the top ~8 facts, injects them as a syntheticMEMORY_RECALL.md. ~2.5s timebox + fail-open. No cross-turn cache (codex P2 — a TTL cache could serve stale "no memories" right after a write; deferred until write-invalidation exists).src/agents/bootstrap-files.ts— chained afterappendAppProfileBootstrapFile(post-shaping, so it's never excluded and is budgeted by the clamp).ops/graphiti-life/agents-md-memory-section.md— one line telling the agent the top facts are pre-injected asMEMORY_RECALL.md; lean on it first, search only for more.Tests / checks
group_ids:[groupId], no forbidden scope fields forwarded, theHostheader, timeout abort), hook group-id parity, fail-open, and a no-stale-cache guard (two turns, the second sees a just-written fact).pnpm check(format + tsgo + lint) green. Existingapp-profile-contextsuite still green (49 total).Deploy note (not in this PR)
The deployed life workspace
AGENTS.app.mdon the host is seeded fromagents-md-memory-section.md— it needs the same one-line sync at roll time. Gateway env already hasGRAPHITI_URL(defaults tohttp://graphiti-mcp:8000/mcp); no new config required.🤖 Generated with Claude Code