CLI
The jr2 binary: orchestrate agentic workflows (ADR-0009). jr2 --help prints the same table as this page, and jr2 <command> --help prints one command.
Commands: version, init, check, up, down, gc, kit push, run, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks, caller token, caller rotate, workspace ls, workspace shell, workspace forward, workspace rm, completion.
Global options
These address the deployment; each lists the verbs that take it (ADR-0019).
| Flag | Variable | Description | Taken by |
|---|---|---|---|
-n, --namespace <ns> | the deployment's namespace (default: the config's name, then the Instance folder's name) | version, up, down, run, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks, caller token, caller rotate, workspace ls, workspace shell, workspace forward, workspace rm | |
--context <ctx> | the kube context (default: kubectl's current context) | version, up, down, gc, run, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks, caller token, caller rotate, workspace ls, workspace shell, workspace forward, workspace rm | |
--url <u> | JR2_URL | attach to a specific orchestrator (skips kube entirely) | version, run, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks |
JR2_TOKEN | the Caller's credential to send, which makes the CLI that Caller: with --url / JR2_URL the only one, and otherwise used in place of the Instance token read from the cluster | run, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks |
Commands
jr2 version
jr2 version [--local] [--json] [--url <u>] [-n <ns>] [--context <ctx>]What runs here (this jr2, the global that handed off, the Instance's Kit) and what the cluster runs.
--local skips the cluster.
Also spelled jr2 --version.
Flags
| Flag | Description |
|---|---|
--local | report what runs here and skip the cluster |
--json | print the one report object on stdout instead of the table |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL: see Global options.
Environment
| Variable | Description |
|---|---|
JR2_HANDOFF_FROM | set by the global jr2 that handed off to this one, which the report names |
Output: report, a table or lines on stdout, or their JSON with --json, where the verb has it. See Output.
Decisions: ADR-0009, ADR-0056.
jr2 init
jr2 init [dir] [--name <n>]Scaffold a new instance folder.
Writes AGENTS.md, with the jr2 docs index between its two jr2-docs markers (empty when this jr2 has no docs bundle), and a CLAUDE.md that imports it.
Arguments
| Argument | Required | Description |
|---|---|---|
dir | no | the folder to scaffold (default: the current directory) |
Flags
| Flag | Description |
|---|---|
--name <n> | the package name in package.json (default: the folder's name) |
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0009, ADR-0072.
jr2 check
jr2 checkTypecheck this instance and load its workflows, as jr2 up does first, with no cluster.
Runs the check that jr2 up runs before it stages the Assembly, and exits 1 with its refusal: a type error, a module that refuses to load (createMachine, defineEvent or workspace()), an Open part, a Chart file, a dispatch, an Effect secret or a Size.
Reads no kube context and writes no file, so an Assistant runs it before it gives a change to the user.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0050.
jr2 up
jr2 up [--yes] [--force] [--skip-provider-preflight] [-n <ns>] [--context <ctx>]Converge the current kube context to this instance.
Reads each git.credentials token from the env var it names, after the Instance's .env.
Before the cluster work, sets the text between the jr2-docs markers in AGENTS.md to the docs index of the Kit version, and nothing else; a folder with no markers is left alone.
Flags
| Flag | Description |
|---|---|
--yes | answer the questions non-interactively: confirm first-time setup, and take the recommended git ssh key source (for CI) |
--force | build every image again, even one already built or deployed |
--skip-provider-preflight | do not run the provider preflight: no check pod checks the models or reads an MCP server's tool list, so a check that fails while the model or server works does not stop the converge |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Environment
| Variable | Description |
|---|---|
NO_COLOR | draws the git ssh key menu without highlight |
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0019, ADR-0051, ADR-0069, ADR-0072.
jr2 down
jr2 down [--all] [--yes] [-n <ns>] [--context <ctx>]Remove the instance from the cluster.
--all: operator too; --yes: no confirmation.
Flags
| Flag | Description |
|---|---|
--all | also uninstall the per-cluster operator |
--yes | do not ask for confirmation (for CI) |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0019.
jr2 gc
jr2 gc [--dry-run] [--repo-ttl <ttl>] [--context <ctx>]Remove jr2's images that no live instance names, and Repo resources no Machine binds and no run attached lately.
Flags
| Flag | Description |
|---|---|
--dry-run | print what would be removed, and remove nothing |
--repo-ttl <ttl> | how long since a run last attached before an unbound Repo is garbage (default: 7d) |
Also takes --context <ctx>: see Global options.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0039, ADR-0051.
jr2 kit push
jr2 kit push <registry>Mirror the published kit images into a registry.
The v0.7.0 kit images (harness, operator, orchestrator) from their canonical home, and the Custodian's pinned Envoy from its own, for a cluster whose kitRegistry names it.
Arguments
| Argument | Required | Description |
|---|---|---|
registry | yes | the registry to mirror into, as kitRegistry names it |
Output: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0044, ADR-0059, ADR-0069.
jr2 run
jr2 run <workflow> [--input <json>] [--detach] [--drop-held] [--url <u>] [-n <ns>]
[--context <ctx>]Start a run; stream activity, print terminal result.
--detach: just print the runId and return.
A Chart that the door refuses prints one line for each rule that it fails.
Exits 0 only for a run that ended done, and 1 for every other end: failed, error, cancelled, lost, drifted, or parked before it settled; a failed run prints its reason.
A standing Workflow: jr2 starts its run, so jr2 run only resumes a paused one, prints the new run, and returns.
Arguments
| Argument | Required | Description |
|---|---|---|
workflow | yes | the workflow to start, or a named Chart as <wrapper>/<name> |
Flags
| Flag | Description |
|---|---|
--input <json> | the run's input, as a JSON object (default: {}) |
--detach | print the runId and return, and do not stream |
--drop-held | resume a paused standing Workflow with no held item: its held items are not carried |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0009, ADR-0017, ADR-0070, ADR-0073.
jr2 runs
jr2 runs [--status <s>] [--workflow <name>] [--since <when>] [--url <u>] [-n <ns>]
[--context <ctx>]List runs, newest first (live by default); "placing" names the Workspaces that wait for capacity, and "status <runId>" says why.
Each run is a summary: runId, workflow, status, reason, startedBy, startedAt, endedAt, assembly, openGates; an ended run is listed while jr2 keeps it (runs.retain).
jr2 workflows lists the Workflows that a run can start.
Flags
| Flag | Description |
|---|---|
--status <s> | live (the default), ended, all, or a comma list such as done,failed,drifted |
--workflow <name> | only the runs of this Workflow |
--since <when> | only the runs that started since: a duration (2h, 7d) or an ISO-8601 time |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0009, ADR-0030, ADR-0064, ADR-0065.
jr2 workflows
jr2 workflows [--json] [--url <u>] [-n <ns>] [--context <ctx>]List the Workflows that a run can start, each with its origin: machine, chart file or chart.
A Chart wrapper's named Charts indent under it; an unrunnable one says why.
A runtime Chart has no verb: PUT or DELETE /workflows/<wrapper>/charts/<name> with the Instance token (an MCP or curl), then jr2 run <wrapper>/<name> starts it.
Flags
| Flag | Description |
|---|---|
--json | print the listing (GET /workflows) as the one report object instead of the tree |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: report, a table or lines on stdout, or their JSON with --json, where the verb has it. See Output.
Decisions: ADR-0009, ADR-0070.
jr2 gates
jr2 gates [--workflow <name>] [--url <u>] [-n <ns>] [--context <ctx>]List the open Gates that this Caller may answer, across the live runs, oldest first.
Each Gate is an entry: runId, workflow, gate, path, accepts, acceptsNow, meta, openedAt, and hook (the Hook kinds that it hears); never a run's context.
Needs the answer scope; a scope that names single Gates ({ workflow, gates }) lists only those Gates.
jr2 send <runId> --gate <gate> --event <name> answers one.
Flags
| Flag | Description |
|---|---|
--workflow <name> | only the Gates of this Workflow's runs |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0009, ADR-0011, ADR-0078.
jr2 status
jr2 status [runId] [--json] [--url <u>] [-n <ns>] [--context <ctx>]Print a run's current status (read-through), or the instance's Repos, per node, when given none.
A failed run prints its reason beside the result: failed: <reason>.
Arguments
| Argument | Required | Description |
|---|---|---|
runId | no | the run to read; without one, the instance's Repos |
Flags
| Flag | Description |
|---|---|
--json | print the one report object on stdout instead of the table (without a runId) |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: jr2 status <runId>: result, one JSON result on stdout, and activity on stderr; jr2 bare status: report, a table or lines on stdout, or their JSON with --json, where the verb has it. See Output.
Decisions: ADR-0048, ADR-0051, ADR-0073.
jr2 watch
jr2 watch <runId> [--json] [--url <u>] [-n <ns>] [--context <ctx>]Follow a run's feed to its end, with the lines that jr2 run prints while it is attached.
On attach it prints where the run is now; an ended run prints its last status once.
Arguments
| Argument | Required | Description |
|---|---|---|
runId | yes | the run, or a unique prefix of its id |
Flags
| Flag | Description |
|---|---|
--json | print each status as one JSON line, and the other events on stderr |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: report, a table or lines on stdout, or their JSON with --json, where the verb has it. See Output.
Decisions: ADR-0009, ADR-0022.
jr2 logs
jr2 logs <runId> [agent] [-f] [--url <u>] [-n <ns>] [--context <ctx>]Print a run's conversations as the Harness prints them, every Agent interleaved by time, or one Agent.
Each line is [<agent>] [<instance id>] [<label>] <text>; Menu-only Agents too; a Working tool's result is never in it.
Reads what the Orchestrator keeps of each conversation, so it works after the Sandbox is gone, while jr2 keeps the run (runs.retain); pod logs stay kubectl logs.
Arguments
| Argument | Required | Description |
|---|---|---|
runId | yes | the run, or a unique prefix of its id |
agent | no | one Agent slot, as jr2 steer <runId> lists it, or an Agent name (default: every Agent) |
Flags
| Flag | Description |
|---|---|
-f, --follow | print each new entry as it is kept, until the run is not live and no conversation is open |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: report, a table or lines on stdout, or their JSON with --json, where the verb has it. See Output.
Decisions: ADR-0009, ADR-0023, ADR-0065.
jr2 send
jr2 send <runId> --event CANCEL [--keep] [--url <u>] [-n <ns>] [--context <ctx>]
jr2 send <runId> --gate <gate> --event <name> [--input <json>] [--url <u>] [-n <ns>]
[--context <ctx>]Abandon a live run, or deliver a workflow event to an open gate.
With --event CANCEL, --keep: abandon a live run and destroy its Workspaces; --keep keeps them for inspection until the idle timeout.
With --gate <gate>, --event <name>, --input <json>: deliver a workflow event to an open gate.
Arguments
| Argument | Required | Description |
|---|---|---|
runId | yes | the run, or a unique prefix of its id |
Flags
| Flag | Description |
|---|---|
--event <name> | CANCEL (run control), or with --gate an event the gate accepts Required. |
--gate <gate> | the open gate to deliver the event to |
--input <json> | the event's input, as a JSON object (with --gate) |
--keep | with --event CANCEL: keep the Workspaces for inspection until the idle timeout |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0009, ADR-0011, ADR-0013, ADR-0025.
jr2 steer
jr2 steer <runId> [agent] [text] [--url <u>] [-n <ns>] [--context <ctx>]Send a Steering message to one Agent of a live run, or list the Agent slots that can hear one.
An open Turn of the slot hears it at its next step boundary; else, or when that Turn ends first, the slot's next Turn in its Machine instance hears it.
With a runId alone it prints the run's Agent slots, each with open and steerable; jr2 status prints the messages sent to the run, in steering.
Needs the steer scope for the run's Workflow.
Arguments
| Argument | Required | Description |
|---|---|---|
runId | yes | the run, or a unique prefix of its id |
agent | no | the Agent slot, as the run's list names it |
text | no | the message, at most 16 KiB |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: jr2 steer <runId> <agent> <text>: activity, activity on stderr only; jr2 steer <runId>: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0002, ADR-0062, ADR-0078.
jr2 whoami
jr2 whoami [--url <u>] [-n <ns>] [--context <ctx>]Print the Caller this credential is: how jr2 knows it, its name, what it may do, and whom it acts for.
On a kube context the Caller is token/instance, on behalf of the kube user; with --url and JR2_TOKEN it is that token's Caller.
Needs no scope, so a credential that may do nothing still sees why.
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0078.
jr2 hooks
jr2 hooks <name> [--limit <n>] [--url <u>] [-n <ns>] [--context <ctx>]Print a Hook's log: each delivery that jr2 keeps (runs.retain), newest first, and what the door did with it.
A line is a handshake, a delivery and its outcome, a repeat (seen), a payload the parse refused (with zod's issues), a request the kind could not read, or a failed follow-up post.
Needs the Instance token: no scope opens it.
Arguments
| Argument | Required | Description |
|---|---|---|
name | yes | the Hook, as hooks in jr2.config.ts names it |
Flags
| Flag | Description |
|---|---|
--limit <n> | how many lines, newest first (default 50, at most 1000) |
Also takes --url <u>, -n, --namespace <ns>, --context <ctx>, JR2_URL, JR2_TOKEN: see Global options.
Output: result, one JSON result on stdout, and activity on stderr. See Output.
Decisions: ADR-0011, ADR-0078.
jr2 caller token
jr2 caller token <name> [-n <ns>] [--context <ctx>]Print a named Caller token's value, read from its Secret over the kube API.
jr2 up makes the value once, for each name that callers.tokens declares.
Arguments
| Argument | Required | Description |
|---|---|---|
name | yes | the named Caller token, as callers.tokens declares it |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: value, one value alone on stdout, for $(…), and activity on stderr. See Output.
Decisions: ADR-0078.
jr2 caller rotate
jr2 caller rotate <name> [-n <ns>] [--context <ctx>]Make a new value for a named Caller token; the old value stops working.
Returns when the Orchestrator has loaded the new digest (about a minute), so the old value is then refused; after 150s it fails, and the old value works until the load.
Prints no value: jr2 caller token <name> prints the new one.
Arguments
| Argument | Required | Description |
|---|---|---|
name | yes | the named Caller token, as callers.tokens declares it |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0078.
jr2 workspace ls
jr2 workspace ls [run] [--json] [-n <ns>] [--context <ctx>]List the Workspaces: handle, Sandbox name, Workflow, phase, age, and whether a run holds it.
Reads the Sandbox CRs over the kube API, with no Orchestrator: kube RBAC is the gate.
A handle is <run-prefix>/<workspace path>, or the Sandbox's name.
Held: the run's Lease marked it (a live run, or one that an Orchestrator crash left); released: its run is over; idle: no Lease renewed it for the idle timeout.
Arguments
| Argument | Required | Description |
|---|---|---|
run | no | only the Workspaces of this run, or of a prefix of its id |
Flags
| Flag | Description |
|---|---|
--json | print the one report object on stdout instead of the table |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: report, a table or lines on stdout, or their JSON with --json, where the verb has it. See Output.
Decisions: ADR-0009, ADR-0012, ADR-0021.
jr2 workspace shell
jr2 workspace shell <ws> [-- cmd] [--user] [-n <ns>] [--context <ctx>]A shell in the Workspace as its Agents work: started by the Harness's spawner in the Agents' Landlock domain, with the Workspace's granted Stand-ins and its folder.
It never reaches the control Stand-in or a Stand-in that the Workspace does not grant.
jr2 workspace shell <ws> -- git status runs one command with no terminal: Ctrl-C ends jr2, and the command gets the end of its input but no signal, so one that ignores it (a dev server) runs on.
Arguments
| Argument | Required | Description |
|---|---|---|
ws | yes | the Workspace: <run-prefix>/<path>, or its Sandbox's name |
-- cmd | no | one command to run in place of a shell |
Flags
| Flag | Description |
|---|---|
--user | a shell in the User Container (kubectl exec -c user), which needs a shell in its image |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0009, ADR-0076.
jr2 workspace forward
jr2 workspace forward <ws> <port> [--stdio] [-n <ns>] [--context <ctx>]Forward a local port to a port in the Workspace's pod; prints 127.0.0.1:<port> and holds it until Ctrl-C.
Ssh: Host *.jr2 with ProxyCommand jr2 workspace forward %h 22 --stdio -n <ns>, then ssh <sandbox name>.jr2.
There is no Service for the User Container: the forward goes through the kube API.
Arguments
| Argument | Required | Description |
|---|---|---|
ws | yes | the Workspace: <run-prefix>/<path>, its Sandbox's name, or <name>.jr2 |
port | yes | the port in the Sandbox pod |
Flags
| Flag | Description |
|---|---|
--stdio | carry one connection on stdin and stdout, for an ssh ProxyCommand |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: value, one value alone on stdout, for $(…), and activity on stderr. See Output.
Decisions: ADR-0005, ADR-0009.
jr2 workspace rm
jr2 workspace rm <ws> [-n <ns>] [--context <ctx>]Remove a Sandbox that no run holds: released, or idle past its idle timeout.
Refuses the Sandbox of a live run: cancel the run first; there is no --force.
The keepalive's age is read on the API server's clock.
Arguments
| Argument | Required | Description |
|---|---|---|
ws | yes | the Workspace: <run-prefix>/<path>, or its Sandbox's name |
Also takes -n, --namespace <ns>, --context <ctx>: see Global options.
Output: activity, activity on stderr only. See Output.
Decisions: ADR-0009, ADR-0021.
jr2 completion
jr2 completion <shell>Print the shell completion script.
The script asks this jr2 for each completion, so the verbs and flags are the command table's.
It completes Workspace handles, live run ids, Workflow names and a run's Agent slots too; a lookup that takes more than 2 s offers nothing.
Bash: source <(jr2 completion bash); zsh: source <(jr2 completion zsh); fish: jr2 completion fish | source.
Arguments
| Argument | Required | Description |
|---|---|---|
shell | yes | bash, zsh or fish |
Output: value, one value alone on stdout, for $(…), and activity on stderr. See Output.
Decisions: ADR-0009.
Run ids
Any <runId> above may be abbreviated to a unique prefix (4+ chars, git-style); an ambiguous prefix lists the candidates and fails rather than guessing.
Env
The Instance's .env is loaded before any verb; a variable already set in the environment wins.
Output
Result verbs (kit push, run, runs, gates, status <runId>, steer <runId>, whoami, hooks) print one JSON result on stdout and activity on stderr, so jr2 run … | jq yields the result; report verbs (version, workflows, bare status, watch, logs, workspace ls) print a table or lines on stdout, or their JSON with --json (watch: one JSON line for each status; logs has no --json); activity verbs (init, check, up, down, gc, send, steer <runId> <agent> <text>, caller rotate, workspace shell, workspace rm) print activity alone; value verbs (caller token, workspace forward, completion) print one value alone on stdout, for $(…), and activity on stderr.
Exit codes
| Code | Meaning |
|---|---|
| 0 | ok |
| 1 | runtime error |
| 2 | usage |