Skip to content

Latest commit

 

History

History
103 lines (92 loc) · 6.64 KB

reference.md

File metadata and controls

103 lines (92 loc) · 6.64 KB
title Reference
sidebar
order
10

Commands

Command What it does
perch status [--refresh] [--json] the active Account and how full it is
perch list [<scope>] [--refresh] [--json] every Account, its Alias, Group, state, Headroom and Utilization, in the order a Cycle ranks them, or one Scope's with its Reserve
perch add [--group <name>|--no-group] [--alias <name>] gain an Account by logging in, without disturbing the active one
perch alias <target> <name> / perch alias <target> --unset name an Account, or free the name
perch switch <target> make an Account active everywhere
perch switch [<group>] [--no-refresh] Cycle to the best Account in a Group
perch watcher run Cycle automatically when the Account you are on runs low
perch watcher check take one round for cron or a systemd timer, saying what it decided in the exit code
perch watcher install|uninstall have the machine run the watcher for you, starting at login, or take that unit back
perch watcher status [--json] whether a Service is installed, whether it is running, and whether a Watcher holds the lock right now
perch run <target> [-- <command>] launch Claude Code as an Account, in this terminal alone
perch group add|move|rename|remove|list declare Groups and move Accounts between them
perch config set|get the rules Perch chooses Accounts by, one Scope at a time
perch disable <target> / perch enable <target> keep an Account out of Cycling, or put it back
perch relogin <target> repair an Account whose Credential stopped working
perch remove <target> [--yes] give up an Account
perch holdings export <path> / perch holdings import <path> write everything Perch holds to one encrypted file, and put it back
perch holdings purge [--yes] give the machine back the state it had before Perch
perch upgrade [--release <tag>] [--check] [--json] [--channel <name>] [--yes] replace this Perch with a newer Release, through the Channel that installed it
perch version which Perch is installed, and a line more when a newer Release exists
perch wizard organize what Perch holds one question at a time: Accounts, Groups, Settings and the Watcher
perch probe [--json] [--raw] everything Perch can see of this machine, for pasting into a bug report
perch triage [--model <name>] [--raw] hand that to Claude Code, and let it investigate this machine and help you file the issue

Reporting something broken

perch probe gathers what a report needs, and perch triage hands it to Claude Code. Both are in troubleshooting.

Exit codes

Code Meaning
0 fine
1 something else went wrong
2 the command line was not understood
10 refused: an assumption about the installed Claude Code failed
11 the keychain is locked, denied, or unavailable
12 there is no such thing: no login, no such Account, no such Group
13 it collides with something that is already there: an Account added twice, a name already spoken for, a path an Export would have written over, an Import onto a Perch that already holds an Account
14 Perch understood it and will not accept it: an ambiguous name, a value out of range, a Group that has not said the watcher may act on it, a command that needs a terminal run where there is none
15 there was nothing to do: you are already on that Account, a check found nothing to do now, or Perch is holding nothing on this machine to purge
16 refused: a client is running against that Profile, so what is in it is not Perch's to write or to delete
17 a Cycle found nowhere to land: every Account in the Group is exhausted, or none is a candidate
18 a bare Cycle, or a watcher, on an Account nobody has declared interchangeable with anything
19 that Account is Quarantined: its Credential no longer works, and perch relogin repairs it
20 held: a lock somebody else has, or a perch watcher check with no current figure to decide on. Nothing is wrong and nothing was changed. Ask again shortly

perch run exits with what the client exited with, once it has launched something. perch upgrade exits with what brew or npm exited with, once it has handed the work to a Channel.

perch upgrade --check and perch watcher status exit 0 either way. Branch on --json: upgrade_available for the one, installed, running and watching for the other. perch watcher uninstall exits 15 when there was nothing to take back. A Watcher whose lock is taken over mid-run stops, says so, and exits 0.

Where things are

  • ~/.config/perch/registry.json is Perch's own state, versioned.
  • ~/.config/perch/.watch.lock is held for as long as a Watcher runs. A second Watcher says who holds it and waits.
  • ~/.config/perch/trail.log, and trail.log.1 once the first has grown past a megabyte, is what each command was asked and what it exited with. perch probe reads it back.
  • ~/.config/perch/watch.log is where a Service's decisions go on macOS and Windows. On Linux journalctl --user -u perch-watch -f reads them.
  • The Service's unit is the one thing Perch writes outside $PERCH_HOME: ~/Library/LaunchAgents/cli.perch.watch.plist on macOS, ~/.config/systemd/user/perch-watch.service on Linux, and a Scheduled Task named Perch\Watch on Windows. perch watcher uninstall removes it, and so does perch holdings purge.
  • ~/.config/perch/profiles/<account>/ is one directory per Account, and gives that Account its private Credential Store.
  • $PERCH_HOME overrides ~/.config/perch, on every platform. Home is $USERPROFILE on Windows and $HOME elsewhere.
  • $PERCH_CLAUDE_BIN overrides where claude is found. Without it Perch walks PATH, and PATHEXT on Windows. perch watcher install writes the answer into the unit.
  • $PERCH_NO_UPGRADE_CHECK stops perch version asking whether a newer Release exists. Nothing else in Perch looks.
  • $PERCH_INSTALL_DIR is where the installer script puts the binary, in place of ~/.local/bin and of %LOCALAPPDATA%\Perch\bin on Windows. perch upgrade reads it too.
  • $PERCH_VERSION holds the installer script to one Release. perch upgrade --release sets it for you.

A Credential lives wherever the installed Claude Code would put it: the keychain on macOS, and a .credentials.json inside the Profile everywhere else, readable by its owner alone. Perch reaches Anthropic through curl at /usr/bin/curl, or %SystemRoot%\System32\curl.exe on Windows, with the token on standard input rather than on the command line.