---
description: "Uninstall the pipeline from Claude Code + Copilot CLI. Keychain access tokens are always left untouched; --all-data also clears pipeline settings, logs, per-repo memory and the knowledge base. Asks for double confirmation. Use when the pipeline should be removed from Claude Code and Copilot CLI."
disable-model-invocation: true
description-tr: "Pipeline'ı Claude Code + Copilot CLI'dan kaldırır. Keychain erişim token'larına asla dokunulmaz; --all-data ayrıca pipeline ayarlarını, loglarını, repo bazlı hafızayı ve bilgi tabanını da siler. Çift onay ister."
argument-hint: "[--dry-run] [--all-data] [--claude] [--copilot] [--target=<path>]"
parameters: [{"name":"--dry-run","kind":"flag"},{"name":"--all-data","kind":"flag"},{"name":"--claude","kind":"flag"},{"name":"--copilot","kind":"flag"},{"name":"--target","kind":"path"}]
gui: button
destructive: true
confirm: required
---

# multi-agent uninstall  -  Token-Preserving Uninstall

> **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.

Uninstalls the pipeline itself from the system. **This is different from `:purge`:**

| Command | What it removes |
|---|---|
| `:purge` | Active tasks' worktrees / branches / logs / state (development data) |
| `:uninstall` | The pipeline itself: skills, commands, agents, scripts  -  from every CLI |

## Two modes

| Mode | Flag | Removes | Keeps |
|---|---|---|---|
| **Standard** (default) | (none) | distributed files: commands, skills, agents, scripts, refs, schemas, lib (except the credential reader) | tokens + `lib/credential-store.sh` + the `multi-agent-toolkit` MCP registration, `CLAUDE.md`, `rules/`, `multi-agent-preferences.json`, all logs |
| **Full cleanup** | `--all-data` | standard PLUS `~/.claude/logs/multi-agent/` (task logs, state, metrics, audit), `~/.claude/memory/multi-agent/` (learnings ledger + triage corpus), `~/.claude/knowledge/` (per-repo knowledge base + code graph) and everything in `multi-agent-preferences.json` **except `global.keychainMapping`** | tokens + the credential reader + the mapping that names them + the MCP registration, `CLAUDE.md`, `rules/` (user-owned) |

Tokens in the OS credential store are NEVER removed by either mode.

## Never deleted (either mode)

- **Keychain** personal access tokens (GitHub, Jira, Bitbucket, Confluence, Telegram, Vercel, Firebase, etc.)
- `~/.claude/lib/credential-store.sh` - the only way to READ those tokens. Deleting it while keeping the secrets preserves a locked box and throws away the key, and the closing message below used to advise a command uninstall had just removed.
- `global.keychainMapping` inside `multi-agent-preferences.json`, even under `--all-data`. It carries no secret, only logical-name -> credential-store key; without it the preserved tokens sit under names the user never chose and no longer has a record of. Everything else in that file is removed.
- The **`multi-agent-toolkit` MCP registration**. Its device, accessibility and store-audit tools work with no pipeline at all - the same reason the tokens stay. The retired `dev-toolkit` name IS deregistered: it points at a registration nothing maintains, so leaving it is litter, not preservation.
- `~/.claude/CLAUDE.md` (user customisations)
- `~/.claude/rules/` (user-owned; installed write-if-missing, never overwritten)
- User content OUTSIDE the `<!-- multi-agent-pipeline:begin/end -->` markers (`copilot-instructions.md`)
- Local-only alias wrappers (`local-only: true` frontmatter) under `commands/multi-agent/` (user-authored, exist nowhere else)
- User-authored skill dirs and agent files (only pipeline-shipped names are removed)

Settings (`multi-agent-preferences.json`), the log root (`~/.claude/logs/multi-agent/`), the memory root (`~/.claude/memory/multi-agent/`) and the knowledge root (`~/.claude/knowledge/`) are kept by default and removed only when the user picks full cleanup (`--all-data`). The last two are the ones a user usually means by "remove everything": they hold prose about a private codebase and, in `code-graph.json`, every symbol name in it.

