@hiai-gg/hiai-opencode 0.1.4 → 0.1.6

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.
Files changed (81) hide show
  1. package/.env.example +14 -8
  2. package/AGENTS.md +19 -8
  3. package/ARCHITECTURE.md +7 -6
  4. package/LICENSE.md +0 -1
  5. package/README.md +48 -17
  6. package/assets/cli/hiai-opencode.mjs +590 -7
  7. package/assets/mcp/mempalace.mjs +159 -25
  8. package/config/hiai-opencode.schema.json +82 -148
  9. package/dist/agents/dynamic-agent-core-sections.d.ts +4 -1
  10. package/dist/agents/dynamic-agent-prompt-builder.d.ts +1 -1
  11. package/dist/config/defaults.d.ts +1 -0
  12. package/dist/config/platform-schema.d.ts +275 -10
  13. package/dist/config/schema/categories.d.ts +2 -2
  14. package/dist/config/schema/commands.d.ts +1 -0
  15. package/dist/config/schema/oh-my-opencode-config.d.ts +1 -3
  16. package/dist/config/types.d.ts +22 -5
  17. package/dist/create-tools.d.ts +2 -0
  18. package/dist/features/builtin-commands/templates/doctor.d.ts +1 -0
  19. package/dist/features/builtin-commands/types.d.ts +1 -1
  20. package/dist/features/builtin-skills/skills/hiai-opencode-setup.d.ts +2 -0
  21. package/dist/features/builtin-skills/skills/index.d.ts +1 -0
  22. package/dist/index.js +870 -1711
  23. package/dist/mcp/types.d.ts +1 -1
  24. package/dist/plugin/tool-registry.d.ts +2 -0
  25. package/dist/shared/mcp-static-export.d.ts +22 -0
  26. package/dist/tools/ast-grep/constants.d.ts +1 -1
  27. package/dist/tools/ast-grep/environment-check.d.ts +1 -5
  28. package/dist/tools/ast-grep/language-support.d.ts +0 -1
  29. package/dist/tools/ast-grep/types.d.ts +1 -2
  30. package/dist/tools/skill-mcp/tools.d.ts +2 -0
  31. package/hiai-opencode.json +39 -171
  32. package/package.json +6 -4
  33. package/src/agents/bob/default.ts +6 -1
  34. package/src/agents/bob/gpt-pro.ts +1 -0
  35. package/src/agents/bob.ts +1 -0
  36. package/src/agents/coder/gpt-codex.ts +1 -0
  37. package/src/agents/coder/gpt-pro.ts +1 -0
  38. package/src/agents/coder/gpt.ts +1 -0
  39. package/src/agents/dynamic-agent-core-sections.ts +36 -0
  40. package/src/agents/dynamic-agent-prompt-builder.ts +1 -0
  41. package/src/config/defaults.ts +171 -28
  42. package/src/config/loader.test.ts +16 -1
  43. package/src/config/loader.ts +4 -2
  44. package/src/config/model-slots-and-export.test.ts +55 -0
  45. package/src/config/platform-schema.ts +37 -5
  46. package/src/config/schema/commands.ts +1 -0
  47. package/src/config/schema/oh-my-opencode-config.ts +0 -3
  48. package/src/config/types.ts +34 -5
  49. package/src/create-tools.ts +4 -1
  50. package/src/features/builtin-commands/commands.ts +7 -0
  51. package/src/features/builtin-commands/templates/doctor.ts +43 -0
  52. package/src/features/builtin-commands/types.ts +1 -1
  53. package/src/features/builtin-skills/skills/hiai-opencode-setup.ts +69 -0
  54. package/src/features/builtin-skills/skills/index.ts +1 -0
  55. package/src/features/builtin-skills/skills.ts +10 -1
  56. package/src/index.ts +4 -38
  57. package/src/lsp/index.ts +1 -0
  58. package/src/mcp/registry.ts +6 -1
  59. package/src/plugin/tool-registry.ts +4 -0
  60. package/src/shared/mcp-static-export.ts +121 -0
  61. package/src/tools/ast-grep/constants.ts +1 -1
  62. package/src/tools/ast-grep/environment-check.ts +2 -32
  63. package/src/tools/ast-grep/language-support.ts +0 -3
  64. package/src/tools/ast-grep/types.ts +1 -2
  65. package/src/tools/skill-mcp/tools.test.ts +44 -0
  66. package/src/tools/skill-mcp/tools.ts +45 -7
  67. package/dist/ast-grep-napi.win32-x64-msvc-67c0y8nc.node +0 -0
  68. package/dist/config/loader.test.d.ts +0 -1
  69. package/dist/config/models.d.ts +0 -13
  70. package/dist/internals/plugins/websearch-cited/google.d.ts +0 -38
  71. package/dist/internals/plugins/websearch-cited/index.d.ts +0 -11
  72. package/dist/internals/plugins/websearch-cited/openai.d.ts +0 -9
  73. package/dist/internals/plugins/websearch-cited/openrouter.d.ts +0 -2
  74. package/dist/internals/plugins/websearch-cited/types.d.ts +0 -5
  75. package/src/internals/plugins/websearch-cited/LICENSE +0 -214
  76. package/src/internals/plugins/websearch-cited/codex_prompt.txt +0 -79
  77. package/src/internals/plugins/websearch-cited/google.ts +0 -749
  78. package/src/internals/plugins/websearch-cited/index.ts +0 -301
  79. package/src/internals/plugins/websearch-cited/openai.ts +0 -407
  80. package/src/internals/plugins/websearch-cited/openrouter.ts +0 -190
  81. package/src/internals/plugins/websearch-cited/types.ts +0 -7
