Skip to main content
Glama

memory_maintenance_run

Run maintenance on a memory namespace: dry-run for a zero-write report, or apply to retire duplicates, evict auto-band entries, and stage judgment-call proposals for review.

Instructions

Run one sleep-time maintenance pass on a namespace (§6.3).

DRY-RUN by default (apply=False): computes the full would-do report with ZERO writes — no ledger row, no proposals. apply=True claims the lease, runs the provably-safe auto band (exact-dup retirement + auto-band eviction) AND stages the judgment-call proposals for human review. Symmetric with lean-memory-maintain. NOTE the asymmetry with the LM_MAINT_AUTO auto-spawn path: that fires --apply --auto-only (auto band only, never stages proposals), so unattended runs cannot grow the review queue — only interactive apply=True stages.

Returns the run summary: mode, staged/merged/demoted counts, and threshold stats.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applyNoFalse (default): dry-run — compute the full would-do report with zero writes. True: claim the maintenance lease, apply the provably-safe auto band, and stage judgment-call proposals for review via memory_review_queue.
namespaceYesIsolation key for one memory store. Each namespace is a separate local SQLite file under LM_DATA_ROOT (default ~/.lean_memory); namespaces never see each other's facts. Use one per agent, project, or user whose memory must stay separate. Created on first access.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

It discloses key behavioral details: dry-run performs zero writes, apply=True claims a lease, runs a provably-safe auto band, and stages proposals. It also notes the important asymmetry that only interactive apply=True stages proposals, which is valuable context beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is logically structured with clear paragraphs and a note section. It is slightly verbose but every sentence carries meaningful operational detail, so the length is justified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, the description covers all essential aspects: modes, lease behavior, proposal staging, comparison to auto-spawn, and return summary. The output schema is present, and the description still summarizes return values, making it complete for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides 100% parameter coverage with detailed descriptions. The tool description adds extra context by explaining the dry-run/apply distinction and the maintenance lease behavior, but it mostly reinforces rather than substantially extends the schema's parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Run one sleep-time maintenance pass on a namespace', which clearly defines the tool's function. It further distinguishes behavior by explaining dry-run vs. apply modes and notes symmetry with `lean-memory-maintain`, separating it from sibling status tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly explains when to use dry-run (default) versus apply=True, and warns about the LM_MAINT_AUTO auto-spawn path, noting that unattended runs never stage proposals. This gives clear when/when-not guidance and references an alternative invocation path.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Wuesteon/lean-memory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server