@giamme/forge 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +31 -12
  4. package/VERSION +1 -1
  5. package/docs/add-ons.md +11 -6
  6. package/docs/artifacts.md +18 -6
  7. package/docs/commands.md +189 -17
  8. package/docs/decomposed-runs.md +13 -5
  9. package/docs/forge-ui.md +34 -4
  10. package/docs/memory.md +2 -1
  11. package/docs/models.md +4 -2
  12. package/docs/reviews.md +81 -19
  13. package/docs/troubleshooting.md +3 -1
  14. package/forge +17 -1
  15. package/package.json +1 -1
  16. package/references/dataset.md +40 -14
  17. package/references/decision-models.md +759 -0
  18. package/references/decompose.md +197 -28
  19. package/references/harnesses.md +10 -3
  20. package/references/planning.md +8 -0
  21. package/references/solo.md +13 -3
  22. package/references/ui.md +11 -0
  23. package/scripts/forge-artifact.sh +30 -4
  24. package/scripts/forge-config.py +238 -29
  25. package/scripts/forge-contract.py +127 -58
  26. package/scripts/forge-control.py +40 -9
  27. package/scripts/forge-decide.py +6 -0
  28. package/scripts/forge-dispatch.sh +47 -15
  29. package/scripts/forge-fail-first.py +2 -2
  30. package/scripts/forge-gate-addressed.sh +40 -0
  31. package/scripts/forge-gate-message.sh +64 -0
  32. package/scripts/forge-issues.py +368 -36
  33. package/scripts/forge-jev-options.sh +269 -42
  34. package/scripts/forge-lib-attribute.sh +447 -0
  35. package/scripts/forge-lib-gates.sh +32 -0
  36. package/scripts/forge-lib-plans.sh +17 -6
  37. package/scripts/forge-lib-review.sh +24 -19
  38. package/scripts/forge-lib-task.sh +219 -39
  39. package/scripts/forge-lib-verify.sh +45 -8
  40. package/scripts/forge-memory.sh +3 -3
  41. package/scripts/forge-parallel-options.sh +44 -5
  42. package/scripts/forge-parallel.sh +503 -304
  43. package/scripts/forge-plan-check.py +35 -1
  44. package/scripts/forge-pre-review.py +437 -0
  45. package/scripts/forge-prompt.py +25 -5
  46. package/scripts/forge-route.py +2 -2
  47. package/scripts/forge-runtime.py +55 -1
  48. package/scripts/forge-schedule.py +70 -9
  49. package/scripts/forge-shadow.py +2 -2
  50. package/scripts/forge-solo.sh +41 -10
  51. package/scripts/forge-submodules.py +389 -0
  52. package/scripts/forge-sweep.py +542 -0
  53. package/scripts/forge_dataset/cli.py +12 -6
  54. package/scripts/forge_dataset/export.py +55 -45
  55. package/scripts/forge_dataset/forecast.py +4 -1
  56. package/scripts/forge_dataset/harvest.py +33 -5
  57. package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
  58. package/scripts/forge_decide/__init__.py +141 -0
  59. package/scripts/forge_decide/budget.py +149 -0
  60. package/scripts/forge_decide/cache.py +66 -0
  61. package/scripts/forge_decide/cli.py +953 -0
  62. package/scripts/forge_decide/doctor.py +221 -0
  63. package/scripts/forge_decide/label_addressed.py +75 -0
  64. package/scripts/forge_decide/label_attribution.py +62 -0
  65. package/scripts/forge_decide/label_coverage.py +81 -0
  66. package/scripts/forge_decide/label_message.py +38 -0
  67. package/scripts/forge_decide/label_prompt.py +139 -0
  68. package/scripts/forge_decide/labels.py +328 -0
  69. package/scripts/forge_decide/metrics.py +125 -0
  70. package/scripts/forge_decide/migrate.py +226 -0
  71. package/scripts/forge_decide/providers.py +292 -0
  72. package/scripts/forge_decide/replay.py +350 -0
  73. package/scripts/forge_decide/report.py +382 -0
  74. package/scripts/forge_decide/resolve.py +397 -0
  75. package/scripts/forge_decide/sites.py +377 -0
  76. package/scripts/forge_jev/__init__.py +202 -104
  77. package/scripts/forge_jev/addressed.py +171 -0
  78. package/scripts/forge_jev/attribution.py +198 -0
  79. package/scripts/forge_jev/cli.py +460 -382
  80. package/scripts/forge_jev/client.py +155 -77
  81. package/scripts/forge_jev/coupling.py +19 -87
  82. package/scripts/forge_jev/coverage.py +303 -0
  83. package/scripts/forge_jev/findings.py +219 -0
  84. package/scripts/forge_jev/gates.py +225 -27
  85. package/scripts/forge_jev/memory.py +65 -4
  86. package/scripts/forge_jev/message.py +134 -0
  87. package/scripts/forge_jev/plan_gates.py +294 -0
  88. package/scripts/forge_jev/questions.py +173 -313
  89. package/scripts/forge_jev/verify.py +130 -104
  90. package/ui/README.md +41 -10
  91. package/ui/docs/api.md +212 -44
  92. package/ui/forge_ui/checks.py +331 -0
  93. package/ui/forge_ui/control.py +60 -11
  94. package/ui/forge_ui/export.py +8 -3
  95. package/ui/forge_ui/models.py +1 -0
  96. package/ui/forge_ui/reader.py +436 -26
  97. package/ui/forge_ui/server.py +13 -0
  98. package/ui/forge_ui/static/app.js +15 -8
  99. package/ui/forge_ui/static/checksview.js +449 -0
  100. package/ui/forge_ui/static/controls.js +20 -13
  101. package/ui/forge_ui/static/convo.js +11 -2
  102. package/ui/forge_ui/static/findingsview.js +6 -4
  103. package/ui/forge_ui/static/index.html +1 -0
  104. package/ui/forge_ui/static/panel.js +105 -17
  105. package/ui/forge_ui/static/runmodel.js +40 -2
  106. package/ui/forge_ui/static/scene3d.js +2 -15
  107. package/ui/forge_ui/static/settings.js +336 -41
  108. package/ui/forge_ui/static/style.css +72 -7
  109. package/ui/forge_ui/transcripts.py +225 -54
  110. package/references/jev.md +0 -865
  111. package/scripts/forge_jev/backtest.py +0 -322
  112. package/scripts/forge_jev/corpus.py +0 -156
  113. package/scripts/forge_jev/features.py +0 -24
  114. package/scripts/forge_jev/predict.py +0 -204
  115. package/scripts/forge_jev/review.py +0 -73
  116. package/scripts/forge_jev/routing.py +0 -271
  117. package/scripts/forge_jev/subset.py +0 -123
