-
Notifications
You must be signed in to change notification settings - Fork 551
Description
Bug Description
memory_list and memory_recall tools return no results when called without an explicit scope parameter, even though memories exist in agent-specific scopes.
Steps to Reproduce
- Store memories with scope
agent:tg-dm-xxx(agent-specific scope) - Call
memory_listwithout any scope parameter - Result: "No memories found" even though entries exist
Root Cause
In src/scopes.ts, the getAllScopes() method only returns explicitly defined scopes from this.config.definitions:
getAllScopes(): string[] {
return Object.keys(this.config.definitions);
}When memory_list is called without a scope parameter, it falls back to:
let scopeFilter = context.scopeManager.getAccessibleScopes(agentId);For an agent with no explicit agentAccess entry and agentId = undefined, getAccessibleScopes(undefined) calls getAllScopes() which only returns [global], missing all agent:xxx scopes.
The issue is that built-in dynamic scope patterns like agent:${agentId} are not included in getAllScopes() even though getAccessibleScopes(agentId) would return them correctly for a known agentId.
Expected Behavior
Calling memory_list or memory_recall without a scope parameter should return memories from all accessible scopes including agent-specific scopes.
Suggested Fix
One approach: modify getAllScopes() to also include the agent pattern scopes:
getAllScopes(): string[] {
const defined = Object.keys(this.config.definitions);
const agentScopes = Object.keys(this.config.agentAccess).map(id => `agent:${id}`);
return [...new Set([...defined, ...agentScopes])];
}Or alternatively, fix the fallback logic in memory_list to handle the case where no agentId is resolved.