GeezerVison is showing github.com — Use the built-in build agent instead of a custom agent · llamauser/solidworks-mcp-python@93e2d6b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .opencode/solidworks-prompt.md -14Lines changed: 0 additions & 14 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | | ---- | 2 | | -description: Inspect and edit the model open in SolidWorks, using only the solidworks tools | 3 | | -mode: primary | 4 | | -temperature: 0.1 | 5 | | -steps: 25 | 6 | | -permission: | 7 | | - bash: deny | 8 | | - edit: deny | 9 | | - webfetch: deny | 10 | | - websearch: deny | 11 | | - task: deny | 12 | | - solidworks_*: allow | 13 | | ---- | 14 | | - | 15 | 1 | You help the user inspect and change the model that is open in SolidWorks. | 16 | 2 |
| 17 | 3 | Rules: | |
Collapse file Copy file name to clipboardExpand all lines: README.md +11-3Lines changed: 11 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -28,9 +28,10 @@ installs. | 28 | 28 | ## Using it from OpenCode | 29 | 29 |
| 30 | 30 | Run `opencode` in this folder. It reads `opencode.json` and starts the server itself over stdio. | 31 | | -Press **Tab** to switch to the **solidworks** agent (`.opencode/agents/solidworks.md`). That agent | 32 | | -can only use the SolidWorks tools: shell and file editing are denied, so the model cannot drift | 33 | | -into writing its own COM scripts. Then pick a model and ask, for example: | | 31 | +In this folder, the default **build** agent is reconfigured by `opencode.json`: it uses the | | 32 | +instructions in `.opencode/solidworks-prompt.md` and may only use the SolidWorks tools. Shell and | | 33 | +file editing are denied, so the model cannot drift into writing its own COM scripts. Pick a model | | 34 | +and ask, for example: | 34 | 35 |
| 35 | 36 | > What is open in SolidWorks? … *(click a face)* … make this 5 mm thicker and export a STEP to C:\Temp\part.step | 36 | 37 |
| @@ -84,6 +85,13 @@ OpenCode `"type": "remote"` entry with `"url": "http://127.0.0.1:8765/mcp"`. | 84 | 85 |
| 85 | 86 | ## Troubleshooting | 86 | 87 |
| | 88 | +- **"OpenCode's free tier can only be used from within OpenCode".** This is an OpenCode bug | | 89 | + ([anomalyco/opencode#50806](https://github.com/anomalyco/opencode/issues/50806), | | 90 | + [#49592](https://github.com/anomalyco/opencode/issues/49592)): free models only accept requests | | 91 | + from the built-in `build` agent. That is why this project reconfigures `build` instead of | | 92 | + adding a custom agent. Session titles and auto-compaction can hit the same error on free | | 93 | + models; start a new session when a long one stops. | | 94 | + | 87 | 95 | - **`SW_STARTING` never ends.** SolidWorks is running but not visible to COM. Close any | 88 | 96 | dialog box in SolidWorks. Then check that SolidWorks and OpenCode run as the same Windows | 89 | 97 | user, and either both or neither with "Run as administrator". | |
Collapse file Copy file name to clipboardExpand all lines: docs/model-test-prompts.md +3-2Lines changed: 3 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Comparing the free OpenCode models | 2 | 2 |
| 3 | | -Run these five prompts with each model, using the **solidworks** agent (press Tab in OpenCode). | | 3 | +Run these five prompts with each model, using the default **build** agent in this folder. | | 4 | +`opencode.json` locks that agent to the SolidWorks tools. | 4 | 5 | Start each model from the same state: SolidWorks open, the smoke-test block (or any simple part) | 5 | 6 | open, and nothing selected. Mark a prompt as a pass only if the model called the expected tools | 6 | 7 | and reported the numbers the tools actually returned. | @@ -16,7 +17,7 @@ and reported the numbers the tools actually returned. | 16 | 17 | Watch for these failure patterns: | 17 | 18 | - **Wrong units:** it passes meters (0.015) instead of millimeters (15). The server flags suspicious jumps in a `warning` field. | 18 | 19 | - **Invented names:** it guesses `D1@Extrude1` instead of copying the name from `dims`. | 19 | | -- **Code instead of tools:** it tries to write a script. The agent blocks bash and edit, but note it anyway. | | 20 | +- **Code instead of tools:** it tries to write a script. The config blocks bash and edit, but note it anyway. | 20 | 21 | - **Retry loops:** it repeats the same failing call instead of following `fix`. | 21 | 22 |
| 22 | 23 | ## Scorecard | |
Collapse file Copy file name to clipboardExpand all lines: install.ps1 +15-1Lines changed: 15 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,6 +29,20 @@ $json = @" | 29 | 29 | "enabled": true, | 30 | 30 | "timeout": 10000 | 31 | 31 | } | | 32 | + }, | | 33 | + "agent": { | | 34 | + "build": { | | 35 | + "prompt": "{file:./.opencode/solidworks-prompt.md}", | | 36 | + "temperature": 0.1, | | 37 | + "permission": { | | 38 | + "bash": "deny", | | 39 | + "edit": "deny", | | 40 | + "webfetch": "deny", | | 41 | + "websearch": "deny", | | 42 | + "task": "deny", | | 43 | + "solidworks_*": "allow" | | 44 | + } | | 45 | + } | 32 | 46 | } | 33 | 47 | } | 34 | 48 | "@ | @@ -44,5 +58,5 @@ Write-Host " 1. Open SolidWorks (or let the smoke test start it)." | 44 | 58 | Write-Host " 2. Run the end-to-end check: .venv\Scripts\python scripts\smoke_test.py" | 45 | 59 | Write-Host " and send back smoke_test_report.txt" | 46 | 60 | Write-Host " 3. Start OpenCode in this folder: opencode" | 47 | | -Write-Host " Press Tab to switch to the 'solidworks' agent, pick a model, and ask:" | | 61 | +Write-Host " Use the default 'build' agent (in this folder it is locked to the SolidWorks tools), pick a model, and ask:" | 48 | 62 | Write-Host " 'What version of SolidWorks is running?'" |
Collapse file Copy file name to clipboardExpand all lines: opencode.json +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | "enabled": true, | 8 | 8 | "timeout": 10000 | 9 | 9 | } | | 10 | + }, | | 11 | + "agent": { | | 12 | + "build": { | | 13 | + "prompt": "{file:./.opencode/solidworks-prompt.md}", | | 14 | + "temperature": 0.1, | | 15 | + "permission": { | | 16 | + "bash": "deny", | | 17 | + "edit": "deny", | | 18 | + "webfetch": "deny", | | 19 | + "websearch": "deny", | | 20 | + "task": "deny", | | 21 | + "solidworks_*": "allow" | | 22 | + } | | 23 | + } | 10 | 24 | } | 11 | 25 | } |
Collapse file Copy file name to clipboardExpand all lines: prompt.md +2Lines changed: 2 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -129,6 +129,8 @@ Next batch after these: `new_part`, `create_sketch(plane)`, `sketch_rectangle`, | 129 | 129 | - [x] Wrote the tests (`tests/fakes/fake_sw.py`, plus test files for com_utils, com_worker, resilience, tools and tool schemas): **59 passing** (`.venv/Scripts/python -m pytest -q`). | 130 | 130 | - [x] Wrote `scripts/smoke_test.py`. Run here, it starts the real server over stdio in 1.5 s and reports NO_SOLIDWORKS cleanly. | 131 | 131 | - [x] Wrote `opencode.json`, `.opencode/agents/solidworks.md` (denies bash, edit, webfetch, websearch and task; allows `solidworks_*`), `install.ps1` (tested here: writes opencode.json as valid JSON with no BOM), `docs/model-test-prompts.md`, `README.md` and `.gitignore`. | | 132 | +- [x] Pushed to the private repo https://github.com/llamauser/solidworks-mcp-python (`references/` is excluded). | | 133 | +- [x] **Changed after the user's first OpenCode run:** OpenCode's free tier rejects custom agents with "OpenCode's free tier can only be used from within OpenCode" (anomalyco/opencode#50806, #49592; only `agent=build` is accepted). The custom agent `.opencode/agents/solidworks.md` was **removed**. `opencode.json` (and `install.ps1`) now reconfigure the built-in `build` agent instead: prompt `{file:./.opencode/solidworks-prompt.md}`, temperature 0.1, and the same deny/allow permissions. The notes above about a custom agent file are superseded. | 132 | 134 | - [ ] **Waiting on the user:** run `install.ps1` and `scripts/smoke_test.py` on the SolidWorks PC, then paste back `smoke_test_report.txt`. | 133 | 135 |
| 134 | 136 | ### Not yet verified on real SolidWorks (check these in the smoke report) | |
|