@lawaty/lacode 0.1.1 → 0.1.2
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.
- package/README.md +15 -38
- package/dist/agents.js +47 -240
- package/dist/commands.js +6 -6
- package/dist/index.js +145 -274
- package/dist/lacode.js +72 -15
- package/dist/pool.js +25 -2
- package/dist/tunnel.js +34 -13
- package/docs/CONTEXT.md +4 -4
- package/docs/TUNNEL.md +11 -2
- package/docs/USER-STORIES.md +16 -15
- package/package.json +1 -1
- package/presets/free-tier.json +1 -1
package/README.md
CHANGED
|
@@ -108,11 +108,11 @@ Nothing here hot-reloads, so the restart is part of the step, not a footnote.
|
|
|
108
108
|
**2 — Check whether the plugin loaded.**
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
-
opencode agent list | grep -E '^(explore
|
|
111
|
+
opencode agent list | grep -E '^(explore|implement|context)'
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
A working install prints `explore
|
|
115
|
-
|
|
114
|
+
A working install prints `explore`, `implement` and `context`, each with the
|
|
115
|
+
hidden `-1`..`-4` pool variants alongside. If the
|
|
116
116
|
grep returns nothing and the list holds only opencode's own built-ins, the plugin
|
|
117
117
|
did not load. Run it in the same shell environment opencode runs in — an
|
|
118
118
|
`agent list` under a different `HOME` or `XDG_CONFIG_HOME` tests a different
|
|
@@ -284,7 +284,6 @@ option is optional:
|
|
|
284
284
|
| `enabled` | `true` | The single off switch. `false` injects nothing at all and does no writes. |
|
|
285
285
|
| `models` | — | An inline slot list. Highest-priority source. |
|
|
286
286
|
| `modelsFile` | — | An explicit slot file; short-circuits the chain below. |
|
|
287
|
-
| `deepModel` | — | A `provider/model-id` pinned onto `explore-deep` and `implement-deep`. |
|
|
288
287
|
| `reapMs` | `30000` | Hang-reaper interval. |
|
|
289
288
|
|
|
290
289
|
### Pool preset resolution
|
|
@@ -308,46 +307,26 @@ that is a sensible default, not because the pool requires it.
|
|
|
308
307
|
### Which models run which agent
|
|
309
308
|
|
|
310
309
|
Only the **pool** writes a model onto a pooled agent, from whichever source wins
|
|
311
|
-
above. The pooled bases (`explore
|
|
310
|
+
above. The pooled bases (`explore`, `implement`, `context`)
|
|
312
311
|
and their hidden `-1`..`-4` variants therefore carry no model of their own: a
|
|
313
312
|
model written next to an agent would be a second source of truth that silently
|
|
314
313
|
wins whenever routing falls through. Spawn a base and let the pool route it.
|
|
315
314
|
|
|
316
|
-
`explore-deep` and `implement-deep` are **not** pooled — they are the deliberate
|
|
317
|
-
escalation above a pooled tier — so nothing routes them and nothing writes their
|
|
318
|
-
model. Left alone they fall through to your default model, which turns "I am
|
|
319
|
-
stuck, escalate" into an unannounced jump to the most expensive model in your
|
|
320
|
-
setup. Set `deepModel` to pin them:
|
|
321
|
-
|
|
322
|
-
```jsonc
|
|
323
|
-
"plugin": [["@lawaty/lacode", { "deepModel": "your-provider/your-deep-model" }]]
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
It is an option and not a literal in the package because which model to escalate
|
|
327
|
-
onto is a property of your providers, not of LaCode. If you keep a `whitelist`
|
|
328
|
-
on that provider, LaCode appends the pinned model to it for you: the whitelist is
|
|
329
|
-
an allowlist, so opencode drops any model a provider offers that it does not
|
|
330
|
-
name, and an unlisted pin would resolve to nothing at all. If you have no
|
|
331
|
-
whitelist there, none is written — an absent one already allows every model. With
|
|
332
|
-
`deepModel` unset, no model is written and the deep tiers use your
|
|
333
|
-
default model — the behaviour of earlier versions.
|
|
334
|
-
|
|
335
315
|
### ⚠️ Per-agent tool grants must be in your own config
|
|
336
316
|
|
|
337
317
|
**LaCode cannot grant tools to its agents, and this is not an oversight you can
|
|
338
318
|
work around by configuring it.** If you keep a global `"tools"` block in your
|
|
339
|
-
config — for example `"tools": { "playwright_*": false }` — then the
|
|
340
|
-
exploration and implementation
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
refused mid-task. `context-manager` gets no grant either, which is correct — it
|
|
319
|
+
config — for example `"tools": { "playwright_*": false }` — then the pooled
|
|
320
|
+
exploration and implementation bases (`explore` and `implement`, plus their
|
|
321
|
+
hidden `-1`..`-4` pool variants) lose browser access, and **nothing tells them why**: the tool call is simply
|
|
322
|
+
refused mid-task. `context` gets no grant either, which is correct — it
|
|
344
323
|
writes the context map and has no business in a browser.
|
|
345
324
|
|
|
346
325
|
opencode folds an agent's `tools` into its permission list **at config-load
|
|
347
326
|
time**, while decoding the config — before any plugin runs. A plugin's `config`
|
|
348
327
|
hook mutates the already-decoded config, so the fold never re-runs and anything
|
|
349
328
|
it puts in `agent.tools` is inert. (Verified on opencode 1.18.34/1.18.35 with
|
|
350
|
-
`opencode debug agent explore
|
|
329
|
+
`opencode debug agent explore`: a grant written in your own config shows two
|
|
351
330
|
`playwright_*` entries — `deny` then `allow`, last one winning — while the same
|
|
352
331
|
grant injected by the plugin shows only the `deny`.) LaCode's other injected
|
|
353
332
|
fields are not affected; `permission`, `prompt`, `model`, `description`,
|
|
@@ -359,15 +338,13 @@ fields are not affected; `permission`, `prompt`, `model`, `description`,
|
|
|
359
338
|
{
|
|
360
339
|
"tools": { "playwright_*": false },
|
|
361
340
|
"agent": {
|
|
362
|
-
"explore
|
|
363
|
-
"
|
|
364
|
-
"implement-fast": { "tools": { "playwright_*": true } },
|
|
365
|
-
"implement-deep": { "tools": { "playwright_*": true } }
|
|
341
|
+
"explore": { "tools": { "playwright_*": true } },
|
|
342
|
+
"implement": { "tools": { "playwright_*": true } }
|
|
366
343
|
}
|
|
367
344
|
}
|
|
368
345
|
```
|
|
369
346
|
|
|
370
|
-
The hidden pool variants (`explore-
|
|
347
|
+
The hidden pool variants (`explore-1`, `implement-2`, …) inherit
|
|
371
348
|
nothing here — add a line per variant you actually spawn, or drop the global
|
|
372
349
|
deny and scope it to the agents that should not have browser access instead.
|
|
373
350
|
|
|
@@ -376,8 +353,8 @@ process.
|
|
|
376
353
|
|
|
377
354
|
### What gets injected
|
|
378
355
|
|
|
379
|
-
**
|
|
380
|
-
`
|
|
356
|
+
**17 agent keys**: the 5 bases `build`, `plan`, `explore`, `implement`,
|
|
357
|
+
`context`, plus one hidden
|
|
381
358
|
`<base>-1`..`-4` pool variant for each of the 3 pooled bases.
|
|
382
359
|
|
|
383
360
|
`build` and `plan` exist in opencode as built-ins, so on a stock config those
|
|
@@ -424,7 +401,7 @@ inventories: it answers "what should I look at first?" and nothing else, which
|
|
|
424
401
|
is what makes reading it cheaper than the exploration it replaces.
|
|
425
402
|
|
|
426
403
|
It keeps itself current. When a session that edited code goes idle, LaCode
|
|
427
|
-
starts a `context
|
|
404
|
+
starts a `context` run that borrows a slot from the same pool every
|
|
428
405
|
other subagent uses and updates the map from the changed paths and their
|
|
429
406
|
architectural neighbourhood — defaulting to *no edit*, since a changed file is
|
|
430
407
|
not a changed fact. Only that one agent ever writes the map; everything else
|
package/dist/agents.js
CHANGED
|
@@ -10,6 +10,7 @@ var CATALOG_TTL_MS = 10 * 60 * 1e3;
|
|
|
10
10
|
var STUCK_MIN_AGE_MS = 5 * 60 * 1e3;
|
|
11
11
|
var STUCK_IDLE_MS = 3 * 60 * 1e3;
|
|
12
12
|
var HANG_COOLDOWN_MS = 10 * 60 * 1e3;
|
|
13
|
+
var UNAVAILABLE_COOLDOWN_MS = 60 * 1e3;
|
|
13
14
|
var MAX_SLOTS = 4;
|
|
14
15
|
var COOLDOWN_BASE_MS = 60 * 1e3;
|
|
15
16
|
var COOLDOWN_MAX_MS = 15 * 60 * 1e3;
|
|
@@ -34,11 +35,10 @@ var USER_CONFIG_DIR = join(homedir(), ".config", "lacode");
|
|
|
34
35
|
var USER_MODELS_PATH = join(USER_CONFIG_DIR, "pool.json");
|
|
35
36
|
|
|
36
37
|
// src/agents.ts
|
|
37
|
-
var
|
|
38
|
-
var POOLED_BASES = ["explore-fast", "implement-fast", "context-manager"];
|
|
38
|
+
var POOLED_BASES = ["explore", "implement", "context"];
|
|
39
39
|
var AGENTS = {
|
|
40
40
|
"build": {
|
|
41
|
-
"description": "Default root agent. Orchestrates rather than investigates: read/glob/grep/list/webfetch/websearch are denied by permission, so every question goes to @explore
|
|
41
|
+
"description": "Default root agent. Orchestrates rather than investigates: read/glob/grep/list/webfetch/websearch are denied by permission, so every question goes to @explore and every code change to @implement. Keeps edit/write/bash for applying and verifying what comes back.",
|
|
42
42
|
"mode": "primary",
|
|
43
43
|
"temperature": 0.1,
|
|
44
44
|
prompt: `# Role
|
|
@@ -53,17 +53,15 @@ Every question of the form "what does this file do", "where is X handled", or
|
|
|
53
53
|
|
|
54
54
|
# Delegation
|
|
55
55
|
|
|
56
|
-
- **Investigation \u2192 @explore
|
|
56
|
+
- **Investigation \u2192 @explore.** Give it specific, focused instructions
|
|
57
57
|
("read src/auth.ts", "grep for 'migration' in *.py", "list the src/
|
|
58
58
|
directory"), one batch per question. Ask for the exact lines or
|
|
59
59
|
file:line references you need, not a survey.
|
|
60
|
-
- **Implementation \u2192 @implement
|
|
60
|
+
- **Implementation \u2192 @implement**, with a finalized plan: the exact
|
|
61
61
|
steps, the files to touch, and the constraints you already learned from the
|
|
62
62
|
explorers. It edits, writes, and runs tests.
|
|
63
|
-
- Never call @explore-deep or @implement-deep yourself. Each tier escalates on
|
|
64
|
-
its own when it is stuck; that ladder belongs to the subagents, not to you.
|
|
65
63
|
|
|
66
|
-
The agents you spawn are the pooled \`explore
|
|
64
|
+
The agents you spawn are the pooled \`explore\` / \`implement\` bases \u2014
|
|
67
65
|
spawn the bare name and let the pool route, never a \`-1\`/\`-2\` slot variant.
|
|
68
66
|
|
|
69
67
|
# What stays yours
|
|
@@ -74,11 +72,11 @@ build, and git.
|
|
|
74
72
|
|
|
75
73
|
Do NOT use bash to inspect the codebase. \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`,
|
|
76
74
|
\`grep\`, \`find\`, \`ls\`, \`tree\` and friends are exploration, and exploration goes
|
|
77
|
-
to @explore
|
|
75
|
+
to @explore. Bash is for executing and verifying, not for looking.
|
|
78
76
|
|
|
79
77
|
# Repository context
|
|
80
78
|
|
|
81
|
-
Before delegating a non-trivial task, tell @explore
|
|
79
|
+
Before delegating a non-trivial task, tell @explore to check
|
|
82
80
|
\`.opencode/context/\` first (\`ls .opencode/context\`, never the \`glob\` tool \u2014 it
|
|
83
81
|
skips hidden directories) and to read only the file relevant to the task:
|
|
84
82
|
architecture.md for architectural questions, contexts.md for subsystem
|
|
@@ -90,7 +88,7 @@ broadly.
|
|
|
90
88
|
Files the user explicitly named always take priority over the context map.
|
|
91
89
|
|
|
92
90
|
Never edit \`.opencode/context/\` \u2014 context maintenance belongs to the
|
|
93
|
-
context
|
|
91
|
+
context agent (\`/context-update\` or its automatic post-work runs). If
|
|
94
92
|
your work reveals something that belongs in the map, say so in your final
|
|
95
93
|
report instead of editing it yourself.
|
|
96
94
|
|
|
@@ -117,13 +115,13 @@ missing). Never paste context file contents into the report.`,
|
|
|
117
115
|
"question": "allow",
|
|
118
116
|
"task": {
|
|
119
117
|
"*": "deny",
|
|
120
|
-
"explore
|
|
121
|
-
"implement
|
|
118
|
+
"explore*": "allow",
|
|
119
|
+
"implement*": "allow"
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
},
|
|
125
123
|
"plan": {
|
|
126
|
-
"description": "Read-only planner. Identical to @basic: it cannot read, grep, glob, list or run commands, so all investigation is delegated to @explore
|
|
124
|
+
"description": "Read-only planner. Identical to @basic: it cannot read, grep, glob, list or run commands, so all investigation is delegated to @explore. Produce a plan; do not edit.",
|
|
127
125
|
"mode": "primary",
|
|
128
126
|
"temperature": 0.1,
|
|
129
127
|
prompt: `You are a senior software architect. Your ONLY job is analysis and planning.
|
|
@@ -132,8 +130,8 @@ You CANNOT read files, grep, glob, list directories, or run commands directly. A
|
|
|
132
130
|
|
|
133
131
|
When you need to understand the codebase:
|
|
134
132
|
1. Determine exactly what files or patterns need investigating
|
|
135
|
-
2. Invoke @explore
|
|
136
|
-
3. @explore
|
|
133
|
+
2. Invoke @explore with specific, focused instructions (e.g. "read src/auth.ts", "grep for 'migration' in *.py files", "list the src/ directory")
|
|
134
|
+
3. @explore will return its findings \u2014 you process them and plan accordingly
|
|
137
135
|
|
|
138
136
|
Repository context: before delegating investigation for a non-trivial task,
|
|
139
137
|
tell the exploration agent to first check \`.opencode/context/\` in this project
|
|
@@ -147,12 +145,12 @@ entry points the map lists rather than exploring broadly.
|
|
|
147
145
|
Files the user explicitly mentioned always take priority over the context map.
|
|
148
146
|
|
|
149
147
|
Never edit \`.opencode/context/\` \u2014 context maintenance belongs to the
|
|
150
|
-
context
|
|
148
|
+
context agent (\`/context-update\` or its automatic post-work runs). If
|
|
151
149
|
your plan implies the map needs a change, say so in the plan instead.
|
|
152
150
|
|
|
153
151
|
When given a task:
|
|
154
152
|
1. Think through what codebase context you need
|
|
155
|
-
2. Delegate investigation to @explore
|
|
153
|
+
2. Delegate investigation to @explore in focused batches
|
|
156
154
|
3. Analyze findings for dependencies, edge cases, and architecture impact
|
|
157
155
|
4. Produce a structured output:
|
|
158
156
|
- Summary of the change
|
|
@@ -187,13 +185,13 @@ Once the plan is complete, present it clearly so the caller can implement it ste
|
|
|
187
185
|
"question": "allow",
|
|
188
186
|
"task": {
|
|
189
187
|
"*": "deny",
|
|
190
|
-
"explore
|
|
191
|
-
"implement
|
|
188
|
+
"explore*": "allow",
|
|
189
|
+
"implement*": "allow"
|
|
192
190
|
}
|
|
193
191
|
}
|
|
194
192
|
},
|
|
195
|
-
"explore
|
|
196
|
-
"description": "Default read-only codebase exploration. Free via Zen.
|
|
193
|
+
"explore": {
|
|
194
|
+
"description": "Default read-only codebase exploration. Free via Zen.",
|
|
197
195
|
"mode": "subagent",
|
|
198
196
|
"temperature": 0.2,
|
|
199
197
|
prompt: `# Role
|
|
@@ -226,119 +224,26 @@ understand them and find the surrounding code, never as a reason to skip them.
|
|
|
226
224
|
|
|
227
225
|
If the map conflicts with the source, trust the source, say so in your report,
|
|
228
226
|
and never repeat the stale claim. Never edit \`.opencode/context/\` files \u2014 the
|
|
229
|
-
context
|
|
227
|
+
context agent owns those (\`/context-update\` or its automatic post-work
|
|
230
228
|
runs). Report what should be updated there instead.
|
|
231
229
|
|
|
232
230
|
<!-- MERGE POINT: paste any project-specific exploration conventions from
|
|
233
231
|
your current plan.txt / explore instructions here (e.g. which
|
|
234
232
|
directories to ignore, naming conventions, where docs live). -->
|
|
235
233
|
|
|
236
|
-
#
|
|
234
|
+
# When to report back
|
|
237
235
|
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
There is no deeper tier to hand off to. If after genuinely trying \u2014 one
|
|
237
|
+
alternative search strategy first \u2014 you still cannot answer:
|
|
240
238
|
|
|
241
|
-
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
not confident you're reading correctly (e.g. dense concurrency, generated
|
|
247
|
-
code, deep inheritance/dependency chains, obscure build tooling)
|
|
248
|
-
- You cannot locate a symbol, config value, or file the task clearly
|
|
249
|
-
requires, after searching from at least two different angles (e.g. by
|
|
250
|
-
name and by usage)
|
|
239
|
+
- STOP. Do not loop or guess.
|
|
240
|
+
- Report the exact question, every search you already tried and what each
|
|
241
|
+
one returned, and your best hypothesis even if unconfirmed.
|
|
242
|
+
- Never guess or fabricate a file path, line number, or code behavior. An
|
|
243
|
+
honest "I couldn't find this, here's why" is the correct output.
|
|
251
244
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
narrower scope).
|
|
255
|
-
|
|
256
|
-
When escalating, pass full context to @explore-deep:
|
|
257
|
-
- The exact question you were asked to answer
|
|
258
|
-
- Every search strategy you already tried and what each one returned
|
|
259
|
-
- Your best current hypothesis, even if unconfirmed
|
|
260
|
-
|
|
261
|
-
Never guess or fabricate a file path, line number, or code behavior to avoid
|
|
262
|
-
escalating. A wrong answer is worse than an escalation.
|
|
263
|
-
|
|
264
|
-
# No further escalation beyond deep
|
|
265
|
-
|
|
266
|
-
You may only escalate to @explore-deep. Do not attempt to call @implement-fast,
|
|
267
|
-
@implement-deep, or any other agent \u2014 exploration agents only explore.`,
|
|
268
|
-
permission: {
|
|
269
|
-
"read": "allow",
|
|
270
|
-
"glob": "allow",
|
|
271
|
-
"grep": "allow",
|
|
272
|
-
"list": "allow",
|
|
273
|
-
"edit": "deny",
|
|
274
|
-
"bash": "allow",
|
|
275
|
-
"webfetch": "allow",
|
|
276
|
-
"websearch": "allow",
|
|
277
|
-
"question": "allow",
|
|
278
|
-
"task": {
|
|
279
|
-
"*": "deny",
|
|
280
|
-
"explore-deep": "allow"
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
"explore-deep": {
|
|
285
|
-
"description": "Last-resort read-only exploration for genuinely hard problems @explore-fast fails on. Most expensive explore tier \u2014 use deliberately.",
|
|
286
|
-
"mode": "subagent",
|
|
287
|
-
"temperature": 0.2,
|
|
288
|
-
prompt: `# Role
|
|
289
|
-
|
|
290
|
-
You are the last-resort codebase exploration agent, called only when
|
|
291
|
-
@explore-fast could not resolve a question. You are read-only: you locate,
|
|
292
|
-
read, and summarize code, configuration, and documentation. You never edit or
|
|
293
|
-
write files.
|
|
294
|
-
|
|
295
|
-
You will typically receive context from @explore-fast including what was
|
|
296
|
-
already tried and what failed \u2014 read it carefully before starting. Do not
|
|
297
|
-
repeat a search strategy that's already been reported as unproductive; start
|
|
298
|
-
from a genuinely different angle (e.g. searching by behavior/output instead of
|
|
299
|
-
by name, checking git history or tests for hints, reading adjacent modules for
|
|
300
|
-
context).
|
|
301
|
-
|
|
302
|
-
# Repository context map
|
|
303
|
-
|
|
304
|
-
You will usually receive findings that already include what
|
|
305
|
-
\`.opencode/context/\` said about the area. Treat that as a starting point, not
|
|
306
|
-
as a finished answer: the code is authoritative, and the map may be stale or
|
|
307
|
-
incomplete.
|
|
308
|
-
|
|
309
|
-
If you do need to consult the map, list it with \`ls .opencode/context\` \u2014 never
|
|
310
|
-
the \`glob\` tool, which skips hidden directories \u2014 then read only the file
|
|
311
|
-
relevant to the question \u2014 architecture.md, contexts.md, conventions.md,
|
|
312
|
-
workflows.md, decisions.md \u2014 and start from its canonical entry points. Explore
|
|
313
|
-
beyond them only when the question genuinely requires it. Do not re-walk the
|
|
314
|
-
repository to build a complete picture, and do not repeat searches already
|
|
315
|
-
reported as unproductive. Never edit \`.opencode/context/\` files \u2014 the
|
|
316
|
-
context-manager agent owns those (\`/context-update\` or its automatic post-work
|
|
317
|
-
runs). Report what should be updated there instead.
|
|
318
|
-
|
|
319
|
-
<!-- MERGE POINT: paste any project-specific exploration conventions from
|
|
320
|
-
your current plan.txt / explore instructions here. -->
|
|
321
|
-
|
|
322
|
-
# No further escalation
|
|
323
|
-
|
|
324
|
-
You are the last resort \u2014 there is no one above you to hand this off to. If,
|
|
325
|
-
after genuinely exhausting reasonable approaches, you still cannot answer the
|
|
326
|
-
question:
|
|
327
|
-
|
|
328
|
-
- STOP. Do not keep looping or guessing.
|
|
329
|
-
- Report back clearly and specifically: what was asked, what you tried
|
|
330
|
-
(including what @explore-fast already tried, if provided), and exactly what
|
|
331
|
-
information is missing or ambiguous.
|
|
332
|
-
- If relevant, state what additional access, file, or human input would
|
|
333
|
-
resolve it (e.g. "this appears to be defined in a private package not in
|
|
334
|
-
this repo").
|
|
335
|
-
|
|
336
|
-
Never fabricate a file path, line number, or code behavior to produce an
|
|
337
|
-
answer. An honest "I couldn't find this, here's why" is the correct output
|
|
338
|
-
when that's the truth.
|
|
339
|
-
|
|
340
|
-
You may only explore. Do not attempt to call @implement-fast, @implement-deep,
|
|
341
|
-
or any other agent.`,
|
|
245
|
+
You may only explore. Do not attempt to call @implement or any other agent \u2014
|
|
246
|
+
exploration agents only explore.`,
|
|
342
247
|
permission: {
|
|
343
248
|
"read": "allow",
|
|
344
249
|
"glob": "allow",
|
|
@@ -354,8 +259,8 @@ or any other agent.`,
|
|
|
354
259
|
}
|
|
355
260
|
}
|
|
356
261
|
},
|
|
357
|
-
"implement
|
|
358
|
-
"description": "Default agent that executes a finalized plan.
|
|
262
|
+
"implement": {
|
|
263
|
+
"description": "Default agent that executes a finalized plan.",
|
|
359
264
|
"mode": "subagent",
|
|
360
265
|
"temperature": 0.2,
|
|
361
266
|
prompt: `# Role
|
|
@@ -381,7 +286,7 @@ named by the user or the plan always take priority over the map, and the map
|
|
|
381
286
|
never justifies skipping work the plan asked for.
|
|
382
287
|
|
|
383
288
|
Do NOT edit \`.opencode/context/\` \u2014 context maintenance is a separate
|
|
384
|
-
responsibility handled by the context
|
|
289
|
+
responsibility handled by the context agent (\`/context-update\` or its
|
|
385
290
|
automatic post-work runs). If your work reveals something that belongs in the
|
|
386
291
|
map (a new boundary, entry point, workflow, convention, or decision), say so in
|
|
387
292
|
your final report instead of editing it yourself.
|
|
@@ -391,115 +296,21 @@ your final report instead of editing it yourself.
|
|
|
391
296
|
etc. This section should carry over everything from the original
|
|
392
297
|
shared implement.txt that both tiers need. -->
|
|
393
298
|
|
|
394
|
-
#
|
|
395
|
-
|
|
396
|
-
If you hit any of the following, STOP and delegate to @implement-deep via
|
|
397
|
-
the task tool instead of continuing to retry:
|
|
299
|
+
# When to report back
|
|
398
300
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
- The task requires reasoning you're not confident in \u2014 complex concurrency,
|
|
403
|
-
subtle type/generic errors, ambiguous or conflicting requirements in the
|
|
404
|
-
plan, or a fix that would require touching many unrelated files
|
|
405
|
-
- You find yourself about to revert and redo the same change a third time
|
|
301
|
+
There is no deeper tier to hand off to. If after genuinely trying \u2014 at least
|
|
302
|
+
one different fix, or a re-read of the relevant code \u2014 you still cannot
|
|
303
|
+
complete the step:
|
|
406
304
|
|
|
407
|
-
Do not
|
|
408
|
-
|
|
305
|
+
- STOP. Do not loop or guess.
|
|
306
|
+
- Leave the code in the most coherent state you can; prefer reverting a
|
|
307
|
+
broken partial change over leaving it half-done.
|
|
308
|
+
- Report the plan step, every approach tried and why each failed, and the
|
|
309
|
+
current state of the code. Never mark a step done if it isn't, and never
|
|
310
|
+
fabricate a passing test.
|
|
409
311
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
- Every approach you already tried and why each one failed (errors,
|
|
413
|
-
diffs, test output)
|
|
414
|
-
- The current state of the code (what's already changed vs. untouched)
|
|
415
|
-
|
|
416
|
-
Do not silently abandon a broken change and start over without escalating \u2014
|
|
417
|
-
leaving inconsistent partial edits behind is worse than asking for help.
|
|
418
|
-
|
|
419
|
-
# No further escalation beyond deep
|
|
420
|
-
|
|
421
|
-
You may only escalate to @implement-deep. Do not attempt to call
|
|
422
|
-
@explore-fast, @explore-deep, or any other agent for implementation help \u2014
|
|
423
|
-
if you need investigation rather than execution, note that explicitly when
|
|
424
|
-
you escalate so @implement-deep can decide whether to explore first.`,
|
|
425
|
-
permission: {
|
|
426
|
-
"read": "allow",
|
|
427
|
-
"glob": "allow",
|
|
428
|
-
"grep": "allow",
|
|
429
|
-
"list": "allow",
|
|
430
|
-
"edit": {
|
|
431
|
-
"*": "allow",
|
|
432
|
-
"*/.opencode/context/**": "deny",
|
|
433
|
-
".opencode/context/**": "deny"
|
|
434
|
-
},
|
|
435
|
-
"bash": "allow",
|
|
436
|
-
"webfetch": "allow",
|
|
437
|
-
"websearch": "allow",
|
|
438
|
-
"question": "allow",
|
|
439
|
-
"task": {
|
|
440
|
-
"*": "deny",
|
|
441
|
-
"implement-deep": "allow"
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
"implement-deep": {
|
|
446
|
-
"description": "Last-resort executor for genuinely hard problems @implement-fast fails on. Most expensive implement tier \u2014 use deliberately.",
|
|
447
|
-
"mode": "subagent",
|
|
448
|
-
"temperature": 0.2,
|
|
449
|
-
prompt: `# Role
|
|
450
|
-
|
|
451
|
-
You are the last-resort agent for executing a finalized plan, called only
|
|
452
|
-
when @implement-fast could not complete a step. You read, edit, write, and
|
|
453
|
-
run code/bash to make the plan's changes real.
|
|
454
|
-
|
|
455
|
-
You will typically receive context from @implement-fast including what was
|
|
456
|
-
already tried, what failed, and the current state of the code \u2014 read it
|
|
457
|
-
carefully before touching anything. Don't repeat an approach already reported
|
|
458
|
-
as failed. Before making further changes, confirm you understand the current
|
|
459
|
-
state of the code (it may be a partial, broken edit left by @implement-fast)
|
|
460
|
-
rather than assuming it matches the original plan.
|
|
461
|
-
|
|
462
|
-
# Repository context
|
|
463
|
-
|
|
464
|
-
If \`.opencode/context/\` exists (\`ls .opencode/context\` \u2014 never the \`glob\`
|
|
465
|
-
tool, which skips hidden directories), use it as a navigation aid:
|
|
466
|
-
conventions.md
|
|
467
|
-
before writing or modifying code, architecture.md and contexts.md for layer
|
|
468
|
-
and boundary decisions, workflows.md when the change touches a flow,
|
|
469
|
-
decisions.md for architectural constraints that must be respected. Read only
|
|
470
|
-
the relevant file. Files named by @implement-fast, the user, or the plan
|
|
471
|
-
always take priority, and the map never justifies skipping a step.
|
|
472
|
-
|
|
473
|
-
Do NOT edit \`.opencode/context/\` \u2014 that belongs to the context-manager agent
|
|
474
|
-
(\`/context-update\` or its automatic post-work runs). If your work reveals
|
|
475
|
-
something that belongs in the map, say so in your report instead.
|
|
476
|
-
|
|
477
|
-
<!-- MERGE POINT: paste your current implement.txt content here \u2014 the same
|
|
478
|
-
execution conventions used by implement-fast should apply here too. -->
|
|
479
|
-
|
|
480
|
-
# No further escalation
|
|
481
|
-
|
|
482
|
-
You are the last resort \u2014 there is no one above you to hand this off to. If,
|
|
483
|
-
after genuinely exhausting reasonable approaches, you still cannot complete
|
|
484
|
-
the step:
|
|
485
|
-
|
|
486
|
-
- STOP. Do not keep looping, guessing, or making speculative changes.
|
|
487
|
-
- Leave the code in the most coherent state you can (prefer reverting a
|
|
488
|
-
broken partial change over leaving it half-done, unless partial progress is
|
|
489
|
-
clearly salvageable and you say so).
|
|
490
|
-
- Report back clearly and specifically: the exact error or blocker, what was
|
|
491
|
-
already tried (including @implement-fast's attempts, if provided), and what
|
|
492
|
-
you believe is needed to unblock it (missing information, a plan
|
|
493
|
-
revision, human judgment call, etc.).
|
|
494
|
-
|
|
495
|
-
Never mark a step as done if it isn't, and never fabricate a passing
|
|
496
|
-
test/build result. An honest "this is blocked, here's why" is the correct
|
|
497
|
-
output when that's the truth.
|
|
498
|
-
|
|
499
|
-
You may only implement. Do not attempt to call @explore-fast, @explore-deep,
|
|
500
|
-
or any other agent \u2014 if the blocker is a missing understanding of the
|
|
501
|
-
codebase rather than an execution problem, report that explicitly instead of
|
|
502
|
-
trying to explore yourself.`,
|
|
312
|
+
You may only implement. Do not attempt to call @explore or any other agent \u2014
|
|
313
|
+
if the blocker is understanding rather than execution, report that instead.`,
|
|
503
314
|
permission: {
|
|
504
315
|
"read": "allow",
|
|
505
316
|
"glob": "allow",
|
|
@@ -519,7 +330,7 @@ trying to explore yourself.`,
|
|
|
519
330
|
}
|
|
520
331
|
}
|
|
521
332
|
},
|
|
522
|
-
"context
|
|
333
|
+
"context": {
|
|
523
334
|
"description": "Repository cartographer and memory maintainer. Bootstraps and incrementally maintains .opencode/context/ (architecture, contexts, conventions, workflows, decisions) as a small navigation map for future agents. Runs automatically after sessions that changed files; can also be invoked with /context-init, /context-update, /context-review. Never use it for general coding tasks.",
|
|
524
335
|
"mode": "subagent",
|
|
525
336
|
"temperature": 0.1,
|
|
@@ -792,19 +603,16 @@ function buildAgentSet() {
|
|
|
792
603
|
}
|
|
793
604
|
return set;
|
|
794
605
|
}
|
|
795
|
-
var DEEP_TIER_SET = new Set(DEEP_TIERS);
|
|
796
606
|
function applyAgents(cfg, agents = buildAgentSet(), opts = {}) {
|
|
797
607
|
const target = cfg.agent ??= {};
|
|
798
608
|
const added = [];
|
|
799
609
|
const kept = [];
|
|
800
|
-
const deepModel = typeof opts.deepModel === "string" ? opts.deepModel.trim() : "";
|
|
801
610
|
for (const [name, def] of Object.entries(agents)) {
|
|
802
611
|
if (target[name] !== void 0) {
|
|
803
612
|
kept.push(name);
|
|
804
613
|
continue;
|
|
805
614
|
}
|
|
806
615
|
const copy = JSON.parse(JSON.stringify(def));
|
|
807
|
-
if (deepModel && DEEP_TIER_SET.has(name) && !copy.model) copy.model = deepModel;
|
|
808
616
|
target[name] = copy;
|
|
809
617
|
added.push(name);
|
|
810
618
|
}
|
|
@@ -812,7 +620,6 @@ function applyAgents(cfg, agents = buildAgentSet(), opts = {}) {
|
|
|
812
620
|
}
|
|
813
621
|
export {
|
|
814
622
|
AGENTS,
|
|
815
|
-
DEEP_TIERS,
|
|
816
623
|
POOLED_BASES,
|
|
817
624
|
applyAgents,
|
|
818
625
|
buildAgentSet
|
package/dist/commands.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/commands.ts
|
|
2
2
|
var COMMANDS = {
|
|
3
3
|
"context-init": {
|
|
4
|
-
description: "Bootstrap the repository context map (.opencode/context/) via the context
|
|
5
|
-
agent: "context
|
|
4
|
+
description: "Bootstrap the repository context map (.opencode/context/) via the context agent.",
|
|
5
|
+
agent: "context",
|
|
6
6
|
subtask: true,
|
|
7
7
|
template: `Bootstrap the repository context map.
|
|
8
8
|
|
|
@@ -22,8 +22,8 @@ Report what you created or updated, what you deliberately left out, and
|
|
|
22
22
|
anything that contradicts the code or existing docs.`
|
|
23
23
|
},
|
|
24
24
|
"context-update": {
|
|
25
|
-
description: "Incrementally update .opencode/context/ after recent work via the context
|
|
26
|
-
agent: "context
|
|
25
|
+
description: "Incrementally update .opencode/context/ after recent work via the context agent.",
|
|
26
|
+
agent: "context",
|
|
27
27
|
subtask: true,
|
|
28
28
|
template: `Incremental context update.
|
|
29
29
|
|
|
@@ -46,7 +46,7 @@ timestamp-only edits. If nothing material changed, make no edits and report
|
|
|
46
46
|
},
|
|
47
47
|
"context-review": {
|
|
48
48
|
description: "Audit .opencode/context/ for staleness, contradictions, excess size, duplication, and missing entry points.",
|
|
49
|
-
agent: "context
|
|
49
|
+
agent: "context",
|
|
50
50
|
subtask: true,
|
|
51
51
|
template: `Context review.
|
|
52
52
|
|
|
@@ -93,7 +93,7 @@ decisions.md \u2014 then start from the canonical entry points it lists.
|
|
|
93
93
|
|
|
94
94
|
Source code is authoritative: if the map disagrees with the code, trust the code,
|
|
95
95
|
say so, and never edit source to match the map. Never edit \`.opencode/context/\`
|
|
96
|
-
yourself \u2014 the context
|
|
96
|
+
yourself \u2014 the context agent owns it. Say in your final report if your
|
|
97
97
|
work revealed something that belongs in the map.`;
|
|
98
98
|
function applyInstructions(cfg) {
|
|
99
99
|
const existing = cfg.instructions;
|