factory-sweep

factory-sweep is a command for Claude Code from watt-mind/factory. It costs 23 tokens per session (1,255 once invoked), scanned A, original, Apache-2.0.

A command for finding Linear tickets that no longer need action, such as duplicates or work that has already shipped.

In plain words
What is it for?
It checks the latest code, gathers evidence, and moves obsolete tickets to canceled or duplicate states with an explanatory comment.
Why use it?
It keeps obsolete tickets from taking up attention or available work slots while preserving their history.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: model in frontmatter.

Part of the core plugin — 2 skills, 13 commands, 4 agents shipped together

Good fit It checks the latest code, gathers evidence, and moves obsolete tickets to canceled or duplicate states with an explanatory comment.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/watt-mind/factory/factory-sweep
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.

Clone the repo
git clone --depth 1 https://github.com/watt-mind/factory

Made for: Claude Code.

Or install core, the plugin that ships this one along with the rest of its 2 skills, 13 commands, 4 agents.

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 factory-sweep

README.md
[![agentmods](https://agentmods.dev/badge/commands/watt-mind/factory/factory-sweep/github.svg)](https://agentmods.dev/commands/watt-mind/factory/factory-sweep)
Your own site
<a href="https://agentmods.dev/commands/watt-mind/factory/factory-sweep"><img src="https://agentmods.dev/badge/commands/watt-mind/factory/factory-sweep/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for factory-sweep

Your own site · 80×15
<a href="https://agentmods.dev/commands/watt-mind/factory/factory-sweep"><img src="https://agentmods.dev/badge/commands/watt-mind/factory/factory-sweep.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 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,255 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00023 $0.01255
Opus 5.5 $0.00009 $0.00502
Sonnet 5.5 $0.00005 $0.00251
Haiku 4.5 $0.00002 $0.00126

Measured 1mo ago against content hash f7dc737e45bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

factory-sweep 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 1mo 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.

plugins/core/commands/factory-sweep.md · 50 lines

How it starts

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

Find tickets in this project's backlog that no longer need to exist, and retire them — never delete them. "Retire" means moving to Linear's Canceled or Duplicate state with a comment citing the evidence. Those states already exist for exactly this (docs/protocol.md §4) and keep the ticket recoverable; an actual delete does not, so never call a delete/archive mutation, only a state transition.

Resolve the team/project from the repo via config/repos.yaml (docs/protocol.md §1–2), or from $ARGUMENTS if a project name is given. Use factory ticket; on failure retry once then fall back to factory ticket raw per the floor.

First, before judging anything: git fetch --quiet and check git rev-list --count HEAD..origin/<base> (never @{upstream} — it depends on tracking config the checkout may not have). This stage's entire job is deciding what is already true of the code, so it is the stage a stale checkout hurts most — a feature merged last week reads as unshipped and its ticket keeps a dispatch slot it no longer deserves. Follow the floor's Checkout freshness rule: fast-forward a clean tree, and read origin/<base> rather than the working tree when it's dirty, ahead, or the fetch/rev-list itself fails. State the ref you swept against at the top of the report.

Scope

Target open tickets not currently live: Backlog, Triage, and Todo (including ai:agent-ready ones — the queue is exactly where an overtaken ticket keeps wasting a future dispatch slot if it isn't caught here). Interpret $ARGUMENTS as specific issue IDs or a max count; default up to 20, oldest-updated first — a ticket nobody has touched in months is the one most likely to have been overtaken by events, though age alone is never the verdict (see below).

Skip, always: anything In Progress, In Review, or carrying ai:blocked — those are live claims or holds owned by other stages, not this one's to touch.

Claim what you are examining

Same protocol as triage/unblock: before judging an issue, set assignee to yourself and add ai:in-progress + agent:<your-harness>; remove it when you finish that issue, whether you acted or left it alone. One at a time, not a batch up front.

Read the full file on GitHub · 50 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. 1mo ago First seen · 50 lines · 23 tokens per session scan A f7dc737e45bc

Subscribe to this mod's changes

factory-sweep is a command published in the GitHub repository watt-mind/factory (19 stars, last pushed 16d ago), licensed Apache-2.0. It adds 23 tokens to every session and 1,255 once invoked, about $0.0001 per session on Opus 5.5. 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-31.