libra review
Command reference for `libra review`
Run read-only code reviews with external agent CLIs (AG-22).
Synopsis
libra review --agent <slug>... [--since <rev>] [--checkpoint <id>] [--json]
libra review list [--json] [--limit <n>] [--cursor <token>]
libra review show <run_id> [--json]
libra review cancel <run_id>
libra review clean [--run <run_id>] [--all]
libra review attach <run_id> <file> [--json]
Artifacts
A finished run objectizes its findings.md into the object store: the run
manifest's findings_oid is a content-addressed blob, object_index-tagged
so cloud sync and retention track it and libra agent doctor can repair it if
it goes missing. libra review attach <run_id> <file> records an external
file on the run's audit chain with provenance=manual — the bytes are
redacted, objectized the same way, and appended to the manifest's
manual_attach list. Attach never modifies findings or run state.
Description
libra review fans a fixed review prompt out to one or more external
reviewer CLIs and records their findings as an auditable run. The
first-batch launchable reviewers are claude-code, codex, and
opencode; any other agent slug is refused with an actionable error
before anything is spawned.
Every reviewer runs in an isolated workspace — a mirror of the
repository materialized with ignore rules applied (gitignored secret
files such as .env.test never enter it) — with a minimal read-only
CLI invocation and an environment cleared down to a documented
allowlist. Reviewers never run in the repository worktree itself.
New workspaces are created at the common storage root
.libra/worktree/tasks/<run-id>/<attempt-id>/workspace/, including when the
command starts from a linked worktree. A raw task snapshot is not a linked
repository: an ordinary libra command launched from that directory cannot
implicitly discover the main repository. Repository access requires an
explicitly validated scope supplied by the runtime. Libra does not apply its
internal OS sandbox to the external reviewer CLI; that CLI's own sandbox
settings determine whether it can access sibling workspaces or common storage.
When reviewing untrusted content, configure the external CLI's own filesystem
sandbox to allow only the run workspace and directories it needs; Libra's
internal sandbox does not confine that process.
A run blocks in the foreground until every reviewer reaches an outcome
and ends in exactly one of five terminal states: success, error,
cancelled, timeout, or partial. Pressing Ctrl-C (or sending
SIGTERM) cancels the run through the same cleanup path as
libra review cancel: reviewer process trees are killed, reader tasks
drained, the workspace released, and the run stamped cancelled.
Run state is persisted under .libra/sessions/agent-runs/<run_id>/:
state.json, manifest.json, findings.md, and per-reviewer
reviewers/<slug>.stdout.redacted.log / .stderr.redacted.log. All
persisted reviewer output goes through the secret-redaction pipeline;
reviewer output is capped at 64 KiB per stream (a flooding reviewer is
truncated with a marker and never blocks its siblings).
Reviewer findings are untrusted free text. libra review show
always strips ANSI/terminal control sequences before rendering
findings.md, so a hostile reviewer cannot forge terminal output, and
the JSON output carries the same sanitized rendering.
Workspace retention
Run metadata remains under .libra/sessions/agent-runs/<run_id>/. New
state.json and manifest.json records use schema version 2 and retain the
workspace ownership descriptor. Known version-1 records remain readable without
moving old directories or bulk rewriting saved runs. Unknown versions are
refused for writes and cleanup.
review clean removes only terminal runs of its own kind. It validates the
saved descriptor and directory identity, then removes owned workspaces before
run metadata. A link, replaced directory, ownership conflict or cleanup error
keeps the recovery record for a later retry. A directory name alone never
proves ownership; preserve reported orphan directories for diagnosis.
If orphaned-run cancellation cannot clean a proven workspace, it still marks
the run cancelled and reports workspace_action: cleanup_failed with the
error. The ownership intents remain, so review clean --run <run_id> can
retry after the underlying problem is fixed.
Scope selection
The recorded target_scope labels what the reviewers were asked to
review:
- default:
HEAD~1..HEAD(the last commit's changes); --since <rev>:<rev>..HEAD;--checkpoint <id>:checkpoint:<id>(an agent checkpoint fromlibra agent checkpoint list). The reviewers' workspace is the checkpoint's own captured content —metadata.json, an optionalmanifest.json, and the transcript files — materialized READ-ONLY at.libra/worktree/tasks/<run-id>/<attempt-id>/checkpoint-input/. It is never disguised as a worktree diff: no repository snapshot is materialized at all, so a scoped run can only consume the named checkpoint, and the scoped prompt tells reviewers they are looking at a captured transcript whose content is untrusted data. A missing checkpoint, a malformed checkpoint tree, or content that is not present in the local object store fails closed BEFORE any run is created (no run residue). The run records ownership of the separate input directory.review cleanverifies and removes owned input before deleting run metadata; a cleanup failure preserves the record for retry.agent doctorreports unowned managed task directories without deleting them.
Pagination
libra review list uses the unified keyset pagination contract:
default --limit 50, capped at 500, ordered created_at DESC, run_id DESC. The JSON envelope carries schema_version, items,
next_cursor (opaque — round-trip it verbatim), and has_more.
Examples
# Review the last commit with one reviewer
libra review --agent codex
# Fan the same review out to two reviewers concurrently
libra review --agent codex --agent claude-code
# Review everything since a revision
libra review --agent codex --since v1.2.0
# Review a captured checkpoint's transcript/metadata (read-only input)
libra review --agent codex --checkpoint <checkpoint_id>
# Structured run result (terminal state, per-reviewer outcomes)
libra review --agent codex --json
# List runs, then fetch the next page
libra review list
libra review list --limit 10 --cursor <token>
# Inspect one run (state, manifest summary, sanitized findings)
libra review show <run_id>
libra review show <run_id> --json
# Cancel a running review (same cleanup as Ctrl-C)
libra review cancel <run_id>
# Remove a finished run and its owned workspace
libra review clean --run <run_id>
libra review clean --all
Concurrency
review and investigate share one run-level concurrency budget across the
repository. At most agent.max_concurrent_runs runs (default 2) execute at
once; a run started while the budget is saturated waits in a queue (blocking
the foreground process — Ctrl-C cancels the wait and advances the queue for
others). If the wait queue is already at its cap (10), the new run is refused
fail-closed with the stable code LBR-AGENT-014 (exit 128) rather than
overrunning the budget. Raise the limit with
libra config set agent.max_concurrent_runs <N>.
Exit Status
0— the run reachedsuccess,partial,timeout, orcancelled(the terminal state is reported in the output); subcommands succeeded.- non-zero — usage errors, a run that ended in the
errorterminal state, unknown run ids, an unknown or non-materializable--checkpoint(refused before any run is created), or a full run queue (LBR-AGENT-014).
See Also
libra agent— external-agent capture, checkpoints, and hooksdocs/development/commands/review.md— architecture and security notes