Per-repo memory written INSIDE a repo (`$PROJECT_ROOT/.multi-agent/memory/`) is never touched by either mode. It lives in the user's working tree, may be committed, and uninstalling a tool is not a licence to edit their repos.

## Steps

1. **Determine scope**  -  parse `$ARGUMENTS`:
   - No target flag: every installed target (default)
   - `--claude / --copilot`: selective
   - `--all-data`: full cleanup (also removes settings, logs, per-repo memory and the knowledge base)
   - `--target=<path>`: adapter target (default: cwd)
   - `--dry-run`: report only, delete nothing

2. **Ask the cleanup depth** (skip if the user already passed `--all-data` or `--dry-run`)  -  native `AskUserQuestion` picker in `outputLanguage`:
   - `question`: "How much should uninstall remove? Tokens are preserved either way."
   - `header`: "Scope" · `options`:
     `{ label: "Standard", description: "Remove pipeline files; keep settings, logs, memory, knowledge" }`,
     `{ label: "Full cleanup", description: "Also remove settings, logs, per-repo memory and the knowledge base" }`
   - **Full cleanup** adds `--all-data` to the flag set below.

3. **Show a preview** (run the script with `--dry-run`, carrying the chosen flags):
   ```bash
   node "$HOME/.claude/scripts/uninstall.mjs" --dry-run --yes <flags>
   ```
   Show the output raw to the user. In full-cleanup mode the preview lists the extra settings + log removals.

4. **First confirmation**  -  native `AskUserQuestion` picker (no typed y/N):
   - `question`: "Remove the pipeline from the listed targets? Tokens, the credential reader and the toolkit MCP entry are NOT touched." (`outputLanguage`)
   - `header`: "Uninstall" · `options`: `{ label: "Continue", description: "Proceed to the final confirmation" }`, `{ label: "Cancel", description: "Keep everything installed" }`
   - **Cancel** → exit.

5. **Second confirmation** (paranoia gate, same pattern as `:purge`)  -  a second `AskUserQuestion` picker:
   - `question`: full cleanup -> "This also erases settings + all logs and is irreversible. Proceed?"; standard -> "This is irreversible. Permanently remove the pipeline files now?" (`outputLanguage`)
   - `header`: "Confirm" · `options`: `{ label: "Remove permanently", description: "Run the uninstall; tokens, their reader and the MCP entry are preserved" }`, `{ label: "Cancel", description: "Abort, change nothing" }`
   - Anything other than **Remove permanently** → cancel.

6. **Remove**  -  run the real script with `--yes` (and `--all-data` if full cleanup was chosen):
   ```bash
   node "$HOME/.claude/scripts/uninstall.mjs" --yes <flags>
   ```

7. **Confirm**:
   ```
   ✓ multi-agent-pipeline removed.
   ℹ Personal access tokens preserved in Keychain.
   ```
   Remind the user how to inspect the tokens (cross-platform  -  same command on every backend). This path is preserved by the uninstall above, so the command actually runs:
   - `~/.claude/lib/credential-store.sh get "<service>"`
   - the logical key names are still in `multi-agent-preferences.json` under `global.keychainMapping`

   Say plainly what was left behind, rather than letting the user discover it: the credential reader, the key mapping, and the `multi-agent-toolkit` MCP entry all survive on purpose. Someone handing the machine over should know the mapping reveals WHICH services were used (never any secret) and can delete `multi-agent-preferences.json` by hand if that matters.

8. **Reinstall** (if the user wants to):
   ```bash
   npx @mmerterden/multi-agent-pipeline install
   ```

## Notes

- This command does NOT remove the *installed copy* of the npm package. It only removes the distributed files. `npm uninstall -g @mmerterden/multi-agent-pipeline` is a separate step.
- `--dry-run` is always safe  -  zero side effects.
