SmartMemory
Reference

Superadmin tenant maintenance

Inspect and prune memory across a tenant's active workspaces.

These routes require the superadmin role and preserve the caller's identity. They are mounted outside /memory.

MethodRoute suffixOperation
GETorphaned-notesFind notes with no connections
GETold-notesFind notes older than days, default 365
GETsummarySummarize with max_items, default 10 per workspace
GETreflectReflect with top_k, default 5 per workspace
POSTprunePreview or execute pruning

The common prefix is /superadmin/tenants/{tenant_id}/. An optional workspace_id query parameter selects one active workspace belonging to that tenant. A foreign, inactive or missing selection returns 404 before any memory access. Without this parameter, the operation visits every active team and personal workspace. A tenant with no active workspaces returns 404.

List results are concatenated with workspace_id on each item, and count is the total length. Summary and reflection retain their dictionary structure, sum numeric counts, and concatenate lists. Dictionary list items receive workspace_id. Other list values become objects with value and workspace_id, so every entry identifies its source.

Prune defaults to dry_run=true and returns candidates plus per-workspace counts. Execution with dry_run=false returns the total pruned count and workspace_results, each containing workspace_id and pruned. Execution proceeds sequentially across workspaces. A failure stops the operation and earlier writes remain committed.

The core pruning implementation determines which strategies can execute. The existing old strategy uses the days threshold. Adding workspace selection does not add pruning strategies.