agent-cleanfiles

agent-cleanfiles is a command for Claude Code from gpt-cmdr/ras-commander. It costs 0 tokens per session (1,020 once invoked), scanned A, original, MIT.

A repository maintenance command for periodic cleanup of completed tasks and related files. It checks task records and moves finished task folders into an archive area.

In plain words
What is it for?
Use it to scan the backlog, find completed tasks, archive their folders, and perform the command’s broader cleanup checks.
Why use it?
It reduces clutter from completed work while keeping the task records available for reference. It is intended for general maintenance rather than closing one specific task.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/gpt-cmdr/ras-commander/agent-cleanfiles
Clone the repo
git clone --depth 1 https://github.com/gpt-cmdr/ras-commander

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-cleanfiles

README.md
[![agentmods](https://agentmods.dev/badge/commands/gpt-cmdr/ras-commander/agent-cleanfiles.svg)](https://agentmods.dev/commands/gpt-cmdr/ras-commander/agent-cleanfiles)
Your own site
<a href="https://agentmods.dev/commands/gpt-cmdr/ras-commander/agent-cleanfiles"><img src="https://agentmods.dev/badge/commands/gpt-cmdr/ras-commander/agent-cleanfiles.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,020 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01020
Opus 5 $0.00000 $0.00510
Sonnet 5 $0.00000 $0.00204
Haiku 4.5 $0.00000 $0.00102

Measured 5d ago against content hash 0843fe7da29b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

agent-cleanfiles scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/agent-cleanfiles.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Perform a general cleanup pass on the repository for periodic maintenance. For task-specific cleanup, use /agent-taskclose instead.

Context Difference

Command When Context Level Aggressiveness
/agent-taskclose End of task Maximum (knows task files) High - consolidate & clean task artifacts
/agent-cleanfiles Periodic Limited (general scan) Moderate - clean completed tasks, flag uncertain

1. Agent Tasks Cleanup (DO THIS FIRST)

Review agent_tasks/.agent/BACKLOG.md for completed tasks:

Identify Completed Tasks

Scan BACKLOG.md for tasks marked [x] or in the "Completed" section:

  • Note task IDs (e.g., gauge-001, lib-001, gui-001)
  • Check if they have associated folders in agent_tasks/tasks/

Archive Completed Task Folders

For each completed task with a folder in agent_tasks/tasks/:

agent_tasks/tasks/{task-id}-{name}/
├── TASK.md      # Task description
├── RESULT.md    # Completion summary
└── {files}      # Working files

Action: Move entire folder to agent_tasks/.old/tasks/

# Example
mv agent_tasks/tasks/gui-automation-integration agent_tasks/.old/tasks/

Clean Orphaned Task Files

Check for standalone files in agent_tasks/ that relate to completed work:

  • Planning documents for completed features
  • Session handoffs that are now stale
  • Research notes incorporated elsewhere

Action: Move to agent_tasks/.old/planning/ or agent_tasks/.old/sessions/

Update STATE.md Reference

If STATE.md references completed tasks as "current focus", note this for user to update.

2. Subagent Outputs Cleanup

Scan .claude/outputs/ for stale outputs:

Identify Stale Outputs

  • Files older than 30 days with no references
  • Outputs superseded by newer analysis
  • Findings already incorporated into permanent hierarchy

Archive Stale Outputs

Move to .old/: Outdated but potentially useful for reference Move to .old/recommend_to_delete/: Obviously temporary or failed outputs

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 146 lines · 0 tokens per session scan A 0843fe7da29b

Subscribe to this mod's changes

agent-cleanfiles is a command published in the GitHub repository gpt-cmdr/ras-commander (79 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,020 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.