Skip to content

[bug] memory.search limit is silently capped by retrieval topK (default 6) #1884

Description

@yyhhyyyyyy

Summary

searchMemories (src/main/presenter/memoryPresenter/services/retrievalService.ts:114-130) delegates to retrieve(), whose fusion already slices results to the agent's retrieval topK (default 6, core/scoring.ts fuse slice). The subsequent hits.slice(0, limit) can therefore never return more than topK rows, while the route contract (memory.routes.ts memorySearchRoute, limit <= 500) and MemoryClient.search advertise a real limit.

Effect: the Memory Manager search (MemoryManagerPanel.vue) shows at most ~6 hits over any corpus size; limit is a dead parameter beyond topK.

Severity

P2 — functional gap in the management search surface; route contract and implementation disagree.

Fix direction

Thread an explicit topK override (clamped by MAX_TOP_K = 100) from searchMemories(limit) through retrieve/fuse for the management path only; agent-facing recall keeps config topK. Align the route schema max with the effective cap.

SDD doc: docs/issues/memory-audit-hardening/ (spec.md + plan.md + tasks.md)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions