@giamme/forge 0.16.0 → 0.17.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 (38) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/VERSION +1 -1
  3. package/docs/dataset.md +8 -0
  4. package/docs/reviews.md +15 -1
  5. package/package.json +1 -1
  6. package/references/dataset.md +124 -5
  7. package/references/decision-models.md +15 -2
  8. package/references/decompose.md +46 -10
  9. package/references/planning.md +3 -2
  10. package/scripts/forge-contract.py +52 -1
  11. package/scripts/forge-issues.py +4 -3
  12. package/scripts/forge-ledger.py +3 -1
  13. package/scripts/forge-lib-adopt.sh +7 -1
  14. package/scripts/forge-metrics.sh +22 -0
  15. package/scripts/forge-parallel.sh +3 -1
  16. package/scripts/forge-plan-check.py +25 -2
  17. package/scripts/forge-planner.py +20 -6
  18. package/scripts/forge-shadow.py +28 -9
  19. package/scripts/forge-sweep.py +25 -10
  20. package/scripts/forge_dataset/cli.py +83 -0
  21. package/scripts/forge_dataset/facts.py +278 -0
  22. package/scripts/forge_dataset/harvest.py +16 -3
  23. package/scripts/forge_dataset/outcomes.py +206 -58
  24. package/scripts/forge_dataset/pairs.py +174 -0
  25. package/scripts/forge_dataset/risk.py +108 -0
  26. package/scripts/forge_dataset/tiers.py +427 -0
  27. package/scripts/forge_decide/cli.py +23 -2
  28. package/scripts/forge_decide/labels.py +30 -6
  29. package/scripts/forge_decide/replay.py +10 -4
  30. package/ui/docs/api.md +12 -3
  31. package/ui/forge_ui/export.py +9 -2
  32. package/ui/forge_ui/findings.py +4 -2
  33. package/ui/forge_ui/reader.py +71 -4
  34. package/ui/forge_ui/server.py +8 -0
  35. package/ui/forge_ui/static/app.js +6 -1
  36. package/ui/forge_ui/static/diffview.js +7 -3
  37. package/ui/forge_ui/static/panel.js +43 -2
  38. package/ui/forge_ui/static/style.css +1 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and versions follow the format `{major}.{minor}[.{patch}]` ([...] parts appear only when non-zero).
7
7
 
8
+ ## [0.17] - 2026-11-11
9
+
10
+ Measure reviews and routing: outcomes recorded at the end of every run, finding facts, paired reviews, task risk and a look inside each difficulty tier, all in shadow; plus adoption fixes.
11
+
12
+ ### Added
13
+
14
+ - forge-ui: each adopted range listed above the final review now opens its review (verdict, gate, findings, what a person kept, the reviewer's reply and prompt) and the range's diff with the findings pinned, through `/api/runs/<key>/adoptions/<name>` and its `/diff`. An export includes them, and keeps each adoption's reason private unless texts are included (#131).
15
+ - Outcomes are now recorded without anyone running `forge dataset outcomes`: the end of every `run` and `integrate` harvests that repository, bounded by `FORGE_OUTCOMES_TIMEOUT` (default 20 s), never changing the exit code, and off with `FORGE_OUTCOMES=off`. The harvest also follows work where it went: an integration whose branch a pull request merged and deleted is measured on the branch it landed in, and so is a run whose integration branch was merged by hand. `forge dataset status` shows the outcomes recorded and when they were last harvested (#120).
16
+ - Reviewers now end each finding with three facts: its reach (main path, realistic or unusual), its origin (new in this change or already there) and their evidence (ran it, traced it or suspected). The facts are recorded in shadow. No verdict changes, and `forge issues`, the ledger and forge-ui read a finding with them exactly as one without. forge-ui shows them beside each finding in the diff. The new `forge dataset facts` command reports how often two reviewers of one attempt agree on reach compared with severity. It also replays candidate rules on past reviews, such as "unusual reach does not block unless P0" and "existing problems do not block", and lists the findings each rule would have let through (#119).
17
+ - A shadow review (`--shadow-qa`) no longer repeats its primary's exact settings when another listed spec differs. If every listed spec is identical to the primary, the shadow still runs but is labelled a control, so it measures noise and never counts as an effort comparison. The new `forge dataset pairs` command groups paired reviews by what differs between the two reviewers: effort within one model, another model, another family, or nothing (controls). For each pair of settings it reports verdict agreement with a 95% interval, the blocking findings only one side found, and how many times the tokens and time each side used. Listing a reviewer's own model at another effort, such as `--shadow-qa sol:medium` beside `sol:high` reviewers, now measures what that effort buys (#121).
18
+ - A task can now carry a risk rating, separate from its difficulty: what a mistake that gets through would cost. The planner rates it, or you write `low`, `medium` or `high` to `tasks/<id>/risk` before `plan`. It is recorded in shadow. No model, reviewer or verdict changes, `tasks.tsv` keeps its columns, and a plan without ratings behaves as before. The new `forge dataset risk` command shows tasks by difficulty and risk together: how often the two ratings differ, and, per pair, first-try passes, serious findings and landed work that did not hold. The docs now say that reviewer tiers follow difficulty (#122).
19
+ - The new `forge dataset tiers` command looks inside each difficulty tier before anyone adds a tier. It sets plan-time facts (declared files, dependencies, wave, prompt size) against first-try passes, attempts and unfinished tasks. Each fact is tested on runs the split never saw, and adjusted for the implementer, so a weaker model mix is not read as harder tasks. Facts known only after the attempt, such as the diff size, are reported apart. `--sample` writes past prompts for a blind re-rating, and `--blind` reports how often that rating matches the recorded tier. Nothing in a run changes (#123).
20
+ - `forge decide replay --label first-attempt` judges the stored drift answers on the 2026-10-16 label: a file counts as drift when attempt 1 edited it, whether or not that attempt passed. It sends nothing and records nothing, so promotion still reads the site's own label. The replay report now also shows an inverted gate's threshold as it is configured, such as `prompt_warn 0.55 (inverted: a score at or above 0.45)`, instead of `0.44999999999999996` (#101).
21
+
22
+ ### Changed
23
+
24
+ - `run --sweep` now fixes what an adopted range's review tolerated, with the adoption's reviewer reviewing the fix, where it used to drop those findings for want of a model. Findings a person kept (`accept`, or `adopt --approved`) are still never swept, and the sweep plan now lists them as `accepted` instead of leaving them out silently (#131).
25
+ - `adopt`'s reviewer is now told the run's verification command (or its lanes' commands), so it can run the parts that touch the adopted range. Verification itself still runs after the review, as before (#131).
26
+
8
27
  ## [0.16] - 2026-11-06
9
28
 
10
29
  forge-ui gets a Worktrees screen and a Projects screen with each repository's runs, findings and memories, and a live refresh no longer cancels what you were doing. A stopped run can be steered by hand: adopt brings in a commit made outside forge, and retry --no-dispatch resumes several tasks side by side. Reviewers get the attempt's dependencies and say whether their tests ran, and a timeout now stops the test servers a harness started.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16
1
+ 0.17
package/docs/dataset.md CHANGED
@@ -15,6 +15,10 @@ forge dataset import ~/.local/share/forge/legacy # runs that predate live capt
15
15
  forge dataset export # labeled decision cases for benchmarks and fine-tuning
16
16
  forge dataset outcomes # which integrated lines survived, read from git history
17
17
  forge dataset reviewers # how often work each reviewer PASSed was later reverted or rewritten
18
+ forge dataset risk # tasks by difficulty and risk together: do they differ, how did each pair fare
19
+ forge dataset tiers # what explains results inside each difficulty tier, and how noisy the rating is
20
+ forge dataset pairs # two reviewers of one attempt: what another effort, model or family found and cost
21
+ forge dataset facts # findings' reach, origin and evidence: do reviewers agree, would a gate on them help
18
22
  forge dataset forecast <plan> # likely tokens, time and first-try PASS rate for a plan's tasks
19
23
  ```
20
24
 
@@ -23,6 +27,10 @@ advisory only and never changes routing, and it shows "not enough data" below 10
23
27
  reviewer rather than a rate a handful of tasks would make up. See
24
28
  [the reviewer report card](../references/dataset.md#reviewer-report-card).
25
29
 
30
+ `forge dataset facts` measures the three facts reviewers add to each finding (reach, origin,
31
+ evidence) before any gate uses them: agreement between two reviewers of one attempt, and what
32
+ rules on them would have changed. See [finding facts](../references/dataset.md#finding-facts).
33
+
26
34
  `forge dataset forecast <plan>` estimates a plan from past tasks at the same tier and model:
27
35
  median and p90 tokens and time, and the first-try PASS rate with a 95% interval, per task and in
28
36
  total. It flags tasks below 50% and says "not enough history" under 5 past tasks. `run` prints
package/docs/reviews.md CHANGED
@@ -174,6 +174,17 @@ decision `fail`), and the next attempt starts with a note saying why.
174
174
  It fails safe: an unlabelled CONFIRMED finding, or a FAIL with no CONFIRMED finding at all,
175
175
  is never tolerated.
176
176
 
177
+ Every finding also ends its first line with three facts, `{reach=main|realistic|unusual
178
+ origin=new|existing evidence=ran|traced|suspected}`: how likely the trigger is, whether this change
179
+ introduced the problem, and how the reviewer knows. They are **recorded in shadow** and decide
180
+ nothing: the gate, `forge issues`, the ledger and forge-ui read a finding with the suffix exactly as
181
+ one without it, and a missing or malformed suffix changes nothing. They go to the run dataset, and
182
+ `forge dataset facts` says whether a gate on them would do better than the severity line alone: how
183
+ often two reviewers of one attempt agree on reach versus severity (with `--shadow-qa`), and how many
184
+ reviews and rounds rules such as "unusual reach does not block unless P0" or "existing problems do
185
+ not block" would have changed, listing the findings they would have let through so a person can
186
+ judge them. See [the dataset reference](../references/dataset.md#finding-facts).
187
+
177
188
  Tolerated findings are recorded, not fixed. After a run, the skill offers once to file them as
178
189
  GitHub issues, together with PLAUSIBLE findings of passed tasks and whatever a whole-run review
179
190
  left open (`--file-issues ask|auto|off`, `ask` by default). Where the
@@ -334,7 +345,10 @@ family than the task's. Its verdict goes to the run dataset and nothing in the r
334
345
  so it never changes a status, merge, memory or retry. `forge dataset status` then reports how
335
346
  often the two reviewers agree, overall and per model pair. The table shows the extra reviews
336
347
  before you approve. The shadow runs beside the main review and is stopped soon after that
337
- finishes, so the most it costs is reviews and a little latency. See
348
+ finishes, so the most it costs is reviews and a little latency. To measure what reviewer effort
349
+ buys, list the reviewers' own model at another effort (`--shadow-qa sol:medium` beside `sol:high`):
350
+ `forge dataset pairs` reports those pairs apart from model and family comparisons, and a shadow
351
+ identical to its primary is recorded as a control, never as an effort comparison. See
338
352
  [decomposition](../references/decompose.md#shadow-reviews-opt-in).
339
353
 
340
354
  ## Implementer guards
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giamme/forge",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Multi-model coding with a reviewer that reads the code: plan, build in parallel worktrees, review every real diff, merge only what passes.",
5
5
  "keywords": ["claude-code", "codex", "opencode", "agent-skill", "code-review", "multi-model"],
6
6
  "license": "MIT",
@@ -48,7 +48,7 @@ time order: an attempt that PASSed, then a merge that CONFLICTed, then a human `
48
48
  | `ledger` | ledger row | imported `.forge/ledger.tsv` rows |
49
49
  | `forecast` | forecast shown by `run` | the plan forecast printed before dispatch (see [plan forecast](#plan-forecast)), once per run and content. Also in the plan as `forecast.json` |
50
50
  | `comparison` | `forge runs compare` | two runs of one plan side by side: `a` and `b` each with the run's uid, run id, starting commit and per-task status, attempts, tokens, time and diff size, and a `summary` (tasks merged in both, only in one, in neither). One event per pair and content; the event's run is the second one. Descriptive: nothing routes on it |
51
- | `outcome` | integrated task, per horizon | written by `forge dataset outcomes`, never by a run: how many of the lines a task added survive N days after `integrate`, and what reverted it |
51
+ | `outcome` | integrated task, per horizon | written by `forge dataset outcomes`, which the end of every `run` and `integrate` also runs for its repository: how many of the lines a task added survive N days after it landed, and what reverted it |
52
52
 
53
53
  An attempt that forge sent back without a review keeps the status `FAIL` in the dataset, and
54
54
  `sent_back` says what sent it back (`prereview`, `bounce` or `message`). `attempts.tsv` names the
@@ -160,9 +160,14 @@ forge still running keeps writing.
160
160
  ./forge dataset blob <sha> # print one stored blob
161
161
  ./forge dataset import <dir|archive|legacy-dir>... [--registry] [--fractal] [--ledger REPO] [--dry-run]
162
162
  ./forge dataset export [--slice S]... [--limit N] [--seed N] [--out DIR] # labeled decision cases
163
- ./forge dataset outcomes [--horizon-days 14] [--repo PATH] [--dry-run] # what integrated work became
163
+ ./forge dataset outcomes [--horizon-days 14] [--repo PATH] [--dry-run] [--deadline S] [--quiet] # what integrated work became
164
164
  ./forge dataset routing [--repo PATH] [--since DAYS] [--json] # pass rate and runtime per tier and model
165
165
  ./forge dataset reviewers [--horizon-days 14] [--repo PATH] [--json] # how each reviewer's PASSed work held up
166
+ ./forge dataset risk [--repo PATH] [--json] # tasks by difficulty and risk together, and how each pair fared
167
+ ./forge dataset tiers [--repo PATH] [--tier T] [--json] # what explains results inside each tier, held out by run
168
+ ./forge dataset tiers --sample N --out DIR | --blind DIR # past prompts to rate blind, then agreement with the recorded tier
169
+ ./forge dataset pairs [--repo PATH] [--json] # two reviewers of one attempt, by what differs (effort, model, family)
170
+ ./forge dataset facts [--repo PATH] [--json] # findings' reach, origin and evidence: agreement, and rules replayed
166
171
  ./forge dataset forecast <plan> [--repo PATH] [--json] # likely cost and first-try PASS rate per task
167
172
  ./forge dataset worktrees [--json] # the worktrees forge created and removed (forge-ui's Worktrees screen)
168
173
  ./forge dataset history [--json] # every review's findings and every learning, by run (forge-ui's Projects screen)
@@ -336,11 +341,31 @@ For every integration, and every task it brought in, the harvester records:
336
341
  integration, dated before `integrate` + N days. The branch is resolved once, and the
337
342
  chain is walked by position, so commit dates out of order cannot skip a commit.
338
343
 
339
- Two cases leave a task without a survival count:
344
+ **Followed where it went** (#120). When the branch `integrate` advanced is gone, or the
345
+ integration is no longer on its first-parent chain, the harvester looks for it in every other
346
+ branch (local, then remote, never forge's own `forge/` branches): the commit where it entered
347
+ a branch's first-parent chain, a merge or the integration itself, is where the horizon is walked
348
+ from, on that branch. The outcome records `followed` (the branch) and `landed` (that commit). A
349
+ feature branch that a pull request merged and then deleted is followed this way. A run nobody
350
+ ran `integrate` for, its integration branch merged by hand, is followed the same way from its
351
+ last integration commit, and its horizon counts from when it landed (`merged_by_hand`).
352
+
353
+ Three cases leave a task without a survival count:
340
354
  - **Pending:** the horizon has not been reached and no later commit has passed it yet.
341
355
  Nothing is written, and the next harvest tries again.
342
- - **Lost:** a rebase, squash or reset took the integration off the branch. This means
343
- unobservable, not failed.
356
+ - **Not landed:** a run merged by hand whose integration no branch contains: not merged yet,
357
+ or squashed. Nothing is written, and the next harvest tries again.
358
+ - **Lost:** an `integrate` that a squash, rebase or reset took off every branch. This means
359
+ unobservable, not failed; `lost_cause` says whether its branch was deleted (`branch_gone`)
360
+ or rewritten (`off_branch`).
361
+
362
+ **When it runs.** The end of every `run` (unless it was interrupted) and every `integrate`
363
+ harvests that plan's repository: bounded by `FORGE_OUTCOMES_TIMEOUT` seconds (default 20; it
364
+ starts no new integration after that, and is killed 10 s later), never changing the exit code,
365
+ with its errors in `errors.log`. `FORGE_OUTCOMES=off`, or the dataset off, skips it. A new
366
+ integration cannot have reached its horizon, so what it records is older work coming due. Every
367
+ harvest that writes leaves `outcomes.last` in the dataset dir, and `forge dataset status`
368
+ prints the outcomes recorded by status and what the last harvest did.
344
369
 
345
370
  The rid names the integration, the reviewed commit and the horizon, so harvesting again
346
371
  adds nothing, and two horizons are two outcomes. Survival describes the diff that landed,
@@ -372,6 +397,100 @@ or its model when no alias was recorded, as the forge-ui Models view keys it. A
372
397
  forge-ui shows the rate as the Reviewers table's **Did not hold** column, through
373
398
  `GET /api/models/reviewers`, which runs this command with `--json`.
374
399
 
400
+ ## Risk beside difficulty
401
+
402
+ A plan event's `tasks.<id>.risk` is the task's `tasks/<id>/risk` rating (`low`, `medium`,
403
+ `high`, or null when it was not rated), recorded beside its difficulty. Nothing routes on it.
404
+ `forge dataset risk` counts each task once, as its run's latest plan revision rated it:
405
+
406
+ - how many tasks are rated, how many have a risk equal to their difficulty, and Cohen's kappa
407
+ between the two. A rating that only echoes difficulty adds nothing, and the question stops there.
408
+ - per (difficulty, risk) cell: tasks; first attempts that passed; tasks whose primary review
409
+ found a CONFIRMED P0 or P1; landed work (`forge dataset outcomes`, the longest horizon followed)
410
+ and how much of it did not hold. A cell under 10 tasks is flagged rather than read as an answer:
411
+ outcomes take 14 days, and low difficulty with high risk, the case that matters, is rare.
412
+
413
+ ## Inside a tier
414
+
415
+ `forge dataset tiers` asks whether a tier, `high` above all, mixes tasks that behave very
416
+ differently, before anyone adds a tier. It reads the tasks `routing` counts (first attempt says
417
+ something about the implementer, fractal runs left out) and changes nothing in a run. Facts come in
418
+ two kinds, reported apart:
419
+
420
+ - **plan time**, known before dispatch, so a rule could route on them: declared files,
421
+ dependencies, wave, and the size of the task's prompt in KB;
422
+ - **afterwards**, known only once the first attempt ran, so they can explain a result but never
423
+ route one: lines in that attempt's diff and files it changed.
424
+
425
+ Outcomes are first attempt passed, attempts taken, and unfinished (never passed, not accepted).
426
+ Per tier and fact:
427
+
428
+ - **bins**: the tier in thirds of the fact, each with tasks, runs, first pass (Wilson 95%), mean
429
+ attempts and unfinished. Descriptive only: a run's tasks are correlated and routing chose who
430
+ ran what.
431
+ - **held out by run**: runs go to 5 folds by a hash of their id. On the other folds, each
432
+ threshold at the training values' quartiles is scored on outcomes adjusted for the implementer
433
+ (an outcome minus its model's mean in the tier, shrunk toward the tier mean by 5 tasks), so a
434
+ weaker model mix is not read as harder tasks. The best threshold and its direction are applied
435
+ to the held-out runs. `lift` is the held-out difference between the side predicted higher and
436
+ the other, in the outcome's units (points for rates, attempts for attempts): above 0 means the
437
+ direction learned elsewhere held. The interval resamples held-out runs. It is omitted under 10
438
+ runs, or when no threshold leaves 5 tasks on each side.
439
+ - **repos**: first pass per repo with 10 or more tasks in the tier, and the implementer-adjusted
440
+ residual with a run bootstrap. Not held out: a repo's runs mostly stay in it.
441
+
442
+ Label noise is measured blind and never by the report itself, since rating costs model calls or a
443
+ person's time. `--sample N --out DIR` writes N past prompts, one task per run before any run gives
444
+ a second, to `DIR/prompts/<n>.md`, with `DIR/sample.tsv` mapping each number to its run and task.
445
+ The tier is not in either file, but a prompt can name it (2 of 663 did on one machine), so tell the
446
+ rater to ignore that. The rater writes `DIR/ratings.tsv` as `<n><TAB>low|medium|high`, and
447
+ `--blind DIR` reports the agreement rate with the recorded tier (Wilson 95%), Cohen's kappa and the
448
+ confusion table. Lines naming an unknown number or an invalid tier are counted, not guessed.
449
+
450
+ ## Paired reviews
451
+
452
+ `forge dataset pairs` reads the usable shadow pairs (as `status` counts them) and groups them by
453
+ the two reviewers' recorded harness, model and effort, each pair ordered lower effort first
454
+ (side `a`), then by model name:
455
+
456
+ - `effort`: the same model, at another effort or through another harness
457
+ - `model`: another model of the same family (`forge-shadow.py`'s families)
458
+ - `family`: another family
459
+ - `control`: identical settings. Their disagreement is the noise the others are read against,
460
+ and a control is never an effort comparison
461
+
462
+ Per pair of settings: `pairs`, `agree`, `agreement` with its Wilson 95% interval `ci`, and
463
+ `enough` from 30 pairs, the bar `forge dataset routing` uses. `only_a` and `only_b` count
464
+ blocking findings (CONFIRMED at the attempt's threshold or worse, or unlabelled) that the other
465
+ side did not name: nothing of it in the same file within 10 lines. An unlocated finding is always
466
+ unique, and a finding both sides name at different severities is not. `tokens_ratio` and
467
+ `time_ratio` are the medians over pairs of b's input plus output tokens and elapsed time as a
468
+ multiple of a's. A unique find is not a correct one: whether it was real is judged afterwards,
469
+ from outcomes or hidden tests. It only advises.
470
+
471
+ ## Finding facts
472
+
473
+ A reviewer ends each finding's first line with `{reach=… origin=… evidence=…}`. Each QA dispatch
474
+ records it beside the finding's severity and status as `findings[].facts` = `{reach, origin,
475
+ evidence}` (a value that is not one of the fact's words is null), and the finding's `head` has the
476
+ suffix cut. A finding without the suffix has no `facts` key. Nothing in forge decides on them yet:
477
+ `forge dataset facts` measures whether a gate should.
478
+
479
+ - **Coverage**: findings and reviews that carry facts, each fact's values, and reach by severity.
480
+ - **Agreement**: for every usable shadow pair (as `status` counts them), the findings both
481
+ reviewers name (same file, lines at most 10 apart, nearest first). Severity and each fact are
482
+ compared where both reviewers gave a value, as a raw share and as Cohen's kappa: severity has
483
+ four values and reach three, so raw agreement alone would flatter reach.
484
+ - **Rules**: the review each task attempt ended on, replayed through the severity gate with and
485
+ without a rule (the threshold its `qa.gate` recorded, else the plan's). `unusual`: reach=unusual
486
+ does not block unless P0. `existing`: origin=existing does not block. `both`. A rule only
487
+ releases a CONFIRMED or UNSTATED finding that has a severity; an unlabelled one still blocks.
488
+ Counted: reviews that would have passed, and the attempts after the first such review that
489
+ would not have run. Up to 50 released findings are listed with their run, task, attempt and head.
490
+
491
+ The replay without a rule is the gate itself. It agreed with every recorded gate decision on one
492
+ machine's store (545 of 545), so a difference is the rule's.
493
+
375
494
  ## Plan forecast
376
495
 
377
496
  `forge dataset forecast <plan>` reads the plan's `tasks.tsv` (the declared tier from
@@ -549,11 +549,24 @@ On the judged half of the runs (the newer half, see [Promotion](#promotion)), `-
549
549
  - precision, recall and the number flagged at the site's threshold, against its floor;
550
550
  - `PASSES: passes`, or `does not pass:` with the first rule that failed.
551
551
 
552
+ An inverted site's threshold is shown as configured, with the score it cuts at beside it:
553
+ `prompt_warn 0.55 (inverted: a score at or above 0.45)`.
554
+
552
555
  A replay is not charged to the run or daily budget, and its requests are not written to
553
556
  `jev.jsonl` or the dataset. Each `--send` is a deliberate call to the provider.
554
557
 
555
- Exit codes: 2 for an unknown site, a site with no label, an unknown provider or a bad flag; 1
556
- when the provider has no key and is not local.
558
+ `--label V` judges the answers already stored on another label of the site, to check a past
559
+ result against the current one. It sends nothing and records nothing, so `gate on` only ever
560
+ reads a site's own label; `--label` with `--send` is refused. Requests that only the other label
561
+ labels and that were never answered are left out, and the output says how many were judged out of
562
+ how many. One variant exists:
563
+
564
+ - `jev-drift --label first-attempt`: the file is in attempt 1's changed files, passed or not.
565
+ It is the label of the 2026-10-16 replay. The site's own label is the final passing attempt's,
566
+ which has fewer positives.
567
+
568
+ Exit codes: 2 for an unknown site, a site with no label, an unknown provider, an unknown label
569
+ variant or a bad flag; 1 when the provider has no key and is not local.
557
570
 
558
571
  ### Promotion
559
572
 
@@ -65,6 +65,22 @@ by diff length instead of by judgment required is the main way difficulty routin
65
65
  paying off — it sends the cheap model at the subtle problem and the expensive one at the
66
66
  boilerplate, which is worse than not routing at all.
67
67
 
68
+ **`risk`** is a separate rating, recorded in shadow (#122): what a mistake that gets through
69
+ would cost — what breaks, for whom, and how hard it is to undo. It changes no model, reviewer
70
+ or verdict yet; `forge dataset risk` measures whether it predicts problems difficulty misses.
71
+
72
+ | Risk | Means |
73
+ |------|-------|
74
+ | `low` | local, and easy to see and revert: docs, a test, an internal helper. |
75
+ | `medium` | wrong behaviour users would notice, undone by a revert. |
76
+ | `high` | hard to undo or reaching everyone: release and CI files, migrations and persisted data, auth and permissions, public APIs. |
77
+
78
+ A one-line change to a release script is low difficulty and high risk. Write the rating as
79
+ `low`, `medium` or `high` on the first line of `tasks/<id>/risk` before `plan` (the planner
80
+ writes it from its reply). A plan without ratings behaves exactly as before, and `tasks.tsv`
81
+ keeps its columns. A collapsed chain gets the highest of its parts' ratings, or none when a
82
+ part was not rated.
83
+
68
84
  ## tasks.tsv
69
85
 
70
86
  Tab-separated, one row per task, written by whoever decomposes the goal:
@@ -131,8 +147,9 @@ outright. Forge does not invent a model when the user has not said which one sho
131
147
  their quota.
132
148
 
133
149
  QA has no tier rules by default and falls back to `opus` at `high`, matching single-task forge.
134
- When the user names no reviewers, offer reviewers sized to the task's risk (never add them
135
- unprompted): `--qa-low sonnet:medium --qa-medium sonnet:high --qa-high opus:high`. In the
150
+ When the user names no reviewers, offer reviewers sized to the task's difficulty, which is what
151
+ the `--qa-<tier>` rules key on (a task's [risk](#the-two-axes-decompose-level-and-difficulty) is
152
+ recorded but routes nothing yet; never add them unprompted): `--qa-low sonnet:medium --qa-medium sonnet:high --qa-high opus:high`. In the
136
153
  SWE-bench Pro benchmark (#89) Sonnet reviewers gave no false PASS at about a seventh of an
137
154
  `opus:xhigh` review's cost.
138
155
 
@@ -593,8 +610,16 @@ turns shadow reviews off again.
593
610
 
594
611
  - **Which reviewer:** the first listed spec whose model family (Claude, GPT, Gemini, ...)
595
612
  differs from the task's reviewer, so the two do not share one blind spot. If none
596
- differs, the first listed spec. Forge only ever uses the specs you list. A spec that
597
- cannot run here (`doctor` fails) is dropped with a note and never fails the run.
613
+ differs, the first listed spec that does not resolve to the reviewer's own harness, model
614
+ and effort: the same model at another effort (`same_model`) or another model of the
615
+ family. Only when every listed spec is identical to the reviewer does it run as a
616
+ `control`, two reviews with one setting, which measures noise and never counts as an
617
+ effort comparison (a reviewer pool can hand a task the shadow's own spec). Forge only
618
+ ever uses the specs you list. A spec that cannot run here (`doctor` fails) is dropped
619
+ with a note and never fails the run.
620
+ - **Measuring an effort:** list only specs of the reviewers' own model at another effort,
621
+ for example `--shadow-qa sol:medium` beside `sol:high` reviewers, with a rate high enough
622
+ for at least 30 pairs per comparison. Each pair is one more review, so agree on its cost first.
598
623
  - **Which attempts:** a deterministic sample per (run, task, attempt), so a QA-only
599
624
  resume decides the same way.
600
625
  - **Same evidence, separate everything else.** The shadow reviews a byte-identical copy of
@@ -608,7 +633,11 @@ turns shadow reviews off again.
608
633
  a manual `retry`.
609
634
  - **Scope:** parallel mode only, and never under Fractal.
610
635
 
611
- `./forge dataset status` reports the agreement rate, overall and per model pair. The export
636
+ `./forge dataset status` reports the agreement rate, overall and per model pair, and
637
+ `./forge dataset pairs` splits it by what differs between the two reviewers: effort within one
638
+ model, another model of the family, another family, and controls. For each pair of settings it
639
+ gives verdict agreement with a 95% interval, the blocking findings only one side found, and the
640
+ token and time ratio (see [the dataset reference](dataset.md#paired-reviews)). The export
612
641
  adds `shadow` and `consensus` to the matching review cases' metadata.
613
642
 
614
643
  ## Severity, thresholds and known issues
@@ -640,8 +669,9 @@ every task has merged, and before the combined verification, the scheduler runs
640
669
  once. It collects the open findings at `Pn` or worse (the ones the threshold tolerated, plus
641
670
  PLAUSIBLE ones with `--sweep-plausible`), with `forge issues`' own collector, and leaves out:
642
671
 
643
- - findings a person accepted with `accept`, and findings of fix tasks (one round: what a sweep review
644
- finds goes to `forge issues`, never into another sweep);
672
+ - findings a person accepted with `accept` or kept with `adopt --approved` (listed as `accepted`), and
673
+ findings of fix tasks (one round: what a sweep review finds goes to `forge issues`, never into another
674
+ sweep);
645
675
  - dismissed ones (`forge issues --dismiss`), ones with no file, and ones whose file is gone;
646
676
  - ones whose line, as the reviewer saw it, a later merge changed (`changed`, naming those merges).
647
677
 
@@ -649,7 +679,9 @@ Every finding left out is listed in the plan with its reason. The rest become fi
649
679
  worst first, at most 8 findings each and `--sweep-max N` (default 5) tasks. Each fix task is a row
650
680
  `sweep-<n>` in `tasks.tsv` with `prompt.md` and `sweep.json`. Its implementer is the plan's low tier
651
681
  (the first spec of `--dwarf-low`, else of `--dwarf`; checked at `run` start), else the implementer of
652
- the task the worst finding came from. Its reviewer is that task's reviewer. The plan (groups, findings,
682
+ the task the worst finding came from. Its reviewer is that task's reviewer. What an adopted range's review
683
+ tolerated is swept too: its fix task's reviewer is the adoption's, and below the low tier its implementer
684
+ is the run's first task's. The plan (groups, findings,
653
685
  dispatches) is printed and kept in `<plan>/sweep/plan.md` and `plan.json`. A plan is swept at most once.
654
686
 
655
687
  Fix tasks share the run's scheduling, controls and `--retry-failed` budget. Their review is narrow
@@ -1048,13 +1080,16 @@ Four subcommands act on plans after tasks have run. Full usage and refusal condi
1048
1080
  reason) and to `control.log`, writes an `adopt` dataset event, and verifies as a retry does. A FAIL or
1049
1081
  UNKNOWN puts the branch back and exits 5, unless `--approved` keeps it, which writes the findings to the
1050
1082
  adoption's `known_issues.md` as `accept` does; `forge issues` and the run's report read that file (as
1051
- accepted findings, the reason with them), and the sweep does not. A review that concluded nothing always puts it back: a crash or timeout exits 5, an
1083
+ accepted findings, the reason with them), and the sweep lists them as `accepted` without fixing them;
1084
+ what the review tolerated under the threshold the sweep fixes like a task's. The reviewer is told the
1085
+ run's verification command (or its lanes' commands), which runs only after the review. A review that concluded nothing always puts it back: a crash or timeout exits 5, an
1052
1086
  infrastructure stop exits 8, a signal exits 130 or 143. If the worktree changed during the review it is
1053
1087
  left as it is, with the commands to go on. A range that lived only on the branch stays at
1054
1088
  `refs/forge/adopt-refused/<dir>`. A merge commit is refused, and a range that does not apply exits 6. A
1055
1089
  diff over 400 KB is read in the snapshot rather than inlined, as in a final review.
1056
1090
  There is no task row, because no model implemented it; the final review reads the whole range and is told
1057
- about it, `attribute` treats it as a step of its own, and forge-ui lists it above the final review.
1091
+ about it, `attribute` treats it as a step of its own, and forge-ui lists it above the final review, each
1092
+ row opening its review, its findings and the range's diff with the findings pinned.
1058
1093
  `adopt-<epoch>-<pid>/` keeps the review.
1059
1094
  - **`accept <plan> <task> --reason … --approved`** overrides a `FAIL`/`UNKNOWN` reviewer only
1060
1095
  when the reviewed commit is still the branch tip and the worktree still matches
@@ -1081,6 +1116,7 @@ removes what it created.
1081
1116
 
1082
1117
  ```
1083
1118
  <plan-dir>/tasks/<id>/approach.md intended approach, if planned
1119
+ <plan-dir>/tasks/<id>/risk low|medium|high, recorded only (#122), if rated
1084
1120
  <repo>/.forge/ project memory (survives the run)
1085
1121
  <repo>/../.forge-worktrees/<run-id>/<task-id> task worktree
1086
1122
  <repo>/../.forge-worktrees/<run-id>/_integration integration worktree
@@ -75,7 +75,7 @@ given this same prompt file as `--prompt-file`.
75
75
  **The reply** holds exactly one fenced block opened by ```` ```forge-plan ```` whose body is JSON:
76
76
 
77
77
  ```
78
- {"tasks": [{"id": "parse-config", "deps": [], "difficulty": "medium",
78
+ {"tasks": [{"id": "parse-config", "deps": [], "difficulty": "medium", "risk": "low",
79
79
  "files": ["src/config.py", "tests/test_config.py"],
80
80
  "title": "Parse the new config section", "approach": "…",
81
81
  "prompt": "… ## Acceptance criteria …"}]}
@@ -88,7 +88,8 @@ matches `^[a-z0-9][a-z0-9-]{0,39}$` and is unique; `deps` are known ids with no
88
88
  `difficulty` is `low`, `medium` or `high`; `files` is a non-empty list of repo-relative paths (no
89
89
  absolute path, no `..`, no tab, comma or newline); `title` is one non-empty line without a tab;
90
90
  `approach` is a string (it may be empty); `prompt` is non-empty and has a `## Acceptance
91
- criteria` heading.
91
+ criteria` heading. `risk` (#122) is the one optional key and never refuses a reply: `low`,
92
+ `medium` or `high` is written to `tasks/<id>/risk`, anything else (or no key) writes nothing.
92
93
 
93
94
  On success it writes `tasks.tsv` (dwarf and qa `-`), `tasks/<id>/prompt.md` (the task's prompt,
94
95
  then `## The whole request` and `$PLAN/request.md` verbatim, so no requirement is lost) and, for
@@ -54,6 +54,11 @@ line); CONFIRMED beats PLAUSIBLE; PLAUSIBLE-only blocks are ignored; "NOT CONFIR
54
54
  lowercase prose do not count. The severity is the first P0-P3 token of the block's first
55
55
  line (`[P2]`, `(P2)`, `**P2**`, `P2:`, `P2 -` or a standalone `P2`; uppercase only).
56
56
 
57
+ Facts (#119). A finding may end its first line (or, wrapped, its last) with
58
+ `{reach=main|realistic|unusual origin=new|existing evidence=ran|traced|suspected}`. They are
59
+ recorded in shadow and decide nothing: the gate never reads them, and `split_facts` cuts the
60
+ suffix for readers that show the line. A missing or malformed suffix changes nothing.
61
+
57
62
  Phantom findings. A reviewer may echo the contract it was given. Three layers keep that
58
63
  from creating findings or blocking: (1) FORGE_VERDICT, FORGE_LEARNING and FORGE_TESTS text is removed
59
64
  before parsing (the verdict line itself says "CONFIRMED"); (2) any line that is a
@@ -186,8 +191,22 @@ _SEVERITY = [
186
191
  ' P1 wrong behaviour on realistic input, or breaks an existing contract',
187
192
  ' P2 edge-case bug, race that needs unusual timing, missing hardening',
188
193
  ' P3 minor: cosmetic, naming, nit-level correctness',
194
+ 'End the first line of every finding with three facts about it, in braces, in this form:',
195
+ ' - [P1][CONFIRMED] path/file.py:123 — what breaks {reach=realistic origin=new evidence=traced}',
196
+ ' reach main (the main path), realistic (realistic input),',
197
+ ' or unusual (an unusual or hostile state)',
198
+ ' origin new (this change introduced it), or existing (it was there before the change)',
199
+ ' evidence ran (you ran it and saw it break), traced (you traced it in the code),',
200
+ ' or suspected',
201
+ 'The facts are recorded for measurement only: they change neither the severity nor what blocks.',
189
202
  ]
190
203
 
204
+ # The three facts of #119, recorded in shadow beside each finding's severity and confidence. They go
205
+ # at the END of the first line, never after the tags: `forge issues` would read a third tag as part
206
+ # of the location, and forge-ui strips only two.
207
+ FACTS = {'reach': ('main', 'realistic', 'unusual'), 'origin': ('new', 'existing'),
208
+ 'evidence': ('ran', 'traced', 'suspected')}
209
+
191
210
  _SWEEP_FINDINGS = [
192
211
  'Report findings only — do not edit any file. A finding here is a regression the change',
193
212
  'introduced: give its file and line, what breaks, and a concrete input that triggers it. Mark it',
@@ -342,7 +361,8 @@ def _clean(text: str) -> list:
342
361
  continue
343
362
  line = _QUOTE.sub('', line).rstrip()
344
363
  core = _collapse(_MARKER.sub('', line.strip()))
345
- if len(core) >= _MIN_ECHO and core in flat:
364
+ # A wrapped finding's facts on a line of their own can match the example's suffix word for word.
365
+ if len(core) >= _MIN_ECHO and core in flat and split_facts(core)[0].strip():
346
366
  continue
347
367
  out.append((number, line))
348
368
  return out
@@ -407,6 +427,37 @@ def _finding(number: int, lines: list):
407
427
  return Finding(status, severity, located, number, '\n'.join(lines))
408
428
 
409
429
 
430
+ # A brace group closing a line, markup and a full stop around it forgiven. It is the facts suffix only
431
+ # when it names at least one of the three facts: a finding's own text may end in braces (`{}`, `{a=1}`).
432
+ _FACTS_SUFFIX = re.compile(r'[ \t]*[`*_]*\{([^{}\n]*)\}[`*_.]*[ \t]*$')
433
+ _FACT = re.compile(r'([A-Za-z]+)[ \t]*[=:][ \t]*([A-Za-z]+)')
434
+
435
+
436
+ def split_facts(line: str):
437
+ """(line without its facts suffix, {reach, origin, evidence}) or (line, None) when it has none.
438
+
439
+ A fact whose value is not one of its words reads None, and keys other than the three are ignored:
440
+ a malformed suffix is still cut from the line, so it never reaches a location or a title."""
441
+ match = _FACTS_SUFFIX.search(line or '')
442
+ if not match:
443
+ return line, None
444
+ said = {key.lower(): value.lower() for key, value in _FACT.findall(match.group(1))}
445
+ if not any(key in said for key in FACTS):
446
+ return line, None
447
+ return line[:match.start()], {key: said[key] if said.get(key) in words else None
448
+ for key, words in FACTS.items()}
449
+
450
+
451
+ def facts(text: str):
452
+ """The facts of one finding block: its first line's suffix, else its last line's (a wrapped bullet)."""
453
+ lines = [line for line in (text or '').split('\n') if line.strip()]
454
+ for line in lines[:1] + lines[-1:]:
455
+ found = split_facts(line)[1]
456
+ if found is not None:
457
+ return found
458
+ return None
459
+
460
+
410
461
  def parse_findings(text: str) -> list:
411
462
  """Finding blocks of a QA reply, in order; see the module docstring for the rules."""
412
463
  found = (_finding(start, lines) for start, _, lines in _blocks(_clean(text)))
@@ -189,6 +189,7 @@ def clean_markdown(text):
189
189
  def parse_findings(text):
190
190
  out = []
191
191
  for m in FINDING_RE.finditer(text or ""):
192
+ said = contract().split_facts(m.group(4))[0].rstrip() # #119: the facts suffix is no part of the title
192
193
  loc = m.group(3).strip()
193
194
  link = re.fullmatch(r"\[([^\]]+)\]\([^)]*\)", loc)
194
195
  loc = (link.group(1) if link else loc).strip("` ")
@@ -196,8 +197,8 @@ def parse_findings(text):
196
197
  # `:442,674`, a range then a note): the path runs to its first `:<digit>`, the line is that number.
197
198
  lm = re.match(r"(.+?):(\d+)(?:[-:]\d+)?$", loc) or re.match(r"([^\s,;()]+?):(\d+)(?=[-:,;\s(]|$)", loc)
198
199
  out.append({"severity": m.group(1), "confidence": m.group(2), "file": lm.group(1) if lm else loc,
199
- "line": int(lm.group(2)) if lm else None, "text": clean_markdown(m.group(4)),
200
- "raw": f"[{m.group(1)}][{m.group(2)}] {loc} — {m.group(4).strip()}"})
200
+ "line": int(lm.group(2)) if lm else None, "text": clean_markdown(said),
201
+ "raw": f"[{m.group(1)}][{m.group(2)}] {loc} — {said.strip()}"})
201
202
  return out
202
203
 
203
204
 
@@ -230,7 +231,7 @@ def parse_known(text):
230
231
  if canonical:
231
232
  out.append(canonical[0])
232
233
  continue
233
- body = _BULLET_RE.sub("", first, count=1)
234
+ body = _BULLET_RE.sub("", contract().split_facts(first)[0], count=1)
234
235
  lm = _LOCATION_RE.search(body)
235
236
  if lm:
236
237
  file, line = lm.group(1).strip("`*"), int(lm.group(2))
@@ -80,7 +80,9 @@ def _is_file(path: str) -> bool:
80
80
 
81
81
 
82
82
  def _words(finding) -> set:
83
- return set(_WORD.findall(finding.text.lower()))
83
+ # #119: the facts suffix's words (reach, origin, evidence, ...) would make any two findings look alike
84
+ text = '\n'.join(contract.split_facts(line)[0] for line in finding.text.split('\n'))
85
+ return set(_WORD.findall(text.lower()))
84
86
 
85
87
 
86
88
  def same_finding(a, b) -> bool:
@@ -128,7 +128,7 @@ do_adopt() {
128
128
  fi
129
129
  tip="$(git -C "$int_wt" rev-parse HEAD)"
130
130
 
131
- local review="$out/review" thr verdict gate_line decision kept inline=1
131
+ local review="$out/review" thr verdict gate_line decision kept inline=1 vcmd
132
132
  forge_review_snapshot "$int_wt" "$base" "$tip" "$review" > "$out/snapshot.log" 2>&1 \
133
133
  || { adopt_rollback; die "adopt: cannot build the review snapshot (see $out/snapshot.log)" 3; }
134
134
  forge_review_deps "$int_wt" "$review" "$out/review.deps"
@@ -146,6 +146,12 @@ do_adopt() {
146
146
  echo
147
147
  cat "$out/review.deps"
148
148
  echo "Forge ran no tests of its own on this range, so nothing here stands in for yours."
149
+ # The run's verification, named and not run: it runs after this review, on the whole branch (#131).
150
+ vcmd="$(verify_command_for "$PLAN" "$(cat "$PLAN/repo")" | head -c 4000)"
151
+ if [ -n "$vcmd" ]; then
152
+ echo "The run verifies its integration branch with the command below, after this review. Run the parts of it that touch this range:"
153
+ echo '```sh'; printf '%s\n' "$vcmd"; echo '```'
154
+ fi
149
155
  echo
150
156
  python3 "$SKILL_DIR/scripts/forge-contract.py" qa --part tail --kind adopt --threshold "$thr"
151
157
  echo
@@ -30,6 +30,28 @@ forge_worktree_event() { # forge_worktree_event created|removed <run dir> <repo>
30
30
  forge_dataset_event "worktree_$1" --dir "$2" ${7:+--task "$7"} --set repo_path="$3" --set path="$4" \
31
31
  --set branch="$5" --set kind="$6"
32
32
  }
33
+ # The outcomes that came due for a run's repository (#120): what older integrations' lines became,
34
+ # read from git alone. At the end of `run` and `integrate`; bounded (FORGE_OUTCOMES_TIMEOUT seconds,
35
+ # default 20, plus a kill 10 s later), never changes the caller's exit code, logs its errors to the
36
+ # dataset's errors.log, and is off with FORGE_OUTCOMES=off or with the dataset.
37
+ forge_outcomes_harvest() { # forge_outcomes_harvest <plan dir>
38
+ forge_dataset_off && return 0
39
+ case "${FORGE_OUTCOMES:-on}" in off|OFF|Off|0|no|false) return 0 ;; esac
40
+ local repo limit pid watcher
41
+ repo="$(cat "$1/repo" 2>/dev/null)"
42
+ [ -n "$repo" ] && [ -d "$repo" ] || return 0
43
+ limit="${FORGE_OUTCOMES_TIMEOUT:-20}"
44
+ case "$limit" in ''|*[!0-9]*) limit=20 ;; esac
45
+ [ "$limit" -gt 0 ] || return 0
46
+ python3 "$SKILL_DIR/scripts/forge-dataset.py" outcomes --repo "$repo" --deadline "$limit" --quiet \
47
+ </dev/null >/dev/null 2>&1 &
48
+ pid=$!
49
+ ( sleep $(( limit + 10 )); kill -KILL "$pid" 2>/dev/null ) >/dev/null 2>&1 &
50
+ watcher=$!
51
+ wait "$pid" 2>/dev/null
52
+ pkill -P "$watcher" 2>/dev/null; kill "$watcher" 2>/dev/null; wait "$watcher" 2>/dev/null
53
+ return 0
54
+ }
33
55
  forge_dataset_invocation() { # forge_dataset_invocation <command> <rc> <started> [argv...]
34
56
  forge_dataset_off && return 0
35
57
  local command="$1" rc="$2" started="$3"; shift 3
@@ -2890,6 +2890,8 @@ case "$CMD" in
2890
2890
  run_wait "$run_job"; rc=$run_rc
2891
2891
  trap - TERM INT
2892
2892
  [ "$run_signalled" = 1 ] && [ "$rc" -gt 128 ] && rc=130
2893
+ # Older integrations' outcomes that came due (#120), unless the run was interrupted: bounded, never the exit code.
2894
+ [ "$run_signalled" = 1 ] || forge_outcomes_harvest "${1:-}"
2893
2895
  forge_update_notice; exit "$rc" ;;
2894
2896
  retry)
2895
2897
  # As run: the handler lives at the pid the user started, and do_retry runs in a background
@@ -2904,7 +2906,7 @@ case "$CMD" in
2904
2906
  trap - TERM INT
2905
2907
  [ "$retry_signalled" = 1 ] && [ "$rc" -le 128 ] && rc=143
2906
2908
  exit "$rc" ;;
2907
- integrate) do_integrate "$@" ;;
2909
+ integrate) do_integrate "$@"; rc=$?; forge_outcomes_harvest "${1:-}"; exit "$rc" ;;
2908
2910
  accept) need_fn do_accept; do_accept "$@" ;;
2909
2911
  adopt) need_fn do_adopt; do_adopt "$@" ;;
2910
2912
  review) need_fn do_review; do_review "$@" ;;