| name | stale-module-pruner |
| description | Ripgrep-powered dead-code crawler that finds stale, broken, or orphaned JavaScript/CJS/MJS modules in the Agent Studio framework. Walks a target directory, checks each file for external references, and surfaces (or deletes) unreferenced files. Prevents registry bloat and silent tool dropouts from modules no one calls. |
| version | 1.0.0 |
| model | sonnet |
| category | validation |
| invoked_by | both |
| user_invocable | true |
| tools | ["Read","Bash","Glob","Grep"] |
| agents | ["developer","code-simplifier"] |
| best_practices | ["Always run in dry-run mode first before enabling --delete","Cross-check findings against test files before deletion","Save report before any destructive pass"] |
| error_handling | strict |
| streaming | supported |
| verified | true |
| lastVerifiedAt | "2026-02-22T00:00:00.000Z" |
| source | builtin |
| trust_score | 100 |
| provenance_sha | 89a1a99e97a88406 |
Stale Module Pruner
Overview
Ripgrep-powered dead-code crawler for the Agent Studio framework. Walks a target
directory (default: .claude/lib), then for each .js/.cjs/.mjs file checks
whether its module name appears in any other file across the codebase. Files with
no external references are flagged as STALE and optionally deleted.
Core principle: Dead modules that stay in .claude/lib/ create false positive
references in the ecosystem scanner, inflate the registry, and mislead other tools
about what capabilities are actually active. Regular pruning keeps the framework
lean and the scanner signal clean.
When to Invoke
Skill({ skill: 'stale-module-pruner' });
Invoke when:
- Post-archival cleanup: after moving modules to
_archive/, run pruner on lib/
- After bulk refactors that relocated or merged modules
- Before running
validate-ecosystem-integrity.cjs to reduce noise
- As part of a maintenance sprint
Mandatory Skills
| Skill | Purpose | When |
|---|
task-management-protocol | Track pruning progress | Always |
ripgrep | Search for module references | During scan |
code-semantic-search | Verify intent when uncertain | On ambiguous hits |
context-compressor | Compress large result sets | When output is large |
verification-before-completion | Gate completion | Before marking done |
memory-search | Check prior pruning patterns | At start |
Iron Laws
-
Always dry-run first. Run without --delete and save the STALE list before
any destructive pass. Never delete files on a first invocation without reviewing
the candidates. One false positive can remove an actively-used module.