Source: Source pull request number: 869 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix(smart-search): apply the project filter to results, not just lessons
Author: jwfaye
State: open
Draft: no
Merged: no
Head: jwfaye/agentmemory:fix/smart-search-project-scope @ 7a9a446
Base: main @ 749c280
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-06-09T12:56:29Z
Updated: 2026-06-09T13:49:48Z
Closed: (not closed)
Merged at: (not merged)
Original PR body:
What
mem::smart-search accepts a project argument but never applies it to its observation results — a project-scoped search returns observations from every project (the cross-project leak reported in #787). mem::search already scopes correctly; this brings smart-search in line, which also covers the MCP memory_smart_search / memory_recall tools and /smart-search that route through it.
How
Resolve each hit's project the way mem::search does — the session's project when the session exists, otherwise the memory's own KV.memories record (entries indexed via mem::remember use a synthetic sessionId with no session row). A null result means the project is unknown and the hit passes through (backward-compatible). Applied in the expand-ids branch, the hybrid/compact path, and the over-fetch trigger; the normalized filterProject is also passed to lesson recall. Resolution is cached and runs concurrently.
Verify
npm run build clean; test/smart-search.test.ts + test/agent-isolation-search.test.ts green (the tests seed KV.memories and use a synthetic memory sessionId so they exercise the real resolver path, not a synthetic observation that already carries project).
- Live on a running instance:
smart-search {project: "review"} returns the review observation; {project: "builder"} excludes it.
Fixes #787
Local branch: review/issue-787-pr-869-smart-search-project-scope
Fork PR: not created
Fork decision: adapted for this fork according to local review documentation. Local decision evidence: adapt minimal fix from both candidates, preferring PR 869-style cached project resolution for core filtering plus only the missing MCP schema/handler tests and implementation from PR 806.
Verification: see local task record docs/todos/2026-06-15-issue-787-smart-search-project-scope/todo.md for recorded checks and evidence.
Notes: tracker updated from local review documentation on 2026-06-16; issue remains open until separately closed.
Source: Source pull request number: 869 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix(smart-search): apply the project filter to results, not just lessons
Author: jwfaye
State: open
Draft: no
Merged: no
Head: jwfaye/agentmemory:fix/smart-search-project-scope @ 7a9a446
Base: main @ 749c280
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-06-09T12:56:29Z
Updated: 2026-06-09T13:49:48Z
Closed: (not closed)
Merged at: (not merged)
Original PR body:
What
mem::smart-searchaccepts aprojectargument but never applies it to its observation results — a project-scoped search returns observations from every project (the cross-project leak reported in #787).mem::searchalready scopes correctly; this bringssmart-searchin line, which also covers the MCPmemory_smart_search/memory_recalltools and/smart-searchthat route through it.How
Resolve each hit's project the way
mem::searchdoes — the session's project when the session exists, otherwise the memory's ownKV.memoriesrecord (entries indexed viamem::rememberuse a synthetic sessionId with no session row). Anullresult means the project is unknown and the hit passes through (backward-compatible). Applied in the expand-ids branch, the hybrid/compact path, and the over-fetch trigger; the normalizedfilterProjectis also passed to lesson recall. Resolution is cached and runs concurrently.Verify
npm run buildclean;test/smart-search.test.ts+test/agent-isolation-search.test.tsgreen (the tests seedKV.memoriesand use a syntheticmemorysessionId so they exercise the real resolver path, not a synthetic observation that already carriesproject).smart-search {project: "review"}returns the review observation;{project: "builder"}excludes it.Fixes #787
Local branch: review/issue-787-pr-869-smart-search-project-scope
Fork PR: not created
Fork decision: adapted for this fork according to local review documentation. Local decision evidence: adapt minimal fix from both candidates, preferring PR 869-style cached project resolution for core filtering plus only the missing MCP schema/handler tests and implementation from PR 806.
Verification: see local task record docs/todos/2026-06-15-issue-787-smart-search-project-scope/todo.md for recorded checks and evidence.
Notes: tracker updated from local review documentation on 2026-06-16; issue remains open until separately closed.