@hiai-gg/hiai-opencode 0.1.2 → 0.1.4

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 (58) hide show
  1. package/.env.example +28 -21
  2. package/AGENTS.md +183 -28
  3. package/ARCHITECTURE.md +17 -20
  4. package/LICENSE.md +1 -0
  5. package/README.md +269 -66
  6. package/assets/cli/hiai-opencode.mjs +276 -0
  7. package/assets/mcp/mempalace.mjs +47 -4
  8. package/assets/mcp/playwright.mjs +83 -0
  9. package/config/hiai-opencode.schema.json +113 -1
  10. package/dist/config/index.d.ts +0 -1
  11. package/dist/config/platform-schema.d.ts +72 -0
  12. package/dist/config/schema/agent-overrides.d.ts +256 -0
  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/index.d.ts +2 -0
  16. package/dist/config/schema/oh-my-opencode-config.d.ts +267 -0
  17. package/dist/config/schema/skill-discovery.d.ts +11 -0
  18. package/dist/config/types.d.ts +12 -1
  19. package/dist/features/builtin-commands/templates/mcp-status.d.ts +1 -0
  20. package/dist/features/builtin-commands/types.d.ts +1 -1
  21. package/dist/features/opencode-skill-loader/loader.d.ts +2 -0
  22. package/dist/index.js +617 -421
  23. package/dist/mcp/registry.d.ts +14 -0
  24. package/dist/mcp/types.d.ts +6 -0
  25. package/dist/plugin/skill-discovery-config.d.ts +4 -0
  26. package/dist/shared/startup-diagnostics.d.ts +6 -0
  27. package/hiai-opencode.json +192 -36
  28. package/package.json +4 -1
  29. package/src/agents/AGENTS.md +3 -4
  30. package/src/config/defaults.ts +55 -133
  31. package/src/config/index.ts +0 -1
  32. package/src/config/loader.ts +4 -1
  33. package/src/config/platform-schema.ts +18 -2
  34. package/src/config/schema/agent-overrides.ts +2 -0
  35. package/src/config/schema/commands.ts +1 -0
  36. package/src/config/schema/fast-apply.ts +4 -4
  37. package/src/config/schema/index.ts +2 -0
  38. package/src/config/schema/oh-my-opencode-config.ts +3 -0
  39. package/src/config/schema/skill-discovery.ts +25 -0
  40. package/src/config/types.ts +16 -0
  41. package/src/features/builtin-commands/commands.ts +7 -0
  42. package/src/features/builtin-commands/templates/mcp-status.ts +36 -0
  43. package/src/features/builtin-commands/types.ts +1 -1
  44. package/src/features/builtin-skills/skills/playwright.ts +24 -2
  45. package/src/features/opencode-skill-loader/loader.ts +11 -0
  46. package/src/index.ts +15 -13
  47. package/src/mcp/index.ts +0 -33
  48. package/src/mcp/omo-mcp-index.ts +0 -5
  49. package/src/mcp/registry.ts +132 -0
  50. package/src/mcp/types.ts +11 -1
  51. package/src/plugin/hooks/create-tool-guard-hooks.ts +1 -1
  52. package/src/plugin/skill-context.ts +31 -13
  53. package/src/plugin/skill-discovery-config.ts +32 -0
  54. package/src/plugin-handlers/agent-config-handler.ts +20 -13
  55. package/src/plugin-handlers/command-config-handler.ts +22 -12
  56. package/src/shared/migration/agent-names.ts +5 -5
  57. package/src/shared/startup-diagnostics.ts +77 -0
  58. package/src/config/models.ts +0 -32
package/.env.example CHANGED
@@ -2,29 +2,22 @@
2
2
  # Copy this file to .env and fill in your values.
3
3
  # All keys are optional unless noted.
4
4
 
