micode 0.8.6 → 0.9.0

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 (42) hide show
  1. package/INSTALL_CLAUDE.md +53 -4
  2. package/LICENSE +21 -0
  3. package/README.md +66 -0
  4. package/dist/index.js +11004 -1830
  5. package/package.json +3 -2
  6. package/src/agents/brainstormer.ts +1 -1
  7. package/src/agents/commander.ts +18 -2
  8. package/src/agents/implementer.ts +16 -0
  9. package/src/agents/index.ts +27 -2
  10. package/src/agents/mindmodel/anti-pattern-detector.ts +95 -0
  11. package/src/agents/mindmodel/code-clusterer.ts +108 -0
  12. package/src/agents/mindmodel/constraint-reviewer.ts +84 -0
  13. package/src/agents/mindmodel/constraint-writer.ts +136 -0
  14. package/src/agents/mindmodel/convention-extractor.ts +102 -0
  15. package/src/agents/mindmodel/dependency-mapper.ts +85 -0
  16. package/src/agents/mindmodel/domain-extractor.ts +77 -0
  17. package/src/agents/mindmodel/example-extractor.ts +87 -0
  18. package/src/agents/mindmodel/index.ts +11 -0
  19. package/src/agents/mindmodel/orchestrator.ts +103 -0
  20. package/src/agents/mindmodel/pattern-discoverer.ts +77 -0
  21. package/src/agents/mindmodel/stack-detector.ts +62 -0
  22. package/src/agents/planner.ts +16 -2
  23. package/src/agents/reviewer.ts +20 -2
  24. package/src/config-loader.ts +158 -39
  25. package/src/hooks/auto-compact.ts +34 -5
  26. package/src/hooks/constraint-reviewer.ts +177 -0
  27. package/src/hooks/context-injector.ts +4 -2
  28. package/src/hooks/context-window-monitor.ts +10 -2
  29. package/src/hooks/fragment-injector.ts +181 -0
  30. package/src/hooks/mindmodel-injector.ts +170 -0
  31. package/src/index.ts +131 -8
  32. package/src/mindmodel/classifier.ts +36 -0
  33. package/src/mindmodel/formatter.ts +18 -0
  34. package/src/mindmodel/index.ts +18 -0
  35. package/src/mindmodel/loader.ts +66 -0
  36. package/src/mindmodel/review.ts +68 -0
  37. package/src/mindmodel/types.ts +87 -0
  38. package/src/tools/batch-read.ts +75 -0
  39. package/src/tools/mindmodel-lookup.ts +87 -0
  40. package/src/tools/spawn-agent.ts +134 -59
  41. package/src/utils/config.ts +23 -3
  42. package/src/utils/model-limits.ts +20 -4
package/INSTALL_CLAUDE.md CHANGED
@@ -160,15 +160,64 @@ Never run this automatically without consent.
160
160
  | `ast_grep_replace` | AST-aware code replace |
161
161
  | `look_at` | Screenshot analysis |
162
162
 
163
- ### Model Override
163
+ ### Model Configuration
164
164
 
165
- To use different models, create `~/.config/opencode/micode.json`:
165
+ micode respects your OpenCode default model. Set it in `~/.config/opencode/opencode.json`:
166
+
167
+ ```json
168
+ {
169
+ "model": "github-copilot/gpt-5-mini"
170
+ }
171
+ ```
172
+
173
+ This model will be used for **all** micode agents automatically.
174
+
175
+ #### Per-Agent Overrides
176
+
177
+ To override specific agents, create `~/.config/opencode/micode.json`:
166
178
 
167
179
  ```json
168
180
  {
169
181
  "agents": {
170
- "commander": { "model": "your-preferred-model" },
171
- "brainstormer": { "model": "your-preferred-model" }
182
+ "brainstormer": { "model": "openai/gpt-4o" }
172
183
  }
173
184
  }
174
185
  ```
