Skip to content

CLI reference

agent-gc with no arguments opens the same screen as the app, in the terminal: arrows move, space switches, o switches off everything unused for 30 days after asking, tab changes installation, c cleans, q quits.

Installation ids look like claude:~/.claude; agent-gc scan --json lists them, and the ids of every source.

agent-gc --help shows every command, agent-gc <command> --help one of them; --help never runs anything. An option a command does not know is an error, so a typo such as clean --dryrun stops instead of cleaning.

In a terminal, scan, clean, budget repo and toggle … unused off show a progress line on stderr while they work (what they are doing and for how long, e.g. ⠹ scanning · starting MCP servers to count their tools (3/12) · 4.1s); it is erased before the results, and never appears when stderr is not a terminal.

Terminal window
agent-gc scan # cost, top sources, cleanable items
agent-gc scan --json

Start cost per installation, the heaviest sources with notes, what could be cleaned, what was switched off automatically (with restore ids) and, inside a repository with a budget file, its repo budget line. Changes no config and removes nothing. To size MCP servers it starts your configured stdio servers it has not counted in the last 24 hours; a repository’s .mcp.json servers only in a folder you trusted in Claude Code.

Terminal window
agent-gc clean --dry-run # what would be removed
agent-gc clean --yes # clean now, and confirm automatic mode
agent-gc clean # clean now, once automatic mode is confirmed

Without --yes it refuses until automatic mode has been confirmed once. Everything removed stays restorable for a while. See Automatic cleaning.

Terminal window
agent-gc restore # what can be put back
agent-gc restore <id> # put one back
Terminal window
agent-gc log # the newest 50 things Agent GC did
agent-gc log --processes --since 1d -v # every process stopped or ended today, full command lines
agent-gc log --grep playwright # anything mentioning it: path, label or command line
agent-gc log -f # follow new entries
agent-gc log --json # one JSON object per line
agent-gc log --daemon # the background service's own log

Every entry has the time, the action (stop, end, quarantine, trash, delete, reclaim, worktree, switch-off, restore, …), what it was and, for processes, the full command line, why it was taken and how it ended (ended (SIGTERM), killed (SIGKILL after 5 s), already gone, resumed by someone else; left running). Filters: --since 30m|2h|3d|1w|<date>, --processes, --files, --sources, --action <a,b>, --grep <text>, -n <count>, --all. The journal is rotated at 4 MB, one older file is kept.

Terminal window
agent-gc auto on # clean in the background, live: a login service (LaunchAgent / systemd)
agent-gc auto off
agent-gc auto status
agent-gc auto switch-off on # also switch off sources unused for 30 days

agent-gc auto switch-off on is the separate confirmation for switching off sources, needed once by users who confirmed automatic mode before that feature existed.

Terminal window
agent-gc toggle claude:~/.claude mcp:global:meshy off
agent-gc toggle claude:~/.claude unused off # every source not used in 30 days; each can go back on

on switches a source back on.

Terminal window
agent-gc budget claude:~/.claude 40000 # start-up budget: switch off only the heaviest unused sources until it fits
agent-gc budget claude:~/.claude off # remove it
agent-gc budget repo [path] # this repository's start cost against its .agent-gc.toml budget

agent-gc budget repo exits 0 even when over. See Repository budget.

Terminal window
agent-gc notify on # opt in: one line at the next session start after an automatic switch-off
agent-gc notify off
Terminal window
agent-gc top # live view like htop: sessions and subagents, CPU, memory, context; sort, filter, end
agent-gc top --json # one snapshot: account limits and the session tree

See agent-gc top.

Terminal window
agent-gc limits on # opt in: record the plan's 5-hour and 7-day limits for `top` (wraps your status line; shared with sched)
agent-gc limits status # per installation: installed or not, who uses it (limits, sched), whether your own status line is wrapped, age of the last numbers
agent-gc limits off # puts back exactly the status line that was there (or none); kept while sched is on

See Limits.

Terminal window
agent-gc sched on # opt in: warn and stop runaway Claude Code agents (asks first; --yes to skip)
agent-gc sched status # on/off, hooks per installation, the subscription window, stopped agents
agent-gc sched release <id> # let a stopped agent continue
agent-gc sched off # remove the hooks; your status line is restored unless limits is still on

See agent-gc sched.