> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getshrike.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Shrike

> Your agent writes dead code. Shrike deletes it — and proves the app still builds. The cleanup layer for AI-built TypeScript apps.

**Your agent writes dead code. Shrike deletes it — and proves the app still builds.**

Shrike is the cleanup layer for AI-built TypeScript apps. It finds code that an agent or pull request left behind, measures the dead weight, removes it in verified batches, and gives you a portable receipt that says exactly what was checked.

> [!NOTE]
>
> **Verified** means the project's configured checks passed after removal, relative to a baseline. It does not prove the code is semantically unused in production, that the tests are adequate, or that external consumers cannot import it.

## Start with the report

```bash theme={null}
npx getshrike report
```

`report` always prints the deterministic plain report. Run `npx getshrike` with no arguments on an interactive terminal to open the read-only view; in CI, pipes, and agent sessions it falls back to plain output. `npx getshrike report --base origin/main` shows what this branch orphaned.

The headline metric is **dead weight %**: removable source lines divided by analyzed non-generated source lines. It is always shown with the raw fraction, never as a score.

```text theme={null}
Shrike report · current state · 9f2c1ab

  Dead weight  4.8%
  1,284 removable lines / 26,900 analyzed source lines
  ██████████████░░░░░░░░░░░░░░░░░░░░░░░░

  38 files · 61 symbols (58 exports) · 4 dependencies (advisory)
  12 protected · 7 diagnostics (2 actionable)

  Next: npx getshrike clean --all
```

Example output — your project will show its own numbers.

## What Shrike does

* **Whole-graph orphan delta.** Shrike compares the merge-base graph with the branch head graph, so it finds code that became unreachable anywhere in the repository — including files the change never touched.
* **Verified deletion batches.** Candidates are split into independent batches. Each batch is applied in a worktree, the project's checks run against a baseline, and a regression is bisected so only the culprit is reverted.
* **Portable receipt.** A content-addressed JSON receipt records graph hashes, witnesses, patches, check results, build evidence, and the outcome.
* **Agent and CI setup.** `shrike install` writes a portable skill for coding agents, and `shrike ci install` writes an advisory-by-default GitHub Actions workflow.

Shrike fails closed. An item that is an entry, public API, generated, unparsed, or reachable through an unknown edge is **protected** and reported with a reason instead of being deleted. Repository content is treated as data, never as instructions; the analyzer does not spawn processes or open sockets.

Dependencies are reported separately and are always **advisory**. Shrike never removes or edits a dependency automatically.

## Who it is for

Shrike is for TypeScript and JavaScript projects — especially Next.js and React applications — that want to remove code orphaned by a change without guessing whether the project still builds. It is not a linter, a bundle optimizer, a type checker, a plugin catalogue, a cleanliness score, or a multi-language analyzer.

## Framework coverage

Shrike protects framework-invoked code so it is not mistaken for dead code. Framework entries are gated on the owning package declaring the dependency, so a file that merely looks like a route in an unrelated package stays analyzable.

| Family | Covered conventions |
| - | - |
| Next.js App Router | `page`, `layout`, `route`, `loading`, `error`, `template`, metadata and icon files, middleware/proxy, instrumentation, route segment config, server actions, RSC boundaries |
| Next.js Pages Router | `pages/**` routes, `_app`/`_document`, `getStaticProps`/`getServerSideProps`/`getInitialProps`, route-tree conflicts |
| React / bundlers | `createRoot` and legacy roots, Vite `index.html` scripts, webpack entries, `import.meta.glob`, `require.context` |
| Routers | React Router, Remix, TanStack Router, Expo Router, Nuxt, SvelteKit |
| Tooling | Storybook, Ladle, React Cosmos, Cypress, Docusaurus, Gatsby, Metro platform variants |
| Packages | `package.json` `exports`/`main`/`bin`, workspace packages, public API surfaces |
| Config and tests | Statically named config and test entry modules; framework-generated types stay live |

## Start here

1. [Install Shrike](https://docs.getshrike.dev/getting-started/installation.md) — Node.js 22+ and the `getshrike` npm package.
2. [Read the cleanup report](https://docs.getshrike.dev/guides/cleanup-report.md) — run `report` and interpret the metric.
3. [Quickstart](https://docs.getshrike.dev/getting-started/quickstart.md) — `report`, `scan`, `delta`, and `plan`.
4. [Verified pruning](https://docs.getshrike.dev/guides/verified-pruning.md) — the batch, check, bisection, and receipt contract.
5. [Agent integrations](https://docs.getshrike.dev/guides/agent-integrations.md) and [GitHub Action](https://docs.getshrike.dev/guides/github-action.md) — put Shrike where you work.

## Performance

The Rust engine emits deterministic JSON: identical input produces byte-identical output. The budgets below come from the repository's deterministic generator and harness, which run one cold analysis followed by warmups and five measured runs, and report wall time and peak RSS. Absolute times are machine-specific; every reported run includes the machine and commit. See the [benchmark method](https://github.com/getshrike/shrike/blob/main/benchmarks/README.md).

| Scenario | Budget |
| - | -: |
| 1,000 files, cold | ≤ 1.5 s |
| 1,000 files, warm | ≤ 400 ms |
| 10,000 files, cold | ≤ 6 s |
| 10,000 files, warm | ≤ 2 s |
| 10,000 files, peak RSS | ≤ 600 MB |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.