186
+
187
+ **Model resolution priority:**
188
+ 1. Per-agent override in `micode.json` (highest)
189
+ 2. Default model from `opencode.json` `"model"` field
190
+ 3. Plugin default (hardcoded in agent definitions)
191
+
192
+ #### Model Syntax
193
+
194
+ Models must use the format `provider/model` where:
195
+ - `provider` is the provider ID from your `opencode.json` (e.g., `openai`, `anthropic`, `github-copilot`)
196
+ - `model` is the model ID configured under that provider
197
+
198
+ **To find valid model names:**
199
+
200
+ 1. Check your `~/.config/opencode/opencode.json` for the `provider` section
201
+ 2. Look for the provider name (the key) and model names under `models`
202
+
203
+ **Example opencode.json structure:**
204
+ ```json
205
+ {
206
+ "provider": {
207
+ "github-copilot": {
208
+ "models": {
209
+ "gpt-5-mini": { "limit": { "context": 128000 } }
210
+ }
211
+ }
212
+ }
213
+ }
214
+ ```
215
+
216
+ For the above config, use `"model": "github-copilot/gpt-5-mini"`.
217
+
218
+ **Important:** The provider name must match exactly. If OpenCode shows `github-copilot` as the provider ID, use `github-copilot/model-name` (not `github/copilot:model-name` or other variations).
219
+
220
+ #### Built-in Models
221
+
222
+ The following model bypasses validation:
223
+ - `opencode/big-pickle` - OpenCode's default model, always valid
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 vtemian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -87,6 +87,72 @@ Maintain context across sessions with structured compaction. Run `/ledger` to cr
87
87
  - **Context Injector** - Injects ARCHITECTURE.md, CODE_STYLE.md
88
88
  - **Token-Aware Truncation** - Truncates large tool outputs
89
89
 
90
+ ## Configuration
91
+
92
+ ### Model Configuration
93
+
94
+ micode reads your default model from `opencode.json`:
95
+
96
+ ```json
97
+ {
98
+ "model": "github-copilot/gpt-5-mini",
99
+ "plugin": ["micode"]
100
+ }
101
+ ```
102
+
103
+ All micode agents will use this model automatically.
104
+
105
+ ### micode.json
106
+
107
+ Create `~/.config/opencode/micode.json` for micode-specific settings:
108
+
109
+ ```json
110
+ {
111
+ "agents": {
112
+ "brainstormer": { "model": "openai/gpt-4o", "temperature": 0.8 },
113
+ "commander": { "maxTokens": 8192 }
114
+ },
115
+ "features": {
116
+ "mindmodelInjection": true
117
+ },
118
+ "compactionThreshold": 0.5,
119
+ "fragments": {
120
+ "commander": ["custom-instructions.md"]
121
+ }
122
+ }
123
+ ```
124
+
125
+ #### Options
126
+
127
+ | Option | Type | Description |
128
+ |--------|------|-------------|
129
+ | `agents` | object | Per-agent overrides (model, temperature, maxTokens) |
130
+ | `features.mindmodelInjection` | boolean | Enable mindmodel context injection |
131
+ | `compactionThreshold` | number | Context usage threshold (0-1) for auto-compaction. Default: 0.5 |
132
+ | `fragments` | object | Additional prompt fragments per agent |
133
+
134
+ #### Model Resolution Priority
135
+
136
+ 1. Per-agent override in `micode.json` (highest)
137
+ 2. Default model from `opencode.json` `"model"` field
138
+ 3. Plugin default (fallback)
139
+
140
+ #### Model Syntax
141
+
142
+ Models use `provider/model` format. The provider must match exactly what's in your `opencode.json`:
143
+
144
+ ```json
145
+ {
146
+ "provider": {
147
+ "github-copilot": {
148
+ "models": { "gpt-5-mini": {} }
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ Use `"model": "github-copilot/gpt-5-mini"` (not `github/copilot:gpt-5-mini`).
155
+
90
156
  ## Development
91
157
 
92
158
  ```bash