@giamme/forge 0.17.0 → 0.19.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 (110) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +1 -0
  3. package/SKILL.md +32 -5
  4. package/VERSION +1 -1
  5. package/docs/artifacts.md +33 -1
  6. package/docs/commands.md +147 -16
  7. package/docs/dataset.md +5 -0
  8. package/docs/decomposed-runs.md +122 -1
  9. package/docs/development.md +2 -1
  10. package/docs/forge-ui.md +98 -8
  11. package/docs/memory.md +27 -4
  12. package/docs/models.md +8 -0
  13. package/docs/reviews.md +122 -0
  14. package/docs/safety.md +8 -0
  15. package/forge +44 -4
  16. package/package.json +2 -1
  17. package/references/dataset.md +39 -1
  18. package/references/decompose.md +737 -16
  19. package/references/harnesses.md +18 -3
  20. package/references/planning.md +43 -14
  21. package/references/solo.md +2 -1
  22. package/references/ui.md +56 -6
  23. package/registry.tsv +8 -3
  24. package/scripts/forge-artifact.sh +14 -0
  25. package/scripts/forge-brief.py +217 -0
  26. package/scripts/forge-compare.py +13 -2
  27. package/scripts/forge-config.py +176 -9
  28. package/scripts/forge-contract.py +246 -28
  29. package/scripts/forge-control.py +200 -15
  30. package/scripts/forge-dispatch.sh +48 -15
  31. package/scripts/forge-du.py +167 -0
  32. package/scripts/forge-group.py +496 -0
  33. package/scripts/forge-groups.py +89 -0
  34. package/scripts/forge-handoff.py +1128 -0
  35. package/scripts/forge-lib-adopt.sh +1 -0
  36. package/scripts/forge-lib-group.sh +641 -0
  37. package/scripts/forge-lib-plans.sh +343 -4
  38. package/scripts/forge-lib-review.sh +29 -1
  39. package/scripts/forge-lib-task.sh +197 -4
  40. package/scripts/forge-memory.sh +245 -3
  41. package/scripts/forge-metrics.sh +7 -3
  42. package/scripts/forge-parallel-options.sh +4 -0
  43. package/scripts/forge-parallel.sh +1216 -41
  44. package/scripts/forge-planner.py +104 -8
  45. package/scripts/forge-prompt.py +120 -0
  46. package/scripts/forge-retro.py +115 -0
  47. package/scripts/forge-route.py +190 -12
  48. package/scripts/forge-runs-compact.py +443 -0
  49. package/scripts/forge-runs-rm.py +2 -0
  50. package/scripts/forge-runs.py +27 -8
  51. package/scripts/forge-schedule.py +633 -49
  52. package/scripts/forge-shadow.py +7 -1
  53. package/scripts/forge-solo.sh +4 -0
  54. package/scripts/forge-summarize.py +698 -0
  55. package/scripts/forge-ui-options.sh +10 -0
  56. package/scripts/forge-worktrees.py +243 -0
  57. package/scripts/forge_brief/__init__.py +831 -0
  58. package/scripts/forge_brief/answers.py +506 -0
  59. package/scripts/forge_brief/proposals.py +1630 -0
  60. package/scripts/forge_dataset/__init__.py +10 -0
  61. package/scripts/forge_dataset/efforts.py +4 -3
  62. package/scripts/forge_dataset/export.py +36 -10
  63. package/scripts/forge_dataset/facts.py +8 -4
  64. package/scripts/forge_dataset/forecast.py +8 -18
  65. package/scripts/forge_dataset/harvest.py +241 -12
  66. package/scripts/forge_dataset/history.py +13 -6
  67. package/scripts/forge_dataset/importer.py +65 -1
  68. package/scripts/forge_dataset/names.py +66 -0
  69. package/scripts/forge_dataset/reviewers.py +5 -2
  70. package/scripts/forge_dataset/risk.py +6 -3
  71. package/scripts/forge_dataset/routing.py +6 -1
  72. package/scripts/forge_decide/__init__.py +11 -1
  73. package/scripts/forge_groups/__init__.py +308 -0
  74. package/scripts/forge_groups/attribute.py +289 -0
  75. package/scripts/forge_groups/review.py +286 -0
  76. package/scripts/forge_locations.py +366 -0
  77. package/scripts/forge_owner.py +152 -0
  78. package/scripts/forge_registry.py +19 -0
  79. package/scripts/forge_retro/__init__.py +417 -0
  80. package/scripts/forge_retro/issues.py +1193 -0
  81. package/scripts/forge_retro/report.py +671 -0
  82. package/scripts/forge_side/__init__.py +482 -0
  83. package/scripts/forge_storage.py +515 -0
  84. package/ui/README.md +68 -8
  85. package/ui/docs/api.md +375 -31
  86. package/ui/forge_ui/control.py +451 -11
  87. package/ui/forge_ui/executions.py +8 -1
  88. package/ui/forge_ui/export.py +53 -7
  89. package/ui/forge_ui/groups.py +264 -0
  90. package/ui/forge_ui/links.py +337 -0
  91. package/ui/forge_ui/models.py +125 -10
  92. package/ui/forge_ui/projects.py +4 -1
  93. package/ui/forge_ui/reader.py +919 -45
  94. package/ui/forge_ui/server.py +4 -0
  95. package/ui/forge_ui/static/app.js +173 -11
  96. package/ui/forge_ui/static/briefview.js +605 -0
  97. package/ui/forge_ui/static/checksview.js +6 -2
  98. package/ui/forge_ui/static/controls.js +5 -0
  99. package/ui/forge_ui/static/diffview.js +86 -1
  100. package/ui/forge_ui/static/groupsview.js +332 -0
  101. package/ui/forge_ui/static/index.html +4 -0
  102. package/ui/forge_ui/static/panel.js +394 -8
  103. package/ui/forge_ui/static/projectsview.js +189 -10
  104. package/ui/forge_ui/static/runmodel.js +27 -4
  105. package/ui/forge_ui/static/storageview.js +352 -0
  106. package/ui/forge_ui/static/style.css +176 -6
  107. package/ui/forge_ui/static/worktreesview.js +235 -14
  108. package/ui/forge_ui/storage.py +150 -0
  109. package/ui/forge_ui/transcripts.py +35 -10
  110. package/ui/forge_ui/worktrees.py +154 -13
