Skip to content
Ask
Reference

CLI Reference

The `agent` binary, derived from CLI_SPEC, the single source of truth the parser and the schema/describe commands surface verbatim.

This page describes the agent binary. It is derived from CLI_SPEC (@inbrowser/agent/cli), the single source of truth the parser and the agent schema / agent describe commands surface verbatim.

Binary

TEXT
agent <command> [options] [positional]

agent is a headless runner for @inbrowser/agent sessions. Output defaults to NDJSON in non-TTY contexts and to text on a TTY.

Global options

These apply to every command.

OptionShortTypeDefaultDescription
--output-oenumndjson (non-TTY), text (TTY)Output format. Choices: ndjson, json, text. Use ndjson for streaming agent consumption.
--fieldsstring[]Comma-separated event field allowlist. Applies only to ndjson/json output. Example: --fields ts,type,turn,name,ok. Max length 512; control chars rejected.
--no-colorbooleanDisable ANSI colors in text output. Auto-disabled when not a TTY.
--help-hbooleanShow help for the (sub)command. Combine with --output json (or pipe to non-TTY) for the machine-readable schema.

Commands

CommandMutatingDescription
runyesRun a single agent session against a scripted LLM and a fake sandbox.
fleetyesLaunch N concurrent agent sessions for isolation testing.
serveyesInverse-mode MCP server exposing AgentDefinition tools over stdio.
eventsnoStream the per-project mutation event log.
undoyesReverse a committed mutation by invoking its recorded reverseOp.
describenoEmit machine-readable descriptions of CLI subjects.
schemanoDump the full CLI command-and-option schema as JSON.
migrateyesPlan the forward replay of a project event log against a production dispatch.
versionnoPrint the package version.
helpnoShow top-level help.

run

Run a single agent session against a scripted LLM and a fake sandbox.

Positional: prompt - free-form prompt text, equivalent to --prompt. Ignored when --json is supplied.

OptionShortTypeDefaultConstraintsDescription
--prompt-pstringreject control chars; max 8192User prompt. Required unless --json is provided.
--jsonjsonRead the full run payload as JSON from stdin (- or no value) or from a file path. Schema: { prompt, scenario?, maxTurns?, sessionId?, history? }.
--scenarioenumechochoices: echo, write-rules; reject control chars, path traversal, query chars; max 64Scripted LLM fixture in headless mode. echo echoes the prompt; write-rules emits a tool_call then text.
--max-turnsnumber81–64Hard cap on agent turn count.
--session-idstringreject control chars, path traversal, query chars; max 64; pattern ^[a-zA-Z0-9_.-]+$Override the auto-generated session id. Used as the session log basename.
--log-dirpath~/.pyric/sessions/reject control chars, query chars; max 1024Directory for the auto session log file. Each run writes <log-dir>/<sessionId>.ndjson.
--no-logbooleanDisable auto session log file writing. Stdout output is unaffected.
--dry-runbooleanValidate inputs and emit a single plan event without invoking the LLM or running tools.
--llmenumautochoices: auto, scripted, openrouterLLM backend. scripted uses the fixture LLM; openrouter requires OPENROUTER_API_KEY; auto picks openrouter when the key is set, otherwise scripted.
--modelstringreject control chars, query chars; max 128OpenRouter model id. Ignored for --llm scripted. Falls back to OPENROUTER_MODEL, then z-ai/glm-4.6.
--reasoningenumchoices: off, low, medium, highForward extended-thinking budget to models that support it. Off by default.
--no-tuibooleanDisable the OpenTUI run view even on a TTY. Falls back to the per-event prose emitter.

fleet

Launch N concurrent agent sessions for isolation testing.

OptionShortTypeDefaultConstraintsDescription
--size-nnumber31–64Number of concurrent sessions to launch.
--scenarioenumwrite-ruleschoices: write-rulesScripted scenario each fleet member runs.
--log-dirpath~/.pyric/sessions/reject control chars, query chars; max 1024Directory for per-session log files.
--no-logbooleanDisable auto session log file writing.
--dry-runbooleanPrint the planned fleet (size, member ids, scenario) without launching sessions.

serve

Inverse-mode MCP server. Exposes the named AgentDefinition(s) over stdio MCP so an external host (Claude Code, Claude Desktop, Cursor) can call their behavior-named tools. The process holds stdin/stdout for the transport; do not pipe through it.

