opencode-model-router 1.0.0 → 1.0.2
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 +28 -4
- package/package.json +1 -1
- package/src/index.ts +19 -0
- package/tiers.json +5 -6
package/README.md
CHANGED
|
@@ -14,9 +14,33 @@ The plugin injects a **delegation protocol** into the system prompt that teaches
|
|
|
14
14
|
|
|
15
15
|
The agent automatically delegates via the Task tool when it recognizes the task complexity, or when plan steps are annotated with `[tier:fast]`, `[tier:medium]`, or `[tier:heavy]` tags.
|
|
16
16
|
|
|
17
|
+
This applies both to plan-driven execution and direct ad-hoc requests. For every new user message, the orchestrator performs an intent gate, splits multi-task requests into atomic units, and routes each unit to `@fast`, `@medium`, or `@heavy`.
|
|
18
|
+
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
19
|
-
### Option A:
|
|
21
|
+
### Option A: npm package (recommended)
|
|
22
|
+
|
|
23
|
+
Add the plugin package in your `opencode.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"plugin": [
|
|
28
|
+
"opencode-model-router@1.0.0"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If you prefer always getting the latest release, use:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"plugin": [
|
|
38
|
+
"opencode-model-router"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Option B: Local plugin clone
|
|
20
44
|
|
|
21
45
|
Clone directly into your OpenCode plugins directory:
|
|
22
46
|
|
|
@@ -35,7 +59,7 @@ Then add it to your `opencode.json`:
|
|
|
35
59
|
}
|
|
36
60
|
```
|
|
37
61
|
|
|
38
|
-
### Option
|
|
62
|
+
### Option C: Reference from anywhere
|
|
39
63
|
|
|
40
64
|
Clone wherever you want:
|
|
41
65
|
|
|
@@ -74,8 +98,8 @@ The plugin ships with two presets:
|
|
|
74
98
|
| Tier | Model | Notes |
|
|
75
99
|
|------|-------|-------|
|
|
76
100
|
| fast | `openai/gpt-5.3-codex-spark` | Cheapest, fastest |
|
|
77
|
-
| medium | `openai/
|
|
78
|
-
| heavy | `openai/
|
|
101
|
+
| medium | `openai/gpt-5.3-codex` | Default settings (no variant/reasoning override) |
|
|
102
|
+
| heavy | `openai/gpt-5.3-codex` | Variant: `xhigh` |
|
|
79
103
|
|
|
80
104
|
Switch presets with the `/preset` command:
|
|
81
105
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -112,6 +112,21 @@ function buildDelegationProtocol(cfg: RouterConfig): string {
|
|
|
112
112
|
|
|
113
113
|
const rules = cfg.rules.map((r, i) => `${i + 1}. ${r}`).join("\n");
|
|
114
114
|
|
|
115
|
+
const directRoutingRules = [
|
|
116
|
+
"Run an Intent Gate for every new user message, even without a plan file.",
|
|
117
|
+
"If the message contains multiple asks, split it into atomic tasks before routing.",
|
|
118
|
+
"Route read-only exploration/search tasks to @fast.",
|
|
119
|
+
"Route implementation/edit/test/refactor tasks to @medium.",
|
|
120
|
+
"Route architecture/security/performance/complex debugging tasks to @heavy.",
|
|
121
|
+
"If a request mixes tiers, delegate each subtask to the right tier and then synthesize one final response.",
|
|
122
|
+
"If a task is trivial (single grep/read), execute directly instead of delegating.",
|
|
123
|
+
"When uncertain, default to the configured default tier unless user constraints clearly require another tier.",
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
const directRoutingList = directRoutingRules
|
|
127
|
+
.map((rule, index) => `${index + 1}. ${rule}`)
|
|
128
|
+
.join("\n");
|
|
129
|
+
|
|
115
130
|
return [
|
|
116
131
|
"## Model Delegation Protocol",
|
|
117
132
|
"",
|
|
@@ -128,6 +143,10 @@ function buildDelegationProtocol(cfg: RouterConfig): string {
|
|
|
128
143
|
"### Rules:",
|
|
129
144
|
rules,
|
|
130
145
|
"",
|
|
146
|
+
"### Direct Request Routing (No Plan Required):",
|
|
147
|
+
"These rules also apply to ad-hoc user requests, not only PLAN.md execution.",
|
|
148
|
+
directRoutingList,
|
|
149
|
+
"",
|
|
131
150
|
"### How to delegate:",
|
|
132
151
|
"Use the Task tool with the tier name as `subagent_type`:",
|
|
133
152
|
'- `Task(subagent_type="fast", prompt="Find all files importing AuthContext")`',
|
package/tiers.json
CHANGED
|
@@ -55,9 +55,8 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"medium": {
|
|
58
|
-
"model": "openai/
|
|
59
|
-
"
|
|
60
|
-
"description": "o3 medium reasoning for implementation and standard coding",
|
|
58
|
+
"model": "openai/gpt-5.3-codex",
|
|
59
|
+
"description": "GPT-5.3 Codex default settings for implementation and standard coding",
|
|
61
60
|
"steps": 50,
|
|
62
61
|
"prompt": "You are an implementation agent. Write clean, production-quality code matching existing project patterns. Run linters/tests after changes when possible.",
|
|
63
62
|
"whenToUse": [
|
|
@@ -68,9 +67,9 @@
|
|
|
68
67
|
]
|
|
69
68
|
},
|
|
70
69
|
"heavy": {
|
|
71
|
-
"model": "openai/
|
|
72
|
-
"
|
|
73
|
-
"description": "
|
|
70
|
+
"model": "openai/gpt-5.3-codex",
|
|
71
|
+
"variant": "xhigh",
|
|
72
|
+
"description": "GPT-5.3 Codex xhigh for architecture and complex tasks",
|
|
74
73
|
"steps": 30,
|
|
75
74
|
"prompt": "You are a senior architecture consultant. Analyze deeply, consider tradeoffs, and provide thorough reasoning.",
|
|
76
75
|
"whenToUse": [
|