@giamme/forge 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +1 -0
  3. package/SKILL.md +32 -5
  4. package/VERSION +1 -1
  5. package/docs/artifacts.md +33 -1
  6. package/docs/commands.md +147 -16
  7. package/docs/dataset.md +5 -0
  8. package/docs/decomposed-runs.md +122 -1
  9. package/docs/development.md +2 -1
  10. package/docs/forge-ui.md +98 -8
  11. package/docs/memory.md +27 -4
  12. package/docs/models.md +8 -0
  13. package/docs/reviews.md +122 -0
  14. package/docs/safety.md +8 -0
  15. package/forge +44 -4
  16. package/package.json +2 -1
  17. package/references/dataset.md +39 -1
  18. package/references/decompose.md +737 -16
  19. package/references/harnesses.md +18 -3
  20. package/references/planning.md +43 -14
  21. package/references/solo.md +2 -1
  22. package/references/ui.md +56 -6
  23. package/registry.tsv +8 -3
  24. package/scripts/forge-artifact.sh +14 -0
  25. package/scripts/forge-brief.py +217 -0
  26. package/scripts/forge-compare.py +13 -2
  27. package/scripts/forge-config.py +176 -9
  28. package/scripts/forge-contract.py +246 -28
  29. package/scripts/forge-control.py +200 -15
  30. package/scripts/forge-dispatch.sh +48 -15
  31. package/scripts/forge-du.py +167 -0
  32. package/scripts/forge-group.py +496 -0
  33. package/scripts/forge-groups.py +89 -0
  34. package/scripts/forge-handoff.py +1128 -0
  35. package/scripts/forge-lib-adopt.sh +1 -0
  36. package/scripts/forge-lib-group.sh +641 -0
  37. package/scripts/forge-lib-plans.sh +343 -4
  38. package/scripts/forge-lib-review.sh +29 -1
  39. package/scripts/forge-lib-task.sh +197 -4
  40. package/scripts/forge-memory.sh +245 -3
  41. package/scripts/forge-metrics.sh +7 -3
  42. package/scripts/forge-parallel-options.sh +4 -0
  43. package/scripts/forge-parallel.sh +1216 -41
  44. package/scripts/forge-planner.py +104 -8
  45. package/scripts/forge-prompt.py +120 -0
  46. package/scripts/forge-retro.py +115 -0
  47. package/scripts/forge-route.py +190 -12
  48. package/scripts/forge-runs-compact.py +443 -0
  49. package/scripts/forge-runs-rm.py +2 -0
  50. package/scripts/forge-runs.py +27 -8
  51. package/scripts/forge-schedule.py +633 -49
  52. package/scripts/forge-shadow.py +7 -1
  53. package/scripts/forge-solo.sh +4 -0
  54. package/scripts/forge-summarize.py +698 -0
  55. package/scripts/forge-ui-options.sh +10 -0
  56. package/scripts/forge-worktrees.py +243 -0
  57. package/scripts/forge_brief/__init__.py +831 -0
  58. package/scripts/forge_brief/answers.py +506 -0
  59. package/scripts/forge_brief/proposals.py +1630 -0
  60. package/scripts/forge_dataset/__init__.py +10 -0
  61. package/scripts/forge_dataset/efforts.py +4 -3
  62. package/scripts/forge_dataset/export.py +36 -10
  63. package/scripts/forge_dataset/facts.py +8 -4
  64. package/scripts/forge_dataset/forecast.py +8 -18
  65. package/scripts/forge_dataset/harvest.py +241 -12
  66. package/scripts/forge_dataset/history.py +13 -6
  67. package/scripts/forge_dataset/importer.py +65 -1
  68. package/scripts/forge_dataset/names.py +66 -0
  69. package/scripts/forge_dataset/reviewers.py +5 -2
  70. package/scripts/forge_dataset/risk.py +6 -3
  71. package/scripts/forge_dataset/routing.py +6 -1
  72. package/scripts/forge_decide/__init__.py +11 -1
  73. package/scripts/forge_groups/__init__.py +308 -0
  74. package/scripts/forge_groups/attribute.py +289 -0
  75. package/scripts/forge_groups/review.py +286 -0
  76. package/scripts/forge_locations.py +366 -0
  77. package/scripts/forge_owner.py +152 -0
  78. package/scripts/forge_registry.py +19 -0
  79. package/scripts/forge_retro/__init__.py +417 -0
  80. package/scripts/forge_retro/issues.py +1193 -0
  81. package/scripts/forge_retro/report.py +671 -0
  82. package/scripts/forge_side/__init__.py +482 -0
  83. package/scripts/forge_storage.py +515 -0
  84. package/ui/README.md +68 -8
  85. package/ui/docs/api.md +375 -31
  86. package/ui/forge_ui/control.py +451 -11
  87. package/ui/forge_ui/executions.py +8 -1
  88. package/ui/forge_ui/export.py +53 -7
  89. package/ui/forge_ui/groups.py +264 -0
  90. package/ui/forge_ui/links.py +337 -0
  91. package/ui/forge_ui/models.py +125 -10
  92. package/ui/forge_ui/projects.py +4 -1
  93. package/ui/forge_ui/reader.py +919 -45
  94. package/ui/forge_ui/server.py +4 -0
  95. package/ui/forge_ui/static/app.js +173 -11
  96. package/ui/forge_ui/static/briefview.js +605 -0
  97. package/ui/forge_ui/static/checksview.js +6 -2
  98. package/ui/forge_ui/static/controls.js +5 -0
  99. package/ui/forge_ui/static/diffview.js +86 -1
  100. package/ui/forge_ui/static/groupsview.js +332 -0
  101. package/ui/forge_ui/static/index.html +4 -0
  102. package/ui/forge_ui/static/panel.js +394 -8
  103. package/ui/forge_ui/static/projectsview.js +189 -10
  104. package/ui/forge_ui/static/runmodel.js +27 -4
  105. package/ui/forge_ui/static/storageview.js +352 -0
  106. package/ui/forge_ui/static/style.css +176 -6
  107. package/ui/forge_ui/static/worktreesview.js +235 -14
  108. package/ui/forge_ui/storage.py +150 -0
  109. package/ui/forge_ui/transcripts.py +35 -10
  110. package/ui/forge_ui/worktrees.py +154 -13