5
- # Core Model Provider (REQUIRED for default presets)
6
-
7
- # Required if using OpenRouter (the default provider for most agents)
8
- OPENROUTER_API_KEY=your_openrouter_api_key_here
9
-
10
- # Alternative Direct Provider Keys
11
-
12
- # Optional - needed only if using OpenAI models directly (not via OpenRouter)
5
+ # Model Provider Credentials
6
+ #
7
+ # Configure model provider credentials with OpenCode Connect.
8
+ # hiai-opencode only stores model IDs such as:
9
+ # - openrouter/anthropic/claude-3.5-sonnet
10
+ # - openai/gpt-4.1
11
+ # - anthropic/claude-3-5-sonnet-latest
12
+ #
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
13
16
  # OPENAI_API_KEY=your_openai_api_key_here
14
-
15
- # Optional - needed only if using Anthropic models directly (not via OpenRouter)
16
17
  # ANTHROPIC_API_KEY=your_anthropic_api_key_here
17
-
18
- # Optional - DeepSeek models
19
18
  # DEEPSEEK_API_KEY=your_deepseek_api_key_here
20
-
21
- # Optional - GLM models via OpenRouter
22
19
  # GLM_API_KEY=your_glm_api_key_here
23
-
24
- # Optional - MiniMax models via OpenRouter
25
20
  # MINIMAX_API_KEY=your_minimax_api_key_here
26
-
27
- # Optional - Qwen models via OpenRouter
28
21
  # QWEN_API_KEY=your_qwen_api_key_here
29
22
 
30
23
  # MCP Service Keys
@@ -32,7 +25,7 @@ OPENROUTER_API_KEY=your_openrouter_api_key_here
32
25
  # Optional - Stitch AI remote MCP service
33
26
  # STITCH_AI_API_KEY=your_stitch_api_key_here
34
27
 
35
- # Optional - Firecrawl web scraping MCP (npx -y firecrawl-mcp)
28
+ # Optional - Firecrawl web scraping MCP
36
29
  # FIRECRAWL_API_KEY=your_firecrawl_api_key_here
37
30
 
38
31
  # Optional - Context7 code search MCP
@@ -51,7 +44,21 @@ OPENROUTER_API_KEY=your_openrouter_api_key_here
51
44
  # Optional - Python command for MemPalace MCP (python3, python, or full path)
52
45
  # MEMPALACE_PYTHON=python3
53
46
 
47
+ # Optional - custom MemPalace data directory
48
+ # MEMPALACE_PALACE_PATH=./.opencode/palace
49
+
50
+ # Optional - set to 0, false, or no to prevent first-run Python package install
51
+ # HIAI_MCP_AUTO_INSTALL=1
52
+
53
+ # Playwright MCP
54
+
55
+ # Optional - set to 1, true, or yes to install Chromium during launcher startup
56
+ # HIAI_PLAYWRIGHT_INSTALL_BROWSERS=0
57
+
58
+ # Optional - if Linux system browser deps cannot be installed, edit hiai-opencode.json
59
+ # and add Playwright MCP args such as "--browser", "chrome" to use an existing browser.
60
+
54
61
  # RAG MCP
55
62
 
56
- # Optional - RAG endpoint URL (default: http://localhost:9002)
57
- # RAG_ENDPOINT=http://localhost:9002
63
+ # Optional - RAG search tool endpoint
64
+ # OPENCODE_RAG_URL=http://localhost:9002/tools/search
package/AGENTS.md CHANGED
@@ -4,7 +4,9 @@ This file is for autonomous agents or tooling that need to install, configure, v
4
4
 
5
5
  ## Purpose
6
6
 
7
- `hiai-opencode` is an OpenCode plugin repository published as `@hiai-gg/hiai-opencode`. It is not a standalone app. The normal workflow is:
7
+ `hiai-opencode` is an OpenCode plugin repository published as `@hiai-gg/hiai-opencode`. It is not a standalone app. It wires OpenCode agents, prompts, skills, MCP server launch commands, LSP defaults, and compatibility behavior around external upstream tools. Do not describe MCP servers, skills, model providers, or auxiliary OpenCode plugins as owned by this repository.
8
+
9
+ The normal workflow is:
8
10
 
