agentleFS
asker26asker26/claude-task-framework/skills/ctf-clean/SKILL.md

ctf-clean

Skill4 starsChanged 7 months agoMITView on GitHub

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]

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Safety invariant: only cruft tied to a done task is ever touched.

    line 14
  2. Very specific:

    Run the sweeper. If the user passed --dry-run, pass it through, print the output, and STOP — touch nothing else.

    line 20
  3. Distinctive:

    Never deletes or modifies isolation clones.

    line 53
  4. Very specific:

    Never deletes agents rows (the sweeper only resets orphaned running rows to cancelled).

    line 54
  5. Distinctive:

    Never touches anything tied to a non-terminal task.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.