@giamme/forge 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +29 -12
  4. package/VERSION +1 -1
  5. package/docs/add-ons.md +11 -6
  6. package/docs/artifacts.md +12 -6
  7. package/docs/commands.md +179 -17
  8. package/docs/decomposed-runs.md +13 -5
  9. package/docs/forge-ui.md +7 -3
  10. package/docs/memory.md +2 -1
  11. package/docs/models.md +4 -2
  12. package/docs/reviews.md +49 -20
  13. package/docs/troubleshooting.md +3 -1
  14. package/forge +17 -1
  15. package/package.json +1 -1
  16. package/references/dataset.md +39 -13
  17. package/references/decision-models.md +759 -0
  18. package/references/decompose.md +166 -29
  19. package/references/harnesses.md +10 -3
  20. package/references/planning.md +8 -0
  21. package/references/solo.md +13 -3
  22. package/scripts/forge-artifact.sh +30 -4
  23. package/scripts/forge-config.py +238 -29
  24. package/scripts/forge-contract.py +95 -56
  25. package/scripts/forge-control.py +40 -9
  26. package/scripts/forge-decide.py +6 -0
  27. package/scripts/forge-dispatch.sh +38 -16
  28. package/scripts/forge-fail-first.py +2 -2
  29. package/scripts/forge-gate-addressed.sh +40 -0
  30. package/scripts/forge-gate-message.sh +64 -0
  31. package/scripts/forge-issues.py +321 -33
  32. package/scripts/forge-jev-options.sh +269 -42
  33. package/scripts/forge-lib-attribute.sh +447 -0
  34. package/scripts/forge-lib-gates.sh +32 -0
  35. package/scripts/forge-lib-plans.sh +17 -6
  36. package/scripts/forge-lib-review.sh +22 -17
  37. package/scripts/forge-lib-task.sh +217 -38
  38. package/scripts/forge-lib-verify.sh +45 -8
  39. package/scripts/forge-memory.sh +3 -3
  40. package/scripts/forge-parallel-options.sh +18 -5
  41. package/scripts/forge-parallel.sh +455 -303
  42. package/scripts/forge-plan-check.py +35 -1
  43. package/scripts/forge-pre-review.py +437 -0
  44. package/scripts/forge-prompt.py +25 -5
  45. package/scripts/forge-route.py +2 -2
  46. package/scripts/forge-runtime.py +10 -4
  47. package/scripts/forge-schedule.py +21 -5
  48. package/scripts/forge-shadow.py +2 -2
  49. package/scripts/forge-solo.sh +38 -9
  50. package/scripts/forge-submodules.py +389 -0
  51. package/scripts/forge_dataset/cli.py +12 -6
  52. package/scripts/forge_dataset/export.py +55 -45
  53. package/scripts/forge_dataset/harvest.py +33 -5
  54. package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
  55. package/scripts/forge_decide/__init__.py +141 -0
  56. package/scripts/forge_decide/budget.py +149 -0
  57. package/scripts/forge_decide/cache.py +66 -0
  58. package/scripts/forge_decide/cli.py +953 -0
  59. package/scripts/forge_decide/doctor.py +221 -0
  60. package/scripts/forge_decide/label_addressed.py +75 -0
  61. package/scripts/forge_decide/label_attribution.py +62 -0
  62. package/scripts/forge_decide/label_coverage.py +81 -0
  63. package/scripts/forge_decide/label_message.py +38 -0
  64. package/scripts/forge_decide/label_prompt.py +139 -0
  65. package/scripts/forge_decide/labels.py +328 -0
  66. package/scripts/forge_decide/metrics.py +125 -0
  67. package/scripts/forge_decide/migrate.py +226 -0
  68. package/scripts/forge_decide/providers.py +292 -0
  69. package/scripts/forge_decide/replay.py +350 -0
  70. package/scripts/forge_decide/report.py +382 -0
  71. package/scripts/forge_decide/resolve.py +397 -0
  72. package/scripts/forge_decide/sites.py +377 -0
  73. package/scripts/forge_jev/__init__.py +202 -104
  74. package/scripts/forge_jev/addressed.py +171 -0
  75. package/scripts/forge_jev/attribution.py +198 -0
  76. package/scripts/forge_jev/cli.py +460 -382
  77. package/scripts/forge_jev/client.py +155 -77
  78. package/scripts/forge_jev/coupling.py +19 -87
  79. package/scripts/forge_jev/coverage.py +303 -0
  80. package/scripts/forge_jev/findings.py +219 -0
  81. package/scripts/forge_jev/gates.py +225 -27
  82. package/scripts/forge_jev/memory.py +65 -4
  83. package/scripts/forge_jev/message.py +134 -0
  84. package/scripts/forge_jev/plan_gates.py +294 -0
  85. package/scripts/forge_jev/questions.py +173 -313
  86. package/scripts/forge_jev/verify.py +130 -104
  87. package/ui/README.md +2 -2
  88. package/ui/docs/api.md +60 -32
  89. package/ui/forge_ui/control.py +60 -11
  90. package/ui/forge_ui/export.py +2 -1
  91. package/ui/forge_ui/models.py +1 -0
  92. package/ui/forge_ui/reader.py +87 -14
  93. package/ui/forge_ui/static/app.js +2 -2
  94. package/ui/forge_ui/static/controls.js +20 -13
  95. package/ui/forge_ui/static/panel.js +63 -17
  96. package/ui/forge_ui/static/runmodel.js +23 -1
  97. package/ui/forge_ui/static/scene3d.js +2 -15
  98. package/ui/forge_ui/static/settings.js +336 -41
  99. package/ui/forge_ui/static/style.css +19 -7
  100. package/references/jev.md +0 -865
  101. package/scripts/forge_jev/backtest.py +0 -322
  102. package/scripts/forge_jev/corpus.py +0 -156
  103. package/scripts/forge_jev/features.py +0 -24
  104. package/scripts/forge_jev/predict.py +0 -204
  105. package/scripts/forge_jev/review.py +0 -73
  106. package/scripts/forge_jev/routing.py +0 -271
  107. package/scripts/forge_jev/subset.py +0 -123
package/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.1",
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