package/.env.example CHANGED
@@ -11,14 +11,7 @@
11
11
  # - anthropic/claude-3-5-sonnet-latest
12
12
  #
13
13
  # Do not put model provider keys here for normal OpenCode usage.
14
- # Optional fallback only for headless/non-Connect workflows:
15
- # OPENROUTER_API_KEY=your_openrouter_api_key_here
16
- # OPENAI_API_KEY=your_openai_api_key_here
17
- # ANTHROPIC_API_KEY=your_anthropic_api_key_here
18
- # DEEPSEEK_API_KEY=your_deepseek_api_key_here
19
- # GLM_API_KEY=your_glm_api_key_here
20
- # MINIMAX_API_KEY=your_minimax_api_key_here
21
- # QWEN_API_KEY=your_qwen_api_key_here
14
+ # Connect model providers in OpenCode itself.
22
15
 
23
16
  # MCP Service Keys
24
17
 
@@ -58,6 +51,19 @@
58
51
  # Optional - if Linux system browser deps cannot be installed, edit hiai-opencode.json
59
52
  # and add Playwright MCP args such as "--browser", "chrome" to use an existing browser.
60
53
 
54
+ # Static MCP export
55
+
56
+ # Optional - controls automatic .mcp.json export when the plugin loads.
57
+ # Values: if-missing (default), always (managed files only), force, 0/false/no/off.
58
+ # HIAI_OPENCODE_AUTO_EXPORT_MCP=if-missing
59
+
60
+ # Optional - override static MCP export path.
61
+ # HIAI_OPENCODE_MCP_EXPORT_PATH=./.mcp.json
62
+
63
+ # Optional - CLI export safety mode.
64
+ # Values: safe (default), force
65
+ # HIAI_OPENCODE_EXPORT_MCP_MODE=safe
66
+
61
67
  # RAG MCP
62
68
 
63
69
  # Optional - RAG search tool endpoint
package/AGENTS.md CHANGED
@@ -66,9 +66,14 @@ Manual alternative:
66
66
 
67
67
  ```bash
68
68
  opencode debug config
69
+ hiai-opencode doctor
70
+ hiai-opencode mcp-status
71
+ hiai-opencode export-mcp .mcp.json
69
72
  opencode mcp list --print-logs --log-level INFO
70
73
  ```
71
74
 
75
+ `opencode mcp list` reads static `.mcp.json` files in many OpenCode versions. Runtime MCP servers launched by the plugin may work but not appear there until a static config exists. The plugin auto-exports `.mcp.json` on startup when missing. In `always` mode it overwrites only hiai-managed exports unless forced. `hiai-opencode export-mcp .mcp.json` can refresh it manually.
76
+
72
77
  ## Post-Install Bootstrap Instructions
73
78
 
74
79
  When a user asks OpenCode or another agent to finish installing this plugin, follow this procedure.
@@ -110,13 +115,15 @@ When a user asks OpenCode or another agent to finish installing this plugin, fol
110
115
  - `FIRECRAWL_API_KEY`
111
116
  - `STITCH_AI_API_KEY`
112
117
  - `CONTEXT7_API_KEY`
