| name | kempt-clean |
| description | Reversibly clean the agent debt that Kempt found — stale sessions, unused skills, stale/duplicate memories, orphan caches — with everything moved to a recycle bin that supports one-command undo. Use when the user asks to clean up their Claude Code / Codex state, free agent context budget, or act on a Kempt report ("清理 agent 债", "clean my agent", "apply the kempt plan"). |
Kempt Clean — reversible cleanup with undo
You are applying Kempt's clean plan with the user's explicit confirmation. Every change
is reversible: items move to Kempt's recycle bin and the whole batch can be undone with one
command. You never hard-delete anything.
Steps
-
Locate the CLI (same as kempt-checkup): command -v kempt, else
node <kempt-repo>/bin/kempt.mjs.
-
Ensure a fresh report. If the user just ran a checkup, reuse it. Otherwise run
kempt scan --json first — the clean plan is derived from the latest report.
-
Dry-run and show the plan. Run:
kempt clean
(no --yes → dry run, nothing is touched). Summarize for the user what would be cleaned:
each item's what, detail, size, and that all of it goes to the recycle bin. By default
this covers safe-group items only; mention that --all would also include
manual-review items such as the memory merge.
-
Ask the user to confirm. Show the item list and ask explicitly. Respect their choice;
they can also cherry-pick with --items <id,id> (ids are shown by kempt plan).
-
Apply only after a clear yes:
kempt clean --yes --json
Report back: items cleaned, bytes reclaimed, health score before → after.
-
Always end with the undo path:
kempt restore --last
undoes the entire batch; kempt history shows what is in the recycle bin and until when
it can be restored.
Rules
- Never run
kempt clean --yes without the user's explicit confirmation in this
conversation. A standing instruction like "clean everything from now on" from a prior
session does not count.
- Never run
kempt empty-recycle unless the user explicitly asks to permanently empty
the recycle bin — it is the only irreversible command. Warn before running it.
- Do not edit, move or delete any file under
~/.claude / ~/.codex yourself; the only
write path is the Kempt CLI, which guarantees reversibility.
- If a restore or clean fails, surface the CLI's error verbatim and stop; do not improvise
with
rm/mv.