sweep-stale-flags

sweep-stale-flags is a command for Claude Code from atretyak1985/swarmery. It costs 29 tokens per session (1,562 once invoked), scanned A, original, Apache-2.0.

A read-only sweep for feature flags, environment variables, and configuration settings that are referenced in code but missing from deployment settings, or configured but unused.

In plain words
What is it for?
Use it for periodic configuration hygiene across one repository or all project repositories.
Why use it?
It reveals dead toggles and stale configuration that can make software behavior confusing or pretend to control something it no longer controls.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Part of the core plugin — 36 skills, 8 commands, 13 agents shipped together

Good fit Use it for periodic configuration hygiene across one repository or all project repositories.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/atretyak1985/swarmery/sweep-stale-flags
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/atretyak1985/swarmery

Made for: Claude Code.

Or install core, the plugin that ships this one along with the rest of its 36 skills, 8 commands, 13 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 sweep-stale-flags

README.md
[![agentmods](https://agentmods.dev/badge/commands/atretyak1985/swarmery/sweep-stale-flags/github.svg)](https://agentmods.dev/commands/atretyak1985/swarmery/sweep-stale-flags)
Your own site
<a href="https://agentmods.dev/commands/atretyak1985/swarmery/sweep-stale-flags"><img src="https://agentmods.dev/badge/commands/atretyak1985/swarmery/sweep-stale-flags/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 sweep-stale-flags

Your own site · 80×15
<a href="https://agentmods.dev/commands/atretyak1985/swarmery/sweep-stale-flags"><img src="https://agentmods.dev/badge/commands/atretyak1985/swarmery/sweep-stale-flags.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 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,562 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.00029 $0.01562
Opus 5 $0.00015 $0.00781
Sonnet 5 $0.00006 $0.00312
Haiku 4.5 $0.00003 $0.00156

Measured 7d ago against content hash c3088ec4b0a2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

sweep-stale-flags 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 7d 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/sweep-stale-flags.md · 145 lines

How it starts

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

Sweep Stale Flags (Dynamic Workflow)

Scope hint: $ARGUMENTS (optional — restrict to one repo, e.g. the main app or the device repo; see project.json → mainApp / device)

When to use

Periodic hygiene sweep across the codebase to find:

  • Feature flags read in code but never set in any deployment environment
  • Env vars referenced in process.env.X / os.getenv('X') but absent from env.example / values.*.yaml
  • Config keys that exist in values.yaml but no code reads them (rot)

This is breadth-first work — independent files, no mid-run user input needed. Perfect for Dynamic Workflow substrate.

For a targeted check on one variable, use the env-check skill directly.

Pre-flight (mandatory)

  • Phase 1 user-only gaps RESOLVED
  • No code changes intended — discovery + report only
  • Scope is closed (single repo or "all project repos" — project.json → repos)

Instructions to @tech-lead

Generate a Dynamic Workflow that:

  1. Discovery stage (parallel per repo) — extract:
    • Code references: grep -rE "process\.env\.[A-Z_]+|os\.getenv\(['\"]?[A-Z_]+" per repo
    • Code references for feature flags: grep -rE "growthbook\.feature\(|isEnabled\(['\"]" (or whatever flag library is in use)
    • Declared env vars: parse env.example, .env.example, all values*.yaml, all Chart.yaml defaults
    • Declared flags: parse growthbook.json or equivalent
  2. Cross-reference stage (sequential reduce) — compute three sets:
    • Stale reads = used in code, absent everywhere → likely dead code
    • Orphan declarations = declared, never read → likely dead config
    • Schema drift = declared in some envs but missing in others
  3. Artifactsweep-stale-flags-{date}.md in ${AGENT_WORKSPACE_ROOT}/${AGENT_PROJECT}/workspace/working/.

Categories

  1. Stale env-var reads — code reads process.env.X / os.getenv('X') but no env declares X
  2. Stale flag reads — code calls isEnabled('foo') but no flag config declares foo
  3. Orphan declarations — declared in values.yaml / env.example but no code reads
  4. Schema drift — declared in values.<envAlias>.yaml but missing in values.prod.yaml (or vice versa) — high incident risk
  5. Sensitive-name without secret — variable name contains KEY|SECRET|TOKEN|PASSWORD but declared with a plaintext default (should source from the cloud provider's secret manager)

Read the full file on GitHub · 145 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. 7d ago First seen · 145 lines · 29 tokens per session scan A c3088ec4b0a2

Subscribe to this mod's changes

sweep-stale-flags is a command published in the GitHub repository atretyak1985/swarmery (5 stars, last pushed today), licensed Apache-2.0. It adds 29 tokens to every session and 1,562 once invoked, about $0.0001 per session on Opus 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-09-03.