113
- - `GOOGLE_SEARCH_API_KEY`
114
118
  - `MEMPALACE_PYTHON`
115
119
  - `OPENCODE_RAG_URL`
116
120
  - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
117
121
  - `HIAI_MCP_AUTO_INSTALL`
118
122
  7. Verify with:
119
123
  - `opencode debug config`
124
+ - `hiai-opencode doctor`
125
+ - `hiai-opencode mcp-status`
126
+ - `hiai-opencode export-mcp .mcp.json` when static MCP visibility is needed
120
127
  - `opencode mcp list --print-logs --log-level INFO`
121
128
 
122
129
  ### MCP Setup Matrix
@@ -126,7 +133,7 @@ When a user asks OpenCode or another agent to finish installing this plugin, fol
126
133
  | `playwright` | Node and npx are available | Helper launcher runs `@playwright/mcp@latest`; set `HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1` to install Chromium on first start |
127
134
  | `sequential-thinking` | Node and npx are available | Helper launcher runs `@modelcontextprotocol/server-sequential-thinking` |
128
135
  | `firecrawl` | `FIRECRAWL_API_KEY` is set | Helper launcher runs `firecrawl-mcp` |
129
- | `mempalace` | `uv` is available, or Python 3.9+ with pip is available | Launcher prefers `uv`; otherwise uses Python and can run `python -m pip install --user mempalace` when `HIAI_MCP_AUTO_INSTALL` is not disabled |
136
+ | `mempalace` | `uv` is available, or Python 3.9+ with pip is available | Launcher prefers `uv`; otherwise uses Python and can run `python -m pip install --user mempalace` when `HIAI_MCP_AUTO_INSTALL` is not disabled. Interpreter can be pinned via `mcp.mempalace.pythonPath` or `MEMPALACE_PYTHON` |
130
137
  | `rag` | User has a local or remote RAG endpoint | Uses `OPENCODE_RAG_URL`, defaulting to `http://localhost:9002/tools/search` |
131
138
  | `stitch` | `STITCH_AI_API_KEY` is set | Remote MCP endpoint |
132
139
  | `context7` | User wants Context7 docs/search | Remote MCP endpoint; use `CONTEXT7_API_KEY` if available |
@@ -155,14 +162,14 @@ Check which services can run here:
155
162
  - playwright: node/npx; optionally HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1.
156
163
  - sequential-thinking: node/npx.
157
164
  - firecrawl: FIRECRAWL_API_KEY.
158
- - mempalace: uv or Python 3.9+ with pip; MEMPALACE_PYTHON if needed; HIAI_MCP_AUTO_INSTALL controls first-run pip install.
165
+ - mempalace: uv or Python 3.9+ with pip; set `mcp.mempalace.pythonPath` (or `MEMPALACE_PYTHON`) if needed; `HIAI_MCP_AUTO_INSTALL` controls first-run pip install.
159
166
  - rag: OPENCODE_RAG_URL or http://localhost:9002/tools/search.
160
167
  - stitch: STITCH_AI_API_KEY.
161
168
  - context7: optional CONTEXT7_API_KEY.
162
169
 
163
170
  Report missing keys without printing secret values. Never invent or hardcode API keys.
164
171
 