9
11
  1. install it through OpenCode or build it locally
10
12
  2. register `@hiai-gg/hiai-opencode` in OpenCode
@@ -15,7 +17,19 @@ This file is for autonomous agents or tooling that need to install, configure, v
15
17
 
16
18
  ### Native OpenCode Install
17
19
 
18
- Add the package name to OpenCode config. OpenCode installs npm plugins automatically at startup.
20
+ Use the OpenCode plugin CLI:
21
+
22
+ ```bash
23
+ opencode plugin @hiai-gg/hiai-opencode@latest --global
24
+ ```
25
+
26
+ Optional Dynamic Context Pruning plugin:
27
+
28
+ ```bash
29
+ opencode plugin @tarquinen/opencode-dcp@latest --global
30
+ ```
31
+
32
+ Manual alternative:
19
33
 
20
34
  ```json
21
35
  {
@@ -33,7 +47,13 @@ bun run build
33
47
 
34
48
  ### Register In OpenCode
35
49
 
36
- Add this to OpenCode config:
50
+ Use the plugin CLI:
51
+
52
+ ```bash
53
+ opencode plugin @hiai-gg/hiai-opencode@latest --global
54
+ ```
55
+
56
+ Manual alternative:
37
57
 
38
58
  ```json
39
59
  {
@@ -49,6 +69,102 @@ opencode debug config
49
69
  opencode mcp list --print-logs --log-level INFO
50
70
  ```
51
71
 
72
+ ## Post-Install Bootstrap Instructions
73
+
74
+ When a user asks OpenCode or another agent to finish installing this plugin, follow this procedure.
75
+
76
+ ### Operating Rules
77
+
78
+ - Keep OpenCode plugins separate from MCP servers.
79
+ - Register `@hiai-gg/hiai-opencode` as an OpenCode plugin.
80
+ - Register `@tarquinen/opencode-dcp` only when the user wants Dynamic Context Pruning; it is a separate OpenCode plugin.
81
+ - Do not add MCP server npm packages to the OpenCode `plugin` array.
82
+ - Use `hiai-opencode.json` as the project-level service switchboard.
83
+ - Use `src/mcp/registry.ts` as the source of truth for default MCP launch wiring.
84
+ - Keep skill discovery deterministic by default: packaged plugin skills, generated builtin skills, explicit config sources, and project `.opencode/skills`.
85
+ - Do not enable global OpenCode, Claude, or Agents skill folders unless the user explicitly asks.
86
+ - Use `.env.example` as the key template, but never print, invent, commit, or hardcode secret values.
87
+ - Prefer user-level or project-local installs. Do not use sudo/admin rights unless the user explicitly asks.
88
+
89
+ ### Bootstrap Checklist
90
+
91
+ 1. Check tool availability:
92
+ - `opencode --version`
93
+ - `node --version`
94
+ - `npx --version`
95
+ - `bun --version`
96
+ - `python --version` or `python3 --version`
97
+ - `uv --version` when available
98
+ 2. Check plugin registration with `opencode debug config`.
99
+ 3. Find or create `hiai-opencode.json` in the project root or `.opencode/`.
100
+ 4. Configure the `mcp` object there. Disable services that cannot run on the host.
101
+ 5. Keep `skill_discovery` clean unless the user opts into external folders:
102
+ - `config_sources: true`
103
+ - `project_opencode: true`
104
+ - `global_opencode: false`
105
+ - `project_claude: false`
106
+ - `global_claude: false`
107
+ - `project_agents: false`
108
+ - `global_agents: false`
109
+ 6. Check environment variables without printing values:
110
+ - `FIRECRAWL_API_KEY`
111
+ - `STITCH_AI_API_KEY`
112
+ - `CONTEXT7_API_KEY`
113
+ - `GOOGLE_SEARCH_API_KEY`
114
+ - `MEMPALACE_PYTHON`
115
+ - `OPENCODE_RAG_URL`
116
+ - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
117
+ - `HIAI_MCP_AUTO_INSTALL`
118
+ 7. Verify with:
119
+ - `opencode debug config`
120
+ - `opencode mcp list --print-logs --log-level INFO`
121
+
122
+ ### MCP Setup Matrix
123
+
124
+ | Service | Enable when | Dependency behavior |
125
+ |---|---|---|
126
+ | `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
+ | `sequential-thinking` | Node and npx are available | Helper launcher runs `@modelcontextprotocol/server-sequential-thinking` |
128
+ | `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 |
130
+ | `rag` | User has a local or remote RAG endpoint | Uses `OPENCODE_RAG_URL`, defaulting to `http://localhost:9002/tools/search` |
131
+ | `stitch` | `STITCH_AI_API_KEY` is set | Remote MCP endpoint |
132
+ | `context7` | User wants Context7 docs/search | Remote MCP endpoint; use `CONTEXT7_API_KEY` if available |
133
+
134
+ Playwright troubleshooting rules:
135
+
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.
137
+ - 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
+ - Without sudo, try a system browser override in `hiai-opencode.json`, such as `--browser chrome` or `--browser msedge`.
139
+ - If no browser path works, use `curl` only as degraded HTTP verification and explicitly say it is not a replacement for browser testing.
140
+
141
+ ### Prompt For OpenCode Users
142
+
143
+ Users can paste this into OpenCode after installing the plugin:
144
+
145
+ ```text
146
+ Finish hiai-opencode setup in this workspace.
147
+
148
+ Keep OpenCode plugins separate from MCP servers. Do not add MCP server packages to the OpenCode plugin list.
149
+
150
+ Verify @hiai-gg/hiai-opencode is registered. If I ask for Dynamic Context Pruning, install @tarquinen/opencode-dcp as a separate OpenCode plugin.
151
+
152
+ Find or create hiai-opencode.json in the project root or .opencode/. Use its mcp object as the only switchboard for MCP enable/disable.
153
+
154
+ Check which services can run here:
155
+ - playwright: node/npx; optionally HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1.
156
+ - sequential-thinking: node/npx.
157
+ - 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.
159
+ - rag: OPENCODE_RAG_URL or http://localhost:9002/tools/search.
160
+ - stitch: STITCH_AI_API_KEY.
161
+ - context7: optional CONTEXT7_API_KEY.
162
+
163
+ Report missing keys without printing secret values. Never invent or hardcode API keys.
164
+
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.
166
+ ```
167
+
52
168
  ## Expected Agent State
53
169
 
54
170
  Visible primary agents:
@@ -89,18 +205,15 @@ If runtime output differs from that set, inspect:
89
205
 
90
206
  ## Model Configuration
91
207
 
92
- There are two sources of truth:
208
+ There is one source of truth for model IDs:
93
209
 
94
- 1. shared presets and guidance:
95
- - [src/config/models.ts](src/config/models.ts)
96
- 2. actual runtime defaults:
97
- - [src/config/defaults.ts](src/config/defaults.ts)
210
+ - [hiai-opencode.json](hiai-opencode.json)
98
211
 
99
- The example override file is:
212
+ The runtime loader is:
100
213
 
101
- - [hiai-opencode.json](hiai-opencode.json)
214
+ - [src/config/defaults.ts](src/config/defaults.ts)
102
215
 
103
- Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast` or `sonnet`.
216
+ Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
104
217
 
105
218
  ## Change Map
106
219
 
@@ -108,10 +221,9 @@ Use this table when you need to change something and want the right file immedia
108
221
 
109
222
  | Goal | Edit this first | Why |
110
223
  |---|---|---|
111
- | Change shared preset values like `fast`, `mid`, `high`, `vision`, `reasoning` | [src/config/models.ts](src/config/models.ts) | This is the shared preset map |
112
- | Change which default model an agent uses | [src/config/defaults.ts](src/config/defaults.ts) | This is the runtime default assignment layer |
113
- | Change which default model a category uses | [src/config/defaults.ts](src/config/defaults.ts) | Categories are assigned there |
114
- | Change provider/model guidance shown to maintainers | [src/config/models.ts](src/config/models.ts) | That file holds provider rules and role guidance |
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 |
115
227
  | Change Bob behavior or prompt text | [src/agents/bob.ts](src/agents/bob.ts), `src/agents/bob/*` | Bob prompt authoring lives there |
116
228
  | Change Coder behavior or prompt text | `src/agents/coder/*` | Coder prompt authoring lives there |
117
229
  | Change Strategist behavior or prompt text | `src/agents/strategist/*` | Strategist prompt authoring lives there |
@@ -129,8 +241,10 @@ Use this table when you need to change something and want the right file immedia
129
241
  | Change closure protocol appended to prompts | [src/shared/closure-protocol.ts](src/shared/closure-protocol.ts) | It is injected after prompt construction |
130
242
  | Change prompt override / prompt_append behavior | `src/agents/builtin-agents/agent-overrides.ts` | Override merge logic lives there |
131
243
  | Change environment context appended to prompts | `src/agents/builtin-agents/environment-context.ts` | Runtime environment prompt injection lives there |
132
- | Change MCP defaults | [src/config/defaults.ts](src/config/defaults.ts) | Default MCP definitions live there |
133
- | Change fallback packaged MCP behavior | [src/mcp/index.ts](src/mcp/index.ts) | Packaged MCP assembly lives there |
244
+ | Change skill discovery source defaults | [src/config/schema/skill-discovery.ts](src/config/schema/skill-discovery.ts), [src/plugin/skill-discovery-config.ts](src/plugin/skill-discovery-config.ts) | Controls opt-in external skill folders |
245
+ | Change skill source loading behavior | [src/plugin/skill-context.ts](src/plugin/skill-context.ts), [src/plugin-handlers/command-config-handler.ts](src/plugin-handlers/command-config-handler.ts) | Skills and skill-backed commands must stay aligned |
246
+ | Change MCP defaults | [src/mcp/registry.ts](src/mcp/registry.ts) | Default MCP wiring lives there |
247
+ | Change OpenCode MCP assembly | [src/mcp/index.ts](src/mcp/index.ts) | Final MCP config assembly lives there |
134
248
  | Change local MCP helper launcher logic | `assets/mcp/*` | Runtime launcher scripts live there |
135
249
  | Change npm bootstrap behavior for MCP/LSP tools | [assets/runtime/npm-package-runner.mjs](assets/runtime/npm-package-runner.mjs) | Shared npm bootstrap logic lives there |
136
250
  | Change LSP defaults | [src/config/defaults.ts](src/config/defaults.ts) | LSP defaults live there |
@@ -204,11 +318,11 @@ So:
204
318
 
205
319
  ## MCP Rules
206
320
 
207
- Default MCP definitions live in:
321
+ Default MCP wiring lives in:
208
322
 
209
- - [src/config/defaults.ts](src/config/defaults.ts)
323
+ - [src/mcp/registry.ts](src/mcp/registry.ts)
210
324
 
211
- Fallback/packaged MCP assembly lives in:
325
+ OpenCode MCP config assembly lives in:
212
326
 
213
327
  - [src/mcp/index.ts](src/mcp/index.ts)
214
328
 
@@ -229,25 +343,66 @@ Current MCP set:
229
343
  - `websearch`
230
344
  - `grep_app`
231
345
 
346
+ ## Skill Discovery Rules
347
+
348
+ Default behavior is intentionally deterministic.
349
+
350
+ Enabled by default:
351
+
352
+ - packaged `hiai-opencode` skill definitions mirrored into OpenCode's skill view
353
+ - generated builtin helper skills
354
+ - explicit `skills.sources` entries
355
+ - project-local `.opencode/skills` and `.opencode/skill`
356
+
357
+ Disabled by default:
358
+
359
+ - global OpenCode skills
360
+ - project and global Claude skills
361
+ - project and global Agents skills
362
+
363
+ Opt-in example:
364
+
365
+ ```json
366
+ {
367
+ "skill_discovery": {
368
+ "global_opencode": true,
369
+ "project_claude": true,
370
+ "global_claude": false,
371
+ "project_agents": false,
372
+ "global_agents": false
373
+ }
374
+ }
375
+ ```
376
+
377
+ Use `skills.disable` for noisy individual skills:
378
+
379
+ ```json
380
+ {
381
+ "skills": {
382
+ "disable": ["claude-md-management"]
383
+ }
384
+ }
385
+ ```
386
+
232
387
  ## Environment Variables
233
388
 
234
389
  Use [.env.example](.env.example) as the canonical key template for local setup and release checks.
235
390
 
236
- Common keys:
391
+ Model provider credentials are configured through OpenCode Connect. Do not ask users to put `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, or `ANTHROPIC_API_KEY` into `hiai-opencode.json` for normal model usage. The plugin stores model IDs only.
392
+
393
+ Common service keys:
237
394
 
238
- - `OPENROUTER_API_KEY`
239
- - `OPENAI_API_KEY`
240
- - `ANTHROPIC_API_KEY`
241
- - `DEEPSEEK_API_KEY`
242
- - `GLM_API_KEY`
243
- - `MINIMAX_API_KEY`
244
- - `QWEN_API_KEY`
245
395
  - `STITCH_AI_API_KEY`
246
396
  - `FIRECRAWL_API_KEY`
247
397
  - `CONTEXT7_API_KEY`
398
+ - `GOOGLE_SEARCH_API_KEY`
248
399
  - `OLLAMA_BASE_URL`
249
400
  - `OLLAMA_MODEL`
250
401
  - `MEMPALACE_PYTHON`
402
+ - `MEMPALACE_PALACE_PATH`
403
+ - `OPENCODE_RAG_URL`
404
+ - `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
405
+ - `HIAI_MCP_AUTO_INSTALL`
251
406
 
252
407
  ## Known Runtime Caveats
253
408
 
package/ARCHITECTURE.md CHANGED
@@ -14,7 +14,7 @@ The plugin has five main layers:
14
14
 
15
15
  ## Repository Layout
16
16
 
17
- - [src/config](src/config): schemas, types, model presets, default wiring
17
+ - [src/config](src/config): schemas, types, and bundled config loading
18
18
  - [src/agents](src/agents): agent factories, prompts, and prompt helpers
19
19
  - [src/plugin-handlers](src/plugin-handlers): runtime config assembly into OpenCode shape
20
20
  - [src/features](src/features): loaders, materializers, bridges, and supporting runtime features
@@ -62,19 +62,13 @@ Runtime naming, visibility, and compatibility are normalized through:
62
62
 
63
63
  ### Presets
64
64
 
65
- Shared presets and provider guidance live in:
65
+ Agent and category model IDs live in one place:
66
66
 
67
- - [src/config/models.ts](src/config/models.ts)
68
-
69
- This file defines:
70
-
71
- - `MODEL_PRESETS`
72
- - `MODEL_ROLE_GUIDE`
73
- - `PROVIDER_MODEL_RULES`
67
+ - [hiai-opencode.json](hiai-opencode.json)
74
68
 
75
69
  ### Runtime Defaults
76
70
 
77
- Actual default agent/category assignments live in:
71
+ The TypeScript defaults loader only reads the bundled canonical config:
78
72
 
79
73
  - [src/config/defaults.ts](src/config/defaults.ts)
80
74
 
@@ -164,8 +158,7 @@ If a prompt change looks correct in source but does not show up correctly in Ope
164
158
 
165
159
  Use these rules when editing the prompt layer:
166
160
 
167
- - change `src/config/models.ts` when the preset map itself should change
168
- - change `src/config/defaults.ts` when default model assignment should change
161
+ - change `hiai-opencode.json` when any default model assignment should change
169
162
  - change `src/agents/*` when the prompt content or behavior should change
170
163
  - change shared prompt/injection files when the prompt is being appended or normalized after agent construction
171
164
  - change `src/plugin-handlers/agent-config-handler.ts` when runtime name, visibility, mode, or final description should change
@@ -187,25 +180,29 @@ The final runtime prompt can also be affected by:
187
180
 
188
181
  ## Skills
189
182
 
190
- Two skill sources are combined:
183
+ Two skill sources are wired into OpenCode:
191
184
 
192
- - project skills shipped in [skills](skills)
193
- - built-in skills materialized into the OpenCode-visible skill tree
185
+ - project skill definitions in [skills](skills)
186
+ - skill materialization into the OpenCode-visible skill tree
194
187
 
195
188
  Relevant files:
196
189
 
197
190
  - [src/features/builtin-skills/materialize.ts](src/features/builtin-skills/materialize.ts)
198
191
  - [src/features/opencode-skill-loader](src/features/opencode-skill-loader)
192
+ - [src/config/schema/skill-discovery.ts](src/config/schema/skill-discovery.ts)
193
+ - [src/plugin/skill-discovery-config.ts](src/plugin/skill-discovery-config.ts)
194
+
195
+ Default discovery is deterministic: packaged plugin skills, generated builtin skills, explicit config sources, and project `.opencode/skills`. Global OpenCode, Claude, and Agents skill folders are opt-in.
199
196
 
200
197
  ## MCP
201
198
 
202
199
  ### Definitions
203
200
 
204
- Default MCP definitions are in:
201
+ Default MCP wiring is in:
205
202
 
206
- - [src/config/defaults.ts](src/config/defaults.ts)
203
+ - [src/mcp/registry.ts](src/mcp/registry.ts)
207
204
 
208
- Fallback assembly for packaged MCP support is in:
205
+ OpenCode MCP config assembly is in:
209
206
 
210
207
  - [src/mcp/index.ts](src/mcp/index.ts)
211
208
 
@@ -273,8 +270,8 @@ Avoid adding more root docs unless they serve a genuinely new role.
273
270
 
274
271
  When changing the plugin, keep these invariants:
275
272
 
276
- - `src/config/defaults.ts` is the runtime source of truth for defaults
277
- - `src/config/models.ts` is the source of truth for shared model presets and provider guidance
273
+ - `hiai-opencode.json` is the source of truth for user-facing runtime defaults and model IDs
274
+ - `src/config/defaults.ts` must remain a loader, not a second model map
278
275
  - root docs should use canonical runtime names, not stale internal aliases
279
276
  - user-facing docs should describe visible agents first and hidden/system agents second
280
277
  - third-party MCPs should follow upstream install/launch conventions whenever possible
package/LICENSE.md CHANGED
@@ -20,6 +20,7 @@ Some are:
20
20
 
21
21
  | Component | Upstream | Notes |
22
22
  |---|---|---|
23
+ | OpenCode host/runtime | [anomalyco/opencode](https://github.com/anomalyco/opencode) | plugin host and runtime target |
23
24
  | Core orchestration influences | [code-yeongyu/oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) | important architectural influence |
24
25
  | Planning / workflow influences | [obra/superpowers](https://github.com/obra/superpowers) | planning, review, and debugging ideas |
25
26
  | Specialist / platform influences | [vtemian/micode](https://github.com/vtemian/micode) | platform-style specialist behavior |