Skip to content
Agentmart
Submit a tool

ctf-clean

Safely GC stale agent cruft (worktrees, registrations, tmux windows, agent rows).

Skill by asker26

IndexedMIT★ 4
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/asker26-ctf-clean

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Safely GC stale agent cruft (worktrees, registrations, tmux windows, agent rows). Offers to PR un-merged work first; reports isolation clones. Usage: /ctf-clean [--dry-run]

Use cases: agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/ctf-clean

What's inside

Skill name
ctf-clean
Description
Safely GC stale agent cruft (worktrees, registrations, tmux windows, agent rows). Offers to PR un-merged work first; reports isolation clones. Usage: /ctf-clean [--dry-run]
License
MIT
Metadata
version: 1.0.0
Instructions
51 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# ctf-clean — agent workspace janitor

Reclaim stale agent cruft from the task framework. Auto-removes only worktrees
whose task is `done`/merged with no real uncommitted work; offers to PR un-merged
work before removing it; reports (never deletes) `/isolate` clones.

**Safety invariant:** only cruft tied to a `done` task is ever touched. Anything
tied to `todo`/`in-progress`/`in-review` is left alone — that's `agent-watcher`'s
job, not this skill's.

## Steps

1. Run the sweeper. If the user passed `--dry-run`, pass it through, print the
   output, and STOP — touch nothing else.
   ```bash
   scripts/agent-clean ${ARGUMENTS}
   ```
2. Show the summary block (worktrees removed + GB reclaimed, registrations
   pruned, tmux windows killed, agent rows reset).
3. Parse the `ATTENTION` lines (tab-separated: `ATTENTION  <task_id>  <branch>
   <status>  <why>`). These are un-merged / active worktrees that were NOT
   removed. For each whose `why` contains "un-merged" (skip ones marked "active
   task"), offer three choices:
   - **(a) PR + remove** — open a PR from the branch, then remove the worktree:
     ```bash
     git -C <project.local_path> push -u origin task-<id>
     gh pr create --repo <org/repo> --head task-<id> --title "<task title>" --body "<bullet summary>"
     git -C <project.local_path> worktree remove --force <framework_root>/.workspaces/agent-<id>
     ```
     Resolve `<project.local_path>` and `<org/repo>` from `tasks`/`projects`;
     `<framework_root>` is the claude-task-framework repo root (where
     `scripts/agent-clean` lives) — the worktree's absolute path, since it's
     registered to the project repo but lives under the framework's `.workspaces/`.
     Title + bullets follow the repo's PR conventions; if the project's org has
     Jira/Discord configured, update them per the Autonomy rules.
   - **(b) keep** — leave it untouched.
   - **(c) force-delete** — `git -C <project.local_path> worktree remove --force
     <framework_root>/.workspaces/agent-<id>` without a PR.
   Worktrees marked "active task" are reported only — never offer to remove them.
4. Print the `ISOLATION` lines verbatim (tab-separated: `ISOLATION  <path>
   <size>  <git summary>`). These are user isolation clones — report only, never
   act on them.

## Boundaries

- Never deletes or modifies isolation clones.
- Never deletes `agents` rows (the sweeper only resets orphaned `running` rows to
  `cancelled`).
- Never touches anything tied to a non-terminal task.

From asker26/claude-task-framework, MIT.

Signals

Stars
4
Forks
0
Open issues
0
Last commit (this folder)
Jun 1, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from asker26

Cite this page

ctf-clean skill. Agent Mart. https://agentmart.dev/skills/asker26-ctf-clean (last updated 2026-10-24)