FormingConfigcli_toolclaude-codecodexcursorpublished fresh until

Knip, vulture or hawk: how do I find and delete dead code?

Summary As of November 2026: Knip for unused JS/TS files, exports and dependencies; vulture for unused Python code; Astral's experimental hawk for unnecessary public Rust APIs, which Charlie Marsh used to delete thousands of lines from uv and Codex. For Rust, run cargo +1.99.0 hawk check --manifest-path Cargo.toml

Not for stale feature flags or reviewing a live diff for bugs; see automatic-code-review-before-pr

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The options

Same job, different trade-offs. Pick one in Try it.

Option
AConfig · v2.16+wwfix.1vulture unused-code finder for Python (2.16)
BConfig · v6.41.0+wwfix.1Knip unused-code finder for JavaScript/TypeScript (6.41.0)
Ccli_tool · v6.42.1Knip CLI
How you use itA setting in your projectA setting in your projectcli_tool
What it can doinstalls software · writes files · network · runs shellinstalls software · writes files · network · runs shellinstalls software · network
What's inside
AConfig · v2.16+wwfix.1vulture unused-code finder for Python (2.16)
How you use it
A setting in your project
What it can do
installs software · writes files · network · runs shell
What's inside
BConfig · v6.41.0+wwfix.1Knip unused-code finder for JavaScript/TypeScript (6.41.0)
How you use it
A setting in your project
What it can do
installs software · writes files · network · runs shell
What's inside
Ccli_tool · v6.42.1Knip CLI
How you use it
cli_tool
What it can do
installs software · network
What's inside

What this thread does

Use a language-specific analyser as evidence, then let the agent remove small batches of unused code.

Do first: Run the analyser without fixes and review its entry points and dynamic-use exclusions.

Why a tool first

Asking an agent to "remove dead code" without evidence leads to guesses and risky deletions. A static analyser gives a concrete list; the agent then deletes, runs the build and tests, and opens small PRs. Charlie Marsh showed this on 20 Jul 2026: he had Codex build hawk, a Cargo lint for unused or too-public items, and used it to delete thousands of lines from uv and Codex.

The options

As of November 2026:

Knip 6.45.1 (11 November 2026)vulture 2.16hawk 0.1.15
LanguageJavaScript / TypeScriptPythonRust (Cargo workspaces)
Findsunused files, exports, dependencies, devDependenciesunused functions, classes, variables, imports, unreachable codepub items unused across the workspace, or that can be pub(crate) / private
Auto-fixknip --fix for exports and dependenciesno (whitelist file for false positives)--fix through cargo fix (visibility)
Agent extras@knip/mcp helps configure Knipnonenone
LicenceISCMITMIT or Apache-2.0
Maturitywidely usedmatureexperimental, written by Codex, "use at your own risk"

A deletion loop

1. Run the tool and save the report. 2. Have the agent remove one category at a time (unused files, then exports, then dependencies), building and running tests after each batch. 3. For anything reached dynamically (plugins, reflection, string imports, framework conventions), add it to the tool's config or whitelist instead of deleting. 4. One PR per batch, so review stays small.

Caveats

  • Static tools miss dynamic use. Knip has plugins for many frameworks; vulture reports a confidence level, so start at --min-confidence 80.
  • hawk needs the exact Rust 1.99.0 toolchain it was built against and is not packaged here: its README's quick install pipes a remote script into sh, which our scanner rejects. For a source install, first run rustup toolchain install 1.99.0 --component rustc-dev, then RUSTC_BOOTSTRAP=1 cargo +1.99.0 install --locked cargo-hawk@0.1.15. Alternatively, download a platform archive and put the executables together on PATH; prebuilt binaries need the matching Rust toolchain but not rustc-dev. Run cargo +1.99.0 hawk check --manifest-path Cargo.toml. Pinned installation instructions.
  • For code that only looks dead at runtime, Boris Cherny's dead-code routine adds logging first and deletes a day later; see the daily routines thread.
  • Related: the Ponytail thread is about not writing unneeded code in the first place.

Started from a post by @charliermarsh, packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in refactoring

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Knip, vulture or hawk: how do I find and delete dead code?
Summary: As of November 2026: Knip for unused JS/TS files, exports and dependencies; vulture for unused Python code; Astral's experimental hawk for unnecessary public Rust APIs, which Charlie Marsh used to delete thousands of lines from uv and Codex. For Rust, run `cargo +1.99.0 hawk check --manifest-path Cargo.toml`

## Options
- A · vulture unused-code finder for Python (2.16) · early, no verdict yet · installs software · writes files · network · runs shell
- B · Knip unused-code finder for JavaScript/TypeScript (6.41.0) · early, no verdict yet · installs software · writes files · network · runs shell
- C · Knip CLI · early, no verdict yet · installs software · network
Copy for agent
get the whatworks thread find-and-delete-dead-code-with-your-agent and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread find-and-delete-dead-code-with-your-agent

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · vulture unused-code finder for Python (2.16)

Finds unused Python code (functions, classes, variables, imports, unreachable code) with a confidence score per finding (MIT). A whitelist file records intentional false positives.

Format
Config
Source
github:jendrikseipp/vulture
Pinned
v2.16+wwfix.1 · b0f67ba00446
Content hash
b0f67ba0044693aa
Audit
scan passed
Can do
installs software · writes files · network · runs shell
Works with
claude-code · codex · cursor
Check
vulture 2.16 is installed in the project's .venv; The vulture CLI runs; Vulture finds a planted unused function and nothing else
Author
@jendrikseipp
Kudos
0
Are you @jendrikseipp? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package vulture-unused-python-code before installing

B · Knip unused-code finder for JavaScript/TypeScript (6.41.0)

Finds unused files, exports and dependencies in JavaScript and TypeScript projects (ISC), with plugins for common frameworks and a --fix mode for exports and dependencies. Gives an agent a concrete list of code to delete. Not for: Python, Go or Rust code, or projects where the agent cannot install npm packages; see dead-code-tools-when-your-agent-can-t-use-a-package-manager.

Format
Config
Source
github:webpro-nl/knip#packages/knip
Pinned
v6.41.0+wwfix.1 · 13d7f21e8ec5
Content hash
13d7f21e8ec5b30d
Audit
scan passed
Can do
installs software · writes files · network · runs shell
Works with
claude-code · codex · cursor
Check
knip 6.41.0 installed in the project; Knip CLI runs without a download; Knip analyses this project and prints its report
Author
@webpro
Kudos
0
Are you @webpro? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package knip-unused-code-js-ts before installing

C · Knip CLI

Finds unused files, exports and dependencies. Pinned knip@6.42.1 from npm, run from a locked install: WhatWorks checks only its --version and --help.

Format
cli_tool
Source
—
Pinned
v6.42.1 · npm:knip@6.4
Content hash
sha256:da7cffa04
Audit
scan warned
Can do
installs software · network
Check
node_modules/.bin/knip --version; node_modules/.bin/knip --help
Author
editor
Kudos
0

This package has no public source link yet.

Ask your agent
show me the whatworks package knip-cli-tool before installing

A · Files

Read from the package source at the pinned version. Shown as is; nothing here runs.

Loading files…

Ask your agent
show me the files of the whatworks package vulture-unused-python-code

B · Files

Read from the package source at the pinned version. Shown as is; nothing here runs.

Loading files…

Ask your agent
show me the files of the whatworks package knip-unused-code-js-ts
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp