@hiai-gg/hiai-opencode 0.1.5 → 0.1.7

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 (180) hide show
  1. package/.env.example +21 -8
  2. package/AGENTS.md +60 -6
  3. package/ARCHITECTURE.md +6 -3
  4. package/LICENSE.md +0 -1
  5. package/README.md +113 -33
  6. package/assets/cli/hiai-opencode.mjs +668 -7
  7. package/assets/mcp/mempalace.mjs +159 -25
  8. package/config/hiai-opencode.schema.json +29 -3
  9. package/dist/agents/agent-skills.d.ts +7 -0
  10. package/dist/agents/bob/default.d.ts +1 -0
  11. package/dist/agents/bob/gemini.d.ts +1 -0
  12. package/dist/agents/bob/gpt-pro.d.ts +1 -0
  13. package/dist/agents/brainstormer.d.ts +7 -0
  14. package/dist/agents/coder/gpt-codex.d.ts +1 -1
  15. package/dist/agents/coder/gpt-pro.d.ts +1 -0
  16. package/dist/agents/coder/gpt.d.ts +2 -1
  17. package/dist/agents/designer.d.ts +7 -0
  18. package/dist/agents/dynamic-agent-core-sections.d.ts +4 -1
  19. package/dist/agents/dynamic-agent-prompt-builder.d.ts +1 -1
  20. package/dist/agents/strategist/gemini.d.ts +1 -0
  21. package/dist/agents/strategist/gpt.d.ts +1 -0
  22. package/dist/agents/types.d.ts +3 -1
  23. package/dist/config/index.d.ts +0 -1
  24. package/dist/config/platform-schema.d.ts +34 -6
  25. package/dist/config/schema/commands.d.ts +1 -0
  26. package/dist/config/schema/hooks.d.ts +0 -2
  27. package/dist/config/schema/index.d.ts +0 -2
  28. package/dist/config/schema/oh-my-opencode-config.d.ts +1 -9
  29. package/dist/config/types.d.ts +4 -4
  30. package/dist/create-hooks.d.ts +0 -2
  31. package/dist/features/builtin-commands/templates/doctor.d.ts +1 -0
  32. package/dist/features/builtin-commands/types.d.ts +1 -1
  33. package/dist/features/builtin-skills/skills/hiai-opencode-setup.d.ts +2 -0
  34. package/dist/features/builtin-skills/skills/index.d.ts +2 -0
  35. package/dist/features/builtin-skills/skills/website-copywriting.d.ts +2 -0
  36. package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
  37. package/dist/hooks/index.d.ts +0 -2
  38. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
  39. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
  40. package/dist/hooks/keyword-detector/ultrawork/gpt.d.ts +1 -1
  41. package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
  42. package/dist/index.js +7719 -153698
  43. package/dist/mcp/index.d.ts +0 -1
  44. package/dist/mcp/registry.d.ts +1 -1
  45. package/dist/plugin/hooks/create-core-hooks.d.ts +0 -2
  46. package/dist/plugin/hooks/create-session-hooks.d.ts +1 -3
  47. package/dist/plugin/startup-diagnostics.d.ts +1 -0
  48. package/dist/shared/logger.d.ts +2 -0
  49. package/dist/shared/mcp-static-export.d.ts +22 -0
  50. package/dist/shared/mode-routing.d.ts +6 -0
  51. package/dist/tools/ast-grep/constants.d.ts +1 -1
  52. package/dist/tools/ast-grep/environment-check.d.ts +1 -5
  53. package/dist/tools/ast-grep/language-support.d.ts +0 -1
  54. package/dist/tools/ast-grep/types.d.ts +1 -2
  55. package/dist/tools/delegate-task/git-categories.d.ts +2 -0
  56. package/dist/tools/delegate-task/sub-agent.d.ts +2 -0
  57. package/dist/tools/skill-mcp/constants.d.ts +1 -1
  58. package/hiai-opencode.json +50 -19
  59. package/package.json +10 -5
  60. package/src/agents/agent-skills.ts +70 -0
  61. package/src/agents/bob/default.ts +7 -1
  62. package/src/agents/bob/gemini.ts +1 -0
  63. package/src/agents/bob/gpt-pro.ts +3 -1
  64. package/src/agents/bob.ts +3 -0
  65. package/src/agents/brainstormer.ts +72 -0
  66. package/src/agents/builtin-agents.ts +59 -3
  67. package/src/agents/coder/gpt-codex.ts +5 -3
  68. package/src/agents/coder/gpt-pro.ts +4 -2
  69. package/src/agents/coder/gpt.ts +3 -1
  70. package/src/agents/critic/agent.ts +1 -0
  71. package/src/agents/designer.ts +70 -0
  72. package/src/agents/dynamic-agent-category-skills-guide.ts +6 -0
  73. package/src/agents/dynamic-agent-core-sections.ts +36 -0
  74. package/src/agents/dynamic-agent-prompt-builder.ts +1 -0
  75. package/src/agents/guard/default.ts +1 -0
  76. package/src/agents/guard/gemini.ts +1 -0
  77. package/src/agents/guard/gpt.ts +1 -0
  78. package/src/agents/platform-manager.ts +17 -1
  79. package/src/agents/prompt-library/platform.ts +34 -0
  80. package/src/agents/researcher.ts +1 -0
  81. package/src/agents/strategist/gemini.ts +1 -0
  82. package/src/agents/strategist/gpt.ts +1 -0
  83. package/src/agents/types.ts +4 -1
  84. package/src/agents/ui.ts +1 -0
  85. package/src/config/defaults.ts +45 -13
  86. package/src/config/index.ts +0 -1
  87. package/src/config/model-slots-and-export.test.ts +73 -0
  88. package/src/config/platform-schema.ts +3 -3
  89. package/src/config/schema/commands.ts +1 -0
  90. package/src/config/schema/hooks.ts +0 -2
  91. package/src/config/schema/index.ts +0 -2
  92. package/src/config/schema/oh-my-opencode-config.ts +0 -5
  93. package/src/config/types.ts +4 -4
  94. package/src/features/builtin-commands/commands.ts +7 -0
  95. package/src/features/builtin-commands/templates/doctor.ts +43 -0
  96. package/src/features/builtin-commands/types.ts +1 -1
  97. package/src/features/builtin-skills/skills/hiai-opencode-setup.ts +69 -0
  98. package/src/features/builtin-skills/skills/index.ts +2 -0
  99. package/src/features/builtin-skills/skills/website-copywriting.ts +41 -0
  100. package/src/features/builtin-skills/skills.test.ts +8 -0
  101. package/src/features/builtin-skills/skills.ts +12 -1
  102. package/src/features/skill-mcp-manager/AGENTS.md +1 -1
  103. package/src/hooks/agent-usage-reminder/constants.ts +4 -4
  104. package/src/hooks/index.ts +0 -2
  105. package/src/hooks/keyword-detector/ultrawork/default.ts +18 -18
  106. package/src/hooks/keyword-detector/ultrawork/gemini.ts +21 -21
  107. package/src/hooks/keyword-detector/ultrawork/gpt.ts +6 -8
  108. package/src/hooks/keyword-detector/ultrawork/planner.ts +5 -5
  109. package/src/index.ts +8 -78
  110. package/src/internals/plugins/subtask2/commands/manifest.ts +2 -6
  111. package/src/internals/plugins/subtask2/hooks/command-hooks.ts +2 -2
  112. package/src/internals/plugins/subtask2/hooks/message-hooks.ts +1 -1
  113. package/src/internals/plugins/subtask2/parsing/parallel.ts +13 -10
  114. package/src/mcp/index.ts +0 -1
  115. package/src/mcp/registry.ts +27 -0
  116. package/src/plugin/chat-message.ts +0 -2
  117. package/src/plugin/hooks/create-session-hooks.ts +0 -17
  118. package/src/plugin/startup-diagnostics.ts +27 -0
  119. package/src/plugin-handlers/agent-config-handler.ts +3 -2
  120. package/src/plugin-handlers/mcp-config-handler.test.ts +63 -0
  121. package/src/plugin-handlers/mcp-config-handler.ts +29 -14
  122. package/src/plugin-handlers/strategist-agent-config-builder.ts +1 -1
  123. package/src/shared/agent-display-names.test.ts +9 -0
  124. package/src/shared/agent-display-names.ts +5 -0
  125. package/src/shared/log-legacy-plugin-startup-warning.ts +6 -8
  126. package/src/shared/logger.ts +8 -0
  127. package/src/shared/mcp-static-export.ts +119 -0
  128. package/src/shared/migration/agent-names.ts +8 -0
  129. package/src/shared/migration/hook-names.ts +1 -1
  130. package/src/shared/mode-routing.test.ts +88 -0
  131. package/src/shared/mode-routing.ts +30 -0
  132. package/src/shared/startup-diagnostics.ts +6 -7
  133. package/src/tools/ast-grep/constants.ts +1 -1
  134. package/src/tools/ast-grep/environment-check.ts +2 -32
  135. package/src/tools/ast-grep/language-support.ts +0 -3
  136. package/src/tools/ast-grep/types.ts +1 -2
  137. package/src/tools/call-omo-agent/tools.ts +11 -4
  138. package/src/tools/delegate-task/anthropic-categories.ts +3 -3
  139. package/src/tools/delegate-task/builtin-categories.ts +2 -0
  140. package/src/tools/delegate-task/categories.test.ts +87 -0
  141. package/src/tools/delegate-task/category-resolver.ts +8 -9
  142. package/src/tools/delegate-task/git-categories.ts +30 -0
  143. package/src/tools/delegate-task/model-string-parser.test.ts +90 -0
  144. package/src/tools/delegate-task/openai-categories.ts +26 -22
  145. package/src/tools/delegate-task/sub-agent.ts +10 -0
  146. package/src/tools/delegate-task/subagent-discovery.test.ts +123 -0
  147. package/src/tools/delegate-task/subagent-resolver.ts +18 -1
  148. package/src/tools/skill-mcp/constants.ts +1 -1
  149. package/src/tools/skill-mcp/tools.test.ts +44 -0
  150. package/dist/ast-grep-napi.win32-x64-msvc-67c0y8nc.node +0 -0
  151. package/dist/config/loader.test.d.ts +0 -1
  152. package/dist/config/models.d.ts +0 -13
  153. package/dist/config/schema/websearch.d.ts +0 -13
  154. package/dist/hooks/no-bob-gpt/hook.d.ts +0 -16
  155. package/dist/hooks/no-bob-gpt/index.d.ts +0 -1
  156. package/dist/hooks/no-coder-non-gpt/hook.d.ts +0 -20
  157. package/dist/hooks/no-coder-non-gpt/index.d.ts +0 -1
  158. package/dist/internals/plugins/websearch-cited/google.d.ts +0 -38
  159. package/dist/internals/plugins/websearch-cited/index.d.ts +0 -17
  160. package/dist/internals/plugins/websearch-cited/openai.d.ts +0 -9
  161. package/dist/internals/plugins/websearch-cited/openrouter.d.ts +0 -2
  162. package/dist/internals/plugins/websearch-cited/types.d.ts +0 -5
  163. package/dist/mcp/grep-app.d.ts +0 -6
  164. package/dist/mcp/omo-mcp-index.d.ts +0 -10
  165. package/dist/mcp/websearch.d.ts +0 -11
  166. package/src/config/schema/websearch.ts +0 -15
  167. package/src/hooks/no-bob-gpt/hook.ts +0 -56
  168. package/src/hooks/no-bob-gpt/index.ts +0 -1
  169. package/src/hooks/no-coder-non-gpt/hook.ts +0 -67
  170. package/src/hooks/no-coder-non-gpt/index.ts +0 -1
  171. package/src/internals/plugins/websearch-cited/LICENSE +0 -214
  172. package/src/internals/plugins/websearch-cited/codex_prompt.txt +0 -79
  173. package/src/internals/plugins/websearch-cited/google.ts +0 -749
  174. package/src/internals/plugins/websearch-cited/index.ts +0 -306
  175. package/src/internals/plugins/websearch-cited/openai.ts +0 -407
  176. package/src/internals/plugins/websearch-cited/openrouter.ts +0 -190
  177. package/src/internals/plugins/websearch-cited/types.ts +0 -7
  178. package/src/mcp/grep-app.ts +0 -6
  179. package/src/mcp/omo-mcp-index.ts +0 -30
  180. package/src/mcp/websearch.ts +0 -44
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
 