package/docs/reviews.md CHANGED
@@ -9,10 +9,17 @@ What a reviewer must answer, what forge does when it fails a task, how to retry,
9
9
  Decompose-mode QA must end with a sentinel line:
10
10
 
11
11
  ```
12
- FORGE_VERDICT: PASS no confirmed correctness bug (style nits are not failures)
13
- FORGE_VERDICT: FAIL at least one CONFIRMED correctness bug
12
+ FORGE_VERDICT: PASS — no CONFIRMED finding at the blocking threshold (P2 or worse)
13
+ FORGE_VERDICT: FAIL — at least one CONFIRMED finding at the blocking threshold (P2 or worse)
14
14
  ```
15
15
 
16
+ forge decides the verdict from the findings, at a blocking threshold: `P2` unless
17
+ `--qa-threshold` sets another. A CONFIRMED finding at the threshold or worse, or one with no
18
+ severity, blocks: a PASS that lists one becomes FAIL. A CONFIRMED finding below the threshold
19
+ never blocks: a FAIL made only of those is accepted, and either way they are recorded in
20
+ `known_issues.md`, which `forge issues` and the sweep pick up. PLAUSIBLE findings never block.
21
+ `--qa-threshold P3` (or `none`) makes every CONFIRMED finding block.
22
+
16
23
  Only a standalone final line counts, and the parser is shared by every runner (solo,
17
24
  decomposed, Fractal's QA checkpoint). The prompt shows each verdict with a dash and its
18
25
  meaning, and some reviewers copy that whole line, so `FORGE_VERDICT: PASS — meaning` is
@@ -28,7 +35,11 @@ type `retry`, or when you opt in for a run with `--retry-failed N` ([below](#ret
28
35
  An `UNKNOWN` task is different from a rejected one: the reviewer never judged the code, so
29
36
  `retry` (or `--retry-failed`) asks **QA again on the unchanged work** instead of paying an
30
37
  implementer to rewrite something nobody rejected. No attempt is spent and no dwarf runs. If
31
- the worktree no longer matches what was reviewed, the full task runs instead.
38
+ the worktree no longer matches what was reviewed, the full task runs instead. A task
39
+ `INVALIDATED` because its review copy changed during the review (the reviewer edited a tracked
40
+ file) is retried the same way: its verdict counts for nothing, but the committed work is intact.
41
+ Untracked files a reviewer leaves in its copy, such as a test run's `__pycache__/`, do not void
42
+ the review.
32
43
 
33
44
  ## Retrying a failed task
34
45
 
@@ -86,8 +97,10 @@ as `retry` does. Other tasks keep running meanwhile; dependents still wait for t
86
97
  run (verification included) to finish before a human could retry it.
87
98
 
88
99
  It is opt-in and per invocation: it is not remembered by the plan, and the orchestrator never
89
- adds it unprompted. Only reviewer rejections are retried automatically — `TIMEOUT`, `ERROR`,
90
- `INVALIDATED` and `CONFLICT` still need a human. A retry that changes nothing (empty diff, or
100
+ adds it unprompted. Reviewer rejections, reviews with no verdict and reviews voided by a
101
+ change to the review copy are retried automatically (the last two as a fresh review of the same
102
+ work) — `TIMEOUT`, `ERROR`, `CONFLICT` and an `INVALIDATED` merge (the task or integration
103
+ branch moved) still need a human. A retry that changes nothing (empty diff, or
91
104
  a diff byte-identical to the previous attempt) writes a `noretry` marker and is **not**
92
105
  retried again, so a stuck task cannot burn its whole budget repeating itself.
93
106
  `tasks/<id>/attempts.tsv` records every entry (epoch, attempt number, resulting status, infra
@@ -135,18 +148,22 @@ still collapses to Fractal's own "failed" handling; QA-side stops propagate as a
135
148
 
136
149
  QA is asked to label every finding `- [P0..P3][CONFIRMED|PLAUSIBLE] file:line — what breaks`
137
150
  (P0 data loss/security/crash on the main path, P1 wrong behaviour on realistic input, P2
138
- edge-case bug, P3 minor). By default the verdict rule is unchanged — any CONFIRMED bug fails.
151
+ edge-case bug, P3 minor). [The verdict rule](#verdicts-and-failure) says which of them block.
139
152
 
140
- `--qa-threshold Pn` (on `run` or `retry`; remembered in the plan; `none` clears it) names the
141
- **least severe level that still blocks**: `P2` means P0–P2 block and only P3 is tolerated.
153
+ `--qa-threshold Pn` (on `plan`, `run`, `retry`, `review` and solo; a plan remembers it) changes
154
+ the default `P2`, the **least severe level that still blocks**: `P2` means P0–P2 block and only P3
155
+ is tolerated. `none` means P3, so every CONFIRMED finding blocks; `default` removes the setting.
156
+ Solo is the exception: it takes only `P0`–`P3` or `none`, so `default` exits 2 there.
142
157
  A task-specific `tasks/<id>/qa_threshold` file beats the plan-level value, which is how a
143
- dev-tooling or investigation task gets a looser bar than production code. With a threshold, a
144
- reviewer `FAIL` made only of CONFIRMED findings that are all labelled and strictly milder than
145
- the threshold is accepted as **PASS with known issues**: the task merges, `tasks/<id>/known_issues.md`
146
- keeps the findings, `qa.gate` records the decision, and every run/retry/integrate summary
158
+ dev-tooling or investigation task gets a looser bar than production code. A reviewer `FAIL` made
159
+ only of CONFIRMED findings that are all labelled and strictly milder than the threshold is
160
+ accepted as **PASS with known issues**: the task merges, `tasks/<id>/known_issues.md`
161
+ keeps the findings, `qa.gate` records the decision (`accept`), and every run/retry/integrate summary
147
162
  lists them. The literal status stays `PASS`, so nothing downstream needed a new vocabulary.
163
+ The same gate runs the other way: a PASS that lists a blocking finding becomes FAIL (`qa.gate`
164
+ decision `fail`), and the next attempt starts with a note saying why.
148
165
  It fails safe: an unlabelled CONFIRMED finding, or a FAIL with no CONFIRMED finding at all,
149
- is never tolerated, and without a threshold nothing changes.
166
+ is never tolerated.
150
167
 
151
168
  Tolerated findings are recorded, not fixed. After a run, the skill offers once to file them as
152
169
  GitHub issues, together with PLAUSIBLE findings of passed tasks and whatever a whole-run review
@@ -162,7 +179,8 @@ them on the team's project board; anywhere else forge files them itself with pla
162
179
  Each issue gets the finding, its severity, the task, reviewer and a code link at the merged
163
180
  commit. A hidden fingerprint, shared with gh-proman, keeps a finding from being filed twice.
164
181
  Findings a person merged with `accept` are origin `accepted`: the CONFIRMED lines under
165
- `## Accepted by a human despite the reviewer's <status> verdict` in `known_issues.md`.
182
+ `## Accepted by a human despite the reviewer's <status> verdict` in `known_issues.md`, or under
183
+ `## Accepted by a human despite forge's FAIL (…)` when `accept` followed a PASS that forge made FAIL.
166
184
  Their issue says a person accepted the work over that verdict, and gives the recorded
167
185
  reason. Findings above that heading, which a threshold tolerated, stay origin
168
186
  `tolerated`. A whole-run review whose integration branch has moved since it is outdated.
@@ -172,6 +190,39 @@ that merged after it. In `--json` each whole-run finding carries `review`: `name
172
190
  plan has no accepted integration commit, and `merged_since` is empty unless the review
173
191
  is outdated. Every other finding has `review` null.
174
192
 
193
+ ## Fixing them in the run: the finding sweep (opt-in)
194
+
195
+ `run --sweep P3` fixes the tolerated findings while the run's context is fresh, instead of leaving
196
+ them for issues. Once every task has merged, and before the combined verification, forge plans one
197
+ sweep:
198
+
199
+ - **Which findings.** The CONFIRMED findings the threshold tolerated, at `P3` or worse, and
200
+ PLAUSIBLE ones too with `--sweep-plausible`. Left out:
201
+ - findings a person accepted;
202
+ - dismissed ones (`forge issues --dismiss`), and ones with no file or whose file is gone;
203
+ - ones whose code a later task changed after the review.
204
+ - **How many tasks.** One fix task per file, worst first, at most 8 findings each and
205
+ `--sweep-max N` tasks (default 5). They run in parallel up to `--max-parallel`.
206
+ - **Which models.** Each fix task's implementer is your low tier (`--dwarf-low`, else `--dwarf`),
207
+ or the implementer of the task the finding came from. Its reviewer is that task's reviewer.
208
+ - **The plan.** It lists the groups, the findings, the dispatches and everything left out with
209
+ its reason. It is printed and kept in `<plan>/sweep/plan.md`.
210
+
211
+ A fix task's review is narrow. The reviewer says, for each finding, whether the change fixed it
212
+ (`S1: FIXED`, `S2: NOT FIXED — why`), and reports only regressions the change introduced. It passes
213
+ when at least one finding is fixed and nothing blocking broke. A finding the sweep fixed is no
214
+ longer offered as an issue. One it did not fix still is, and so is anything a sweep review found:
215
+ there is only one round. A fix task that fails does not fail the run.
216
+
217
+ The sweep uses the same `--retry-failed` budget and controls as the rest of the run, and a plan is
218
+ swept once. A run without `--sweep` behaves as before. The cost is at least two dispatches per file,
219
+ plus retries, spent on findings the threshold had said could wait, and changes land right before
220
+ the final review. That is why it is off by default.
221
+
222
+ `run --sweep-ahead` is the cheaper first step and needs no extra dispatch. A task dispatched after
223
+ others merged is told the open findings in the files it owns, at most three, to fix only when its
224
+ change already goes through that code. Its reviewer is told the same.
225
+
175
226
  ## Accepting a task despite its reviewer
176
227
 
177
228
  ```bash
@@ -188,7 +239,8 @@ the branch is still at the reviewed commit and the worktree still has the saved
188
239
  otherwise it exits `3` and says to `retry` for a fresh review (accepting would sign off on code
189
240
  nobody reviewed). It writes `tasks/<id>/known_issues.md` (your reason, who and when, and the
190
241
  reviewer's reply copied verbatim, under
191
- `## Accepted by a human despite the reviewer's <status> verdict`) and `accepted.by`,
242
+ `## Accepted by a human despite the reviewer's <status> verdict`, or after forge's flip under
243
+ `## Accepted by a human despite forge's FAIL (…)`) and `accepted.by` (with `gate=fail` after a flip),
192
244
  merges through the same checks as any other
193
245
  task, and puts everything back if the merge conflicts (exit `6`). Dependents are not touched;
194
246
  `run` continues them.
@@ -213,7 +265,7 @@ reads `integration.base..integration tip` from a disposable checkout, writes
213
265
  `<plan>/final-review-<epoch>-<pid>/` (`qa.input`, `qa.last`, `verdict`, `qa.gate`, …), keeps
214
266
  `<plan>/final-review` and `final-review.verdict` pointing at the newest, and never touches your
215
267
  branch or the integration branch. With `integrate --final-review`, it runs after verification
216
- and before your branch can move: `PASS` (or a `FAIL` accepted by `--qa-threshold`) continues,
268
+ and before your branch can move: `PASS` (or a `FAIL` the threshold accepts) continues,
217
269
  anything else stops with exit `5`; an infrastructure stop exits `8`. The QA spec is `--qa`, else
218
270
  the one remembered in `final_qa`, else the single spec every task shares (otherwise it asks).
219
271
  Tasks that are not merged are not in the result, and it says so. `integrate` also names unmerged
@@ -309,8 +361,7 @@ run) when the source fingerprint is unchanged. If the rerun passes the status is
309
361
  `verification.flaky` is written, `verification.log` keeps the first (failing) run,
310
362
  `verification.retry.log` the second, and `run`/`integrate` print a loud `FLAKY` line — an
311
363
  intermittent failure can be a real bug, so it is never passed off as a clean pass. A command
312
- that changes the tree is never retried. This deterministic rerun comes before Jev's optional
313
- model-assisted triage, which then does not run.
364
+ that changes the tree is never retried.
314
365
 
315
366
  With [verification lanes](../references/decompose.md#execution-checks-and-integration-verification)
316
367
  the rerun is per lane: only a lane that failed runs again, alone, and a lane that passes on its
@@ -320,7 +371,7 @@ such lane (`lanes=`, `<lane>.first_exit=`, `<lane>.retries_used=`); a lane whose
320
371
  test is in its baseline prints `known failures only: lane <name>`. A whole-run review's
321
372
  verification summary lists every lane with its state (`unit: pass`, `db: flaky`, ...) and says
322
373
  again which lane failed, which passed only on a rerun ("so its pass is not clean") and which
323
- failed only on known tests. In lanes mode there is no whole-command rerun and no Jev triage.
374
+ failed only on known tests. In lanes mode there is no whole-command rerun.
324
375
 
325
376
  ## Native review
326
377
 
@@ -339,3 +390,14 @@ the reviewer the result: `proven`, `passes_without_change`, `inconclusive` or `e
339
390
  reviewer is asked for a P2 finding for every test that passes without the change. It is advice
340
391
  only: forge never changes a status or verdict from it. forge-ui shows the evidence under the
341
392
  review findings. See [fail-first evidence](../references/decompose.md#fail-first-evidence-opt-in).
393
+
394
+ ## Pre-review tests (opt-in)
395
+
396
+ `plan --pre-review-tests` runs only the tests an attempt affects, with `.forge/verify-subset`,
397
+ before forge pays for its review: the tests the change adds or edits, and the tests of the files it
398
+ changes (from `.forge/test-map`, the naming convention or a reverse lookup). Never the whole suite:
399
+ a change to shared test infrastructure, more than 20 files or more than 120 s is skipped as too
400
+ broad. A red attempt goes back to its implementer without a review, with the failing tests and
401
+ their output as its findings; a test that also fails on the task base is not blamed, and a failure
402
+ that passes when rerun alone is recorded as flaky. Green, the reviewer gets the result as
403
+ evidence. See [pre-review tests](../references/decompose.md#pre-review-tests-opt-in).
@@ -15,8 +15,10 @@ Symptoms, causes and fixes, from a skill a harness cannot see to a task that wil
15
15
  | dwarf produced no changes | usually an ambiguous prompt it couldn't resolve headlessly. Nobody can answer a question mid-run |
16
16
  | task status `ERROR` | worktree creation or a dispatch failed — read `tasks/<id>/dwarf.out` / `qa.out` |
17
17
  | task status `UNKNOWN` | QA never emitted a verdict line; read `tasks/<id>/qa.last`. `retry` (or `run --retry-failed N`) asks QA again on the unchanged work — no dwarf runs, no attempt is spent |
18
+ | task status `INVALIDATED`, "artifact changed during review" | the reviewer changed a tracked file in its review copy, so its verdict counts for nothing. `retry` (or `run --retry-failed N`) reviews the unchanged work again — no dwarf runs, no attempt is spent. Untracked leftovers such as `__pycache__/` never cause this |
18
19
  | task status `INFRA`, `run` exits `8` | a quota/usage limit, auth problem, rate limit, network error or empty answer stopped a dispatch — not a task failure, and no attempt was spent. Read `tasks/<id>/infra.txt` (`class=`, `retry_after=`), fix the cause, run the same command again. `run --infra-retries M` waits it out instead. Dependents stay `PENDING`, never `BLOCKED` |
19
- | a task merged although its reviewer said FAIL | `--qa-threshold` accepted it: every CONFIRMED finding was labelled and milder than the threshold. See `tasks/<id>/known_issues.md` and `qa.gate`; nothing is accepted without an explicit threshold |
20
+ | a task merged although its reviewer said FAIL | the threshold (`P2` by default) accepted it: every CONFIRMED finding was labelled and milder than the threshold. See `tasks/<id>/known_issues.md` and `qa.gate` (decision `accept`); [the verdict rule](reviews.md#verdicts-and-failure) |
21
+ | a task FAILed although its reviewer said PASS | forge's gate: a CONFIRMED finding at or above the threshold was listed. `qa.gate` says `fail`, and the next attempt starts with a note saying so. Fix those findings, or `accept` the task if a person decides to; [the verdict rule](reviews.md#verdicts-and-failure) |
20
22
  | `accept` exits `3` "changed since it was reviewed" | the branch or worktree moved after QA, so accepting would sign off on unreviewed code. `retry` for a fresh review |
21
23
  | `combine` / `split` refuses | the message names why: unmerged task left behind, duplicate ids, locked or dirty plan, a Fractal-backed plan, or a selection that strands a dependent. Nothing was changed |
22
24
  | `integrate --final-review` stops with exit `5` | the whole-run reviewer found a blocking defect (or never reached a verdict); findings are in `<plan>/…/final-review/qa.last`. Your branch is untouched. Exit `8` means the reviewer hit a quota/auth stop: run it again |
package/forge CHANGED
@@ -19,7 +19,8 @@ usage() {
19
19
  'commands:' \
20
20
  ' install link forge into each agent harness on this machine; --dry-run previews' \
21
21
  ' fractal opt-in Fractal execution: install, doctor, runs, status, tree, logs, open, report, ...' \
22
- ' jev optional Jev advice: setup, status, doctor, enable, disable, backtest' \
22
+ ' decide decision-model gates: status, gate, provider, budget, privacy, doctor, migrate, report, replay' \
23
+ ' jev the old decision-model commands, replaced by decide (kept for one release)' \
23
24
  ' dataset every run'"'"'s inputs and outcomes: status, dump, import, export, outcomes, ...' \
24
25
  ' issues file the review findings a run left open as GitHub issues (plain gh)' \
25
26
  ' ui forge-ui, the run viewer: open [DIR], status, stop' \
@@ -54,8 +55,23 @@ case "${1:-}" in
54
55
  shift
55
56
  exec python3 "$ROOT/scripts/forge-fractal.py" "$@"
56
57
  ;;
58
+ decide)
59
+ shift
60
+ exec python3 "$ROOT/scripts/forge-decide.py" "$@"
61
+ ;;
57
62
  jev)
58
63
  shift
64
+ # Only the launcher says so: forge's own callers run forge-jev.py directly.
65
+ case "${1:-}" in
66
+ setup) NEW='forge decide provider add …' ;;
67
+ sites) NEW='forge decide gate <gate> <mode> --provider <name>' ;;
68
+ enable) NEW='forge decide gate <gate> on' ;;
69
+ disable) NEW='forge decide gate <gate> off' ;;
70
+ status) NEW='forge decide status' ;;
71
+ doctor) NEW='forge decide doctor' ;;
72
+ *) NEW='' ;;
73
+ esac
74
+ [ -n "$NEW" ] && printf 'forge jev is replaced by forge decide (this alias stays for one release): %s\n' "$NEW" >&2
59
75
  exec python3 "$ROOT/scripts/forge-jev.py" "$@"
60
76
  ;;
61
77
  dataset)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giamme/forge",
3
- "version": "0.12.0",
3
+ "version": "0.13.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",
@@ -31,26 +31,32 @@ time order: an attempt that PASSed, then a merge that CONFLICTed, then a human `
31
31
  |---|---|---|
32
32
  | `start` | execution | a receipt written by `begin()`. A start with no matching end is an execution that was killed or is still running |
33
33
  | `dispatch` | model call | role, alias, harness, **resolved** model, effort after clamping, timeout and its source, delivery (custom or native review), phase timings, exit, timeout, infra class, tokens, parsed verdict and findings, `FORGE_LEARNING` lines, `session_id`, `session_continue`. Blobs: the delivered prompt and the final message |
34
- | `attempt` | task attempt or solo run | status, attempt number (with refund and resume flags), trigger (`initial`, `auto`, `human`), dwarf and qa spec, declared vs changed files, numstat, drift, guard notes, gate line, patch key, the files this execution wrote and the ones it only carried. Blobs: the diff, retry findings, memory slices, capsule, Jev task files |
35
- | `verification` / `verify_run` | verify, and each command execution | command and its source (flag, `.forge/verify`, Jev), status, flaky, Jev triage. One `verify_run` per execution, each with its own log |
36
- | `plan` | `plan` | goal, original request, decompose level, exploratory routing decisions (`tasks[id].route`, with their odds), author (orchestrator or planner), per-task declared vs executed difficulty and who set it, pools, waves, Jev routing and coupling, options (including `reviewer_session` when that file is present). Blobs: both task tables, prompts, approaches, excerpts of the declared files at plan time, the file inventory, `memory.md` |
34
+ | `attempt` | task attempt or solo run | status, attempt number (with refund and resume flags), trigger (`initial`, `auto`, `human`), dwarf and qa spec, declared vs changed files, numstat, drift, guard notes, gate line (`thr<TAB>decision<TAB>worst<TAB>n_confirmed<TAB>n_unlabelled<TAB>n_below`; a solo attempt has it too, with the `known_issues` blob; null when the run wrote none), patch key, the files this execution wrote and the ones it only carried, `sent_back` (`prereview`, `bounce` or `message`: the send-back this attempt ended with, which leaves its status `FAIL`; null otherwise) and `retry_source` (where the retry findings it was given came from: `review`, `prereview`, `bounce`, `message` or `answer`; null on a first attempt). Blobs: the diff, retry findings, memory slices, capsule, Jev task files |
35
+ | `verification` / `verify_run` | verify, and each command execution | command and its source (flag, `.forge/verify`, Jev), status, flaky. One `verify_run` per execution, each with its own log |
36
+ | `plan` | `plan` | goal, original request, decompose level, exploratory routing decisions (`tasks[id].route`, with their odds), author (orchestrator or planner), per-task declared vs executed difficulty and who set it, pools, waves, Jev's plan-time judgments (stores from before 2026-10-27 also hold routing and coupling), options (`qa_threshold`, the effective blocking threshold, and `qa_threshold_source`, `set` when the plan's file held a valid value and `default` otherwise; plus `reviewer_session` when that file is present), `plan_gates` (the parsed `plan-gates.json`: what the plan-time gates did, with the `sent_back` history and `pending`; absent when the plan has no such file). Blobs: both task tables, prompts, approaches, excerpts of the declared files at plan time, the file inventory, `memory.md` |
37
37
  | `run_end` | `run` | results per task, the accepted integration commit, `memory.md` |
38
38
  | `invocation` | user-facing `forge-parallel.sh` subcommand | argv, exit, duration, plus final review, accept, integrate and split/combine payloads |
39
- | `event` | point event | `merge` (MERGED, CONFLICT with the files, INVALIDATED and why), `integrate_advanced`, `integrate_conflict`, `combine_conflict`, `sched_terminal`, `subset_run` (every outcome), `memory_record`, `memory_prune` |
39
+ | `event` | point event | `merge` (MERGED, CONFLICT with the files, INVALIDATED and why), `integrate_advanced`, `integrate_conflict`, `combine_conflict`, `sched_terminal`, `memory_record`, `memory_prune`, `attribution` (below) |
40
40
  | `event` `escalation` | retry that changes the model | the model a retry escalated from and to, `after_attempt`, and `source` (`policy`, `retry` for an explicit `--dwarf`, or `pin`), recorded at the rewrite, before the retried attempt begins |
41
41
  | `event` `control` | `forge control` change | a human's live change: `at`, `actor` (`cli`/`ui`), `action` (`set`, `pin`, `unpin`), `key`, `value`, `previous`; task events carry the task id. Also read back from `control.log` by `import` |
42
42
  | `event` `run_delete_started` / `run_deleted` | `forge runs rm` | written strictly around a run's deletion: `path`, `run_id`, `archive`, and for `run_deleted` the bytes freed |
43
43
  | `event` `shadow_review` | shadow review | how an opt-in second review ended (`done`, `invalid`, `overtime`, `orphaned`, ...), with the reviewed commit and both specs. Its dispatch is recorded with role `qa_shadow` |
44
- | `jev` | Jev request | site, answers, usage, latency, mode. Blob: the **full request** (state and questions). Its original sha is `jev.jsonl`'s `key` |
44
+ | `jev` | Jev request | site, answers, usage, latency, mode. Blob: the **full request** (state and questions). Its original sha is `jev.jsonl`'s `key`. A per-attempt gate's request state carries `run`, `task` and `attempt` (`dwarf-message`, `retry-addressed`), so its key differs per attempt and per run; `attribution` carries `run` only |
45
45
  | `fractal_step` / `fractal_node` | Fractal step, node state | decomposition decision, iteration, resolved model, cost, tokens, candidate diff |
46
46
  | `ledger` | ledger row | imported `.forge/ledger.tsv` rows |
47
47
  | `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` |
48
48
  | `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 |
49
49
 
50
+ An attempt that forge sent back without a review keeps the status `FAIL` in the dataset, and
51
+ `sent_back` says what sent it back (`prereview`, `bounce` or `message`). `attempts.tsv` names the
52
+ `bounce` and `message` cases `BOUNCED` and `INCOMPLETE`; those two statuses exist only there. An
53
+ attempt that stopped for the user's answer has the status `NEEDS_INPUT` in the dataset.
54
+
50
55
  A dispatch carries `session_id` and `session_continue`. `session_id` comes from the attempt
51
56
  dir's `<role>.session`, and from `metrics.json` when that file is absent. `session_continue`
52
57
  is null when the attempt dir has no `<role>.continue`. That file is written only when the
53
- dispatch was asked to continue a reviewer session: `mode=continued` is `continued`, and
58
+ dispatch was asked to continue a session (a reviewer's, or with `plan --implementer-session` an
59
+ implementer's): `mode=continued` is `continued`, and
54
60
  `mode=failed`, a missing mode or any other mode is `failed`. The file's presence means
55
61
  continuing was requested, so a failed continue that still printed a verdict is tagged too.
56
62
  The `attempt` event's `resumed` flag is a different fact: a QA-only re-run after an
@@ -59,6 +65,12 @@ infrastructure stop (the `tasks/<id>/resume` marker).
59
65
  `plan --reviewer-session` writes `$PLAN/reviewer_session` (`on`). The plan event records
60
66
  it in `options`. The file joins the plan id only when it is present, so every plan already
61
67
  in a store keeps its id, and turning the experiment on stores a new plan event.
68
+ `plan --implementer-session` (`$PLAN/implementer_session`, `on`) is recorded the same way, and
69
+ `plan --pre-review-tests` joins the plan id the same way and is listed in `flags`. `plan-gates.json`
70
+ joins it too, but with its parsed content rather than a first line: a plan without the file keeps
71
+ its id, and a re-plan that changes the file's content gets a new plan event.
72
+ `forge dataset status` counts continued and failed continues for reviewers and implementers
73
+ apart.
62
74
 
63
75
  Each blob reference carries `sha` (the stored bytes), `original_sha`, `n` (the original
64
76
  size), `kept`, and `cut`. A cut keeps the head and the tail, because a QA prompt ends with
@@ -68,6 +80,12 @@ prompt in argv) are never stored. A harness without structured output has its fi
68
80
  message copied from the whole log, so for those harnesses only the tail is kept, flagged
69
81
  `final_source: log_copy`.
70
82
 
83
+ The `attribution` event is written once an integration search stops (`forge-parallel.sh attribute`,
84
+ in [the command reference](../docs/commands.md)). It is a point event with no task. Its blob
85
+ `attribution` holds the search's `attribution.json`: `culprit`, `base_fails`, `inconclusive`,
86
+ `merges`, `steps` (each verified prefix, its status and its `source`), `verification_runs` and
87
+ `gate` (the decision model's ranking, the suspect it tried and the outcome, or null).
88
+
71
89
  ## How it is captured
72
90
 
73
91
  All capture goes through a handful of hooks. Every one of them is fail-open: errors go
@@ -90,8 +108,7 @@ to `errors.log`, nothing is printed, and nothing changes an exit code.
90
108
  - **An EXIT trap in `forge-parallel.sh`** records every user-facing subcommand, `die`
91
109
  included.
92
110
  - **`forge_jev/client.py`** keeps the canonical request bytes of every live Jev call,
93
- including calls made without a run dir. It skips fixture replays, the setup probe and
94
- backtests.
111
+ including calls made without a run dir. It skips fixture replays and the setup probe.
95
112
 
96
113
  Run identity is a uuid in `<plan-or-run-dir>/dataset.uid`, created once (`O_EXCL`) by
97
114
  `plan` or by the first `begin()`. Split and combine copy attempt dirs unchanged, so a
@@ -171,7 +188,7 @@ The reviewer is part of the review state because strictness differs by reviewer:
171
188
  same kind of diff passes far more often under one reviewer than another, so a label
172
189
  means little without knowing who gave it. Routing and retry states also carry a `size`
173
190
  block (`prompt_chars`, `declared_files`, `plan_tasks`, `deps`, `decompose_level`, from
174
- `forge_jev/features.py`), since task size moves the first-pass rate more than anything
191
+ `forge_dataset/states.py`), since task size moves the first-try pass rate more than anything
175
192
  else in the history.
176
193
 
177
194
  An attempt is labeled by the last execution that carries its number, because a QA-only
@@ -187,8 +204,10 @@ under `censored` in `manifest.json`:
187
204
  A later success is never labeled as the first attempt's.
188
205
 
189
206
  Decisions with no outcome to label them are left out rather than labeled by opinion.
190
- These are QA effort sizing (recorded until 2026-10-17), the five routing rubrics, failure triage, and coupling, since
191
- no merge has conflicted yet.
207
+ These are QA effort sizing (recorded until 2026-10-17) and the sites removed on 2026-10-27
208
+ (the five routing rubrics, review triage, verify flake triage, same-wave coupling), which stores from
209
+ before then still hold but no export labels. See
210
+ [decision models](decision-models.md#tried-and-removed).
192
211
 
193
212
  Routing cases of tasks routed with `plan --explore` add `route` to their metadata: the
194
213
  candidates, the pool's own pick, the choice, its propensity, and `followed`, which says
@@ -197,6 +216,12 @@ replace it). `assignments.jsonl` lists every such decision with its first attemp
197
216
  or censoring reason, including tasks no case was exported for. It is the randomized cohort,
198
217
  free of the export's own filters.
199
218
 
219
+ Review cases carry `gate` in their metadata: what forge's severity gate decided for that attempt's review, per
220
+ attempt (`accept`: reviewer FAIL, forge PASS; `fail`: reviewer PASS, forge FAIL; `keep`: forge agreed), or null
221
+ when the attempt has no `qa.gate` (a run from before the gate was always written). The label stays the reviewer's
222
+ raw verdict, so counting reviews with `passes` true and `gate` `fail` per reviewer measures how often a reviewer
223
+ applies a threshold of its own.
224
+
200
225
  Review cases whose attempt also had a shadow review (`plan --shadow-qa`) add `shadow` (its
201
226
  verdict, reviewer and worst finding) and `consensus` to their metadata. Only a shadow that
202
227
  finished on an untouched snapshot and reviewed the same commit counts. The primary
@@ -227,6 +252,7 @@ Routing cases also add how the task went:
227
252
  - `attempts_observed`
228
253
  - `raw_verdict`
229
254
  - `gate_pass`, a reviewer FAIL the severity gate accepted
255
+ - `gate_fail`, a reviewer PASS the gate turned into FAIL (a blocking CONFIRMED finding); false when there is no first attempt
230
256
  - `first_raw_pass_attempt`
231
257
  - `human_accept`
232
258
  - `stop_reason`: `passed`, `accepted`, `noretry`, `interrupted` or `no_pass_observed`
@@ -243,7 +269,7 @@ tables kept apart because they answer different questions.
243
269
 
244
270
  **Observational.** Every task's first attempt, by declared tier and the model and effort that
245
271
  ran it (resolved, so `sol` and `gpt-6.1-sol:medium:codex` share a row):
246
- - first-pass rate with a Wilson 95% interval
272
+ - first-try pass rate with a Wilson 95% interval
247
273
  - the share that passed review at some attempt, or that a human accepted
248
274
  - unfinished tasks
249
275
  - attempts per task
@@ -256,7 +282,7 @@ Fractal runs are left out, since their dispatches have identities of their own.
256
282
  Round-robin pools make the pair differ between rows, and a model has no chance at all
257
283
  outside its own pairs, so pairs are never pooled. For each arm:
258
284
  - assigned tasks
259
- - first-pass as a Hajek (self-normalized inverse-propensity) mean
285
+ - first-try pass as a Hajek (self-normalized inverse-propensity) mean
260
286
  - Kish's effective n
261
287
  - attrition: tasks not run as assigned, and tasks with no outcome
262
288
  - runtime
@@ -353,7 +379,7 @@ run.
353
379
  `forge-parallel.sh run` prints the same block before it dispatches, shortened: the tasks without
354
380
  enough history share one line instead of a row each, and when no task has enough, the whole block
355
381
  is one line pointing at `forge dataset forecast <plan>`. It runs with a time budget
356
- (`FORGE_FORECAST_BUDGET_S`, default 3 seconds), prints one line and moves on if reading the
382
+ (`FORGE_FORECAST_BUDGET_S`, default 3 seconds; `inf` means no limit), prints one line and moves on if reading the
357
383
  history takes longer, never prints errors and never changes the exit code. `--no-forecast` or
358
384
  `FORGE_FORECAST=off` turn it off. The block is written to the plan as `forecast.json` and
359
385
  recorded once as a `forecast` event, so it can later be compared to what the run did.