@giamme/forge 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +29 -12
  4. package/VERSION +1 -1
  5. package/docs/add-ons.md +11 -6
  6. package/docs/artifacts.md +12 -6
  7. package/docs/commands.md +179 -17
  8. package/docs/decomposed-runs.md +13 -5
  9. package/docs/forge-ui.md +7 -3
  10. package/docs/memory.md +2 -1
  11. package/docs/models.md +4 -2
  12. package/docs/reviews.md +49 -20
  13. package/docs/troubleshooting.md +3 -1
  14. package/forge +17 -1
  15. package/package.json +1 -1
  16. package/references/dataset.md +39 -13
  17. package/references/decision-models.md +759 -0
  18. package/references/decompose.md +166 -29
  19. package/references/harnesses.md +10 -3
  20. package/references/planning.md +8 -0
  21. package/references/solo.md +13 -3
  22. package/scripts/forge-artifact.sh +30 -4
  23. package/scripts/forge-config.py +238 -29
  24. package/scripts/forge-contract.py +95 -56
  25. package/scripts/forge-control.py +40 -9
  26. package/scripts/forge-decide.py +6 -0
  27. package/scripts/forge-dispatch.sh +38 -16
  28. package/scripts/forge-fail-first.py +2 -2
  29. package/scripts/forge-gate-addressed.sh +40 -0
  30. package/scripts/forge-gate-message.sh +64 -0
  31. package/scripts/forge-issues.py +321 -33
  32. package/scripts/forge-jev-options.sh +269 -42
  33. package/scripts/forge-lib-attribute.sh +447 -0
  34. package/scripts/forge-lib-gates.sh +32 -0
  35. package/scripts/forge-lib-plans.sh +17 -6
  36. package/scripts/forge-lib-review.sh +22 -17
  37. package/scripts/forge-lib-task.sh +217 -38
  38. package/scripts/forge-lib-verify.sh +45 -8
  39. package/scripts/forge-memory.sh +3 -3
  40. package/scripts/forge-parallel-options.sh +18 -5
  41. package/scripts/forge-parallel.sh +455 -303
  42. package/scripts/forge-plan-check.py +35 -1
  43. package/scripts/forge-pre-review.py +437 -0
  44. package/scripts/forge-prompt.py +25 -5
  45. package/scripts/forge-route.py +2 -2
  46. package/scripts/forge-runtime.py +10 -4
  47. package/scripts/forge-schedule.py +21 -5
  48. package/scripts/forge-shadow.py +2 -2
  49. package/scripts/forge-solo.sh +38 -9
  50. package/scripts/forge-submodules.py +389 -0
  51. package/scripts/forge_dataset/cli.py +12 -6
  52. package/scripts/forge_dataset/export.py +55 -45
  53. package/scripts/forge_dataset/harvest.py +33 -5
  54. package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
  55. package/scripts/forge_decide/__init__.py +141 -0
  56. package/scripts/forge_decide/budget.py +149 -0
  57. package/scripts/forge_decide/cache.py +66 -0
  58. package/scripts/forge_decide/cli.py +953 -0
  59. package/scripts/forge_decide/doctor.py +221 -0
  60. package/scripts/forge_decide/label_addressed.py +75 -0
  61. package/scripts/forge_decide/label_attribution.py +62 -0
  62. package/scripts/forge_decide/label_coverage.py +81 -0
  63. package/scripts/forge_decide/label_message.py +38 -0
  64. package/scripts/forge_decide/label_prompt.py +139 -0
  65. package/scripts/forge_decide/labels.py +328 -0
  66. package/scripts/forge_decide/metrics.py +125 -0
  67. package/scripts/forge_decide/migrate.py +226 -0
  68. package/scripts/forge_decide/providers.py +292 -0
  69. package/scripts/forge_decide/replay.py +350 -0
  70. package/scripts/forge_decide/report.py +382 -0
  71. package/scripts/forge_decide/resolve.py +397 -0
  72. package/scripts/forge_decide/sites.py +377 -0
  73. package/scripts/forge_jev/__init__.py +202 -104
  74. package/scripts/forge_jev/addressed.py +171 -0
  75. package/scripts/forge_jev/attribution.py +198 -0
  76. package/scripts/forge_jev/cli.py +460 -382
  77. package/scripts/forge_jev/client.py +155 -77
  78. package/scripts/forge_jev/coupling.py +19 -87
  79. package/scripts/forge_jev/coverage.py +303 -0
  80. package/scripts/forge_jev/findings.py +219 -0
  81. package/scripts/forge_jev/gates.py +225 -27
  82. package/scripts/forge_jev/memory.py +65 -4
  83. package/scripts/forge_jev/message.py +134 -0
  84. package/scripts/forge_jev/plan_gates.py +294 -0
  85. package/scripts/forge_jev/questions.py +173 -313
  86. package/scripts/forge_jev/verify.py +130 -104
  87. package/ui/README.md +2 -2
  88. package/ui/docs/api.md +60 -32
  89. package/ui/forge_ui/control.py +60 -11
  90. package/ui/forge_ui/export.py +2 -1
  91. package/ui/forge_ui/models.py +1 -0
  92. package/ui/forge_ui/reader.py +87 -14
  93. package/ui/forge_ui/static/app.js +2 -2
  94. package/ui/forge_ui/static/controls.js +20 -13
  95. package/ui/forge_ui/static/panel.js +63 -17
  96. package/ui/forge_ui/static/runmodel.js +23 -1
  97. package/ui/forge_ui/static/scene3d.js +2 -15
  98. package/ui/forge_ui/static/settings.js +336 -41
  99. package/ui/forge_ui/static/style.css +19 -7
  100. package/references/jev.md +0 -865
  101. package/scripts/forge_jev/backtest.py +0 -322
  102. package/scripts/forge_jev/corpus.py +0 -156
  103. package/scripts/forge_jev/features.py +0 -24
  104. package/scripts/forge_jev/predict.py +0 -204
  105. package/scripts/forge_jev/review.py +0 -73
  106. package/scripts/forge_jev/routing.py +0 -271
  107. package/scripts/forge_jev/subset.py +0 -123
package/docs/commands.md CHANGED
@@ -16,13 +16,14 @@ harness (`/forge`); this command installs forge and drives its optional tools.
16
16
  | `forge version [--check]` | the installed version, and whether a newer release is out |
17
17
  | `forge fractal …` | opt-in Fractal execution; see [the command group](fractal.md#forge-fractal-command-group) |
18
18
  | `forge runs [--repo DIR \| --all] [--limit N] [--json]` | this repo's recent runs, newest first: run id, kind, age, task states, verification and final review, goal, and the run dir. Read-only; the same summaries forge-ui shows |
19
- | `forge control show\|set\|pin\|unpin\|drain\|resume\|stop\|retry\|add PLAN_DIR …` | change a live plan: `set` takes `qa-threshold`, `timeout`, `escalate-after`, `escalate-effort` (`on`/`off`), `verify-retries`, `infra-backoff` (a backoff shape; `none` drops it), `retry-budget`, `infra-retries` or `max-parallel` (1-64) (the last three only while a scheduler runs; `--task ID` for `qa-threshold` and `retry-budget`, value `inherit` drops the override); `pin PLAN_DIR TASK SPEC` sets the model the task's next full retry uses once, `unpin` drops it. While a scheduler runs: `drain` starts nothing new until `resume` (a run with nothing left to start ends as usual); `stop [--now]` ends the run once the running tasks finish (`--now` interrupts them; `run` exits 130 without verifying, unless every task had merged by then: it then verifies and exits 0 as usual); `retry PLAN_DIR TASK [--dwarf SPEC]` and `add PLAN_DIR TASK` (a row appended to `tasks.tsv`) queue a request the scheduler applies or refuses. `show` (`--json` for JSON) also says whether the run is drained or stopping and lists its infrastructure pauses. Every change and every request's outcome is logged in `control.log`. Exit 2 invalid input, 3 refused. See [live controls](decomposed-runs.md#changing-a-run-while-it-works) |
20
- | `forge config show [--repo DIR] [--json]` / `forge config set <key> <value> --repo DIR [--json]` / `forge config unset <key> --repo DIR [--json]` | one view of every config source (registry, Jev, the repo's `.forge/verify`, `setup` and `verify-subset`, dataset, `FORGE_*` variables with secrets hidden); `set KEY VALUE` / `unset KEY` edit `repo.verify`, `repo.setup`, `repo.verify-subset` (must contain `{files}`) and, for `set`, `jev.enabled true\|false` (that one does not need `--repo`). `-` as a value reads stdin. Exit 2 on invalid input |
19
+ | `forge control show\|set\|pin\|unpin\|drain\|resume\|stop\|retry\|add PLAN_DIR …` | change a live plan: `set` takes `qa-threshold` (`P0`..`P3`, `none` or `default` for the plan, `inherit` per task), `timeout`, `escalate-after`, `escalate-effort` (`on`/`off`), `verify-retries`, `infra-backoff` (a backoff shape; `none` drops it), `pre-review-tests` (`on`/`off`), `pre-review-parallel` (1-64), `retry-budget`, `infra-retries` or `max-parallel` (1-64) (the last three only while a scheduler runs; `--task ID` for `qa-threshold` and `retry-budget`, value `inherit` drops the override); `pin PLAN_DIR TASK SPEC` sets the model the task's next full retry uses once, `unpin` drops it. While a scheduler runs: `drain` starts nothing new until `resume` (a run with nothing left to start ends as usual); `stop [--now]` ends the run once the running tasks finish (`--now` interrupts them; `run` exits 130 without verifying, unless every task had merged by then: it then verifies and exits 0 as usual); `retry PLAN_DIR TASK [--dwarf SPEC]` and `add PLAN_DIR TASK` (a row appended to `tasks.tsv`) queue a request the scheduler applies or refuses. `show` (`--json` for JSON) also says whether the run is drained or stopping and lists its infrastructure pauses. Every change and every request's outcome is logged in `control.log`. Exit 2 invalid input, 3 refused. See [live controls](decomposed-runs.md#changing-a-run-while-it-works) |
20
+ | `forge config show [--repo DIR] [--json]` / `forge config set <key> <value> [--repo DIR] [--json]` / `forge config unset <key> [--repo DIR] [--json]` | one view of every config source (registry, the legacy Jev file, decide, the repo's `.forge/verify`, `setup` and `verify-subset`, dataset, `FORGE_*` variables with secrets hidden); `set` / `unset` edit `repo.verify`, `repo.setup`, `repo.verify-subset` (must contain `{files}` or `{changed}`; `--repo` required) and `decide.gate.<gate>`, `decide.gate.<gate>.provider`, `decide.gate.<gate>.model` (`off`, `shadow` or `on`; those write the user level and do not need `--repo`). Unset of a `decide.gate.*` key is refused: set the mode to `off`. `-` as a value reads stdin for the per-repo files. Exit 2 on invalid input |
21
21
  | `forge runs rm RUN_DIR [--dry-run] [--yes] [--no-archive] [--worktrees] [--branches] [--json]` | delete a run directory but keep what it taught the dataset; see [below](#forge-runs-rm) |
22
22
  | `forge issues RUN [--apply] …` | file the review findings a run left open as GitHub issues; see [below](#forge-issues) |
23
23
  | `forge ui open\|status\|stop` | forge-ui, the run viewer; see [the command group](forge-ui.md#forge-ui-command-group) |
24
24
  | `forge dataset …` | every run's inputs and outcomes; see [run dataset](dataset.md) |
25
- | `forge jev …` | optional Jev advice: setup, status, doctor, enable, disable, backtest; see [Jev](add-ons.md#jev) |
25
+ | `forge decide …` | decision-model gates, providers, budgets and the privacy floor; see [below](#forge-decide) |
26
+ | `forge jev …` | deprecated alias of the old decision-model commands, kept for one release; see [below](#forge-decide) |
26
27
  | `forge --help` | list the commands; `forge <command> --help` shows each one's options |
27
28
 
28
29
  ### `forge runs rm`
@@ -52,7 +53,7 @@ deletion or the run directory was kept (the same command finishes the job).
52
53
 
53
54
  `forge issues <plan dir, task dir, review dir, known_issues.md or qa.last>` drafts one GitHub
54
55
  issue per finding the run left open (`--group task|run` for fewer) and files them only with
55
- `--apply`. The findings are the CONFIRMED ones `--qa-threshold` tolerated (origin
56
+ `--apply`. The findings are the CONFIRMED ones the threshold tolerated (origin
56
57
  `tolerated`), the CONFIRMED ones a person accepted with `accept` (origin `accepted`, with
57
58
  their own issue text: a person accepted the work over the reviewer's verdict), PLAUSIBLE
58
59
  ones with `--include-plausible`, and what the whole-run review left open. A whole-run
@@ -76,6 +77,50 @@ repository lock from the issue lookup to the last `gh issue create`, and each di
76
77
  around its write. A busy lock is retried for 10 s, then exit 3. Exit 0 ok, 2 usage or a `gh` or
77
78
  dismissal-store error, 3 busy.
78
79
 
80
+ ### `forge decide`
81
+
82
+ Per-gate decision models. The setup — precedence, what each gate does, budgets, the privacy
83
+ floor and migration — is in [Decision models](../references/decision-models.md#setup). How a
84
+ gate is measured before it turns on (labels, `report`, `replay`, the promotion rule and the
85
+ request cache) is in [Measuring a gate](../references/decision-models.md#measuring-a-gate).
86
+
87
+ | Command | Does |
88
+ |---|---|
89
+ | `status [--repo DIR] [--json]` | each gate's effective mode and which level set it, providers (`present` or `missing` key), caps and today's spend, privacy floor. A gate that is `on` without a passing replay is shown as `forced`. Never writes |
90
+ | `gate GATE off\|shadow\|on [--force] [--provider P] [--model M] [--profile NAME \| --repo DIR]` | set one gate. Gates: `drift`, `forward`, `prompt`, `coverage`, `retry-addressed`, `dwarf-message`, `attribution`, `findings`, `memory-curate`, `memory-slice`, `memory-stale`, `verify-discover` (what each does when `on`: [Gates and modes](../references/decision-models.md#gates-and-modes)). With no `--provider`, a gate uses the legacy transport (`jev.json`'s endpoint with `TYPESAFE_API_KEY` or `jev.json`'s key, or Cloudflare for a site `jev.json` maps there); name a provider to choose where requests go. Without `--repo`, writes the user file and migrates `jev.json` first. `--profile` writes that profile in the user file. `on` needs a passing replay for the provider and model it resolves to, else it is refused (exit 3). `--force` turns it on anyway, and it shows as forced (see [measuring a gate](../references/decision-models.md#promotion)) |
91
+ | `provider add jev\|clef --name N [--url U] [--account-id A] [--model M] [--context N] [--price X] [--deadline S] [--local] [--key-stdin \| --key-env VAR]` | add a hosted or local provider. A key is never an argument: one line on stdin or a terminal prompt is written to `keys/<N>.key` mode `0600`, or `--key-env VAR` stores the variable name and reads it at request time |
92
+ | `provider list [--json]` | configured providers |
93
+ | `provider rm N` | remove a provider no gate uses, and the `keys/<N>.key` it wrote |
94
+ | `budget [--run tokens=N,usd=X] [--daily tokens=N,usd=X] [--repo DIR]` | show the caps and today's spend, or set them. `--daily` is user-level; a repo file takes only `--run`. `none` clears a cap |
95
+ | `privacy never-send\|allow --repo DIR` | set or remove that repo's privacy floor. `never-send` turns every gate off for that repo and beats every other level |
96
+ | `doctor [--live] [--json] [--repo DIR]` | stale settings. Exit 1 on a problem. `--live` probes each provider unless the privacy floor is on |
97
+ | `migrate [--force] [--json]` | copy `jev.json` into the user `decide.json`, once. `--force` replaces that file from `jev.json` again |
98
+ | `report [--runs N] [--run DIR]... [--site S] [--all] [--json]` | per site, over the newest N runs of this repo (default 10; `--run` names directories, `--all` reads every repo): calls, cache hits, errors, skips, tokens, cost, and how often the gate fired and was right on the free labels. Read-only, asks no model. See [measuring a gate](../references/decision-models.md#forge-decide-report) |
99
+ | `replay --site S --provider P --model M [--runs N] [--send] [--workers 3] [--seed 7] [--margin 0.02] [--json]` | re-asks the site's labelled requests on provider P and model M. Without `--send` it is a dry run that sends nothing; with it, it asks the unanswered requests, judges the answers on the newer half of the runs, and records the result that `gate on` reads. Charged to no budget. See [measuring a gate](../references/decision-models.md#forge-decide-replay) |
100
+
101
+ `--repo` defaults to `FORGE_DECIDE_REPO`, else the git top level. Exit 0 ok, 2 usage, 1 a
102
+ failed doctor check or a config file that cannot be read, 3 a refused `gate on`.
103
+ `forge config set` writes the same user-level gate fields as `decide.gate.<gate>`, `decide.gate.<gate>.provider` and
104
+ `decide.gate.<gate>.model`.
105
+
106
+ A write to the user file migrates `jev.json` first: `gate` without `--repo`, `provider add`,
107
+ `provider rm`, and `budget` when `--run` or `--daily` changes the user file. `provider list`,
108
+ a bare `budget`, `status` and `doctor` do not.
109
+
110
+ `forge jev` is the deprecated alias, kept for one release. `setup`, `sites`, `enable`,
111
+ `disable`, `status` and `doctor` print the `forge decide` command and then run the old one.
112
+
113
+ Run flags, on `forge-solo.sh` and `forge-parallel.sh plan`, are frozen in `jev-selection.json`.
114
+ A re-plan replaces the file. Solo again on the same run dir keeps it. When the file exists,
115
+ `run` and `retry` keep it and say so when flags are passed again. A plan with no selection
116
+ file takes the flags on `run` or `retry` and freezes them then.
117
+
118
+ | Flag | Does |
119
+ |---|---|
120
+ | `--gate NAME=MODE[,NAME=MODE...]` | set those gates `off`, `shadow` or `on` for this run. Repeatable; a later one wins for the same gate |
121
+ | `--no-gates` | every gate off: no decision-model request |
122
+ | `--decide-budget tokens=N[,usd=X]` | cap this run's decision-model tokens, and optionally USD. Does not change the daily cap |
123
+
79
124
  ## The `/forge` slash command
80
125
 
81
126
  ```
@@ -83,7 +128,9 @@ dismissal-store error, 3 busy.
83
128
  [--qa <alias>[:<effort>[:<harness>]]]
84
129
  [--planner <alias>[:<effort>[:<harness>]]]
85
130
  [--yolo-dwarf] [--yolo-qa] [--repo <dir>] [--native-review]
86
- [--no-memory] [--timeout <seconds>] [--ui | --no-ui] [--fractal | --no-fractal]
131
+ [--no-memory] [--gate NAME=MODE[,...]] [--no-gates]
132
+ [--decide-budget tokens=N[,usd=X]]
133
+ [--timeout <seconds>] [--ui | --no-ui] [--fractal | --no-fractal]
87
134
  [--fractal-auto-decompose] [--fractal-planner <spec>]
88
135
  [--fractal-depth <n>] [--fractal-children <n>] [--fractal-nodes <n>]
89
136
  [--fractal-iterations <n>] [--fractal-concurrency <n>] [--fractal-deadline <s>]
@@ -95,9 +142,12 @@ dismissal-store error, 3 busy.
95
142
  | Flag | Default | Meaning |
96
143
  |---|---|---|
97
144
  | `--dwarf <spec>` | *asks* | the model that implements the change |
98
- | `--qa <spec>` | `opus` at `xhigh` | the model that reviews the dwarf's diff |
145
+ | `--qa <spec>` | `opus` at `high` | the model that reviews the dwarf's diff |
99
146
  | `--planner <spec>` | orchestrator plans | dispatch planning to a model; one dispatch per run, effort defaults to `xhigh` |
100
147
  | `--no-memory` | memory on | write and inject nothing in `.forge/` |
148
+ | `--gate NAME=MODE` | the configured gates | set decision-model gates for this run (`off`, `shadow` or `on`); repeatable, a later one wins. Frozen in `jev-selection.json`. See [`forge decide`](#forge-decide) |
149
+ | `--no-gates` | gates as configured | every decision-model gate off for this run |
150
+ | `--decide-budget tokens=N[,usd=X]` | the configured cap | cap this run's decision-model spend |
101
151
  | `--timeout <s>` | `2700` (45m) | kill any single dispatch that runs longer. `0` disables |
102
152
  | `--yolo-dwarf` | off | drop the dwarf's sandbox and approval gates |
103
153
  | `--yolo-qa` | off | drop the reviewer's sandbox |
@@ -221,8 +271,8 @@ failure. On `8`, `<run-dir>/<role>.infra` holds `class=`, `retry_after=`, `detai
221
271
  and disables the watchdog), then the optional fifth `timeout` column of the model's
222
272
  [registry](models.md#model-registry) row, then the built-in `2700` (45 min). A value that was *not*
223
273
  explicit is scaled by the resolved (post-clamp) effort: up to `high` ×1, `xhigh` ×4/3,
224
- `max`/`ultra`/`ultracode` ×2. QA and planner default to `xhigh`, so their built-in limit is
225
- 3600 s; dwarves default to `medium` and keep 2700 s. `<role>.resolved` records `timeout=` and
274
+ `max`/`ultra`/`ultracode` ×2. The planner defaults to `xhigh`, so its built-in limit is 3600 s;
275
+ QA defaults to `high` and dwarves to `medium`, and both keep 2700 s. `<role>.resolved` records `timeout=` and
226
276
  `timeout_source=` (`explicit`, `env`, `registry` or `default`, plus `+effort-scaled`).
227
277
  `forge-parallel.sh run`/`retry --timeout S` sets it for a decomposed run (kept in the plan).
228
278
  `FORGE_REGISTRY` points the dispatcher at an alternative registry file.
@@ -264,11 +314,14 @@ capture, the QA dispatch, and the ledger writes.
264
314
  forge-solo.sh <run-dir> --repo <dir> --dwarf <spec> [--qa <spec>]
265
315
  [--approach <file>] [--yolo-dwarf] [--yolo-qa]
266
316
  [--native-review] [--no-memory] [--timeout <s>] [--dry-run] [--ui | --no-ui]
267
- [--fail-first]
317
+ [--gate NAME=MODE[,...]] [--no-gates] [--decide-budget tokens=N[,usd=X]]
318
+ [--fail-first] [--qa-threshold P0|P1|P2|P3|none]
268
319
  [--fractal | --no-fractal] [--fractal-<limit> <n>]
269
320
  [--dwarf-low <pool>] [--dwarf-medium <pool>] [--dwarf-high <pool>] [--retry]
270
321
  ```
271
322
 
323
+ `--qa-threshold` sets the blocking level for this run: `P0`..`P3`, or `none` (P3); the default is `P2`. The gate's decision is in `qa.gate` and the tolerated findings are in `known_issues.md`. See [the verdict rule](reviews.md#verdicts-and-failure).
324
+
272
325
  You write two files into the run directory; forge does the rest:
273
326
 
274
327
  | You write | Is |
@@ -333,25 +386,31 @@ Bash 3.2 entrypoints use a Python standard-library coordinator to schedule eligi
333
386
 
334
387
  ```
335
388
  forge-parallel.sh plan <plan-dir> --repo <dir> [routing flags] [--planner <spec>] [--no-memory]
389
+ [--gate NAME=MODE[,...]] [--no-gates] [--decide-budget tokens=N[,usd=X]]
336
390
  [--decompose-level L] [--shadow-qa <spec>[,..]|none] [--shadow-rate R]
337
391
  [--reviewer-session | --no-reviewer-session]
392
+ [--implementer-session | --no-implementer-session]
338
393
  [--explore E] [--ui | --no-ui] [--fail-first | --no-fail-first]
394
+ [--pre-review-tests | --no-pre-review-tests] [--pre-review-parallel N]
395
+ [--qa-threshold P0|P1|P2|P3|none|default]
339
396
  forge-parallel.sh run <plan-dir> [--max-parallel N] [--yolo-dwarf] [--yolo-qa] [--dry-run]
340
397
  [--verify <cmd> | --verify-lane 'name[opts]=cmd' ...]
341
398
  [--verify-parallel N] [--setup <cmd>] [--timeout S]
342
399
  [--retry-failed N] [--infra-retries M] [--infra-backoff SHAPE]
343
400
  [--infra-fallback | --no-infra-fallback]
344
- [--qa-threshold P0|P1|P2|P3|none] [--verify-retries N]
401
+ [--qa-threshold P0|P1|P2|P3|none|default] [--verify-retries N]
345
402
  [--escalate-after N] [--escalate-effort | --no-escalate-effort]
346
403
  [--sweep P0|P1|P2|P3 [--sweep-plausible] [--sweep-max N]]
347
- [--sweep-ahead | --no-sweep-ahead]
404
+ [--sweep-ahead | --no-sweep-ahead] [--attribute | --no-attribute]
348
405
  [--fractal | --no-fractal] [--fractal-<limit> <n>]
349
- forge-parallel.sh retry <plan-dir> <task-id> [--dwarf <spec>] [--timeout S]
350
- [--qa-threshold Pn|none] [--verify-retries N]
406
+ forge-parallel.sh retry <plan-dir> <task-id> [--dwarf <spec>] [--answer <text> | --answer-file <file>]
407
+ [--timeout S]
408
+ [--qa-threshold P0|P1|P2|P3|none|default] [--verify-retries N]
351
409
  [--verify <cmd> | --verify-lane 'name[opts]=cmd' ...] [--verify-parallel N]
352
410
  [--escalate-after N] [--escalate-effort | --no-escalate-effort]
353
411
  forge-parallel.sh accept <plan-dir> <task-id> --reason "<why>" --approved
354
- forge-parallel.sh review <plan-dir> [--qa <spec>] [--yolo-qa] [--qa-threshold Pn]
412
+ forge-parallel.sh review <plan-dir> [--qa <spec>] [--yolo-qa] [--qa-threshold P0|P1|P2|P3|none|default]
413
+ forge-parallel.sh attribute <plan-dir> [--force]
355
414
  forge-parallel.sh integrate <plan-dir> --approved [--final-review <qa-spec>] [--verify-retries N]
356
415
  [--verify-parallel N]
357
416
  forge-parallel.sh split <plan-dir> <new-plan-dir> --tasks <id,id> [--dry-run]
@@ -362,7 +421,8 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
362
421
  |---|---|
363
422
  | `plan` | validate `tasks.tsv`, resolve difficulty → concrete dwarf/qa specs, compute waves, render the approval table |
364
423
  | `run` | schedule ready tasks; per task: worktree → dwarf → diff → QA → status; merge passing tasks onto the integration branch |
365
- | `retry` | re-run **one** failed task in the worktree it already has, with its reviewer's findings in the prompt |
424
+ | `retry` | re-run **one** failed task in the worktree it already has, with its reviewer's findings in the prompt; with `--answer` or `--answer-file`, answer a `NEEDS_INPUT` task's question and run it |
425
+ | `attribute` | after a failed combined verification, search the merge order for **a merge that breaks it**; merges, revises and accepts nothing. See below |
366
426
  | `integrate` | **never automatic** — merge the integration branch into your branch |
367
427
  | `accept` | **only on your explicit instruction** — merge a `FAIL`/`UNKNOWN` task's reviewed work anyway, recording why |
368
428
  | `review` | **opt-in, spends QA quota** — one reviewer reads the whole combined result; read-only |
@@ -370,31 +430,133 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
370
430
 
371
431
  | Flag | Subcommands | Remembered in the plan | Means |
372
432
  |---|---|---|---|
433
+ | `--gate NAME=MODE[,NAME=MODE...]` | plan | `jev-selection.json` | set decision-model gates for this run; repeatable, a later one wins. When the file exists, `run` and `retry` keep it; with no file they apply the flags passed then and freeze them |
434
+ | `--no-gates` | plan | `jev-selection.json` | every decision-model gate off |
435
+ | `--decide-budget tokens=N[,usd=X]` | plan | `jev-selection.json` | cap this run's decision-model spend |
436
+ | `--answer TEXT` / `--answer-file F` | retry | no — this retry only | the user's answer to a `NEEDS_INPUT` task's question (`tasks/<id>/needs_input.md`), written to `answer.md`; on any other status `retry` exits `2` |
373
437
  | `--timeout S` | run, retry | `timeout` | per-dispatch timeout in seconds (`0` disables); wins over `FORGE_TIMEOUT` |
374
438
  | `--retry-failed N` | run | no — this run only | re-queue a task the reviewer rejected up to `N` more times inside the run |
375
439
  | `--infra-retries M` | run | no — this run only | wait out up to `M` infrastructure stops per paused scope (a model, a harness, or everything) instead of ending the run |
376
440
  | `--infra-backoff SHAPE` | run | `infra_backoff` | the waits between those stops when the provider gave no retry-after: `exp:B[,C]`, `linear:S,T[,C]` or `list:a,b,...` in seconds (default `exp:60`) |
377
441
  | `--infra-fallback` | run | `infra_fallback` | a dwarf stopped by a rate limit moves to the next healthy model of its tier pool instead of waiting (off by default; `--no-infra-fallback` turns it off) |
378
- | `--qa-threshold Pn` | run, retry | `qa_threshold` | least severe finding that still blocks; milder ones become known issues; `none` clears |
442
+ | `--qa-threshold P0\|P1\|P2\|P3\|none\|default` | plan, run, retry, review | `qa_threshold` | the least severe CONFIRMED finding that still blocks (default `P2`); milder ones become known issues; `none` means P3, `default` removes the setting. Solo takes `P0`..`P3` or `none`. See [the verdict rule](reviews.md#verdicts-and-failure) |
379
443
  | `--verify-retries N` | run, retry, integrate | `verify_retries` | reruns of a failed verify command, or of each failed lane (default `1`, `0` = strict single run) |
380
444
  | `--verify-lane 'name[opts]=cmd'` | run, retry | `verify.d/<name>` | one verification lane; repeatable. Options as in a lane file, comma-separated (`group=g`, `first`, `retries=n`, `reports=dir`, `baseline=file`). The first one of an invocation replaces the plan's earlier lanes and `--verify`; see [verification lanes](../references/decompose.md#execution-checks-and-integration-verification) |
381
445
  | `--verify-parallel N` | run, retry, integrate | `verify_parallel` | lanes run at once, 1 to 32 (default `3`) |
382
446
  | `--escalate-after N` | run, retry | `escalate_after` | failed attempts on one model before the next goes a tier up (default `3`, `0` = off) |
447
+ | `--pre-review-tests` | plan | `pre_review_tests` | before each review, run only the tests the attempt affects; a red attempt goes back to its implementer unreviewed (off by default; `--no-pre-review-tests` turns it off). See [pre-review tests](../references/decompose.md#pre-review-tests-opt-in) |
448
+ | `--pre-review-parallel N` | plan | `pre_review_parallel` | how many of those checks run at once across tasks, 1 to 64 (default `2`) |
383
449
  | `--sweep Pn` | run | no — this run only | once every task has merged, fix the open findings at `Pn` or worse in a few extra tasks, one per file, each with a narrow review; the plan goes to `sweep/plan.md`. Once per plan; what it does not fix stays for `forge issues`. See [the finding sweep](reviews.md#fixing-them-in-the-run-the-finding-sweep-opt-in) |
384
450
  | `--sweep-plausible` | run | no — this run only | the sweep also takes PLAUSIBLE findings of passed tasks |
385
451
  | `--sweep-max N` | run | no — this run only | at most `N` fix tasks (default `5`) |
386
452
  | `--sweep-ahead` | run | `sweep_ahead` | a task is also told the open findings in files it owns, to fix on its way (off by default; `--no-sweep-ahead` turns it off) |
453
+ | `--attribute` | run | `attribute_on` | when the run's combined verification fails, search the merge order for a merge that breaks it, right after the failure is reported (off by default; `--no-attribute` turns it off). Without it the summary says how to run `attribute` later |
387
454
  | `--escalate-effort` | run, retry | `escalate_effort` | at the top tier, retry the same model once more at its next accepted effort before stopping (off by default; `--no-escalate-effort` turns it off) |
388
455
 
389
456
  **Exit codes:** `0` ok · `2` usage or validation · `3` precondition (not a git repo, …) ·
390
- `5` some task failed QA, or the combined verification failed · `6` integration conflict ·
457
+ `4` **`plan` only: the plan gates sent work back** (see below) ·
458
+ `5` some task failed QA, the combined verification failed, or a task is still waiting for an
459
+ answer · `6` integration conflict ·
391
460
  `8` **paused on an infrastructure failure** (quota, auth, rate limit, network): no attempt was
392
461
  spent and nothing was judged — fix the cause and run the same command again ·
393
462
  `130` **interrupted or stopped** (a signal, or `forge control stop`): the running tasks are
394
463
  `INTERRUPTED` and verification was skipped or stopped; the summary prints the `retry` for each.
395
464
 
465
+ **`plan` and the plan-time gates.** With the `prompt` or `coverage` gate `on`, `plan` may send work
466
+ back and exits `4` before it validates the tasks or prints the table. It writes `plan.sendback.md`,
467
+ listing the task prompts a reviewer could not judge, and the requirements of `request.md` (the first
468
+ 30 with at least four words) that no task's `## Acceptance criteria` covers. Rewrite what the file
469
+ lists (a prompt, a task's criteria, or a new task), then run `plan` again. An item goes back at most
470
+ once, keyed by its task id (prompts) or its requirement (coverage). What is still flagged from that
471
+ list is printed in a `decision-model gates:` block under the table and is not sent back again. An
472
+ item the first list did not name, such as a new task whose prompt is flagged, is sent back in its
473
+ own round, so the second `plan` can exit `4` again; no item goes back twice. `drift`
474
+ and `forward`, when `on`, act without exiting: they add a predicted file to a task's `files`, or
475
+ make a task depend on a later one, and the block says what they added. In `shadow` they change
476
+ `tasks.tsv` and `waves.tsv` not at all, and their predictions go to `plan-gates.json` as `would_add`.
477
+
478
+ **`attribute`** answers the question a failed combined verification leaves open: every task passed
479
+ its own review, so which merge broke the whole? It verifies *prefixes* of the merge order in a
480
+ scratch worktree (`<worktree root>/_attribute`, detached at the prefix commit, after the plan's
481
+ setup command): prefix 0 is the integration base, prefix `n` the tip. The tip is known to fail
482
+ from the run itself; the search verifies the base and then halves the interval until it has a
483
+ merge `k` whose prefix `k − 1` verified PASS and whose prefix `k` verified FAIL. Verification is an
484
+ arbitrary command, so failure need not be monotonic over the merges: this is *a* merge that breaks
485
+ verification, not necessarily the earliest. Each step runs the verification the run used, frozen:
486
+ the lanes in `verification.lanes.d/` or the command in `verification.command`, never a config
487
+ changed since and never discovery. A run that recorded neither is inconclusive unless `--force`,
488
+ which uses today's source. On this repo one verification takes about 10 minutes, so a search of
489
+ `n` merges costs `1 + ⌈log₂ n⌉` of them.
490
+
491
+ It takes the plan lock like `retry`, so a second `attribute`, or one started while a run holds the
492
+ plan, is refused. It refuses (exit `2`) a plan whose `verification.status` is not `FAIL` and one
493
+ whose `verification.commit` is not `accepted.integration`, the commit being searched; `--force`
494
+ skips both checks and verifies the tip itself (a passing tip is inconclusive). A step that ends
495
+ `UNVERIFIED`, is interrupted or whose setup fails ends the search inconclusive with no culprit.
496
+
497
+ With the `attribution` gate `on` (see [`forge decide`](#forge-decide)), the search first asks the
498
+ decision model which merged task most likely broke the run, from the end of the failing log and
499
+ each merge's diff. It verifies that task's boundary first, prefix `k − 1` then prefix `k`: a
500
+ pass-then-fail pair settles it (`outcome: "confirmed"`), and otherwise the answer narrows the bounds
501
+ and the binary search goes on (`"refuted"`). In `shadow` the ranking is recorded and the binary
502
+ search alone decides. The gate only chooses which boundary to verify first; it never decides the
503
+ result.
504
+
505
+ It writes `attribution.json` (`culprit`, `base_fails`, `inconclusive`, `merges`, `steps` of
506
+ `{prefix, commit, status, seconds, source}`, `verification_runs`, `gate`), each step's output in
507
+ `attribute/<prefix>-<sha>/`, the failing log's last 200 lines in `tasks/<culprit>/verification.md`,
508
+ and an `attribution` event in the [run dataset](dataset.md). It prints one line,
509
+ `integration failure: merge <id> breaks verification (prefix k−1 passes, k fails; M verification
510
+ runs)`, or the variant `the base already fails verification` or `attribution inconclusive — <reason>`.
511
+ When the gate's first guess is the merge that was confirmed, the line ends `(the decision model's first guess)`.
512
+ Exit `0` when the search finished, culprit or not, `1` when a step could not run at all.
513
+
514
+ **`NEEDS_INPUT`** is a task status that is not a failure: the implementer ended with a question
515
+ only the user can answer, kept in `tasks/<id>/needs_input.md`. The run summary lists it under
516
+ `waiting for your answer:` with the first line of the question and the command to answer it, and
517
+ the retry hint does not count it as failed. Its dependents end `BLOCKED`, and neither a later
518
+ `run`, `--retry-failed` nor `forge control retry` resumes it. Only
519
+ `retry <plan> <id> --answer "<text>"` (or `--answer-file F`) does: the question and the answer
520
+ join the findings of the next attempt, a normal new attempt. Without an answer, or with one older
521
+ than the question, `retry` exits `2` and changes nothing; if escalation refuses the retry, the
522
+ question and the answer stay for the same `--answer` to be tried again. A run that ends with such a
523
+ task unmerged exits `5`, as it does for a task that failed. Only the `dwarf-message` gate, when `on`,
524
+ sets this status.
525
+
396
526
  The full plan → run → integrate walkthrough is in [decomposed runs](decomposed-runs.md#plan-run-integrate). `retry`, `accept` and `review` are covered in [reviews, retries and recovery](reviews.md); resuming, `split`/`combine`, scope drift and `tasks.tsv` in [decomposed runs](decomposed-runs.md).
397
527
 
528
+ ## `scripts/forge-jev.py`
529
+
530
+ The verbs the decision-model gates run. A person turns gates on with `forge decide`; the shell
531
+ calls these verbs, one per gate question. The `forge jev` verbs `setup`, `sites`, `enable`,
532
+ `disable`, `status` and `doctor` are the old names of `forge decide` commands and are not listed.
533
+
534
+ ```
535
+ forge-jev.py score-plan --plan P --repo R [--json] prompt adequacy and drift, per task
536
+ forge-jev.py coupling --plan P --repo R [--json] forward dependencies, per warned pair
537
+ forge-jev.py coverage --plan P --repo R [--json] requirements no task covers
538
+ forge-jev.py retry-addressed --plan P --task T --attempt N --repo R
539
+ forge-jev.py dwarf-message --plan P --task T --attempt N --repo R
540
+ forge-jev.py attribution --plan P --repo R --log L the merged tasks, most likely culprit first
541
+ forge-jev.py findings --repo R --input F [--run-dir D]
542
+ forge-jev.py verify-discover --repo R [--json] [--run-dir D]
543
+ forge-jev.py memory-curate --repo R --category C --text T [--json] [--run-dir D]
544
+ forge-jev.py memory-slice --task T --lines F [--keep N] [--run-dir D]
545
+ forge-jev.py memory-stale --text T --anchor A [--run-dir D]
546
+ ```
547
+
548
+ The verbs `coverage`, `retry-addressed`, `dwarf-message`, `attribution` and `findings` check their
549
+ paths first: `--plan`, `--repo` and `--run-dir` must be directories, and `--log` and `--input`
550
+ files, for the verbs that take them, else the verb exits `2`. Exit `3` is no opinion: the gate is
551
+ off or in `shadow`, there is nothing to ask, or the model did not answer. A failed request is never a verdict. The rows the
552
+ shell reads, one per item:
553
+
554
+ - `coverage`: `r<i>`, the probability, and the requirement, for each uncovered requirement at or above `coverage_warn`.
555
+ - `retry-addressed`: `u<i>`, the probability, and the finding, for each finding at or above `untouched_warn`.
556
+ - `dwarf-message`: the first of `question`, `blocked`, `unfinished` that fires, as `<which>` and its probability; otherwise `ok` and the highest probability.
557
+ - `attribution`: `<id>` and its probability, highest first, `none` included.
558
+ - `findings`: a JSON list in input order, `[{"fp", "duplicate_of", "dup_p", "concrete"}]`. `--input` is a JSON object `{"findings": [...], "candidates": [...]}`; `--run-dir` is the plan the findings came from, for the dataset and the request cache.
559
+
398
560
  ## `scripts/forge-verify.py`
399
561
 
400
562
  The verification lane runner `run`, `retry` and `integrate` use when lanes are declared. You can
@@ -48,7 +48,13 @@ exist yet. Naming a dwarf per task would mean guessing how the goal will split.
48
48
  ```
49
49
 
50
50
  `--qa`, `--qa-high`, `--qa-medium`, `--qa-low` mirror it exactly. QA has no tier rules by
51
- default and falls back to `opus`.
51
+ default and falls back to `opus` (at `high`). Sizing the reviewer to the task's risk costs less
52
+ for the same verdicts: the SWE-bench Pro benchmark (#89) saw no false PASS from Sonnet reviewers,
53
+ at about a seventh of an `opus:xhigh` review's cost. A set to start from:
54
+
55
+ ```bash
56
+ --qa-low sonnet:medium --qa-medium sonnet:high --qa-high opus:high
57
+ ```
52
58
 
53
59
  Resolution order per task: **explicit column value → the tier's rule → plain `--dwarf` →
54
60
  `UNASSIGNED`**. An `UNASSIGNED` task makes `plan` exit `2` and `run` refuse outright. forge
@@ -100,7 +106,9 @@ that baseline, and QA sees only baseline membership recorded for that task.
100
106
 
101
107
  Every dispatch is a **clean slate** — forge never passes `--continue`, `--resume`, or
102
108
  `codex exec resume`, except the opt-in `plan --reviewer-session` experiment (it continues
103
- a reviewer's session across rounds on claude, openclaude and codex). One task's confused
109
+ a reviewer's session across rounds on claude, openclaude and codex) and the opt-in
110
+ `plan --implementer-session` (a retry continues its implementer's session on claude and
111
+ openclaude when the work is as the review left it). One task's confused
104
112
  turn can't poison another, and each task's context stays small.
105
113
 
106
114
  Clean slates alone would leave every dwarf blind to the wider run, so a short `capsule.md` is
@@ -222,7 +230,7 @@ belong to that pool. See [recovery](../references/fractal.md#limits-and-lifecycl
222
230
 
223
231
  ```bash
224
232
  forge control show <plan-dir> [--json] # every control, per-task overrides, pins, recent changes
225
- forge control set <plan-dir> qa-threshold P2 # also --task <id>; P0-P3, none, or inherit (task only)
233
+ forge control set <plan-dir> qa-threshold P2 # also --task <id>; P0-P3, none (P3), default (plan only; P2) or inherit (task only)
226
234
  forge control set <plan-dir> retry-budget 3 [--task <id>] # automatic retries; live scheduler only
227
235
  forge control set <plan-dir> infra-retries 2 # infrastructure waits per scope; live scheduler only
228
236
  forge control set <plan-dir> max-parallel 2 # tasks at once, 1-64; live scheduler only
@@ -257,8 +265,8 @@ Each change is validated, written under `control.lock`, and says when it applies
257
265
 
258
266
  - **The QA threshold is read once per attempt**, at the start of the task's next attempt; the
259
267
  attempt already running keeps the one it began with, so a verdict is never judged by a bar that
260
- moved under it. A per-task `none` exempts that task from the plan's threshold; `inherit` drops
261
- the override. A plan-level `none` clears the threshold.
268
+ moved under it. A `none` (P3) exempts that task from a looser plan threshold; `inherit` drops
269
+ the override. A plan-level `default` removes the setting, so the threshold is P2 again.
262
270
  - **Budgets stay "per invocation".** `run --retry-failed N` and `--infra-retries M` still apply
263
271
  only to the invocation that was given them and are not remembered; the next `run` starts
264
272
  from its own flags. A rule that came back from an old file would silently spend money nobody
package/docs/forge-ui.md CHANGED
@@ -74,7 +74,7 @@ is. A running task names the dwarf or reviewer at work, the command it is runnin
74
74
  it is a test, type check, lint or build) and for how long, and flags *quiet N min* once its log
75
75
  has said nothing for five minutes. A task that is not running says why: the tasks it waits on, a
76
76
  running task it shares files with, no free slot, a drain or stop, an infrastructure pause with
77
- its countdown, or the retry policy's stop with the split it suggests. The run's inspector says
77
+ its countdown, or the retry policy's stop with the split it proposes. The run's inspector says
78
78
  what the scheduler is doing and how many tasks wait on what.
79
79
 
80
80
  Under each attempt's dwarf and reviewer are the checks they ran, read from their logs: each
@@ -94,6 +94,8 @@ its review said (fixed, not fixed, not reported), and links each to the task it
94
94
  shows which of its findings the sweep took and where they stand. The run's *Finish* says how many
95
95
  the sweep fixed and lists what it left for `forge issues`, with each reason.
96
96
 
97
+ A review the reviewer passed but forge failed, because it listed a blocking CONFIRMED finding, shows a red `forge: FAIL (reviewer said PASS)` chip in the *Review findings* section.
98
+
97
99
  ### Controls
98
100
 
99
101
  forge-ui reads everything, and it changes things only by calling forge's own commands: it
@@ -102,14 +104,16 @@ locks, the audit log) whichever way you change something, and a change from the
102
104
  indistinguishable from the same command typed in a terminal, except that `control.log` says
103
105
  `ui` instead of `cli`. Every change asks you to confirm and says when it takes effect.
104
106
 
105
- - **Run controls** (a plan's inspector): the QA threshold, the per-attempt timeout, how many
107
+ - **Run controls** (a plan's inspector): the QA threshold (shown with its source, `P2 (default)`
108
+ or `P1 (set)`); it accepts `P0`–`P3`, *Default* (drop the setting; P2) and *None* (P3, nothing
109
+ tolerated), the per-attempt timeout, how many
106
110
  failures before escalating, the effort step, verification retries, the infrastructure backoff,
107
111
  and, while a scheduler is live, the retry and infrastructure-retry budgets and max parallel.
108
112
  A live run also gets **Drain** (start nothing new; *Resume* ends it), **Stop** (finish what
109
113
  runs, then end the run) and **Stop now** (interrupt the running tasks), and one line per
110
114
  infrastructure pause: the model or harness it holds, the class, its tasks, and a countdown to
111
115
  its next try, or *budget used up*. A task has its own panel for a threshold override
112
- (including *None*, which exempts it from the run's threshold), its own retry budget, a
116
+ (*Inherit*, or a level; *None* means P3 for that task), its own retry budget, a
113
117
  **model pin**: the model its next full retry uses, once, and, on a live run, **Retry now**
114
118
  for a task that stopped or failed, on the policy's choice or a model you name. A retry is
115
119
  queued; the panel says *queued*, then *applied* or *refused* with the scheduler's reason.
package/docs/memory.md CHANGED
@@ -5,7 +5,8 @@
5
5
  What forge learns about a repository, where it keeps it, what each role is told, and what forge has spent there.
6
6
 
7
7
  Every forge dispatch is a clean slate — the opt-in `plan --reviewer-session` experiment,
8
- which continues a reviewer's session across rounds, is the exception — so without help the
8
+ which continues a reviewer's session across rounds, and `plan --implementer-session`, which
9
+ continues an implementer's on a retry, are the exceptions — so without help the
9
10
  tenth run in a repo rediscovers what the first one learned. forge keeps that in the repo,
10
11
  in two files:
11
12
 
package/docs/models.md CHANGED
@@ -26,8 +26,10 @@ the wrong provider.
26
26
  - `--dwarf` missing → forge **asks**. Every dispatch spends real quota on your account, so
27
27
  picking for you isn't its call.
28
28
  - `--qa` missing → `opus`, which runs locally through `claude` and adds no cost surprise.
29
- - effort missing → dwarf builds at `medium`, qa reviews at `xhigh`. A reviewer thinking
30
- *less* than the implementer tends to wave things through, which wastes the stage entirely.
29
+ - effort missing → dwarf builds at `medium`, qa reviews at `high`, a planner plans at `xhigh`. A
30
+ reviewer thinking *less* than the implementer tends to wave things through, which wastes the
31
+ stage entirely; `xhigh` reviews cost about twice as much as `high` ones for the same verdicts in
32
+ the SWE-bench Pro benchmark (#89), so `high` is the default and `xhigh` is yours to ask for.
31
33
 
32
34
  ## Effort, ceilings and clamping
33
35
 
package/docs/reviews.md CHANGED
@@ -9,10 +9,17 @@ What a reviewer must answer, what forge does when it fails a task, how to retry,
9
9
  Decompose-mode QA must end with a sentinel line:
10
10
 
11
11
  ```
12
- FORGE_VERDICT: PASS no confirmed correctness bug (style nits are not failures)
13
- FORGE_VERDICT: FAIL at least one CONFIRMED correctness bug
12
+ FORGE_VERDICT: PASS — no CONFIRMED finding at the blocking threshold (P2 or worse)
13
+ FORGE_VERDICT: FAIL — at least one CONFIRMED finding at the blocking threshold (P2 or worse)
14
14
  ```
15
15
 
16
+ forge decides the verdict from the findings, at a blocking threshold: `P2` unless
17
+ `--qa-threshold` sets another. A CONFIRMED finding at the threshold or worse, or one with no
18
+ severity, blocks: a PASS that lists one becomes FAIL. A CONFIRMED finding below the threshold
19
+ never blocks: a FAIL made only of those is accepted, and either way they are recorded in
20
+ `known_issues.md`, which `forge issues` and the sweep pick up. PLAUSIBLE findings never block.
21
+ `--qa-threshold P3` (or `none`) makes every CONFIRMED finding block.
22
+
16
23
  Only a standalone final line counts, and the parser is shared by every runner (solo,
17
24
  decomposed, Fractal's QA checkpoint). The prompt shows each verdict with a dash and its
18
25
  meaning, and some reviewers copy that whole line, so `FORGE_VERDICT: PASS — meaning` is
@@ -28,7 +35,11 @@ type `retry`, or when you opt in for a run with `--retry-failed N` ([below](#ret
28
35
  An `UNKNOWN` task is different from a rejected one: the reviewer never judged the code, so
29
36
  `retry` (or `--retry-failed`) asks **QA again on the unchanged work** instead of paying an
30
37
  implementer to rewrite something nobody rejected. No attempt is spent and no dwarf runs. If
31
- the worktree no longer matches what was reviewed, the full task runs instead.
38
+ the worktree no longer matches what was reviewed, the full task runs instead. A task
39
+ `INVALIDATED` because its review copy changed during the review (the reviewer edited a tracked
40
+ file) is retried the same way: its verdict counts for nothing, but the committed work is intact.
41
+ Untracked files a reviewer leaves in its copy, such as a test run's `__pycache__/`, do not void
42
+ the review.
32
43
 
33
44
  ## Retrying a failed task
34
45
 
@@ -86,8 +97,10 @@ as `retry` does. Other tasks keep running meanwhile; dependents still wait for t
86
97
  run (verification included) to finish before a human could retry it.
87
98
 
88
99
  It is opt-in and per invocation: it is not remembered by the plan, and the orchestrator never
89
- adds it unprompted. Only reviewer rejections are retried automatically — `TIMEOUT`, `ERROR`,
90
- `INVALIDATED` and `CONFLICT` still need a human. A retry that changes nothing (empty diff, or
100
+ adds it unprompted. Reviewer rejections, reviews with no verdict and reviews voided by a
101
+ change to the review copy are retried automatically (the last two as a fresh review of the same
102
+ work) — `TIMEOUT`, `ERROR`, `CONFLICT` and an `INVALIDATED` merge (the task or integration
103
+ branch moved) still need a human. A retry that changes nothing (empty diff, or
91
104
  a diff byte-identical to the previous attempt) writes a `noretry` marker and is **not**
92
105
  retried again, so a stuck task cannot burn its whole budget repeating itself.
93
106
  `tasks/<id>/attempts.tsv` records every entry (epoch, attempt number, resulting status, infra
@@ -135,18 +148,22 @@ still collapses to Fractal's own "failed" handling; QA-side stops propagate as a
135
148
 
136
149
  QA is asked to label every finding `- [P0..P3][CONFIRMED|PLAUSIBLE] file:line — what breaks`
137
150
  (P0 data loss/security/crash on the main path, P1 wrong behaviour on realistic input, P2
138
- edge-case bug, P3 minor). By default the verdict rule is unchanged — any CONFIRMED bug fails.
151
+ edge-case bug, P3 minor). [The verdict rule](#verdicts-and-failure) says which of them block.
139
152
 
140
- `--qa-threshold Pn` (on `run` or `retry`; remembered in the plan; `none` clears it) names the
141
- **least severe level that still blocks**: `P2` means P0–P2 block and only P3 is tolerated.
153
+ `--qa-threshold Pn` (on `plan`, `run`, `retry`, `review` and solo; a plan remembers it) changes
154
+ the default `P2`, the **least severe level that still blocks**: `P2` means P0–P2 block and only P3
155
+ is tolerated. `none` means P3, so every CONFIRMED finding blocks; `default` removes the setting.
156
+ Solo is the exception: it takes only `P0`–`P3` or `none`, so `default` exits 2 there.
142
157
  A task-specific `tasks/<id>/qa_threshold` file beats the plan-level value, which is how a
143
- dev-tooling or investigation task gets a looser bar than production code. With a threshold, a
144
- reviewer `FAIL` made only of CONFIRMED findings that are all labelled and strictly milder than
145
- the threshold is accepted as **PASS with known issues**: the task merges, `tasks/<id>/known_issues.md`
146
- keeps the findings, `qa.gate` records the decision, and every run/retry/integrate summary
158
+ dev-tooling or investigation task gets a looser bar than production code. A reviewer `FAIL` made
159
+ only of CONFIRMED findings that are all labelled and strictly milder than the threshold is
160
+ accepted as **PASS with known issues**: the task merges, `tasks/<id>/known_issues.md`
161
+ keeps the findings, `qa.gate` records the decision (`accept`), and every run/retry/integrate summary
147
162
  lists them. The literal status stays `PASS`, so nothing downstream needed a new vocabulary.
163
+ The same gate runs the other way: a PASS that lists a blocking finding becomes FAIL (`qa.gate`
164
+ decision `fail`), and the next attempt starts with a note saying why.
148
165
  It fails safe: an unlabelled CONFIRMED finding, or a FAIL with no CONFIRMED finding at all,
149
- is never tolerated, and without a threshold nothing changes.
166
+ is never tolerated.
150
167
 
151
168
  Tolerated findings are recorded, not fixed. After a run, the skill offers once to file them as
152
169
  GitHub issues, together with PLAUSIBLE findings of passed tasks and whatever a whole-run review
@@ -162,7 +179,8 @@ them on the team's project board; anywhere else forge files them itself with pla
162
179
  Each issue gets the finding, its severity, the task, reviewer and a code link at the merged
163
180
  commit. A hidden fingerprint, shared with gh-proman, keeps a finding from being filed twice.
164
181
  Findings a person merged with `accept` are origin `accepted`: the CONFIRMED lines under
165
- `## Accepted by a human despite the reviewer's <status> verdict` in `known_issues.md`.
182
+ `## Accepted by a human despite the reviewer's <status> verdict` in `known_issues.md`, or under
183
+ `## Accepted by a human despite forge's FAIL (…)` when `accept` followed a PASS that forge made FAIL.
166
184
  Their issue says a person accepted the work over that verdict, and gives the recorded
167
185
  reason. Findings above that heading, which a threshold tolerated, stay origin
168
186
  `tolerated`. A whole-run review whose integration branch has moved since it is outdated.
@@ -178,7 +196,7 @@ is outdated. Every other finding has `review` null.
178
196
  them for issues. Once every task has merged, and before the combined verification, forge plans one
179
197
  sweep:
180
198
 
181
- - **Which findings.** The CONFIRMED findings `--qa-threshold` tolerated at `P3` or worse, and
199
+ - **Which findings.** The CONFIRMED findings the threshold tolerated, at `P3` or worse, and
182
200
  PLAUSIBLE ones too with `--sweep-plausible`. Left out:
183
201
  - findings a person accepted;
184
202
  - dismissed ones (`forge issues --dismiss`), and ones with no file or whose file is gone;
@@ -221,7 +239,8 @@ the branch is still at the reviewed commit and the worktree still has the saved
221
239
  otherwise it exits `3` and says to `retry` for a fresh review (accepting would sign off on code
222
240
  nobody reviewed). It writes `tasks/<id>/known_issues.md` (your reason, who and when, and the
223
241
  reviewer's reply copied verbatim, under
224
- `## Accepted by a human despite the reviewer's <status> verdict`) and `accepted.by`,
242
+ `## Accepted by a human despite the reviewer's <status> verdict`, or after forge's flip under
243
+ `## Accepted by a human despite forge's FAIL (…)`) and `accepted.by` (with `gate=fail` after a flip),
225
244
  merges through the same checks as any other
226
245
  task, and puts everything back if the merge conflicts (exit `6`). Dependents are not touched;
227
246
  `run` continues them.
@@ -246,7 +265,7 @@ reads `integration.base..integration tip` from a disposable checkout, writes
246
265
  `<plan>/final-review-<epoch>-<pid>/` (`qa.input`, `qa.last`, `verdict`, `qa.gate`, …), keeps
247
266
  `<plan>/final-review` and `final-review.verdict` pointing at the newest, and never touches your
248
267
  branch or the integration branch. With `integrate --final-review`, it runs after verification
249
- and before your branch can move: `PASS` (or a `FAIL` accepted by `--qa-threshold`) continues,
268
+ and before your branch can move: `PASS` (or a `FAIL` the threshold accepts) continues,
250
269
  anything else stops with exit `5`; an infrastructure stop exits `8`. The QA spec is `--qa`, else
251
270
  the one remembered in `final_qa`, else the single spec every task shares (otherwise it asks).
252
271
  Tasks that are not merged are not in the result, and it says so. `integrate` also names unmerged
@@ -342,8 +361,7 @@ run) when the source fingerprint is unchanged. If the rerun passes the status is
342
361
  `verification.flaky` is written, `verification.log` keeps the first (failing) run,
343
362
  `verification.retry.log` the second, and `run`/`integrate` print a loud `FLAKY` line — an
344
363
  intermittent failure can be a real bug, so it is never passed off as a clean pass. A command
345
- that changes the tree is never retried. This deterministic rerun comes before Jev's optional
346
- model-assisted triage, which then does not run.
364
+ that changes the tree is never retried.
347
365
 
348
366
  With [verification lanes](../references/decompose.md#execution-checks-and-integration-verification)
349
367
  the rerun is per lane: only a lane that failed runs again, alone, and a lane that passes on its
@@ -353,7 +371,7 @@ such lane (`lanes=`, `<lane>.first_exit=`, `<lane>.retries_used=`); a lane whose
353
371
  test is in its baseline prints `known failures only: lane <name>`. A whole-run review's
354
372
  verification summary lists every lane with its state (`unit: pass`, `db: flaky`, ...) and says
355
373
  again which lane failed, which passed only on a rerun ("so its pass is not clean") and which
356
- failed only on known tests. In lanes mode there is no whole-command rerun and no Jev triage.
374
+ failed only on known tests. In lanes mode there is no whole-command rerun.
357
375
 
358
376
  ## Native review
359
377
 
@@ -372,3 +390,14 @@ the reviewer the result: `proven`, `passes_without_change`, `inconclusive` or `e
372
390
  reviewer is asked for a P2 finding for every test that passes without the change. It is advice
373
391
  only: forge never changes a status or verdict from it. forge-ui shows the evidence under the
374
392
  review findings. See [fail-first evidence](../references/decompose.md#fail-first-evidence-opt-in).
393
+
394
+ ## Pre-review tests (opt-in)
395
+
396
+ `plan --pre-review-tests` runs only the tests an attempt affects, with `.forge/verify-subset`,
397
+ before forge pays for its review: the tests the change adds or edits, and the tests of the files it
398
+ changes (from `.forge/test-map`, the naming convention or a reverse lookup). Never the whole suite:
399
+ a change to shared test infrastructure, more than 20 files or more than 120 s is skipped as too
400
+ broad. A red attempt goes back to its implementer without a review, with the failing tests and
401
+ their output as its findings; a test that also fails on the task base is not blamed, and a failure
402
+ that passes when rerun alone is recorded as flaky. Green, the reviewer gets the result as
403
+ evidence. See [pre-review tests](../references/decompose.md#pre-review-tests-opt-in).
@@ -15,8 +15,10 @@ Symptoms, causes and fixes, from a skill a harness cannot see to a task that wil
15
15
  | dwarf produced no changes | usually an ambiguous prompt it couldn't resolve headlessly. Nobody can answer a question mid-run |
16
16
  | task status `ERROR` | worktree creation or a dispatch failed — read `tasks/<id>/dwarf.out` / `qa.out` |
17
17
  | task status `UNKNOWN` | QA never emitted a verdict line; read `tasks/<id>/qa.last`. `retry` (or `run --retry-failed N`) asks QA again on the unchanged work — no dwarf runs, no attempt is spent |
18
+ | task status `INVALIDATED`, "artifact changed during review" | the reviewer changed a tracked file in its review copy, so its verdict counts for nothing. `retry` (or `run --retry-failed N`) reviews the unchanged work again — no dwarf runs, no attempt is spent. Untracked leftovers such as `__pycache__/` never cause this |
18
19
  | task status `INFRA`, `run` exits `8` | a quota/usage limit, auth problem, rate limit, network error or empty answer stopped a dispatch — not a task failure, and no attempt was spent. Read `tasks/<id>/infra.txt` (`class=`, `retry_after=`), fix the cause, run the same command again. `run --infra-retries M` waits it out instead. Dependents stay `PENDING`, never `BLOCKED` |
19
- | a task merged although its reviewer said FAIL | `--qa-threshold` accepted it: every CONFIRMED finding was labelled and milder than the threshold. See `tasks/<id>/known_issues.md` and `qa.gate`; nothing is accepted without an explicit threshold |
20
+ | a task merged although its reviewer said FAIL | the threshold (`P2` by default) accepted it: every CONFIRMED finding was labelled and milder than the threshold. See `tasks/<id>/known_issues.md` and `qa.gate` (decision `accept`); [the verdict rule](reviews.md#verdicts-and-failure) |
21
+ | a task FAILed although its reviewer said PASS | forge's gate: a CONFIRMED finding at or above the threshold was listed. `qa.gate` says `fail`, and the next attempt starts with a note saying so. Fix those findings, or `accept` the task if a person decides to; [the verdict rule](reviews.md#verdicts-and-failure) |
20
22
  | `accept` exits `3` "changed since it was reviewed" | the branch or worktree moved after QA, so accepting would sign off on unreviewed code. `retry` for a fresh review |
21
23
  | `combine` / `split` refuses | the message names why: unmerged task left behind, duplicate ids, locked or dirty plan, a Fractal-backed plan, or a selection that strands a dependent. Nothing was changed |
22
24
  | `integrate --final-review` stops with exit `5` | the whole-run reviewer found a blocking defect (or never reached a verdict); findings are in `<plan>/…/final-review/qa.last`. Your branch is untouched. Exit `8` means the reviewer hit a quota/auth stop: run it again |