OptionShortTypeDefaultConstraintsDescription
--project-pstringrequired; reject control chars, path traversal, query chars; max 64; pattern ^[a-zA-Z0-9_.-]+$Firebase project id. Routes the event log + run log to ~/.pyric/projects/<project>/.
--events-dirpath~/.pyric/projectsreject control chars, query chars; max 1024Override the events + runs root.
--dry-runbooleanPrint the catalog (agent + tool list) without binding stdio. Exit 0.

events

Stream the per-project mutation event log (~/.pyric/projects/<project>/events.ndjson). Each event is one NDJSON line. Supports filtering by session, tool, agent, phase, and time.

OptionShortTypeDefaultConstraintsDescription
--project-pstringrequired; reject control chars, path traversal, query chars; max 64; pattern ^[a-zA-Z0-9_.-]+$Firebase project id. The log lives at <events-dir>/<project>/events.ndjson.
--events-dirpath~/.pyric/projectsreject control chars, query chars; max 1024Override the events root.
--sessionstringreject control chars, path traversal, query chars; max 64Restrict to events from a single agent session.
--toolstringreject control chars, query chars; max 64Restrict to events from one tool name.
--agentstringreject control chars, query chars; max 64Restrict to events emitted by a single agent. Default emitter is host.
--phaseenumchoices: plan, commit, rollbackRestrict to one lifecycle phase.
--sincestringreject control chars; max 40ISO-8601 lower bound (inclusive).
--untilstringreject control chars; max 40ISO-8601 upper bound (exclusive).
--include-bookkeepingbooleanInclude bookkeeping markers (migrate_applied, migrate_intent). Hidden by default.

undo

Reverse a previously-committed mutation by invoking its recorded reverseOp. Refuses on reversible: false events. --dry-run shows the plan.

OptionShortTypeDefaultConstraintsDescription
--project-pstringrequired; reject control chars, path traversal, query chars; max 64; pattern ^[a-zA-Z0-9_.-]+$Firebase project id whose log holds the event.
--event-estringrequired; reject control chars, query chars; max 64Event id to undo. Must reference a commit-phase event with reversible: true.
--events-dirpath~/.pyric/projectsreject control chars, query chars; max 1024Override the events root.
--dry-runbooleanShow the rollback plan (target, reverseOp tool+args, irreversible-flag check) without invoking the reverse op.

describe

Emit machine-readable descriptions of CLI subjects (commands, scenarios, events).

OptionShortTypeDefaultConstraintsDescription
--target-tenumallchoices: commands, scenarios, events, allWhich subject to describe. commands: subcommand tree. scenarios: scripted LLM fixtures. events: NDJSON event types. all: a single combined object.

schema

Dump the full CLI command-and-option schema as JSON. No options. The output is a stable contract for agent integrations.


migrate

Plan the forward replay of a project event log against a production dispatch. The CLI emits one migrate_plan per replayable commit; --record appends a migrate_intent marker for host pickup. The CLI does not invoke tools; call replayEvents() from @inbrowser/agent against a production registry. Marked mutating because --record appends to the log; without --record the command is pure plan-only.

OptionShortTypeDefaultConstraintsDescription
--project-pstringrequired; reject control chars, path traversal, query chars; max 64; pattern ^[a-zA-Z0-9_.-]+$Firebase project id whose log holds the events to replay.
--events-dirpath~/.pyric/projectsreject control chars, query chars; max 1024Override the events root.
--since-eventstringreject control chars, query chars; max 64Replay only events with id >= this id.
--toolsstring[]reject control chars; max 512Comma-separated tool allowlist. Only events for these tools are planned.
--recordbooleanAppend a migrate_intent event to the log for host pickup. Without it, the command is a pure plan.

version

Print the package version. No options.


help

Show top-level help. Add a subcommand name to scope it. No options.

Input hardening

String and path options carry validation rules enforced by the parser. A rejected input throws InputHardeningError; the CLI emits { type: "error", code: "INPUT_HARDENED", field, reason } as a single NDJSON event and exits with code 64 (EX_USAGE).

RuleEffect
reject control charsRejects values matching [\x00-\x08\x0B\x0C\x0E-\x1F\x7F].
reject path traversalRejects ../ (or ..\) segments and percent-encoded dots (%2e).
reject query charsRejects URL query/fragment characters (?, #).
max lengthRejects values longer than the field’s maxLength.
patternRejects values not matching the field’s regular expression.

Path options additionally resolve to an absolute path: an absolute input is returned as-is, a relative input is joined onto the current working directory. Control-char rejection defaults to on for path options.