code_dead
code_dead returns functions that have zero callers in the graph. These are candidates for removal — code that is either truly dead or only reachable through dynamic dispatch (reflection, eval, external callers).
code_dead()code_dead(path="src/utils")code_dead(include_exports=true)Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Limit search to files matching this path |
include_exports | boolean | false | Include exported functions that have no internal callers |
Output
Section titled “Output”Dead code candidates (5 found): formatLegacyDate src/utils/date.ts:42 — 0 callers migrateOldSchema src/db/migrations.ts:18 — 0 callers debugDump src/debug/dump.ts:7 — 0 callersWhen to use
Section titled “When to use”- After a large refactor — clean up leftover functions
- Before a release — find code that was never wired up
- Reducing bundle size — remove modules nothing imports
Caveats
Section titled “Caveats”code_dead works from static analysis. Functions may have zero graph callers but still be:
- Called by external packages or plugins
- Invoked via reflection or dynamic dispatch
- Entry points (main, exports, event handlers, CLI commands)
Always review results before deleting. Use code_impact to double-check a specific function before removal.