Skip to content

memory_stats and memory_list return 0 when scope not provided — confusing UX for new users #378

@zcya198

Description

@zcya198

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_recall performs vector search which scans across scopes — not affected
  • memory_stats and memory_list default to the global scope when scope is 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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions