opencode-model-router 1.6.0 → 1.8.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.
- package/CHANGELOG.md +376 -0
- package/README.md +223 -26
- package/package.json +3 -2
- package/src/commands/output.ts +132 -26
- package/src/index.ts +165 -6
- package/src/router/agent-options.ts +17 -8
- package/src/router/catalog.ts +464 -0
- package/src/router/config.ts +63 -6
- package/src/router/sessions.ts +140 -5
- package/src/router/subagents.ts +85 -0
- package/tiers.json +28 -27
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.8.0] - 2026-08-19
|
|
9
|
+
|
|
10
|
+
Minor release: every vendor preset is refreshed to the current generation of models.
|
|
11
|
+
No routing logic changed — the tier structure, patterns and enforcement behavior are
|
|
12
|
+
the same, only the model ids (and the reasoning effort attached to them) move forward.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **`anthropic` preset** now routes `fast` → `sonnet-5`, `medium` → `opus-5` at `high`
|
|
17
|
+
effort, and `heavy` → `fable-5` at `max`.
|
|
18
|
+
- **`openai` preset** now routes `fast` → `gpt-5.6-luna-fast`, `medium` →
|
|
19
|
+
`gpt-5.6-terra-fast` at `high` effort, and `heavy` → `gpt-5.6-sol-fast` at `xhigh`.
|
|
20
|
+
- **`google` preset** now routes `fast` → `gemini-3.5-flash-lite`, `medium` →
|
|
21
|
+
`gemini-3.7-flash`, and `heavy` → `gemini-3.1-pro-preview`.
|
|
22
|
+
- **`github-copilot` preset** now routes `medium` → `claude-sonnet-5` and `heavy` →
|
|
23
|
+
`claude-fable-5`.
|
|
24
|
+
- **`hybrid` preset** now routes `medium` → `gpt-5.6-terra-fast` and `heavy` →
|
|
25
|
+
`claude-opus-5` at `max` effort.
|
|
26
|
+
|
|
27
|
+
## [1.7.0] - 2026-08-19
|
|
28
|
+
|
|
29
|
+
Minor release: live model-catalog discovery and validation — `/router models`, stale-model
|
|
30
|
+
and fallback-chain checks, orphaned strong-pattern detection with near-miss naming — plus
|
|
31
|
+
`subagentTiers` for routing pre-existing subagents, resolved prompt style in `/tiers`, and
|
|
32
|
+
a set of enforcement and noise fixes. Routing behavior is unchanged unless you opt into
|
|
33
|
+
the new keys.
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- **Near-miss reporting for orphaned strong-model patterns.** When a pattern matches
|
|
38
|
+
nothing served, `/router models` and the startup warning now name any served model
|
|
39
|
+
that matches once `.`, `-` and `_` are normalized away. The known failure is a
|
|
40
|
+
provider moving between separator styles rather than a wrong name, so this turns
|
|
41
|
+
"this matches nothing" into "this matches nothing, and here is the id it means".
|
|
42
|
+
|
|
43
|
+
- **`subagentTiers`, opt-in routing for your own subagents.** A map of agent name to
|
|
44
|
+
tier name repoints pre-existing custom subagents at the active preset's models, so
|
|
45
|
+
they follow `/preset` instead of pinning a model id in their own agent files. A
|
|
46
|
+
subagent that declares no `model` otherwise inherits the model of whoever invoked it,
|
|
47
|
+
which quietly runs cheap read-only helpers at orchestrator prices. Absent or empty
|
|
48
|
+
means no agent is touched.
|
|
49
|
+
- **`/router models [provider]`** lists valid model ids from opencode's live provider
|
|
50
|
+
catalog, with each provider's default and any `deprecated`/`alpha`/`beta` status.
|
|
51
|
+
- **Stale-model validation.** Bare `/router` checks the active preset's tier models
|
|
52
|
+
against the catalog and reports missing or deprecated ids with the closest valid
|
|
53
|
+
suggestions; the same check is logged once per session. Report-only, so the plugin
|
|
54
|
+
never changes a model for you. A bad model id previously failed silently on every
|
|
55
|
+
subagent dispatch.
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- **Orphaned-pattern warnings the user could not act on.** A pattern from the shipped
|
|
60
|
+
default list is now reported only when a near-miss proves the model is served under a
|
|
61
|
+
drifted separator; a pattern you wrote in `modelGenerations.strong` is still always
|
|
62
|
+
reported. An anthropic-only install no longer warns that `claude-mythos-5` matches
|
|
63
|
+
nothing — that provider simply does not sell it.
|
|
64
|
+
|
|
65
|
+
- **Dormant fallback chains reported as broken.** `fallback-provider-unknown` now fires
|
|
66
|
+
only when the active preset actually routes to that provider. The shipped chains cover
|
|
67
|
+
every provider, so a single-provider install was warning about chains that are inert by
|
|
68
|
+
design. Chain entries naming a preset that does not exist are still reported.
|
|
69
|
+
|
|
70
|
+
- Removed a stale `buildAgentOptions` from `src/commands/output.ts`. It was live when
|
|
71
|
+
the presentation layer was extracted, but `src/router/agent-options.ts` later became
|
|
72
|
+
the real implementation and gained `effort` handling. The orphan was reachable only
|
|
73
|
+
from its own test, and importing it by mistake would have silently dropped `effort`.
|
|
74
|
+
|
|
75
|
+
- **`thinking.budgetTokens: 0` no longer swallows a tier's `effort`.** Behavior change:
|
|
76
|
+
suppression used `budgetTokens != null` while emission required a truthy value, so a
|
|
77
|
+
Claude tier with `thinking: { budgetTokens: 0 }` plus `effort` warned that "explicit
|
|
78
|
+
thinking wins" and then registered neither key. A truthy `budgetTokens` is now the
|
|
79
|
+
single notion of "thinking was asked for": `0` is ignored (one-time notice per tier)
|
|
80
|
+
and `effort` applies normally.
|
|
81
|
+
- **Enforced-mode hard blocks now apply to non-trivial `@fast` recon.** Trivial
|
|
82
|
+
classification exempted *any* `fast`-tier dispatch whose text matched a `fast`
|
|
83
|
+
taskPattern stem (`read`, `search`, `grep`, …) from enforcement, so a multi-file
|
|
84
|
+
recon dispatch was treated as "trivial" and `guardBeforeCall` downgraded
|
|
85
|
+
`enforced` → `advisory`. The `read_budget` guard could therefore never
|
|
86
|
+
hard-block a `@fast` subagent — the precise runaway it exists to bound.
|
|
87
|
+
`classifyTrivial` now additionally requires single-shot shape: at most one named
|
|
88
|
+
file path (well-known extensionless files like `Makefile` or `LICENSE` count),
|
|
89
|
+
no multi-step marker (numbered or colon-numbered lists, sequencing words, `;`,
|
|
90
|
+
`&&`), no enumeration of three or more subjects, no multiple imperative lines,
|
|
91
|
+
no distributive breadth quantifier (`every` / `all` over a plural or collective
|
|
92
|
+
target class, as in `read all guard modules` — partitive depth over a single
|
|
93
|
+
file such as `read every line of package.json` stays trivial), and a length
|
|
94
|
+
backstop. Genuine single-shot lookups stay exempt, and real work
|
|
95
|
+
was never trivial either way. Present since
|
|
96
|
+
proportional enforcement landed (`80abf05`) and shipped in every release that
|
|
97
|
+
included it. The `enforcement.proportional.trivialBypass` knob and its semantics
|
|
98
|
+
are unchanged.
|
|
99
|
+
|
|
100
|
+
## [1.6.0] - 2026-08-18
|
|
101
|
+
|
|
102
|
+
Minor release: a salvage port of the features worth keeping from an abandoned branch —
|
|
103
|
+
per-tier reasoning effort, goal-oriented prompts, session-resume accounting, time-boxes
|
|
104
|
+
on every verification hop, and idle eviction for the delegation store. Routing behavior
|
|
105
|
+
is unchanged unless you opt into the new keys.
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
|
|
109
|
+
- **Per-tier `effort`.** Each tier may declare a reasoning-effort level that is forwarded
|
|
110
|
+
to the provider on dispatch. The bundled `fable-effort` preset uses it to run all three
|
|
111
|
+
tiers on the same model at different effort levels, so the cost ladder comes from
|
|
112
|
+
reasoning depth rather than model size.
|
|
113
|
+
- **Goal-oriented prompt styles.** `promptStyle` (`auto` | `prescriptive` | `goal-oriented`),
|
|
114
|
+
`modelGenerations`, and `tierPromptsGoalOriented` let a tier ship a goal-oriented prompt
|
|
115
|
+
instead of the terse rule list. Under `auto` a tier switches to the goal-oriented text
|
|
116
|
+
when its model matches a declared newer generation; everything else keeps the prescriptive
|
|
117
|
+
prompt.
|
|
118
|
+
- **Session-resume accounting.** A resumed session no longer restarts its budget: the
|
|
119
|
+
cumulative ceiling carries across resumes, and registration now returns a `RegisterResult`
|
|
120
|
+
so callers can see whether a dispatch was newly counted or replayed.
|
|
121
|
+
- **Time-boxes on delegate, grader, and gate.** `delegateTimeoutMs` (default 600000),
|
|
122
|
+
`graderTimeoutMs` (default 60000), and `gateBudgetMs` (default 90000) bound each hop.
|
|
123
|
+
They are fail-closed: a hop that runs out of budget is reported as unmet, never as
|
|
124
|
+
silently satisfied.
|
|
125
|
+
- **Idle-TTL eviction for the delegation store.** Entries idle for more than an hour are
|
|
126
|
+
swept, throttled to at most one sweep every five minutes. The sweep is timer-less — it
|
|
127
|
+
piggybacks on store access — so it adds no background handles and nothing to unref in
|
|
128
|
+
tests.
|
|
129
|
+
- **`cwd`-scoped verification.** A delegation may carry a `cwd`, which scopes the
|
|
130
|
+
deterministic file checks and the grader's session lookup to that directory.
|
|
131
|
+
- **Evidence-grounding clauses in the medium and heavy tier prompts.** Subagents are told
|
|
132
|
+
to check each reported claim against a tool result from the same session and to say so
|
|
133
|
+
explicitly when a claim is unverified.
|
|
134
|
+
- **An explicit `enforcement` block in `tiers.json`.** Every key is now written out at the
|
|
135
|
+
value that was previously the effective default, so the shipped behavior is unchanged and
|
|
136
|
+
readable rather than implicit. `validateEnforcement` type-checks every shipped key.
|
|
137
|
+
|
|
138
|
+
### Changed
|
|
139
|
+
|
|
140
|
+
- **`CAP:none` now requires a `reason:` line.** A dispatch that says `CAP:none` without a
|
|
141
|
+
`reason:` line in its text falls back to the tier's baseline cap instead of lifting it.
|
|
142
|
+
The protocol states this in two places (rule 7 and the per-dispatch paragraph), which is
|
|
143
|
+
the whole of this release's prompt growth: the routing protocol goes from 2,970 to 3,089
|
|
144
|
+
characters, and the Claude and enforcement paths grow by the same 119 characters. See the
|
|
145
|
+
token-overhead table in the README.
|
|
146
|
+
- **Under `promptStyle: "auto"`, some bundled tiers switch to goal-oriented prompts.** Tiers
|
|
147
|
+
whose model is `claude-fable-5` or `claude-opus-4-8` — `anthropic.heavy`, `hybrid.heavy`,
|
|
148
|
+
and all three `fable-effort` tiers — now receive the goal-oriented text. Set
|
|
149
|
+
`promptStyle` to `prescriptive` to keep the previous prompts.
|
|
150
|
+
|
|
151
|
+
### Fixed
|
|
152
|
+
|
|
153
|
+
- **Child-session disposal is idempotent.** Disposing a session that was already disposed
|
|
154
|
+
is a no-op instead of throwing.
|
|
155
|
+
- **Gate-timeout aborts are scoped per delegation.** A gate that runs out of budget aborts
|
|
156
|
+
only its own delegation; concurrent delegations are no longer cancelled with it.
|
|
157
|
+
- **`fileExists` reasons are honest about absolute paths.** The reason string reports the
|
|
158
|
+
path that was actually checked rather than the relative form that was passed in.
|
|
159
|
+
- **No more orphan `lastTouch` entries.** Touch records are removed with their delegation
|
|
160
|
+
instead of accumulating for the lifetime of the process.
|
|
161
|
+
|
|
162
|
+
### Deliberately not ported
|
|
163
|
+
|
|
164
|
+
Several things from the source branch were left behind on purpose. The **lessons memory store**
|
|
165
|
+
(~800 lines) has no measurement behind it — if it is revisited it must arrive opt-in and
|
|
166
|
+
default-false rather than as a new always-on subsystem. The **anti-context-anxiety clause**,
|
|
167
|
+
the **INTENT section**, and the **workspace-root line** would re-add the prose that [#21]
|
|
168
|
+
deliberately removed. Flipping `activePreset` to `"opus"` would change the default for every
|
|
169
|
+
user, and flipping `enforcement.mode` to `"enforced"` would turn an advisory layer into a
|
|
170
|
+
blocking one; both stay as they are. `src/guard/smoke-evidence.ts` is test-support only and
|
|
171
|
+
carries no runtime behavior, so it was left as optional and not ported.
|
|
172
|
+
|
|
173
|
+
### Credits
|
|
174
|
+
|
|
175
|
+
Refactors [#26], [#27], and [#28] by Lucas Húngaro were merged while this port was in
|
|
176
|
+
progress, and the ported code is built on top of them.
|
|
177
|
+
|
|
178
|
+
[#26]: https://github.com/marco-jardim/opencode-model-router/pull/26
|
|
179
|
+
[#27]: https://github.com/marco-jardim/opencode-model-router/pull/27
|
|
180
|
+
[#28]: https://github.com/marco-jardim/opencode-model-router/pull/28
|
|
181
|
+
|
|
182
|
+
## [1.5.0] - 2026-08-18
|
|
183
|
+
|
|
184
|
+
Minor release: update-safe configuration overrides, so customizations survive the plugin
|
|
185
|
+
updates that overwrite the cached package file.
|
|
186
|
+
|
|
187
|
+
### Added
|
|
188
|
+
|
|
189
|
+
- **Update-safe config overrides.** `~/.config/opencode/opencode-model-router.overrides.jsonc`
|
|
190
|
+
(global) and `<repo>/.opencode/opencode-model-router.overrides.jsonc` (project) are
|
|
191
|
+
deep-merged over the bundled `tiers.json` — specify only the keys you want to change.
|
|
192
|
+
The project file is located by searching upward to the repo root and wins over the
|
|
193
|
+
global file, which wins over the bundled defaults. Models, tiers, and whole presets can
|
|
194
|
+
now be customized without editing the cached package file, which every plugin update
|
|
195
|
+
overwrites. An overrides file can also define an entirely new preset — `model` is the
|
|
196
|
+
only required field per tier: `costRatio`/`steps` default to the conventional `1`/`5`/`20`
|
|
197
|
+
and `30`/`50`/`120` by tier name when omitted, and `description`/`whenToUse` are optional.
|
|
198
|
+
Contributed by Lucas Húngaro. ([#22], closes [#2] and [#4])
|
|
199
|
+
- **JSONC in the override files.** `//` and `/* */` comments and trailing commas are
|
|
200
|
+
accepted, via a small zero-dependency parser (`src/router/jsonc.ts`). No new runtime
|
|
201
|
+
dependencies.
|
|
202
|
+
- **`/router overrides`** — prints the global and project override paths, which of them
|
|
203
|
+
exist, and the merge precedence.
|
|
204
|
+
|
|
205
|
+
### Fixed
|
|
206
|
+
|
|
207
|
+
- **The upward search for the project override file is now bounded.** It stops at a
|
|
208
|
+
`.git`, `.hg`, or `.svn` marker, at 16 levels above the working directory, or at the
|
|
209
|
+
user's home directory. A tree containing no repo marker previously walked all the way
|
|
210
|
+
to the filesystem root, so running opencode from a non-repo directory could silently
|
|
211
|
+
adopt an unrelated ancestor's override file. `package.json` is deliberately not treated
|
|
212
|
+
as a repo marker: in a monorepo it would stop the walk at `packages/<pkg>/` before
|
|
213
|
+
reaching the repo-root `.opencode/`. ([`8710a84`])
|
|
214
|
+
|
|
215
|
+
[`8710a84`]: https://github.com/marco-jardim/opencode-model-router/commit/8710a84
|
|
216
|
+
[#2]: https://github.com/marco-jardim/opencode-model-router/issues/2
|
|
217
|
+
[#4]: https://github.com/marco-jardim/opencode-model-router/issues/4
|
|
218
|
+
[#22]: https://github.com/marco-jardim/opencode-model-router/pull/22
|
|
219
|
+
|
|
220
|
+
## [1.4.0] - 2026-08-18
|
|
221
|
+
|
|
222
|
+
Minor release: session lifecycle fixes, more reliable read-only delegation, and a
|
|
223
|
+
smaller routing protocol with measured overhead documentation.
|
|
224
|
+
|
|
225
|
+
### Fixed
|
|
226
|
+
|
|
227
|
+
- **Grader and producer child sessions are now parented and disposed.** The plugin
|
|
228
|
+
previously created backend sessions for every grader and producer attempt but never
|
|
229
|
+
aborted or deleted them, including on the happy path, leaving orphaned top-level
|
|
230
|
+
sessions in the TUI. ([`40c9b94`])
|
|
231
|
+
- **Layer-2 grading now skips read-only research delegations** when the DoD is inferred,
|
|
232
|
+
checker-only, and no files changed. This prevents false "not accepted" notes on
|
|
233
|
+
legitimate research results. Contributed by Lucas Húngaro. ([#20])
|
|
234
|
+
- README prompt-overhead figures now use measured character counts and explicit token
|
|
235
|
+
estimate ranges. The previous `~210 tokens` claim understated the former default
|
|
236
|
+
Claude path by roughly eight to nine times.
|
|
237
|
+
|
|
238
|
+
### Added
|
|
239
|
+
|
|
240
|
+
- A drift test now pins the acceptance-check grammar shared by the `/annotate-plan`
|
|
241
|
+
template, `parseAcceptanceBlock`, and the delegation protocol. ([`19171ea`])
|
|
242
|
+
|
|
243
|
+
### Changed
|
|
244
|
+
|
|
245
|
+
- **The delegation protocol was rewritten without dropping routing rules.** On the
|
|
246
|
+
default Claude path it is 46.6% smaller, from 7,006 to 3,742 characters. Contributed
|
|
247
|
+
by Lucas Húngaro. ([#21])
|
|
248
|
+
- **The anti-narration guardrail is now opt-in.** Set the top-level `antiNarration`
|
|
249
|
+
boolean to `true` to restore the prompt clause and detector; the default is `false`.
|
|
250
|
+
([#21])
|
|
251
|
+
- The package now declares Node.js 20 or later through `engines.node`. ([`6fa9bab`])
|
|
252
|
+
|
|
253
|
+
[`19171ea`]: https://github.com/marco-jardim/opencode-model-router/commit/19171ea
|
|
254
|
+
[`40c9b94`]: https://github.com/marco-jardim/opencode-model-router/commit/40c9b94
|
|
255
|
+
[`6fa9bab`]: https://github.com/marco-jardim/opencode-model-router/commit/6fa9bab
|
|
256
|
+
[#20]: https://github.com/marco-jardim/opencode-model-router/pull/20
|
|
257
|
+
[#21]: https://github.com/marco-jardim/opencode-model-router/pull/21
|
|
258
|
+
|
|
259
|
+
## [1.3.1] - 2026-08-16
|
|
260
|
+
|
|
261
|
+
Patch release: bug fixes, documentation, and release-engineering only. No runtime
|
|
262
|
+
behaviour changes beyond the corrected `github-copilot` model identifiers.
|
|
263
|
+
|
|
264
|
+
### Fixed
|
|
265
|
+
|
|
266
|
+
- **`github-copilot` preset model IDs** now use the dot-separated form the provider
|
|
267
|
+
actually serves (`claude-haiku-4.5`, `claude-sonnet-4.6`, `claude-opus-4.6`) instead of
|
|
268
|
+
the dash-separated variants, and the non-existent `/thinking` suffix has been dropped
|
|
269
|
+
from the `@heavy` tier. Delegations under this preset previously referenced models that
|
|
270
|
+
could not be resolved. ([#10], fixes [#9])
|
|
271
|
+
- Golden snapshot for the `github-copilot` delegation protocol realigned with the
|
|
272
|
+
corrected identifiers above.
|
|
273
|
+
|
|
274
|
+
### Added
|
|
275
|
+
|
|
276
|
+
- **Continuous integration.** A `Test` workflow runs `npm ci`, the full suite, and
|
|
277
|
+
`npm run typecheck` on Node 24 for every pull request and every push to `master`.
|
|
278
|
+
- **Automated publishing via npm Trusted Publishing (OIDC).** Pushing a `v*` tag builds
|
|
279
|
+
and publishes from GitHub Actions with SLSA provenance attestation and no long-lived
|
|
280
|
+
npm token. Third-party actions are pinned by commit SHA.
|
|
281
|
+
- **`package-lock.json` is now tracked**, making installs reproducible across
|
|
282
|
+
contributors and CI. It is not included in the published tarball.
|
|
283
|
+
|
|
284
|
+
### Changed
|
|
285
|
+
|
|
286
|
+
- README install and configuration instructions corrected and expanded, including how the
|
|
287
|
+
`tiers.json` cache behaves. ([#7])
|
|
288
|
+
- Development dependencies `vitest` and `@vitest/coverage-v8` upgraded to 4.x. Both are
|
|
289
|
+
bumped in lockstep because `@vitest/coverage-v8` pins an exact `vitest` peer; Dependabot
|
|
290
|
+
is now configured to group them. Dev-only — no effect on the published package. ([#8])
|
|
291
|
+
|
|
292
|
+
[#7]: https://github.com/marco-jardim/opencode-model-router/pull/7
|
|
293
|
+
[#8]: https://github.com/marco-jardim/opencode-model-router/pull/8
|
|
294
|
+
[#9]: https://github.com/marco-jardim/opencode-model-router/issues/9
|
|
295
|
+
[#10]: https://github.com/marco-jardim/opencode-model-router/pull/10
|
|
296
|
+
|
|
297
|
+
## [1.3.0]
|
|
298
|
+
|
|
299
|
+
### Changed — advisory enforcement is now the default
|
|
300
|
+
|
|
301
|
+
- **Default enforcement mode flipped `off` → `advisory`.** With `enforcement.mode`
|
|
302
|
+
unset, every non-trivial delegation is now verified and any miss surfaces a
|
|
303
|
+
non-blocking forcing-note; the orchestrator system prompt grows by ~200 tokens for
|
|
304
|
+
the DoD/acceptance section, and subagents may receive non-blocking guard banners.
|
|
305
|
+
Nothing is ever hard-blocked in `advisory`. To restore the previous byte-identical
|
|
306
|
+
behaviour (zero added tokens, zero new latency), set `"mode": "off"` explicitly, run
|
|
307
|
+
`/router enforce off`, or set `MODEL_ROUTER_ENFORCE=0`.
|
|
308
|
+
- **The custom `delegate` tool is now hidden by default.** Delegation routes through the
|
|
309
|
+
native `Task()` tool so subagents render inline in the TUI instead of running in an
|
|
310
|
+
invisible orphan session (fixes the `delegate [tier=…, task=…]` stall). The
|
|
311
|
+
independently-verified `delegate` tool remains available behind an opt-in flag.
|
|
312
|
+
- The acceptance forcing-note now includes tier-escalation guidance
|
|
313
|
+
(`Task(subagent_type="<nextTier>")`) when a delegated result is not accepted.
|
|
314
|
+
|
|
315
|
+
### Added
|
|
316
|
+
|
|
317
|
+
- `experimental.verifiedDelegateTool` config flag in `tiers.json`, and the
|
|
318
|
+
`MODEL_ROUTER_VERIFIED_DELEGATE=1` environment variable, to opt back into the
|
|
319
|
+
authoritative `delegate` tool.
|
|
320
|
+
|
|
321
|
+
## [1.2.0]
|
|
322
|
+
|
|
323
|
+
### Added — Enforced delegation (opt-in, default OFF)
|
|
324
|
+
|
|
325
|
+
A three-layer enforcement system that makes tiered delegation *reliable* instead of
|
|
326
|
+
advisory. **It is opt-in and disabled by default**: with `enforcement.mode` unset (or
|
|
327
|
+
`"off"`), behaviour is byte-identical to previous releases — no added prompt tokens, no
|
|
328
|
+
new runtime behaviour. Enable per repo via `enforcement.mode` in `tiers.json`, per run
|
|
329
|
+
via the `MODEL_ROUTER_ENFORCE=1` environment variable, or per session via
|
|
330
|
+
`/router enforce <off|advisory|enforced>`. Enforcement applies only to subagent/delegate
|
|
331
|
+
sessions; the orchestrator session is never gated.
|
|
332
|
+
|
|
333
|
+
- **Layer 1 — hard-block guard** (`tool.execute.before`): an in-band, throw-to-block
|
|
334
|
+
guard for subagent sessions. Enforces a tool-call budget ceiling, anti-redundancy
|
|
335
|
+
(repeated identical reads), and anti-self-script (ad-hoc `bash` execution such as
|
|
336
|
+
heredocs / `node -e` / `cat >`), with an optional deliverable-first rule. Writing
|
|
337
|
+
source files is *never* blocked by default (`blockScriptWrites` is opt-in).
|
|
338
|
+
`off` is a no-op, `advisory` surfaces a banner, `enforced` blocks.
|
|
339
|
+
- **Layer 2 — independent acceptance gate**: turns "the producer says it's done" into
|
|
340
|
+
"the output was objectively accepted". A Definition-of-Done is parsed from an
|
|
341
|
+
`[acceptance]` block (Mode B) or auto-inferred from the dispatch (Mode A) and checked
|
|
342
|
+
either deterministically (`run` / `fileExists` / `schemaMatch` / `testsPass` /
|
|
343
|
+
`buildPasses` / `lintClean` behind an allowlisted exec/fs seam) or by an **independent
|
|
344
|
+
grader** in a fresh session at a tier ≥ the producer's. Fail-closed: any error,
|
|
345
|
+
unparseable verdict, or non-independent grader counts as a failure. Never silently
|
|
346
|
+
accepts a non-trivial delegation that lacks a checkable DoD.
|
|
347
|
+
- **Layer 3 — quality-escalation ladder**: on a failed gate the authoritative `delegate`
|
|
348
|
+
tool retries, then escalates `fast → medium → heavy`, then returns an honest
|
|
349
|
+
`status: unmet` — never a fake pass. Provably terminating (bounded by
|
|
350
|
+
`maxAttemptsPerTier`, `maxTotalAttempts`, and a cost ceiling) and composes with the
|
|
351
|
+
existing advisory provider-failover chain without double-counting attempts.
|
|
352
|
+
|
|
353
|
+
### Added — tooling & APIs
|
|
354
|
+
|
|
355
|
+
- New `delegate` tool (authoritative produce → verify → escalate in one call) alongside
|
|
356
|
+
the existing raw `Task()` path (advisory-grade verify-dispatch).
|
|
357
|
+
- New `/router enforce <off|advisory|enforced>` command (persisted atomically).
|
|
358
|
+
- New `enforcement` configuration block in `tiers.json` (fully validated; see
|
|
359
|
+
`docs/CONFIG_REFERENCE.md`). Per-mode example presets in `docs/ENFORCEMENT_PRESETS.md`.
|
|
360
|
+
- TypeScript + Vitest test infrastructure, golden-snapshot characterization tests, and a
|
|
361
|
+
coverage gate. Documentation suite: `docs/ENFORCEMENT.md`, `docs/VERIFICATION.md`,
|
|
362
|
+
`docs/ESCALATION.md`, `docs/CONFIG_REFERENCE.md`, `docs/MIGRATION.md`, and ADRs
|
|
363
|
+
`docs/adr/0000`–`0002`.
|
|
364
|
+
|
|
365
|
+
### Security
|
|
366
|
+
|
|
367
|
+
- Secret scrubbing (`scrubText`) is applied to every model-visible string the enforcement
|
|
368
|
+
layers emit — forcing messages, grader prompts, scorecards, and trajectory dumps.
|
|
369
|
+
- The deterministic verifier runs only allowlisted binaries, rejects shell
|
|
370
|
+
metacharacters, and blocks interpreter eval flags (`node -e`, `python -c`, …).
|
|
371
|
+
|
|
372
|
+
### Notes
|
|
373
|
+
|
|
374
|
+
- Default is OFF; upgrading changes nothing until you opt in. See `docs/MIGRATION.md`.
|
|
375
|
+
- The bundled per-mode enforcement presets are **preliminary** (tuned from fixtures, not
|
|
376
|
+
field telemetry) and are documented rather than written into `tiers.json`.
|