# agengo reference
Exact behaviour of agengo 0.4: the plan format, every CLI command, the workflow and its states, quality gates, metrics, storage and cleanup, and the adapter protocol. This page tells you what each thing does, not when to use it; for that, see the [user guide](guide.md). Terms are defined in the [glossary](glossary.md). A Vietnamese translation is available: [docs/vi/tra-cuu.md](vi/tra-cuu.md).
**Contents:** [Plan format](#plan-format) · [Commands](#commands) · [Workflow and states](#workflow-and-states) · [Quality gates](#quality-gates) · [Metrics](#metrics) · [Storage and cleanup](#storage-and-cleanup) · [Adapter protocol](#adapter-protocol)
## Plan format
A plan is YAML or JSON, validated against [specs/plan.schema.json](../specs/plan.schema.json). agengo rejects unknown fields, dependency cycles and paths outside the repository.
| Field | Required | Meaning |
|---|---|---|
| `goal` | ✔ | Overall goal of the run |
| `tasks[].id` | ✔ | 1–64 characters from `A-Z a-z 0-9 _ -`, unique |
| `tasks[].goal`, `title` | goal ✔ | Instructions for the agent / short title for people |
| `tasks[].owns` | ✔ | Files or directories, relative to the repository root, that the Builder may change. Changes outside this scope are rejected. Tasks with overlapping `owns` never run in parallel |
| `tasks[].acceptance` | ✔ | Acceptance criteria, as strings or `{id, text}`. Strings get the IDs `AC-1`, `AC-2`, …. With a `spec`, an object may add `refs: [FR-1, SC-2]` |
| `tasks[].verify` | ✔ | argv commands, run on the candidate before review and again at integration |
| `tasks[].depends` | | Tasks that must be integrated first |
| `tasks[].setup` | | Commands that prepare this task's worktrees, in addition to the shared `setup` |
| `tasks[].dependency_context`, `related_to` | | Explain relationships to the agent (`needed_for` / `reason`, `refs`) |
| `setup` | | Commands that prepare every worktree, for example `[["npm","ci"]]` |
| `integration_verify` | | Commands run after every integration |
| `final_verify` | ✔ | Commands run on the final branch before delivery |
| `quality` | | See [Quality gates](#quality-gates) |
| `spec` | | `{path, digest, stories}`, written by `plan --spec`; see [Planning from a spec](guide.md#planning-from-a-spec) |
Commands are always argv arrays (`["cmd", "arg"]`) and never go through a shell. Use `["sh", "-c", "..."]` if you need shell syntax.
## Commands
| Command | Purpose |
|---|---|
| `spec --idea I` / `spec FILE` | Turn an idea into a spec by answering questions (`--answer Q-n=…`, `--decision`, `--proceed`, `--approve`, `--depth`, `--json`, `-o`, `--force` to replace an existing spec file). Exit `2` while questions are open |
| `plan --file F` / `--goal G` / `--from F` / `--spec S` | Validate a plan, or have the agent draft one (`--brief`, `--format yaml`, `--context`; `--stories` and `--approve-spec CODE` with `--spec`). Exit `2` when a `--spec` draft has questions |
| `run PLAN [--id ID] [--jobs N] [--base REV]` | Start a run. Without `--id`, a plan kept in `.agengo/plans/` whose file name is a valid run ID names the run (`.agengo/plans/p1-admin.yaml` → `p1-admin`); otherwise agengo generates one, so rerunning a reused `plan.yaml` still works. If that run or its branch `af/<id>` already exists, pass `--id` (or `agengo resume <id>`). Before any agent starts, it prints the agent, how it logs in, the handoff mode, jobs, limits and timeout. Other options: `--review-limit` (default 3), `--gate-limit` (default 2), `--timeout` seconds per agent attempt (default 900), `--builder-handoff worktree\|commit`, `--agent`, `--auth subscription\|api` (default `subscription`, see [Authentication](guide.md#authentication)), `--roles`, `--await-approval` |
| `resume ID [--agent A]` | Continue or recover a run. `--agent` continues it with another agent (`claude`, `codex`, `agy` or a custom adapter path) and stores that choice, for when the one it started with is unavailable. Without it the run keeps its agent, and the command says so when that agent is not installed |
| `resume ID --task T` / `pause ID --task T` | Unpause / pause one task |
| `status ID [--json]` | Plan, task states, requests and evidence (`--json` includes every attempt's request and result). When a run is marked `running` but no agengo process drives it (its coordinator was killed or the machine restarted), it says so, lists attempts left marked active as stalled, and prints `agengo resume ID`; `--json` adds `driven` and `resume_command`. Read-only: it never resumes the run itself |
| `status ID --watch [--interval SECONDS]` | Print the status and the attempts and cost so far every 10 seconds (or SECONDS). Stops when the run is delivered or failed, a request waits for you, no agengo process drives the run, or on Ctrl+C. Read-only |
| `inbox ID [--json]` | Pending requests, each with the command that answers it, and `agengo resume ID` when a `running` run has no agengo process driving it |
| `respond ID Y-xx --choice A\|B\|approve\|reject --note N [--plan F]` | Answer a request; which options apply to which kind of request is in [Answering requests](guide.md#answering-requests) |
| `resolve ID T --note N` | Record guidance and reopen a blocked task |
| `amend ID PLAN --note N` | Approve a new plan revision (only tasks that have not started or are blocked may change) |
| `metrics ID [--json]` | Time, tokens and cost per role, per task and in total; rework count; reliability figures (see [Metrics](#metrics)) |
| `metrics --all [--json]` | One row per run in the state database, a combined row and per-model rows (see [Metrics](#metrics)) |
| `clean ID` | Remove the run's worktrees, and its temporary refs once the run is delivered |
| `agent` / `agent use NAME` | List the coding agents installed and the one commands will use, or choose one for this repository in `.agengo/config.yaml` (`agent: NAME`). `agent use auto` removes the choice. See [Choosing the agent](#choosing-the-agent) |
| `config` / `config set KEY VALUE` / `config unset KEY` | Show the repository's settings, or change one in `.agengo/config.yaml`. Keys: `agent`, `sandbox` (`off`, `auto`, `strict`), `think.model`, `think.effort`, `build.model`, `build.effort` (`low`, `medium`, `high`, `max`), and `think.models.AGENT` / `build.models.AGENT`. A value that would make the file invalid is refused and nothing is written; comments in the file are not kept. See [Model and effort](#model-and-effort) |
| `roles [--file F]` | Validate a custom role catalog and its prompts |
| `init [--no-agents-md]` | Install the agengo skill and an `AGENTS.md` section, and create `.agengo/principles.md` and `.agengo/plans/` (see [Agent integration](guide.md#agent-integration)) |
| `doctor` | Check git (2.31+, identity), that the repository has commits and a clean tree, that every file `init` writes is present (with the fix for a missing one), and which coding agents are installed (Claude Code, Codex, Antigravity), which one commands will use, and that Claude Code is logged in when it is that one. Exits 1 if a run would fail |
`-C <dir>` (`--repo`) selects the repository; the default is the current directory.
## Workflow and states
```
pending → building → [verifying] → ready_review → reviewing → passed → integrated
↘───────────────── blocked (waiting for you) ─────────────────↙
```
1. **Build.** The Builder works in a fresh worktree on branch `af-work/<run>/<task>/<attempt>`. There are two handoff modes:
- `worktree` (default with Claude Code and Codex): the Builder only edits files. agengo captures the changes as a commit and pins it at `refs/agengo/builds/...`.
- `commit` (default with a custom adapter or `--agent agy`): the Builder commits to its assigned branch. `--agent codex` defaults to `worktree` (see [Sandbox](#sandbox)).
2. **Verify.** The task's `setup` and `verify` commands run on the candidate commit in a clean worktree. The Reviewer only sees commits that pass.
3. **Review.** The Reviewer must report on exactly the SHA it was given. Requested changes become findings (`F-01`, …) that the next Builder attempt receives. Each finding has a severity: `critical` and `high` findings block the task, while `medium` and `low` findings are recorded with state `advisory` in `status --json` and do not go back to the Builder. A review can pass with advisory findings. After `--review-limit` rounds, the run asks you.
4. **Integrate.** agengo runs `merge --no-ff` into `af/<run>`, then the task's `verify` and `integration_verify`. Integration failures go back to the Builder; after `--gate-limit` failures, the run asks you.
5. **Final checks.** `setup`, `final_verify`, `quality.checks`, the duplicate gate and the optional whole-branch review run on the final branch. If they pass, agengo delivers and cleans up.
All state lives in SQLite. If agengo is interrupted at any point, even in the middle of an integration, `resume` continues from exactly there. A file lock ensures only one coordinator runs per run.
## Quality gates
```yaml
quality:
python_duplicates: warn # off | warn (default) | block
ignore_paths: [vendor] # skipped by the duplicate search
checks: [["ruff", "check", "."]] # extra commands for the final checks
review: false # true: add a whole-branch review
verify_findings: false # true: try to refute blocking review findings first
```
**Finding verification** (`verify_findings: true`). When a Reviewer requests changes, a verifier agent (role `verify`) checks out the same commit and tries to prove each new `critical` or `high` finding wrong. A finding is cleared only when the verifier refutes it with a confidence of at least 0.8; it is then stored as `advisory` with a `refuted` object (`confidence`, `reasoning`). An unsure verdict, a missing verdict or a verifier failure keeps the finding blocking. If every blocking finding is refuted and no earlier finding is still open, the review counts as a pass, so the task does not go back to the Builder or use up a `--review-limit` round. The same applies to the whole-branch review. The verifier's tokens and cost are added to the review attempt, and its verdicts are kept in that attempt's `result.verification`.
**Python duplicates** compares syntax fingerprints (tree-sitter) of functions. Parameter and local variable names are normalized, so a copied function with renamed variables is still found. Functions that only store values into attributes (`self.x = x` boilerplate in `__init__`) are ignored. Only new duplicates, or more copies than at `base`, count.
- `warn`: records the result in the `quality_duplicates` attempt and still delivers, with a warning.
- `block`: checks at **every integration**, so the Builder of the task that adds a duplicate has to fix it. At the final checks, duplicates block delivery.
- `true`/`false` from 0.2.x plans are still accepted and mean `block`/`off`.
## Metrics
`agengo metrics ID` reports one run; `agengo metrics --all` reports every run in the state database. Both only read the state database; they make no agent calls. Add `--json` for the full document. The text output prints the same figures, with a `[RELIABILITY]` block after the usage lines of `metrics ID`; a rate that is omitted from the JSON is printed as `n/a`.
`metrics ID --json` has the keys `run_id`, `roles` (time, attempt count and usage per role), `tasks` (build and review attempts and usage per task), `usage_total`, `additional_task_attempts` (build and review attempts beyond the first per task and role) and `reliability`.
### The `reliability` object
Only task build and review attempts count here: attempts with role `build` or `review` and a task. The first attempt of a task is the earliest one recorded. A review attempt **has a verdict** when agengo recorded it as `pass` or `changes_requested`. Review attempts without a verdict (still `active`, or ended as `blocked`, `error`, `interrupted` or `superseded`) are not counted, so an interrupted or failed review is neither a failed first review nor a review round. A review whose blocking findings were all refuted by finding verification is recorded as `pass`.
| Key | Meaning |
|---|---|
| `tasks_reviewed` | Tasks with at least one review attempt that has a verdict |
| `first_review_pass` | Tasks whose first review verdict is `pass` |
| `first_review_pass_rate` | `first_review_pass / tasks_reviewed`, from 0 to 1. **Omitted** when `tasks_reviewed` is 0 |
| `review_rounds` | `{"mean", "max"}`: review attempts with a verdict per reviewed task, averaged over `tasks_reviewed`, and the largest count. **Omitted** when `tasks_reviewed` is 0 |
| `build_attempts` | Build attempts of every task, in any state, including active ones |
| `integrated_tasks` | Tasks merged into `af/<run-id>` |
| `build_attempts_per_integrated_task` | `build_attempts / integrated_tasks`. **Omitted** when `integrated_tasks` is 0 |
| `gate_failures` | Sum over tasks of the integration failures counted toward `--gate-limit`. A failure that needs an `action` (a missing prerequisite) is not counted |
| `review_failures` | Sum over tasks of the `changes_requested` reviews counted toward `--review-limit` |
| `findings.total` | Review findings recorded in the run |
| `findings.by_state` | Findings per state: `open`, `advisory`, `resolved`, `superseded`. States with no findings are left out |
| `findings.by_severity` | Findings per severity: `critical`, `high`, `medium`, `low`. A finding stored without a severity counts as `high`, the same default agengo uses to decide whether it blocks. Severities with no findings are left out |
| `by_model` | One entry per model that reported [usage](#token-and-cost-usage-optional), sorted by model; see below |
`gate_failures` and `review_failures` are the per-task counters that the limits use. agengo sets a task's counters back to 0 when it reopens the task through `resolve`, `respond` (choice A) or `amend`, so they count failures since the task was last reopened, not over its whole history.
Each `by_model` entry:
| Key | Meaning |
|---|---|
| `model` | The `model` an attempt reported in its usage; `null` when usage had no model |
| `attempts` | Attempts of any role in the run that reported usage with this model |
| `cost_usd` | Sum of their `cost_usd`. **Omitted** when none reported a cost |
| `tasks_first_built` | Tasks whose first build attempt reported this model |
| `tasks_reviewed` | Those tasks that have at least one finished review attempt |
| `first_review_pass` | Those tasks whose first finished review attempt is `pass` |
| `first_review_pass_rate` | `first_review_pass / tasks_reviewed`. **Omitted** when `tasks_reviewed` is 0 |
`tasks_first_built`, `tasks_reviewed`, `first_review_pass` and the rate credit each task to the model of its first build attempt only, even when a later build attempt used another model. A task whose first build attempt reported no model (or no usage) is credited to the `"model": null` entry when there is one, and otherwise to no model. `attempts` and `cost_usd` count every attempt of the model, rework included.
### `metrics --all`
`metrics --all --json` returns `{"runs": [...], "combined": {...}, "by_model": [...]}`. Runs are listed in the order they were created.
| Key | Meaning |
|---|---|
| `runs[].run_id` · `runs[].state` | Run ID and run state |
| `runs[].tasks` | Tasks in the run's current plan revision |
| `runs[].agent_attempts` | Task build and review attempts (the sum of `agent_attempts` in the run's `tasks` rows) |
| `runs[].tasks_reviewed` · `first_review_pass` · `first_review_pass_rate` · `gate_failures` | As in the run's `reliability` object, including when the rate is omitted |
| `runs[].cost_usd` | The run's total reported cost (`usage_total.cost_usd`). **Omitted** when no attempt reported a cost |
| `combined.runs` | Number of runs |
| `combined.tasks` · `agent_attempts` · `tasks_reviewed` · `first_review_pass` · `gate_failures` · `cost_usd` | Sums of the run rows. `cost_usd` is **omitted** when no run has a cost |
| `combined.first_review_pass_rate` | `combined.first_review_pass / combined.tasks_reviewed`, not an average of the run rates. **Omitted** when `combined.tasks_reviewed` is 0 |
| `by_model[]` | The runs' `by_model` entries merged by model: `model`, `runs` (runs in which the model reported usage), and the sums of `attempts`, `cost_usd` (**omitted** when no run reported a cost for the model), `tasks_first_built`, `tasks_reviewed` and `first_review_pass`. `first_review_pass_rate` is computed from the sums and **omitted** when `tasks_reviewed` is 0 |
These figures compare agents and models only as well as the runs allow: tasks differ in size and difficulty, so compare models on similar plans.
## Storage and cleanup
| Data | Location |
|---|---|
| Project principles, spec and plans | `.agengo/principles.md`, `.agengo/spec.yaml`, `.agengo/plans/<run-id>.yaml`. Commit them; they record what was decided and planned |
| State and evidence | `.git/agent-flow/state.sqlite3` (shared by all worktrees of the repository) |
| Agent worktrees | `~/.cache/agengo/worktrees/<repo>-<id>/<run>/<step>/<attempt>`. Precedence: `$AGENGO_WORKTREES`, then `$XDG_CACHE_HOME/agengo/worktrees`, then on Windows `%LOCALAPPDATA%\agengo\worktrees`. The location chosen first is recorded in `.git/agent-flow/worktree-root` |
| Result branch | `refs/heads/af/<run>` |
| Temporary refs | `refs/heads/af-work/<run>/…`, `refs/agengo/builds/<run>/…` |
Worktrees live **outside `.git`**, because Claude Code refuses to write below `.git/`. Each step's worktree is removed as soon as the step finishes, except a blocked Builder's worktree, which is kept for inspection. On delivery, agengo removes all of the run's worktrees and temporary refs. `agengo clean ID` cleans up manually; for a run that is not delivered it keeps the temporary refs, because unfinished tasks still need those commits.
## Adapter protocol
With `--agent <exe>`, agengo runs `<exe>` once per attempt, with the assigned worktree as the working directory. The request is one JSON document on **stdin**, following [specs/request.schema.json](../specs/request.schema.json). The adapter prints exactly one JSON document on **stdout**, following [specs/outcome.schema.json](../specs/outcome.schema.json) (the `plan` role follows [specs/planner-output.schema.json](../specs/planner-output.schema.json), the `specify` role [specs/specify-output.schema.json](../specs/specify-output.schema.json)). Environment variables are inherited from agengo, except API keys in `--auth subscription` mode (see [Authentication](guide.md#authentication)). On Windows the adapter must be an `.exe`, `.cmd` or `.bat` file; to use a script, wrap it in a `.cmd` (for example `@python "%~dp0adapter.py" %*`). A bare name is looked up on `PATH` with `PATHEXT`, as are the commands in `verify` and `setup`, so `["npm", "test"]` runs `npm.cmd`.
A `specify` request carries `idea`, `spec` (the current sections, `null` in round 1), `answers` (`id`, `question`, `answer`), `round` and `finalize`; it runs in the repository root.
Main request fields: `role` (`plan`/`specify`/`build`/`review`/`verify`), `run_id`, `attempt_id`, `plan_revision`, `task` (id, goal, owns, acceptance, verify, …), `head`, `base`, `integration_sha`, `worktree`, `builder_handoff`, `merge_parent` (when present), `feedback`, `decisions`, `context` (`acceptance`, `decisions`, `open_findings`, and `spec` when the plan has one) and `relationships`. A `plan` request drafted with `--spec` carries `spec`, the part of the spec to plan.
Result:
```json
{"status": "done", "head": "<sha>", "summary": "…", "blocker": null,
"findings": [], "finding_resolutions": [], "resolved_conflicts": []}
```
- Builder, `commit` mode: `done` with the new HEAD SHA (clean worktree, unchanged branch). `worktree` mode: `ready` with `head` set to the starting commit, and the index untouched.
- Reviewer: `pass` or `changes_requested`, with `head` equal to the SHA it was given. New findings go in `findings` with an `acceptance_id` and a `severity` (`critical`, `high`, `medium` or `low`; `high` when omitted). `pass` allows only `medium` and `low` new findings, and `changes_requested` needs at least one `critical` or `high` finding, new or still open. Existing findings are answered in `finding_resolutions`.
- Verifier (only with `quality.verify_findings: true`): the request is the review request with `role` set to `verify` and a `findings` list holding the Reviewer's blocking findings, each with its position in the Reviewer's reply as `finding`. The adapter returns `{"verdicts": [{"finding": 0, "refuted": true, "confidence": 0.9, "reasoning": "…"}]}`, following [specs/verification.schema.json](../specs/verification.schema.json), and may add `usage`. It must not change the worktree.
- Any role except the verifier may return `blocked` with a `blocker` (`action`/`decision`/`information`). agengo turns it into a `Y-xx` request.
- A non-zero exit, output that is not JSON, or exceeding `--timeout` is an incident: the task is blocked with a `decision` request.
- agengo checks the result when it arrives: `status`, `blocker.kind`, `blocker.recommended_choice` and `finding_resolutions[].status` must be one of the listed values, `summary` must be a non-empty string, and every field must have the type in the schema. A result that breaks these rules is an incident whose message names the field, for example `invalid agent reply: unknown variant "finished"`. Missing lists count as empty, and unknown fields are ignored, so an adapter may add its own data. If the result echoes `attempt_id`, `run_id`, `plan_revision` or `task_id`, they must match the request.
A complete reference adapter lives in [`tests/support/mod.rs`](../tests/support/mod.rs) (function `adapter`).
### Token and cost usage (optional)
An adapter may add a top-level `usage` object next to `status`, following [specs/usage.schema.json](../specs/usage.schema.json). agengo stores it per attempt, shows it in `status --json`, and totals it in `agengo metrics` per role, per task and per run. The reported `model` is what groups the per-model [reliability figures](#metrics).
```json
{"status": "done", "head": "<sha>", "summary": "…", "blocker": null,
"findings": [], "finding_resolutions": [], "resolved_conflicts": [],
"usage": {"input_tokens": 1200, "output_tokens": 300, "cache_read_tokens": 0,
"cache_write_tokens": 0, "cost_usd": 0.012, "model": "my-model"}}
```
- Every field is optional. Fields with the wrong type or a negative value are dropped; an attempt never fails because of usage data.
- `input_tokens` counts input that was **not** read from a cache.
- agengo never prices tokens itself. If the adapter knows the cost, it fills in `cost_usd`.
- Attempts that report no `usage` are shown as "no usage", not as 0. Attempts killed by a timeout have no usage.
- For Claude Code, agengo reads `usage`, `total_cost_usd` and `modelUsage` from the `claude -p` JSON automatically.
Mapping from common providers (field names as in each provider's API):
| agengo field | Anthropic API | OpenAI Chat Completions | OpenAI Responses | Gemini (`usageMetadata`) | Ollama |
|---|---|---|---|---|---|
| `input_tokens` | `input_tokens` | `prompt_tokens − prompt_tokens_details.cached_tokens` | `input_tokens − input_tokens_details.cached_tokens` | `promptTokenCount − cachedContentTokenCount` | `prompt_eval_count` |
| `output_tokens` | `output_tokens` | `completion_tokens` | `output_tokens` | `candidatesTokenCount + thoughtsTokenCount` | `eval_count` |
| `cache_read_tokens` | `cache_read_input_tokens` | `prompt_tokens_details.cached_tokens` | `input_tokens_details.cached_tokens` | `cachedContentTokenCount` | — |
| `cache_write_tokens` | `cache_creation_input_tokens` | — | — | — | — |
If your agent calls a model several times in one attempt, sum the values before returning them.
### Choosing the agent
agengo does not fix an agent when it is installed. Each command that starts one (`spec`, `plan`, `run`) picks it, in this order:
1. `--agent NAME` (`claude`, `codex`, `agy` or the path of a custom adapter).
2. The environment variable `AGENGO_AGENT`, with the same values.
3. `agent: NAME` in `.agengo/config.yaml`, which `agengo agent use NAME` writes. `auto`, or no value, goes to the next step.
4. The only agent installed: of `claude`, `codex` and `agy`, the one whose program is on `PATH`. A note says which was used, except for Claude Code.
With none installed agengo says what to install. With **several installed and none chosen** it does not guess, because the choice decides which login is used and who is billed: at a terminal it asks once and keeps the answer in `.agengo/config.yaml`; without one (a script, or an agent calling agengo) it stops and prints the command to run, such as `agengo agent use codex`. A run stores the agent it started with; `agengo resume ID --agent NAME` continues it with another one.
### Model and effort
Roles use two tiers: `think` for `plan`, `specify`, `review` and `verify`, and `build` for `build`. Set them in `.agengo/config.yaml`; nothing is set by default, so each agent uses its own default model.
```yaml
think: {model: opus, effort: high}
build: {model: sonnet, effort: low}
```
`effort` is `low`, `medium`, `high` or `max`. agengo does not know or check model names: it passes them to the agent unchanged and records the model the agent reports. To use one agent per platform with different names, add a `models:` map to a tier (`think: {model: opus, models: {codex: gpt-5.5}}`); an entry for the agent in use wins over `model`. Agents without a model or effort flag get a note and use their own setting. A custom adapter receives `tier`, `model` and `effort` in the request when they are set. The commands print the tiers they use before any agent starts.
### Agents known by name
`--agent codex` and `--agent agy` start those command-line agents with their own login, so work can use the model of the platform you already pay for. They are listed in [specs/agents.yaml](../specs/agents.yaml): the command, where the prompt goes, the flags for roles that only read and for the Builder, and where the final message is in the output.
Unlike an adapter, these agents are not asked for JSON on stdout. agengo sends the role's instructions, the request and the reply schema as the prompt, asks the agent to end with one JSON object, finds the last JSON object in the output (a code fence or an introduction around it is fine), and checks it as it checks any reply. If the output holds no JSON object, agengo asks once more; a second miss is an error. The same size and structure checks as for any adapter then apply, and usage is not read, so these attempts report no tokens or model.
| Name | Runs | Read-only roles | Builder |
|---|---|---|---|
| `codex` | `codex exec -` (prompt on stdin) | `--sandbox read-only` | `--sandbox workspace-write` |
| `agy` (experimental) | `agy --output-format json -p PROMPT` | agy's own default | agy's own default |
`agy` is experimental: its flags come from its documentation. Run without a terminal, agy cannot ask for approval: a tool it needs (such as `command`) is denied and the run ends with an empty reply. agengo reports the denied tool; allow it under `permissions.allow` in `~/.gemini/antigravity-cli/settings.json` (agy's own settings). Also, and the prompt travels as an argument, so a prompt longer than 30,000 bytes is refused. Codex on Linux needs `bubblewrap` for its sandbox. A name that is not in the file is taken as the path of a custom adapter, as before.
### Sandbox
`--sandbox off|auto|strict` (on any command; or `sandbox:` in `.agengo/config.yaml`, and `--sandbox` wins) says how far agengo goes to confine the agents it starts. The default is `auto`; `--sandbox off` (or `sandbox: off` in the config file) gives the old behaviour: no sandbox from agengo and your whole environment passed to the agents.
| Mode | Claude Code | Codex | `agy` | Custom adapters | Environment |
|---|---|---|---|---|---|
| `off` | no sandbox | its own `--sandbox` option, as always | none | none | passed unchanged |
| `auto` | Bash runs in Claude Code's sandbox when it can start; otherwise one note says so | as `off`; one note if its sandbox may not start (no `bwrap` on Linux) | `--sandbox` is added; one note says agengo cannot check it | one note says there is no sandbox | only a short list |
| `strict` | as `auto`, and a sandbox that cannot start stops the attempt | allowed where its sandbox can start (macOS, Windows, Linux with `bwrap`), otherwise refused | refused: agy ignores `--sandbox` silently when its sandbox is unavailable | refused | only a short list |
With Claude Code, the Builder, Reviewer and verifier get `--settings` with `sandbox.enabled`, `failIfUnavailable` and `allowUnsandboxedCommands: false`, no allowed network hosts, and the deny rules above. Its sandbox lets shell commands write in the worktree and a temporary directory, and `git commit` still works in a worktree because writes to the shared `.git` are allowed (Claude Code keeps `hooks/` and `config` there read-only). It needs `bubblewrap` and `socat` on Linux and WSL2, uses Seatbelt on macOS, and does not exist on native Windows. It covers Bash only: the Read, Edit and Write tools follow permission rules, and it reads most of the machine. `agengo doctor` says whether it is available.
The environment an agent receives in `auto` and `strict` holds `PATH`, `HOME`, locale, temporary-directory, proxy and certificate variables, common toolchain homes (`CARGO_HOME`, `GOPATH`, …), and variables starting with `CLAUDE`, `CODEX`, `ANTIGRAVITY`, `AGY_`, `ANTHROPIC_`, `OPENAI_`, `GEMINI_`, `XDG_` or `LC_`. Tokens such as `GITHUB_TOKEN`, `AWS_*` and `NPM_TOKEN` are left out; list names you need under `sandbox_env:` in `.agengo/config.yaml` (`sandbox_env: [NPM_TOKEN]`). `--auth subscription` still removes API key variables. Codex's own sandbox always applies to the agents agengo starts by name: `read-only` for the roles that only read and `workspace-write` for the Builder, which keeps `.git` read-only and the network closed. Because a worktree's `.git` lies outside the workspace, agengo defaults to `--builder-handoff worktree` with `--agent codex`, so agengo makes the commit.
Plan commands (`setup`, `verify`, …) get the same short list in `auto` and `strict`, without API key variables, so a build or test command does not see the key that pays for the agent; add what they need (for example `NPM_TOKEN`) to `sandbox_env:`. On Linux with `bubblewrap` they also run in a sandbox: the file system is read-only except the worktree, its Git folder, a scratch `/tmp`, `~/.cargo`, `~/.npm`, `~/.cache` and folders listed under `sandbox_write:`; `~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.kube`, `~/.docker`, `~/.azure`, `~/.config/gh`, `~/.config/gcloud`, `~/.netrc` and `~/.git-credentials` are hidden; and `verify`, `final_verify` and the other checks have no network (`setup` keeps it; `sandbox_check_network: true` gives the checks network too). Where that is not possible (macOS, Windows, no `bwrap`), `auto` says so once and runs them as before, and `strict` refuses to run them.
### Claude Code
Without `--agent`, agengo runs `claude -p --output-format json --json-schema … --strict-mcp-config` with the prompts in [specs/prompts](../specs/prompts). Print mode has nobody to approve permission prompts, so permissions are granted per role:
| Role | Tools | Permissions |
|---|---|---|
| plan, specify | Read, Grep, Glob | `default` (read-only) |
| build | Read, Grep, Glob, Edit, Write, Bash | `acceptEdits`, plus `Bash` allowed |
| review | Read, Grep, Glob, Bash | `default`, plus `Bash` allowed |
Prompts can be replaced with `--roles path/roles.yaml` (see [specs/roles.yaml](../specs/roles.yaml); validate with `agengo roles --file ...`).