Skip to main content
Glama

memory_clear

DestructiveIdempotent

Clears all stored facts for a namespace by deleting its SQLite file. Irreversible; use when the entire history must be forgotten. Other namespaces remain untouched.

Instructions

Delete ALL memory for a namespace by removing its SQLite file. Irreversible.

Use only when the namespace's entire history should be forgotten; there is no per-fact deletion. Idempotent — clearing a missing namespace succeeds as a no-op. Other namespaces are untouched.

Refuses (returns an explanatory message, changing nothing) while a LIVE maintenance lease with a fresh heartbeat is held for the namespace (spec §7.3): a POSIX unlink cannot safely interrupt an in-flight maintenance run — the run's open handle would keep committing to the unlinked (ghost) inode, silently losing that work. So clear waits for the run to finish or its lease to go stale. A stale or absent lease clears normally; the maintenance runner itself independently skips a namespace cleared mid-run at its next batch boundary.

Residual race (spec §7.3, known limitation): a clear that lands in the sliver BETWEEN this lease-check and the unlink is not prevented — full cross-process file locking is deliberately out of scope for v1. The two guards (this refusal + the runner's batch-boundary skip) shrink the window; they do not close it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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
resultYes
Behavior5/5

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

Beyond the annotations (destructiveHint, idempotentHint), the description discloses the file-removal mechanism, irreversibility, the lease-refusal behavior, and the known residual race condition. This is substantial behavioral context that helps an agent predict edge-case behavior and safety trade-offs.

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 front-loaded with the core action and irreversibility in the first sentence. The later sections on lease handling and race conditions are verbose but each sentence adds meaningful safety context. It is not maximally concise but well-organized.

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 destructive and concurrency-sensitive nature, the description fully covers normal operation, edge cases (missing namespace, live lease), isolation guarantees, and known limitations. The output schema can handle return-value details, so the description is complete enough for safe invocation.

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

Parameters3/5

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

The input schema already fully documents the 'namespace' parameter with 100% coverage, including its meaning as an isolation key and file path. The description adds no further parameter-specific detail, so the baseline score of 3 is appropriate.

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 first sentence states a specific action—deleting ALL memory for a namespace by removing its SQLite file—and clearly marks it as irreversible, distinguishing it from per-fact deletion (explicitly disclaimed) and sibling tools like memory_add or memory_search.

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

Usage Guidelines4/5

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

The description gives explicit when-to-use ('Use only when the namespace's entire history should be forgotten') and when-not-to-use ('there is no per-fact deletion'), but does not name an alternative sibling tool. It also clarifies idempotency and namespace isolation, but stops short of referencing a specific replacement tool.

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