@giamme/forge 0.12.1 → 0.13.1
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.
- package/CHANGELOG.md +66 -0
- package/README.md +1 -1
- package/SKILL.md +29 -12
- package/VERSION +1 -1
- package/docs/add-ons.md +11 -6
- package/docs/artifacts.md +12 -6
- package/docs/commands.md +179 -17
- package/docs/decomposed-runs.md +13 -5
- package/docs/forge-ui.md +14 -4
- package/docs/memory.md +2 -1
- package/docs/models.md +4 -2
- package/docs/reviews.md +49 -20
- package/docs/troubleshooting.md +3 -1
- package/forge +17 -1
- package/package.json +1 -1
- package/references/dataset.md +39 -13
- package/references/decision-models.md +763 -0
- package/references/decompose.md +166 -29
- package/references/harnesses.md +10 -3
- package/references/planning.md +8 -0
- package/references/solo.md +13 -3
- package/scripts/forge-artifact.sh +30 -4
- package/scripts/forge-config.py +238 -29
- package/scripts/forge-contract.py +95 -56
- package/scripts/forge-control.py +40 -9
- package/scripts/forge-decide.py +6 -0
- package/scripts/forge-dispatch.sh +38 -16
- package/scripts/forge-fail-first.py +2 -2
- package/scripts/forge-gate-addressed.sh +40 -0
- package/scripts/forge-gate-message.sh +64 -0
- package/scripts/forge-issues.py +321 -33
- package/scripts/forge-jev-options.sh +269 -42
- package/scripts/forge-lib-attribute.sh +447 -0
- package/scripts/forge-lib-gates.sh +32 -0
- package/scripts/forge-lib-plans.sh +22 -6
- package/scripts/forge-lib-review.sh +22 -17
- package/scripts/forge-lib-task.sh +217 -38
- package/scripts/forge-lib-verify.sh +45 -8
- package/scripts/forge-memory.sh +3 -3
- package/scripts/forge-parallel-options.sh +18 -5
- package/scripts/forge-parallel.sh +457 -303
- package/scripts/forge-plan-check.py +35 -1
- package/scripts/forge-pre-review.py +437 -0
- package/scripts/forge-prompt.py +25 -5
- package/scripts/forge-route.py +2 -2
- package/scripts/forge-runtime.py +10 -4
- package/scripts/forge-schedule.py +21 -5
- package/scripts/forge-shadow.py +2 -2
- package/scripts/forge-solo.sh +39 -9
- package/scripts/forge-submodules.py +389 -0
- package/scripts/forge-ui-options.sh +25 -0
- package/scripts/forge_dataset/cli.py +12 -6
- package/scripts/forge_dataset/export.py +140 -84
- package/scripts/forge_dataset/harvest.py +33 -5
- package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
- package/scripts/forge_decide/__init__.py +141 -0
- package/scripts/forge_decide/budget.py +180 -0
- package/scripts/forge_decide/cache.py +66 -0
- package/scripts/forge_decide/cli.py +953 -0
- package/scripts/forge_decide/doctor.py +270 -0
- package/scripts/forge_decide/label_addressed.py +75 -0
- package/scripts/forge_decide/label_attribution.py +62 -0
- package/scripts/forge_decide/label_coverage.py +81 -0
- package/scripts/forge_decide/label_message.py +38 -0
- package/scripts/forge_decide/label_prompt.py +139 -0
- package/scripts/forge_decide/labels.py +328 -0
- package/scripts/forge_decide/metrics.py +125 -0
- package/scripts/forge_decide/migrate.py +226 -0
- package/scripts/forge_decide/providers.py +292 -0
- package/scripts/forge_decide/replay.py +350 -0
- package/scripts/forge_decide/report.py +382 -0
- package/scripts/forge_decide/resolve.py +397 -0
- package/scripts/forge_decide/sites.py +377 -0
- package/scripts/forge_jev/__init__.py +202 -104
- package/scripts/forge_jev/addressed.py +171 -0
- package/scripts/forge_jev/attribution.py +198 -0
- package/scripts/forge_jev/cli.py +460 -382
- package/scripts/forge_jev/client.py +155 -77
- package/scripts/forge_jev/coupling.py +19 -87
- package/scripts/forge_jev/coverage.py +303 -0
- package/scripts/forge_jev/findings.py +219 -0
- package/scripts/forge_jev/gates.py +225 -27
- package/scripts/forge_jev/memory.py +65 -4
- package/scripts/forge_jev/message.py +134 -0
- package/scripts/forge_jev/plan_gates.py +294 -0
- package/scripts/forge_jev/questions.py +173 -313
- package/scripts/forge_jev/verify.py +130 -104
- package/ui/README.md +2 -2
- package/ui/docs/api.md +92 -39
- package/ui/forge_ui/control.py +71 -14
- package/ui/forge_ui/export.py +2 -1
- package/ui/forge_ui/models.py +17 -16
- package/ui/forge_ui/reader.py +132 -21
- package/ui/forge_ui/repos.py +428 -0
- package/ui/forge_ui/static/app.js +24 -5
- package/ui/forge_ui/static/cloudmodel.js +8 -5
- package/ui/forge_ui/static/controls.js +20 -13
- package/ui/forge_ui/static/modelstats.js +12 -8
- package/ui/forge_ui/static/panel.js +63 -17
- package/ui/forge_ui/static/runmodel.js +48 -7
- package/ui/forge_ui/static/scene3d.js +2 -15
- package/ui/forge_ui/static/settings.js +481 -68
- package/ui/forge_ui/static/style.css +56 -9
- package/references/jev.md +0 -865
- package/scripts/forge_jev/backtest.py +0 -322
- package/scripts/forge_jev/corpus.py +0 -156
- package/scripts/forge_jev/features.py +0 -24
- package/scripts/forge_jev/predict.py +0 -204
- package/scripts/forge_jev/review.py +0 -73
- package/scripts/forge_jev/routing.py +0 -271
- package/scripts/forge_jev/subset.py +0 -123
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
# Decision models
|
|
2
|
+
|
|
3
|
+
A decision model is a small hosted model that answers narrow, typed questions (a yes/no
|
|
4
|
+
probability, a single choice) over state forge supplies, in about a second. forge uses two:
|
|
5
|
+
TypeSafe's **Jev** and Cloudflare's **Clef**, which takes Jev's request shape. Both are
|
|
6
|
+
optional. Read this when turning one on, when changing a site, or before proposing a new one.
|
|
7
|
+
|
|
8
|
+
- **Off by default.** Nothing is sent until a gate is `shadow` or `on` and its provider can be
|
|
9
|
+
asked. See [Setup](#setup).
|
|
10
|
+
- **Always fail-open.** A timeout, an error, a refusal or a missing key is logged as a skip
|
|
11
|
+
reason, and the run proceeds exactly as it would with the model off. A decision-model call
|
|
12
|
+
can never fail a run.
|
|
13
|
+
- **The rule: a gate never changes a verdict, never blocks a dispatch, and never makes work
|
|
14
|
+
pass.** It never changes a review verdict, a severity, `accept` or a PASS. A decision model
|
|
15
|
+
never changes a task's tier or the model a task runs on, and never marks anything verified
|
|
16
|
+
itself. With the gate `on`, a gate acts in one of these ways and no other: it sends a task's
|
|
17
|
+
prompt or an uncovered requirement back to the planner, once; it adds a predicted file to a
|
|
18
|
+
task's `files`, or a dependency that forms no cycle; it bounces a retry, skips the review of an
|
|
19
|
+
attempt that says it did not finish, or stops a task for the user's answer; it puts the likeliest
|
|
20
|
+
culprit's boundary first in the attribution search; it turns duplicate findings into comments and
|
|
21
|
+
pre-selects concrete ones for filing; or it acts on memory and on the verify command. Verify
|
|
22
|
+
discover picks the command that runs when none is configured; that command's own result decides
|
|
23
|
+
verification. `shadow` asks and records, and changes nothing. See [Gates and modes](#gates-and-modes)
|
|
24
|
+
and [Setup](#setup).
|
|
25
|
+
- **`FORGE_JEV=off` sends nothing.** It turns every gate off. A repo privacy floor does the
|
|
26
|
+
same and is applied after it. See [Setup](#setup).
|
|
27
|
+
|
|
28
|
+
Which models do which work is measured instead of asked: exploratory routing and
|
|
29
|
+
`forge dataset routing` compare models per tier from randomized assignments (see
|
|
30
|
+
[Decomposition](decompose.md#exploratory-routing-on-by-default)).
|
|
31
|
+
|
|
32
|
+
## Criteria a site must meet to exist
|
|
33
|
+
|
|
34
|
+
#35 audited every site against four rules. A site that fails one is removed, not tuned.
|
|
35
|
+
|
|
36
|
+
1. **It changes something.** A warning a person sees, a command forge runs, a fact it keeps
|
|
37
|
+
or drops. A score nobody reads is not a site.
|
|
38
|
+
2. **It was measured.** Against a label from outside the model (git history, the task's own
|
|
39
|
+
outcome, the repo's documented command), on state production really sends.
|
|
40
|
+
3. **It beats a trivial baseline.** Doing nothing, an exact-match key, or a cheap feature.
|
|
41
|
+
4. **It is cheap enough per run.** One bounded request, never one per file, per dispatch or
|
|
42
|
+
per entry on a hot path.
|
|
43
|
+
|
|
44
|
+
How each kept site meets them:
|
|
45
|
+
|
|
46
|
+
| site | changes | measured | baseline it beats | cost |
|
|
47
|
+
|---|---|---|---|---|
|
|
48
|
+
| drift | in `on`, adds the predicted undeclared file to the task's `files` before the waves are computed (in `shadow`, only recorded) | precision at `gate_warn` 0.60 over 50 commits × 2 repos: **1.000** and **0.934**; non-edited files scored ≤0.23 where the true file scored 0.65 | the post-wave `drift.txt`, which reports the broken promise only after the wave ran | one request per task |
|
|
49
|
+
| forward | in `on`, makes the earlier-wave task wait for the later one it may be written against, unless that forms a cycle (in `shadow`, only recorded) | 7 cross-wave pairs, 5 runs each: `readme`→`cli` **0.88–0.90**, every other pair 0.05–0.15 (gap 0.73, noise 0.07) | wave order, which cannot see the case; the review cannot either | one request per plan |
|
|
50
|
+
| prompt adequacy | in `on`, sends a task back to the planner, once, when a reviewer could not judge its prompt (in `shadow`, only recorded) | 3 runs over 8 probe prompts and 8 real ones: unjudgeable **0.06–0.27**, checkable behaviour **0.85–0.96** | silence; the old 0.30 sat 0.03 above the worst true positive | one request per task |
|
|
51
|
+
| memory curate, slice, stale | refiles, merges, hides or drops a fact in `memory.md` | merge: wrong 0.56–0.72, right 0.91–1.00. Refile: wrong 0.56–0.72, right 0.92–1.00. Stale: gone false 0.03–0.10, still true 0.47–0.96 | exact-match keys (two wordings of one fact never reach two distinct runs) | curate at `record`, slice at `inject`, stale only on `prune` |
|
|
52
|
+
| verify discover | picks a verify command when none is configured | 18 repos: 10 fire at 0.70, every pick correct, lowest correct 0.73, highest wrong 0.55 | `UNVERIFIED` | one request, only when nothing is configured |
|
|
53
|
+
|
|
54
|
+
The five gates added in C3–C5 (coverage, retry-addressed, dwarf-message, attribution, findings)
|
|
55
|
+
are not in this table. None has a replay or a measured threshold yet, so their thresholds are
|
|
56
|
+
starting points, and `forge decide gate G on` needs `--force` for each until a replay passes.
|
|
57
|
+
|
|
58
|
+
Two caveats travel with these numbers:
|
|
59
|
+
|
|
60
|
+
- Forward rests on a single positive example. A second plan could move the positive class, but
|
|
61
|
+
unlikely by 0.38.
|
|
62
|
+
- `tests_act` 0.70 is **stale**. The 18-repo table was measured before a make target's recipe
|
|
63
|
+
reached the model, and the one confirmed wrong pick (`spankai` → `cargo test`) has since risen
|
|
64
|
+
from 0.55 to 0.77–0.81, past the gate. The gate reads 1 − P(none), the probability that the
|
|
65
|
+
repo is verifiable at all, because Choice confidence drops when two commands both run the suite.
|
|
66
|
+
Re-measure across the 18 repos before moving the number; fitting a new one to one data point
|
|
67
|
+
is the mistake this file records.
|
|
68
|
+
|
|
69
|
+
Every number here is from this project's repos and does not transfer. Re-measure before trusting
|
|
70
|
+
a threshold elsewhere. Each rubric has its own threshold because the rubrics are not on one
|
|
71
|
+
scale: the single shared `gate_warn` warned on 5 of 9 and 5 of 11 perfectly good tasks.
|
|
72
|
+
|
|
73
|
+
## The kept sites
|
|
74
|
+
|
|
75
|
+
`SITE_CAPABILITY` in `scripts/forge_jev/__init__.py` is the source of truth for the first two
|
|
76
|
+
columns; thresholds are `DEFAULT_THRESHOLDS` in the same file. A capability of `—` means the
|
|
77
|
+
gate has no legacy capability, so its own mode alone decides.
|
|
78
|
+
|
|
79
|
+
| site | capability | runs | can change | threshold | recorded |
|
|
80
|
+
|---|---|---|---|---|---|
|
|
81
|
+
| `jev-prompt` | `gates` | `plan`, per task | sends a task whose prompt is below the threshold back to the planner, once (`plan` exits 4) | `prompt_warn` 0.55 (flags a probability below it) | `<plan>/jev.jsonl`; judgment in `tasks/<id>/jev.json`; `plan-gates.json` (`prompt`) |
|
|
82
|
+
| `jev-drift` | `gates` | `plan`, per task | adds each predicted file at or above the threshold to the task's `files`, before the waves are computed | `drift_warn`, falls back to `gate_warn` 0.60 | `<plan>/jev.jsonl`; judgment in `tasks/<id>/jev.json`; `plan-gates.json` (`drift`) |
|
|
83
|
+
| `jev-forward` | `gates` | `plan`, once | makes the earlier task of a warned pair depend on the later one, unless that would form a cycle (then recorded as refused); at most three pairs a plan (`MAX_WARNINGS`, the highest-scoring) | `forward_warn` 0.50 | `<plan>/jev.jsonl`; `jev-coupling.json`; `plan-gates.json` (`forward`) |
|
|
84
|
+
| `jev-coverage` | `—` | `plan`, once, one question per requirement of `request.md`: the first 30 that have at least four words and are not repeated (`MAX_REQUIREMENTS`), so a later requirement is never asked. Skipped above 40 tasks, with fewer than two requirements, or without `request.md` | sends each uncovered requirement back to the planner, once (`plan` exits 4) | `coverage_warn` 0.50 (the probability that no task covers it) | `<plan>/jev.jsonl`; `plan-gates.json` (`coverage`, `sent_back`, `pending`) |
|
|
85
|
+
| `jev-retry-addressed` | `—` | a retry (attempt above 1) whose retry findings came from a review, after its diff is taken and before QA | bounces the retry back to its implementer without a review when its diff leaves a blocking finding untouched | `untouched_warn` 0.70 | `tasks/<id>/jev.jsonl`; `bounced` and `bounce.md`; attempts.tsv `BOUNCED`; dataset attempt `sent_back: bounce` |
|
|
86
|
+
| `jev-dwarf-message` | `—` | each implementer reply, before its diff is taken and before any review | stops the task as `NEEDS_INPUT` when the message asks a question only the user can answer; sends the attempt back as FAIL without a review when it says it did not finish or was blocked | `message_ask` 0.70 (question); `message_warn` 0.70 (unfinished, blocked) | `tasks/<id>/jev.jsonl`; `needs_input.md` or `message.md` with `message.failed`; attempts.tsv `INCOMPLETE`; dataset attempt `sent_back: message` (not for a question) |
|
|
87
|
+
| `jev-attribution` | `—` | `attribute` and `run --attribute`, once per search, after a failed combined verification | ranks the merged tasks, and in `on` verifies the top suspect's boundary first; nothing is merged, reverted or accepted | none (it orders a search) | `<plan>/jev.jsonl`; `attribution.json` (`gate`); the `attribution` event |
|
|
88
|
+
| `jev-findings` | `—` | `forge-issues.py`, once per plan, through `forge-jev.py findings --run-dir <plan>` | turns a finding that duplicates an open issue into a comment on that issue (posted by `--apply`), and pre-selects the PLAUSIBLE findings that read as concrete defects | `findings_dup` 0.85 (duplicate); `findings_concrete` 0.50 (concrete) | `<plan>/jev.jsonl`; the `gate` field of each finding and draft; comment receipts in `${XDG_STATE_HOME:-~/.local/state}/forge/findings/<repo key>.comments.json` |
|
|
89
|
+
| `jev-memory-curate` | `memory` | `forge-memory.sh record` | not injected, refiled, or merged onto an existing key | `memory_merge` 0.85, `memory_recategorize` 0.80, durability `gate_warn` 0.60 | ledger flag; nothing is ever lost |
|
|
90
|
+
| `jev-memory-slice` | `memory` | `forge-memory.sh inject` | removes lines from the role slice, never adds or reorders | none | `jev.jsonl` |
|
|
91
|
+
| `jev-memory-stale` | `memory` | `forge-memory.sh prune`, deep prune only | drops an entry whose fact went false | `stale_drop` 0.25 | `memory_prune` event |
|
|
92
|
+
| `jev-verify-discover` | `tests` | `verify_result`, when neither `--verify` nor `.forge/verify` exists | chooses the verify command | `tests_act` 0.70 | `verification.jev.json` |
|
|
93
|
+
|
|
94
|
+
Every request, from every site, is also recorded:
|
|
95
|
+
|
|
96
|
+
- `<run-dir>/jev.jsonl`: one row per request with site, question ids, answers, confidences,
|
|
97
|
+
latency, tokens and whether the judgment was applied. `jev.skip` holds the reason for a
|
|
98
|
+
skipped one.
|
|
99
|
+
- The run dataset keeps the **full request** whole (state and questions), so a judgment can be
|
|
100
|
+
replayed later. See [Dataset](dataset.md).
|
|
101
|
+
|
|
102
|
+
Thresholds are deliberately conservative where an action is irreversible: `stale_drop` sits far
|
|
103
|
+
below `gate_warn` because dropping a fact is silent and permanent, while a stale fact costs a
|
|
104
|
+
line. `memory.md` is injected into every future dispatch, so a wrong fact is paid for forever;
|
|
105
|
+
`ledger.tsv` is append-only, so a rejected line is still kept in full.
|
|
106
|
+
|
|
107
|
+
Verify discover enumerates commands that demonstrably exist (`package.json` scripts, Makefile
|
|
108
|
+
targets with their recipes, tox/nox, runner scripts, workflow `run:` steps, `## Verify` facts in
|
|
109
|
+
`.forge/memory.md`) and Jev selects one or `none`. It selects, never generates. `UNVERIFIED`
|
|
110
|
+
remains the outcome whenever nothing is chosen: a model may find a command, never declare
|
|
111
|
+
something verified.
|
|
112
|
+
|
|
113
|
+
## Setup
|
|
114
|
+
|
|
115
|
+
`forge decide` is the setup command. `forge jev` is an alias for this release and then goes
|
|
116
|
+
away. For `setup`, `sites`, `enable`, `disable`, `status` and `doctor` the launcher names the
|
|
117
|
+
`forge decide` command and then runs the old one. Command lines are also in
|
|
118
|
+
[the command reference](../docs/commands.md#forge-decide).
|
|
119
|
+
|
|
120
|
+
### Quick start
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
# hosted TypeSafe. The key is one line on stdin, stored mode 0600.
|
|
124
|
+
printf '%s\n' "$TYPESAFE_API_KEY" | forge decide provider add jev --name typesafe --key-stdin
|
|
125
|
+
|
|
126
|
+
# or a local server: --local needs --url, sends no key and costs nothing
|
|
127
|
+
forge decide provider add jev --name local --url http://127.0.0.1:8080 --local
|
|
128
|
+
|
|
129
|
+
forge decide gate memory-curate shadow --provider typesafe
|
|
130
|
+
forge decide status
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Name a provider to choose where a gate's requests go. The local server above is
|
|
134
|
+
`forge decide gate memory-curate shadow --provider local`. `on` waits for a passing replay
|
|
135
|
+
(see [Measuring a gate](#measuring-a-gate)). A gate with no `--provider` does not
|
|
136
|
+
read the key file `provider add` wrote: it uses the legacy transport, `jev.json`'s endpoint
|
|
137
|
+
with `TYPESAFE_API_KEY` or `jev.json`'s key (or Cloudflare, for a site `jev.json` maps
|
|
138
|
+
there). Migration leaves `jev.json` in place, so with either key present such a gate still
|
|
139
|
+
sends requests, wherever `jev.json` points.
|
|
140
|
+
|
|
141
|
+
`status` prints each gate's effective mode and which level set it, the providers (key
|
|
142
|
+
`present` or `missing`), today's spend, and whether a privacy floor is on. It never writes.
|
|
143
|
+
forge-ui's Settings page has the same fields under Decision models; a change there writes the
|
|
144
|
+
user file.
|
|
145
|
+
|
|
146
|
+
### Gates and modes
|
|
147
|
+
|
|
148
|
+
Twelve gates, each `off` (the default), `shadow` or `on`:
|
|
149
|
+
|
|
150
|
+
`drift`, `forward`, `prompt`, `coverage`, `retry-addressed`, `dwarf-message`, `attribution`,
|
|
151
|
+
`findings`, `memory-curate`, `memory-slice`, `memory-stale`, `verify-discover`.
|
|
152
|
+
|
|
153
|
+
`off` asks nothing. `shadow`, on every gate, asks and records the answer, then leaves the run
|
|
154
|
+
as it would have been with the gate off: no note, no work sent back, no retry bounced, no review
|
|
155
|
+
skipped, no task stopped, no search reordered, no memory edit, no comment, no verify command.
|
|
156
|
+
|
|
157
|
+
What `on` does:
|
|
158
|
+
|
|
159
|
+
| gate | what `on` does |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `drift` | adds each file it predicts at or above `drift_warn` to the task's `files`, before the waves are computed, so the wave plan treats it as declared |
|
|
162
|
+
| `forward` | makes the earlier task of a warned pair depend on the later one, never one that would form a cycle; the waves are computed again |
|
|
163
|
+
| `prompt` | sends a task whose prompt is below `prompt_warn` back to the planner, once |
|
|
164
|
+
| `coverage` | sends each uncovered requirement back to the planner, once (among the first 30 requirements of `request.md`) |
|
|
165
|
+
| `retry-addressed` | bounces a retry back to its implementer without a review when its diff leaves a blocking finding untouched |
|
|
166
|
+
| `dwarf-message` | skips the review of an attempt whose final message says it did not finish or was blocked (the attempt ends FAIL, unreviewed), or stops the task as `NEEDS_INPUT` when the message asks a question only the user can answer |
|
|
167
|
+
| `attribution` | after a failed combined verification, verifies the likeliest culprit's boundary first |
|
|
168
|
+
| `findings` | turns a finding that duplicates an open issue into a comment on that issue (posted by `forge issues --apply`), and pre-selects the concrete findings for filing |
|
|
169
|
+
| `memory-curate` | refiles, merges or withholds the fact |
|
|
170
|
+
| `memory-slice` | removes lines from the injected slice |
|
|
171
|
+
| `memory-stale` | drops a fact that went false |
|
|
172
|
+
| `verify-discover` | runs the chosen command when none is configured |
|
|
173
|
+
|
|
174
|
+
`prompt` and `coverage` send work back **once** per item: a task for `prompt`, a requirement for
|
|
175
|
+
`coverage`. `plan` writes `plan.sendback.md` listing what was flagged and exits 4 before it prints
|
|
176
|
+
the table. Rewrite what the file lists, then run `plan` again. What is still flagged from that list
|
|
177
|
+
is printed under the table and is not sent back again. An item the first list did not name is a new
|
|
178
|
+
flag, such as a task the rewrite added with an unjudgeable prompt, or a requirement the rewrite left
|
|
179
|
+
uncovered. That item is sent back in its own round, so the second `plan` can exit 4 again. No item
|
|
180
|
+
is sent back twice; `plan-gates.json` keeps that history across re-plans.
|
|
181
|
+
|
|
182
|
+
`dwarf-message` and `retry-addressed` send an attempt back without spending a review on it. The
|
|
183
|
+
attempt ends FAIL, and the next attempt is handed the implementer's own words (`dwarf-message`) or
|
|
184
|
+
the untouched blocking findings (`retry-addressed`). `retry-addressed` does not check the attempt
|
|
185
|
+
after its bounce again.
|
|
186
|
+
|
|
187
|
+
The memory gates and verify discover act as they did before C3–C5. Verify discover still does
|
|
188
|
+
not mark anything verified: the command it picked does, or `UNVERIFIED` stands.
|
|
189
|
+
|
|
190
|
+
`on` for any gate needs a passing replay for the provider and model it uses, or `--force`.
|
|
191
|
+
See [Measuring a gate](#measuring-a-gate). None of the five gates added in C3–C5 has a recorded
|
|
192
|
+
replay yet, so each needs `--force` for now.
|
|
193
|
+
|
|
194
|
+
Set one with `forge decide gate <gate> off|shadow|on [--provider P] [--model M]`. `--repo DIR`
|
|
195
|
+
writes `<repo>/.forge/decide.json`; `--profile NAME` writes that profile in the user file.
|
|
196
|
+
The two flags are exclusive. `--provider` must already be configured, and the gate uses only
|
|
197
|
+
that provider.
|
|
198
|
+
|
|
199
|
+
### Where settings live, and which wins
|
|
200
|
+
|
|
201
|
+
Two files. The user file is `${XDG_CONFIG_HOME:-~/.config}/forge/decide.json`, mode `0600`.
|
|
202
|
+
An empty or relative `XDG_CONFIG_HOME` counts as unset. The repo file is
|
|
203
|
+
`<repo>/.forge/decide.json`, mode `0644`, and is the one a checkout shares.
|
|
204
|
+
`--repo` defaults to `FORGE_DECIDE_REPO`, else the git top level of the working directory.
|
|
205
|
+
|
|
206
|
+
Six levels, lowest first. A level sets only the fields it names. The user file wins over the
|
|
207
|
+
repo on any field both set; `status` lists those as shadowed.
|
|
208
|
+
|
|
209
|
+
1. **default.** Every gate `off`, no budget.
|
|
210
|
+
2. **repo.** `<repo>/.forge/decide.json`: `gates`, and the per-run budget (`run_tokens`,
|
|
211
|
+
`run_usd`).
|
|
212
|
+
3. **user.** `decide.json`: `gates`, providers, and the whole budget, including the daily caps.
|
|
213
|
+
While that file does not exist, the legacy level stands here (source `legacy`): `jev.json`
|
|
214
|
+
plus `FORGE_JEV*` turn a gate `on` when its old capability is enabled. A fresh install, with
|
|
215
|
+
neither file and no `FORGE_JEV*`, stays at `default`.
|
|
216
|
+
4. **profile.** `FORGE_DECIDE_PROFILE`, looked up in the user file's `profiles` first, then the
|
|
217
|
+
repo file's. A profile in the user file may set the daily budget; one in the repo file may
|
|
218
|
+
set only the per-run budget.
|
|
219
|
+
5. **env.** `FORGE_DECIDE_GATE_<NAME>=off|shadow|on`, with `NAME` upper-cased and `-` written
|
|
220
|
+
`_` (`FORGE_DECIDE_GATE_MEMORY_CURATE`, `FORGE_DECIDE_GATE_VERIFY_DISCOVER`). Once the user
|
|
221
|
+
`decide.json` exists, `FORGE_JEV_<CAP>` can only turn gates off, and any `=on` is an
|
|
222
|
+
allowlist of the capabilities left on. `FORGE_JEV_SHADOW=on` (`--jev-shadow`) turns every
|
|
223
|
+
`on` into `shadow`, except, before the user `decide.json` exists, a gate the legacy level
|
|
224
|
+
turned on: that site acts as it did before #36, its records are marked shadow, and `plan`
|
|
225
|
+
prints a count in shadow mode instead of its warnings. Drift, forward and prompt are the
|
|
226
|
+
exception to the exception: they only advised before #36, so under `--jev-shadow` they
|
|
227
|
+
record what they would do (`would_add`, `shadow: true`) and change nothing in the plan.
|
|
228
|
+
6. **flags.** `--gate`, `--no-gates` and `--decide-budget` on `plan` or a solo run, frozen in
|
|
229
|
+
`<plan-or-run>/jev-selection.json`. `--no-gates` turns every gate off after `--gate` is
|
|
230
|
+
applied. A re-plan replaces the file. Solo again on the same run dir keeps it. `run` and
|
|
231
|
+
`retry` keep it too, and say so when flags are passed again. A plan with no selection file
|
|
232
|
+
takes the flags on `run` or `retry` and freezes them then.
|
|
233
|
+
|
|
234
|
+
After those six, `FORGE_JEV=off` turns every gate off (skip `kill`). A repo privacy floor then
|
|
235
|
+
turns every gate off (skip `privacy`) and wins over the kill switch. Both send nothing.
|
|
236
|
+
|
|
237
|
+
`providers` and `budget.daily_*` count only in the user file. `privacy` counts only in the repo
|
|
238
|
+
file. Anywhere else they are ignored, and `doctor` reports them as misplaced.
|
|
239
|
+
|
|
240
|
+
### Providers
|
|
241
|
+
|
|
242
|
+
Two types, each hosted or local. `jev` is TypeSafe's request shape; hosted, the URL defaults
|
|
243
|
+
to `https://api.typesafe.ai/v1/systemone` and the model to `jev-latest`. `clef` is Cloudflare's
|
|
244
|
+
envelope; hosted, pass `--url`, or `--account-id` (else `CLOUDFLARE_ACCOUNT_ID`) to build the
|
|
245
|
+
Workers AI URL. The default model is `clef`.
|
|
246
|
+
|
|
247
|
+
```sh
|
|
248
|
+
forge decide provider add jev --name typesafe --key-stdin
|
|
249
|
+
forge decide provider add clef --name cloudflare --account-id <id> --key-env CLOUDFLARE_API_TOKEN
|
|
250
|
+
forge decide provider add jev --name local --url http://127.0.0.1:8080 --local
|
|
251
|
+
forge decide provider list
|
|
252
|
+
forge decide provider rm local
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`--context N` is the context limit in tokens. A request over 90% of it is skipped `too-large`
|
|
256
|
+
and the state is not cut to fit. `--price X` is USD per million tokens, which the budget uses.
|
|
257
|
+
`--deadline S` is seconds per request; the default is 5. `--local` requires `--url`, sends no
|
|
258
|
+
key and adds no cost.
|
|
259
|
+
|
|
260
|
+
A key is never an argument. `provider add` reads one line from `--key-stdin` and writes
|
|
261
|
+
`${XDG_CONFIG_HOME:-~/.config}/forge/keys/<name>.key` (mode `0600`, the `keys/` directory
|
|
262
|
+
`0700`), stores a variable name with `--key-env VAR` and reads it when a request is made, or
|
|
263
|
+
prompts on a terminal. Adding the same name again without a key keeps the key it has. `status`
|
|
264
|
+
and `provider list` show `present` or `missing`. `provider rm` refuses while a gate names that
|
|
265
|
+
provider, and deletes the `keys/<name>.key` it wrote.
|
|
266
|
+
|
|
267
|
+
### Budgets
|
|
268
|
+
|
|
269
|
+
Two caps, each in tokens and estimated USD. Unset means no cap.
|
|
270
|
+
|
|
271
|
+
```sh
|
|
272
|
+
forge decide budget # caps, and what today has spent
|
|
273
|
+
forge decide budget --run tokens=20000,usd=0.50 # this run
|
|
274
|
+
forge decide budget --daily tokens=200000,usd=5 # user level; a repo file cannot set it
|
|
275
|
+
forge decide budget --run none # clear the per-run cap
|
|
276
|
+
forge decide budget --repo DIR --run tokens=5000 # per-run cap for one repo
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
`--daily` is refused together with `--repo`. `none`, or `tokens=none` / `usd=none`, clears
|
|
280
|
+
that cap. A number is zero or more.
|
|
281
|
+
|
|
282
|
+
Today's spend is `${XDG_STATE_HOME:-~/.local/state}/forge/decide/spend/<YYYY-MM-DD>.json`
|
|
283
|
+
(local date; a new day is a new file). The run's own counter is `<run-dir>/decide.budget.json`
|
|
284
|
+
and shows up in `status` when `FORGE_DECIDE_RUN_DIR` is set. `forge decide budget` and
|
|
285
|
+
`forge decide status` both print today's tokens and USD.
|
|
286
|
+
|
|
287
|
+
Once any set cap is reached, every later decision-model call is skipped with reason `budget`
|
|
288
|
+
and the run continues. A local provider, or one with no `--price`, adds tokens and zero USD.
|
|
289
|
+
A replay (`forge decide replay --send`) is charged to neither cap, and a request-cache hit
|
|
290
|
+
costs nothing. See [Measuring a gate](#measuring-a-gate).
|
|
291
|
+
`--decide-budget tokens=N[,usd=X]` on a run sets that run's cap at the flags level and does
|
|
292
|
+
not change the daily cap.
|
|
293
|
+
|
|
294
|
+
### Privacy floor
|
|
295
|
+
|
|
296
|
+
```sh
|
|
297
|
+
forge decide privacy never-send --repo DIR
|
|
298
|
+
forge decide privacy allow --repo DIR
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
`never-send` writes `"privacy": "never-send"` into `<DIR>/.forge/decide.json`. Every gate is
|
|
302
|
+
then off (skip `privacy`): no decision-model request leaves that repo, and `doctor --live`
|
|
303
|
+
does not probe. The floor beats every level, including run flags and `FORGE_JEV=off`. A
|
|
304
|
+
replay skips that repo's stored requests too.
|
|
305
|
+
|
|
306
|
+
Removing it is a per-repo edit: `privacy allow --repo DIR` deletes the key from that repo's
|
|
307
|
+
file. The user `decide.json` cannot set or clear it.
|
|
308
|
+
|
|
309
|
+
With no floor, a gate that is `shadow` or `on` sends that site's state to its provider.
|
|
310
|
+
`.forge/memory.md` is part of it: prompt adequacy includes its first 4000 characters, the
|
|
311
|
+
memory gates send the entries they are judging, and verify discover sends the bullets under
|
|
312
|
+
`## Verify`. Drift's candidate file list leaves out `.forge/` and `.git`; that filter applies
|
|
313
|
+
to the candidate list only. Keep private text out of `.forge/memory.md`, or set the floor.
|
|
314
|
+
|
|
315
|
+
### Migration
|
|
316
|
+
|
|
317
|
+
```sh
|
|
318
|
+
forge decide migrate # once
|
|
319
|
+
forge decide migrate --force # replace the user decide.json from jev.json again
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`migrate` reads `${XDG_CONFIG_HOME:-~/.config}/forge/jev.json` and a Cloudflare token
|
|
323
|
+
(`cloudflare.env` beside it, or `CLOUDFLARE_API_TOKEN`) and writes the user `decide.json`:
|
|
324
|
+
|
|
325
|
+
- A TypeSafe key becomes the provider `typesafe` (`type` `jev`, URL and model from
|
|
326
|
+
`jev.json`). The key moves to `keys/typesafe.key`.
|
|
327
|
+
- Cloudflare becomes the provider `cloudflare` (`type` `clef`). A token already in
|
|
328
|
+
`cloudflare.env` stays in that file; one stored in `jev.json` moves to
|
|
329
|
+
`keys/cloudflare.key`; one that lives only in the environment is referenced as
|
|
330
|
+
`key_env` `CLOUDFLARE_API_TOKEN`.
|
|
331
|
+
- When `jev.json` is `enabled`, the `memory` gates and `verify-discover` are set `on`, and
|
|
332
|
+
`drift`, `forward` and `prompt` are set `shadow`. A capability switched off is left unset,
|
|
333
|
+
so its gates stay `off`. The five gates added in C3–C5 have no legacy capability, so migration
|
|
334
|
+
leaves them unset. The `on` gates are written with `"force": true`, so they show as
|
|
335
|
+
forced until a replay passes for them.
|
|
336
|
+
- A site mapped to `cloudflare` points at that provider; every other site points at
|
|
337
|
+
`typesafe`, when that provider was created. `forge jev setup --provider cloudflare` mapped
|
|
338
|
+
`jev-drift` by default, and migrate copies that map.
|
|
339
|
+
- Each stored threshold is copied onto the gates that read it (`drift_warn` onto `drift`,
|
|
340
|
+
`forward_warn` onto `forward`, `prompt_warn` onto `prompt`, `memory_merge`,
|
|
341
|
+
`memory_recategorize` and `gate_warn` onto `memory-curate`, `gate_warn` also onto `drift`,
|
|
342
|
+
`stale_drop` onto `memory-stale`, `tests_act` onto `verify-discover`). Per-model values for
|
|
343
|
+
the provider's model override those and set `thresholds_model`. Retired thresholds are not
|
|
344
|
+
copied.
|
|
345
|
+
|
|
346
|
+
While the user `decide.json` does not exist, runs still follow `jev.json` and `FORGE_JEV*`.
|
|
347
|
+
On that path `FORGE_CLEF=off` sends every site to TypeSafe, `FORGE_JEV_PROVIDER` forces
|
|
348
|
+
`typesafe` or `cloudflare`, and `TYPESAFE_API_KEY` overrides the stored key.
|
|
349
|
+
`status`, `doctor`, `provider list` and a bare `budget` never write, so they do not migrate.
|
|
350
|
+
The migration runs before a write to the user file: `gate` without `--repo`, `provider add`,
|
|
351
|
+
`provider rm`, `budget` with `--run` or `--daily` and without `--repo`, and `migrate`.
|
|
352
|
+
A repo-only write (`privacy`, `gate --repo`, `budget --repo`) leaves `jev.json` in place.
|
|
353
|
+
After `decide.json` exists, which gates are on comes from it.
|
|
354
|
+
|
|
355
|
+
`forge jev` remains an alias for this release. Next release it is gone.
|
|
356
|
+
|
|
357
|
+
### Doctor
|
|
358
|
+
|
|
359
|
+
```sh
|
|
360
|
+
forge decide doctor [--repo DIR] [--json]
|
|
361
|
+
forge decide doctor --live
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Offline, it reports settings that went stale. Nothing it prints contains a key. Exit 0 when
|
|
365
|
+
the only findings are advice, exit 1 when a problem is found or a live probe fails.
|
|
366
|
+
|
|
367
|
+
Advice, which does not fail the command: `threshold-override` (a stored threshold differs from
|
|
368
|
+
the measured default), `shadowed` (the user file wins over the repo), `privacy-floor`.
|
|
369
|
+
|
|
370
|
+
Problems: `retired-threshold`, `unknown-provider` (a gate names a provider that is not
|
|
371
|
+
configured), `unused-provider`, `misplaced` (providers or a daily budget in a repo file, or
|
|
372
|
+
`privacy` in the user file), `key-file` (missing, or not mode `0600`), `not-migrated`
|
|
373
|
+
(`jev.json` exists and `decide.json` does not), `config-error`, `bad-price` (a stored
|
|
374
|
+
`price_usd_per_mtok` is not a finite number above zero, so it is ignored and that
|
|
375
|
+
provider's spend does not count toward a USD cap). A non-finite price is reported as
|
|
376
|
+
the string `Infinity`, `-Infinity` or `NaN`, including when it sits inside a list or
|
|
377
|
+
object, so `doctor --json` is standard JSON.
|
|
378
|
+
|
|
379
|
+
`--live` sends one fixed synthetic request, with no repo data, to each configured provider.
|
|
380
|
+
It is the only `forge decide` subcommand that uses the network, and it is skipped when the
|
|
381
|
+
repo has a privacy floor.
|
|
382
|
+
|
|
383
|
+
### Cloudflare Clef
|
|
384
|
+
|
|
385
|
+
Point a gate at that provider with `forge decide gate drift on --provider <name>`, once a
|
|
386
|
+
replay has passed for it (see [Measuring a gate](#measuring-a-gate)). A paired replay on
|
|
387
|
+
2026-10-16 found hosted Clef non-inferior on drift: AUC 0.985 against
|
|
388
|
+
Jev's 0.972, paired difference [0.000, +0.028], on 4560 decisions from 17 runs. A site moves
|
|
389
|
+
on the rule in [Promotion](#promotion). `jev-memory-slice` tied (AUC 0.951 against 0.953) on
|
|
390
|
+
5 runs and stays on a `jev` provider. No per-model threshold is set, so Clef reads the shared ones.
|
|
391
|
+
|
|
392
|
+
The client sends at most 64 questions per request (drift asks up to 120, so that request is
|
|
393
|
+
two concurrent chunks) and refuses `too-large` past the context, 64K tokens for `clef` and
|
|
394
|
+
24K for `clef-flash`, or whatever `--context` set. The service would otherwise cut the state.
|
|
395
|
+
Rate limits are retried inside the deadline; quota and plan errors are final. A response
|
|
396
|
+
missing an answer, or with one out of range, is `malformed`.
|
|
397
|
+
|
|
398
|
+
## Measuring a gate
|
|
399
|
+
|
|
400
|
+
A gate becomes `on` by the same path for every site:
|
|
401
|
+
|
|
402
|
+
1. **Shadow records.** With the gate `shadow`, the site asks. The answers go to `jev.jsonl`,
|
|
403
|
+
and the full request and its answers go to the run dataset. The run goes on as it would
|
|
404
|
+
with the gate off.
|
|
405
|
+
2. **Labels arrive for free.** After the run, the dataset shows what happened next: which
|
|
406
|
+
undeclared file the task edited, which command the repo documents. Nobody labels anything.
|
|
407
|
+
See [Labels](#labels).
|
|
408
|
+
3. **Replay compares.** `forge decide replay` re-asks the stored requests on one provider and
|
|
409
|
+
model, and scores the answers against those labels and against the site's baseline, a cheap
|
|
410
|
+
heuristic that uses no model.
|
|
411
|
+
4. **Promotion.** The gate may be `on` for a provider and model only when the replay for them
|
|
412
|
+
passes. Otherwise `forge decide gate G on` is refused, unless it is forced. See
|
|
413
|
+
[Promotion](#promotion).
|
|
414
|
+
|
|
415
|
+
A replay measures one provider and model. A passing replay on `typesafe` does not cover `local`.
|
|
416
|
+
|
|
417
|
+
### Labels
|
|
418
|
+
|
|
419
|
+
Each site's label is one sentence in its record in `forge_decide/sites.py`. Labels mean
|
|
420
|
+
**should act**: a label is true when the gate should have acted (sent the work back, added the
|
|
421
|
+
file or the dependency, bounced the attempt, named the culprit), and false when it should not
|
|
422
|
+
have. A label never comes from the gate's own action: whatever followed a send-back that the gate
|
|
423
|
+
made is left unlabelled, or labelled by evidence the gate did not produce.
|
|
424
|
+
|
|
425
|
+
A site whose threshold reads the other way round from its score sets `invert` in its record.
|
|
426
|
+
Two do:
|
|
427
|
+
- **Prompt adequacy.** Its model answers "is the prompt adequate", so the probability of acting
|
|
428
|
+
is `1 − p`, and its score is that. `replay` compares the score with `1 − prompt_warn`, the
|
|
429
|
+
same line as `p < prompt_warn`.
|
|
430
|
+
- **Findings.** Its score is the Noul of "does it read as a preference", the probability of
|
|
431
|
+
deselecting, and its baseline is 1.0 for a finding with no concrete cue. Its threshold
|
|
432
|
+
`findings_concrete` is on the concreteness scale (`1 − p`), so `replay` compares the score with
|
|
433
|
+
`1 − findings_concrete`.
|
|
434
|
+
|
|
435
|
+
`report` counts each site's fired decisions with the site's own rule, which already reads the
|
|
436
|
+
threshold the right way, so it needs no inversion of its own.
|
|
437
|
+
|
|
438
|
+
`forge_decide/labels.py` computes the labels from the run dataset with the joins of `forge
|
|
439
|
+
dataset export`, so a run the dataset did not capture has no labels. The gate modules' labellers
|
|
440
|
+
(`label_prompt`, `label_coverage`, `label_addressed`, `label_message`, `label_attribution`) are
|
|
441
|
+
loaded lazily, so a site whose labeller is missing has no rows.
|
|
442
|
+
|
|
443
|
+
| site | label: true means should act | precision floor |
|
|
444
|
+
|---|---|---|
|
|
445
|
+
| `jev-drift` | the undeclared file was edited by the task's final passing attempt (true), or was not (false). A file the gate added to `files` is labelled by the same edit | 0.5 |
|
|
446
|
+
| `jev-forward` | a later plan revision of the run has the dependency and the gate did not add it (true); both tasks merged and no revision has it (false). A dependency the gate added is false only once a later revision removes it, the user's correction, and is otherwise unlabelled | 0.5 |
|
|
447
|
+
| `jev-prompt` | the prompt was inadequate (true): a later plan revision changed it before its first attempt started, or the first attempt's review calls it ambiguous or unclear. False when the first attempt was reviewed and neither held. No label for a task the gate sent back, a task that never ran, or one whose first review is missing or unparseable | none |
|
|
448
|
+
| `jev-memory-slice` | the fact's anchor was edited by the task (true), or lies in an area the task never touched (false); a request needs both classes | none |
|
|
449
|
+
| `jev-verify-discover` | the candidate is the command the repo documents: its `.forge/verify`, or the command a later run of the same repo verified with, from `--verify` or `repo.verify` (command source not `jev`) | 0.7 |
|
|
450
|
+
| `jev-coverage` | the requirement is uncovered (true): a later plan revision has a task whose acceptance criteria hold at least 60% of the requirement's content words, and the tasks the request was asked about did not. Covered (false): every task of the run merged and no revision changed any acceptance criteria. No label for a requirement the gate sent back | none |
|
|
451
|
+
| `jev-retry-addressed` | the review of the same attempt raised the finding again (true); that review parsed in full and did not (false). No label without a review (a bounced attempt has none), or when its findings cannot be read in full | none |
|
|
452
|
+
| `jev-dwarf-message` | `unfinished` and `blocked`: the QA verdict of the same attempt was FAIL (true) or PASS (false). `question` has no label. No label for an attempt with no review, which is what a send-back leaves | none |
|
|
453
|
+
| `jev-attribution` | `culprit:<id>`: the merge breaks verification (true) when the search verified prefix k−1 PASS and prefix k FAIL; false when both were verified and do not form that pair. No label when either prefix was not verified, the base fails, or the search was inconclusive | none |
|
|
454
|
+
|
|
455
|
+
Verify discover has a label only for a repo that documents a command. Memory slice labels a
|
|
456
|
+
request only when it has both classes.
|
|
457
|
+
|
|
458
|
+
Three sites have no label, so `forge decide replay` refuses them, and their `on` needs
|
|
459
|
+
`--force`. Each is listed with the reason its label is not yet defined:
|
|
460
|
+
|
|
461
|
+
| site | why it has no label |
|
|
462
|
+
|---|---|
|
|
463
|
+
| `jev-memory-curate`, `jev-memory-stale` | `#41: recurrence is influenced by the gate itself; needs independent contradiction evidence`. An injected fact gets re-recorded, so the gate's own action would decide the label |
|
|
464
|
+
| `jev-findings` | `#46: needs issue-closure records`. Auto mode would supply its own ground truth, and an operational non-filing (a cap, a same-titled issue) is not a judgment |
|
|
465
|
+
|
|
466
|
+
### forge decide report
|
|
467
|
+
|
|
468
|
+
`forge decide report` reads the `jev.jsonl` files of past runs and the dataset's labels. It
|
|
469
|
+
asks no model.
|
|
470
|
+
|
|
471
|
+
It reads these runs:
|
|
472
|
+
|
|
473
|
+
- by default, the newest 10 runs in this repo's run registry, by the run directory's
|
|
474
|
+
modification time. `--runs N` changes the count;
|
|
475
|
+
- with `--all`, every repo's registered runs, cut the same way: the newest 10 across all repos,
|
|
476
|
+
or the newest N with `--runs N`;
|
|
477
|
+
- with `--run DIR` (repeatable), just those directories. It cannot be combined with `--all` or
|
|
478
|
+
`--runs`.
|
|
479
|
+
|
|
480
|
+
In each run directory it reads every `jev.jsonl`: the run's own, and those under `tasks/*/`
|
|
481
|
+
and `integrate-*/`. Anything under `jev-backtests/` is ignored. `--site S` keeps one site.
|
|
482
|
+
|
|
483
|
+
It prints one row per site, sorted by input tokens, then a `total` row:
|
|
484
|
+
|
|
485
|
+
| column | meaning |
|
|
486
|
+
|---|---|
|
|
487
|
+
| `mode` | the gate's mode for this repo, with `(forced)` when it is `on` without a passing replay. `-` for a site with no gate |
|
|
488
|
+
| `calls` | every logged request, including cache hits and skips |
|
|
489
|
+
| `cached` | requests answered from the request cache, at no cost |
|
|
490
|
+
| `errors` | failed requests with no skip reason |
|
|
491
|
+
| `skipped` | failed requests with a reason. The line under the table counts each reason |
|
|
492
|
+
| `in tokens`, `out tokens` | from each request's usage. A cache hit has none |
|
|
493
|
+
| `cost $` | tokens times the provider's price per million tokens, from the user `decide.json` (`provider add --price`). `-` when a provider in use has no price |
|
|
494
|
+
| `fired` | requests the site acted on at its threshold for the model used. `(+N?)` counts requests it could not judge, since verify discover needs the stored request body |
|
|
495
|
+
| `right` | decisions the site fired on whose label is true |
|
|
496
|
+
| `wrong` | decisions the site fired on whose label is false |
|
|
497
|
+
| `missed` | decisions the site did not fire on whose label is true |
|
|
498
|
+
|
|
499
|
+
`right`, `wrong` and `missed` count decisions, one per question, not requests. They read `-`
|
|
500
|
+
for a site with no label, and `0` when the runs carry no dataset or no labelled decision yet.
|
|
501
|
+
`--json` also gives `labelled.decisions`, which the table does not show.
|
|
502
|
+
|
|
503
|
+
An example, from a small test run directory with no dataset. Drift's label columns read `0`
|
|
504
|
+
because there is no dataset; prompt has no label, so its columns read `-`:
|
|
505
|
+
|
|
506
|
+
```text
|
|
507
|
+
site mode calls cached errors skipped in tokens out tokens cost $ fired right wrong missed
|
|
508
|
+
jev-drift on (forced) 3 1 0 1 1,200 80 0.0019 2 0 0 0
|
|
509
|
+
jev-prompt off 1 0 0 0 300 20 0.0005 1 - - -
|
|
510
|
+
total 4 1 0 1 1,500 100 0.0024 3 0 0 0
|
|
511
|
+
skipped: budget 1
|
|
512
|
+
runs read: 1: …/run
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### forge decide replay
|
|
516
|
+
|
|
517
|
+
```sh
|
|
518
|
+
forge decide replay --site jev-drift --provider typesafe --model jev-latest # dry run
|
|
519
|
+
forge decide replay --site jev-drift --provider typesafe --model jev-latest --send # ask, judge, record
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
Run the dry run first. It counts the labelled requests the replay would ask, and prints how
|
|
523
|
+
many are already answered, how many would be sent, how many the privacy floor skips, the input
|
|
524
|
+
tokens and the cost at the provider's price. It sends nothing and writes nothing.
|
|
525
|
+
|
|
526
|
+
`--send` asks each unanswered request, `--workers` at a time (default 3), then judges the
|
|
527
|
+
answers. A request already answered is never sent again, so an interrupted replay resumes. A
|
|
528
|
+
failed request is asked again by the next `--send`.
|
|
529
|
+
|
|
530
|
+
It takes the site's labelled live requests from the dataset, the first per request key.
|
|
531
|
+
`--runs N` keeps the newest N dataset runs. A request from a repo with the privacy floor is
|
|
532
|
+
never sent. The floor is read from that repo's `.forge/decide.json` at replay time, and the
|
|
533
|
+
request is counted under `privacy floor`.
|
|
534
|
+
|
|
535
|
+
The answers and the result are stored under `${XDG_STATE_HOME:-~/.local/state}/forge/decide/`:
|
|
536
|
+
|
|
537
|
+
- `replay/<site>/<provider>/<model>.jsonl`: one line per request, with its answers or its
|
|
538
|
+
failure reason. Each component is percent-encoded, so `--model @cf/meta/llama` is stored as
|
|
539
|
+
`replay/<site>/<provider>/%40cf%2Fmeta%2Fllama.jsonl`;
|
|
540
|
+
- `replays/<gate>.json`: the result, under `"<provider>/<model>"`. `forge decide gate G on`
|
|
541
|
+
reads this file. A result is recorded only when at least one labelled decision was judged.
|
|
542
|
+
|
|
543
|
+
On the judged half of the runs (the newer half, see [Promotion](#promotion)), `--send` reports:
|
|
544
|
+
|
|
545
|
+
- requests answered, and requests skipped by the privacy floor;
|
|
546
|
+
- decisions, positives and runs;
|
|
547
|
+
- the AUC of the replay, of the baseline, and of the live answers, one per live model;
|
|
548
|
+
- replay minus baseline, with its 95% interval and the margin;
|
|
549
|
+
- precision, recall and the number flagged at the site's threshold, against its floor;
|
|
550
|
+
- `PASSES: passes`, or `does not pass:` with the first rule that failed.
|
|
551
|
+
|
|
552
|
+
A replay is not charged to the run or daily budget, and its requests are not written to
|
|
553
|
+
`jev.jsonl` or the dataset. Each `--send` is a deliberate call to the provider.
|
|
554
|
+
|
|
555
|
+
Exit codes: 2 for an unknown site, a site with no label, an unknown provider or a bad flag; 1
|
|
556
|
+
when the provider has no key and is not local.
|
|
557
|
+
|
|
558
|
+
### Promotion
|
|
559
|
+
|
|
560
|
+
`forge decide gate G on`, for the provider and model the gate resolves to, writes `on` only when
|
|
561
|
+
the replay of G on that provider and model passes, or when it is forced (see
|
|
562
|
+
[Forced gates](#forced-gates)). It passes when, on the judged half:
|
|
563
|
+
|
|
564
|
+
1. there are at least 30 labelled decisions;
|
|
565
|
+
2. they come from at least 8 judged runs. Runs are ordered by their first labelled request,
|
|
566
|
+
and the older half calibrates while the newer half is judged. So a site needs 15 runs before
|
|
567
|
+
it has 8 to judge;
|
|
568
|
+
3. the lower bound of the 95% paired interval of AUC(replay) − AUC(baseline) is above −0.02.
|
|
569
|
+
The interval resamples whole runs 2,000 times. `--seed` (default 7) sets the resamples and
|
|
570
|
+
`--margin` (default 0.02) the bound. The verdict uses the interval that is reported;
|
|
571
|
+
4. for `drift`, `forward` and `verify-discover`, the replay's precision at the site's
|
|
572
|
+
threshold is at least the floor: 0.5, 0.5 and 0.7. The threshold is `drift_warn`,
|
|
573
|
+
`forward_warn` or `tests_act`, for the model replayed. `memory-slice` has no floor, so it
|
|
574
|
+
passes on rules 1 to 3.
|
|
575
|
+
|
|
576
|
+
A passing replay shows as `replayed <date>` in `status`.
|
|
577
|
+
|
|
578
|
+
### Forced gates
|
|
579
|
+
|
|
580
|
+
`--force` turns a gate on without a passing replay:
|
|
581
|
+
|
|
582
|
+
```sh
|
|
583
|
+
forge decide gate drift on --provider typesafe --force
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
It writes `"force": true` into the gate's entry. That lets the write through, and lets
|
|
587
|
+
`forge config set decide.gate.<gate>.provider` or `.model` change an `on` gate without a
|
|
588
|
+
replay.
|
|
589
|
+
|
|
590
|
+
"Forced" describes the state, not the flag. A gate is forced when it is `on` and no passing
|
|
591
|
+
replay exists for its provider and model, whichever level turned it on: the user file, the
|
|
592
|
+
repo, a profile, an environment variable, a flag, the legacy `jev.json`, or `migrate`. It stays
|
|
593
|
+
forced until a replay passes. Setting it to `off` or `shadow`, or to `on` with a passing
|
|
594
|
+
replay, drops the flag too.
|
|
595
|
+
|
|
596
|
+
Forced shows in:
|
|
597
|
+
|
|
598
|
+
- `forge decide status`: `forced` after the gate's provider, as in
|
|
599
|
+
`drift on (user) provider typesafe, forced`. `status --json` has `"forced": true` for the gate;
|
|
600
|
+
- `forge decide report`: the mode column reads `on (forced)`;
|
|
601
|
+
- `forge config show --json`: the same `forced` field. The text view does not print it;
|
|
602
|
+
- the plan's decide line, as in `forge: decide: on: drift (forced); shadow: none`;
|
|
603
|
+
- forge-ui: a `forced` tag on the gate, in Settings under Decision models. A recorded replay
|
|
604
|
+
shows as `replayed <date>`, or as `replay failed` when it did not pass.
|
|
605
|
+
|
|
606
|
+
`forge decide migrate` writes each gate it turns on with `"force": true`. Those gates keep
|
|
607
|
+
acting, and show as forced until a replay passes.
|
|
608
|
+
|
|
609
|
+
### The request cache
|
|
610
|
+
|
|
611
|
+
Each decision-model request is keyed by its body: the state, the model and the questions.
|
|
612
|
+
Answers from live calls are kept in `<run dir>/decide.cache/`, one file per request and
|
|
613
|
+
provider (name and URL). Each file holds the request's hash and the answers, not the request.
|
|
614
|
+
The run dir is the plan dir or the solo run dir (`FORGE_DECIDE_RUN_DIR`), so every task of a
|
|
615
|
+
plan shares one cache.
|
|
616
|
+
|
|
617
|
+
The cache answers a repeated request in the same run dir:
|
|
618
|
+
|
|
619
|
+
- a `run` that resumes a plan, and a `retry`;
|
|
620
|
+
- a re-`plan` of the same plan dir;
|
|
621
|
+
- a QA-only resume, where the dwarf's work is kept and only QA runs again.
|
|
622
|
+
|
|
623
|
+
A changed state, model or question is a miss, and so is a different provider or URL.
|
|
624
|
+
|
|
625
|
+
A hit costs nothing and is not charged to a budget, even when a cap is reached. It is logged in
|
|
626
|
+
`jev.jsonl` with `"cached": true`, counts under `cached` in `forge decide report`, and is not
|
|
627
|
+
written to the dataset a second time. Only live answers are cached: failures, fixtures and
|
|
628
|
+
replays are not. The privacy floor is checked before the cache, so a hit cannot get past it.
|
|
629
|
+
|
|
630
|
+
To turn the cache off, set `FORGE_DECIDE_CACHE=off` (`0`, `no` and `false` work too) in the
|
|
631
|
+
run's environment. Every request is then sent, and nothing is written to the cache.
|
|
632
|
+
|
|
633
|
+
## Adding a site
|
|
634
|
+
|
|
635
|
+
A new site takes this path, in this order. Skipping a step is how the sites in
|
|
636
|
+
[Tried and removed](#tried-and-removed) shipped.
|
|
637
|
+
|
|
638
|
+
1. **A rubric in `questions.py`.** A typed question with its own wording and its own threshold
|
|
639
|
+
name. Never reuse another rubric's threshold: `coupling_warn` borrowed `gate_warn` and never
|
|
640
|
+
fired once on any plan.
|
|
641
|
+
2. **Asked through `client.ask` with a site name** (`jev-<name>`). `client.ask` is the only
|
|
642
|
+
place that talks to a provider; it handles the key, the deadline, the provider mapping and
|
|
643
|
+
the fail-open skip, and it records the request.
|
|
644
|
+
3. **Gated in every copy of the gate list.** The gate's name goes into `GATES`, its site into
|
|
645
|
+
`GATE_SITE`, and its legacy capability into `GATE_CAPABILITY`, all in
|
|
646
|
+
`scripts/forge_decide/__init__.py`. The capability is `None` when the gate has none: the legacy
|
|
647
|
+
level then never turns it on. The same names are also hard-coded
|
|
648
|
+
in these places, and each one needs the new name:
|
|
649
|
+
- `scripts/forge_jev/__init__.py`: `SITE_CAPABILITY`, for every site, and `DEFAULT_THRESHOLDS`
|
|
650
|
+
for each threshold the rubric reads;
|
|
651
|
+
- `scripts/forge_decide/migrate.py`: `THRESHOLD_GATES`, the gates each stored threshold is
|
|
652
|
+
copied onto;
|
|
653
|
+
- `scripts/forge-jev-options.sh`: `FORGE_DECIDE_GATE_NAMES` and the gate names in its help
|
|
654
|
+
text (`tests/test_decide_flags.py` keeps it in step with `forge_decide.GATES`);
|
|
655
|
+
- `ui/forge_ui/control.py`: `DECIDE_GATES`;
|
|
656
|
+
- `ui/forge_ui/static/settings.js`: `GATES`;
|
|
657
|
+
- `ui/tests/test_browser_settings.py`: `_GATES`;
|
|
658
|
+
- `ui/tests/js/settings.test.js`: the list its assertions compare the page with.
|
|
659
|
+
|
|
660
|
+
Three tests spell the list out by hand and need the name too: `tests/test_config.py`,
|
|
661
|
+
`tests/test_decide_cli.py` and `tests/test_gate_registry.py`.
|
|
662
|
+
|
|
663
|
+
The shell asks `forge_decide_active <gate>` and the Python side asks `site_ready(site)`; both
|
|
664
|
+
must be false when the gate is off, `FORGE_JEV=off` is set, the privacy floor is on, or the
|
|
665
|
+
provider cannot be asked.
|
|
666
|
+
4. **Recorded in the run dataset.** The request must land in `jev.jsonl` and the run dataset
|
|
667
|
+
whole, state included. The labeller reads it back from the dataset and labels it from what
|
|
668
|
+
happened afterwards.
|
|
669
|
+
5. **A record in `forge_decide/sites.py`, with its functions taken lazily.** One `Site` per site:
|
|
670
|
+
its `fired`, `decisions`, `score` and `baseline`, the label sentence or a `label_issue`, the
|
|
671
|
+
floor if it has one, and `invert=True` when the raw probability points away from acting. A
|
|
672
|
+
site whose functions live in its gate module takes them through `_lazy(module, attr, default)`,
|
|
673
|
+
so `sites.py` never imports a module another task is still writing. While the module is
|
|
674
|
+
missing the site acts on nothing: `fired` and `decisions` give `[]`, `score` gives None and
|
|
675
|
+
`baseline` gives 0.0.
|
|
676
|
+
6. **A labeller, read lazily.** `forge_decide/labels.py` finds a site's labeller in `LABELLERS`.
|
|
677
|
+
A labeller has the shape `label(index, record, event, body) -> {qid: bool}`. One in its own
|
|
678
|
+
module, `forge_decide/label_<name>.py`, is registered as `sites._lazy('forge_decide.label_<name>',
|
|
679
|
+
'label', {})`, so the site has no rows until the module exists.
|
|
680
|
+
7. **The measurement functions and the CLI verb.** `forge_jev/<module>.py` exports `decisions`,
|
|
681
|
+
`score`, `fired` and `baseline` over the stored body, and `main(args)` for its verb. In
|
|
682
|
+
`forge_jev/cli.py`, `cmd_<verb>` checks its paths (exit 2) and calls
|
|
683
|
+
`_delegate(verb, module, args, repo)`, which imports the module and returns its `main`. A
|
|
684
|
+
missing module is exit 3. Exit 3 always means no opinion: skipped, shadow, or nothing to say.
|
|
685
|
+
Each `main` checks `site_ready(site)` first. The verb goes into `parser()` and into the dispatch
|
|
686
|
+
table in `main()`.
|
|
687
|
+
8. **A run-time gate puts its attempt into the request state.** A gate that runs once per attempt
|
|
688
|
+
puts `run` (the plan's `run_id`), `task` and `attempt` into the request's **state**, as
|
|
689
|
+
`dwarf-message` and `retry-addressed` do, and not only into `client.ask(context=...)`. The
|
|
690
|
+
request key, and with it the cache, then differs per attempt and per run. `labels.requests`
|
|
691
|
+
keeps only the first request per key, so without this a message repeated on a later attempt,
|
|
692
|
+
or in another run, would be neither asked nor labelled again. A per-run gate (`attribution`)
|
|
693
|
+
puts `run` alone.
|
|
694
|
+
9. **Replayed against labelled outcomes before it may act.** The label must come from outside the
|
|
695
|
+
model. Then measure the site on the state production sends, and report the class separation,
|
|
696
|
+
the noise floor from repeated identical requests, and the baseline from the criteria above.
|
|
697
|
+
`forge decide replay` judges it by the rule in [Measuring a gate](#measuring-a-gate). A number
|
|
698
|
+
measured on state the model is not sent describes nothing: it has bitten this file seven times.
|
|
699
|
+
10. **Ships in `shadow` first.** `shadow` asks and records, and changes nothing. A new site moves
|
|
700
|
+
to `on` only after step 9 holds on live runs. What `on` may then do is one of the actions in
|
|
701
|
+
[Gates and modes](#gates-and-modes): it never changes a verdict, never blocks a dispatch, and
|
|
702
|
+
never makes work pass.
|
|
703
|
+
|
|
704
|
+
## Tried and removed
|
|
705
|
+
|
|
706
|
+
All of these were removed on 2026-10-27 (#35) unless noted, each on a measurement. None should
|
|
707
|
+
be retried without new data that answers the measurement below.
|
|
708
|
+
|
|
709
|
+
**Routing rubrics and the tier composite.** Five `Score` rubrics per task (design judgment,
|
|
710
|
+
concurrency subtlety, blast radius, spec clarity, test coverage) were weighted into a tier, with
|
|
711
|
+
a "suggests <tier>" note and a `--jev-act` mode that could write it into the `difficulty`
|
|
712
|
+
column. No repo ever reached the calibration floor, so it never acted (removed 2026-10-17).
|
|
713
|
+
Over the run dataset its score predicted a first pass about as well as cheap features (AUC 0.69
|
|
714
|
+
against 0.64–0.67 on older runs), and on the newest runs every method sat near chance. A model
|
|
715
|
+
swap on Clef explained 2% of the variance in its predictions: a decision model judges how hard
|
|
716
|
+
a task is, not which model does it better. Models and efforts are measured by randomized
|
|
717
|
+
routing instead. `--jev-act` stays as a no-op, and `--jev-routing` still parses.
|
|
718
|
+
|
|
719
|
+
**`independently_verifiable`.** A gate for tasks whose confirmation needs another task's work.
|
|
720
|
+
Its first form asked about a sibling task the model was never shown. With the whole plan in
|
|
721
|
+
state it still could not separate a task documenting later work (`readme`, 0.60–0.65) from a
|
|
722
|
+
real one (`cli`, 0.65–0.75). At the old 0.38 it caught nothing on a real plan, and at 0.55 it
|
|
723
|
+
was a precision gate whose silence meant "no evidence", not "verifiable".
|
|
724
|
+
|
|
725
|
+
**Same-wave coupling.** Asked whether two tasks in one wave share an interface. It never fired
|
|
726
|
+
on any plan until measured, because it borrowed `gate_warn` (0.60) while coupling scores sat at
|
|
727
|
+
0.09–0.38. With its own `coupling_warn` 0.20 and a cap of three pairs, it rested on a single
|
|
728
|
+
plan with a margin of about 0.02. Cross-wave forward dependency, with a gap of 0.73, is the half that stayed.
|
|
729
|
+
|
|
730
|
+
**Review triage.** After a FAIL it read the review against the diff and flagged an unsound one
|
|
731
|
+
(correctness and citation). It could never change the verdict, and on real runs it flagged 2 of 5
|
|
732
|
+
FAILs, both artifacts of the 24K diff cut rather than unsound reviews. The reviewer's
|
|
733
|
+
verdict was never its to change, so there was nothing left for it to do.
|
|
734
|
+
|
|
735
|
+
**`clef-first-pass` and `clef-retry-pass`.** Silent Clef predictions of whether a first attempt
|
|
736
|
+
or a retry would pass, recorded and never acted on. They ranked at AUC 0.73 and 0.75 but were
|
|
737
|
+
poorly calibrated (retry ECE 0.28), cost 8% of tokens and hit two 10-second timeouts, and never
|
|
738
|
+
learned: the newest, largest tasks were too few to test, so the skill never showed up on new
|
|
739
|
+
runs.
|
|
740
|
+
|
|
741
|
+
**Verify flake triage (`flake_act`).** Classified a failing verify command as
|
|
742
|
+
`real_regression`, `known_flake`, `environment` or `generated_drift` and reran once on a
|
|
743
|
+
corroborated flake. It was unreachable by default: the deterministic rerun (`--verify-retries`,
|
|
744
|
+
default 1) comes first and needs no model, so the triage only ran with retries set to 0, plus a
|
|
745
|
+
recorded trap sharing a distinctive token with the failure. Its memory readers were also empty
|
|
746
|
+
for every repo for a time. The deterministic rerun and the `FLAKY` line stay.
|
|
747
|
+
|
|
748
|
+
**The test subset.** Asked which tests a diff makes relevant, to run them early. The safe
|
|
749
|
+
threshold at recall ≥ 0.95 was 0.20 in one repo and 0.45 in another, a 2.25× spread, so no
|
|
750
|
+
global default could serve, and it only ever added a run: the full suite still ran at
|
|
751
|
+
integration. `.forge/verify-subset` stays, for `--fail-first`.
|
|
752
|
+
|
|
753
|
+
**`forge jev backtest` and the corpus.** Replayed git history to score the test rubric, and the
|
|
754
|
+
tracked `jev-backtests/` directory held its results. Its tally carried a 140M-token artifact, so
|
|
755
|
+
its numbers could not be trusted. Captured requests in the run dataset are what a site is
|
|
756
|
+
replayed against now, as in step 5 above.
|
|
757
|
+
|
|
758
|
+
**Earlier removals (2026-10-17).** Effort sizing (AUC 0.64 overall but 0.50–0.54 within a tier,
|
|
759
|
+
81% of suggestions `xhigh` or higher), `forge jev parse-spec` (no shorter than typing the
|
|
760
|
+
`--dwarf-<tier>` flags) and Fractal child re-rating (gated on a calibration no repo had).
|
|
761
|
+
|
|
762
|
+
Old plan dirs and dataset stores that hold routing, coupling or triage rows stay readable; they
|
|
763
|
+
are no longer written.
|