shrink-anything deletes dead code and keeps each cut only if tests pass
shrink-anything is an open-source tool that finds unused functions, files, dependencies and assets, deletes them, and runs the project's own tests after each cut, putting back anything that breaks. Judgment calls such as public methods are handed to a coding…
Why it matters
As agents write more code, cutting dead code reduces both build weight and the tokens agents must read on every task.
What happened
1 min readshrink-anything is an open-source tool that finds unused functions, files, dependencies and assets, deletes them, and runs the project's own tests after each cut, putting back anything that breaks. Judgment calls such as public methods are handed to a coding agent like Claude or Codex. It supports 19 languages and ships as a CLI, an MCP server, a Claude Code plugin and a skill.
Our analysis
Counting name mentions instead of building a call graph is conservative: it can miss dead code but should not delete live code. Relying on the project's own tests is sensible, though, as the tool itself says, the guarantee is only as strong as test coverage. The 46% token reduction comes from demo projects with planted dead code; real projects will see less. Worth trying for teams with good test coverage.