# Installation

Requires Node.js 22.20 or later on Linux or macOS. whatfrees refuses to run on Windows.

## Run it once

```sh
npx whatfrees
```

## Install the command

```sh
npm install --global whatfrees
```

## Use it as a library

```sh pm
pnpm add whatfrees
```

The library has one runtime dependency, [readerly](https://readerly.loadsheet.dev), which shapes the command line's output for the reader. Its entries are `whatfrees`, `whatfrees/measure`, `whatfrees/sources` and `whatfrees/schema`. See the [JavaScript API](https://whatfrees.loadsheet.dev/reference/api).

## First run

### Scan

```sh
whatfrees
```

It prints the totals, then one line per entry, biggest first. Each line holds the size, the verdict, what it is, why, and the command. Entries that free less than 50 MB, and entries in use, are hidden. The totals still count the small ones.

### Show everything

```sh
whatfrees --all --min 0
```

`--all` adds the entries that are in use or under `--min`. `--min 0` shows the small ones too.

### Look in another folder

```sh
whatfrees --root ~/scratch
```

`--root` adds a folder to the worktrees source. Everything in it is a candidate: a git checkout gets the git checks, anything else is a leftover. Repeat the flag for more folders.

### Re-check before you delete

```sh
whatfrees check --json ~/.codex/worktrees/9f2c/app
```

It exits with 0 when the path is `safe` or `orphan`. Check the verdict too: an orphan can still contain unique files. See [whatfrees check](https://whatfrees.loadsheet.dev/guide/check).

whatfrees prints the command and stops there. An agent should run it automatically only for a `safe` entry after a recheck both succeeds and still reports `safe`. Leave orphans for manual review.

## Where the size cache goes

whatfrees keeps the sizes of single files in `measure.json`, keyed by path and modification time. The folder is `$XDG_CACHE_HOME/whatfrees` when that is set. Otherwise it is `~/Library/Caches/whatfrees` on macOS and `~/.cache/whatfrees` elsewhere. `--no-cache` neither reads nor writes it.

<!-- vitehub-docs:section-links -->
## In this section

- [Introduction](https://whatfrees.loadsheet.dev/raw/guide.md)
- [Installation](https://whatfrees.loadsheet.dev/raw/guide/installation.md) (this page)
- [How it stays fast](https://whatfrees.loadsheet.dev/raw/guide/speed.md)
- [Verdicts](https://whatfrees.loadsheet.dev/raw/guide/verdicts.md)
- [Sources](https://whatfrees.loadsheet.dev/raw/guide/sources.md)
- [whatfrees check](https://whatfrees.loadsheet.dev/raw/guide/check.md)
- [For agents](https://whatfrees.loadsheet.dev/raw/guide/agents.md)

Next: [How it stays fast](https://whatfrees.loadsheet.dev/raw/guide/speed.md)

All pages: [llms.txt](https://whatfrees.loadsheet.dev/llms.txt)

Something on this page does not work as written? Tell the user, and draft an issue for them to post: [issue tracker](https://github.com/words-with-agents/whatfrees/issues). Report a security vulnerability privately, never in a public issue.
