sdd-clean

sdd-clean is a command for Claude Code from GregorBiswanger/featherspec. It costs 21 tokens per session (1,547 once invoked), scanned A, original, MIT.

A manually invoked workflow for reviewing and safely compacting persistent Markdown notes used by FeatherSpec. It removes duplication and keeps useful information while reporting how much context the files consume.

In plain words
What is it for?
Use it to clean FeatherSpec memory, architecture maps, or another permitted file, while leaving specifications and architecture snapshots to the workflows that own their changes.
Why use it?
Long-term notes are loaded into future agent conversations, so unnecessary lines can increase context use and cost.

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/gregorbiswanger/featherspec/sdd-clean
Clone the repo
git clone --depth 1 https://github.com/GregorBiswanger/featherspec

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 sdd-clean

README.md
[![agentmods](https://agentmods.dev/badge/commands/gregorbiswanger/featherspec/sdd-clean.svg)](https://agentmods.dev/commands/gregorbiswanger/featherspec/sdd-clean)
Your own site
<a href="https://agentmods.dev/commands/gregorbiswanger/featherspec/sdd-clean"><img src="https://agentmods.dev/badge/commands/gregorbiswanger/featherspec/sdd-clean.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 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,547 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 $0.00021 $0.01547
Opus 5 $0.00010 $0.00773
Sonnet 5 $0.00004 $0.00309
Haiku 4.5 $0.00002 $0.00155

Measured 4d ago against content hash c8fefbdc43d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sdd-clean 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 4d 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/sdd-clean.md · 114 lines

How it starts

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

/sdd-clean — Context Cleanup

Persistent markdown is a paid resource: every line it holds loads into future context windows. This workflow keeps it at as little as possible, as much as necessary — maximum useful information per token, judged by semantic usefulness, never by raw size alone. It is manually invokable at any time; other workflows may recommend it, but cleanup never happens as a silent side effect. The user may name one file after the command; then only that file is analyzed and compacted. All dialogue and reports in DocLanguage; compacted files keep the language they are written in.

Scope and write authority

Analyze all FeatherSpec-managed markdown; write only where this command has authority:

Files Authority
.memory-bank/*.md analyze + compact here
.architecture/*.md maps analyze + compact here (≤ 40-line budget per .claude/rules/architecture-map.md)
architecture: snapshot in AGENTS.md analyze only; observed drift hands over to /sdd-architecture-update — its gate stays the snapshot's only write path
.specs/** specs and plans analyze, report findings only — their commands and rules own edits; AC- and T- IDs are never cleanup material
Wiring (.claude/, .github/, AGENTS.md prose) out of scope — template-owned

Phase 1 — Analyze (read-only)

Read each in-scope file against its declared purpose (AGENTS.md Memory Bank list, .claude/rules/memory-bank.md with its routing table, .claude/rules/architecture-map.md for maps) and ask, in this order:

  1. Misplaced? Content in the wrong file moves to its declared home per the routing table — moving is not deleting.
  2. Duplicate? A fact stated in several files keeps exactly one canonical home; the others link or drop it.
  3. Stale? Spot-check claims against the repository — named paths, technologies, assumptions. A named file, script or command target must exist: verify each with a cheap check (path exists, script is in the manifest) and carry the checked items into the Phase-2 plan — "nothing to verify" is itself a claim and needs that list to back it. Stale content is updated or removed; git history is the archive, the live file represents the current useful state.
  4. Rediscoverable? Inventories an agent can derive from the code in seconds (file lists, obvious signatures) go. Intent, boundaries, constraints, conventions and traps stay — the Memory Bank holds knowledge, not a second copy of the repository.
  5. Historical? activeContext.md is the current working state, not a diary: finished episodes leave; decisions that still matter move, dated, to systemPatterns.md.
  6. Verbose? Compact prose into facts without losing meaning. Reasoning stays when it binds future decisions ("new persistence tech needs architecture approval"), goes when it only narrates the past.
  7. Over budget? activeContext.md against its size limit in AGENTS.md; maps against their 40 lines. Over budget triggers the checks above — never blind truncation.
  8. Against the constitution? A statement that contradicts an AGENTS.md invariant — a plan file described as deleted, a "preference" that is not a bullet in AGENTS.md — is a finding, never a fact to preserve: inside this command's write scope, correct the text to plain facts stripped of the invalid justification; outside it, report it with the quote.

Read the full file on GitHub · 114 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. 4d ago First seen · 114 lines · 21 tokens per session scan A c8fefbdc43d6

Subscribe to this mod's changes

sdd-clean is a command published in the GitHub repository GregorBiswanger/featherspec (45 stars, last pushed 5d ago), licensed MIT. It adds 21 tokens to every session and 1,547 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-08-30.