Preview and delete `.trace` bundles under TRACE_ROOT
cleanupTracesRemove stale .trace bundles from the trace directory to reclaim disk space. Use dry-run mode to preview candidates before authorizing deletion.
Instructions
[ops] Triage and clean up .trace bundles produced by recordTimeProfile. Each bundle is typically tens to hundreds of MB; after a few sessions the trace root fills up fast and v1.8 had no built-in cleanup.
Default-safe: dryRun: true by default. The tool returns the list of candidates with path, sizeMB, and ageDays (sorted oldest-first) but deletes nothing. Pass dryRun: false only when the user has reviewed the candidates and authorized deletion.
Scope: restricted to MEMORYDETECTIVE_TRACE_ROOT by default. To clean up an arbitrary directory, pass root: <path> AND set MEMORYDETECTIVE_ALLOW_EXTERNAL_CLEANUP=1 in the env. Without the env var the tool returns ok: false with the failure reason and deletes nothing; destructive disk operations outside the configured boundary are default-deny.
Recursion boundary: the tool walks subdirectories looking for *.trace directories, but stops at the .trace boundary (does NOT descend INTO bundles). xctrace writes structured content inside (Run1, Form1.template, etc.) that must not be treated as nested bundles.
Use olderThanDays: N to keep recent traces and only target stale ones (e.g. older than 7 days). Omit to consider all bundles regardless of age.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| olderThanDays | No | Only consider `.trace` bundles whose modification time is older than this many days. Omit to consider all traces under the root regardless of age. | |
| dryRun | No | When `true` (default), the tool returns the list of candidates without deleting. Pass `false` to actually delete. The default-to-true means an accidental call previews instead of destroying. | |
| root | No | Directory to scan. Defaults to `MEMORYDETECTIVE_TRACE_ROOT`. If the resolved path is outside the configured trace root, the tool requires `MEMORYDETECTIVE_ALLOW_EXTERNAL_CLEANUP=1` in the environment to proceed. | |
| outputFormat | No | Response format. Omitted or `json` (default, preserves v1.8 behavior) returns JSON.stringify of the result. `markdown` renders a human-readable view of the same data. `both` returns both content items in one response, so a client can display markdown to the user and parse JSON for the agent loop without a second call. `verify-fix-table` (v1.10, applies to `analyzeAbandonedMemory` and `diffMemgraphs`) emits a focused 4-column markdown comparison table (Class | Before | After | Delta) of the actionable rows; other tools fall back to `markdown` for this value. |