@@ -31,6 +24,13 @@
31
24
  # Optional - Context7 code search MCP
32
25
  # CONTEXT7_API_KEY=your_context7_api_key_here
33
26
 
27
+ # Optional - Exa remote websearch MCP. Recommended for higher limits.
28
+ # EXA_API_KEY=your_exa_api_key_here
29
+
30
+ # Optional - Tavily remote websearch MCP.
31
+ # Required only when hiai-opencode.json uses provider "tavily".
32
+ # TAVILY_API_KEY=your_tavily_api_key_here
33
+
34
34
  # Local Model Helpers
35
35
 
36
36
  # Optional - Ollama local model endpoint
@@ -58,6 +58,19 @@
58
58
  # Optional - if Linux system browser deps cannot be installed, edit hiai-opencode.json
59
59
  # and add Playwright MCP args such as "--browser", "chrome" to use an existing browser.
60
60
 
61
+ # Static MCP export
62
+
63
+ # Optional - controls automatic .mcp.json export when the plugin loads.
64
+ # Values: if-missing (default), always (managed files only), force, 0/false/no/off.
65
+ # HIAI_OPENCODE_AUTO_EXPORT_MCP=if-missing
66
+
67
+ # Optional - override static MCP export path.
68
+ # HIAI_OPENCODE_MCP_EXPORT_PATH=./.mcp.json
69
+
70
+ # Optional - CLI export safety mode.
71
+ # Values: safe (default), force
72
+ # HIAI_OPENCODE_EXPORT_MCP_MODE=safe
73
+
61
74
  # RAG MCP
