@dreb/coding-agent 2.45.4 → 2.46.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/README.md +6 -2
- package/dist/core/agent-session.d.ts +10 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +75 -15
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/context-buffer.d.ts +2 -0
- package/dist/core/context-buffer.d.ts.map +1 -1
- package/dist/core/context-buffer.js +8 -0
- package/dist/core/context-buffer.js.map +1 -1
- package/dist/core/dispatch-arbiter.d.ts +94 -0
- package/dist/core/dispatch-arbiter.d.ts.map +1 -0
- package/dist/core/dispatch-arbiter.js +316 -0
- package/dist/core/dispatch-arbiter.js.map +1 -0
- package/dist/core/git-repo-state.d.ts +2 -0
- package/dist/core/git-repo-state.d.ts.map +1 -1
- package/dist/core/git-repo-state.js +19 -0
- package/dist/core/git-repo-state.js.map +1 -1
- package/dist/core/model-routing-guide.d.ts +15 -0
- package/dist/core/model-routing-guide.d.ts.map +1 -0
- package/dist/core/model-routing-guide.js +186 -0
- package/dist/core/model-routing-guide.js.map +1 -0
- package/dist/core/settings-manager.d.ts +18 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +33 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/thinking.d.ts +14 -0
- package/dist/core/thinking.d.ts.map +1 -1
- package/dist/core/thinking.js +35 -2
- package/dist/core/thinking.js.map +1 -1
- package/dist/core/tools/index.d.ts +7 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +53 -6
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +343 -53
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +99 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +75 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +65 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +8 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/agent-models.md +33 -1
- package/docs/dashboard.md +8 -2
- package/docs/json.md +31 -5
- package/docs/rpc.md +60 -9
- package/docs/session.md +7 -1
- package/docs/settings.md +33 -1
- package/docs/skills.md +38 -0
- package/package.json +1 -1
- package/skills/model-routing-guide/SKILL.md +182 -0
package/docs/rpc.md
CHANGED
|
@@ -1243,17 +1243,18 @@ Note: with `summarize: true` the command is LLM-bound and can take a while. `Rpc
|
|
|
1243
1243
|
|
|
1244
1244
|
### Settings
|
|
1245
1245
|
|
|
1246
|
-
Persistent settings, backed by the settings file (see [settings.md](settings.md)). They are normally distinct from live session state, with
|
|
1246
|
+
Persistent settings, backed by the settings file (see [settings.md](settings.md)). They are normally distinct from live session state, with global-only control/security-policy exceptions:
|
|
1247
1247
|
|
|
1248
1248
|
- **Persistent defaults** (`get_settings` / `set_settings`): provider/model, thinking level, queue modes, compaction/retry/image/skill/thinking-display/transport toggles, and per-agent model fallback lists seed fresh runtimes. Writing these ordinary defaults does **not** change a running session.
|
|
1249
1249
|
- **Global nested-context trust policy** (`autoLoadNestedContext`, `trustedContextFolders`, `effectiveTrustedContextRoots`, and the trust commands below): this is read from `~/.dreb/agent/settings.json` only, never project settings. Active main/subagent processes observe it for **future lazy nested/out-of-cwd loads**; it cannot remove content already injected into a conversation. It does not govern the separate initial upward context scan from the launch cwd.
|
|
1250
|
+
- **Global Dispatch Arbiter policy** (`subagentArbiter`): the complete object is read/written globally and project settings cannot shadow it. Enabled runtimes consume it before future subagent spawns; it does not rewrite already-started children.
|
|
1250
1251
|
- **Runtime state** (`get_state` / `set_model` / `set_thinking_level` / `set_steering_mode` / `set_follow_up_mode` / `set_auto_compaction` / `set_auto_retry`): the state of the live session. Note that the runtime setters also persist their values as new defaults as a side effect.
|
|
1251
1252
|
|
|
1252
1253
|
A dashboard settings tab typically reads `get_state` for what is active now and `get_settings` for persistent defaults plus the current global context-trust policy.
|
|
1253
1254
|
|
|
1254
1255
|
#### get_settings
|
|
1255
1256
|
|
|
1256
|
-
Get persistent settings. Before replying, RPC flushes pending settings writes, reloads durable global and project settings, and then reads the merged view; reopening dashboard Settings therefore sees external file edits. A pending write failure, unreadable file, parse error, or reload failure returns an explicit RPC error rather than a stale snapshot. Ordinary fields are the merged global + project view;
|
|
1257
|
+
Get persistent settings. Before replying, RPC flushes pending settings writes, reloads durable global and project settings, and then reads the merged view; reopening dashboard Settings therefore sees external file edits. A pending write failure, unreadable file, parse error, or reload failure returns an explicit RPC error rather than a stale snapshot. Ordinary fields are the merged global + project view; nested-context trust and `subagentArbiter` are always global-only.
|
|
1257
1258
|
|
|
1258
1259
|
```json
|
|
1259
1260
|
{"type": "get_settings"}
|
|
@@ -1283,6 +1284,12 @@ Response:
|
|
|
1283
1284
|
"hideThinkingBlock": false,
|
|
1284
1285
|
"agentModels": {
|
|
1285
1286
|
"Explore": ["anthropic/sonnet", "openai/gpt-5"]
|
|
1287
|
+
},
|
|
1288
|
+
"subagentArbiter": {
|
|
1289
|
+
"enabled": true,
|
|
1290
|
+
"model": "anthropic/claude-sonnet-4-5",
|
|
1291
|
+
"thinking": "medium",
|
|
1292
|
+
"guidePath": "~/.dreb/agent/model-routing-guide.md"
|
|
1286
1293
|
}
|
|
1287
1294
|
}
|
|
1288
1295
|
}
|
|
@@ -1292,6 +1299,8 @@ Response:
|
|
|
1292
1299
|
|
|
1293
1300
|
`trustedContextFolders` is the raw global configured list, including invalid legacy paths that are ignored fail-closed. `effectiveTrustedContextRoots` is the canonical, existing root set actually enforced after `~` expansion, native `realpath`, deduplication, and ancestor subsumption. `autoLoadNestedContext` defaults to `false`; when `true` it is global expert trust-all for every resolvable target, not a project override. Project `.dreb/settings.json` cannot affect any of these three fields.
|
|
1294
1301
|
|
|
1302
|
+
`subagentArbiter` is absent when unconfigured. It is always the global object; project `.dreb/settings.json` cannot enable, disable, or alter it.
|
|
1303
|
+
|
|
1295
1304
|
#### set_settings
|
|
1296
1305
|
|
|
1297
1306
|
Update persistent default settings. Takes a partial payload — only the supplied keys change. The whole payload is validated before anything is applied: on any invalid field, nothing changes and the response is an explicit error. Writes target the global settings file (same scope as every runtime setter).
|
|
@@ -1330,6 +1339,14 @@ Setting per-agent model fallback lists:
|
|
|
1330
1339
|
|
|
1331
1340
|
For `agentModels`, a non-empty array writes the global fallback list for that agent. An empty array removes the global entry, so that agent uses its agent-definition default unless a project-level override exists.
|
|
1332
1341
|
|
|
1342
|
+
Replace the complete global-only Dispatch Arbiter policy (exact model is validated; explicit thinking is capability-validated):
|
|
1343
|
+
|
|
1344
|
+
```json
|
|
1345
|
+
{"type":"set_settings","settings":{"subagentArbiter":{"enabled":true,"model":"anthropic/claude-sonnet-4-5","thinking":"medium","guidePath":"~/.dreb/agent/model-routing-guide.md"}}}
|
|
1346
|
+
```
|
|
1347
|
+
|
|
1348
|
+
Set `subagentArbiter: null` to remove the global policy. Enabling requires `model`; `guidePath` defaults to the standard guide path and omitted thinking runs the arbiter call with thinking off. Runtime guide/scope validation still occurs at each spawn because the live explicit scope can change.
|
|
1349
|
+
|
|
1333
1350
|
Response is the full settings snapshot after the write (same shape as `get_settings`), plus `warnings` when the write was accepted but a project-level override shadows part of it:
|
|
1334
1351
|
|
|
1335
1352
|
```json
|
|
@@ -1406,6 +1423,7 @@ Valid keys and values:
|
|
|
1406
1423
|
| `transport` | `"sse"`, `"websocket"`, `"auto"` |
|
|
1407
1424
|
| `hideThinkingBlock` | boolean |
|
|
1408
1425
|
| `agentModels` | Plain object mapping agent names to arrays of non-empty model id strings; empty arrays remove the global entry for that agent |
|
|
1426
|
+
| `subagentArbiter` | Complete global-only object or `null`. Keys: `enabled` boolean, exact available `model`, optional valid/capability-supported `thinking`, non-empty `guidePath`. Enabling requires `model`. Unknown nested keys are rejected. |
|
|
1409
1427
|
|
|
1410
1428
|
Errors are explicit `success: false` responses (nothing is applied on any of them):
|
|
1411
1429
|
|
|
@@ -1419,6 +1437,7 @@ Errors are explicit `success: false` responses (nothing is applied on any of the
|
|
|
1419
1437
|
- Invalid trusted-root list: `trustedContextFolders must be an array of non-empty path strings` or `Invalid trustedContextFolders[0]: path must be absolute after ~ expansion` / `path must be an existing directory`
|
|
1420
1438
|
- Provider without model (or vice versa): `defaultProvider and defaultModel must be set together`
|
|
1421
1439
|
- Unavailable model: `Model not found: provider/model-id`
|
|
1440
|
+
- Invalid arbiter policy: `Enabling subagentArbiter requires an exact provider/model`, `Arbiter model not found: ...`, or a nested-key/type/thinking capability error
|
|
1422
1441
|
- Corrupt settings file: `Cannot write settings: the global settings file failed to load (fix or remove the corrupt settings.json first)` — without this guard the write would silently no-op
|
|
1423
1442
|
- Write failure (I/O error): `Failed to persist settings: ...`
|
|
1424
1443
|
|
|
@@ -1584,7 +1603,7 @@ Response:
|
|
|
1584
1603
|
|
|
1585
1604
|
| Event | Description |
|
|
1586
1605
|
|-------|-------------|
|
|
1587
|
-
| `agent_start` | Agent begins processing |
|
|
1606
|
+
| `agent_start` | Agent begins processing (resolved model and effective thinking level) |
|
|
1588
1607
|
| `agent_end` | Agent completes (includes all generated messages) |
|
|
1589
1608
|
| `turn_start` | New turn begins |
|
|
1590
1609
|
| `turn_end` | Turn completes (includes assistant message and tool results) |
|
|
@@ -1601,7 +1620,7 @@ Response:
|
|
|
1601
1620
|
| `auto_retry_start` | Auto-retry begins (after transient error) |
|
|
1602
1621
|
| `auto_retry_end` | Auto-retry completes (success or final failure) |
|
|
1603
1622
|
| `background_agent_start` | Background subagent launched (includes `sessionDir`) |
|
|
1604
|
-
| `background_agent_end` | Background subagent finished (
|
|
1623
|
+
| `background_agent_end` | Background subagent finished (canonical model/thinking, per-step chain metadata, and `sessionFile` when known) |
|
|
1605
1624
|
| `background_agent_event` | Relayed event from a background subagent's own stream |
|
|
1606
1625
|
| `parent_paused_for_background_agents` | Parent paused waiting on background agents |
|
|
1607
1626
|
| `session_name_changed` | Session display name changed (manual rename, extension rename, or auto-title) |
|
|
@@ -1615,10 +1634,10 @@ rather than validating against a closed list; new event types may be added.
|
|
|
1615
1634
|
|
|
1616
1635
|
### agent_start
|
|
1617
1636
|
|
|
1618
|
-
Emitted when the agent begins processing a prompt. Includes the resolved model.
|
|
1637
|
+
Emitted when the agent begins processing a prompt. Includes the resolved model and effective thinking level sent to the provider.
|
|
1619
1638
|
|
|
1620
1639
|
```json
|
|
1621
|
-
{"type": "agent_start", "model": {"provider": "anthropic", "id": "claude-sonnet-4-20250514"}}
|
|
1640
|
+
{"type": "agent_start", "model": {"provider": "anthropic", "id": "claude-sonnet-4-20250514"}, "thinkingLevel": "high"}
|
|
1622
1641
|
```
|
|
1623
1642
|
|
|
1624
1643
|
### agent_end
|
|
@@ -1806,9 +1825,9 @@ On final failure (max retries exceeded):
|
|
|
1806
1825
|
}
|
|
1807
1826
|
```
|
|
1808
1827
|
|
|
1809
|
-
### background_agent_start / background_agent_end / background_agent_event
|
|
1828
|
+
### background_agent_start / subagent_arbitration / background_agent_end / background_agent_event
|
|
1810
1829
|
|
|
1811
|
-
Lifecycle and live-observability events for background subagents (the `subagent` tool's background mode).
|
|
1830
|
+
Lifecycle, pre-spawn routing, and live-observability events for background subagents (the `subagent` tool's background mode).
|
|
1812
1831
|
|
|
1813
1832
|
`background_agent_start` fires at launch. `sessionDir` is the directory the child will write its session JSONL into (per-launch, known before spawn):
|
|
1814
1833
|
|
|
@@ -1822,7 +1841,22 @@ Lifecycle and live-observability events for background subagents (the `subagent`
|
|
|
1822
1841
|
}
|
|
1823
1842
|
```
|
|
1824
1843
|
|
|
1825
|
-
`
|
|
1844
|
+
When the global Dispatch Arbiter is enabled, `subagent_arbitration` fires after the requested route is made concrete and before child spawn/events. It appears for changed and unchanged successful decisions, and for failures that prevent spawn. Chain records include `step`; failures have `final: null` and bounded host-generated `errorCode`/`errorMessage`.
|
|
1845
|
+
|
|
1846
|
+
```json
|
|
1847
|
+
{
|
|
1848
|
+
"type": "subagent_arbitration",
|
|
1849
|
+
"agentId": "a1b2c3d4e5f6",
|
|
1850
|
+
"status": "success",
|
|
1851
|
+
"proposed": {"agent": "Explore", "model": "provider/frontier", "thinking": "high"},
|
|
1852
|
+
"final": {"agent": "feature-dev", "model": "provider/worker", "thinking": "medium"},
|
|
1853
|
+
"changed": ["agent", "model", "thinking"]
|
|
1854
|
+
}
|
|
1855
|
+
```
|
|
1856
|
+
|
|
1857
|
+
The event is deliberately safe and programmatic: it never contains the task, guide, conversation context, prompt, raw response, or model reasoning. The parent session persists the same fields as a non-context `custom` entry. Consumers should update displayed background-agent identity from `final.agent` before child events arrive.
|
|
1858
|
+
|
|
1859
|
+
`background_agent_end` fires after the result is delivered to the parent agent. For a single child it includes the canonical resolved `provider/model` and effective thinking level when reported; `sessionFile` is the child's session JSONL path when one was written:
|
|
1826
1860
|
|
|
1827
1861
|
```json
|
|
1828
1862
|
{
|
|
@@ -1830,10 +1864,27 @@ Lifecycle and live-observability events for background subagents (the `subagent`
|
|
|
1830
1864
|
"agentId": "a1b2c3d4e5f6",
|
|
1831
1865
|
"agentType": "Explore",
|
|
1832
1866
|
"success": true,
|
|
1867
|
+
"model": "anthropic/claude-sonnet-4-20250514",
|
|
1868
|
+
"thinking": "medium",
|
|
1833
1869
|
"sessionFile": "/home/user/.dreb/agent/subagent-sessions/a1b2c3d4e5f6/2026-07-07T12-00-00-000Z_uuid.jsonl"
|
|
1834
1870
|
}
|
|
1835
1871
|
```
|
|
1836
1872
|
|
|
1873
|
+
Chain completions omit ambiguous scalar model/thinking fields and instead include ordered per-step metadata, since steps may use different agents, providers, models, or thinking levels:
|
|
1874
|
+
|
|
1875
|
+
```json
|
|
1876
|
+
{
|
|
1877
|
+
"type": "background_agent_end",
|
|
1878
|
+
"agentId": "a1b2c3d4e5f6",
|
|
1879
|
+
"agentType": "Explore",
|
|
1880
|
+
"success": true,
|
|
1881
|
+
"steps": [
|
|
1882
|
+
{"step": 1, "agent": "Explore", "success": true, "model": "anthropic/claude-sonnet-4-6", "thinking": "low"},
|
|
1883
|
+
{"step": 2, "agent": "feature-dev", "success": true, "model": "openai/gpt-5.6-sol", "thinking": "high"}
|
|
1884
|
+
]
|
|
1885
|
+
}
|
|
1886
|
+
```
|
|
1887
|
+
|
|
1837
1888
|
`background_agent_event` relays every JSONL event the child process emits (the same event union documented here, plus the initial session header), verbatim, tagged with the child's `agentId`. This is the live-transcript transport for observers like the dashboard — no session-file tailing needed. Streaming children emit `message_update` deltas at high frequency; consumers that fan events out further (e.g. over a network) should batch or throttle:
|
|
1838
1889
|
|
|
1839
1890
|
```json
|
package/docs/session.md
CHANGED
|
@@ -261,7 +261,13 @@ Extension state persistence. Does NOT participate in LLM context.
|
|
|
261
261
|
{"type":"custom","id":"h8i9j0k1","parentId":"g7h8i9j0","timestamp":"2024-12-03T14:20:00.000Z","customType":"my-extension","data":{"count":42}}
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
Use `customType` to identify your extension's entries on reload.
|
|
264
|
+
Use `customType` to identify your extension's entries on reload. Core host features can use the same non-context channel. When the Dispatch Arbiter is enabled, every attempted pre-spawn decision is stored as `customType: "subagent_arbitration"` with only safe host-validated metadata:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{"type":"custom","customType":"subagent_arbitration","data":{"type":"subagent_arbitration","agentId":"a1b2c3","status":"success","proposed":{"agent":"Explore","model":"provider/frontier","thinking":"high"},"final":{"agent":"feature-dev","model":"provider/worker","thinking":"medium"},"changed":["agent","model","thinking"]}}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Failure records have `final: null` plus bounded host-generated `errorCode`/`errorMessage`; chain records include `step`. Arbiter prompts, raw responses, and reasoning are never stored. Because this is `custom`, replay/build-context skips it and neither the parent nor child model receives the record.
|
|
265
271
|
|
|
266
272
|
### CustomMessageEntry
|
|
267
273
|
|
package/docs/settings.md
CHANGED
|
@@ -224,6 +224,38 @@ Set `parentTurnGuardrail` to `false` to let the parent keep running with no turn
|
|
|
224
224
|
}
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
### Dispatch Arbiter
|
|
228
|
+
|
|
229
|
+
The optional Dispatch Arbiter is a fully headless, tool-less model call in the subagent control path. It is disabled by default and can be configured **only** in global `~/.dreb/agent/settings.json` (or the global RPC settings API). A project `.dreb/settings.json` cannot enable, disable, or reconfigure it.
|
|
230
|
+
|
|
231
|
+
| Setting | Type | Default | Description |
|
|
232
|
+
|---------|------|---------|-------------|
|
|
233
|
+
| `subagentArbiter.enabled` | boolean | `false` | Run fail-closed arbitration before every actual child spawn |
|
|
234
|
+
| `subagentArbiter.model` | string | - | Required when enabled; exact canonical `provider/model` used for the direct arbiter call |
|
|
235
|
+
| `subagentArbiter.thinking` | string | `off` | Optional arbiter-call thinking: `off`, `minimal`, `low`, `medium`, `high`, or `xhigh`; explicit values are capability-validated |
|
|
236
|
+
| `subagentArbiter.guidePath` | string | `~/.dreb/agent/model-routing-guide.md` | Routing guide generated by `/skill:model-routing-guide`; `~` expands normally and relative paths resolve against the child cwd |
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"subagentArbiter": {
|
|
241
|
+
"enabled": true,
|
|
242
|
+
"model": "provider/router-model",
|
|
243
|
+
"thinking": "medium",
|
|
244
|
+
"guidePath": "~/.dreb/agent/model-routing-guide.md"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
First-class controls are available in both interactive `/settings` and the web dashboard Settings screen. Each exposes enable/disable, an authenticated exact-model picker, thinking level, and guide path. The TUI validates current live scope and guide coverage before accepting enablement; the dashboard prevents model-less enablement, validates model/thinking through RPC, shows readiness guidance, and the runtime still revalidates live scope/guide before every dispatch. Validation errors are loud and do not silently persist an unusable enabled policy.
|
|
250
|
+
|
|
251
|
+
Enabling also requires a non-empty **live explicit session model scope** from `--models` or `enabledModels`, plus a schema-valid guide whose canonical covered IDs and `## Model:` sections exactly match that live scope. The research skill cannot discover runtime `--models`; generate its guide with matching explicit skill arguments when needed.
|
|
252
|
+
|
|
253
|
+
For each single child, parallel item, and post-substitution chain step, the arbiter may return only an existing agent name, an exact model in the live scope, and a thinking level supported by that model. Missing/invalid settings, auth, guide, scope, timeout/provider errors, malformed output, unknown agents, out-of-scope models, and unsupported thinking all stop the affected spawn. There is no fallback to the proposed route or parent model after arbitration is enabled.
|
|
254
|
+
|
|
255
|
+
The arbiter receives the immutable child task/cwd, proposed route, available agent names/descriptions/effective tools/model defaults, validated guide, canonical live candidates, bounded first/latest user intent and recent labeled parent activity—including bounded tool outputs—parent model/session title, repository/cwd/branch/dirty-count metadata, and lineage identifiers where available. Following the title setter's rolling-context pattern, ordinary file contents, diffs, command output, and other useful tool-result content are intentional routing context rather than a separate security boundary; the package receives the existing secret scrubbing before inference. The arbiter itself receives no tools. Guide files are capped at 128 KiB; the complete serialized package is capped at 180,000 characters. Individual intent/description/activity fields also have fixed bounds. Required task/guide/scope/agent data is never silently truncated—exceeding the package cap stops inference. The real child's task and cwd are not modified by scrubbing or arbitration.
|
|
256
|
+
|
|
257
|
+
Only host-validated decision metadata is persisted/emitted. Raw arbiter prompts, responses, and reasoning never enter the parent transcript, child context, session history, JSON/RPC events, or dashboard. See [Agent Model Settings](agent-models.md#dispatch-arbiter).
|
|
258
|
+
|
|
227
259
|
### Message Delivery
|
|
228
260
|
|
|
229
261
|
| Setting | Type | Default | Description |
|
|
@@ -385,7 +417,7 @@ See [packages.md](packages.md) for package management details.
|
|
|
385
417
|
|
|
386
418
|
## Project Overrides
|
|
387
419
|
|
|
388
|
-
Project settings (`.dreb/settings.json`) override global settings. Nested objects are merged. **
|
|
420
|
+
Project settings (`.dreb/settings.json`) override global settings. Nested objects are merged. **Exceptions:** `context.trustedFolders`, `context.autoLoadNested`, and the complete `subagentArbiter` policy are global-only security/control-path settings. Project settings cannot add, replace, override, enable, or disable them. Nested context from the initial startup upward scan remains separate from the lazy-load policy.
|
|
389
421
|
|
|
390
422
|
```json
|
|
391
423
|
// ~/.dreb/agent/settings.json (global)
|
package/docs/skills.md
CHANGED
|
@@ -285,11 +285,49 @@ dreb ships with **mach6**, a development workflow that orchestrates the full iss
|
|
|
285
285
|
| `mach6-review` | Explicitly user-triggered multi-agent review with scope-aware independent assessment |
|
|
286
286
|
| `mach6-implement` | Implement plans, fix review findings, or fix CI failures |
|
|
287
287
|
| `mach6-publish` | Pre-merge checks, docs update, merge, tag, release |
|
|
288
|
+
| `model-routing-guide` | Research scoped models and sanitized local subagent evidence into a validated routing guide |
|
|
288
289
|
|
|
289
290
|
Built-in skills are always available and can be overridden by placing a skill with the same name in any [user or project location](#locations). `mach6-review` is model-invocable when the user directly asks an agent to run it, as well as user-invocable through its slash command. Agents must never start formal review autonomously; implementation must first be committed and pushed.
|
|
290
291
|
|
|
291
292
|
See [docs/mach6.md](mach6.md) for full documentation.
|
|
292
293
|
|
|
294
|
+
### model-routing-guide
|
|
295
|
+
|
|
296
|
+
`model-routing-guide` is an explicit, potentially expensive research workflow with exactly two supported scope sources.
|
|
297
|
+
|
|
298
|
+
Pass comma-separated model patterns directly to make them authoritative:
|
|
299
|
+
|
|
300
|
+
```text
|
|
301
|
+
/skill:model-routing-guide anthropic/claude-*,openai/gpt-5.6-sol
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Or invoke it without arguments to use the effective non-empty `enabledModels` array:
|
|
305
|
+
|
|
306
|
+
```text
|
|
307
|
+
/skill:model-routing-guide
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
When model scope rotates, update the existing guide incrementally instead of regenerating every retained entry:
|
|
311
|
+
|
|
312
|
+
```text
|
|
313
|
+
/skill:model-routing-guide update
|
|
314
|
+
/skill:model-routing-guide update anthropic/claude-*,openai/gpt-5.6-sol
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
`update` must be the first argument. The skill validates the existing guide against its own coverage, diffs that coverage against the newly resolved authoritative scope, preserves retained model sections, removes unscoped sections and summary references, and researches only newly added canonical models. It refreshes scope/local-evidence metadata and performs the same complete final validation before atomically replacing the guide. A missing or malformed existing guide fails loudly and requires normal generation.
|
|
318
|
+
|
|
319
|
+
Model-pattern arguments after the optional `update` keyword take precedence over `enabledModels`; the skill selects one source and does not search for any other runtime or session scope. Because this Stage 1 workflow is implemented only as a skill, it cannot discover the current session's `--models` value or later in-session scope changes. To research that runtime scope, pass the same comma-separated patterns as skill arguments.
|
|
320
|
+
|
|
321
|
+
The skill refuses missing/empty and effectively all-model scopes. It obtains available candidates with `dreb --list-models`, resolves the selected patterns to canonical provider/model IDs, snapshots existing files under `~/.dreb/agent/subagent-sessions/`, and combines sanitized aggregate local observations with official documentation, model cards, benchmarks, issue trackers, forums, and practitioner reports. Existing unreadable or malformed child logs fail the run; a genuinely empty history is labeled cold-start.
|
|
322
|
+
|
|
323
|
+
The generated `~/.dreb/agent/model-routing-guide.md` is human-readable Markdown with schema-versioned YAML frontmatter and one validated section per canonical candidate. Evidence is labeled as vendor claims, measured benchmarks, community reports, or local observations, with dates, confidence, sample counts, contrary findings, and explicit unknowns. The workflow prohibits copied prompts, outputs, tool arguments, secrets, paths, and identifying project details.
|
|
324
|
+
|
|
325
|
+
Semantic local-evidence assessment uses normal dreb tools, so inspected session content is processed by the active research model's configured provider. The persisted guide is sanitized and generalized, but invoking the skill is still a decision to send the inspected evidence to that provider.
|
|
326
|
+
|
|
327
|
+
Its primary routing safeguards are practical: `Explore` is for factual collection and navigation, not planning or implementation; routine lookup, extraction, repetitive file inspection, and straightforward summarization should use the least expensive scoped model demonstrated adequate by the evidence.
|
|
328
|
+
|
|
329
|
+
The optional global-only [Dispatch Arbiter](agent-models.md#dispatch-arbiter) now consumes this file before every subagent spawn. Its live scope is the current session's exact explicit candidate set, so guide frontmatter and model headings must match that set exactly. A guide generated from `enabledModels` will work when the session uses the same resolved scope; for runtime `--models`, pass those patterns to the skill. Missing/stale/malformed guide coverage fails the child launch rather than bypassing arbitration.
|
|
330
|
+
|
|
293
331
|
## Skill Repositories
|
|
294
332
|
|
|
295
333
|
- [Anthropic Skills](https://github.com/anthropics/skills) - Document processing (docx, pdf, pptx, xlsx), web development
|
package/package.json
CHANGED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: model-routing-guide
|
|
3
|
+
description: Research model patterns passed as skill arguments, or enabledModels when no arguments are supplied, and generate or update an evidence-based subagent routing guide. This is a user-triggered, potentially expensive workflow.
|
|
4
|
+
argument-hint: "[update] [comma-separated model patterns]"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# model-routing-guide — Generate or Update the Subagent Routing Guide
|
|
10
|
+
|
|
11
|
+
**Mode and explicit model patterns, when supplied:** $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
Generate, replace, or incrementally update `~/.dreb/agent/model-routing-guide.md`. This is a deep research workflow, not a quick opinion. Use normal dreb tools (`read`, `bash`, `find`, `grep`, `web_search`, `web_fetch`, and the Reddit reader when applicable); no special runtime support is required.
|
|
14
|
+
|
|
15
|
+
The optional first argument `update` selects UPDATE mode. Remove that keyword before parsing model patterns. Without it, use GENERATE mode. The candidate scope still has exactly two supported sources: non-empty model-pattern arguments after the optional mode keyword, or the effective non-empty `enabledModels` setting when no model patterns were supplied. Once one source is selected, it is authoritative. Do not search for a separate runtime, session, or "scoped models" value.
|
|
16
|
+
|
|
17
|
+
## Non-negotiable routing goals
|
|
18
|
+
|
|
19
|
+
The guide must help a later dispatcher make two especially important corrections:
|
|
20
|
+
|
|
21
|
+
1. **Agent-role fit:** `Explore` is for factual collection, codebase navigation, file discovery, web research, and answering bounded questions. Planning, architecture ownership, implementation, editing, and feature development are not Explore work. Explicitly call out examples such as a planning workflow delegating its plan to Explore, or a feature-development task being sent to Explore.
|
|
22
|
+
2. **Capability/cost fit:** routine fact checks, repetitive inspection of many mundane files, lookup, extraction, and straightforward summarization should use the least expensive/lowest-latency selected candidate that the evidence shows is adequate. Reserve frontier or strongest-tier models for tasks whose complexity, ambiguity, risk, or demonstrated failure rate justifies them.
|
|
23
|
+
|
|
24
|
+
Do not turn the guide into a generalized policy engine. Research the selected canonical provider/model candidates and give practical recommendations for the existing dreb agent roles.
|
|
25
|
+
|
|
26
|
+
## Step 1: Select the mode and one authoritative scope source
|
|
27
|
+
|
|
28
|
+
First parse the invocation mode:
|
|
29
|
+
|
|
30
|
+
- If the first whitespace-delimited argument is exactly `update` (case-insensitive), select UPDATE mode and remove only that keyword from the argument text.
|
|
31
|
+
- Otherwise select GENERATE mode and leave the argument text unchanged.
|
|
32
|
+
- UPDATE is a mode keyword, never a model pattern. An `update` token anywhere except first position is ordinary pattern text and should fail normally if unresolved.
|
|
33
|
+
|
|
34
|
+
There are exactly two supported scope sources. Apply these rules in order, choose one source, and then stop looking for scope:
|
|
35
|
+
|
|
36
|
+
1. Read the model-pattern argument text remaining after optional mode parsing.
|
|
37
|
+
- If it is non-empty after trimming, split it as a comma-separated model-pattern list.
|
|
38
|
+
- That argument list is the complete authoritative scope. Do not read `enabledModels` and do not search session state for another scope.
|
|
39
|
+
2. Only when the skill arguments are empty, read the effective `enabledModels` value from the normal settings files:
|
|
40
|
+
- Start with `enabledModels` from `~/.dreb/agent/settings.json`, when present.
|
|
41
|
+
- If `.dreb/settings.json` in the current working directory explicitly defines `enabledModels`, that project array replaces the global array; if it does not define the key, retain the global array.
|
|
42
|
+
- A non-empty effective `enabledModels` array is the complete authoritative scope. Stop looking for scope as soon as it is found.
|
|
43
|
+
3. This skill-only workflow does **not** receive the current session's runtime `--models` value or later in-session scope changes. Never try to discover them from session logs, process state, the current model, or another file. If the user wants the runtime `--models` scope, they must pass the same comma-separated patterns as skill arguments.
|
|
44
|
+
4. Do not infer scope from the current model, agent-definition defaults, all authenticated models, `agentModels.models`, or subagent session history.
|
|
45
|
+
5. If neither source provides a non-empty pattern list, **stop with an actionable error before researching or writing a guide**. Tell the user to pass skill arguments or configure `enabledModels`.
|
|
46
|
+
6. Run `dreb --list-models` to obtain the complete available-model listing. If the command fails or returns no usable listing, stop loudly.
|
|
47
|
+
7. Resolve every selected pattern against that listing using the same normal model-pattern semantics as `--models`, including case-insensitive canonical/exact matching, fuzzy single-model matching, and globs. Preserve provider identity: the same upstream model through two providers is two candidates.
|
|
48
|
+
8. Fail loudly and name every selected pattern that resolves to no available candidate.
|
|
49
|
+
9. Compare the resolved candidate set with the complete `dreb --list-models` set. If they are equal, or the selected patterns otherwise amount to unbounded all-model research (for example a bare `*`), **refuse and ask the user for a narrower scope**.
|
|
50
|
+
|
|
51
|
+
Keep the canonical candidate list. It is the coverage checklist for every later step. From this point onward, "selected candidates" means only that list; it never means an undiscovered runtime/session scope.
|
|
52
|
+
|
|
53
|
+
## Step 2: In UPDATE mode, validate and diff the existing guide
|
|
54
|
+
|
|
55
|
+
Skip this step in GENERATE mode.
|
|
56
|
+
|
|
57
|
+
1. Require `~/.dreb/agent/model-routing-guide.md` to exist and be readable. If it is absent, stop before research or writes and tell the user to rerun without `update` for initial generation.
|
|
58
|
+
2. Read the existing guide once. Parse its YAML frontmatter and model sections using the same contract described in Steps 5 and 6, but validate its internal coverage against its own `covered_model_ids`, not the newly selected scope. Require schema version 1, unique canonical covered IDs, exactly one complete model section per covered ID, the root heading, and routing safeguards. A stale but internally valid scope is expected; malformed content is not. Stop loudly rather than trying to salvage malformed Markdown.
|
|
59
|
+
3. Diff the selected canonical candidates against existing `covered_model_ids` and report three deterministic canonical-ID lists:
|
|
60
|
+
- **retained** — present in both;
|
|
61
|
+
- **removed** — present only in the existing guide;
|
|
62
|
+
- **added** — present only in the selected scope.
|
|
63
|
+
4. Preserve retained model sections and their sourced external findings instead of rebuilding them. Remove every removed model section and any removed-model row or claim in cross-model summaries. Fully research every added canonical provider/model in Step 4 and add exactly one complete section for it.
|
|
64
|
+
5. Refresh the scope/methodology summary, routing table, frontmatter timestamp and coverage, and local-evidence metadata/aggregates for the current evidence snapshot. Do not silently relabel old external retrieval dates as current; update a source date only when that source was actually revisited. If new local or contrary evidence materially changes a retained model's recommendation, amend that section while keeping unaffected sourced material.
|
|
65
|
+
6. If the diff is empty, still run the evidence snapshot and full validation. Preserve the existing guide unless refreshed local evidence or metadata requires a change; do not perform full external re-research merely because UPDATE mode was requested.
|
|
66
|
+
|
|
67
|
+
Never write the partially updated guide before all added-model research and final validation are complete. Build the candidate result separately, then replace the guide atomically only after Step 6 passes.
|
|
68
|
+
|
|
69
|
+
## Step 3: Snapshot and validate local subagent evidence
|
|
70
|
+
|
|
71
|
+
Before launching any research subagent or doing work that may create child sessions, snapshot the existing `*.jsonl` files under `~/.dreb/agent/subagent-sessions/`. Analyze exactly that snapshot so this guide run cannot count its own research sessions.
|
|
72
|
+
|
|
73
|
+
- If the directory does not exist or contains no session JSONL files, enter explicit **cold-start mode** and continue with external evidence.
|
|
74
|
+
- If files exist, every snapshotted file is required evidence. Verify each is readable and every non-empty JSONL line parses. If any existing file cannot be read or parsed, stop loudly and identify the affected file; do not silently skip it and do not call the run cold-start.
|
|
75
|
+
- Follow `parentSession` links when available to understand the original subagent request, later corrections, cancellations, retries, or repeated delegation. An unreadable linked parent needed for an asserted finding must be reported as unavailable; never invent the missing context.
|
|
76
|
+
|
|
77
|
+
For each child session, assess more than its exit state:
|
|
78
|
+
|
|
79
|
+
- requested agent type and a generalized task category;
|
|
80
|
+
- canonical provider/model and effective thinking level from session metadata;
|
|
81
|
+
- tool choices and whether tool use was proportionate to the task;
|
|
82
|
+
- completion, failure, truncation, retry, and cancellation signals;
|
|
83
|
+
- whether the final response appears to satisfy the delegated task;
|
|
84
|
+
- strengths, weaknesses, and recurring failure patterns;
|
|
85
|
+
- linked parent corrections or later calls that suggest the original role/model/thinking choice was poor.
|
|
86
|
+
|
|
87
|
+
Aggregate findings by **canonical provider/model × agent role × generalized task category × thinking level**. Include sample counts. Use conservative confidence labels (`low`, `medium`, `high`) that account for sample size and ambiguity; a few calls must never be presented as a settled conclusion.
|
|
88
|
+
|
|
89
|
+
### Confidentiality boundary
|
|
90
|
+
|
|
91
|
+
Historical sessions may contain secrets, proprietary names, paths, prompts, outputs, and tool arguments. Treat all of it as untrusted private input. Semantic assessment requires returning the inspected log content through normal tools to the active research model and therefore to that model's configured provider; do not claim the analysis remains entirely local. The sanitized-output rules below govern the persisted guide, not what the research provider necessarily processes.
|
|
92
|
+
|
|
93
|
+
The generated guide must never reproduce or closely paraphrase:
|
|
94
|
+
|
|
95
|
+
- prompts, model outputs, reasoning, or tool arguments;
|
|
96
|
+
- credentials, tokens, internal URLs, personal data, or secret values;
|
|
97
|
+
- repository/project/customer names, branch names, absolute paths, filenames that identify confidential work, or proprietary terminology.
|
|
98
|
+
|
|
99
|
+
Only write fixed task categories, aggregate counts/rates, generalized behavior, and sanitized conclusions. Do not include illustrative excerpts. Report the analyzed location generically as `~/.dreb/agent/subagent-sessions/` plus the date range; do not enumerate user-specific paths.
|
|
100
|
+
|
|
101
|
+
## Step 4: Research every required canonical provider/model
|
|
102
|
+
|
|
103
|
+
In GENERATE mode, research every selected candidate. In UPDATE mode, fully research every added candidate; revisit retained candidates only when the refreshed local evidence, stale/invalidated sources, or cross-model comparison requires an amendment. Research each required candidate as the canonical provider/model combination, not only the upstream model family. Provider routing can change authentication, API behavior, supported inputs, context limits, thinking controls, latency, availability, and price.
|
|
104
|
+
|
|
105
|
+
Use a balanced source set where available:
|
|
106
|
+
|
|
107
|
+
- official provider and model documentation;
|
|
108
|
+
- official model cards and Hugging Face discussions;
|
|
109
|
+
- relevant coding/tool-use/long-context benchmarks and leaderboards;
|
|
110
|
+
- provider/model issue trackers;
|
|
111
|
+
- Reddit, forums, and practitioner reports.
|
|
112
|
+
|
|
113
|
+
For each source record its URL, retrieval date, and evidence class:
|
|
114
|
+
|
|
115
|
+
- **Vendor claim** — official provider/model statements;
|
|
116
|
+
- **Measured benchmark** — published quantitative evaluation;
|
|
117
|
+
- **Community report** — practitioner experience or issue discussion;
|
|
118
|
+
- **Local observation** — sanitized aggregate from Step 3.
|
|
119
|
+
|
|
120
|
+
Research coding, exploration, review, planning, tool use, instruction following, long-context behavior, vision, latency, cost, and supported thinking levels. Record contrary evidence and unknowns. Do not fill a required field with a guess: write `Unknown` and lower confidence when reliable evidence is absent.
|
|
121
|
+
|
|
122
|
+
Reconcile external and local evidence explicitly. If they disagree, preserve the disagreement and explain the likely limits (sample size, provider differences, workload mismatch, version drift) rather than choosing the more flattering result.
|
|
123
|
+
|
|
124
|
+
## Step 5: Write the guide
|
|
125
|
+
|
|
126
|
+
In GENERATE mode, write a complete new guide. In UPDATE mode, assemble the validated retained sections plus researched additions, remove stale scope references everywhere, and atomically replace the old file only after the complete candidate passes Step 6.
|
|
127
|
+
|
|
128
|
+
Write `~/.dreb/agent/model-routing-guide.md` as human-readable Markdown with this stable YAML frontmatter shape:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
---
|
|
132
|
+
schema_version: 1
|
|
133
|
+
generated_at: "YYYY-MM-DDTHH:MM:SSZ"
|
|
134
|
+
covered_model_ids:
|
|
135
|
+
- "provider/model-id"
|
|
136
|
+
local_evidence: "available" # or "cold-start"
|
|
137
|
+
analyzed_session_directories:
|
|
138
|
+
- "~/.dreb/agent/subagent-sessions/"
|
|
139
|
+
session_date_range:
|
|
140
|
+
start: "YYYY-MM-DD" # null in cold-start mode
|
|
141
|
+
end: "YYYY-MM-DD" # null in cold-start mode
|
|
142
|
+
---
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
After frontmatter include:
|
|
146
|
+
|
|
147
|
+
1. `# Model Routing Guide`
|
|
148
|
+
2. A scope/methodology summary and explicit cold-start warning when applicable.
|
|
149
|
+
3. `## Routing safeguards` containing the two non-negotiable routing goals above.
|
|
150
|
+
4. A compact cross-model routing table for dreb's available agent roles and common task categories.
|
|
151
|
+
5. Exactly one `## Model: provider/model-id` section for every canonical candidate, using these required subsections:
|
|
152
|
+
- `### Capabilities and thinking support`
|
|
153
|
+
- `### Strengths`
|
|
154
|
+
- `### Weaknesses and failure modes`
|
|
155
|
+
- `### Recommended roles and tasks`
|
|
156
|
+
- `### Discouraged roles and tasks`
|
|
157
|
+
- `### Tool use, long context, and vision`
|
|
158
|
+
- `### Latency and cost`
|
|
159
|
+
- `### Local evidence`
|
|
160
|
+
- `### External evidence and contrary findings`
|
|
161
|
+
- `### Confidence and limitations`
|
|
162
|
+
- `### Sources`
|
|
163
|
+
|
|
164
|
+
Every factual external claim needs a dated URL and evidence-class label. Every local claim needs its aggregation dimensions, sample count, and confidence without identifying session content.
|
|
165
|
+
|
|
166
|
+
## Step 6: Validate before reporting success
|
|
167
|
+
|
|
168
|
+
Re-read the completed guide and perform a final validation. Do not merely eyeball it.
|
|
169
|
+
|
|
170
|
+
1. Parse the YAML frontmatter and require `schema_version: 1`, a valid generation timestamp, valid local-evidence mode, and the documented session fields.
|
|
171
|
+
2. Compare sets exactly:
|
|
172
|
+
- resolved canonical candidates;
|
|
173
|
+
- `covered_model_ids`;
|
|
174
|
+
- canonical IDs in `## Model:` headings.
|
|
175
|
+
They must be identical with no duplicates, missing entries, or extras.
|
|
176
|
+
3. Check every model section contains every required subsection.
|
|
177
|
+
4. Check each model records thinking support, strengths, weaknesses/failure modes, recommended and discouraged roles, latency/cost, confidence, contrary evidence, and dated sources; `Unknown` is valid, omission is not.
|
|
178
|
+
5. Check local-evidence sections contain sample counts/confidence when history exists, or explicitly say cold-start when it does not.
|
|
179
|
+
6. Scan for accidental copied prompts/outputs, secrets, absolute paths, project names, or other identifying session material and remove it.
|
|
180
|
+
7. If any validation fails, fix the guide and rerun validation. If it still cannot pass, fail loudly and list the unmet checks instead of claiming generation succeeded.
|
|
181
|
+
|
|
182
|
+
On success, report the guide path, canonical covered models, local-evidence mode/date range, and validation result. Do not paste the full guide into the conversation.
|