gsd-opencode 1.9.1 → 1.9.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/agents/gsd-set-model.md +287 -0
- package/agents/gsd-set-profile.md +239 -0
- package/agents/gsd-settings.md +303 -0
- package/bin/install.js +81 -1
- package/command/gsd/new-project.md +68 -3
- package/command/gsd/set-model.md +77 -0
- package/command/gsd/set-profile.md +16 -81
- package/command/gsd/settings.md +14 -117
- package/get-shit-done/references/model-profiles.md +67 -36
- package/package.json +1 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gsd-set-model
|
|
3
|
+
description: Configure models for a specific profile's stages
|
|
4
|
+
tools:
|
|
5
|
+
read: true
|
|
6
|
+
write: true
|
|
7
|
+
bash: true
|
|
8
|
+
question: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<role>
|
|
12
|
+
You are executing the `/gsd-set-model` command. Configure the models assigned to each stage (planning, execution, verification) for a specific profile preset.
|
|
13
|
+
|
|
14
|
+
This command reads/writes two files:
|
|
15
|
+
- `.planning/config.json` — profile state (active_profile, presets, custom_overrides)
|
|
16
|
+
- `opencode.json` — agent model assignments (OpenCode's native config)
|
|
17
|
+
|
|
18
|
+
Do NOT modify agent .md files. This command updates profile presets, not overrides.
|
|
19
|
+
</role>
|
|
20
|
+
|
|
21
|
+
<context>
|
|
22
|
+
**Invocation styles:**
|
|
23
|
+
|
|
24
|
+
1. No args (interactive): `/gsd-set-model`
|
|
25
|
+
2. Positional: `/gsd-set-model quality` or `balanced` or `budget`
|
|
26
|
+
|
|
27
|
+
**Stage-to-agent mapping (11 agents):**
|
|
28
|
+
|
|
29
|
+
| Stage | Agents |
|
|
30
|
+
|--------------|--------|
|
|
31
|
+
| Planning | gsd-planner, gsd-plan-checker, gsd-phase-researcher, gsd-roadmapper, gsd-project-researcher, gsd-research-synthesizer, gsd-codebase-mapper |
|
|
32
|
+
| Execution | gsd-executor, gsd-debugger |
|
|
33
|
+
| Verification | gsd-verifier, gsd-integration-checker, gsd-set-profile, gsd-settings, gsd-set-model |
|
|
34
|
+
|
|
35
|
+
**Profile presets:** Stored in `.planning/config.json` under `profiles.presets.{profile}`. Each profile has three keys: `planning`, `execution`, `verification`.
|
|
36
|
+
</context>
|
|
37
|
+
|
|
38
|
+
<behavior>
|
|
39
|
+
|
|
40
|
+
## Step 1: Read config file
|
|
41
|
+
|
|
42
|
+
Read `.planning/config.json`. Handle these cases:
|
|
43
|
+
|
|
44
|
+
**Case A: File missing or no `.planning/` directory**
|
|
45
|
+
- Print: `Error: No GSD project found. Run /gsd-new-project first.`
|
|
46
|
+
- Stop.
|
|
47
|
+
|
|
48
|
+
**Case B: File exists but no `profiles.presets` key**
|
|
49
|
+
- Print: `Error: No model presets configured. Run /gsd-settings first to initialize your profiles.`
|
|
50
|
+
- Stop.
|
|
51
|
+
|
|
52
|
+
**Case C: File exists with `profiles.presets` key**
|
|
53
|
+
- Use as-is
|
|
54
|
+
|
|
55
|
+
## Step 2: Determine target profile
|
|
56
|
+
|
|
57
|
+
**A) Check for positional argument:**
|
|
58
|
+
- If user typed `/gsd-set-model quality` (or balanced/budget), use that as `targetProfile`
|
|
59
|
+
|
|
60
|
+
**B) Interactive picker (no args):**
|
|
61
|
+
|
|
62
|
+
Use Question tool:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
header: "Configure Profile"
|
|
66
|
+
question: "Which profile do you want to configure?"
|
|
67
|
+
options:
|
|
68
|
+
- label: "Quality"
|
|
69
|
+
description: "Configure models for the quality profile"
|
|
70
|
+
- label: "Balanced"
|
|
71
|
+
description: "Configure models for the balanced profile"
|
|
72
|
+
- label: "Budget"
|
|
73
|
+
description: "Configure models for the budget profile"
|
|
74
|
+
- label: "Cancel"
|
|
75
|
+
description: "Exit without changes"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Input rules:
|
|
79
|
+
- For this command, custom/freeform answers are NOT allowed.
|
|
80
|
+
- If the user's selection is not exactly one of the option labels, print an error and re-run the same Question prompt.
|
|
81
|
+
|
|
82
|
+
If user selects Cancel:
|
|
83
|
+
```
|
|
84
|
+
Configuration cancelled.
|
|
85
|
+
```
|
|
86
|
+
Stop.
|
|
87
|
+
|
|
88
|
+
**C) Invalid profile handling:**
|
|
89
|
+
|
|
90
|
+
If an invalid profile name is provided:
|
|
91
|
+
- Print: `Unknown profile '{name}'. Valid options: quality, balanced, budget`
|
|
92
|
+
- Fall back to interactive picker
|
|
93
|
+
|
|
94
|
+
## Step 3: Display information BEFORE prompting
|
|
95
|
+
|
|
96
|
+
**IMPORTANT: Complete ALL display output in this step before asking any questions.**
|
|
97
|
+
|
|
98
|
+
### 3a. Show current configuration
|
|
99
|
+
|
|
100
|
+
Get current preset from `config.profiles.presets[targetProfile]` and print:
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
Configuring models for: {targetProfile}
|
|
104
|
+
|
|
105
|
+
Current configuration:
|
|
106
|
+
| Stage | Model |
|
|
107
|
+
|-------|-------|
|
|
108
|
+
| planning | {preset.planning} |
|
|
109
|
+
| execution | {preset.execution} |
|
|
110
|
+
| verification | {preset.verification} |
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 3b. Discover and display available models
|
|
114
|
+
|
|
115
|
+
Run:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
opencode models 2>/dev/null
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Parse the output to extract model IDs in `provider/model` format. Store these in a list for validation.
|
|
122
|
+
|
|
123
|
+
If command fails or returns no models:
|
|
124
|
+
```text
|
|
125
|
+
Error: Could not fetch available models. Check your OpenCode installation.
|
|
126
|
+
```
|
|
127
|
+
Stop.
|
|
128
|
+
|
|
129
|
+
**Print** the tip below after running opencode models:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
Tip: Models prefixed with "opencode/" require an OpenCode Zen subscription.
|
|
133
|
+
To see only one provider's models: opencode models <provider>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 3c. Print input instructions
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
Enter model selection for each stage (you may press Enter to keep the current value).
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Do NOT proceed to Step 4 until all of the above is printed.**
|
|
143
|
+
|
|
144
|
+
## Step 4: Prompt for model selection
|
|
145
|
+
|
|
146
|
+
Now prompt the user for each stage. Ask one question at a time.
|
|
147
|
+
|
|
148
|
+
### Planning Stage
|
|
149
|
+
|
|
150
|
+
Use Question tool with free-form input allowed:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
header: "{targetProfile} Profile - Planning"
|
|
154
|
+
question: "Enter model ID for planning agents (or press Enter to keep current)"
|
|
155
|
+
placeholder: "{preset.planning}"
|
|
156
|
+
allowFreeform: true
|
|
157
|
+
options:
|
|
158
|
+
- label: "Keep current"
|
|
159
|
+
description: "{preset.planning}"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Execution Stage
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
header: "{targetProfile} Profile - Execution"
|
|
166
|
+
question: "Enter model ID for execution agents (or press Enter to keep current)"
|
|
167
|
+
placeholder: "{preset.execution}"
|
|
168
|
+
allowFreeform: true
|
|
169
|
+
options:
|
|
170
|
+
- label: "Keep current"
|
|
171
|
+
description: "{preset.execution}"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Verification Stage
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
header: "{targetProfile} Profile - Verification"
|
|
178
|
+
question: "Enter model ID for verification agents (or press Enter to keep current)"
|
|
179
|
+
placeholder: "{preset.verification}"
|
|
180
|
+
allowFreeform: true
|
|
181
|
+
options:
|
|
182
|
+
- label: "Keep current"
|
|
183
|
+
description: "{preset.verification}"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Input handling for each stage:**
|
|
187
|
+
|
|
188
|
+
1. If user selects "Keep current" or enters empty/blank input, retain the existing value
|
|
189
|
+
2. If user enters a model ID:
|
|
190
|
+
- Validate it exists in the available models list
|
|
191
|
+
- If invalid, print error and re-prompt:
|
|
192
|
+
```
|
|
193
|
+
Invalid model ID: '{input}'. Please enter a valid model from the list above.
|
|
194
|
+
```
|
|
195
|
+
- If valid, use the entered model ID
|
|
196
|
+
|
|
197
|
+
## Step 5: Check for changes
|
|
198
|
+
|
|
199
|
+
If no changes were made (all stages selected "Keep current"):
|
|
200
|
+
```
|
|
201
|
+
No changes made to {targetProfile} profile.
|
|
202
|
+
```
|
|
203
|
+
Stop.
|
|
204
|
+
|
|
205
|
+
## Step 6: Save changes
|
|
206
|
+
|
|
207
|
+
Use the **write tool directly** to update files. Do NOT use bash, python, or other scripts—use native file writing.
|
|
208
|
+
|
|
209
|
+
1. **Update .planning/config.json:**
|
|
210
|
+
|
|
211
|
+
- Set `config.profiles.presets[targetProfile].planning` to selected value
|
|
212
|
+
- Set `config.profiles.presets[targetProfile].execution` to selected value
|
|
213
|
+
- Set `config.profiles.presets[targetProfile].verification` to selected value
|
|
214
|
+
- Write the config file (preserve all other keys)
|
|
215
|
+
|
|
216
|
+
2. **Update opencode.json (only if targetProfile is active):**
|
|
217
|
+
|
|
218
|
+
Check if `config.profiles.active_profile === targetProfile`. If so, regenerate `opencode.json` with the new effective models.
|
|
219
|
+
|
|
220
|
+
Compute effective models (preset + overrides):
|
|
221
|
+
```
|
|
222
|
+
overrides = config.profiles.custom_overrides[targetProfile] || {}
|
|
223
|
+
effective.planning = overrides.planning || newPreset.planning
|
|
224
|
+
effective.execution = overrides.execution || newPreset.execution
|
|
225
|
+
effective.verification = overrides.verification || newPreset.verification
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Build agent config:
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"$schema": "https://opencode.ai/config.json",
|
|
233
|
+
"agent": {
|
|
234
|
+
"gsd-planner": { "model": "{effective.planning}" },
|
|
235
|
+
"gsd-plan-checker": { "model": "{effective.planning}" },
|
|
236
|
+
"gsd-phase-researcher": { "model": "{effective.planning}" },
|
|
237
|
+
"gsd-roadmapper": { "model": "{effective.planning}" },
|
|
238
|
+
"gsd-project-researcher": { "model": "{effective.planning}" },
|
|
239
|
+
"gsd-research-synthesizer": { "model": "{effective.planning}" },
|
|
240
|
+
"gsd-codebase-mapper": { "model": "{effective.planning}" },
|
|
241
|
+
"gsd-executor": { "model": "{effective.execution}" },
|
|
242
|
+
"gsd-debugger": { "model": "{effective.execution}" },
|
|
243
|
+
"gsd-verifier": { "model": "{effective.verification}" },
|
|
244
|
+
"gsd-integration-checker": { "model": "{effective.verification}" },
|
|
245
|
+
"gsd-set-profile": { "model": "{effective.verification}" },
|
|
246
|
+
"gsd-settings": { "model": "{effective.verification}" },
|
|
247
|
+
"gsd-set-model": { "model": "{effective.verification}" }
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
If `opencode.json` already exists, merge the `agent` key (preserve other top-level keys).
|
|
253
|
+
|
|
254
|
+
3. **Report success:**
|
|
255
|
+
|
|
256
|
+
```text
|
|
257
|
+
✓ Updated {targetProfile} profile:
|
|
258
|
+
|
|
259
|
+
| Stage | Model |
|
|
260
|
+
|--------------|-------|
|
|
261
|
+
| planning | {newPreset.planning} |
|
|
262
|
+
| execution | {newPreset.execution} |
|
|
263
|
+
| verification | {newPreset.verification} |
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
If `targetProfile` is the active profile:
|
|
267
|
+
```text
|
|
268
|
+
Note: This is your active profile. Quit and relaunch OpenCode to apply model changes.
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
If `targetProfile` is NOT the active profile:
|
|
272
|
+
```text
|
|
273
|
+
To use this profile, run: /gsd-set-profile {targetProfile}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
</behavior>
|
|
277
|
+
|
|
278
|
+
<notes>
|
|
279
|
+
- Display available models first, then accept free-form input for model selection
|
|
280
|
+
- Validate entered model IDs against the available models list
|
|
281
|
+
- Always show full model IDs (e.g., `opencode/claude-sonnet-4`)
|
|
282
|
+
- Preserve all other config.json keys when writing (deep merge)
|
|
283
|
+
- Do NOT rewrite agent .md files — only update config.json and opencode.json
|
|
284
|
+
- This command modifies **presets**, not overrides. Use `/gsd-settings` for per-stage overrides.
|
|
285
|
+
- **Source of truth:** `config.json` stores profiles/presets/overrides; `opencode.json` is **derived** from the effective models
|
|
286
|
+
- OpenCode shows all available models regardless of subscription status. Users without Zen can filter with `opencode models github-copilot`
|
|
287
|
+
</notes>
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gsd-set-profile
|
|
3
|
+
description: Switch between model profiles with confirmation workflow
|
|
4
|
+
tools:
|
|
5
|
+
question: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<role>
|
|
9
|
+
You are executing the `/gsd-set-profile` command. Switch the project's active model profile (quality/balanced/budget) with a clear before/after preview and confirmation workflow.
|
|
10
|
+
|
|
11
|
+
This command reads/writes two files:
|
|
12
|
+
- `.planning/config.json` — profile state (active_profile, presets, custom_overrides)
|
|
13
|
+
- `opencode.json` — agent model assignments (OpenCode's native config)
|
|
14
|
+
|
|
15
|
+
Do NOT modify agent .md files. Profile switching updates `opencode.json` in the project root.
|
|
16
|
+
</role>
|
|
17
|
+
|
|
18
|
+
<context>
|
|
19
|
+
**Invocation styles:**
|
|
20
|
+
|
|
21
|
+
1. No args (interactive picker): `/gsd-set-profile`
|
|
22
|
+
2. Positional: `/gsd-set-profile quality` or `balanced` or `budget`
|
|
23
|
+
3. Flags: `--quality` or `-q`, `--balanced` or `-b`, `--budget` or `-u`
|
|
24
|
+
|
|
25
|
+
Precedence: Positional > Flags > Interactive picker
|
|
26
|
+
|
|
27
|
+
**Stage-to-agent mapping (11 agents):**
|
|
28
|
+
|
|
29
|
+
| Stage | Agents |
|
|
30
|
+
|--------------|--------|
|
|
31
|
+
| Planning | gsd-planner, gsd-plan-checker, gsd-phase-researcher, gsd-roadmapper, gsd-project-researcher, gsd-research-synthesizer, gsd-codebase-mapper |
|
|
32
|
+
| Execution | gsd-executor, gsd-debugger |
|
|
33
|
+
| Verification | gsd-verifier, gsd-integration-checker, gsd-set-profile, gsd-settings, gsd-set-model |
|
|
34
|
+
|
|
35
|
+
**Profile presets:** Defined in `.planning/config.json` (user-configurable via `/gsd-settings`). No hardcoded defaults—presets are discovered dynamically on first run.
|
|
36
|
+
</context>
|
|
37
|
+
|
|
38
|
+
<behavior>
|
|
39
|
+
|
|
40
|
+
## Step 1: Read config file
|
|
41
|
+
|
|
42
|
+
Read `.planning/config.json`. Handle these cases:
|
|
43
|
+
|
|
44
|
+
**Case A: File missing or no `profiles.presets` key**
|
|
45
|
+
- Print: `Error: No model presets configured. Run /gsd-settings first to set up your profiles.`
|
|
46
|
+
- Stop.
|
|
47
|
+
|
|
48
|
+
**Case B: File exists with `profiles.presets` key**
|
|
49
|
+
- Use as-is
|
|
50
|
+
|
|
51
|
+
**Also check `opencode.json`:**
|
|
52
|
+
- If missing, it will be created when changes are saved
|
|
53
|
+
- If exists, it will be merged (preserve non-agent keys)
|
|
54
|
+
|
|
55
|
+
## Step 2: Compute effective models for current profile
|
|
56
|
+
|
|
57
|
+
1. Get `currentProfile` = `config.profiles.active_profile` (default: "balanced")
|
|
58
|
+
2. Get `preset` = `config.profiles.presets[currentProfile]`
|
|
59
|
+
3. Get `overrides` = `config.profiles.custom_overrides[currentProfile]` (may be undefined)
|
|
60
|
+
4. Compute effective models:
|
|
61
|
+
- `planning` = overrides?.planning || preset.planning
|
|
62
|
+
- `execution` = overrides?.execution || preset.execution
|
|
63
|
+
- `verification` = overrides?.verification || preset.verification
|
|
64
|
+
|
|
65
|
+
## Step 3: Display current state
|
|
66
|
+
|
|
67
|
+
Print:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Active profile: {currentProfile}
|
|
71
|
+
|
|
72
|
+
Current configuration:
|
|
73
|
+
| Stage | Model |
|
|
74
|
+
|--------------|-------|
|
|
75
|
+
| planning | {current.planning} |
|
|
76
|
+
| execution | {current.execution} |
|
|
77
|
+
| verification | {current.verification} |
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Step 4: Determine requested profile
|
|
81
|
+
|
|
82
|
+
**A) Check for positional argument:**
|
|
83
|
+
- If user typed `/gsd-set-profile quality` (or balanced/budget), use that as `newProfile`
|
|
84
|
+
|
|
85
|
+
**B) Check for flags:**
|
|
86
|
+
- `--quality` or `-q` → quality
|
|
87
|
+
- `--balanced` or `-b` → balanced
|
|
88
|
+
- `--budget` or `-u` → budget
|
|
89
|
+
|
|
90
|
+
**C) Interactive picker (no args/flags):**
|
|
91
|
+
|
|
92
|
+
Build options dynamically from `config.profiles.presets`:
|
|
93
|
+
|
|
94
|
+
Use Question tool:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
header: "Model profile"
|
|
98
|
+
question: "Select a profile"
|
|
99
|
+
options:
|
|
100
|
+
- label: "Quality"
|
|
101
|
+
description: "{preset.quality.planning} / {preset.quality.execution} / {preset.quality.verification}"
|
|
102
|
+
- label: "Balanced"
|
|
103
|
+
description: "{preset.balanced.planning} / {preset.balanced.execution} / {preset.balanced.verification}"
|
|
104
|
+
- label: "Budget"
|
|
105
|
+
description: "{preset.budget.planning} / {preset.budget.execution} / {preset.budget.verification}"
|
|
106
|
+
- label: "Cancel"
|
|
107
|
+
description: "Exit without changes"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
(Substitute actual model IDs from `config.profiles.presets` for each profile.)
|
|
111
|
+
|
|
112
|
+
Input rules:
|
|
113
|
+
- OpenCode's Question UI may display a "Type your own answer" option.
|
|
114
|
+
- For this command, custom/freeform answers are NOT allowed.
|
|
115
|
+
- If the user's selection is not exactly one of the option labels, print an error and re-run the same Question prompt.
|
|
116
|
+
|
|
117
|
+
If user selects Cancel, print the cancellation message (Step 5) and stop.
|
|
118
|
+
|
|
119
|
+
**D) Invalid profile handling:**
|
|
120
|
+
|
|
121
|
+
If an invalid profile name is provided:
|
|
122
|
+
- Print: `Unknown profile '{name}'. Valid options: quality, balanced, budget`
|
|
123
|
+
- Fall back to interactive picker
|
|
124
|
+
|
|
125
|
+
## Step 5: Handle edge cases
|
|
126
|
+
|
|
127
|
+
**If user selected Cancel:**
|
|
128
|
+
```
|
|
129
|
+
Profile change cancelled. Current profile: {currentProfile}
|
|
130
|
+
```
|
|
131
|
+
Stop.
|
|
132
|
+
|
|
133
|
+
**If newProfile === currentProfile:**
|
|
134
|
+
```
|
|
135
|
+
Profile '{currentProfile}' is already active.
|
|
136
|
+
```
|
|
137
|
+
Re-print current configuration table and stop.
|
|
138
|
+
|
|
139
|
+
## Step 5.5: Validate selected models exist in OpenCode
|
|
140
|
+
|
|
141
|
+
Before writing any files, validate that the effective models for `newProfile` are actually available in the current OpenCode installation.
|
|
142
|
+
|
|
143
|
+
Run:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
opencode models
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Parse the output and extract valid model IDs in `provider/model` format.
|
|
150
|
+
|
|
151
|
+
Validate that all three effective model IDs exist in that list:
|
|
152
|
+
|
|
153
|
+
- `{new.planning}`
|
|
154
|
+
- `{new.execution}`
|
|
155
|
+
- `{new.verification}`
|
|
156
|
+
|
|
157
|
+
If `opencode models` fails, or any model is missing:
|
|
158
|
+
|
|
159
|
+
Print an error like:
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
Error: One or more selected models are not available in OpenCode.
|
|
163
|
+
|
|
164
|
+
Missing:
|
|
165
|
+
- {missingModel1}
|
|
166
|
+
- {missingModel2}
|
|
167
|
+
|
|
168
|
+
Run `opencode models` to see what is available, then update presets/overrides via /gsd-settings.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Stop. Do NOT write `.planning/config.json` and do NOT update `opencode.json`.
|
|
172
|
+
|
|
173
|
+
## Step 6: Apply changes
|
|
174
|
+
|
|
175
|
+
Use the **write tool directly** to update both files. Do NOT use bash, python, or other scripts—use native file writing.
|
|
176
|
+
|
|
177
|
+
1. **Update .planning/config.json:**
|
|
178
|
+
|
|
179
|
+
- Set `config.profiles.active_profile` to `newProfile`
|
|
180
|
+
- Also set `config.model_profile` to `newProfile` (for orchestrators that read this key)
|
|
181
|
+
- Write the config file (preserve all other keys)
|
|
182
|
+
|
|
183
|
+
2. **Update opencode.json:**
|
|
184
|
+
|
|
185
|
+
Build agent config from effective stage models for `newProfile`:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"$schema": "https://opencode.ai/config.json",
|
|
190
|
+
"agent": {
|
|
191
|
+
"gsd-planner": { "model": "{new.planning}" },
|
|
192
|
+
"gsd-plan-checker": { "model": "{new.planning}" },
|
|
193
|
+
"gsd-phase-researcher": { "model": "{new.planning}" },
|
|
194
|
+
"gsd-roadmapper": { "model": "{new.planning}" },
|
|
195
|
+
"gsd-project-researcher": { "model": "{new.planning}" },
|
|
196
|
+
"gsd-research-synthesizer": { "model": "{new.planning}" },
|
|
197
|
+
"gsd-codebase-mapper": { "model": "{new.planning}" },
|
|
198
|
+
"gsd-executor": { "model": "{new.execution}" },
|
|
199
|
+
"gsd-debugger": { "model": "{new.execution}" },
|
|
200
|
+
"gsd-verifier": { "model": "{new.verification}" },
|
|
201
|
+
"gsd-integration-checker": { "model": "{new.verification}" },
|
|
202
|
+
"gsd-set-profile": { "model": "{new.verification}" },
|
|
203
|
+
"gsd-settings": { "model": "{new.verification}" },
|
|
204
|
+
"gsd-set-model": { "model": "{new.verification}" }
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
If `opencode.json` already exists, merge the `agent` key (preserve other top-level keys).
|
|
210
|
+
|
|
211
|
+
3. **Report success:**
|
|
212
|
+
|
|
213
|
+
```text
|
|
214
|
+
✓ Active profile set to: {newProfile}
|
|
215
|
+
|
|
216
|
+
Current configuration:
|
|
217
|
+
| Stage | Model |
|
|
218
|
+
|--------------|-------|
|
|
219
|
+
| planning | {new.planning} |
|
|
220
|
+
| execution | {new.execution} |
|
|
221
|
+
| verification | {new.verification} |
|
|
222
|
+
|
|
223
|
+
Note: OpenCode loads `opencode.json` at startup and does not hot-reload model/agent assignments. Fully quit and relaunch OpenCode to apply this profile change.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Important: Do NOT print any tooling transcript (e.g., `python -m json.tool ...`) or a separate `Updated:` file list. The success message above is the complete user-facing output.
|
|
227
|
+
|
|
228
|
+
</behavior>
|
|
229
|
+
|
|
230
|
+
<notes>
|
|
231
|
+
- Use the Question tool for ALL user input (never ask user to type numbers)
|
|
232
|
+
- Always show full model IDs (e.g., `opencode/glm-4.7-free`)
|
|
233
|
+
- Preserve all other config.json keys when writing (deep merge)
|
|
234
|
+
- Do NOT rewrite agent .md files — only update opencode.json
|
|
235
|
+
- If opencode.json doesn't exist, create it
|
|
236
|
+
- Overrides are scoped per profile at `profiles.custom_overrides.{profile}.{stage}`
|
|
237
|
+
- **Source of truth:** `config.json` stores profiles/presets/overrides; `opencode.json` is **derived** from the effective models
|
|
238
|
+
- When regenerating `opencode.json`, read the new profile from `config.json`, compute effective models (preset + overrides), then write the agent mappings
|
|
239
|
+
</notes>
|