/agentic:agentic-cleanup [<slug> | --all]from agentic
Clean up after a merged PR. Removes the work item's worktree and branches, updates the default branch, archives the work-item folder. Use when a PR has merged, or with --all to sweep stale worktrees and branches.
Ships in agentic. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Remove everything a merged work item left behind, keep its audit trail.
Call the Skill tool with "agentic-use-workflow" (no Skill tool → open its SKILL.md and follow it) unless already loaded. Run git from the main checkout. Read PR state with the platform's tooling: gh, or a Bitbucket / GitLab CLI or MCP.
workspace matches the current branch or worktree; none → ask.--all → every non-archived work item in {output} that has a PR or a branch.{output}/_archive/ → say so, stop.workspace recorded → use the PR's head branch.Per target, run from the main checkout bun {agentic-use-workflow}/scripts/agentic.ts cleanup check --work {slug} first. Exit 0 → nothing left, only archive. Exit 1 → it prints one missing: line per gap: print them all, act only on those. A gap in the workflow or PR (workflow not completed, pr not merged, no pr url) is a stop: report it, go on only per Merged? below. Branch, worktree and stray-file gaps are the Clean work.
Never delete the default branch. Uncommitted changes, or commits neither on the remote, nor in the merged PR's head (headRefOid), nor in the default branch, in the worktree or on the branch → ask, never discard.
Log cleanup started (step: null) before step 1. Each step is skipped when cleanup check did not report it:
kind: worktree → git worktree remove {path}, then git worktree prune.git branch -d refuses squash-merged branches: force only when the PR state confirms the merge.Then log a note with the merge evidence (PR url and state, or merge commit) and what was removed, then cleanup completed: status becomes archived. Last, move the folder to {output}/_archive/{work-item}/. Nothing is written to it after the move; never delete it.
Done when cleanup completed is logged and the folder is in {output}/_archive/, or the work item is skipped with its reason reported.
Same rules per work item, without stopping on the first question: clean the merged and safe ones, skip anything that needs an answer. Report two lists: cleaned, and skipped with the reason (not merged, PR open, closed without merge, uncommitted or unpushed work, dirty main checkout). Then offer to go through the skipped ones that only need a yes.
Done when every target is archived or listed as skipped with its reason.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub johannwilfridcalixte/agent-skills --plugin agentic40 skills in this plugin
/agentic-babysit-prGet a work item's PR merge-ready and watch it until it merges: push, open or reuse the PR, fix CI and comments in a loop. Use to open a PR, get it green, handle feedback, or watch it to merge./agentic-change-featureChange an existing feature's behaviour, from request to merged PR; `light` for a small change./agentic-clean-architectureUse when writing or modifying backend code that has business logic — services, domain models, use cases, APIs with validation/calculations/state transitions. Default for any non-trivial backend work./agentic-code-testingTesting rules (layers, test doubles, flakiness, naming, coverage). Use when writing or reviewing tests, or fixing a flaky one./agentic-configureSet up agentic: write the config (models per step, reviewers, folders, profiles, limits)./agentic-debugFix a bug end to end (diagnose the root cause, regression test first, implement, review, babysit PR, cleanup).