find_unused_imports
Find imported names never referenced in the file body. Complements find_dead_code for import-level cleanup.
What it does
find_unused_imports scans each file for import statements and checks whether the imported names are actually used in the file body. Imports that are never referenced are reported as unused.
How it differs from find_dead_code
| Tool | Scope | Finds |
|---|---|---|
find_dead_code | Cross-file | Exported symbols with zero external references |
find_unused_imports | Per-file | Imported names never used within the importing file |
They complement each other: find_dead_code finds exports nobody imports, find_unused_imports finds imports nobody uses.
When to use it
- Code cleanup — unused imports add noise and confuse readers
- After refactoring — moving code often leaves behind orphaned imports
- Bundle optimization — unused imports can prevent tree-shaking in some bundlers
- Linting — catches what ESLint’s
no-unused-varswould, but across the whole repo in one call
Related tools
Benchmark note
This benchmark compares CodeSift against the closest practical native workflow an agent would use for the same task.
For some tools, that baseline is a direct shell equivalent such as rg or find.
For AST-aware, graph-aware, and LSP-backed tools, the baseline is a multi-step workflow rather than a strictly identical command.
Results should be read as agent-workflow comparisons: token cost, call count, and practical context efficiency.