62
75
 
63
76
  # 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,17 @@ 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`
118
+ - `EXA_API_KEY`
119
+ - `TAVILY_API_KEY`
114
120
  - `MEMPALACE_PYTHON`
115
121
  - `OPENCODE_RAG_URL`
116
122
  - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
117
123
  - `HIAI_MCP_AUTO_INSTALL`
118
124
  7. Verify with:
119
125
  - `opencode debug config`
126
+ - `hiai-opencode doctor`
127
+ - `hiai-opencode mcp-status`
128
+ - `hiai-opencode export-mcp .mcp.json` when static MCP visibility is needed
120
129
  - `opencode mcp list --print-logs --log-level INFO`
121
130
 
122
131
  ### MCP Setup Matrix
@@ -126,14 +135,17 @@ When a user asks OpenCode or another agent to finish installing this plugin, fol
126
135
  | `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
136
  | `sequential-thinking` | Node and npx are available | Helper launcher runs `@modelcontextprotocol/server-sequential-thinking` |
128
137
  | `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 |
138
+ | `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
139
  | `rag` | User has a local or remote RAG endpoint | Uses `OPENCODE_RAG_URL`, defaulting to `http://localhost:9002/tools/search` |
131
140
  | `stitch` | `STITCH_AI_API_KEY` is set | Remote MCP endpoint |