165
- Run opencode debug config and opencode mcp list --print-logs --log-level INFO if available. If something is missing, propose or run only user-level/project-local install commands.
172
+ Run hiai-opencode mcp-status and opencode debug config. If the user wants opencode mcp list visibility, run hiai-opencode export-mcp .mcp.json before opencode mcp list --print-logs --log-level INFO. If something is missing, propose or run only user-level/project-local install commands.
166
173
  ```
167
174
 
168
175
  ## Expected Agent State
@@ -213,6 +220,8 @@ The runtime loader is:
213
220
 
214
221
  - [src/config/defaults.ts](src/config/defaults.ts)
215
222
 
223
+ Users configure only the 10 primary agent model slots under `models`: `bob`, `coder`, `strategist`, `guard`, `critic`, `designer`, `researcher`, `manager`, `brainstormer`, and `vision`.
224
+ Hidden agents and task categories are derived internally in `src/config/defaults.ts`.
216
225
  Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
217
226
 
218
227
  ## Change Map
@@ -221,9 +230,9 @@ Use this table when you need to change something and want the right file immedia
221
230
 
222
231
  | Goal | Edit this first | Why |
223
232
  |---|---|---|
224
- | Change which default model an agent uses | [hiai-opencode.json](hiai-opencode.json) | This is the canonical model source |
225
- | Change which default model a category uses | [hiai-opencode.json](hiai-opencode.json) | Categories are assigned there |
226
- | Change MCP/LSP/user-facing defaults | [hiai-opencode.json](hiai-opencode.json) | The runtime loader reads this file |
233
+ | Change a user-facing default model slot | [hiai-opencode.json](hiai-opencode.json) | This is the canonical model source |
234
+ | Change how categories inherit the 10 model slots | [src/config/defaults.ts](src/config/defaults.ts) | Category routing is internal |
235
+ | Change MCP/LSP user-facing switches | [hiai-opencode.json](hiai-opencode.json) | Users only toggle enabled state there |
227
236
  | Change Bob behavior or prompt text | [src/agents/bob.ts](src/agents/bob.ts), `src/agents/bob/*` | Bob prompt authoring lives there |
228
237
  | Change Coder behavior or prompt text | `src/agents/coder/*` | Coder prompt authoring lives there |
229
238
  | Change Strategist behavior or prompt text | `src/agents/strategist/*` | Strategist prompt authoring lives there |
@@ -395,7 +404,6 @@ Common service keys:
395
404
  - `STITCH_AI_API_KEY`
396
405
  - `FIRECRAWL_API_KEY`
397
406
  - `CONTEXT7_API_KEY`
398
- - `GOOGLE_SEARCH_API_KEY`
399
407
  - `OLLAMA_BASE_URL`
400
408
  - `OLLAMA_MODEL`
401
409
  - `MEMPALACE_PYTHON`
@@ -403,6 +411,9 @@ Common service keys:
403
411
  - `OPENCODE_RAG_URL`
404
412
  - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
405
413
  - `HIAI_MCP_AUTO_INSTALL`
414
+ - `HIAI_OPENCODE_AUTO_EXPORT_MCP`
415
+ - `HIAI_OPENCODE_MCP_EXPORT_PATH`
416
+ - `HIAI_OPENCODE_EXPORT_MCP_MODE`
406
417
 
407
418
  ## Known Runtime Caveats
408
419
 
package/ARCHITECTURE.md CHANGED
@@ -62,20 +62,20 @@ Runtime naming, visibility, and compatibility are normalized through:
62
62
 
63
63
  ### Presets
64
64
 
65
- Agent and category model IDs live in one place:
65
+ User-facing model IDs live in one place:
66
66
 
67
67
  - [hiai-opencode.json](hiai-opencode.json)
68
68
 
69
69
  ### Runtime Defaults
70
70
 
71
- The TypeScript defaults loader only reads the bundled canonical config:
71
+ The TypeScript defaults loader derives hidden agents and categories from the 10 user-facing model slots:
72
72
 
73
73
  - [src/config/defaults.ts](src/config/defaults.ts)
74
74
 
75
- This is the runtime source of truth for:
75
+ This is the internal routing source for:
76
76
 
77
- - agent models
78
- - category models
77
+ - hidden agent model inheritance
78
+ - category model inheritance
79
79
  - MCP defaults
80
80
  - LSP defaults
81
81
  - permissions
@@ -158,7 +158,8 @@ If a prompt change looks correct in source but does not show up correctly in Ope
158
158
 
159
159
  Use these rules when editing the prompt layer:
160
160
 
161
- - change `hiai-opencode.json` when any default model assignment should change
161
+ - change `hiai-opencode.json` when any primary agent model slot should change
162
+ - change `src/config/defaults.ts` when internal category-to-agent-slot routing should change
162
163
  - change `src/agents/*` when the prompt content or behavior should change
163
164
  - change shared prompt/injection files when the prompt is being appended or normalized after agent construction
164
165
  - change `src/plugin-handlers/agent-config-handler.ts` when runtime name, visibility, mode, or final description should change
package/LICENSE.md CHANGED
@@ -31,7 +31,6 @@ Some are:
31
31
  | Sequential Thinking | [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) | external MCP |
32
32
  | Firecrawl MCP | [firecrawl-ai/firecrawl-mcp-server](https://github.com/firecrawl-ai/firecrawl-mcp-server) | external MCP |
33
33
  | Context7 MCP | [upstash/context7-mcp](https://github.com/upstash/context7-mcp) | external MCP |
34
- | Websearch cited | [ghoulr/opencode-websearch-cited](https://github.com/ghoulr/opencode-websearch-cited) | search integration influence |
35
34
  | bun-pty / PTY ecosystem | [shekohex/opencode-pty](https://github.com/shekohex/opencode-pty) | PTY/runtime integration influence |
36
35
 
37
36
  ## What Is Bundled vs External
package/README.md CHANGED
@@ -31,7 +31,7 @@ Keep OpenCode plugins separate from MCP servers. Do not add MCP server packages
31
31
 
32
32
  Check which MCP services can run on this machine, update hiai-opencode.json, install only missing user-level or project-local dependencies, and report missing API keys without printing secret values.
33
33
 
34
- Then run opencode debug config and opencode mcp list --print-logs --log-level INFO if available.
34
+ Then run `hiai-opencode doctor`, `hiai-opencode mcp-status`, and `opencode debug config`.
35
35
  ```
36
36
 
37
37
  For the full operator playbook, see [AGENTS.md](AGENTS.md). 🤖
@@ -116,15 +116,27 @@ New-Item -ItemType Directory -Force .opencode
116
116
  Copy-Item .\hiai-opencode.json .\.opencode\hiai-opencode.json
117
117
  ```
118
118
 
119
- If you installed only from npm/OpenCode and do not have this repository checked out, create `.opencode/hiai-opencode.json` with the service block below and adjust it later.
119
+ If you installed only from npm/OpenCode and do not have this repository checked out, create `.opencode/hiai-opencode.json` with the shape below and adjust it later.
120
120
 
121
121
  ```json
122
122
  {
123
+ "models": {
124
+ "bob": { "model": "openrouter/moonshotai/kimi-k2.6", "recommended": "xhigh" },
125
+ "coder": { "model": "openrouter/minimax/minimax-m2.7", "recommended": "high" },
126
+ "strategist": { "model": "openrouter/anthropic/claude-opus-latest", "recommended": "high" },
127
+ "guard": { "model": "openrouter/qwen/qwen3.6-plus", "recommended": "middle" },
128
+ "critic": { "model": "openrouter/xiaomi/mimo-v2.5-pro", "recommended": "high" },
129
+ "designer": { "model": "openrouter/google/gemini-3.1-pro-preview", "recommended": "design" },
130
+ "researcher": { "model": "openrouter/deepseek/deepseek-v4-flash", "recommended": "fast" },
131
+ "manager": { "model": "openrouter/qwen/qwen3.5-9b", "recommended": "fast" },
132
+ "brainstormer": { "model": "openrouter/mistralai/mistral-small-2603", "recommended": "writing" },
133
+ "vision": { "model": "openrouter/google/gemma-4-26b-a4b-it", "recommended": "vision" }
134
+ },
123
135
  "mcp": {
124
136
  "playwright": { "enabled": true },
125
137
  "sequential-thinking": { "enabled": true },
126
138
  "firecrawl": { "enabled": true },
127
- "mempalace": { "enabled": true },
139
+ "mempalace": { "enabled": true, "pythonPath": "{env:MEMPALACE_PYTHON:-./.venv/bin/python}" },
128
140
  "rag": { "enabled": false },
129
141
  "stitch": { "enabled": false },
130
142
  "context7": { "enabled": true }
@@ -137,7 +149,7 @@ By default, skill discovery is deterministic: `hiai-opencode` skills plus projec
137
149
  ### 3. Connect models and add service keys
138
150
 
139
151
  Model provider credentials belong to OpenCode Connect, not to `hiai-opencode`.
140
- This plugin only writes model IDs such as `openrouter/anthropic/claude-3.5-sonnet` into agent and category config.
152
+ This plugin only reads the 10 model IDs in `models`. Internal routing derives hidden agents and task categories from those 10 choices.
141
153
 
142
154
  Use OpenCode Connect to authorize the providers behind your configured model IDs. Then add only the service keys for MCP or search integrations you actually use:
143
155
 
@@ -153,15 +165,19 @@ See [Environment Variables And Keys](#environment-variables-and-keys) for the fu
153
165
 
154
166
  ```bash
155
167
  opencode
168
+ hiai-opencode doctor
156
169
  hiai-opencode mcp-status
170
+ hiai-opencode export-mcp .mcp.json
157
171
  opencode debug config
158
172
  opencode mcp list --print-logs --log-level INFO
159
173
  ```
160
174
 
161
- `opencode mcp list` may not show plugin-provided MCP servers in every OpenCode version. If that happens, use `opencode debug config` and startup logs as the source of truth.
175
+ `opencode mcp list` reads static `.mcp.json` files in many OpenCode versions. Runtime MCP servers launched by plugins may work but not appear there. If you want `opencode mcp list` visibility, run `hiai-opencode export-mcp .mcp.json` first.
162
176
 
163
177
  `hiai-opencode mcp-status` is the fastest visibility check. It does not change OpenCode config; it reports config location, enabled MCP services, missing keys, and basic local runtime availability.
164
178
 
179
+ `hiai-opencode doctor` is the broader install/runtime diagnostic. It includes MCP status, static `.mcp.json` freshness, OpenCode Connect visibility, skill materialization, agent naming/count checks, LSP runtime checks, MemPalace Python source selection, and real MCP tool probes.
180
+
165
181
  ## Development Install
166
182
 
167
183
  Direct npm install is only needed for development or inspection:
@@ -198,7 +214,7 @@ Enable only services that can run on this machine:
198
214
  - playwright: requires node/npx; optionally set HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1 before first run if browser binaries are needed.
199
215
  - sequential-thinking: requires node/npx.
200
216
  - firecrawl: requires FIRECRAWL_API_KEY.
201
- - mempalace: requires uv or Python 3.9+ with pip; set MEMPALACE_PYTHON if needed. Leave HIAI_MCP_AUTO_INSTALL enabled unless the user forbids package installation.
217
+ - mempalace: requires uv or Python 3.9+ with pip; set `mcp.mempalace.pythonPath` (or `MEMPALACE_PYTHON`) if needed. Leave `HIAI_MCP_AUTO_INSTALL` enabled unless the user forbids package installation.
202
218
  - rag: requires OPENCODE_RAG_URL or a running local endpoint at http://localhost:9002/tools/search.
203
219
  - stitch: requires STITCH_AI_API_KEY.
204
220
  - context7: works without a key but use CONTEXT7_API_KEY if available.
@@ -207,6 +223,8 @@ Check .env.example, report missing keys without printing secret values, and neve
207
223
 
208
224
  Run verification commands where available:
209
225
  - opencode debug config
226
+ - hiai-opencode mcp-status
227
+ - hiai-opencode export-mcp .mcp.json
210
228
  - opencode mcp list --print-logs --log-level INFO
211
229
 
212
230
  If a dependency is missing, install only user-level or project-local dependencies, explain every command before running it, and do not use sudo/admin rights unless the user explicitly asks.
@@ -216,7 +234,7 @@ If a dependency is missing, install only user-level or project-local dependencie
216
234
 
217
235
  ### Models
218
236
 
219
- Canonical runtime defaults for agents, categories, MCP, LSP, and model IDs:
237
+ Canonical user-facing config for 10 primary agent models, MCP/LSP switches, service auth placeholders, and skill discovery:
220
238
 
221
239
  - [hiai-opencode.json](hiai-opencode.json)
222
240
 
@@ -224,7 +242,7 @@ Runtime loader for the bundled canonical config:
224
242
 
225
243
  - [src/config/defaults.ts](src/config/defaults.ts)
226
244
 
227
- If you want to change which model a specific agent or category uses by default, edit `hiai-opencode.json`.
245
+ If you want to change model selection, edit the 10 entries in `models`. Do not add category-specific model choices unless you are intentionally developing the plugin internals.
228
246
 
229
247
  Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
230
248
 
@@ -309,7 +327,6 @@ Important service variables:
309
327
  - `STITCH_AI_API_KEY`
310
328
  - `FIRECRAWL_API_KEY`
311
329
  - `CONTEXT7_API_KEY`
312
- - `GOOGLE_SEARCH_API_KEY`
313
330
  - `OLLAMA_BASE_URL`
314
331
  - `OLLAMA_MODEL`
315
332
  - `MEMPALACE_PYTHON`
@@ -317,6 +334,8 @@ Important service variables:
317
334
  - `OPENCODE_RAG_URL`
318
335
  - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
319
336
  - `HIAI_MCP_AUTO_INSTALL`
337
+ - `HIAI_OPENCODE_AUTO_EXPORT_MCP`
338
+ - `HIAI_OPENCODE_MCP_EXPORT_PATH`
320
339
 
321
340
  Optional headless or non-Connect fallback variables are documented in [.env.example](.env.example), but they are not required for normal OpenCode model auth.
322
341
 
@@ -381,7 +400,7 @@ If sudo is not available:
381
400
 
382
401
  ### Needs upstream runtime or extra setup
383
402
 
384
- - `mempalace`: prefers `uv`; otherwise uses Python. If `HIAI_MCP_AUTO_INSTALL` is not `0`, `false`, or `no`, the launcher can run `python -m pip install --user mempalace` on first start.
403
+ - `mempalace`: prefers `uv`; otherwise uses Python. You can force interpreter selection via `mcp.mempalace.pythonPath` or `MEMPALACE_PYTHON`. If `HIAI_MCP_AUTO_INSTALL` is not `0`, `false`, or `no`, the launcher can run `python -m pip install --user mempalace` on first start.
385
404
  - `rag`: requires your own running endpoint
386
405
 
387
406
  ### Important Windows note
@@ -403,12 +422,26 @@ The plugin now emits startup warnings for common misconfiguration, including:
403
422
  Available CLI:
404
423
 
405
424
  ```bash
425
+ hiai-opencode doctor
406
426
  hiai-opencode mcp-status
427
+ hiai-opencode export-mcp .mcp.json
428
+ ```
429
+
430
+ By default, the plugin auto-exports `.mcp.json` at workspace startup when the file is missing. This closes the visibility gap where runtime plugin MCP works but `opencode mcp list` only reads static files. Control it with:
431
+
432
+ ```bash
433
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=if-missing # default
434
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=always # overwrite only managed hiai-opencode exports
435
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=force # force overwrite even non-managed files
436
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=0 # disable auto-export
437
+ export HIAI_OPENCODE_MCP_EXPORT_PATH=.mcp.json # override path
438
+ export HIAI_OPENCODE_EXPORT_MCP_MODE=safe # export-mcp command mode: safe|force
407
439
  ```
408
440
 
409
441
  Inside OpenCode, use the slash command:
410
442
 
411
443
  ```text
444
+ /doctor
412
445
  /mcp-status
413
446
  ```
414
447
 
@@ -423,14 +456,13 @@ MCP Servers:
423
456
  ⚠️ stitch - enabled, API key missing (STITCH_AI_API_KEY)
424
457
  ```
425
458
 
426
- Planned follow-up commands:
427
-
428
- - `hiai-opencode doctor`: report config location, MCP status, missing keys, and local dependency checks.
429
- - `hiai-opencode export-mcp`: generate a standard `.mcp.json` for hosts that do not expose plugin-provided MCP servers through `opencode mcp list`.
459
+ `hiai-opencode export-mcp` writes a standard `.mcp.json` so hosts whose `mcp list` ignores plugin runtime MCP can still show the same servers statically. Exports are marker-tagged as hiai-managed; by default, the command avoids overwriting non-managed files unless `HIAI_OPENCODE_EXPORT_MCP_MODE=force` is set.
430
460
 
431
- Until those commands ship, use:
461
+ Use:
432
462
 
433
463
  ```bash
464
+ hiai-opencode mcp-status
465
+ hiai-opencode export-mcp .mcp.json
434
466
  opencode debug config
435
467
  opencode mcp list --print-logs --log-level INFO
436
468
  ```
@@ -452,7 +484,6 @@ opencode mcp list --print-logs --log-level INFO
452
484
  | Sequential Thinking | [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) | external MCP |
453
485
  | Firecrawl MCP | [firecrawl-ai/firecrawl-mcp-server](https://github.com/firecrawl-ai/firecrawl-mcp-server) | external MCP |
454
486
  | Context7 MCP | [upstash/context7-mcp](https://github.com/upstash/context7-mcp) | external MCP |
455
- | Websearch cited | [ghoulr/opencode-websearch-cited](https://github.com/ghoulr/opencode-websearch-cited) | search integration influence |
456
487
  | bun-pty / PTY ecosystem | [shekohex/opencode-pty](https://github.com/shekohex/opencode-pty) | PTY/runtime integration influence |
457
488
 
458
489
  ## Build And Publish
@@ -480,7 +511,7 @@ Before publishing:
480
511
  1. run `bun run build`
481
512
  2. run `npm pack --dry-run`
482
513
  3. verify `debug config`
483
- 4. verify `mcp list`
514
+ 4. run `hiai-opencode export-mcp .mcp.json` if you need static `mcp list` visibility
484
515
 
485
516
  Publish:
486
517