@@ -12,19 +12,25 @@ run leaves branches behind.
12
12
  - [tasks.tsv](#taskstsv)
13
13
  - [Routing](#routing)
14
14
  - [Profiles](#profiles)
15
+ - [Scripted tasks](#scripted-tasks)
15
16
  - [Fractal within decomposed tasks](#fractal-within-decomposed-tasks)
16
17
  - [Waves and disjointness](#waves-and-disjointness)
18
+ - [Groups and group review (opt-in)](#groups-and-group-review-opt-in)
17
19
  - [Task size and acceptance criteria](#task-size-and-acceptance-criteria)
18
20
  - [Plan gates: sent back, and the block under the table](#plan-gates-sent-back-and-the-block-under-the-table)
19
21
  - [The capsule](#the-capsule)
20
22
  - [Planning](#planning)
21
23
  - [Plan shape](#plan-shape)
22
24
  - [QA verdicts](#qa-verdicts)
25
+ - [Retro notes (opt-in)](#retro-notes-opt-in)
26
+ - [Brief mode (opt-in)](#brief-mode-opt-in)
27
+ - [Task summaries (opt-in)](#task-summaries-opt-in)
23
28
  - [Severity, thresholds and known issues](#severity-thresholds-and-known-issues)
24
29
  - [Retrying, and resuming an interrupted run](#retrying-and-resuming-an-interrupted-run)
25
30
  - [Infrastructure failures](#infrastructure-failures)
26
31
  - [Implementer guards](#implementer-guards)
27
32
  - [Accepting, splitting, combining and the whole-run review](#accepting-splitting-combining-and-the-whole-run-review)
33
+ - [Chained plans](#chained-plans)
28
34
  - [Branches, worktrees, cleanup](#branches-worktrees-cleanup)
29
35
  - [Failure modes](#failure-modes)
30
36
 
@@ -98,7 +104,7 @@ tests mul medium tests/test_calc.py - - Tests for multiply()
98
104
  | `deps` | comma-list of task ids that must land first, or `-` |
99
105
  | `difficulty` | `low` \| `medium` \| `high` |
100
106
  | `files` | expected touch set, comma-separated. Drives disjointness — see below |
101
- | `dwarf` / `qa` | `-` to resolve from the routing rules; an explicit spec always wins |
107
+ | `dwarf` / `qa` | `-` to resolve from the routing rules; an explicit spec always wins. `script` in `dwarf` runs the executable `tasks/<id>/run` ([Scripted tasks](#scripted-tasks)) |
102
108
  | `title` | one line, shown in the approval table and the capsule |
103
109
 
104
110
  Each task also needs `tasks/<id>/prompt.md` — the implementation instruction, written the
@@ -124,7 +130,8 @@ already named, instead of leaving someone to diff two branches to find out.
124
130
  `plan` resolves difficulty into concrete specs and writes them back into the `dwarf`/`qa`
125
131
  columns, so `run` never consults the routing rules. This is also what makes a gate override
126
132
  durable: an explicit value is preserved across a re-plan, while `UNASSIGNED` is treated as a
127
- leftover marker and re-resolved.
133
+ leftover marker and re-resolved. A `script` cell is one of those explicit values: `plan` leaves
134
+ it, and requires `tasks/<id>/run` to be executable.
128
135
 
129
136
  ## Routing
130
137
 
@@ -144,7 +151,8 @@ carry, since distinct harnesses have independent quotas.
144
151
  Resolution order per task: explicit column value → the tier's rule → plain `--dwarf` → and if
145
152
  none of those exist, `UNASSIGNED`. An `UNASSIGNED` task makes `plan` exit 2 and `run` refuse
146
153
  outright. Forge does not invent a model when the user has not said which one should spend
147
- their quota.
154
+ their quota. The explicit value `script` is reserved for a command, and it is not drawn from a
155
+ pool. See [Scripted tasks](#scripted-tasks).
148
156
 
149
157
  QA has no tier rules by default and falls back to `opus` at `high`, matching single-task forge.
150
158
  When the user names no reviewers, offer reviewers sized to the task's difficulty, which is what
@@ -216,6 +224,58 @@ froze and does not apply it again; a plan with no copy gets the default profile,
216
224
  set. The runner does not select `balanced` on its own. `--no-profile` removes the frozen
217
225
  copy. See [commands](../docs/commands.md#forge-config-profile).
218
226
 
227
+ ### Scripted tasks
228
+
229
+ A dwarf cell of `script` runs the executable `tasks/<id>/run` in the task's worktree. Use it
230
+ when the change is already a command: a codemod, a move by a map, a generator. The command
231
+ should be atomic, and it should produce the same tree each time it runs from the same base.
232
+
233
+ `plan` leaves the cell as `script`. It does not draw a pool, does not explore the row, and
234
+ does not record `tasks/<id>/running.tier`. The `qa` cell is resolved as usual, and doctor
235
+ still checks that reviewer. Doctor is skipped for the implementer. The approval table shows
236
+ `script`. The dispatch estimate counts no implementer for the row, and prints
237
+ `scripted tasks: N (ids) run tasks/<id>/run; no implementer model`. The review is still
238
+ counted. If `tasks/<id>/run` is missing or not executable, `plan` exits 2
239
+ (`task '<id>' is a script task but tasks/<id>/run is missing or not executable`) and stops
240
+ before writing the resolved `tasks.tsv`. A `--dwarf` pool, a tier pool, or a profile pool that names `script` is
241
+ refused with exit 2: the word is reserved for a task that runs `tasks/<id>/run`.
242
+
243
+ Each attempt resets the worktree to the task's pinned base (the tracked tree, and untracked
244
+ files other than `.forge`), then runs the command in its own process group. The working
245
+ directory is the worktree. Standard input is empty. The environment is `FORGE_TASK_ID`,
246
+ `FORGE_PLAN`, `FORGE_WORKTREE` and `FORGE_BASE_REF`. A file that does not start with `#!`
247
+ runs under `/bin/bash`. The limit is the plan's `timeout` in seconds, `0` for none as for a
248
+ dispatch, and 2700 seconds when the plan has none. A timeout stops the process
249
+ group. Both streams go to `tasks/<id>/script.log`. The run is also recorded at
250
+ `tasks/<id>/attempts/script-<hex>/`, where `<hex>` is 16 hex digits: a copy of `script.log`,
251
+ the `run` file as it ran (the copy the review shows, even after `run` is edited), and `metrics.json` (`role` and `harness` are `script`; `exit_code` is null
252
+ when the run timed out).
253
+
254
+ Exit 0 with a new diff commits `forge(<id>) attempt N: <title> (script)` and reviews with
255
+ `forge-contract.py qa --kind script`. The head is the task head, plus an instruction to judge
256
+ the command and its result: whether the result is complete and correct for the requirements,
257
+ and whether the command did only what it should. A mechanical change can be sampled, and the
258
+ review says what it sampled. The prompt includes the command and the last 3000 characters of
259
+ `script.log`. The tail matches a task review. A member of a `review=group` group still waits
260
+ for that group's review.
261
+
262
+ A non-zero exit is `FAIL`. `tasks/<id>/qa.last` starts `The script exited N.` A timeout is
263
+ `FAIL`, and `qa.last` says `The script timed out after Ns.` Both quote the last 3000
264
+ characters of `script.log`. There is no review and no `noretry`, so a later retry can run.
265
+ The worktree is left as the command left it. Exit 0 that changes nothing is `FAIL` as well,
266
+ with `The script produced no changes.` and `noretry`, so it is not retried. A reset that
267
+ cannot reach the base is `ERROR` and is not reviewed (`tasks/<id>/script.reset.out`).
268
+
269
+ The task is never escalated, and its failed reviews are not counted as converging. The
270
+ scheduler, `forge-route.py`, dataset routing and forge-ui treat `script` as no model. The
271
+ plan forecast does not price the row. The reviewer is still a model, and a pause on that
272
+ reviewer holds the task.
273
+
274
+ A retry runs the same command again from the base. Editing `tasks/<id>/run` is how the diff
275
+ changes. An unchanged command repeats the previous diff, and that retry stops: `FAIL`,
276
+ `noretry`, and `The retry changed nothing: the diff is byte-identical to the previous
277
+ attempt.` It is not reviewed again.
278
+
219
279
  ## Fractal within decomposed tasks
220
280
 
221
281
  Select optional Fractal execution on `run`; planning the task table does not activate it.
@@ -287,6 +347,296 @@ fingerprint checks. A slow unrelated task no longer holds up eligible dependents
287
347
 
288
348
  Each task's baseline is pinned immediately before dispatch and stays fixed across retries.
289
349
 
350
+ ## Groups and group review (opt-in)
351
+
352
+ Two opt-ins share `groups.tsv`. A planner may name groups, and those are identity only
353
+ (`review=task`): they do not change dispatch or the estimate, and they are fine under Fractal.
354
+ `plan --groups` with `--group-review` is the other opt-in: one QA review covers several tasks.
355
+ Offer either; never add them unprompted. The user-facing tradeoff is in
356
+ [group review](../docs/reviews.md#group-review-opt-in). The data layer is `scripts/forge_groups`
357
+ and `scripts/forge-groups.py` (`validate`, `derive`, `resolve`, `freeze`, `check`, `of`, `show`).
358
+
359
+ ### `groups.tsv`
360
+
361
+ Six tab-separated columns. `#` lines and blank lines are ignored.
362
+
363
+ ```
364
+ # id review qa members title goal
365
+ ```
366
+
367
+ - `id` matches `[a-z0-9][a-z0-9-]{0,39}`, is unique, and is not also a task id.
368
+ - `review` is `task` or `group`.
369
+ - `qa` is a spec, or `-`.
370
+ - `members` is a comma list of task ids, in order. A task is in at most one group.
371
+ - `title` and `goal` are one line each, or `-` when absent. A planner's title and goal are
372
+ at most 200 characters.
373
+
374
+ Where a row comes from:
375
+
376
+ - A planner reply that includes `groups` writes `groups.tsv` with `review` always `task` and
377
+ `qa` always `-`. A planner group may have one member. The planner never sets `review=group`.
378
+ - `plan --groups waves` makes one group per computed wave that has at least two tasks, named
379
+ `w1`, `w2`, and so on. A wave larger than the max splits in `tasks.tsv` order into `w3a`,
380
+ `w3b`, and so on. A leftover single task is dropped. Each gets the title `Wave 3` (`Wave 3a`)
381
+ and no goal: nothing in a computed wave says what it is for.
382
+ - `--group-review` is only valid with `--groups waves`. Without it, `plan` exits 2:
383
+ `--group-review goes with --groups waves (it sets the review of the groups waves derives)`.
384
+ The derived groups then have `review=group`. High-difficulty tasks stay out and keep their
385
+ own review. A leftover single is dropped.
386
+ - `plan --groups FILE` copies that file. An existing `groups.tsv` and no `--groups` is used
387
+ as it is.
388
+
389
+ `plan` computes waves, then validates, resolves each review group's `qa`, and freezes.
390
+ The approval table shows each group's title and goal, `(no goal)` when it has none, and one line
391
+ naming the groups without a goal. `forge group set PLAN GID --goal "…"` (or `--title`) writes it
392
+ and freezes the groups again, under the control lock and logged in `control.log` (actor `cli`).
393
+ It refuses (exit 3) when `groups.tsv` or a member's deps or files already differ from what `plan`
394
+ froze, since freezing again would accept those edits too. It works on a live run: a title or a
395
+ goal changes no membership, and the next group review or brief prompt uses the new text.
396
+
397
+ ### Rules for `review=group`
398
+
399
+ These apply only when `review` is `group`. A `review=task` group is not checked this way.
400
+
401
+ - At least two members, and at most `--group-max-tasks` (default 6, plan file
402
+ `group_max_tasks`). The flag accepts a positive integer. Deriving waves requires at
403
+ least 2 (`max tasks must be at least 2`). Validating an existing file uses the same max,
404
+ so 1 rejects every review group.
405
+ - No member depends on another member, directly or through a task outside the group.
406
+ - Declared `files` do not overlap. A directory covers the paths under it, `.` covers
407
+ everything, and `-` declares nothing. Same rule as the scheduler.
408
+ - No sweep member (an id `sweep-N`, or `tasks/<id>/sweep.json`).
409
+ - `qa` of `-` becomes the QA spec of the highest-difficulty member (`high` over `medium`
410
+ over `low`; a tie takes the first listed), as `tasks.tsv` has it after `plan`.
411
+
412
+ ### The freeze, and what makes `run` refuse
413
+
414
+ `groups.frozen` is the sha256 of the freeze text: one line per group, all six columns, then
415
+ one line per member, `member<TAB>deps<TAB>files`. The dwarf column is not in it. No groups
416
+ removes `groups.frozen`. A `groups.frozen` with no `groups.tsv` fails the check.
417
+
418
+ `run` calls `forge-groups.py check` when `groups.tsv` or `groups.frozen` exists, a dry run
419
+ included, before any dispatch. A mismatch, a missing file, or groups that cannot be read
420
+ refuses with `groups.tsv or a member's deps/files changed since plan; run plan again`.
421
+
422
+ Group review and Fractal do not combine. `--fractal`, or a plan that is already fractal,
423
+ makes `plan` and `run` exit 2: `group review does not support Fractal yet`.
424
+
425
+ ### The member lifecycle and `IMPLEMENTED`
426
+
427
+ A `review=group` member implements, writes `reviewed.commit` and `source.fingerprint`, and
428
+ stops at `IMPLEMENTED`. There is no per-task QA snapshot, no shadow review, no fail-first
429
+ check, and no QA-only resume (the `resume` marker is removed). `--pre-review-tests` still
430
+ runs, on a snapshot that exists only for that check. Red is `FAIL`, unreviewed, not
431
+ `IMPLEMENTED`.
432
+
433
+ `record_attempt` writes no `attempts.tsv` row while the status is `IMPLEMENTED`, and
434
+ `post_attempt` does nothing. The attempt cap counts `attempts.tsv` rows (an `INFRA` row
435
+ does not count), so that stop spends nothing. The `attempt` counter may already have moved.
436
+
437
+ `retry` and `accept` of an `IMPLEMENTED` task exit 3: `<id> is implemented and waits for
438
+ group <gid>'s review`. The scheduler does not dispatch that member again. A dependent waits
439
+ for `MERGED`, so it does not start.
440
+
441
+ ### When a group is reviewed
442
+
443
+ The scheduler treats each `review=group` group as one unit, keyed `group:<gid>` in `active`.
444
+ It is ready when every member is `IMPLEMENTED`, nothing is running it, it has not merged, and
445
+ its status is empty or `WAITING`, or `FAIL` with `settled.round` equal to the current
446
+ `round`, or this run has marked it to review again. It starts as soon as the last member is
447
+ `IMPLEMENTED`. There is no wave barrier. It takes one slot, and it does not start while the
448
+ run is stopping, draining, or paused for infrastructure. The command is
449
+ `forge-parallel.sh _group`.
450
+
451
+ ### The candidate, and the size bound
452
+
453
+ The candidate worktree is `<wt_root>/_group-<gid>`. It starts at the integration HEAD, then
454
+ merges each member's `reviewed.commit` with `--no-ff`, in member order.
455
+
456
+ - A member that is not `IMPLEMENTED`: the group is `WAITING`. Members stay as they are.
457
+ - A member whose branch tip is not `reviewed.commit`, or whose worktree fingerprint is not
458
+ `source.fingerprint`: that member becomes `INVALIDATED` with `invalidated.reason`
459
+ `group-candidate`, and the group is `WAITING`.
460
+ - A conflict between members: the group is `CONFLICT`, `conflict.files` lists the files, the
461
+ merge is aborted, the members stay `IMPLEMENTED`, and nothing is dispatched.
462
+ - Any other merge failure, or no integration HEAD: `ERROR`.
463
+
464
+ The fingerprint is the sha256 of the sorted `task=commit` lines plus a final
465
+ `tree=<candidate tree>` line.
466
+
467
+ `combined.diff` is `git diff --binary --irreversible-delete` of the candidate against that
468
+ base, excluding `.forge`. Over `group_max_diff_kb` times 1024 bytes (default 256 when the
469
+ plan file is absent), the group is `NEEDS_DECISION` with reason `oversized`. Nothing is
470
+ dispatched, truncated, or sent to another reviewer. `decision.md` starts `reasons: oversized`
471
+ and offers two edits, then `plan` again: smaller groups in `groups.tsv`, or this group's
472
+ `review` set to `task`. `forge group retry` refuses an oversized group.
473
+ `--group-max-diff-kb N` is a positive integer, written only when given, so a re-plan keeps it.
474
+ The same is true of `--group-max-tasks`.
475
+
476
+ This is not a [whole-run review](../docs/reviews.md#whole-run-review-opt-in). That one reads
477
+ the combined result after the run and truncates. A group review that is over the bound never
478
+ builds a prompt.
479
+
480
+ ### The prompt and `{tasks=…}`
481
+
482
+ One fresh QA dispatch. The prompt is the contract head for kind `group` (the task preamble,
483
+ plus that this review covers several tasks and must judge each against its own criteria and
484
+ judge the combined change), the group's title and goal, `Members, in merge order`, then any
485
+ findings from the previous round that named no task. Each member follows: title, `prompt.md`,
486
+ the declared files and the reviewed commit. When the task has them, it also has the intended
487
+ approach, that member's diff `--stat` against its base, pre-review text, guard notes and
488
+ drift. Findings the previous round attributed to the task are quoted, and the implementer's
489
+ reply is included when this attempt is not the one those findings judged. The tail is the task contract plus
490
+ the `{tasks=…}` instructions below, then the whole combined diff in a fence. The diff is not
491
+ truncated. An oversized group never gets here. The threshold is the plan's QA threshold.
492
+
493
+ `{tasks=…}` is its own brace. It is not the facts brace
494
+ `{reach=… origin=… evidence=…}`. The prompt says to write it immediately before the facts
495
+ brace, so the facts brace still ends the line. The last `{tasks=…}` on a finding wins. Ids
496
+ are separated by commas or spaces.
497
+
498
+ Attribution (`scripts/forge_groups/attribute.py`, written to `attribution.json` with the
499
+ round):
500
+
501
+ - A tag names those ids. An empty tag (`{tasks=}` or `{tasks= , }`) names nobody and does
502
+ not fall back to the file.
503
+ - With no tag, the tasks are the members whose changed paths contain the finding's file, in
504
+ member order. A leading `./` is stripped and nothing else is normalised: `src/./a.py` does
505
+ not match `src/a.py`.
506
+ - Ambiguous when the tag names an id that is not a member, when the tag names nobody, when
507
+ there is no tag and no file, or when no member changed that file.
508
+ - `blocking` is the gate's per-finding decision at the threshold (`none` is P3; unset is
509
+ P2). `PLAUSIBLE` never blocks.
510
+ - `implicated` is the union, in member order, of the tasks on blocking findings that are not
511
+ ambiguous. The top-level `ambiguous` list is the `n` of findings that are both blocking
512
+ and ambiguous.
513
+
514
+ The facts line is `implicated<TAB>ambiguous<TAB>findings<TAB>blocking`. The two lists are
515
+ comma separated, or `-`. `findings` is the count. `blocking` is `1` or `0`.
516
+
517
+ ### Each outcome, and what happens next
518
+
519
+ The round ends in `groups/<gid>/status`, and one `rounds.tsv` row: round, epoch, status,
520
+ implicated tasks or `-`, QA spec. Status writes are atomic.
521
+
522
+ - **`PASS`.** The scheduler runs `_merge_group`: one `--no-ff` merge of `candidate.commit`
523
+ onto integration (`forge: merge group <gid> (ids)`). Every member is judged `PASS` (one
524
+ `attempts.tsv` row), its status becomes `PASS`, `merged` is touched, and the group's
525
+ `merged` is touched. A conflict sets the group and every member to `CONFLICT`, keeps
526
+ `conflict.files`, and merges nothing. Integration moved (`accepted.integration` does not
527
+ match) or dirty: the group is `INVALIDATED` with `integration-moved` or
528
+ `integration-dirty`, and nothing merges. A member whose branch tip is not its reviewed
529
+ commit, or whose worktree fingerprint is not `source.fingerprint`: those members are
530
+ `INVALIDATED` with `group-candidate`, and the group is `INVALIDATED` with
531
+ `candidate-moved`. A member that is no longer `IMPLEMENTED`, or a recomputed fingerprint
532
+ that does not match, invalidates the group with `candidate-moved` and merges nothing;
533
+ members are not marked `INVALIDATED` unless they moved. A member dependency that is not
534
+ `MERGED` blocks the merge and leaves the status unchanged. `forge group retry` on `PASS`
535
+ refuses; the next `run` merges it.
536
+ - **`FAIL`.** `_group_settle` writes each implicated member's `qa.last` (a header, the
537
+ blocks attributed to it, `Also involves:` when a finding names other members too, then
538
+ `FORGE_VERDICT: FAIL`), runs the QA gate, sets the status to `FAIL`, writes one judged
539
+ attempt row, runs `post_attempt`, and writes `settled.group` (`gid round`). A member that
540
+ is not implicated stays `IMPLEMENTED`: no `qa.last`, no attempt row, no gate. The group
541
+ writes `settled.round`. The scheduler requeues the `FAIL` members when `--retry-failed`
542
+ budget remains. Without it they stay `FAIL` and the others stay `IMPLEMENTED`. The next
543
+ round starts when the implicated members are `IMPLEMENTED` again. Settling the same round
544
+ twice does nothing. A `FAIL` that implicates no member settles nothing.
545
+ - **`NEEDS_DECISION`, ambiguous.** A blocking finding names no member. Members stay
546
+ `IMPLEMENTED`. `decision.md` starts `reasons: ambiguous`. The user names the members with
547
+ `forge group retry PLAN GID --tasks a,b`. That runs `_group_settle --tasks`, which fails
548
+ those members, each with the ambiguous findings (marked as assigned by a decision), and
549
+ also any member the review implicated by its own blocking finding, with only that. It moves
550
+ `decision.md` to `decision.<round>.md`, and sets the group to `FAIL`. The next `run
551
+ --retry-failed` retries those tasks. A live scheduler picks them up on its sweep when
552
+ they have budget left. Do this only when the user says so.
553
+ - **`NEEDS_DECISION`, oversized.** Refused by `forge group retry`. Split `groups.tsv` and
554
+ run `plan` again, or set that group's `review` to `task` and run `plan` again. The reason
555
+ word is the first token after `reasons:`. Only `oversized` and `ambiguous` are handled.
556
+ Any other reason is refused; read `decision.md`.
557
+ - **`UNKNOWN`.** No verdict. Members stay `IMPLEMENTED`. The scheduler reviews the group
558
+ again within `--retry-failed`, counted in `groups/<gid>/retries.used`. No member attempt
559
+ is spent. With the budget spent, the group stays `UNKNOWN`.
560
+ - **`INFRA`, `TIMEOUT`, `ERROR`, `INTERRUPTED`.** `INFRA` is dispatch exit 8: `infra.txt`
561
+ has `stage=qa` and the class, and no attempt is spent. `TIMEOUT` is exit 7. Any other
562
+ dispatch failure is `ERROR`. `forge group retry` on `UNKNOWN`, `INFRA`, `TIMEOUT`,
563
+ `INTERRUPTED` or `ERROR` sets the group status to `INTERRUPTED` and touches no member
564
+ file, so the next `run` reviews it again. `--tasks` is refused in those states. A review
565
+ that dies while `REVIEWING` is marked `ERROR`. A scheduler killed mid-review leaves
566
+ `REVIEWING`; the next `run` turns that into `INTERRUPTED` and reviews again, without
567
+ re-implementing the members.
568
+ - **`INVALIDATED`.** A tracked change to the candidate or to the review snapshot during the
569
+ review. An untracked file in the snapshot is not a change. Also the merge-time reasons
570
+ above. The next `run` reviews it again, unless `invalidated.reason` is
571
+ `integration-moved` or `integration-dirty`. `forge group retry` says the same and does
572
+ not rearm it.
573
+ - **`CONFLICT`.** `forge group retry` refuses. Two paths differ. A conflict while building
574
+ the candidate leaves the members `IMPLEMENTED`, and `retry` of an `IMPLEMENTED` task
575
+ exits 3, so the printed `forge-parallel.sh retry` line does not apply until a member is
576
+ no longer `IMPLEMENTED`. A conflict merging onto integration sets every member to
577
+ `CONFLICT`, and a `CONFLICT` task can be retried.
578
+ - **`WAITING`.** A member is not `IMPLEMENTED`. **`REVIEWING`.** A review is running.
579
+ Neither is retried with `forge group retry`.
580
+
581
+ ### Attempt accounting
582
+
583
+ Only a judged attempt writes an `attempts.tsv` row, and the cap counts those rows. An
584
+ `IMPLEMENTED` member spends nothing. A member a `FAIL` does not implicate spends nothing.
585
+ A re-review after `UNKNOWN`, `INFRA`, `TIMEOUT`, `INTERRUPTED` or `ERROR` spends no member
586
+ attempt. On `PASS`, every member gets one judged `PASS` row, including members the findings
587
+ did not name. A later `FAIL` of only some members records one `FAIL` row for each of those,
588
+ at the attempt number they are on. Separately, a task attempt left `STALE` (`prompt.md` or
589
+ `approach.md` changed while it ran) is not judged. `attempts.tsv` records `STALE`, and the cap
590
+ skips that row, as it skips `INFRA`.
591
+
592
+ ### Resume
593
+
594
+ `run` again does not re-implement a member left `IMPLEMENTED`. A `PASS` group is merged,
595
+ with no new QA dispatch; a stale member branch is not merged. An unsettled `FAIL` is
596
+ settled, then those members are requeued. `INTERRUPTED`, `INFRA` and `TIMEOUT` are reviewed
597
+ again. `INVALIDATED` is reviewed again unless the reason is `integration-moved` or
598
+ `integration-dirty`. `UNKNOWN` is reviewed again while the group's `--retry-failed` budget
599
+ remains; otherwise the status line is printed. `NEEDS_DECISION`, `CONFLICT` and `ERROR` wait
600
+ for a person. The summary says `forge: <id> is implemented, waiting for group <gid>
601
+ (<status>)` for a member still `IMPLEMENTED`. An empty group status is printed as
602
+ `not reviewed`. A dependent of an unmerged group stays `BLOCKED`.
603
+
604
+ ### Files in `groups/<gid>/`
605
+
606
+ `status` (then `PASS`, `FAIL`, `NEEDS_DECISION`, `UNKNOWN`, `CONFLICT`, `INFRA`, `TIMEOUT`,
607
+ `ERROR`, `INVALIDATED`, `WAITING`, or `REVIEWING`; `INTERRUPTED` is written by the scheduler
608
+ or by `forge group retry`), `round`, `rounds.tsv`, `candidate.base`, `candidate.commit`,
609
+ `members.tsv` (round, task, reviewed commit, attempt; one row per member of a round that
610
+ built a candidate), `fingerprint`, `combined.diff`, `members.paths` (`task<TAB>path`),
611
+ `attribution.json`, `qa.input`, `qa.last`, `qa.out`, `qa.gate`, `qa.round-<n>.last`,
612
+ `known_issues.md`, `infra.txt`, `decision.md`, `conflict.files`, `review.base`, `merge.out`,
613
+ `group.out` (the scheduler's log). Settle writes `settled.round`, `settle.tasks` (until the
614
+ round is settled) and `decision.<round>.md`. Merge writes `merged` and, when it refuses,
615
+ `invalidated.reason` (`integration-moved`, `integration-dirty`, `candidate-moved`).
616
+ `retries.used` counts `UNKNOWN` re-reviews. The candidate worktree stays at
617
+ `<wt_root>/_group-<gid>`.
618
+
619
+ On the member: `reviewed.commit`, `source.fingerprint`, `settled.group`, and
620
+ `invalidated.reason` of `group-candidate` when the member moved. Plan files: `groups.tsv`,
621
+ `groups.frozen`, `group_max_tasks`, `group_max_diff_kb`.
622
+
623
+ The dataset records `group_review` and `group_merge`. The QA dispatch has `scope` `group`
624
+ and an empty task, and it is left out of the per-task reviewer statistics. A judged member
625
+ attempt is linked with `review_scope=group`, `group` and `round`, and does not keep a copy
626
+ of that review's `qa.last` or `qa.gate`. See
627
+ [the dataset](dataset.md#raw-events-not-training-examples).
628
+
629
+ `forge group show PLAN [--group GID] [--json]` reads this. `forge group retry` is the
630
+ decision and the rearm above. Exit codes and flags are in
631
+ [commands](../docs/commands.md#the-forge-command).
632
+
633
+ ### Out of scope
634
+
635
+ - Shadow reviews of groups. A member skips shadow, and the group dispatch is one fresh QA.
636
+ - Fractal. `group review does not support Fractal yet`.
637
+ - A reviewer session across rounds. The group dispatch does not continue a session.
638
+ - Fail-first on a member. Pre-review tests still run, as above.
639
+
290
640
  ## Task size and acceptance criteria
291
641
 
292
642
  Size predicts a failed first attempt better than anything forge asks a model. In the run
@@ -640,6 +990,220 @@ gives verdict agreement with a 95% interval, the blocking findings only one side
640
990
  token and time ratio (see [the dataset reference](dataset.md#paired-reviews)). The export
641
991
  adds `shadow` and `consensus` to the matching review cases' metadata.
642
992
 
993
+ ## Retro notes (opt-in)
994
+
995
+ `plan --retro` makes each agent record what got in its way: a sandbox that blocked a command, a
996
+ tool that is not installed, an instruction it could not follow, a forge fault. A note says what
997
+ happened and who can fix it. Without a flag a plan keeps its earlier choice, and a first plan
998
+ takes the user setting (`forge config set retro on`). `plan --no-retro` turns it off.
999
+
1000
+ - **What an agent writes.** Most tasks have nothing to report, and a hard task is not a note.
1001
+ A note is one `FORGE_RETRO: {json}` line in the final message. The planner, QA and the
1002
+ whole-run review write it the same way. A dwarf blocked before it finishes also appends the
1003
+ same JSON to `.forge/retro-inbox.jsonl` in its worktree, which forge reads when the dispatch
1004
+ ends. The fields are `type` (`environment`, `sandbox`, `tooling`, `prompt`, `forge-bug` or
1005
+ `other`), `fixable_by` (`user`, `forge` or `unsure`), `summary`, `evidence` (the command, its
1006
+ exit code and the error, up to 2 KB), `blocking` and `tried`.
1007
+ - **Checked against the log.** forge looks for the note's command and the first line of its
1008
+ error in that dispatch's log. When both are there the note is `verified`; otherwise `claimed`.
1009
+ - **Orchestrator notes.** `forge retro note PLAN --type T --fixable-by F --summary S` records
1010
+ one note of the run's own, with `--command`, `--exit`, `--error`, `--blocking` and `--tried`
1011
+ as needed. It is always `claimed`, and it does not check the retro setting.
1012
+ - **Where it goes.** `<plan>/retro/notes.jsonl`, `tasks/<id>/retro.json` for a task, and one
1013
+ `retro_note` dataset event per note. `forge retro report PLAN` writes `<plan>/retro.md`.
1014
+ Notes with the same type and the same normalised command form one pattern; a note with no
1015
+ command is matched on its normalised summary instead. Each pattern
1016
+ goes to the group its majority `fixable_by` names: **You can fix this on this machine**
1017
+ (`user`), **forge should fix this** (`forge`), or **Not sure who should fix this** (`unsure`,
1018
+ also on a tie). A run prints one line with the pattern count and the path when there are any
1019
+ patterns. The first plan with retro on says what is recorded, once per user.
1020
+ - **Filing.** `forge retro issues PLAN` drafts one redacted issue per `forge` pattern, for
1021
+ forge's own repository, and posts nothing. The dry run prints the texts and their hash.
1022
+ `forge retro issues PLAN --apply --approve HASH` posts only when the hash matches those texts
1023
+ and the `--choice rN=new|comment:N|skip` choices. It needs an authenticated `gh`, and it
1024
+ refuses a never-send repository. Both refusals exit `3`.
1025
+ - **Never memory.** Notes never go into `.forge/memory.md` or the ledger, and no prompt reads
1026
+ them back. A retro plan does add a short instruction block to each prompt, at its end.
1027
+ - **Off.** With retro off (`--no-retro`, no setting, or `FORGE_RETRO=off`) no instruction is
1028
+ added to any prompt, the inbox is not read, and forge stores no note from a dispatch. Its
1029
+ prompts stay as they were without the feature. `forge retro note` still records a note when
1030
+ it is called, because it does not check the setting.
1031
+
1032
+ Files it adds: `retro_mode` (plan file), `retro/notes.jsonl`, `retro/.lock`, `retro.md`,
1033
+ `tasks/<id>/retro.json`, and `.forge/retro-inbox.jsonl` in a worktree (removed once its notes
1034
+ are stored). It costs no model call of its own.
1035
+
1036
+ ## Brief mode (opt-in)
1037
+
1038
+ With `plan --brief advisory|gated|strict --brief-model SPEC`, a read-only side dispatch writes
1039
+ the questions each task needs answered before it starts. Each question has a default. A task
1040
+ with no answer follows the default. The user answers with `forge brief answer`.
1041
+ A task-scoped answer goes into that task's prompt. A `wave` or `plan` answer stays parked
1042
+ until an approved proposal applies its diff. forge never answers for the user.
1043
+
1044
+ - **Cost.** One dispatch per task that has no `brief.json`, at effort `low`, four at a time.
1045
+ A reply that is not valid JSON, or has the wrong shape, is retried once; a second failure
1046
+ stores no questions and the reason in `brief.json`'s `error`. Answers, stale flags and
1047
+ `reject` call no model. A proposal is one more side dispatch, kind `brief-change`. Each
1048
+ unstarted task whose questions are regenerated is one more, kind `brief`. Both are read-only,
1049
+ at effort `low`, on the brief model.
1050
+ - **When.** `run` writes the missing briefs when it starts. `strict` waits for them; `advisory`
1051
+ and `gated` write them alongside the scheduler. `forge brief write PLAN [--task ID] [--jobs N]
1052
+ [--force]` does the same by hand, and `--force` redoes a task that already has a brief.
1053
+ - **Levels.**
1054
+ - `advisory`: the run does not wait. Open questions reach the prompt under "Open questions:
1055
+ follow the stated default", with each default.
1056
+ - `gated`: a task with an unanswered must-answer question is held. The run prints
1057
+ `forge: <task> waits for your answer to <qid>` with the `forge brief answer` line. A task
1058
+ whose brief is still being written waits too.
1059
+ - `strict`: `run` exits `3` before any task starts while a question of an unstarted task is
1060
+ open. It prints each question, its default and the answer command. Answer them and run again.
1061
+ - **Answers.** `forge brief answer PLAN TASK QID TEXT` (or `--file F`; `-` reads stdin). For a
1062
+ task-scoped question, an answer given before the task starts goes to `brief.answers.json` and
1063
+ into the prompt under "Decisions the user made", which overrides what the requirements say.
1064
+ After the task starts, that answer goes to `brief.late.json` and changes nothing in the run.
1065
+ The command then prints the `tasks.tsv` row, the `prompt.md` a follow-up needs, and the
1066
+ `forge control add` line that queues it.
1067
+ - **Scope.** `--brief-scope` is `task` (the default), `wave` or `plan`. The question's own
1068
+ scope decides what an answer may change. `task` writes the answer into that task. `wave` and
1069
+ `plan` questions are parked in `brief.parked.json` whatever `--brief-scope` says, and they
1070
+ change the plan only through a proposal you approve. Both scopes use the plan's
1071
+ [groups](#groups-and-group-review-opt-in). A wave proposal needs the question's group in
1072
+ `groups.tsv`. When the task belongs to a group, the question
1073
+ writer is told that group's title, goal and the other tasks in it. It asks `wave` when the
1074
+ answer would change how several tasks of the group are done, and `plan` when the answer
1075
+ would add, remove or split tasks, or change their order. A wave question from a grouped
1076
+ task records `"group": "<gid>"`. A plan question from a grouped task records `"group": null`.
1077
+ A task in no group keeps the prompt it had before groups, and its parked questions have no
1078
+ `group` key. With `--brief-scope wave` or `plan` and no `groups.tsv`, forge prints one note
1079
+ and goes on. `brief.groups.noted` keeps that note to once per plan. The note says to run
1080
+ `plan --groups waves`, or to let the planner write groups, because a wave question with no
1081
+ group stays parked. `gated` and `strict` still read only the task questions in `brief.json`.
1082
+ A parked question does not hold a task.
1083
+ - **Parked answers.** A parked question can be answered when the brief scope is at least as
1084
+ wide as the question. `wave` answers wave questions. `plan` answers wave and plan questions.
1085
+ `task` answers neither: the question id is unknown, and `answer` exits `2`. The answer goes
1086
+ to `tasks/<id>/brief.parked.answers.json` as `{qid: {text, actor, t}}`, including after the
1087
+ task has started. It is never a late answer, and it does not change a prompt. The command
1088
+ prints `forge brief propose PLAN TASK QID`. Nothing in the plan changes until that proposal
1089
+ is approved. `forge brief show` lists parked questions by group: `Group <gid> (<title>):`
1090
+ and the question, or `Group <gid>:` when the title is `-` or the group is gone, then
1091
+ `Plan:` for a plan question. A question with no `group` key stays under
1092
+ `Parked (wider scope):`.
1093
+ - **Proposals.** `forge brief propose PLAN TASK QID` asks the brief model what that parked
1094
+ answer changes, in one read-only side dispatch of kind `brief-change`, and stores the result
1095
+ under `proposals/<pid>/` (`p1`, `p2`, and so on). Each directory holds `proposal.json`,
1096
+ `diff.patch` (a unified diff of the plan files it would change) and `hash`. `state` is
1097
+ `proposed`, `refused`, `approved` or `rejected`. A reply that breaks the rules below, or
1098
+ that changes nothing, is stored as `refused` with its reason and its diff, and `propose`
1099
+ exits `3`. `apply` leaves a refused proposal where it is. A failed dispatch stores nothing.
1100
+ The question's scope is the proposal's scope: under `--brief-scope plan`, a wave question
1101
+ is still a wave proposal. A plan question needs `--brief-scope plan`, or `propose` refuses
1102
+ it. `forge brief proposals PLAN` lists every proposal, oldest first, with its state, scope,
1103
+ group, summary and diff. `--json` prints the same records. A `proposed` one also prints the
1104
+ exact `forge brief apply` line. `forge brief reject PLAN PID [--reason TEXT]` sets
1105
+ `rejected`. It touches no plan file. Only a `proposed` or `refused` proposal can be rejected.
1106
+ - **What each scope may change.**
1107
+ - `task`: the answer, as under Answers. There is no proposal.
1108
+ - `wave`: `prompt.md`, `approach.md` and the `files` column, and only for unstarted members
1109
+ of the question's group. The question must name a group that is in `groups.tsv`. A change
1110
+ that names another task, a started member, or any other field refuses the whole proposal.
1111
+ A wave question with no group cannot be proposed.
1112
+ - `plan`: the same three fields on any unstarted task, new tasks, removal of unstarted
1113
+ tasks, and new dependency lists for unstarted tasks. A split is a removal plus the added
1114
+ tasks, and every task that still depended on a removed one needs its deps rewritten in
1115
+ the same reply. An added task's group is null or an existing group id. Anything that
1116
+ would not be a plan `plan` could have written refuses the whole proposal. Between runs,
1117
+ an added row gets dwarf and qa `-`.
1118
+ - **Approve by hash.** `hash` is the sha256 of `diff.patch` and the current contents of every
1119
+ target. For a wave `files` change the target is that task's `tasks.tsv` row. For a plan
1120
+ change the hash also covers `tasks.tsv`, `groups.tsv` and every edited prompt or approach.
1121
+ `forge brief apply PLAN PID --approve HASH` must quote the hash `proposals` shows. A
1122
+ different hash, a state other than `proposed`, a target that has started, or a target that
1123
+ changed since the proposal, refuses the apply and writes nothing. After a target changes,
1124
+ propose again.
1125
+ - **Live and between runs.** While a scheduler is live, a wave proposal that changes only
1126
+ prompt and approach is written. The next attempt of an unstarted task reads those files.
1127
+ A wave proposal that changes `files` is refused while the run is live, and nothing is
1128
+ written: the scheduler keeps the files column it read at start. With no live run, a wave
1129
+ `files` change is written, `groups.frozen` is re-frozen (a stale marker left by a plan
1130
+ proposal stays stale), and `waves.tsv` is recomputed when that file already exists. A
1131
+ plan apply with no live run writes `tasks.tsv` and the task directories, and `groups.tsv`
1132
+ when membership changed. A removed task's directory moves to `tasks/.removed/<id>-<pid>/`.
1133
+ `groups.frozen` becomes the marker `stale: plan changed by proposal <pid>`, so `run`
1134
+ refuses until `forge-parallel.sh plan` validates, routes and freezes again. With a live
1135
+ run, a plan proposal that includes an edit, a removal or a dep change is refused, and
1136
+ nothing is written. A proposal that only adds tasks queues each one with
1137
+ `forge control add`, in dependency order. A task added that way joins no group. It needs
1138
+ dwarf and qa specs copied from a task that already has them. If a later add is refused,
1139
+ the tasks already queued stay, and the proposal is `approved` so it is not applied again.
1140
+ - **Affected tasks.** After a successful apply, every task the proposal changed or added, and
1141
+ every task that depends on a changed, added or removed task, directly or further down, gets
1142
+ `tasks/<id>/brief.affected`. The marker is `{pid, reason, t}`. `reason` is `changed`,
1143
+ `added` or `dependent`. An unstarted task's questions are regenerated, one brief dispatch
1144
+ each (`write --force`). An answer whose question text is still in the new brief is kept.
1145
+ Any other answer moves to `brief.answers.prev.json`. A task that has already started gets
1146
+ the same marker with `flag_only`, and its questions stay. `forge brief show` lists a marked
1147
+ task as `affected by <pid>`, and adds `flagged (already started)` when `flag_only` is set.
1148
+ `apply --no-regenerate` writes the same markers and does not dispatch. Regenerating one
1149
+ task later is `forge brief write PLAN --task ID --force`. The next approved proposal that
1150
+ touches a task replaces that task's marker. Earlier proposals stay in `proposals/`.
1151
+ - **Stale.** After a task merges, a merge that changed files outside that task's declared files
1152
+ flags the open questions of its dependents that have not started (`possibly_stale`). `forge
1153
+ brief stale PLAN TASK` does this by hand.
1154
+ - **Model.** `--brief-model SPEC` is required with brief on, and it must resolve; otherwise
1155
+ `plan` exits `2`. forge never picks the model.
1156
+ - **Privacy.** A never-send repository gets no brief dispatch (`never-send`), so its tasks have
1157
+ no questions and nothing holds them.
1158
+ - **Off.** With `--brief off`, no setting, or `FORGE_BRIEF=off`, there is no writer, no hold and
1159
+ no prompt addition. `forge-prompt.py` adds nothing without a `brief` file. `forge brief write`,
1160
+ `forge brief show` and `forge brief propose` exit `3` for such a plan.
1161
+
1162
+ Files it adds: the plan files `brief`, `brief_scope` and `brief_model`; `brief.out` (the
1163
+ writer's output), `brief.pid` (while the writer runs) and `brief.groups.noted` (once, when
1164
+ wave or plan scope has no groups); `proposals/<pid>/proposal.json`, `diff.patch` and `hash`;
1165
+ and per task `tasks/<id>/brief.json`, `brief.parked.json`, `brief.answers.json`,
1166
+ `brief.late.json`, `brief.parked.answers.json`, `brief.affected` and `brief.answers.prev.json`.
1167
+ A removed task's directory is moved to `tasks/.removed/<id>-<pid>/`. Its events are
1168
+ `brief_question`, `brief_answer`, `brief_diff` and `side_dispatch` (kind `brief` or
1169
+ `brief-change`). A `brief_diff` event is `{pid, scope, group, state, tasks}` and is written
1170
+ when a proposal is proposed, refused, approved or rejected. The approved event from a
1171
+ successful apply also carries `affected` and `flagged`, the task ids it marked.
1172
+
1173
+ ## Task summaries (opt-in)
1174
+
1175
+ `plan --summaries on --summaries-model SPEC` writes a short summary of each task to
1176
+ `tasks/<id>/summary.json`. The model sees only the task's facts: its status, its attempt trail
1177
+ (attempt, dwarf spec, verdict, findings count, worst severity, retry reason), the latest review's
1178
+ finding titles and severities, its known issues, and its dependencies and dependents. The facts
1179
+ are capped at 8 KB. The model never sees the repository, the diff or the task prompt.
1180
+
1181
+ - **Cost.** One read-only dispatch per task, at effort `low`, when its facts change. Unchanged
1182
+ facts are not dispatched again, because `inputs_hash` matches the stored summary. Each kind
1183
+ of side dispatch is capped per run at `max(10, 3 × tasks)`.
1184
+ - **When.** During `run`, the scheduler starts a detached `forge summarize PLAN --task ID` for
1185
+ each task whose status, dwarf reply, attempt trail, verdict or retry count changed since its
1186
+ last look. The first look at a task only remembers it. The scheduler never waits for a
1187
+ summary, and a failed one changes nothing in the run. On a finished run, `forge control set
1188
+ PLAN summaries on` starts `forge summarize` itself, with its output in `summaries.out`.
1189
+ - **Output.** `summary.json` holds `text`, `sentence`, `model`, `generated_at`, `inputs_hash`
1190
+ and `sources` (the attempts and findings the facts came from). The prompt asks for 3 to 5
1191
+ short lines. A reply that is not a JSON object with `text` and `sentence`, or whose text runs
1192
+ past 8 lines, is rejected: the previous `summary.json` stays and `summary.error` says why.
1193
+ - **Commands.** `forge summarize PLAN [--task ID] [--force] [--json]`. `--force` dispatches even
1194
+ when the facts did not change. `--json` prints one object per task: `task`, `status`, `reason`.
1195
+ `forge control set PLAN summaries on|off` sets the plan. `--task ID on|off|inherit` sets one
1196
+ task; its own `on` or `off` overrides the plan, and `inherit` drops that override.
1197
+ - **Model.** `--summaries-model SPEC` is required with summaries on, and it must resolve;
1198
+ otherwise `plan` exits `2`. Set a user default with `forge config set summaries.model SPEC`.
1199
+ - **Off.** With `--summaries off`, no setting, or `FORGE_SUMMARIES=off`, there is no dispatch and
1200
+ no `summary.json`.
1201
+
1202
+ Files it adds: the plan files `summaries` and `summaries_model`; `summaries.out`; and per task
1203
+ `tasks/<id>/summary.json`, `summary.error` (after a failed reply) and `tasks/<id>/summaries`
1204
+ (`on` or `off`, the task's override). Its events are `side_dispatch` (kind `summary`) and the
1205
+ `side_summary` role in the dataset.
1206
+
643
1207
  ## Severity, thresholds and known issues
644
1208
 
645
1209
  QA labels each finding `- [P0..P3][CONFIRMED|PLAUSIBLE] file:line — what breaks (input)`:
@@ -748,6 +1312,34 @@ as `retry` does (same findings carry-forward, same pinned base, same cumulative
748
1312
  tasks keep running; dependents wait for the task to merge. It applies per invocation (not
749
1313
  remembered), never to `TIMEOUT`/`ERROR`/`CONFLICT` or an `INVALIDATED` merge, and never after a retry that
750
1314
  changed nothing (`tasks/<id>/noretry`). Every entry is logged in `tasks/<id>/attempts.tsv`.
1315
+ An attempt that carries retry findings also gets one row in `tasks/<id>/retry_sources.tsv`:
1316
+ the attempt number, the source of those findings (`review`, `prereview`, `bounce`, `message`,
1317
+ `answer` or `prompt`) and the epoch time. A row for the same attempt replaces the earlier one, because an
1318
+ infrastructure stop refunds the attempt and its restart runs the same number again. forge-ui's
1319
+ attempt trail reads this file.
1320
+
1321
+ **A prompt edited during the attempt.** When `dwarf.input` is built, `prompt.md` and
1322
+ `approach.md` are copied to `prompt.dispatched` and `approach.dispatched`. A missing
1323
+ `approach.md` is an empty copy, and `prompt.dispatched` is written last: its presence is what
1324
+ says the pair is complete. If the copy fails, `prompt.dispatched` is removed and a later edit
1325
+ is not detected. An attempt from before those copies is not checked. Before review,
1326
+ if either file differs, the attempt is `STALE` and no review runs. `stale.diff` is the unified
1327
+ diff, `control.log` gets action `prompt-changed` with actor `scheduler`, and the console names
1328
+ the file and says no attempt was spent. The attempt counter is given back, as a dwarf-stage
1329
+ infrastructure stop is. The cap skips the `STALE` row, the escalation streak treats `STALE` as
1330
+ neutral, and no decision is written. Unless the run is stopping, the scheduler re-dispatches at
1331
+ once with `retry_findings.source` `prompt`. `retry_findings.md` is the new requirements plus
1332
+ that diff, and the next entry reuses the attempt number. `changes.diff` and
1333
+ `changes.prev.diff` are removed, so a re-dispatch that keeps the committed work is reviewed
1334
+ rather than refused as identical (`stale.diff` and `committed.diff` stay). A `STALE` task still
1335
+ waiting at the next `run` is prepared the same way, with no `--retry-failed` required and no
1336
+ retry counted. `forge control retry` accepts `STALE`; `--dwarf` is refused, because the same
1337
+ implementer gets the new text. A plain `forge-parallel.sh retry` does not take this path. The
1338
+ dataset attempt event has `prompt_changed` (true when the status is `STALE`). `forge dataset
1339
+ routing`, tiers and the forecast leave those attempts out,
1340
+ the same way they leave out a refunded or infrastructure stop. The `prompt` blob is
1341
+ `prompt.dispatched`, the text the implementer was given; an attempt from before the copy falls
1342
+ back to `prompt.md`. An empty `approach.dispatched` stores no approach blob.
751
1343
 
752
1344
  **Escalation after repeated failures.** In forge's history the first three attempts at a task
753
1345
  pass review at about the same rate (43%, 42%, 47%), and the fourth and later at 29%, whether
@@ -757,7 +1349,7 @@ turns it off):
757
1349
 
758
1350
  - **Counting:** the count is the task's failed attempts (FAIL, or an implementer TIMEOUT) on its current model,
759
1351
  from the fifth column of `attempts.tsv`, after the latest row of `tasks/<id>/decisions.tsv`.
760
- Infrastructure stops, missing verdicts and forge's own errors judge nothing and are skipped; a pass
1352
+ Infrastructure stops, missing verdicts, `STALE` attempts and forge's own errors judge nothing and are skipped; a pass
761
1353
  or a change of model resets it. A lateral move does not: the streak carries across `tasks/<id>/lateral.tsv`.
762
1354
  - **Escalation:** at the threshold, the next attempt goes to a different model in the next tier
763
1355
  up of the pools given to `plan` (same position in the pool, as with exploration),
@@ -787,6 +1379,28 @@ turns it off):
787
1379
  `resume` marker, or an unreviewed verdict, still matches the worktree). A marker the
788
1380
  next retry will discard is not that wait.
789
1381
 
1382
+ **A budget per model.** `plan --retry-per-model N` writes `retry_per_model` (`N` from 1 to 99).
1383
+ `--no-retry-per-model` removes it; a re-plan with neither keeps the file. A task may fail N
1384
+ times on the model it is on, then the next attempt moves one rung up the pools and the count
1385
+ starts again. With `escalate_effort` on, the same N applies to each effort of that model before
1386
+ the next effort. `forge-route.py escalation` uses `retry_per_model` as the trigger when the
1387
+ file is a number from 1 to 99, instead of `escalate_after`. When both files exist, `run` notes
1388
+ that retry-per-model replaces `--escalate-after` for this plan; the `escalate_after` file stays.
1389
+ Automatic retries still need `--retry-failed` above 0 (or a live `retry_budget` above 0): any
1390
+ positive budget turns the ladder on, and that number is not the limit. A person's
1391
+ `decided.left` replaces the ladder: a positive count retries even when `forge-route.py per-model`
1392
+ says no, and 0 does not. `retry=N` with `--dwarf` keeps the task on that model until the larger of N
1393
+ and the per-model count. `max_attempts`, the converging stop, `noretry`
1394
+ and `escalation.stop` still apply. `forge-route.py per-model` prints whether one task may be
1395
+ attempted again (`retry`, `rung`, `failed_on_rung`, `rungs_left`, `per_model`; exit 2 when the
1396
+ plan has no valid file). `worst-case` is the unmerged tasks' dispatches (implementer, reviewer,
1397
+ and shadow reviews when those are on) and the tasks whose `N` times rungs exceed
1398
+ `max_attempts`. The plan table prints `retry per model: N`, `worst case with retry-per-model N:
1399
+ X dispatches`, and `max-attempts … stops these tasks before the top of their ladder` for that
1400
+ last list. Pools `low`, `medium` and `high` with N=3 give a task that starts on `low` up to 9
1401
+ implementer attempts, bounded by `--max-attempts` (default 8). A `script` implementer has no
1402
+ rungs above it; its worst-case implementer count is 0.
1403
+
790
1404
  History cannot yet say whether escalating rescues a task (31% of the 29 later attempts on a
791
1405
  changed spec passed, mostly effort bumps); the attempts this policy makes are what will.
792
1406
 
@@ -811,13 +1425,39 @@ Task and solo reviews are asked to list every CONFIRMED finding, and to say so p
811
1425
  diff is correct, so a round is the whole list and not only the worst few.
812
1426
 
813
1427
  The task then stops with status **`NEEDS_DECISION`**. So does a task the retry policy cannot
814
- escalate further (reason `split`; `split.suggested` still names the suggestion), and a task at its
815
- attempt cap (reason `cap`). The cap is `plan --max-attempts N`, default **8** when `max_attempts`
816
- is absent, counted across runs: an infrastructure stop spends nothing, and each `retry=N` a person
817
- grants adds N to the cap. `0` is no cap, and a grant does not create one. `forge control set max-attempts N --confirm`
1428
+ escalate further (reason `split`; `split.suggested` still names the suggestion), a task at its
1429
+ attempt cap (reason `cap`), and a `FAIL` whose every blocking finding needs a file the task does
1430
+ not declare (reason `plan`). The cap is `plan --max-attempts N`, default **8** when `max_attempts`
1431
+ is absent, counted across runs: an infrastructure stop spends nothing, a `STALE` attempt spends
1432
+ nothing, and each `retry=N` a person grants adds N to the cap. `0` is no cap, and a grant does not create one. `forge control set max-attempts N --confirm`
818
1433
  changes it; `--confirm` applies only to that key. A `NEEDS_INPUT` task at the cap keeps its question:
819
1434
  raise the plan's cap before the answer can start an attempt.
820
1435
 
1436
+ **Reason `plan`.** After a judged `FAIL`, and before the escalation check, the task stops when
1437
+ `qa.last` holds a real `PASS` or `FAIL` verdict, at least one finding blocks at the task's
1438
+ threshold, every blocking finding carries `{outside=…}`, and `forge_owner.py` says none of
1439
+ those paths is covered by this task's declared files (a declaration of `.` covers every path;
1440
+ `files` of `-`, or an unknown task, leaves every path outside). A `PLAUSIBLE` finding never
1441
+ blocks, and a finding milder than the threshold does not. The check writes
1442
+ `tasks/<id>/outside.json`: a JSON list of `{path, owner, owners, owner_status}`. `owner` is the
1443
+ task that declares the path, or null when none does; `owners` is every such task; `owner_status`
1444
+ is `MERGED` when that task has `merged`, otherwise the text of its `status`, or `PENDING` when
1445
+ it has none, and null when there is no owner. If that does not hold, `outside.json` is removed
1446
+ and escalation runs as usual. `decision.md` lists each path as `path — declared by <id> (<status>)`
1447
+ or `path — declared by no task`, then the plan choices, which edit `tasks.tsv`: add the path to
1448
+ this task's `files`, make this task depend on the owner (edit its `deps`), or merge the two
1449
+ rows into one task. Then `forge-parallel.sh plan <plan>` again when no run is live, and
1450
+ `forge-parallel.sh retry <plan> <id> --decide retry=1 --reason "…" --approved`. The usual
1451
+ choices (more attempts, a threshold, a named model, accept, split) stay listed. This `FAIL`
1452
+ counts toward the cap. It does not escalate, and `--retry-failed` does not re-queue
1453
+ `NEEDS_DECISION`, so it spends no further attempt on the model. The reviewer's `{outside=…}`
1454
+ is what stops the task. The implementer is told not to edit a file outside its `files`, and to
1455
+ end with `FORGE_BLOCKED: <path>: <why>`, one line per path. Those lines are copied into
1456
+ `qa.input` as a claim ("The implementer says these fixes need files outside the task"), for the
1457
+ reviewer to confirm with `{outside=<path>}` or refute. Task, solo and group reviews are taught
1458
+ the brace; sweep, adopt and final reviews are not. The brace is its own, immediately before the
1459
+ facts brace: `- [P1][CONFIRMED] path/file.py:123 — {outside=a.py,b.py} {reach=main origin=new evidence=ran}`.
1460
+
821
1461
  `tasks/<id>/decision.md` gives the reasons and the choices. Nothing else resumes the task: not a
822
1462
  re-run, not `--retry-failed`, not a retry budget and not a pin. A plain `retry` exits 2.
823
1463
 
@@ -868,7 +1508,9 @@ The choices:
868
1508
  ([below](#accepting-splitting-combining-and-the-whole-run-review)).
869
1509
 
870
1510
  A live scheduler takes the same decision as `forge control retry <plan> <id> --decide …` (or
871
- `--dwarf`), with `--reason` and `--approved`; that only queues the request. The answer is appended
1511
+ `--dwarf`), and an accept as `forge control accept <plan> <id>`, each with `--reason` and
1512
+ `--approved`; that only queues the request. An accepted task merges and its dependents start in
1513
+ the same run (#138). The answer is appended
872
1514
  to `tasks/<id>/decisions.tsv` (epoch, attempt, choice, reason). The run summary lists these tasks
873
1515
  under `waiting for your decision:`. A run that ends with such a task unmerged exits 5.
874
1516
 
@@ -913,20 +1555,26 @@ Five more commands steer a live scheduler (exit 3 when none is live):
913
1555
  file in `control.requests/`. At its next pass the scheduler applies or refuses it and appends
914
1556
  an outcome line to `control.log` with the same `request` id (`actor` `scheduler`, `outcome`
915
1557
  `applied|refused`, `reason`). `retry` takes a `FAIL`, `UNKNOWN`, `TIMEOUT`, `ERROR`,
916
- `BLOCKED` or `INTERRUPTED` task that is neither running nor waiting, prepares it exactly as
917
- `forge-parallel.sh retry` does. A `NEEDS_DECISION` task is resumed only by `--decide` or
918
- `--dwarf`, each with `--reason` and `--approved`. It spends no automatic retry budget; an
919
- `INFRA` task is the scheduler's own to resume. `add` takes a row the human appended to `tasks.tsv` (with its
1558
+ `BLOCKED`, `INTERRUPTED` or `STALE` task that is neither running nor waiting. A `STALE`
1559
+ task is re-dispatched with the changed prompt on the same implementer, and `--dwarf` is
1560
+ refused. The others are prepared exactly as `forge-parallel.sh retry` does. A
1561
+ `NEEDS_DECISION` task is resumed only by `--decide` or `--dwarf`, each with `--reason` and
1562
+ `--approved`. It spends no automatic retry budget; an `INFRA` task is the scheduler's own
1563
+ to resume. `add` takes a row the human appended to `tasks.tsv` (with its
920
1564
  `tasks/<id>/prompt.md`) whose dependencies this run already knows, and refreshes `waves.tsv`.
921
1565
  A request never outlives the scheduler that was live when it was queued; one left behind is
922
1566
  refused, and every request is refused once the run is stopping.
923
1567
 
924
1568
  **Ordinary execution resume:** run `run` again. Tasks already `MERGED` are skipped. A saved PASS is fingerprint-checked and merged without
925
1569
  redispatch. PENDING, `INFRA` (paused by an infrastructure failure) and newly unblocked tasks run
926
- when eligible. A `NEEDS_DECISION` task is not among them: only a decision resumes it. Failed or interrupted tasks
1570
+ when eligible. A `STALE` task still waiting is prepared with the new prompt and spends nothing.
1571
+ A `NEEDS_DECISION` task is not among them: only a decision resumes it. Failed or interrupted tasks
927
1572
  require an explicit `retry` (or `--retry-failed N`); `run` never silently pays for them again. Worktrees and pinned
928
1573
  baselines are retained. A per-plan advisory lock excludes concurrent run/retry/integrate
929
- operations.
1574
+ operations. A `review=group` member left `IMPLEMENTED` is not implemented again; its group's
1575
+ review resumes as in [Groups and group review](#groups-and-group-review-opt-in).
1576
+
1577
+ From another session or harness, `forge handoff resume <plan>` follows a live scheduler and restarts a stopped run with its recorded flags; see [From another session or harness](../docs/decomposed-runs.md#from-another-session-or-harness). The `run` and per-task `retry` above remain the way to finish by hand.
930
1578
 
931
1579
  **Interrupts.** A SIGINT or SIGTERM to `run` (or to its scheduler), and `forge control stop
932
1580
  --now`, first reap the tasks that already ended (a PASS still merges), then send TERM to each
@@ -1112,14 +1760,81 @@ Four subcommands act on plans after tasks have run. Full usage and refusal condi
1112
1760
  `split`/`combine` hold the plans' advisory locks for their whole duration, and every failure path
1113
1761
  removes what it created.
1114
1762
 
1763
+ ## Chained plans
1764
+
1765
+ `plan <dir> --after <prev>` starts `<dir>` from an earlier plan's integration branch. `<prev>`
1766
+ is that plan's directory. See the [plan flags](../docs/commands.md#scriptsforge-parallelsh).
1767
+
1768
+ `plan` writes `<prev>`'s absolute path to `after` and the starting commit to
1769
+ `integration.base`, and creates `forge/<run>-integration` at `<prev>`'s
1770
+ `accepted.integration`. A branch that already points at that commit is kept. The approval
1771
+ table prints `after: <run> (<base>)`, with the first 12 characters of that commit. A later `plan` of the same directory without `--after` keeps the
1772
+ files and the branch. A chained plan skips the warning about uncommitted changes in the
1773
+ repository: its worktrees start from the previous plan's accepted tip.
1774
+
1775
+ `<prev>` has to be a plan of the same repository. Every refusal below is exit 2, and it leaves
1776
+ the plan directory and the branches as they were:
1777
+
1778
+ - `<prev>` is not a directory, `--after` was given no directory, or the directory has no
1779
+ `tasks.tsv`, `run_id` and `repo`
1780
+ - the plan would come after itself
1781
+ - the two plans belong to different repositories
1782
+ - a task of `<prev>` is not `MERGED`
1783
+ - `forge/<prev-run>-integration` is missing, `<prev>` has no `accepted.integration`, or the
1784
+ branch tip is not that accepted commit. Extra commits on the branch are adopted into
1785
+ `<prev>` first (`forge-parallel.sh adopt <prev> --head --reason "…"`)
1786
+ - `<prev>`'s scheduler is live (`scheduler.live` names a pid that is still running)
1787
+ - this plan's own `forge/<run>-integration` is at another commit: it is checked out, it is
1788
+ not still at the recorded `integration.base`, or this plan already has merged work
1789
+
1790
+ Before any merge, a different `--after` moves the branch when it is still at its old
1791
+ `integration.base` and is not checked out. After a task has merged, a different `--after`
1792
+ is the same exit 2, and the recorded base stays.
1793
+
1794
+ `run` checks again while no task of this plan has merged. If `<prev>` has no
1795
+ `accepted.integration`, `run` notes that and goes on. Otherwise that commit must be an
1796
+ ancestor of this plan's `integration.base`. If `<prev>` moved, `run` exits 3, dispatches
1797
+ nothing, and tells you to run `plan <dir> --after <prev>` again. Planning again with the
1798
+ same `--after` records the new tip. A plan split from a chained plan starts later than
1799
+ `<prev>` ended; the old tip is still an ancestor, so the check passes. Once a task of this
1800
+ plan has merged, `run` does not check again.
1801
+
1802
+ `integrate` merges this plan's integration branch, which already holds every plan it follows,
1803
+ and prints `this brings plans A → B → C` with the run ids, oldest first. A predecessor
1804
+ that cannot be read, or a chain longer than 64, makes that line start with `…`. A plan
1805
+ with no `after` file prints no such line.
1806
+
1807
+ `forge runs` puts `after <run>` on the plan's summary line. `<run>` is the predecessor's run
1808
+ id, or its key when that directory is gone. forge-ui shows After, a link to the plan this run
1809
+ follows, and Followed by, the plans whose `after` names this run.
1810
+
1115
1811
  ## Branches, worktrees, cleanup
1116
1812
 
1117
1813
  ```
1118
1814
  <plan-dir>/tasks/<id>/approach.md intended approach, if planned
1815
+ <plan-dir>/retry_per_model failures on each model before the next rung (1-99); absent leaves escalate_after
1816
+ <plan-dir>/tasks/<id>/prompt.dispatched prompt.md as given to the implementer; written last at dispatch
1817
+ <plan-dir>/tasks/<id>/approach.dispatched approach.md as given; empty when there was none
1818
+ <plan-dir>/tasks/<id>/stale.diff unified diff when prompt.md or approach.md changed during the attempt
1819
+ <plan-dir>/tasks/<id>/outside.json paths a plan stop named, with owner, owners and owner_status
1119
1820
  <plan-dir>/tasks/<id>/risk low|medium|high, recorded only (#122), if rated
1821
+ <plan-dir>/groups.tsv id, review, qa, members, title, goal; absent unless groups are on
1822
+ <plan-dir>/groups.frozen sha256 of the six columns, then each member's deps and files
1823
+ <plan-dir>/group_max_tasks, group_max_diff_kb review-group bounds; defaults 6 and 256 when the file is absent
1824
+ <plan-dir>/groups/<gid>/ one review=group group's review; see Groups and group review
1825
+ <plan-dir>/tasks/<id>/reviewed.commit commit a review=group member stopped at (also a task review's)
1826
+ <plan-dir>/tasks/<id>/source.fingerprint worktree fingerprint beside that commit
1827
+ <plan-dir>/tasks/<id>/settled.group gid and round, once a group FAIL judged this member
1828
+ <plan-dir>/tasks/<id>/retry_sources.tsv attempt, source, epoch: why each retried attempt ran (#133)
1829
+ <plan-dir>/run.flags.json flags of this run of the plan, rewritten at each real start; not copied by split or rerun
1830
+ <plan-dir>/handoff.notes.jsonl session notes of what is not on disk: at, actor, text; newest first in forge handoff
1831
+ <plan-dir>/handoff.driver.json harness, session, since, last_seen of the session driving the run
1832
+ <plan-dir>/tasks/<id>/interrupted-<epoch>.diff uncommitted work saved before forge handoff resume resets a stale RUNNING worktree
1833
+ <plan-dir>/resume-<epoch>.{log,done} log of the run forge handoff resume started, and its exit code once that run ends
1120
1834
  <repo>/.forge/ project memory (survives the run)
1121
1835
  <repo>/../.forge-worktrees/<run-id>/<task-id> task worktree
1122
1836
  <repo>/../.forge-worktrees/<run-id>/_integration integration worktree
1837
+ <repo>/../.forge-worktrees/<run-id>/_group-<gid> group-review candidate; kept for the merge
1123
1838
  forge/<run-id>/<task-id> task branch
1124
1839
  forge/<run-id>-integration integration branch
1125
1840
  ```
@@ -1213,7 +1928,13 @@ The user's own branch and working tree are untouched for the whole run.
1213
1928
  | task status `FAIL` with "produced no changes" | the dwarf ended without editing anything — usually an ambiguous prompt it could not resolve headlessly |
1214
1929
  | task status `UNKNOWN` | QA never emitted a verdict line; read `tasks/<id>/qa.last`. `retry` re-runs QA only, on the unchanged work |
1215
1930
  | task status `INFRA`, `run` exits `8` | an infrastructure stop; the cause is in the summary and `tasks/<id>/infra.txt`. No attempt spent. Fix a "needs you" line before re-running; otherwise re-run, or wait with `--infra-retries M`. See [Infrastructure failures](#infrastructure-failures) |
1216
- | task status `NEEDS_DECISION` | reviews are not converging, the retry policy has no stronger model, or the attempt cap is spent. Read `tasks/<id>/decision.md`. Only a decision resumes it |
1931
+ | task status `NEEDS_DECISION` | reviews are not converging, the retry policy has no stronger model, every blocking finding needs a file the task does not declare (reason `plan`), or the attempt cap is spent. Read `tasks/<id>/decision.md`. Only a decision resumes it |
1932
+ | task status `STALE` | `prompt.md` or `approach.md` changed during the attempt. Not reviewed, and no attempt spent. The scheduler re-dispatches it with the new text; so does `forge control retry`. See [Retrying, and resuming an interrupted run](#retrying-and-resuming-an-interrupted-run) |
1933
+ | task status `IMPLEMENTED` | a `review=group` member finished implementing and waits for its group's review. `retry` and `accept` exit 3. See [Groups and group review](#groups-and-group-review-opt-in) |
1934
+ | group status `NEEDS_DECISION` | the combined diff is over `group_max_diff_kb`, or a blocking finding names no member. Read `groups/<gid>/decision.md`. `forge group show` prints it; `forge group retry --tasks` only on the user's word, and only for an ambiguous decision |
1935
+ | a group left `INFRA`, `TIMEOUT` or `INTERRUPTED` | the review did not finish. The next `run` reviews it again. `forge group retry` rearms it to `INTERRUPTED`. No member attempt was spent |
1936
+ | a group left `UNKNOWN` | no verdict. The next `run` reviews it again while `--retry-failed` budget remains; otherwise it stays. `forge group retry` rearms it. No member attempt was spent |
1937
+ | a group left `ERROR` | the dispatch failed, or the review ended while still `REVIEWING`. The next `run` leaves it. `forge group retry` rearms it to `INTERRUPTED`. No member attempt was spent |
1217
1938
  | task status `INTERRUPTED`, `run` exits `130` | the run was signalled or stopped with `forge control stop --now`; verification was skipped. The summary prints `forge-parallel.sh retry <plan> <id>` for each one; a plain `run` does not dispatch them |
1218
1939
  | a run that sits idle with tasks `PENDING` | `forge control drain` is in effect (`forge control show` says `drained`; `forge control resume` continues), every scope a task needs is paused on infrastructure (`infra.paused`), or `max-parallel` is lower than you think |
1219
1940
  | a `FAIL` task merged anyway | the threshold (`P2` by default) tolerated its findings, or a person ran `accept`; see `known_issues.md` and `qa.gate` |