### Mode: uninstall

<!-- opt-in-capability: none — removal of what setup placed, never a capability a user could enable -->

The **guarded teardown** — the inverse of `init` (the kit + engine skills) + `setup` (the bridges) + a hidden deploy. **In-agent, opt-in**, and built around one hard rule: **it never deletes user-authored content.** Run **`--dry-run` first, always**, show the user the classified plan in plain language, get explicit consent, then re-run with `--yes`. It **never commits**.

Run `node ${CLAUDE_SKILL_DIR}/tools/uninstall.mjs [<member>] [--dir <project>] [--bindir <path>] [--dry-run | --yes]`:

- `<member>` — limit the skill axis to one member (`agent-workflow-kit` / `-memory` / `-engine` / a bridge); omit for the **whole family**.
- `--dir <project>` — also reverse the **project-deployment** surfaces in `<project>`.
- `--bindir <path>` — where the bridge wrappers were linked (default `~/.local/bin`, mirrors `setup`).
- `--dry-run` — print the plan and change **nothing** (run this first). `--yes` — apply the **auto-removable** set.

It classifies every surface into four classes and acts accordingly:

- **remove** (safe) — an installed skill dir that is **provably ours** (valid manifest, `name`+`kind` match). A dir present but **not provably ours** (`foreign`/`stub`/`invalid`/unreadable) → **STOP**: left untouched **and reported**, while the teardown still removes the members that ARE ours (a not-ours surface is never clobbered, and never blocks removing the rest — the per-item `setup` posture). **Preflight-then-mutate:** the apply run builds its OWN fresh plan and preflights every mutable surface against it; if one has changed by then (a skill no longer ours, a wrapper turned foreign, a hook that lost our marker, is unreadable or is no longer a regular file, a malformed fence, or a path now reachable only through a symlink), the run **aborts with zero changes**. A surface that changes AFTER that preflight — during the mutation itself — cannot be answered that way, and the report distinguishes two outcomes rather than flattening them. A removal **refused before it touched anything** (containment, or a skill directory that stopped being provably ours — re-established immediately before the recursive delete, not only at preflight) is reported as **left untouched**, which is a claim the refusal proves. A removal that **failed part way** proves nothing of the sort: it is reported as **possibly partially removed**, and it STOPS the run, because continuing to delete later surfaces on top of an unknown state is not a teardown. Either way the run ends with a typed **INCOMPLETE** stop listing both categories plus what had already been applied — or stating plainly that nothing had been. That outcome is a real one, not a promise of atomicity.
- **reverse** (managed-marker) — a bridge **wrapper symlink that points at our source** (a foreign/non-symlink one → STOP); the hidden-mode **managed fence** (via the existing `--unhide` path — only the fenced lines); a **pre-commit hook carrying our marker** (an unmarked / user hook → left + reported).
- **KEEP — never deleted** (report-only) — `docs/ai`, `AGENTS.md`, `CLAUDE.md`, `docs/plans`, and `.claude/settings.json` (the `includeCoAuthoredBy` edit **and** any `permissions.defaultMode`/`permissions.allow` the velocity profile may have seeded). The tool **prints the exact `rm` / `git rm --cached`** for the docs/entry files and an **edit** instruction for `settings.json` (never an `rm` — it may hold your own settings); the **user** runs them. Surface this in plain language; never delete on their behalf.
- **KEEP — the MCP registration** (report-only, same posture, two seams): the `"agent-workflow"` entry in **`.mcp.json`** at the project root, and in `.claude/settings.json` the `enabledMcpjsonServers` membership plus the two tool rules `mcp__agent-workflow__path_inventory` and `mcp__agent-workflow__repo_search`. Both are reported with the exact **edit** to make by hand — `.mcp.json` may declare servers this kit never placed, and the settings file may hold your own rules, so neither is ever rewritten or removed. A `.mcp.json` that is a symlink or a sandbox device mask is reported **unread**, never followed and never parsed.

**Shared globals:** removing `agent-workflow-memory` / `agent-workflow-engine` / a bridge removes a **global** skill that another project on the machine may use — say so before applying. **Windows:** the wrappers are POSIX; the skill-dir + project arms still work, the wrapper arm reports *use WSL*.
