Skip to main content
You’ll add an approval(...) step between two edits, answer it in a terminal, then run the same workflow the way CI and coding agents do. You need Node.js 22.18 or later and Git.

1. A workflow that asks

In a new directory my-app, create a file to change and the workflow:
src/user.js
workflow.ts
astGrep applies an ast-grep rule to each file. approval(message) waits for a yes or no before the run goes on.

2. Answer in a terminal

The run asks, and goes on when you answer y:
Answering n stops the run at the approval, to resume later. Undo the change before the next part: git checkout -- src.

3. Run it unattended

In CI there is nobody to answer. Pass --no-interactive: the run goes as far as it can, saves itself at the approval, and exits.
Exit code 3 lets a CI job tell a waiting run from a finished one. See Exit codes.
The first step’s change is written. Ask the run what it waits for:
approval:1 is the question’s id: the approval in step 1. It stays the same however often you resume.

4. Approve and continue

The first step isn’t run again (↺ … (done earlier)). Both vars are now const. To approve everything up front, pass --approve to workflow run. To see past approvals in a dry run, pass --dry-run --approve: a dry run is not saved, so one that reaches an approval without --approve exits 1.

5. Answer from a program

A coding agent or a wrapper script can answer questions while the run waits, in one process. Start the run with --format jsonl --control stdio, read events from its stdout, and write commands to its stdin. Save this as drive.mjs next to my-app:
drive.mjs
Answer reject instead and the run ends as rejected, with exit code 1. The first step’s change stays; a rejected run can’t be resumed without --force.
Closing stdin while a question is open pauses the run, as Ctrl-C does. Resume it later with workflow resume --id <id> --approve approval:1.

Next