CLI for agents: non-TTY safe run/confirmations, compact inspect, wait hints and exit codes

- Without a terminal, run behaves as --json, tui refuses and confirmations
  fail fast naming --yes instead of prompting.
- inspect prints a compact summary by default; --step N, --transcripts and
  --json give detail.
- wait names a failed run's stage and first diagnostic line, prints how to
  answer a run waiting on a person, and exits 2 when any run failed,
  was canceled or interrupted (1 stays for client errors).
- help describes the current # outcome / # handoff format.
- Task starter's Land stage drops edit to match format.md; skill docs
  document run --json --yes, retry --yes --json and the new behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 00:27:14 +00:00
parent accb9970b6
commit 2bde6b6344
16 changed files with 658 additions and 56 deletions
+21 -2
View File
@@ -91,6 +91,12 @@ Use the authoritative `CLI_PREFIX` from the prompt:
distinguishable; `CLI_PREFIX title RUN_ID "..."` renames a run after the fact
without changing its input or steps. The stored prompt is unchanged, and
listing/renaming never calls a model.
- `CLI_PREFIX inspect RUN_ID`: compact summary — a header (status, outcome,
duration, diagnostic), one line per step (stage, status, outcome, duration,
first diagnostic line), how to answer a `waiting` run and the final `# handoff`
(bounded). `--step N` prints one step in full without its transcript (add
`--transcripts` for it), `--transcripts` alone appends every transcript, and
`--json` (with `--step N`, just that step) is the complete record below.
- `CLI_PREFIX inspect RUN_ID --json`: selected run, visits and retained evidence.
Each model step carries the usage its harness reported (`usage.tokens_total`,
`tokens_in`/`tokens_out` only when `split_known`, `cost_usd` only when
@@ -105,6 +111,17 @@ Use the authoritative `CLI_PREFIX` from the prompt:
complete tool history.
- `CLI_PREFIX decide RUN_ID [STAGE] --option KEY [--feedback TEXT] [--json]`: answer
a run `waiting` on a `type=human` stage (`references/format.md`).
- Without a terminal on stdin/stdout (an agent's shell, a pipe, CI) `run` behaves
as `--json` and never opens the full-screen view, `tui` refuses, and every
confirmation fails at once naming `--yes` instead of prompting: pass
`run NAME "TASK" --json --yes` and `retry RUN_ID --yes --json`.
- `CLI_PREFIX wait RUN_ID ...`: one line per run as it finishes (a failed run's
stage and first diagnostic line); while a run waits on a human it prints
`waiting at STAGE — answer with: pipelines decide ID --option KEY` once (stderr
under `--json`). Exit status: 0 every run succeeded, 2 a run failed, was
canceled or interrupted, 1 a client error (unknown id, connection, `--timeout`
reached; the run is untouched). `run --wait` and `retry --wait` also exit 2
for an unsuccessful run.
- `CLI_PREFIX run ... --json --wait --wait-timeout DURATION`: `--wait` polls until
terminal and `--wait-timeout` bounds only the client wait after admission,
independent of per-request `--timeout`. A reached wait limit leaves the admitted run
@@ -267,8 +284,10 @@ assistant message with the same bounded readback as the final result, so a small
final result is visible behind large prior tool content. Inspect the retained
session itself when a preview is bounded or omitted; never assume a complete tool
history from a preview.
Retry is allowed only for a `failed` run after cleanup stops (`interrupted` and
`canceled` runs need a new run). It creates a new linked run with the original
Retry is allowed for a `failed` or `interrupted` run after cleanup stops
(`canceled` runs need a new run); an interrupted run resumes its unfinished
stage, or the stage after its last completed one, and refuses resume (pointing
to `--mode=restart`) when neither is safe. It creates a new linked run with the original
input, directory, pinned version, edit scope and overrides. The default `resume`
mode restarts the failed stage (or `--stage`/`--visit`) with the completed
prefix's handoff and `public/` files; `--mode=restart` starts at entry;