-
Notifications
You must be signed in to change notification settings - Fork 574
Description
Problem
When calling memory_stats or memory_list without explicitly passing the scope parameter, the tools return 0 results even though memories exist in the agent's private scope.
Root Cause
LanceDB stores memories isolated by agent scope (e.g., agent:main, agent:intel).
memory_recallperforms vector search which scans across scopes — not affectedmemory_statsandmemory_listdefault to the global scope whenscopeis not provided — returns 0
Current Behavior
// Agent "main" calls memory_stats without scope -> returns 0
// Agent "main" calls memory_recall with any query -> returns results from agent:main scope
Expected Behavior
When an agent calls memory_stats or memory_list without a scope parameter, it should automatically query that agent's private scope (agent:<agentId>), not the global scope.
Suggested Fix
In src/tools.ts, update memory_stats and memory_list to use the calling agent's private scope as the default when scope is not provided:
// Instead of defaulting to global (empty result)
const scopeFilter = scope
? [scope]
: context.scopeManager.getAccessibleScopes(agentId);Or at minimum, document this behavior clearly in the tool descriptions.
Workaround
Pass scope: "agent:main" explicitly when calling these tools as the main agent.
Impact
New users naturally assume stats/list should return their agent's memories. This UX issue causes confusion and unnecessary debugging.