package/CHANGELOG.md CHANGED
@@ -5,6 +5,63 @@ 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.19] - 2026-11-15
9
+
10
+ Group review and wider brief answers; a retry budget per model, scripted tasks, chained plans and forge handoff; early stops for a fix outside the task and for a prompt edited mid-attempt; forge-ui runs its own commands; and forge's website.
11
+
12
+ ### Highlights
13
+
14
+ - forge has a website: https://giamme.github.io/forge/, with plain-language docs from install to steering a live run, a route map of a run, and the full reference one link away. It is built from `site/` with no dependencies and published by GitHub Pages; the npm package links to it.
15
+
16
+ ### Added
17
+
18
+ - `plan --reviewer-session-rate R` turns the reviewer-session experiment on for a sampled share of the tasks, balanced by difficulty and fixed at plan time, so one run can compare continued and fresh review rounds. The other tasks log `not-sampled` in `review_sessions.tsv`.
19
+ - Brief mode part 2: a task's questions name its group, `--brief-scope wave|plan` lets you answer wider questions, and the answer becomes a proposal (`forge brief propose`). Nothing in the plan changes until you approve its exact diff with `forge brief apply PLAN PID --approve HASH`, or reject it. A wave proposal changes only that group's unstarted tasks; a plan proposal can also add, remove or split tasks. Affected tasks get their questions asked again. Proposals can be approved or rejected in forge-ui too.
20
+ - Opt-in group review (`plan --groups waves --group-review`): related tasks share one QA dispatch over their combined diff. Each finding goes back only to the member whose files it names (or the members a `{tasks=…}` tag names), the group merges in one step once it passes, and a finding that names no member stops the group for your decision (`forge group show|retry`). Groups and their review show in forge-ui. Group dispatches are recorded as `scope=group` and kept out of reviewer statistics. Fewer dispatches are not yet a measured saving.
21
+ - Groups derived with `plan --groups waves` get a title (`Wave N`). The approval table shows each group's title and goal, says which groups have no goal, and `forge group set PLAN GID --goal "…"` (or `--title`) sets one and freezes the groups again, logged in `control.log`.
22
+ - Chained plans (`plan <dir> --after <prev>`): a plan can start from an earlier plan's integration branch, so a second milestone builds on the first before either is integrated. `run` refuses when the earlier plan moved, and `integrate` names the whole chain it brings in.
23
+ - `forge handoff`: another session or another harness can pick up a run. `show` reports what the run is doing and what needs a person, `note` leaves a line for the next session, `claim` records who drives it (a 12-hour lease, `--take-over` to override), and `resume` follows a live scheduler or restarts a stopped run detached with its recorded flags, after saving and resetting tasks left `RUNNING`.
24
+ - A task whose every blocking finding needs a file it does not declare now stops early as `NEEDS_DECISION` (reason `plan`) instead of spending more attempts. The reviewer marks such a finding `{outside=path}`; the implementer can claim one with a `FORGE_BLOCKED: <path>: <why>` line for the reviewer to confirm or refute. `decision.md` names the task that owns each path and the plan edits that fix it (add the file, depend on the owner, or merge the rows).
25
+ - Editing a task's `prompt.md` or `approach.md` while its attempt runs no longer gets the old work reviewed against the new text: the attempt becomes `STALE`, spends nothing, and the implementer is re-dispatched with the new requirements and a diff of what changed. `control.log` records it as `prompt-changed`, and the dataset keeps such attempts out of pass rates.
26
+ - Retry budget per model (`plan --retry-per-model N`): a task may fail N times on each model the retry policy gives it before it moves a tier up, replacing `--escalate-after`. The approval table prints the worst case: the most implementer, reviewer and shadow dispatches the plan can spend if every rung fails.
27
+ - Scripted tasks: a `tasks.tsv` row whose dwarf column is `script` runs the executable `tasks/<id>/run` in its worktree instead of a model, from the task's base on every attempt, under the plan's timeout. A non-zero exit fails the task with no review; otherwise the result is reviewed as a script's output. Codemods and generated files no longer need a model to type them.
28
+ - forge-ui runs its own commands when controls are on: remove finished or failed worktrees in bulk (`forge worktrees rm`), forget memory learnings (`forge memory forget REPO category:key`), compact one run or all runs from the Disk screen, and answer a waiting task's question from the task panel (`forge control retry --answer`, which also prepares the retry itself when no run is live). Read-only mode shows each command to copy instead.
29
+
30
+ ### Changed
31
+
32
+ - `terra` now resolves to gpt-6.1-terra. The previous model is still available as `terra-5.6`, and dispatches recorded on it are counted under `terra-5.6` in `forge dataset reviewers`, review history and forge-ui's model leaderboard, never mixed into the new `terra`.
33
+
34
+ ### Fixed
35
+
36
+ - forge-ui: each run on the Disk screen links to its run page again. The screen matched runs by path, and its real path often differed from the one the run list uses; it now gets each run's key from the server, and a run dir the run list does not show stays plain text.
37
+ - Reviewers can run tests that need a temporary directory: every read-only dispatch gets a writable temp dir of its own outside the repository (`TMPDIR`, `TMP`, `TEMP`), removed when it ends. On codex the read-only sandbox now allows writes to that directory alone, so test runners such as Vitest no longer stop with `EPERM`.
38
+ - A task whose diff is over 400 KB is reviewed: the reviewer gets the diff's stat and reads the diff in its snapshot, as the whole-run review already does, instead of a prompt its harness refuses. If a harness still refuses a prompt as too large, the task's note says so and points to `adopt` or a split, since a retry would send the same prompt.
39
+ - An implementer whose CLI cancelled its session before it changed anything (grok does this when a tool call needs an approval a headless run cannot give) is now an infrastructure stop: the task waits as `INFRA` with no attempt spent. It used to fail as an empty diff marked never to retry, which also blocked every task that depended on it.
40
+
41
+ ## [0.18] - 2026-11-13
42
+
43
+ Around each task and on disk: retro notes, brief mode, task summaries and the task inspector; review snapshots removed after each review, forge runs compact, forge du and the Disk screen, and a list of everything forge puts on disk.
44
+
45
+ ### Added
46
+
47
+ - Retro notes, opt-in with `plan --retro` (or `forge config set retro on`): implementers and reviewers record what got in their way (a missing tool, a flaky test, a wrong instruction), each with its command and error and checked against the run's own logs. `forge retro report` groups them into `retro.md` (forge's own problems, the project's, the environment's) with counts across tasks and earlier runs. `forge retro issues` drafts redacted GitHub issues for forge's repository and posts only what a person approves by hash. Nothing leaves the machine otherwise (#132).
48
+ - forge-ui: the task inspector opens with the task's goal, acceptance criteria and links read from its prompt, then an attempt trail: each attempt's model, verdict, worst finding and why it was retried (automatic, a person's retry, an escalation), each line linking to that attempt's executions (#133).
49
+ - Task summaries, opt-in with `plan --summaries on --summaries-model SPEC`: a cheap read-only dispatch writes a few sentences per task, plus one sentence for the tasks table, rewritten only when the task's attempts, status or review change. `forge summarize` runs it by hand, and `forge control set summaries on|off` (or `--task ID on|off|inherit`) switches it during or after a run. forge-ui shows each summary in the inspector with its model, time and sources, marks one out of date, and has a master switch and a per-task override. forge never picks the model (#133).
50
+ - Brief mode, opt-in with `plan --brief advisory|gated|strict --brief-model SPEC`: before each task starts, a cheap read-only dispatch writes the questions only you can answer, each with why it matters, options and the default forge will assume. Answers (`forge brief answer`, or the answer box in forge-ui's inspector) go into the task's prompt. `gated` holds a task with an unanswered must-answer question, and `strict` makes `run` exit 3 while any is open. After a merge, dependents' open questions are flagged as possibly stale, and an answer that comes after its task started is kept as late, with a `forge control add` suggestion. forge-ui lists the run's open questions, flagged first, then by how soon each task starts (#135).
51
+ - `forge control accept <plan> <task> --reason "…" --approved` accepts a `FAIL`, `UNKNOWN` or `NEEDS_DECISION` task while its run is live. The scheduler applies it at its next pass, just as `forge-parallel.sh accept` would: the findings become known issues, the task merges, and the tasks waiting on it start in the same run instead of ending `BLOCKED`. `control.log` and `accepted.by` record who asked and why. With no live run it is refused, and points to the plain `accept` (#138).
52
+ - `forge runs compact` takes back the space run dirs hold for nothing and keeps every run: after a strict dataset import it removes leftover review snapshots and, with `--logs`, gzips each dwarf's and reviewer's log copy (forge-ui reads them the same way). It holds the run's lock, skips active runs, and reports anything forge did not create (a dependency install inside a run dir) instead of deleting it. On a real 2.3 GB plan dir it took back 2.2 GB (#139).
53
+ - `forge du` shows what forge takes on disk (each run dir's snapshots, logs and other files, each run's worktree folder, and the data home) and the command that takes each part back. forge-ui's new Disk screen shows the same report, with the commands to copy (#139).
54
+ - At run start forge compacts the repository's idle runs in the background and warns when its forge files passed a size you set. `forge config set storage.compact auto|off` (default `auto`) and `storage.warn-gb N|off` (default 20) control it; a run never waits for it (#139).
55
+ - The Disk screen in forge-ui now charts where the space goes: one bar by kind (review snapshots, logs, other run files, what is not forge's, worktrees, the data home) and one per repository, with sizes and shares on hover.
56
+ - forge now keeps a list of everything it puts on disk, in `<config home>/forge/locations.jsonl`: every run dir and worktree, with its repository's git dir and main checkout, and when forge removed it. `forge du`, `forge runs compact` and forge-ui's Disk and Worktrees screens use it to know where to look, so a checkout deleted by hand, a symlinked path or a run dir that is gone no longer hides anything. It is written even with the dataset off (`FORGE_RUN_REGISTRY=off` turns it off), and filled once from the run registry and the worktrees already on disk.
57
+
58
+ ### Fixed
59
+
60
+ - Run directories no longer grow by a full copy of the repository for every review: forge removes each review snapshot (task, final, shadow, solo and adopt reviews) once the review ends, whatever its outcome, and a task's next review removes one an interrupted review left behind. `review.base`, `review.deps`, the prompt, the log and the verdict stay. `FORGE_KEEP_SNAPSHOTS=1` keeps them for debugging. Snapshots that existing runs already hold are untouched (#139).
61
+ - A forge command refused by a plan's lock (`accept`, `retry`, `integrate` and the others while another one runs) now says which command holds the lock, with its pid and start time, and on a live run which `forge control` command to use instead, rather than a bare `[Errno 35] Resource temporarily unavailable` (#138).
62
+ - A final review stopped by a signal no longer leaves its review snapshot behind for good: the plan's next final review removes it, as a task's next review already did (#139).
63
+ - forge-ui's Worktrees screen no longer greys out worktrees that are still on disk. It used to miss a repository reached through a symlink, or one whose recorded checkout was deleted by hand; their worktrees then showed as removed or not at all. Now it finds a repository through any of its worktrees and never calls a worktree on disk removed. It names a repository git cannot list, counts a split task's worktree as the run's, and offers to delete a folder left where a worktree was. The screen opens on the worktrees on disk.
64
+
8
65
  ## [0.17] - 2026-11-11
9
66
 
10
67
  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.
package/README.md CHANGED
@@ -18,6 +18,7 @@
18
18
  <a href="#quick-start">Quick start</a> ·
19
19
  <a href="#how-it-works">How it works</a> ·
20
20
  <a href="#forge-ui">forge-ui</a> ·
21
+ <a href="https://giamme.github.io/forge/">Website</a> ·
21
22
  <a href="docs/README.md">Docs</a> ·
22
23
  <a href="CHANGELOG.md">Changelog</a>
23
24
  </p>
package/SKILL.md CHANGED
@@ -77,7 +77,10 @@ For explanation requests, explain the workflow without spending model quota.
77
77
  tests also run without its non-test changes, and the reviewer is asked to report any that
78
78
  still pass as P2; it needs `.forge/verify-subset` and never changes a result by itself. So is
79
79
  `plan --pre-review-tests`: before each review forge runs only the tests the attempt affects
80
- (`.forge/verify-subset`), and a red attempt goes back to its implementer unreviewed. `plan` explores by default (`--explore 0.2`: now and then
80
+ (`.forge/verify-subset`), and a red attempt goes back to its implementer unreviewed. So are
81
+ `plan --groups` and `plan --group-review`: one review can cover several small, related,
82
+ low-risk tasks. Offer them, never add them unprompted, and keep a high-risk task on per-task
83
+ review. Read [Groups and group review](references/decompose.md#groups-and-group-review-opt-in). `plan` explores by default (`--explore 0.2`: now and then
81
84
  a row left to forge gets its neighbouring tier's model from the user's pools, odds
82
85
  recorded for `forge dataset routing`); say so with the table and pass `--explore 0` when
83
86
  the user declines. Retries follow a policy: after three failed attempts on one model the
@@ -87,18 +90,30 @@ For explanation requests, explain the workflow without spending model quota.
87
90
  explicitly says so; never self-accept.
88
91
  - When you report a run, read `<plan>/control.log` and mention any human change made mid-run
89
92
  (a threshold, a budget, a model pin, a drain, stop or queued retry; `forge control show <plan>`
90
- lists them). Never set a control, pin, `drain|stop|retry` or delete a run with `forge control` /
91
- `forge runs rm` unless the user asks. Exit `130` / `INTERRUPTED`: the run was signalled or
92
- stopped; relay the `retry` lines it printed.
93
+ lists them). Never set a control, pin, `drain|stop|retry`, delete a run or compact one with
94
+ `forge control` / `forge runs rm` / `forge runs compact` unless the user asks; `forge du` only reads. Exit `130` / `INTERRUPTED`: the run was signalled or
95
+ stopped; `forge handoff resume <plan>` carries it on, and relay the `retry` lines it printed to finish by hand.
96
+ - When a session starts on a repo with an active or unfinished run, or the user names one, run
97
+ `forge handoff` first and work from its output. Never start `run` for a run whose scheduler is
98
+ live; continue with `forge handoff resume <plan> --harness <this harness>`, which follows a live
99
+ run and restarts a stopped one with its recorded flags. A Fractal plan is left to `forge fractal
100
+ resume`. Claim the run with the session's harness. Take over another driver only on the user's
101
+ word (`--take-over`). Record what is not on disk (a decision the user made, a hand fix under way)
102
+ with `forge handoff note`.
93
103
  - A `waiting for your answer:` block is status `NEEDS_INPUT`: relay each question verbatim and
94
104
  pass it with `retry <plan> <id> --answer "<reply>"`. Never answer for the user; nothing else
95
105
  resumes it.
96
106
  - A task at `NEEDS_DECISION` waits for the user. Present `tasks/<id>/decision.md`'s reasons and
97
107
  choices. Run `retry --decide`, `retry --dwarf` or `accept` (with `--reason` and `--approved`)
98
- only on the user's explicit word, never to keep a run going. Nothing else resumes it. The
108
+ only on the user's explicit word, never to keep a run going; on a live run use `forge control
109
+ retry … --decide` or `forge control accept`, which the scheduler applies. Nothing else resumes it. The
99
110
  split choice replaces the row in `tasks.tsv` and is a later `run`
100
111
  ([when reviews don't converge](references/decompose.md#when-reviews-dont-converge)); do that
101
112
  only when the user asks.
113
+ - A group at `NEEDS_DECISION` waits for the user. Present `forge group show <plan>`. Run
114
+ `forge group retry <plan> <gid> --tasks <ids>` only on the user's word: that answers an
115
+ ambiguous decision. An oversized group is split in `groups.tsv` and planned again; do not
116
+ retry it. Nothing else resumes it.
102
117
  - Exit `8` / status `INFRA` is an infrastructure stop (`capacity`, `rate_limit`, `usage_limit`,
103
118
  `budget`, `auth`, `network`, `provider_down`, `empty` or `cancelled`; an old run may say
104
119
  `quota`), not a task failure, and no attempt was spent. Report each "needs you" item with its
@@ -125,6 +140,18 @@ For explanation requests, explain the workflow without spending model quota.
125
140
  fail-open, and never change a task's tier, select a model, or substitute for QA acceptance
126
141
  or repository verification (`--jev-act` is still accepted and changes nothing). Read
127
142
  [Decision models](references/decision-models.md) when selected.
143
+ - **Retro, brief and summaries are opt-in:** offer them, never add them unprompted. Brief and
144
+ summaries need a model the user names (`--brief-model`, `--summaries-model` or `forge config
145
+ set`); forge never picks one. With brief on, relay the questions from `forge brief show <plan>`,
146
+ pass the user's answers with `forge brief answer`, and never answer for the user. A strict brief
147
+ run exits `3` before any task starts while questions are open. With retro on, record each
148
+ obstacle with `forge retro note <plan> --type T --fixable-by F --summary S` (`T`: `environment`,
149
+ `sandbox`, `tooling`, `prompt`, `forge-bug` or `other`; `F`: `user`, `forge` or `unsure`), and at
150
+ the end of the run relay the groups in `<plan>/retro.md`. `forge retro issues` posts only on the
151
+ user's approval of the exact text it prints (`--apply --approve <hash>`). Details:
152
+ [retro notes](references/decompose.md#retro-notes-opt-in),
153
+ [brief mode](references/decompose.md#brief-mode-opt-in),
154
+ [task summaries](references/decompose.md#task-summaries-opt-in).
128
155
 
129
156
  ## Common workflow
130
157
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17
1
+ 0.19
package/docs/artifacts.md CHANGED
@@ -35,6 +35,14 @@ A solo run also records, for forge-ui and for you:
35
35
  qa_threshold only with --qa-threshold: P0-P3 or none; without it the default P2 applies
36
36
  ```
37
37
 
38
+ Review snapshots (`review-*` directories, a full export of the reviewed tree) exist only while their
39
+ review runs. A dwarf's or reviewer's log copy under `attempts/` may be `<role>.log.gz` once `forge runs
40
+ compact --logs` has run: the same bytes, gzipped. See [forge runs compact](commands.md#forge-runs-compact).
41
+
42
+ Outside every repo, beside the run registry (`<config home>/forge/runs/`), `<config home>/forge/locations.jsonl`
43
+ lists every run dir and worktree forge created, with its repository, and when forge removed it. See
44
+ [forge du](commands.md#forge-du).
45
+
38
46
  Plus, in the repo itself and surviving the run:
39
47
 
40
48
  ```
@@ -50,7 +58,25 @@ A decomposed run adds:
50
58
  tasks.tsv
51
59
  waves.tsv, deferrals.txt
52
60
  tasks/<id>/{capsule.md,prompt.md,dwarf.*,qa.*,changes.diff,status}
61
+ tasks/<id>/run executable a dwarf cell of `script` runs
62
+ tasks/<id>/script.log stdout and stderr of that command
63
+ tasks/<id>/attempts/script-<hex>/ one script run (16 hex digits): script.log, the run file, metrics.json
53
64
  tasks/<id>/attempt, attempts.tsv attempts spent; one audit row per entry (incl. refunded stops)
65
+ groups.tsv id, review, qa, members, title, goal; absent unless groups are on
66
+ groups.frozen sha256 of the six columns, then each member's deps and files
67
+ group_max_tasks, group_max_diff_kb review-group bounds (defaults 6 members and 256 KB when absent)
68
+ groups/<gid>/status, round, rounds.tsv, merged
69
+ a review=group group's outcome; rounds.tsv is round, epoch, status, implicated, qa spec
70
+ groups/<gid>/candidate.base, candidate.commit, fingerprint, members.tsv, members.paths, combined.diff
71
+ the candidate the one review read; members.tsv is round, task, commit, attempt
72
+ groups/<gid>/qa.input, qa.last, qa.out, qa.gate, qa.round-<n>.last, known_issues.md, infra.txt
73
+ groups/<gid>/attribution.json, decision.md, decision.<round>.md, conflict.files
74
+ groups/<gid>/attempts/qa-<id>/group.round
75
+ the round that QA dispatch reviewed, read by a dataset import
76
+ groups/<gid>/settled.round, settle.tasks, retries.used, invalidated.reason, review.base, merge.out, group.out
77
+ tasks/<id>/reviewed.commit, source.fingerprint
78
+ the commit and worktree fingerprint a review=group member stopped at
79
+ tasks/<id>/settled.group gid and round, once a group FAIL judged this member
54
80
  tasks/<id>/known_issues.md, qa.gate findings the threshold tolerated, and the gate's decision (accept, fail or keep)
55
81
  sweep/plan.json, plan.md run --sweep: the fix tasks, their findings, and every finding left out with its reason
56
82
  tasks/<id>/sweep.json a fix task's findings (S1, S2, ...), each with its source task and key
@@ -71,7 +97,7 @@ A decomposed run adds:
71
97
  tasks/<id>/changes.since.diff diff from that commit to the one under review; omitted when there is no such range
72
98
  tasks/<id>/changes.since.range the two commits, full hashes
73
99
  tasks/<id>/changes.since.stat diff --stat of that range
74
- tasks/<id>/review_sessions.tsv one row per review round while plan --reviewer-session is on: round, attempt, mode, reason, session id
100
+ tasks/<id>/review_sessions.tsv one row per review round while plan --reviewer-session is on: round, attempt, mode, reason (not-sampled for a task --reviewer-session-rate left out), session id
75
101
  tasks/<id>/implementer_sessions.tsv one row per attempt while plan --implementer-session is on: row, attempt, mode (continued|fresh|failed), reason, session id
76
102
  tasks/<id>/reviewed.dwarf.{session,resolved} the implementer session that made reviewed.commit, and what it ran as
77
103
  tasks/<id>/retry_findings.dwarf.{session,resolved} the same, carried beside the retry findings; what --implementer-session continues
@@ -82,6 +108,7 @@ A decomposed run adds:
82
108
  infra_backoff, infra_fallback --infra-backoff's shape; on while --infra-fallback is set
83
109
  max_parallel the concurrency limit: written by each run from --max-parallel, changed live by forge control
84
110
  reviewer_session holds on; present while plan --reviewer-session is on
111
+ reviewer_session_rate, reviewer_session_tasks --reviewer-session-rate's share, and the task ids it picked (one per line)
85
112
  implementer_session holds on; present while plan --implementer-session is on
86
113
  <final-review-dir>/review.meta final-review-<epoch>-<pid>/ or integrate-*/final-review/; base=, tip=, source=, spec=, threshold=, integration=, previous=, since=; session= and session_reason= while reviewer_session is set
87
114
  control.log one JSON line per human change made with forge control, and per request outcome
@@ -91,6 +118,7 @@ A decomposed run adds:
91
118
  infra.paused only while something is paused on infrastructure: {"scopes": [...]}
92
119
  control.lock the lock that serialises changes to the plan's control files, created by whichever takes it first (forge control, the scheduler or an escalation record) and left in place
93
120
  retry_budget, infra_budget only while a scheduler runs: its live budgets (a number each)
121
+ after absolute path of the plan this one follows (`plan --after`)
94
122
  integration.base commit the integration branch started from
95
123
  verification.{status,exit,log,command,fingerprint} the combined verification; status PASS, FAIL or INTERRUPTED (a signal stopped it)
96
124
  verification.{flaky,retry.log} only when a failing command passed on rerun (lanes: flaky alone, per lane)
@@ -117,10 +145,14 @@ with worktrees and branches at:
117
145
 
118
146
  ```
119
147
  <repo>/../.forge-worktrees/<run-id>/<task-id> worktree
148
+ <repo>/../.forge-worktrees/<run-id>/_group-<gid> group-review candidate; kept for the merge
120
149
  forge/<run-id>/<task-id> task branch
121
150
  forge/<run-id>-integration integration branch
122
151
  ```
123
152
 
153
+ A group review's files are what each outcome writes. The rules are in
154
+ [Groups and group review](../references/decompose.md#groups-and-group-review-opt-in).
155
+
124
156
  `control.log` lines look like
125
157
  `{"at": 1761200000.5, "actor": "ui", "action": "set", "task": null, "key": "qa-threshold", "value": "P2", "previous": "P1"}`
126
158
  (`actor` is `cli` or `ui`; `action` is `set`, `pin`, `unpin`, `drain`, `resume`, `stop`, `retry` or
package/docs/commands.md CHANGED
@@ -15,17 +15,25 @@ harness (`/forge`); this command installs forge and drives its optional tools.
15
15
  | `forge update` | fast-forward a git checkout and refresh every harness installation; on an npm install it names the npm command instead. See [updating](install.md#updating-all-harness-installations) |
16
16
  | `forge version [--check]` | the installed version, and whether a newer release is out |
17
17
  | `forge fractal …` | opt-in Fractal execution; see [the command group](fractal.md#forge-fractal-command-group) |
18
- | `forge runs [--repo DIR \| --all] [--limit N] [--json]` | this repo's recent runs, newest first: run id, kind, age, task states, verification and final review, goal, and the run dir. Read-only; the same summaries forge-ui shows |
19
- | `forge control show\|set\|pin\|unpin\|drain\|resume\|stop\|retry\|add PLAN_DIR …` | change a live plan: `set` takes `qa-threshold` (`P0`..`P3`, `none` or `default` for the plan, `inherit` per task), `timeout`, `escalate-after`, `escalate-effort` (`on`/`off`), `verify-retries`, `infra-backoff` (a backoff shape; `none` drops it), `infra-fallback` (`on`/`off`), `max-attempts` (a non-negative integer, `0` = no cap, and only with `--confirm`), `converge-window` (a non-negative integer), `pre-review-tests` (`on`/`off`), `pre-review-parallel` (1-64), `retry-budget`, `infra-retries` or `max-parallel` (1-64) (the last three only while a scheduler runs; `--task ID` for `qa-threshold` and `retry-budget`, value `inherit` drops the override); `pin PLAN_DIR TASK SPEC` sets the model the task's next full retry uses once, `unpin` drops it. While a scheduler runs: `drain` starts nothing new until `resume` (a run with nothing left to start ends as usual); `stop [--now]` ends the run once the running tasks finish (`--now` interrupts them; `run` exits 130 without verifying, unless every task had merged by then: it then verifies and exits 0 as usual); `retry PLAN_DIR TASK [--dwarf SPEC]` queues a retry, and a `NEEDS_DECISION` task instead needs `--decide retry=N` or `--decide threshold=Pn`, or `--dwarf SPEC`, each with `--reason TEXT --approved`; `add PLAN_DIR TASK` (a row appended to `tasks.tsv`) queues a request the scheduler applies or refuses. `show` (`--json` for JSON) also says whether the run is drained or stopping, prints an `INFRA` task's cause, and, while a scheduler is live, lists each infrastructure pause with its reset and "needs you". The text table lists each task's attempts against its cap (`9/8`, or `9/-` when there is no cap). Every change and every request's outcome is logged in `control.log`. Exit 2 invalid input, 3 refused. See [live controls](decomposed-runs.md#changing-a-run-while-it-works) |
20
- | `forge config show [--repo DIR] [--json]` / `forge config set <key> <value> [--repo DIR] [--json]` / `forge config unset <key> [--repo DIR] [--json]` | one view of every config source (registry, the legacy Jev file, decide, the repo's `.forge/verify`, `setup` and `verify-subset`, dataset, `FORGE_*` variables with secrets hidden); `set` / `unset` edit `repo.verify`, `repo.setup`, `repo.verify-subset` (must contain `{files}` or `{changed}`; `--repo` required) and `decide.gate.<gate>`, `decide.gate.<gate>.provider`, `decide.gate.<gate>.model` (`off`, `shadow` or `on`; those write the user level and do not need `--repo`). Unset of a `decide.gate.*` key is refused: set the mode to `off`. `-` as a value reads stdin for the per-repo files. Exit 2 on invalid input |
18
+ | `forge runs [--repo DIR \| --all] [--limit N] [--json]` | this repo's recent runs, newest first: run id, kind, age, task states, verification and final review, goal, `after <run>` when the plan was chained, and the run dir. Read-only; the same summaries forge-ui shows |
19
+ | `forge handoff [show] [RUN_DIR \| --repo DIR] [--json]` / `note RUN_DIR TEXT [--actor A] [--json]` / `claim RUN_DIR --harness H [--session S] [--take-over] [--json]` / `resume RUN_DIR [--take-over] [--harness H] [--session S] [--json]` | the run for the next session. `show` is the default (`forge handoff` and `forge handoff RUN_DIR`); it writes nothing. `--repo DIR`, or no argument inside a checkout, reports that repo's newest registered plan that is live or still has a task not `MERGED`. The report has the run, its option files and `run.flags.json`, scheduler liveness, task states, what needs a person, the last `control.log` changes, tasks left `RUNNING`, notes newest first, the driver and the next commands. `note` appends one line to `handoff.notes.jsonl` (`--actor` defaults to `cli`; whitespace collapses; empty text, text over 2000 characters and text that is not UTF-8 are refused). `claim` requires `--harness H` (`[a-z0-9._-]{1,40}`) and writes `handoff.driver.json` (`harness`, `session`, `since`, `last_seen`); `--session S` is an id with no whitespace, at most 200 characters. A different driver last seen under 12 hours ago is refused unless `--take-over` (one `control.log` line, action `take-over`, actor `cli`, and a dataset `control` event). `resume` claims (`--harness` defaults to `unknown`), follows a live scheduler and starts nothing, names `forge fractal resume` for a Fractal plan, and otherwise saves each stale `RUNNING` task's diff, resets that worktree, marks it `INTERRUPTED` without counting the attempt twice, prepares every `INTERRUPTED` task and restarts `run` detached from `run.flags.json`. Exit 0 ok, 2 usage or not a run dir, 3 no run to report or another driver holds the run; a restart that cannot be launched exits 1. See [from another session](decomposed-runs.md#from-another-session-or-harness) |
20
+ | `forge control show\|set\|pin\|unpin\|drain\|resume\|stop\|retry\|add PLAN_DIR …` | change a live plan: `set` takes `qa-threshold` (`P0`..`P3`, `none` or `default` for the plan, `inherit` per task), `timeout`, `escalate-after`, `escalate-effort` (`on`/`off`), `verify-retries`, `infra-backoff` (a backoff shape; `none` drops it), `infra-fallback` (`on`/`off`), `max-attempts` (a non-negative integer, `0` = no cap, and only with `--confirm`), `converge-window` (a non-negative integer), `pre-review-tests` (`on`/`off`), `pre-review-parallel` (1-64), `summaries` (`on`/`off`; on a finished run it also starts `forge summarize`), `retry-budget`, `infra-retries` or `max-parallel` (1-64) (the last three only while a scheduler runs; `--task ID` for `qa-threshold`, `retry-budget` and `summaries`, value `inherit` drops the override); `pin PLAN_DIR TASK SPEC` sets the model the task's next full retry uses once, `unpin` drops it. While a scheduler runs: `drain` starts nothing new until `resume` (a run with nothing left to start ends as usual); `stop [--now]` ends the run once the running tasks finish (`--now` interrupts them; `run` exits 130 without verifying, unless every task had merged by then: it then verifies and exits 0 as usual); `retry PLAN_DIR TASK [--dwarf SPEC]` queues a retry, including a `STALE` task (its `prompt.md` or `approach.md` changed during the attempt: it is re-dispatched with the new text on the same implementer, and `--dwarf` is refused). `retry PLAN_DIR TASK --answer TEXT` (or `--answer-file F`, `-` for stdin) answers a `NEEDS_INPUT` task: 1 to 8000 characters after stripping, no NUL, and not combined with `--dwarf` or `--decide`. On a live run it is queued and the scheduler writes `tasks/<id>/answer.md` and resumes the task; with no live run it prepares the task through `forge-parallel.sh retry --answer-file --no-dispatch` for the next `run` (`forge-parallel.sh retry --answer` itself is unchanged). `--json` prints `{"queued": true, "request"}` when queued and `{"queued": false, "prepared": true}` when prepared. `control.log` records the value `answer` and `answer_chars`, never the text (`--actor` `ui` or `cli`, default `cli`). A `NEEDS_DECISION` task instead needs `--decide retry=N` or `--decide threshold=Pn`, or `--dwarf SPEC`, each with `--reason TEXT --approved`; `add PLAN_DIR TASK` (a row appended to `tasks.tsv`) queues a request the scheduler applies or refuses. `show` (`--json` for JSON) also says whether the run is drained or stopping, prints an `INFRA` task's cause, and, while a scheduler is live, lists each infrastructure pause with its reset and "needs you". The text table lists each task's attempts against its cap (`9/8`, or `9/-` when there is no cap). Every change and every request's outcome is logged in `control.log`. Exit 2 invalid input, 3 refused. See [live controls](decomposed-runs.md#changing-a-run-while-it-works) |
21
+ | `forge config show [--repo DIR] [--json]` / `forge config set <key> <value> [--repo DIR] [--json]` / `forge config unset <key> [--repo DIR] [--json]` | one view of every config source (registry, the legacy Jev file, decide, the user `features`, the repo's `.forge/verify`, `setup` and `verify-subset`, dataset, `FORGE_*` variables with secrets hidden); `set` / `unset` edit `repo.verify`, `repo.setup`, `repo.verify-subset` (must contain `{files}` or `{changed}`; `--repo` required) and `decide.gate.<gate>`, `decide.gate.<gate>.provider`, `decide.gate.<gate>.model` (`off`, `shadow` or `on`; those write the user level and do not need `--repo`). They also set the user feature keys: `retro` (`off` or `on`), `brief` (`off`, `advisory`, `gated` or `strict`), `brief.scope` (`task`, `wave` or `plan`), `brief.model` (a spec), `summaries` (`off` or `on`), `summaries.model` (a spec), `storage.compact` (`auto`, the default, or `off`) and `storage.warn-gb` (gigabytes, `20` by default, or `off`; see [forge du](#forge-du)). Those write the user file and ignore `--repo`; `unset` removes one key. A bad value exits 2 and writes nothing. A model spec is checked for its form when it is set; whether it resolves is checked when `plan` uses it. Unset of a `decide.gate.*` key is refused: set the mode to `off`. `-` as a value reads stdin for the per-repo files. Exit 2 on invalid input |
21
22
  | `forge config profile list\|show\|create\|edit\|set\|unset\|rm\|use` | named bundles of routing, policy, gates and budget in `decide.json`; see [below](#forge-config-profile) |
22
23
  | `forge watch [RUN_DIR \| --repo DIR \| --all] [--interval S] [--settle S] [--until-done] [--no-notify] [--exec CMD]` | follow runs live: a line for every task status change, and a desktop notification, `--exec CMD` and the repo's `.forge/on-finish` when a run finishes or fails, a task fails or a final review gives its verdict; see [below](#forge-watch). Read-only |
23
24
  | `forge runs rm RUN_DIR [--dry-run] [--yes] [--no-archive] [--worktrees] [--branches] [--json]` | delete a run directory but keep what it taught the dataset; see [below](#forge-runs-rm) |
25
+ | `forge runs compact [RUN_DIR … \| --repo DIR \| --all] [--logs] [--older-than DAYS] [--dry-run] [--json]` | keep every run and take back what it holds for nothing: leftover review snapshots and, with `--logs`, gzipped log copies; see [below](#forge-runs-compact) |
26
+ | `forge du [--repo DIR \| --all] [--top N] [--json]` | what forge takes on disk (run dirs, worktree folders, its data home) and the command that takes each part back; see [below](#forge-du). Read-only |
27
+ | `forge worktrees rm PATH… [--branches] [--dry-run] [--json] [--actor {cli,ui}]` | remove `failed` and `finished` worktrees, and leftover folders, by forge-ui's rules (never `--force`; `--branches` is `git branch -d` on a finished worktree's merged branch). Exit 0 when no row failed, 4 when one did, 2 usage. See [below](#forge-worktrees-rm) |
24
28
  | `forge runs rerun RUN_DIR --dwarf SPEC [--qa SPEC] [--to DIR] [--max-parallel N] [--dry-run] [--run --yes]` | set up the same plan again with another implementer, from the same starting commit; spends nothing unless `--run --yes`; never merges. See [below](#forge-runs-rerun-and-compare) |
25
29
  | `forge runs compare RUN_A RUN_B [--json] [--no-record]` | two runs of one plan, side by side, per task; records the pair in the dataset |
26
- | `forge memory show\|learnings\|prune\|spend REPO …` | a repository's project memory; `learnings REPO --json` lists every learning in its ledger with what forge does with it (`in_memory`, `waiting` for a second run, `stale`, `capped`, `muted`), from forge-memory.sh's own rebuild, without changing the repository. See [project memory](memory.md) |
30
+ | `forge memory show\|learnings\|prune\|spend\|forget REPO …` | a repository's project memory; `learnings REPO --json` lists every learning in its ledger with what forge does with it (`in_memory`, `waiting` for a second run, `stale`, `capped`, `muted`), from forge-memory.sh's own rebuild, without changing the repository. `forget REPO KEY…` (`KEY` is `category:key`; `--dry-run`, `--json`, `--actor ui\|cli`) drops those ledger rows and rebuilds `memory.md`. A missing key is not an error. `--json` prints `{ok, dry_run, keys: [{key, rows, found}], memory_lines_removed}`. Exit 0 ok, 2 usage. See [below](#forge-memory-forget) and [project memory](memory.md) |
27
31
  | `forge issues RUN [--apply] …` | file the review findings a run left open as GitHub issues; see [below](#forge-issues) |
28
32
  | `forge pr [RUN_DIR \| --repo DIR] [--texts] [--paths] [--out FILE] [--create [--base B] [--head B]]` | a draft pull-request description for a finished run, on stdout; `--create` opens it as a draft PR with `gh`; see [below](#forge-pr) |
33
+ | `forge retro note\|report\|issues PLAN …` | retro notes on what got in a run's way (`plan --retro`): `note` records one by hand (`--type`, `--fixable-by`, `--summary`, and `--command`, `--exit`, `--error`, `--blocking`, `--tried` as needed), `report` writes `retro.md`, and `issues` drafts GitHub issues for forge's own repository and posts only with `--apply --approve HASH`. `record` is forge's own call after a dispatch. Exit 2 usage, 3 refused. See [retro notes](../references/decompose.md#retro-notes-opt-in) |
34
+ | `forge brief write\|show\|answer\|stale\|propose\|proposals\|apply\|reject PLAN …` | each task's open questions, asked before it starts (`plan --brief`), and the diff a wider answer waits on. `write` asks the missing ones (`--task ID`, `--jobs N`; `--force` redoes a task that already has `brief.json`). `show` lists them (`--task`, `--json`), parked questions by group and tasks marked `affected by <pid>`. `answer PLAN TASK QID TEXT` records an answer (`--file F`, `--actor`). A task answer goes into the prompt before the task starts and is late after. A parked `wave` or `plan` question is answerable only when `--brief-scope` is at least that wide; the answer is stored and the command prints `forge brief propose`. `stale PLAN TASK` flags dependents' open questions after a merge. `propose PLAN TASK QID` (`--actor`) turns that parked answer into `proposals/<pid>/`, one read-only dispatch. `proposals PLAN` (`--json`) lists every proposal with its state, scope, group, summary, diff and, while `proposed`, the apply line. `apply PLAN PID --approve HASH` (`--actor`, `--no-regenerate`) writes that diff. `--no-regenerate` marks affected tasks and does not regenerate their questions. `reject PLAN PID` (`--reason TEXT`, `--actor`) marks it `rejected` and touches no plan file. Exit 2 usage or an unknown task, question or proposal; 3 when PLAN is not a plan dir, when brief is off (`write`, `show`, `propose`), or when a proposal is refused (`propose`, `apply`, `reject`). See [brief mode](../references/decompose.md#brief-mode-opt-in) |
35
+ | `forge group show\|retry\|set PLAN …` | a plan's task groups (`plan --groups`, and `plan --group-review`). `show PLAN [--group GID] [--json]` is read-only: every group, and for a `review=group` group its round, status, implicated tasks and, when `NEEDS_DECISION`, the first line of `decision.md`. Exit 3 when there is no `groups.tsv`; exit 2 for an unknown group. `retry PLAN GID [--tasks a,b] [--reason TEXT]` answers an ambiguous `NEEDS_DECISION` (`--tasks` is required; those members become `FAIL`, and so does any member with its own blocking finding) or rearms `UNKNOWN`, `INFRA`, `TIMEOUT`, `INTERRUPTED` or `ERROR` to `INTERRUPTED` so the next run reviews again, with no member attempt spent. An oversized group is refused: split `groups.tsv` and run `plan` again. `set PLAN GID [--title T] [--goal G] [--reason TEXT]` rewrites a group's title or goal (one line each, at most 500 characters, empty for none) and freezes the groups again, logged as `group-set`; refused (exit 3) when the groups or a member's deps or files changed since `plan`. `--reason` is at most 2000 characters, logged in `control.log` with `actor` `cli`. Exit 0 ok, 2 usage or an unknown group or task (including `retry` with no `groups.tsv`), 3 refused (a state this command does not retry, or the control lock busy). A settle that fails returns that command's exit code. See [group review](reviews.md#group-review-opt-in) |
36
+ | `forge summarize PLAN [--task ID] [--force] [--json]` | a generated summary per task (`plan --summaries on`), in `tasks/<id>/summary.json`, rewritten only when its facts change. Exit 2 usage, 3 when PLAN is not a directory. See [task summaries](../references/decompose.md#task-summaries-opt-in) |
29
37
  | `forge ui open\|status\|stop` | forge-ui, the run viewer; see [the command group](forge-ui.md#forge-ui-command-group) |
30
38
  | `forge dataset …` | every run's inputs and outcomes; see [run dataset](dataset.md) |
31
39
  | `forge decide …` | decision-model gates, providers, budgets and the privacy floor; see [below](#forge-decide) |
@@ -91,6 +99,104 @@ reports; `--yes` skips the prompt for the run id (needed without a terminal); `-
91
99
  object, on failure too. Exit 0 ok, 2 refused input, 3 busy or the run is active, 4 failed during
92
100
  deletion or the run directory was kept (the same command finishes the job).
93
101
 
102
+ ### `forge runs compact`
103
+
104
+ Keeps every run on disk, viewable in forge-ui and in the dataset, and takes back what it holds for
105
+ nothing. Per run, holding the run's own lock as `forge runs rm` does:
106
+
107
+ 1. **preserve**: a strict dataset import of the run, as `forge runs rm` starts with; if any event cannot
108
+ be stored, nothing in that run is touched;
109
+ 2. **snapshots**: every review snapshot is removed (a `review` or `review-*` directory with a `.git`, beside
110
+ a `review.base`). Nothing reads one once its review has ended, and since 0.18 forge removes each one
111
+ then; these are older runs' and interrupted reviews' leftovers;
112
+ 3. **logs** (`--logs`): each dwarf's and reviewer's log copy in its execution record
113
+ (`attempts/<role>-<id>/<role>.log`, 64 KB or more) becomes `<role>.log.gz`, with the same mode and
114
+ times; forge-ui reads either the same way. The logs in task dirs, which running agents write and
115
+ retries read, are never touched;
116
+ 4. **record**: the dataset event `run_compacted`.
117
+
118
+ It never touches an active run, a worktree, or anything forge does not create: a dependency install
119
+ or a `.git` found inside a run dir is reported with its size (`stray`) and left in place. Name run dirs,
120
+ or take every registered run of a repository (`--repo DIR`) or of every repository (`--all`); there an
121
+ active run, or one changed within the hour, is skipped. `--older-than DAYS` keeps to runs unchanged that
122
+ long; `--dry-run` changes nothing and says what would go; `--json` prints one object. Exit 0 ok, 2
123
+ refused input, 3 the one run named is active, 4 failed. On a real 2.3 GB plan dir it took back
124
+ 2.2 GB, and forge-ui showed every conversation and check as before.
125
+
126
+ **At run start** (`run` and solo runs), forge starts the same compaction with `--logs` in the background
127
+ for the repository's other runs (`storage.compact auto`, the default; `forge config set storage.compact
128
+ off` or `FORGE_STORAGE_COMPACT=off` turns it off; `FORGE_KEEP_SNAPSHOTS=1` keeps snapshots), measures the
129
+ repository's footprint, and warns on stderr when the last measurement passed `storage.warn-gb` (20 GB by
130
+ default; `off` turns it off). A run never waits for it or fails over it. forge never deletes a run on its
131
+ own: that stays `forge runs rm`.
132
+
133
+ ### `forge du`
134
+
135
+ forge knows where to look from its location list, `<config home>/forge/locations.jsonl`
136
+ (`scripts/forge_locations.py`): every run dir and worktree forge creates is added as it is made, with its
137
+ repository's git dir and main working tree, and marked gone when forge removes it. A checkout deleted by hand or
138
+ reached through a symlink hides nothing. It is written whatever `FORGE_DATASET` says (`FORGE_RUN_REGISTRY=off`
139
+ turns it off with the registry), and the first `forge du` or `forge runs compact --repo|--all` fills it once
140
+ from the run registry and the worktrees on disk. It records what forge did; what is there now is always
141
+ read from the disk and git.
142
+
143
+ What forge takes on disk, for the repository at the current directory, `--repo DIR`, or every
144
+ repository (`--all`): each registered run dir (total, review snapshots, logs, other files, anything
145
+ forge does not create, and what `forge runs compact --logs` would take back), each run's worktree
146
+ folder, and forge's data home (the dataset and its blobs, which are kept, archives, exports, legacy
147
+ files). It ends with the commands that take each part back. Sizes are disk usage, as `du` counts it;
148
+ every file is visited, so a large tree takes a while. It reads only, apart from keeping the totals for
149
+ the `storage.warn-gb` check. forge-ui's **Disk** screen shows the same report and, when the server can write, compacts from it after a dry run ([Controls](forge-ui.md#controls)).
150
+
151
+ ### `forge worktrees rm`
152
+
153
+ ```
154
+ forge worktrees rm PATH… [--branches] [--dry-run] [--json] [--actor {cli,ui}]
155
+ ```
156
+
157
+ Removes worktrees by the rules of forge-ui's Worktrees screen (`ui/forge_ui/worktrees.py` `compute`), the one rule set. It never passes `--force`.
158
+
159
+ - A `failed` or `finished` worktree whose repository is known is `git worktree remove`. `--branches` also runs `git branch -d` (never `-D`) on a `finished` worktree whose branch is merged. A `failed` worktree's branch stays, and so does an unmerged one: `-d` refuses it.
160
+ - An `unknown` row that is a leftover folder (git no longer lists it as a worktree) is deleted as a folder, after checking again that git does not list it and that it still sits under `.forge-worktrees`.
161
+ - Every other status is skipped with its reason: its run is active, it has uncommitted changes, it is locked by git, it is the integration worktree of a run not integrated yet, its folder is gone (`git worktree prune`), it is not forge's worktree, it is already removed, it is not a leftover, the path is not a worktree forge knows, or its repository is not known.
162
+
163
+ The same path given twice is one row. `--dry-run` computes the same actions and changes nothing. `--actor` is who asked, `cli` (the default) or `ui`, recorded with a real removal: a `worktree_removed` dataset event (the actor on the event) and a gone entry in the location list, `forge worktrees rm (<actor>)`. A skip and a dry run record nothing.
164
+
165
+ `--json` prints one object on stdout, on failure too:
166
+
167
+ ```json
168
+ {"ok": true, "dry_run": false,
169
+ "rows": [{"path": "…", "action": "remove", "status": "removed", "reason": null}]}
170
+ ```
171
+
172
+ `action` is `remove`, `remove+branch`, `delete-folder` or `none`. `status` is `removed`, `skipped`, `failed` or `would-remove` (the dry run). `reason` is a string, or null when there is nothing to say. `ok` is false when any row is `failed`. A worktree that was removed and whose branch then refused `-d` is `failed`, with the reason that the worktree is gone and the branch stays.
173
+
174
+ Exit 0 when no row failed (a skip is not a failure), 4 when a row failed, 2 usage. forge-ui's Remove runs this with `--actor ui`. See [Controls](forge-ui.md#controls).
175
+
176
+ ### `forge memory forget`
177
+
178
+ ```
179
+ forge memory forget REPO KEY… [--dry-run] [--json] [--actor {ui,cli}]
180
+ ```
181
+
182
+ `KEY` is `category:key`, the identity the rebuild and `learnings` already use. Each part is normalised (lowercase, every run of non-alphanumerics collapsed to one space) and neither part may be empty. A repeated key, or two spellings that normalise to one, is a single entry.
183
+
184
+ It removes those learnings' rows from `.forge/ledger.tsv` and rebuilds `.forge/memory.md` from the ledger that remains. `--dry-run` touches neither file. A key that is not in the ledger is not an error. The command runs when `FORGE_MEMORY=off` too: it is an edit you asked for, not an automatic write.
185
+
186
+ `--json` prints one object:
187
+
188
+ ```json
189
+ {"ok": true, "dry_run": false,
190
+ "keys": [{"key": "trap:alpha thing", "rows": 2, "found": true}],
191
+ "memory_lines_removed": ["- alpha thing [a.py]"]}
192
+ ```
193
+
194
+ `rows` is how many ledger rows matched that key. `found` is false when none did. `memory_lines_removed` is the `- ` fact lines a rebuild of `memory.md` loses, in their old order, not a count and not the section headings. `ok` is true on that object. A usage error prints to stderr and exits before any JSON.
195
+
196
+ A real forget that drops at least one row records a `memory_forget` dataset event (`keys`, `rows`, `actor`). A dry run, and a forget that matches nothing, record nothing. `--actor` is `cli` (the default) or `ui`.
197
+
198
+ Exit 0 ok, 2 usage (a bad key, an unknown option, a missing repo, or no key). See [project memory](memory.md#scriptsforge-memorysh).
199
+
94
200
  ### `forge runs rerun` and `forge runs compare`
95
201
 
96
202
  `forge runs rerun <run-dir> --dwarf SPEC` answers "would this plan have gone better on another
@@ -412,8 +518,9 @@ Resolves a spec into a real CLI invocation and runs it. Needs only bash and core
412
518
  is the point: it behaves identically no matter which harness is orchestrating.
413
519
 
414
520
  ```
415
- forge-dispatch.sh doctor --spec <spec> [--role dwarf|qa|planner] [--service-tier fast]
521
+ forge-dispatch.sh doctor --spec <spec> [--role dwarf|qa|planner|side] [--service-tier fast]
416
522
  forge-dispatch.sh dwarf <spec> --prompt-file <f> [--repo <dir>] [--run-dir <d>] [--yolo] [--dry-run]
523
+ forge-dispatch.sh side <spec> --prompt-file <f> [--repo <dir>] [--run-dir <d>] [--yolo] [--dry-run]
417
524
  forge-dispatch.sh qa <spec> --prompt-file <f> [--repo <dir>] [--run-dir <d>] [--yolo] [--dry-run]
418
525
  [--native-review [--review-base <ref>]]
419
526
  forge-dispatch.sh planner <spec> --prompt-file <f> [--repo <dir>] [--run-dir <d>] [--dry-run]
@@ -598,16 +705,21 @@ Decomposed runs: many dwarves in isolated worktrees, per-task QA, only passing w
598
705
  Bash 3.2 entrypoints use a Python standard-library coordinator to schedule eligible tasks.
599
706
 
600
707
  ```
601
- forge-parallel.sh plan <plan-dir> --repo <dir> [routing flags] [--planner <spec>] [--no-memory]
708
+ forge-parallel.sh plan <plan-dir> --repo <dir> [--after <plan-dir>] [routing flags] [--planner <spec>] [--no-memory]
602
709
  [--gate NAME=MODE[,...]] [--no-gates] [--decide-budget tokens=N[,usd=X]]
603
710
  [--decompose-level L] [--shadow-qa <spec>[,..]|none] [--shadow-rate R]
604
- [--reviewer-session | --no-reviewer-session]
711
+ [--reviewer-session | --reviewer-session-rate R | --no-reviewer-session]
605
712
  [--implementer-session | --no-implementer-session]
606
713
  [--explore E] [--ui | --no-ui] [--fail-first | --no-fail-first]
607
714
  [--pre-review-tests | --no-pre-review-tests] [--pre-review-parallel N]
608
715
  [--qa-threshold P0|P1|P2|P3|none|default]
609
716
  [--profile NAME | --no-profile] [--fast ROLES] [--collapse-chains]
610
- [--max-attempts N] [--converge-window N] [--no-infra-fallback]
717
+ [--groups waves|FILE] [--group-review]
718
+ [--group-max-tasks N] [--group-max-diff-kb N]
719
+ [--max-attempts N] [--retry-per-model N | --no-retry-per-model]
720
+ [--converge-window N] [--no-infra-fallback]
721
+ [--retro | --no-retro] [--brief advisory|gated|strict|off] [--brief-scope task|wave|plan]
722
+ [--brief-model SPEC] [--summaries on|off] [--summaries-model SPEC]
611
723
  forge-parallel.sh auto <plan-dir> --repo <dir> --goal-file <file> [--planner <spec>]
612
724
  [--decompose-level L] [--plan auto|always|never]
613
725
  [--one-task-difficulty low|medium|high]
@@ -640,7 +752,7 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
640
752
 
641
753
  | Subcommand | Does |
642
754
  |---|---|
643
- | `plan` | validate `tasks.tsv`, resolve difficulty → concrete dwarf/qa specs, compute waves, render the approval table |
755
+ | `plan` | validate `tasks.tsv`, resolve difficulty → concrete dwarf/qa specs, compute waves, and with `groups.tsv` or `--groups` validate, resolve and freeze the groups; render the approval table. A `dwarf` cell of `script` is kept: that task runs the executable `tasks/<id>/run` |
644
756
  | `auto` | from a goal file to that table in one blocking command; with `--approved`, also `run`. The orchestrator's job is mechanical, so a small model can drive it. See [below](#forge-parallelsh-auto) |
645
757
  | `run` | schedule ready tasks; per task: worktree → dwarf → diff → QA → status; merge passing tasks onto the integration branch |
646
758
  | `retry` | re-run **one** failed task in the worktree it already has, with its reviewer's findings in the prompt; with `--answer` or `--answer-file`, answer a `NEEDS_INPUT` task and run it; with `--decide` or `--dwarf` plus `--reason` and `--approved`, decide a `NEEDS_DECISION` task and run it |
@@ -650,6 +762,8 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
650
762
  | `review` | **opt-in, spends QA quota** — one reviewer reads the whole combined result; read-only |
651
763
  | `split` / `combine` | move tasks into a plan of their own / join fully merged plans into one |
652
764
 
765
+ A `tasks.tsv` row whose `dwarf` column is `script` runs the executable `tasks/<id>/run`. `plan` exits 2 when that file is missing or not executable, does not route the row, skips its implementer doctor, shows it in the table and counts no implementer dispatch. The `qa` column is still a model. See [Scripted tasks](../references/decompose.md#scripted-tasks).
766
+
653
767
  | Flag | Subcommands | Remembered in the plan | Means |
654
768
  |---|---|---|---|
655
769
  | `--gate NAME=MODE[,NAME=MODE...]` | plan | `jev-selection.json` | set decision-model gates for this run; repeatable, a later one wins. When the file exists, `run` and `retry` keep it; with no file they apply the flags passed then and freeze them |
@@ -664,12 +778,13 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
664
778
  | `--no-infra-fallback` | plan, run | `infra_fallback` | turn lateral recovery off. A plan with no file stays off, and a re-plan keeps the setting it has |
665
779
  | `--converge-window N` | plan | `converge_window` | reviews the non-converging signal looks at (default `4` when the file is absent; below `2` it never fires). Changing it later is `forge control set converge-window N` |
666
780
  | `--max-attempts N` | plan | `max_attempts` | attempts a task may spend across runs before it stops for a decision (default `8` when the file is absent; `0` means no cap). Changing it later is `forge control set max-attempts N --confirm` |
781
+ | `--retry-per-model N` / `--no-retry-per-model` | plan | `retry_per_model` | a task may fail `N` times (1 to 99) on each model the retry policy gives it, then it moves one rung up and the count starts again. With `escalate_effort` on, the same `N` applies to each effort of that model. Replaces `--escalate-after` for this plan: when `escalate_after` is also present, `run` says so and follows `retry_per_model`. `--no-retry-per-model` removes the file; a re-plan with neither keeps it. Automatic retries still need `--retry-failed` above 0. See [a budget per model](reviews.md#a-budget-per-model---retry-per-model-n) |
667
782
  | `--decide retry=N` / `--decide threshold=Pn` | retry | no — this retry only | resume a `NEEDS_DECISION` task: `N` more attempts (`N` from 1 to 20) or this task's blocking threshold (`P0`..`P3`) and then one retry. Needs `--reason` and `--approved`. Refused on any other status |
668
783
  | `--qa-threshold P0\|P1\|P2\|P3\|none\|default` | plan, run, retry, review | `qa_threshold` | the least severe CONFIRMED finding that still blocks (default `P2`); milder ones become known issues; `none` means P3, `default` removes the setting. Solo takes `P0`..`P3` or `none`. See [the verdict rule](reviews.md#verdicts-and-failure) |
669
784
  | `--verify-retries N` | run, retry, integrate | `verify_retries` | reruns of a failed verify command, or of each failed lane (default `1`, `0` = strict single run); with `.forge/verify-subset`, a failed command's failing test files run alone first and confirm a regression without a full rerun |
670
785
  | `--verify-lane 'name[opts]=cmd'` | run, retry | `verify.d/<name>` | one verification lane; repeatable. Options as in a lane file, comma-separated (`group=g`, `first`, `retries=n`, `reports=dir`, `baseline=file`). The first one of an invocation replaces the plan's earlier lanes and `--verify`; see [verification lanes](../references/decompose.md#execution-checks-and-integration-verification) |
671
786
  | `--verify-parallel N` | run, retry, integrate | `verify_parallel` | lanes run at once, 1 to 32 (default `3`) |
672
- | `--escalate-after N` | run, retry | `escalate_after` | failed attempts on one model before the next goes a tier up (default `3`, `0` = off) |
787
+ | `--escalate-after N` | run, retry | `escalate_after` | failed attempts on one model before the next goes a tier up (default `3`, `0` = off). When `retry_per_model` is set, that count is the trigger instead |
673
788
  | `--pre-review-tests` | plan | `pre_review_tests` | before each review, run only the tests the attempt affects; a red attempt goes back to its implementer unreviewed (off by default; `--no-pre-review-tests` turns it off). See [pre-review tests](../references/decompose.md#pre-review-tests-opt-in) |
674
789
  | `--pre-review-parallel N` | plan | `pre_review_parallel` | how many of those checks run at once across tasks, 1 to 64 (default `2`) |
675
790
  | `--sweep Pn` | run | no — this run only | once every task has merged, fix the open findings at `Pn` or worse in a few extra tasks, one per file, each with a narrow review; the plan goes to `sweep/plan.md`. Once per plan; what it does not fix stays for `forge issues`. See [the finding sweep](reviews.md#fixing-them-in-the-run-the-finding-sweep-opt-in) |
@@ -682,8 +797,19 @@ forge-parallel.sh combine <new-plan-dir> <plan-dir> <plan-dir>... [--verify <c
682
797
  | `--no-profile` | plan | removes `profile.json` | no profile. `routed.json` stays |
683
798
  | `--fast ROLES` | plan | `fast` | which of `dwarf`, `qa`, `planner`, `review` ask for the fast tier (`all` or `none`). Omitted on a re-plan, the file stays; `none` removes it. See [below](#the-fast-tier) |
684
799
  | `--collapse-chains` | plan | no — this call only | merge a chain into one task named `combined`, after validation and before routing. A one-task or branching plan is unchanged. An already collapsed plan is not an error. See [below](#collapse-chains) |
685
-
686
- **Exit codes:** `0` ok · `2` usage or validation · `3` precondition (not a git repo, …) ·
800
+ | `--after DIR` | plan | `after`, `integration.base` | start from plan DIR's integration branch. DIR is a plan of the same repo whose tasks are all `MERGED`, whose integration tip equals `accepted.integration`, and whose scheduler is not live. Otherwise exit 2, and the plan directory and branches stay as they were. Creates `forge/<run>-integration` at that tip. A later `plan` without the flag keeps it. `run` exits 3 if DIR moved before this plan has merged a task. See [Chained plans](../references/decompose.md#chained-plans) |
801
+ | `--groups waves\|FILE` | plan | `groups.tsv`, `groups.frozen` | opt-in. `waves` writes one group per computed wave of at least two tasks; `FILE` copies that `groups.tsv`. An existing `groups.tsv` and no flag is kept. Then validated, its group QA resolved, and frozen. `run` refuses when the file or a member's deps or files changed. See [Groups and group review](../references/decompose.md#groups-and-group-review-opt-in) |
802
+ | `--group-review` | plan | the `review` column | with `--groups waves` only: those groups are `review=group` (one QA review for the group). High-difficulty tasks stay out. Without `waves`, `plan` exits 2 |
803
+ | `--group-max-tasks N` | plan | `group_max_tasks`, only when given | most members of a review group (default 6). A positive integer. Deriving waves needs at least 2 |
804
+ | `--group-max-diff-kb N` | plan | `group_max_diff_kb`, only when given | largest combined diff a group review will read, in KB (default 256). Over it, the group stops for a decision and nothing is truncated |
805
+ | `--retro` / `--no-retro` | plan | `retro_mode` | agents record what got in their way, as retro notes. Off by default. Without either flag the plan keeps its earlier choice; a first plan takes the user setting (`forge config set retro on`). See [retro notes](../references/decompose.md#retro-notes-opt-in) |
806
+ | `--brief advisory\|gated\|strict\|off` | plan | `brief` | one read-only dispatch per task writes its open questions before the task starts. `advisory` lets the run go on, `gated` holds a task with an unanswered must-answer question, and `strict` makes `run` exit `3` while any question is open. `off` turns it off. On needs `--brief-model` (or `forge config set brief.model`), else exit `2`. See [brief mode](../references/decompose.md#brief-mode-opt-in) |
807
+ | `--brief-scope task\|wave\|plan` | plan | `brief_scope` | which parked questions can be answered. Default `task`: a task answer goes into that task's prompt, and a `wave` or `plan` question stays in `brief.parked.json` until a proposal is approved. `wave` also answers wave questions; the proposal may change the prompt, approach and files of unstarted members of that question's group, which must be in `groups.tsv`. `plan` answers wave and plan questions; a plan proposal may also add, remove and split tasks and change deps. See [brief mode](../references/decompose.md#brief-mode-opt-in). Only with brief on |
808
+ | `--brief-model SPEC` | plan | `brief_model` | the model that writes the questions. Required with brief on; forge never picks one |
809
+ | `--summaries on\|off` | plan | `summaries` | a generated summary per task in `tasks/<id>/summary.json`, rewritten only when its facts change. Off by default. See [task summaries](../references/decompose.md#task-summaries-opt-in) |
810
+ | `--summaries-model SPEC` | plan | `summaries_model` | the model that writes the summaries. Required with summaries on; forge never picks one |
811
+
812
+ **Exit codes:** `0` ok · `2` usage or validation · `3` precondition (not a git repo, …), and `run` on a strict brief plan with open questions (nothing starts) ·
687
813
  `4` **`plan` only: the plan gates sent work back** (see below); **`auto`:** the planner failed, its reply was refused, or the gates sent items back a second time ·
688
814
  `5` some task failed QA, the combined verification failed, or a task is still waiting for an
689
815
  answer or a decision · `6` integration conflict ·
@@ -919,8 +1045,11 @@ Exit `0` when the search finished, culprit or not, `1` when a step could not run
919
1045
  only the user can answer, kept in `tasks/<id>/needs_input.md`. The run summary lists it under
920
1046
  `waiting for your answer:` with the first line of the question and the command to answer it, and
921
1047
  the retry hint does not count it as failed. Its dependents end `BLOCKED`, and neither a later
922
- `run`, `--retry-failed` nor `forge control retry` resumes it. Only
923
- `retry <plan> <id> --answer "<text>"` (or `--answer-file F`) does: the question and the answer
1048
+ `run`, `--retry-failed` nor a plain `forge control retry` resumes it. Only an answer does:
1049
+ `retry <plan> <id> --answer "<text>"` (or `--answer-file F`), and on a live run
1050
+ `forge control retry <plan> <id> --answer TEXT` (or `--answer-file F`, `-` for stdin), which queues
1051
+ that answer for the scheduler. With no live run, `forge control retry --answer` prepares the task
1052
+ the way `retry … --answer-file --no-dispatch` does. The question and the answer
924
1053
  join the findings of the next attempt, a normal new attempt. Without an answer, or with one older
925
1054
  than the question, `retry` exits `2` and changes nothing; if escalation refuses the retry, the
926
1055
  question and the answer stay for the same `--answer` to be tried again. A run that ends with such a
@@ -929,7 +1058,8 @@ sets this status.
929
1058
 
930
1059
  **`NEEDS_DECISION`** is the same kind of stop for a choice rather than a question. The reviews in
931
1060
  the last window all failed and kept finding new problems, or the retry policy has no stronger
932
- model, or the task has spent its attempt cap (`plan --max-attempts N`, default 8 across runs;
1061
+ model, or every blocking finding needs a file the task does not declare (reason `plan`), or the
1062
+ task has spent its attempt cap (`plan --max-attempts N`, default 8 across runs;
933
1063
  `forge control set max-attempts N --confirm` changes it, and `0` means no cap). The reasons and
934
1064
  the `retry` and `accept` commands are in `tasks/<id>/decision.md`. The run summary lists them under
935
1065
  `waiting for your decision:`. Neither a later `run`, `--retry-failed`, a retry budget nor a pin
@@ -938,7 +1068,8 @@ resumes that same task. Only `retry <plan> <id> --decide retry=N` or `--decide t
938
1068
  `accept`, does. To resume several at once, add `--no-dispatch` to each `retry`, which records the
939
1069
  decision and starts nothing, then `run` the plan. Replacing it is a hand
940
1070
  edit of `tasks.tsv` before the next `run`, as the summary says (`forge control add` queues a new
941
- row but does not replace the stopped one). A live scheduler takes the same flags as `forge control retry`. A run that ends with such a
1071
+ row but does not replace the stopped one). A live scheduler takes the same flags as `forge control retry`, and
1072
+ `forge control accept <plan> <id> --reason "…" --approved` for `accept`. A run that ends with such a
942
1073
  task still in `tasks.tsv` and unmerged exits `5`. See
943
1074
  [when reviews don't converge](../references/decompose.md#when-reviews-dont-converge).
944
1075
 
package/docs/dataset.md CHANGED
@@ -46,5 +46,10 @@ import also reads a plan's `escalations.tsv` (with who decided: `policy`, `retry
46
46
  `control.log`, so human interventions made with `forge control` are in the dataset as
47
47
  `control` events. See [forge runs rm](commands.md#forge-runs-rm).
48
48
 
49
+ Keeping a run but taking back its space keeps the dataset too. `forge runs compact` starts with the same
50
+ strict import, then removes the run's leftover review snapshots (which the importer never reads) and,
51
+ with `--logs`, gzips its log copies (which the dataset does not store), and records `run_compacted`. A
52
+ second import of a compacted run adds no event. See [forge runs compact](commands.md#forge-runs-compact).
53
+
49
54
  Capture is fail-open and never read by anything that builds a prompt. See
50
55
  [references/dataset.md](../references/dataset.md) for the event schema and its invariants.