# whatfrees check

A report is a snapshot. A person may have opened the worktree a minute after the scan. `whatfrees check` asks again, about one path.

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

```text
whatfrees check: ok. no problems /home/you/.codex/worktrees/9f2c/app is safe: deletable.
Clean, pushed and untouched for 9 days.
```

```sh
whatfrees check ~/.codex/worktrees/56bb/app
```

```text
whatfrees check: failed. no problems /home/you/.codex/worktrees/56bb/app is unsaved: don't delete it.
git status lists 2 changed or untracked: a.txt, big.bin.
```

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | The path exists and its verdict is `safe` or `orphan` |
| 1 | Anything else: the path is `live`, `unsaved`, `ask` or `unchecked`, or doesn't exist |
| 2 | Usage error, such as a missing path |

For automatic worktree cleanup, require both exit code 0 and a `safe` verdict. An `orphan` can also exit with 0: that confirms the verdict, not that the files are backed up. Leave it for a person to inspect and approve.

## What it re-runs

It runs the same checks as a scan, for one path: the process table, the file times, `git status`, the unpushed commits and the stash log. It doesn't size anything.

Some paths get a special answer:

- A path that doesn't exist is `unchecked`, with `exists: false`.
- A symlink is judged as the link itself, found through its parent folder, not the folder it points to.
- A folder that holds git checkouts, such as `~/.codex/worktrees/9f2c`, is `ask`: check each checkout instead.
- A folder that isn't a checkout is a leftover. A leftover is `ask`, so `check` doesn't clear it. A regular file is `orphan` only when it sits in an agent's worktree folder and hasn't changed for 30 days.

`whatfrees check` knows Git checkouts and the agents' leftovers. It cannot verify a pnpm store; see the report's evidence instead.

## JSON

`--json` prints a `whatfrees/check@1` document.

```json
{
  "schema": "whatfrees/check@1",
  "path": "/home/you/.codex/worktrees/9f2c/app",
  "exists": true,
  "verdict": "safe",
  "deletable": true,
  "evidence": ["Clean, pushed and untouched for 9 days."]
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `schema` | `"whatfrees/check@1"` | The document's version |
| `path` | string | The absolute path that was checked |
| `exists` | boolean | Whether anything is at the path |
| `verdict` | string | One of the [six verdicts](https://whatfrees.loadsheet.dev/guide/verdicts) |
| `deletable` | boolean | `true` only for `safe` and `orphan`, and only when the path exists |
| `evidence` | string[] | The facts behind the verdict |

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

- [Introduction](https://whatfrees.loadsheet.dev/raw/guide.md)
- [Installation](https://whatfrees.loadsheet.dev/raw/guide/installation.md)
- [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) (this page)
- [For agents](https://whatfrees.loadsheet.dev/raw/guide/agents.md)

Next: [For agents](https://whatfrees.loadsheet.dev/raw/guide/agents.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.
