Skip to content

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).

FlagVariableDescriptionTaken 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_URLattach to a specific orchestrator (skips kube entirely)version, run, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks
JR2_TOKENthe 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 clusterrun, runs, workflows, gates, status, watch, logs, send, steer, whoami, hooks

Commands ​

jr2 version ​

sh
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

FlagDescription
--localreport what runs here and skip the cluster
--jsonprint 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

VariableDescription
JR2_HANDOFF_FROMset 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 ​

sh
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

ArgumentRequiredDescription
dirnothe folder to scaffold (default: the current directory)

Flags

FlagDescription
--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 ​

sh
jr2 check

Typecheck 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 ​

sh
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

FlagDescription
--yesanswer the questions non-interactively: confirm first-time setup, and take the recommended git ssh key source (for CI)
--forcebuild every image again, even one already built or deployed
--skip-provider-preflightdo 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

VariableDescription
NO_COLORdraws 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 ​

sh
jr2 down [--all] [--yes] [-n <ns>] [--context <ctx>]

Remove the instance from the cluster.

--all: operator too; --yes: no confirmation.

Flags

FlagDescription
--allalso uninstall the per-cluster operator
--yesdo 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 ​

sh
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

FlagDescription
--dry-runprint 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 ​

sh
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

ArgumentRequiredDescription
registryyesthe 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 ​

sh
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

ArgumentRequiredDescription
workflowyesthe workflow to start, or a named Chart as <wrapper>/<name>

Flags

FlagDescription
--input <json>the run's input, as a JSON object (default: {})
--detachprint the runId and return, and do not stream
--drop-heldresume 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 ​

sh
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

FlagDescription
--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 ​

sh
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

FlagDescription
--jsonprint 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 ​

sh
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

FlagDescription
--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 ​

sh
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

ArgumentRequiredDescription
runIdnothe run to read; without one, the instance's Repos

Flags

FlagDescription
--jsonprint 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 ​

sh
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

ArgumentRequiredDescription
runIdyesthe run, or a unique prefix of its id

Flags

FlagDescription
--jsonprint 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 ​

sh
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

ArgumentRequiredDescription
runIdyesthe run, or a unique prefix of its id
agentnoone Agent slot, as jr2 steer <runId> lists it, or an Agent name (default: every Agent)

Flags

FlagDescription
-f, --followprint 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 ​

sh
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

ArgumentRequiredDescription
runIdyesthe run, or a unique prefix of its id

Flags

FlagDescription
--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)
--keepwith --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 ​

sh
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

ArgumentRequiredDescription
runIdyesthe run, or a unique prefix of its id
agentnothe Agent slot, as the run's list names it
textnothe 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 ​

sh
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 ​

sh
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

ArgumentRequiredDescription
nameyesthe Hook, as hooks in jr2.config.ts names it

Flags

FlagDescription
--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 ​

sh
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

ArgumentRequiredDescription
nameyesthe 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 ​

sh
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

ArgumentRequiredDescription
nameyesthe 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 ​

sh
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

ArgumentRequiredDescription
runnoonly the Workspaces of this run, or of a prefix of its id

Flags

FlagDescription
--jsonprint 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 ​

sh
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

ArgumentRequiredDescription
wsyesthe Workspace: <run-prefix>/<path>, or its Sandbox's name
-- cmdnoone command to run in place of a shell

Flags

FlagDescription
--usera 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 ​

sh
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

ArgumentRequiredDescription
wsyesthe Workspace: <run-prefix>/<path>, its Sandbox's name, or <name>.jr2
portyesthe port in the Sandbox pod

Flags

FlagDescription
--stdiocarry 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 ​

sh
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

ArgumentRequiredDescription
wsyesthe 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 ​

sh
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

ArgumentRequiredDescription
shellyesbash, 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 ​

CodeMeaning
0ok
1runtime error
2usage

The docs of Kit version 0.7.0. Each page is also at its .md URL.