supervisor is an autonomous supervisor for coding agents across GitHub repositories and owners. It provides a CLI for configuration validation and supervision workflows, an MCP server (supervisor mcp), JSON Schemas, and agent skills.
Requires Node.js >=24 and pnpm.
pnpm add -g @jongleberry/supervisorOr build from source:
pnpm install
pnpm run buildValidate a configuration file:
supervisor config validate examples/config.example.jsonStart the stdio MCP server:
supervisor mcpThe supervisor loop keeps its state, waits for events, and is stopped through these commands. All read the config from $SUPERVISOR_CONFIG, else .supervisor.json in the current directory, and need stateDir set. They call gh, and wait runs hook-harness through npx.
supervisor state <subcommand>is the only writer of<stateDir>/state.json. Each subcommand holds a lock for the whole read-modify-write, checks each top-level field that the write adds or changes against schemas/state.json (the field names and the exact shape ofschedule), and replaces the file atomically; a write that breaks the schema exits 1 and saves nothing, while reads never check the file and an old invalid field that a write leaves alone does not block it.supervisor state --helplists the subcommands.supervisor state merge-record --pr <owner>/<repo>#<N> --head <sha> --check <file> --review <text> --always-human <text>records each autonomous merge from thesupervisor policy check <owner>/<repo> <pr> --jsonresult that allowed it. It refuses a result for another pull request or head, one made with--input, and one whose next step is not a merge;supervisor state merge-recordslists the records by repository or rule.supervisor wait [--advance]runs one wait over every owner inscopes(hook-harness 0.4.0 or newer for more than one; an exact oldereventWait.hookHarnessfails the wait) and returns only the events that need action: a JSON summary line, then one compact JSON line per event, with its repository asowner/repo. There is one cursor,hookHarness.cursor, and one seen list,hookHarness.seen; the full result goes to<stateDir>/hh-last.json.--owneris gone (exit 2).supervisor wait --helpdescribes what returns. It exits 3 while the stop switch is set, and 4 (one line namingsupervisor state advance-hh) whenhh-last.jsonstill holds events that were not advanced; that check is skipped when the wait advances itself. A hook-harness failure passes its own exit code through, told apart by its message (hook-harness exited N). It also drops events already inhookHarness.seen. A state written by 0.3.0 kept both per owner: the first wait oradvance-hhdrops those entries and keeps their seen ids, the first wait starts from--since 10m(older events are not returned; the next sweep covers them), and oldhh-last.<owner>.jsonfiles are ignored and can be deleted.supervisor stop [--reason <text>]sets the stop switch, one file at<stateDir>/stopthat records the time and the reason.supervisor stop --statusprints whether it is set and exits 3 when it is;supervisor resumeremoves it. While it is set,supervisor wait,supervisor state sweep-start, andsupervisor state merge-recordrefuse with one line and exit 3, and the skills check the status before every tick, mutation, and merge. Thesupervisor statesubcommands that only record facts keep working. None of the three takes the state lock.
supervisor preflight [--json] runs the checks a loop needs before it starts, in one command. Each is reported as {name, ok, detail}: config (the file loads), gh (gh auth status, with the token scopes), pr-shepherd (pr-shepherd --version), hook-harness (npx -y hook-harness@<eventWait.hookHarness> --version), and stop (not ok while the stop switch is set). hook-harness is reported ok with the detail not configured when the config file does not set eventWait. When the config does not load, gh and pr-shepherd still run. The default eventWait.hookHarness moved from 0.3.5 to 0.4.1; supervisor wait runs that version, and the preflight check needs 0.4.1 or newer (the first with --version), so a config that pins an older version keeps working for wait but fails the check. Each detail is one line. It prints one line per check, or one {ok, checks} object with --json, and exits 0 only when every check is ok.
What may merge without a person is written in a merge policy. Two commands read it:
supervisor policy explain <dir> [path]lists the policy files under<dir>, or the rules that decide one path.supervisor policy check <owner>/<repo> <pr> --dir <dir> [--supervisor-policy] [--json]reads one pull request from GitHub throughgh apiand evaluates it: its current head, changed files, authors, labels, and approvals of that head. It then asks pr-shepherd, read-only, whether it would merge the head; the merge is held unless it would. It prints the rules that apply, the verdict, the seats and who fills them, pr-shepherd's action, and the next step: merge, request a review (also when only a bot's seat is unmet), escalate to a person, or run pr-shepherd when the policy allows the merge but the head is not ready. pr-shepherd reads its config from--repo-dir, or from the current directory without it. It exits 0 only when the next step is a merge, 1 when it is not, and 2 when the pull request or the policy could not be read whole.--print-inputprints the collected input as JSON and evaluates nothing.--classifiers <json>gives classifier results, which the command cannot collect. Without it, a rule that waits on a classifier stays undecided.supervisor policy check --dir <dir> --input <json>evaluates a written input file instead, for dry runs and the eval. It reads nothing from pr-shepherd.
pnpm run format # format files with oxfmt
pnpm run format:check # check formatting
pnpm run lint # lint with oxlint
pnpm run typecheck # typecheck with TypeScript
pnpm run test # run unit tests
pnpm run test:coverage # run tests with 100% coverage enforcement
pnpm run build # compile TypeScript to dist/
pnpm run pack:check # verify pnpm pack --dry-run file listBump version in package.json on main, then publish a GitHub Release tagged v<version> (release.yml tests, packs, and publishes to npm via OIDC).