132
141
  | `context7` | User wants Context7 docs/search | Remote MCP endpoint; use `CONTEXT7_API_KEY` if available |
142
+ | `websearch` | User wants remote web search | Defaults to Exa; `EXA_API_KEY` optional for Exa, `TAVILY_API_KEY` required for Tavily |
143
+ | `grep_app` | User wants GitHub/code search | Remote MCP endpoint; no key required |
133
144
 
134
145
  Playwright troubleshooting rules:
135
146
 
136
- - If `skill_mcp` says `MCP server "playwright" not found`, first load the `playwright` skill and check `hiai-opencode mcp-status`; do not report this as a browser dependency failure.
147
+ - `skill_mcp` can call enabled hiai-opencode builtin MCPs and skill-embedded MCPs. If it reports a builtin MCP such as `firecrawl` as missing, check that the installed plugin version includes builtin fallback support and that `hiai-opencode.json` has that MCP enabled.
148
+ - If `skill_mcp` says `MCP server "playwright" not found`, first check `hiai-opencode mcp-status`; do not report this as a browser dependency failure.
137
149
  - If Chromium reports missing Linux libraries (`libnspr4`, `libnss3`, `libatk-bridge`, `libgtk-3`, etc.), explain that MCP is present but the host lacks browser system dependencies.
138
150
  - Without sudo, try a system browser override in `hiai-opencode.json`, such as `--browser chrome` or `--browser msedge`.
139
151
  - If no browser path works, use `curl` only as degraded HTTP verification and explicitly say it is not a replacement for browser testing.
@@ -155,14 +167,16 @@ Check which services can run here:
155
167
  - playwright: node/npx; optionally HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1.
156
168
  - sequential-thinking: node/npx.
157
169
  - 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.
170
+ - 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
171
  - rag: OPENCODE_RAG_URL or http://localhost:9002/tools/search.
160
172
  - stitch: STITCH_AI_API_KEY.
161
173
  - context7: optional CONTEXT7_API_KEY.
174
+ - websearch: optional EXA_API_KEY for Exa, or TAVILY_API_KEY when provider is tavily.
175
+ - grep_app: no key required.
162
176
 
163
177
  Report missing keys without printing secret values. Never invent or hardcode API keys.
