---
description: "Delete per-task project logs under ~/.claude/logs/multi-agent (filter by age/project/task). Audit trail + metrics are preserved. Dry-run first; confirms before deleting. Use when task logs have built up and need trimming by age, project or task."
disable-model-invocation: true
description-tr: "~/.claude/logs/multi-agent altındaki görev bazlı proje loglarını siler (yaş/proje/görev filtresi). Denetim izi + metrikler korunur. Önce dry-run; silmeden önce onay alır."
argument-hint: "[--older-than=<days>] [--project=<name>] [--task=<id>] [--yes]"
parameters: [{"name":"--older-than","kind":"text"},{"name":"--project","kind":"text"},{"name":"--task","kind":"run-id"},{"name":"--yes","kind":"flag"}]
gui: button
destructive: true
confirm: required
---

# multi-agent prune-logs  -  Clear Per-Task Project Logs

> **Pickers follow** `$HOME/.claude/multi-agent-refs/picker-contract.md`: never a one-option call, and branch on the option selected, not on its text.

Every run persists a task log dir at
`~/.claude/logs/multi-agent/<project>/<task>/` (agent-state.json, agent-log.md,
tracker-state.json, otel-spans.jsonl). These accumulate forever. This prunes
whole task dirs, with optional age / project / task filters.

Backed by `$HOME/.claude/scripts/prune-logs.sh`. Safe by default: it previews
and deletes nothing until you confirm. The audit trail (`audit.jsonl` +
rotations) and the metrics corpus (`metrics.jsonl`, `metrics-summary.md`) live
at the log-root top level and are never removed; `.counter` files survive too.

Unlike `/multi-agent:purge` (which wipes worktrees, branches, logs, and state
together), this only removes log dirs and leaves your worktrees and branches
untouched.

Not in scope: `~/.claude/logs/multi-agent-toolkit/`, the sibling directory where
`multi-agent-toolkit-mcp` saves tool outputs too large to return inline. That
directory prunes itself at write time (newest 50 files, 7 days), because an
MCP-only user has no pipeline installed and "some other tool cleans it" would
mean nobody does. Mentioned here so the files are not a mystery when you come
looking for what is using space under `logs/`.

## Steps

1. **Preview (dry-run)**  -  run the pruner with no `--yes`, forwarding any
   `--older-than=<days>`, `--project=<name>`, or `--task=<id>` the user gave:

   ```bash
   bash $HOME/.claude/scripts/prune-logs.sh ${ARGUMENTS}
   ```

   It lists each task log dir that matches and the space it would free.

2. **Nothing to do**  -  if the output says `nothing matched`, stop and report
   there is nothing to prune.

3. **Confirm**  -  surface a native `AskUserQuestion` picker (no typed keyword),
   in `outputLanguage`:
   - `question`: "Delete the listed task log dirs now?" (include the count and
     freed-size estimate, and note audit + metrics are preserved)
   - `header`: "Prune logs" (English, <=12 chars)
   - `options`: `{ label: "Delete logs", description: "Remove the listed task log dirs" }`,
     `{ label: "Cancel", description: "Keep everything, change nothing" }`
   - Anything other than **Delete logs** -> cancel and change nothing.

4. **Delete**  -  on confirm, re-run with `--yes` plus the same filters:

   ```bash
   bash $HOME/.claude/scripts/prune-logs.sh --yes ${ARGUMENTS}
   ```

5. **Report**  -  echo the `══ prune-logs: removed N task log dir(s), freed ~X ══`
   summary line.

## Notes

- Pruning a log dir does not affect the run's git history or its commit/PR;
  it only removes the local state + log artifacts.
- To also reclaim `/tmp` scratch, use `/multi-agent:garbage-collect`.
- For a full reset (worktrees + branches + logs + state), use
  `/multi-agent:purge`.
