GitHub 0
Skip to content

whatfrees check

Re-check one path right before you delete it. It exits with 0 only when the path is safe or orphan.

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

whatfrees check ~/.codex/worktrees/9f2c/app
whatfrees check: ok. no problems /home/you/.codex/worktrees/9f2c/app is safe: deletable.
Clean, pushed and untouched for 9 days.
text
whatfrees check ~/.codex/worktrees/56bb/app
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.
text
CodeMeaning
0The path exists and its verdict is safe or orphan
1Anything else: the path is live, unsaved, ask or unchecked, or doesn't exist
2Usage 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.

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 prints a whatfrees/check@1 document.

{
  "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."]
}
json
FieldTypeMeaning
schema"whatfrees/check@1"The document's version
pathstringThe absolute path that was checked
existsbooleanWhether anything is at the path
verdictstringOne of the six verdicts
deletablebooleantrue only for safe and orphan, and only when the path exists
evidencestringThe facts behind the verdict