164
178
 
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.
179
+ 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
180
  ```
167
181
 
168
182
  ## Expected Agent State
@@ -216,6 +230,7 @@ The runtime loader is:
216
230
  Users configure only the 10 primary agent model slots under `models`: `bob`, `coder`, `strategist`, `guard`, `critic`, `designer`, `researcher`, `manager`, `brainstormer`, and `vision`.
217
231
  Hidden agents and task categories are derived internally in `src/config/defaults.ts`.
218
232
  Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
233
+ When helping a user choose model IDs, tell them to connect providers in OpenCode, run `opencode models`, and copy the exact `provider/model-id` strings into `hiai-opencode.json`. Do not invent provider prefixes.
219
234
 
220
235
  ## Change Map
221
236
 
@@ -345,6 +360,41 @@ Current MCP set:
345
360
  - `websearch`
346
361
  - `grep_app`
347
362
 
363
+ ## Writing And Website Copy
364
+
365
+ Public-facing website/product copy is owned by `brainstormer`.
366
+ `writer`, `copywriter`, `content-writer`, and `website-writer` are aliases for `brainstormer`.
367
+
368
+ Use the `website-copywriting` skill for:
369
+
370
+ - landing pages
371
+ - hero sections
372
+ - CTA labels
373
+ - feature copy
374
+ - positioning and naming
375
+ - onboarding, empty states, and product microcopy
376
+
377
+ Preferred invocation:
378
+
379
+ ```text
380
+ task(subagent_type="brainstormer", load_skills=["website-copywriting"], run_in_background=false, description="Write landing page copy", prompt="...")
381
+ ```
382
+
383
+ Use `designer` or `visual-engineering` for visual direction. Use `brainstormer` for words.
384
+
385
+ ## Manager Memory Stewardship
386
+
387
+ Use `platform-manager` / `manager` when durable project memory or handoff state must stay current.
388
+
389
+ Manager owns:
390
+
391
+ - MemPalace decision hygiene: search first, deduplicate, write only durable decisions and important preferences.
392
+ - Architecture memory updates: when architecture changes, update MemPalace and sync to RAG only if the configured RAG endpoint exposes write/upsert capability.
393
+ - TODO hygiene: mark completed items complete, preserve unfinished tasks with blocker and next action, remove duplicate stale TODOs.
394
+ - Session continuity: write concise handoff ledgers, not raw transcripts.
395
+
396
+ Do not ask Manager to implement code. Use Coder for implementation and Manager for memory/task state.
397
+
348
398
  ## Skill Discovery Rules
349
399
 
350
400
  Default behavior is intentionally deterministic.
@@ -397,7 +447,8 @@ Common service keys:
397
447
  - `STITCH_AI_API_KEY`
398
448
  - `FIRECRAWL_API_KEY`
399
449
  - `CONTEXT7_API_KEY`
400
- - `GOOGLE_SEARCH_API_KEY`
450
+ - `EXA_API_KEY`
451
+ - `TAVILY_API_KEY`
401
452
  - `OLLAMA_BASE_URL`
402
453
  - `OLLAMA_MODEL`
403
454
  - `MEMPALACE_PYTHON`
@@ -405,6 +456,9 @@ Common service keys:
405
456
  - `OPENCODE_RAG_URL`
406
457
  - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
407
458
  - `HIAI_MCP_AUTO_INSTALL`
459
+ - `HIAI_OPENCODE_AUTO_EXPORT_MCP`
460
+ - `HIAI_OPENCODE_MCP_EXPORT_PATH`
461
+ - `HIAI_OPENCODE_EXPORT_MCP_MODE`
408
462
 
409
463
  ## Known Runtime Caveats
410
464
 
package/ARCHITECTURE.md CHANGED
@@ -89,10 +89,13 @@ Prompting is not a single file and not a single directory. `src/agents` is the m
89
89
  These files create the top-level agent config objects:
90
90
 
91
91
  - Bob: [src/agents/bob.ts](src/agents/bob.ts)
92
- - Coder: `src/agents/coder/agent.ts`
92
+ - Coder: [src/agents/coder/agent.ts](src/agents/coder/agent.ts)
93
93
  - Strategist: `src/agents/strategist/*`
94
- - Guard: `src/agents/guard/agent.ts`
95
- - Critic: `src/agents/critic/agent.ts`
94
+ - Guard: [src/agents/guard/agent.ts](src/agents/guard/agent.ts)
95
+ - Critic: [src/agents/critic/agent.ts](src/agents/critic/agent.ts)
96
+ - Designer: [src/agents/designer.ts](src/agents/designer.ts)
97
+ - Brainstormer: [src/agents/brainstormer.ts](src/agents/brainstormer.ts)
98
+ - Agent Skills: [src/agents/agent-skills.ts](src/agents/agent-skills.ts)
96
99
  - Vision: [src/agents/ui.ts](src/agents/ui.ts)
97
100
  - Manager: [src/agents/platform-manager.ts](src/agents/platform-manager.ts)
98
101
  - Researcher: [src/agents/researcher.ts](src/agents/researcher.ts)
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
@@ -1,5 +1,7 @@
1
1
  # hiai-opencode
2
2
 
3
+ [![CI](https://github.com/HiAi-gg/hiai-opencode/actions/workflows/ci.yml/badge.svg)](https://github.com/HiAi-gg/hiai-opencode/actions/workflows/ci.yml)
4
+
3
5
  `hiai-opencode` is an OpenCode plugin that wires together:
4
6
 
5
7
  - a curated multi-agent runtime
@@ -31,21 +33,47 @@ Keep OpenCode plugins separate from MCP servers. Do not add MCP server packages
31
33
 
32
34
  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
35
 
34
- Then run opencode debug config and opencode mcp list --print-logs --log-level INFO if available.
36
+ Then run `hiai-opencode doctor`, `hiai-opencode mcp-status`, and `opencode debug config`.
35
37
  ```
36
38
 
37
39
  For the full operator playbook, see [AGENTS.md](AGENTS.md). 🤖
38
40
 
41
+ ## Agents
42
+
43
+ | Agent | Role | When to use |
44
+ |-------|------|-------------|
45
+ | `Bob` | Orchestrator, router, distributor | Entry point; complex tasks needing multi-agent coordination |
46
+ | `Coder` | Deep implementation, focused execution | Complex features, refactors, deep work |
47
+ | `Sub` | Bounded cheap executor | Small targeted changes, quick fixes |
48
+ | `Strategist` | Planning, architecture, pre-check | Scope definition, architectural decisions |
49
+ | `Guard` | Final acceptor, workflow enforcer | Closure validation, output acceptance |
50
+ | `Critic` | Review gate, high-accuracy verification | Plan review, code review, regression catch |
51
+ | `Researcher` | Local + external search | Codebase exploration, documentation discovery |
52
+ | `Designer` | UI/visual, creative direction | Visual problems, UX decisions, branding |
53
+ | `Brainstormer` | Ideation, content, copy | Landing pages, CTA, feature copy, onboarding |
54
+ | `Vision` | Image/PDF/layout analysis | Visual inspection, multimodal interpretation |
55
+ | `Manager` | Memory, bootstrap, ledger | Durable state, session continuity, project init |
56
+
57
+ ## Modes (Task Routing)
58
+
59
+ Mode determines prompt append, variant, and reasoning effort. The executor agent is selected via `mode → agent` mapping.
60
+
61
+ | Mode | Agent | Prompt variant | When to use |
62
+ |------|-------|----------------|-------------|
63
+ | `quick` | `sub` | Fast bounded | Small targeted changes |
64
+ | `writing` | `brainstormer` | Docs/prose | Content, i18n, copy |
65
+ | `deep` | `coder` | Deep reasoning | Complex implementation |
66
+ | `ultrabrain` | `strategist` | Plan-only | Architecture, hard logic |
67
+ | `visual-engineering` | `designer` | UI/visual | Visual problems |
68
+ | `artistry` | `designer` | Creative | Brand, SEO, creative |
69
+ | `git` | `platform-manager` | Git ops | Version control operations |
70
+ | `bounded` | `sub` | Mid-tier bounded | Moderate effort changes |
71
+ | `cross-module` | `coder` | Deep substantial | Multi-component changes |
72
+
39
73
  ## What You Get
40
74
 
41
- - Visible primary agents: `Bob`, `Coder`, `Strategist`, `Guard`, `Critic`, `Designer`, `Researcher`, `Manager`, `Brainstormer`, `Vision`
42
- - Hidden system or compatibility agents: `Agent Skills`, `Sub`, `build`, `plan`
43
- - Task routing model:
44
- - category-based execution routes through `Coder`
45
- - `quick`, `writing`, and `unspecified-low` are the fast bounded Coder contour
46
- - `deep`, `ultrabrain`, `visual-engineering`, `artistry`, and `unspecified-high` are the deep Coder contour
47
- - `Critic` and `Researcher` are selected explicitly
48
- - `Designer`, `Brainstormer`, `Manager`, and `Vision` are direct callable specialists
75
+ - **10 visible primary agents** + **4 hidden system agents** (Agent Skills, Sub, build, plan)
76
+ - **Mode-based task routing** via `task(category=..., ...)` or `task(mode=..., ...)`
49
77
  - Skill materialization into OpenCode's `skills/` view
50
78
  - MCP wiring for `playwright`, `stitch`, `sequential-thinking`, `firecrawl`, `rag`, `mempalace`, `context7`, plus remote `websearch` and `grep_app`
51
79
  - LSP wiring for TypeScript, Svelte, Python, Bash, and ESLint
@@ -67,6 +95,8 @@ Optional, depending on which services you want:
67
95
  - `FIRECRAWL_API_KEY` for Firecrawl
68
96
  - `STITCH_AI_API_KEY` for Stitch
69
97
  - `CONTEXT7_API_KEY` for Context7
98
+ - `EXA_API_KEY` for higher Exa websearch limits
99
+ - `TAVILY_API_KEY` when `mcp.websearch.provider` is `tavily`
70
100
  - Python 3.9+ or `uv` for MemPalace
71
101
  - a running RAG endpoint if you enable `rag`
72
102
  - local language servers if you want LSP beyond the npm-bootstrapped helpers
@@ -121,22 +151,22 @@ If you installed only from npm/OpenCode and do not have this repository checked
121
151
  ```json
122
152
  {
123
153
  "models": {
124
- "bob": { "model": "openrouter/anthropic/claude-3.5-opus", "recommended": "xhigh" },
125
- "coder": { "model": "openrouter/anthropic/claude-3.5-sonnet", "recommended": "high" },
126
- "strategist": { "model": "openrouter/z-ai/glm-5.1", "recommended": "high" },
127
- "guard": { "model": "openrouter/openai/gpt-4o", "recommended": "middle" },
128
- "critic": { "model": "openrouter/qwen/qwen2.5-72b-instruct", "recommended": "high" },
129
- "designer": { "model": "openrouter/google/gemini-3.1-pro", "recommended": "design" },
130
- "researcher": { "model": "openrouter/google/gemini-2.0-flash", "recommended": "fast" },
131
- "manager": { "model": "openrouter/google/gemini-2.0-flash", "recommended": "fast" },
132
- "brainstormer": { "model": "openrouter/kimi/kimi-latest", "recommended": "writing" },
133
- "vision": { "model": "openrouter/google/gemini-3.1-pro", "recommended": "vision" }
154
+ "bob": { "model": "openrouter/moonshotai/kimi-k2.6", "recommended": "xhigh" },
155
+ "coder": { "model": "openrouter/minimax/minimax-m2.7", "recommended": "high" },
156
+ "strategist": { "model": "openrouter/anthropic/claude-opus-latest", "recommended": "high" },
157
+ "guard": { "model": "openrouter/qwen/qwen3.6-plus", "recommended": "middle" },
158
+ "critic": { "model": "openrouter/xiaomi/mimo-v2.5-pro", "recommended": "high" },
159
+ "designer": { "model": "openrouter/google/gemini-3.1-pro-preview", "recommended": "design" },
160
+ "researcher": { "model": "openrouter/deepseek/deepseek-v4-flash", "recommended": "fast" },
161
+ "manager": { "model": "openrouter/qwen/qwen3.5-9b", "recommended": "fast" },
162
+ "brainstormer": { "model": "openrouter/mistralai/mistral-small-2603", "recommended": "writing" },
163
+ "vision": { "model": "openrouter/google/gemma-4-26b-a4b-it", "recommended": "vision" }
134
164
  },
135
165
  "mcp": {
136
166
  "playwright": { "enabled": true },
137
167
  "sequential-thinking": { "enabled": true },
138
168
  "firecrawl": { "enabled": true },
139
- "mempalace": { "enabled": true },
169
+ "mempalace": { "enabled": true, "pythonPath": "{env:MEMPALACE_PYTHON:-./.venv/bin/python}" },
140
170
  "rag": { "enabled": false },
141
171
  "stitch": { "enabled": false },
142
172
  "context7": { "enabled": true }
@@ -153,10 +183,19 @@ This plugin only reads the 10 model IDs in `models`. Internal routing derives hi
153
183
 
154
184
  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:
155
185
 
186
+ ```bash
187
+ opencode models
188
+ ```
189
+
190
+ Use the exact model IDs printed by OpenCode in `hiai-opencode.json`. For example, `openrouter/minimax/minimax-m2.7` routes through OpenRouter, while `minimax/minimax-m2.7` routes through a direct Minimax provider only if that provider is connected in OpenCode.
191
+
156
192
  ```bash
157
193
  export FIRECRAWL_API_KEY=...
158
194
  export STITCH_AI_API_KEY=...
159
195
  export CONTEXT7_API_KEY=...
196
+ export EXA_API_KEY=...
197
+ # or, if mcp.websearch.provider is "tavily":
198
+ export TAVILY_API_KEY=...
160
199
  ```
161
200
 
162
201
  See [Environment Variables And Keys](#environment-variables-and-keys) for the full list.
@@ -165,15 +204,19 @@ See [Environment Variables And Keys](#environment-variables-and-keys) for the fu
165
204
 
166
205
  ```bash
167
206
  opencode
207
+ hiai-opencode doctor
168
208
  hiai-opencode mcp-status
209
+ hiai-opencode export-mcp .mcp.json
169
210
  opencode debug config
170
211
  opencode mcp list --print-logs --log-level INFO
171
212
  ```
172
213
 
173
- `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.
214
+ `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.
174
215
 
175
216
  `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.
176
217
 
218
+ `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.
219
+
177
220
  ## Development Install
178
221
 
179
222
  Direct npm install is only needed for development or inspection:
@@ -210,7 +253,7 @@ Enable only services that can run on this machine:
210
253
  - playwright: requires node/npx; optionally set HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1 before first run if browser binaries are needed.
211
254
  - sequential-thinking: requires node/npx.
212
255
  - firecrawl: requires FIRECRAWL_API_KEY.
213
- - 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.
256
+ - 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.
214
257
  - rag: requires OPENCODE_RAG_URL or a running local endpoint at http://localhost:9002/tools/search.
215
258
  - stitch: requires STITCH_AI_API_KEY.
216
259
  - context7: works without a key but use CONTEXT7_API_KEY if available.
@@ -219,6 +262,8 @@ Check .env.example, report missing keys without printing secret values, and neve
219
262
 
220
263
  Run verification commands where available:
221
264
  - opencode debug config
265
+ - hiai-opencode mcp-status
266
+ - hiai-opencode export-mcp .mcp.json
222
267
  - opencode mcp list --print-logs --log-level INFO
223
268
 
224
269
  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.
@@ -239,6 +284,7 @@ Runtime loader for the bundled canonical config:
239
284
  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.
240
285
 
241
286
  Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
287
+ After connecting providers in OpenCode, run `opencode models` and copy the exact model IDs from that output into `hiai-opencode.json`.
242
288
 
243
289
  ### Prompting
244
290
 
@@ -257,6 +303,7 @@ Important prompt entrypoints:
257
303
  - `Vision`: [src/agents/ui.ts](src/agents/ui.ts)
258
304
  - `Manager`: [src/agents/platform-manager.ts](src/agents/platform-manager.ts)
259
305
  - `Researcher`: [src/agents/researcher.ts](src/agents/researcher.ts)
306
+ - `Brainstormer` / `Writer`: [src/agents/brainstormer.ts](src/agents/brainstormer.ts)
260
307
 
261
308
  Name mapping and visibility:
262
309
 
@@ -273,6 +320,22 @@ Skill materialization logic:
273
320
 
274
321
  - [src/features/builtin-skills/materialize.ts](src/features/builtin-skills/materialize.ts)
275
322
 
323
+ Built-in helper skills include browser automation, frontend UI/UX, review, git workflow, hiai-opencode setup, AI slop cleanup, and `website-copywriting`.
324
+
325
+ Website/product copy should use:
326
+
327
+ ```text
328
+ task(subagent_type="brainstormer", load_skills=["website-copywriting"], ...)
329
+ ```
330
+
331
+ `writer`, `copywriter`, and `content-writer` are aliases for `brainstormer`.
332
+
333
+ Manager memory stewardship:
334
+
335
+ - Use `task(subagent_type="platform-manager", ...)` or `task(subagent_type="manager", ...)` for MemPalace cleanup, session ledgers, TODO hygiene, and architecture decision handoff.
336
+ - Manager writes only durable decisions and important project state. It should not dump raw chat logs into memory.
337
+ - RAG is retrieval-first by default; Manager syncs architecture summaries to RAG only when the configured endpoint exposes write/upsert capability.
338
+
276
339
  Skill discovery defaults:
277
340
 
278
341
  ```json
@@ -321,7 +384,8 @@ Important service variables:
321
384
  - `STITCH_AI_API_KEY`
322
385
  - `FIRECRAWL_API_KEY`
323
386
  - `CONTEXT7_API_KEY`
324
- - `GOOGLE_SEARCH_API_KEY`
387
+ - `EXA_API_KEY`
388
+ - `TAVILY_API_KEY`
325
389
  - `OLLAMA_BASE_URL`
326
390
  - `OLLAMA_MODEL`
327
391
  - `MEMPALACE_PYTHON`
@@ -329,6 +393,8 @@ Important service variables:
329
393
  - `OPENCODE_RAG_URL`
330
394
  - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
331
395
  - `HIAI_MCP_AUTO_INSTALL`
396
+ - `HIAI_OPENCODE_AUTO_EXPORT_MCP`
397
+ - `HIAI_OPENCODE_MCP_EXPORT_PATH`
332
398
 
333
399
  Optional headless or non-Connect fallback variables are documented in [.env.example](.env.example), but they are not required for normal OpenCode model auth.
334
400
 
@@ -342,7 +408,9 @@ The user-facing MCP switchboard is the `mcp` object in `hiai-opencode.json`:
342
408
  {
343
409
  "mcp": {
344
410
  "playwright": { "enabled": true },
345
- "mempalace": { "enabled": false }
411
+ "mempalace": { "enabled": false },
412
+ "websearch": { "enabled": true, "provider": "exa" },
413
+ "grep_app": { "enabled": true }
346
414
  }
347
415
  }
348
416
  ```
@@ -353,7 +421,7 @@ The source of truth for default MCP wiring is `src/mcp/registry.ts`. Change that
353
421
 
354
422
  - `stitch`
355
423
  - `context7`
356
- - `websearch`
424
+ - `websearch`: defaults to Exa remote MCP. `EXA_API_KEY` is optional for Exa; set `"provider": "tavily"` and `TAVILY_API_KEY` to use Tavily.
357
425
  - `grep_app`
358
426
 
359
427
  ### Works with local helper bootstrap
@@ -393,7 +461,7 @@ If sudo is not available:
393
461
 
394
462
  ### Needs upstream runtime or extra setup
395
463
 
396
- - `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.
464
+ - `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.
397
465
  - `rag`: requires your own running endpoint
398
466
 
399
467
  ### Important Windows note
@@ -415,12 +483,26 @@ The plugin now emits startup warnings for common misconfiguration, including:
415
483
  Available CLI:
416
484
 
417
485
  ```bash
486
+ hiai-opencode doctor
418
487
  hiai-opencode mcp-status
488
+ hiai-opencode export-mcp .mcp.json
489
+ ```
490
+
491
+ 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:
492
+
493
+ ```bash
494
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=if-missing # default
495
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=always # overwrite only managed hiai-opencode exports
496
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=force # force overwrite even non-managed files
497
+ export HIAI_OPENCODE_AUTO_EXPORT_MCP=0 # disable auto-export
498
+ export HIAI_OPENCODE_MCP_EXPORT_PATH=.mcp.json # override path
499
+ export HIAI_OPENCODE_EXPORT_MCP_MODE=safe # export-mcp command mode: safe|force
419
500
  ```
420
501
 
421
502
  Inside OpenCode, use the slash command:
422
503
 
423
504
  ```text
505
+ /doctor
424
506
  /mcp-status
425
507
  ```
426
508
 
@@ -435,14 +517,13 @@ MCP Servers:
435
517
  ⚠️ stitch - enabled, API key missing (STITCH_AI_API_KEY)
436
518
  ```
437
519
 
438
- Planned follow-up commands:
520
+ `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.
439
521
 
440
- - `hiai-opencode doctor`: report config location, MCP status, missing keys, and local dependency checks.
441
- - `hiai-opencode export-mcp`: generate a standard `.mcp.json` for hosts that do not expose plugin-provided MCP servers through `opencode mcp list`.
442
-
443
- Until those commands ship, use:
522
+ Use:
444
523
 
445
524
  ```bash
525
+ hiai-opencode mcp-status
526
+ hiai-opencode export-mcp .mcp.json
446
527
  opencode debug config
447
528
  opencode mcp list --print-logs --log-level INFO
448
529
  ```
@@ -464,7 +545,6 @@ opencode mcp list --print-logs --log-level INFO
464
545
  | Sequential Thinking | [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) | external MCP |
465
546
  | Firecrawl MCP | [firecrawl-ai/firecrawl-mcp-server](https://github.com/firecrawl-ai/firecrawl-mcp-server) | external MCP |
466
547
  | Context7 MCP | [upstash/context7-mcp](https://github.com/upstash/context7-mcp) | external MCP |
467
- | Websearch cited | [ghoulr/opencode-websearch-cited](https://github.com/ghoulr/opencode-websearch-cited) | search integration influence |
468
548
  | bun-pty / PTY ecosystem | [shekohex/opencode-pty](https://github.com/shekohex/opencode-pty) | PTY/runtime integration influence |
469
549
 
470
550
  ## Build And Publish
@@ -492,7 +572,7 @@ Before publishing:
492
572
  1. run `bun run build`
493
573
  2. run `npm pack --dry-run`
494
574
  3. verify `debug config`
495
- 4. verify `mcp list`
575
+ 4. run `hiai-opencode export-mcp .mcp.json` if you need static `mcp list` visibility
496
576
 
497
577
  Publish:
498
578