@agentuity/opencode 0.1.40 → 0.1.41

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 (161) hide show
  1. package/README.md +321 -9
  2. package/dist/agents/architect.d.ts +4 -0
  3. package/dist/agents/architect.d.ts.map +1 -0
  4. package/dist/agents/architect.js +259 -0
  5. package/dist/agents/architect.js.map +1 -0
  6. package/dist/agents/builder.d.ts +1 -1
  7. package/dist/agents/builder.d.ts.map +1 -1
  8. package/dist/agents/builder.js +44 -1
  9. package/dist/agents/builder.js.map +1 -1
  10. package/dist/agents/index.d.ts.map +1 -1
  11. package/dist/agents/index.js +6 -0
  12. package/dist/agents/index.js.map +1 -1
  13. package/dist/agents/lead.d.ts +1 -1
  14. package/dist/agents/lead.d.ts.map +1 -1
  15. package/dist/agents/lead.js +183 -19
  16. package/dist/agents/lead.js.map +1 -1
  17. package/dist/agents/planner.d.ts +4 -0
  18. package/dist/agents/planner.d.ts.map +1 -0
  19. package/dist/agents/planner.js +158 -0
  20. package/dist/agents/planner.js.map +1 -0
  21. package/dist/agents/runner.d.ts +4 -0
  22. package/dist/agents/runner.d.ts.map +1 -0
  23. package/dist/agents/runner.js +364 -0
  24. package/dist/agents/runner.js.map +1 -0
  25. package/dist/agents/types.d.ts +5 -1
  26. package/dist/agents/types.d.ts.map +1 -1
  27. package/dist/background/concurrency.d.ts +36 -0
  28. package/dist/background/concurrency.d.ts.map +1 -0
  29. package/dist/background/concurrency.js +92 -0
  30. package/dist/background/concurrency.js.map +1 -0
  31. package/dist/background/index.d.ts +5 -0
  32. package/dist/background/index.d.ts.map +1 -0
  33. package/dist/background/index.js +4 -0
  34. package/dist/background/index.js.map +1 -0
  35. package/dist/background/manager.d.ts +54 -0
  36. package/dist/background/manager.d.ts.map +1 -0
  37. package/dist/background/manager.js +409 -0
  38. package/dist/background/manager.js.map +1 -0
  39. package/dist/background/types.d.ts +47 -0
  40. package/dist/background/types.d.ts.map +1 -0
  41. package/dist/background/types.js +2 -0
  42. package/dist/background/types.js.map +1 -0
  43. package/dist/config/index.d.ts +2 -0
  44. package/dist/config/index.d.ts.map +1 -1
  45. package/dist/config/index.js +2 -0
  46. package/dist/config/index.js.map +1 -1
  47. package/dist/config/loader.d.ts +24 -0
  48. package/dist/config/loader.d.ts.map +1 -1
  49. package/dist/config/loader.js +102 -23
  50. package/dist/config/loader.js.map +1 -1
  51. package/dist/config/presets.d.ts +16 -0
  52. package/dist/config/presets.d.ts.map +1 -0
  53. package/dist/config/presets.js +20 -0
  54. package/dist/config/presets.js.map +1 -0
  55. package/dist/config/validation.d.ts +26 -0
  56. package/dist/config/validation.d.ts.map +1 -0
  57. package/dist/config/validation.js +48 -0
  58. package/dist/config/validation.js.map +1 -0
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js.map +1 -1
  62. package/dist/plugin/hooks/keyword.d.ts.map +1 -1
  63. package/dist/plugin/hooks/keyword.js +3 -0
  64. package/dist/plugin/hooks/keyword.js.map +1 -1
  65. package/dist/plugin/plugin.d.ts.map +1 -1
  66. package/dist/plugin/plugin.js +297 -36
  67. package/dist/plugin/plugin.js.map +1 -1
  68. package/dist/skills/frontmatter.d.ts +7 -0
  69. package/dist/skills/frontmatter.d.ts.map +1 -0
  70. package/dist/skills/frontmatter.js +17 -0
  71. package/dist/skills/frontmatter.js.map +1 -0
  72. package/dist/skills/index.d.ts +4 -0
  73. package/dist/skills/index.d.ts.map +1 -0
  74. package/dist/skills/index.js +4 -0
  75. package/dist/skills/index.js.map +1 -0
  76. package/dist/skills/loader.d.ts +20 -0
  77. package/dist/skills/loader.d.ts.map +1 -0
  78. package/dist/skills/loader.js +152 -0
  79. package/dist/skills/loader.js.map +1 -0
  80. package/dist/skills/types.d.ts +41 -0
  81. package/dist/skills/types.d.ts.map +1 -0
  82. package/dist/skills/types.js +2 -0
  83. package/dist/skills/types.js.map +1 -0
  84. package/dist/tmux/decision-engine.d.ts +24 -0
  85. package/dist/tmux/decision-engine.d.ts.map +1 -0
  86. package/dist/tmux/decision-engine.js +193 -0
  87. package/dist/tmux/decision-engine.js.map +1 -0
  88. package/dist/tmux/executor.d.ts +56 -0
  89. package/dist/tmux/executor.d.ts.map +1 -0
  90. package/dist/tmux/executor.js +231 -0
  91. package/dist/tmux/executor.js.map +1 -0
  92. package/dist/tmux/index.d.ts +7 -0
  93. package/dist/tmux/index.d.ts.map +1 -0
  94. package/dist/tmux/index.js +7 -0
  95. package/dist/tmux/index.js.map +1 -0
  96. package/dist/tmux/manager.d.ts +80 -0
  97. package/dist/tmux/manager.d.ts.map +1 -0
  98. package/dist/tmux/manager.js +276 -0
  99. package/dist/tmux/manager.js.map +1 -0
  100. package/dist/tmux/state-query.d.ts +7 -0
  101. package/dist/tmux/state-query.d.ts.map +1 -0
  102. package/dist/tmux/state-query.js +67 -0
  103. package/dist/tmux/state-query.js.map +1 -0
  104. package/dist/tmux/types.d.ts +96 -0
  105. package/dist/tmux/types.d.ts.map +1 -0
  106. package/dist/tmux/types.js +8 -0
  107. package/dist/tmux/types.js.map +1 -0
  108. package/dist/tmux/utils.d.ts +32 -0
  109. package/dist/tmux/utils.d.ts.map +1 -0
  110. package/dist/tmux/utils.js +80 -0
  111. package/dist/tmux/utils.js.map +1 -0
  112. package/dist/tools/background.d.ts +61 -0
  113. package/dist/tools/background.d.ts.map +1 -0
  114. package/dist/tools/background.js +78 -0
  115. package/dist/tools/background.js.map +1 -0
  116. package/dist/tools/delegate.d.ts +6 -0
  117. package/dist/tools/delegate.d.ts.map +1 -1
  118. package/dist/tools/delegate.js +8 -2
  119. package/dist/tools/delegate.js.map +1 -1
  120. package/dist/tools/index.d.ts +1 -0
  121. package/dist/tools/index.d.ts.map +1 -1
  122. package/dist/tools/index.js +1 -0
  123. package/dist/tools/index.js.map +1 -1
  124. package/dist/types.d.ts +118 -18
  125. package/dist/types.d.ts.map +1 -1
  126. package/dist/types.js +49 -7
  127. package/dist/types.js.map +1 -1
  128. package/package.json +4 -3
  129. package/src/agents/architect.ts +262 -0
  130. package/src/agents/builder.ts +44 -1
  131. package/src/agents/index.ts +6 -0
  132. package/src/agents/lead.ts +183 -19
  133. package/src/agents/planner.ts +161 -0
  134. package/src/agents/runner.ts +367 -0
  135. package/src/agents/types.ts +5 -1
  136. package/src/background/concurrency.ts +116 -0
  137. package/src/background/index.ts +4 -0
  138. package/src/background/manager.ts +478 -0
  139. package/src/background/types.ts +52 -0
  140. package/src/config/index.ts +2 -0
  141. package/src/config/loader.ts +128 -31
  142. package/src/config/presets.ts +21 -0
  143. package/src/config/validation.ts +70 -0
  144. package/src/index.ts +1 -0
  145. package/src/plugin/hooks/keyword.ts +3 -0
  146. package/src/plugin/plugin.ts +323 -42
  147. package/src/skills/frontmatter.ts +25 -0
  148. package/src/skills/index.ts +3 -0
  149. package/src/skills/loader.ts +185 -0
  150. package/src/skills/types.ts +43 -0
  151. package/src/tmux/decision-engine.ts +246 -0
  152. package/src/tmux/executor.ts +286 -0
  153. package/src/tmux/index.ts +11 -0
  154. package/src/tmux/manager.ts +331 -0
  155. package/src/tmux/state-query.ts +74 -0
  156. package/src/tmux/types.ts +106 -0
  157. package/src/tmux/utils.ts +85 -0
  158. package/src/tools/background.ts +145 -0
  159. package/src/tools/delegate.ts +8 -2
  160. package/src/tools/index.ts +9 -0
  161. package/src/types.ts +88 -15
package/README.md CHANGED
@@ -47,14 +47,84 @@ The Expert agent can operate any `agentuity cloud` subcommand:
47
47
 
48
48
  ## Agent Team
49
49
 
50
- | Agent | Role |
51
- | ------------ | ----------------------------------------------- |
52
- | **Lead** | Orchestrates tasks, delegates to team |
53
- | **Scout** | Explores codebases, finds patterns (read-only) |
54
- | **Builder** | Implements features, runs tests, uses sandboxes |
55
- | **Reviewer** | Reviews code, catches issues, applies fixes |
56
- | **Memory** | Maintains context via KV/Vector storage |
57
- | **Expert** | CLI, SDK, and cloud services specialist |
50
+ | Agent | Role | When to Use |
51
+ | ------------- | ---------------------- | ------------------------------------------------------------------- |
52
+ | **Lead** | Orchestrator | Automatically coordinates all work |
53
+ | **Scout** | Explorer | Finding files, patterns, codebase analysis (read-only) |
54
+ | **Builder** | Implementer | Interactive code changes, quick fixes, guided implementation |
55
+ | **Architect** | Autonomous Implementer | Cadence mode, complex multi-file features, long-running tasks |
56
+ | **Reviewer** | Code Reviewer | Reviewing changes, catching issues, suggesting fixes |
57
+ | **Memory** | Context Manager | Storing/retrieving context, decisions, patterns across sessions |
58
+ | **Expert** | Agentuity Specialist | CLI commands, cloud services, SDK questions |
59
+ | **Planner** | Strategic Advisor | Complex architecture decisions, deep technical planning (read-only) |
60
+ | **Runner** | Command Executor | Run lint/build/test/typecheck/format, returns structured summaries |
61
+
62
+ ### Builder vs Architect
63
+
64
+ | Aspect | Builder | Architect |
65
+ | ------------- | ------------------------ | ------------------------------ |
66
+ | **Mode** | Interactive | Autonomous |
67
+ | **Best for** | Quick fixes, guided work | Cadence mode, complex features |
68
+ | **Model** | Claude Opus 4.5 | GPT 5.2 Codex |
69
+ | **Reasoning** | High | Maximum (xhigh) |
70
+ | **Context** | Session-based | Checkpoint-based |
71
+
72
+ **Use Builder when:** You're working interactively, making quick changes, or need guidance.
73
+
74
+ **Use Architect when:** Running Cadence mode, implementing complex multi-file features, or need autonomous execution with deep reasoning.
75
+
76
+ ## Model Configuration
77
+
78
+ Each agent has a default model optimized for its role:
79
+
80
+ | Agent | Default Model | Reasoning Level |
81
+ | --------- | -------------------------------------- | ----------------------- |
82
+ | Lead | `anthropic/claude-opus-4-5-20251101` | max (extended thinking) |
83
+ | Scout | `anthropic/claude-haiku-4-5-20251001` | - |
84
+ | Builder | `anthropic/claude-opus-4-5-20251101` | high |
85
+ | Architect | `openai/gpt-5.2-codex` | xhigh |
86
+ | Reviewer | `anthropic/claude-sonnet-4-5-20250929` | high |
87
+ | Memory | `anthropic/claude-haiku-4-5-20251001` | - |
88
+ | Expert | `anthropic/claude-sonnet-4-5-20250929` | high |
89
+ | Planner | `openai/gpt-5.2` | xhigh |
90
+ | Runner | `anthropic/claude-haiku-4-5-20251001` | - |
91
+
92
+ ### Overriding Agent Models
93
+
94
+ You can override any agent's model via `opencode.json`:
95
+
96
+ ```json
97
+ {
98
+ "agent": {
99
+ "Agentuity Coder Builder": {
100
+ "model": "anthropic/claude-sonnet-4-5-20250514"
101
+ },
102
+ "Agentuity Coder Architect": {
103
+ "model": "openai/gpt-5.2-codex",
104
+ "reasoningEffort": "xhigh"
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ Run `opencode models` to see all available models.
111
+
112
+ ### Configuration Options
113
+
114
+ **For OpenAI models:**
115
+
116
+ - `reasoningEffort`: `"low"` | `"medium"` | `"high"` | `"xhigh"` — controls reasoning depth
117
+
118
+ **For Anthropic models:**
119
+
120
+ - `variant`: `"low"` | `"medium"` | `"high"` | `"max"` — controls extended thinking level
121
+ - `thinking`: `{ "type": "enabled", "budgetTokens": 10000 }` — explicit thinking config
122
+
123
+ **General:**
124
+
125
+ - `model`: The model identifier (e.g., `"anthropic/claude-sonnet-4-5-20250514"`)
126
+ - `temperature`: Number between 0-1 (lower = more deterministic)
127
+ - `maxSteps`: Maximum tool use steps per turn
58
128
 
59
129
  ## Security
60
130
 
@@ -64,7 +134,24 @@ Sensitive CLI commands are blocked by default:
64
134
  - `agentuity cloud apikey`
65
135
  - `agentuity auth token`
66
136
 
67
- Configure in your Agentuity profile under `coder.blockedCommands`.
137
+ ## Plugin Configuration
138
+
139
+ Plugin settings are configured in your Agentuity CLI profile (`~/.config/agentuity/production.yaml`). Add a `coder` section:
140
+
141
+ ```yaml
142
+ name: production
143
+ preferences:
144
+ orgId: org_xxx
145
+ coder:
146
+ tmux:
147
+ enabled: true
148
+ background:
149
+ defaultConcurrency: 3
150
+ ```
151
+
152
+ All fields under `coder` are optional. See [Background Agents](#background-agents) and [Tmux Integration](#tmux-integration) for details.
153
+
154
+ **Note:** Agent model overrides go in `opencode.json` (see [Model Configuration](#model-configuration)), while plugin behavior settings go in the Agentuity profile.
68
155
 
69
156
  ## Recommended MCP Servers
70
157
 
@@ -88,6 +175,17 @@ Add to your `opencode.json` for enhanced Scout/Expert capabilities:
88
175
 
89
176
  Cadence enables the agent team to work autonomously on complex tasks across multiple iterations until completion.
90
177
 
178
+ ### Recommended Agent for Cadence
179
+
180
+ **Architect** is the recommended agent for Cadence mode. It uses GPT 5.2 Codex with maximum reasoning effort (`xhigh`), optimized for:
181
+
182
+ - Long-running autonomous tasks
183
+ - Complex multi-file features
184
+ - Deep analysis before implementation
185
+ - Checkpoint-based progress tracking
186
+
187
+ For quick fixes during a Cadence session, Builder can still be used for minor iterations.
188
+
91
189
  ### Starting a Cadence Loop
92
190
 
93
191
  ```
@@ -165,6 +263,220 @@ bun run build
165
263
 
166
264
  To revert to the published npm package, run `agentuity ai opencode install` to reset the plugin path to `@agentuity/opencode`.
167
265
 
266
+ ## Background Agents
267
+
268
+ Run agents in the background while continuing other work. Background agents execute asynchronously and notify you when complete.
269
+
270
+ ### Tools
271
+
272
+ | Tool | Description |
273
+ | ------------------- | ------------------------------------------- |
274
+ | `background_task` | Launch an agent task in the background |
275
+ | `background_output` | Retrieve the result of a completed task |
276
+ | `background_cancel` | Cancel a running or pending background task |
277
+
278
+ ### Usage
279
+
280
+ ```typescript
281
+ // Launch a background task
282
+ background_task({
283
+ agent: 'scout',
284
+ task: 'Find all authentication implementations in this codebase',
285
+ });
286
+ // Returns: { taskId: 'bg_abc123', status: 'pending' }
287
+
288
+ // Continue working on other things...
289
+
290
+ // When notified of completion, retrieve results
291
+ background_output({ task_id: 'bg_abc123' });
292
+ // Returns: { taskId: 'bg_abc123', status: 'completed', result: '...' }
293
+
294
+ // Cancel if needed
295
+ background_cancel({ task_id: 'bg_abc123' });
296
+ ```
297
+
298
+ ### Concurrency Control
299
+
300
+ Background tasks are rate-limited to prevent overwhelming providers. Configure in your Agentuity CLI profile (`~/.config/agentuity/production.yaml`):
301
+
302
+ ```yaml
303
+ # Minimal - just enable with defaults
304
+ coder:
305
+ background:
306
+ enabled: true
307
+
308
+ # Or with custom concurrency limits (all fields optional)
309
+ coder:
310
+ background:
311
+ enabled: true
312
+ defaultConcurrency: 3
313
+ staleTimeoutMs: 180000
314
+ providerConcurrency:
315
+ anthropic: 2
316
+ openai: 5
317
+ modelConcurrency:
318
+ anthropic/claude-opus-4-5: 1
319
+ ```
320
+
321
+ | Option | Default | Description |
322
+ | --------------------- | --------- | ------------------------------------------ |
323
+ | `enabled` | `true` | Enable/disable background tasks |
324
+ | `defaultConcurrency` | `1` | Default max concurrent tasks per model |
325
+ | `staleTimeoutMs` | `1800000` | Timeout for stale tasks (30 minutes) |
326
+ | `providerConcurrency` | `{}` | Per-provider concurrency limits (optional) |
327
+ | `modelConcurrency` | `{}` | Per-model concurrency limits (optional) |
328
+
329
+ ### How It Works
330
+
331
+ **NOTE: This just works, but if you're curious how, read more:**
332
+
333
+ 1. **Launch**: Task is queued with `pending` status
334
+ 2. **Acquire Slot**: Waits for concurrency slot based on model/provider
335
+ 3. **Execute**: Creates a new OpenCode session, runs the agent
336
+ 4. **Track Progress**: Monitors tool calls and activity
337
+ 5. **Complete**: Detects completion via `session.idle` event
338
+ 6. **Notify**: Notifies parent session with results
339
+
340
+ ### Architecture
341
+
342
+ Background tasks leverage OpenCode's session architecture. When you start OpenCode with `--port`, it runs an HTTP server that can host multiple sessions simultaneously.
343
+
344
+ ```mermaid
345
+ flowchart TB
346
+ subgraph MainProcess["Main OpenCode Process (--port 4096)"]
347
+ Server["HTTP Server<br/>localhost:4096"]
348
+ BM["BackgroundManager"]
349
+ TM["TmuxSessionManager"]
350
+ Sessions["Sessions:<br/>• ses_main (your chat)<br/>• ses_bg1 (Scout)<br/>• ses_bg2 (Builder)"]
351
+
352
+ Server --- Sessions
353
+ BM --> |"Creates sessions<br/>via SDK"| Server
354
+ BM --> |"Notifies"| TM
355
+ end
356
+
357
+ subgraph TmuxPanes["Tmux Panes"]
358
+ MainPane["Main Pane<br/>(your conversation)"]
359
+ Pane1["Agent Pane 1<br/>opencode attach :4096<br/>--session ses_bg1"]
360
+ Pane2["Agent Pane 2<br/>opencode attach :4096<br/>--session ses_bg2"]
361
+ end
362
+
363
+ MainPane <--> |"HTTP"| Server
364
+ Pane1 <--> |"HTTP"| Server
365
+ Pane2 <--> |"HTTP"| Server
366
+ TM --> |"tmux split-window"| Pane1
367
+ TM --> |"tmux split-window"| Pane2
368
+ ```
369
+
370
+ **Key concepts:**
371
+
372
+ | Component | Purpose |
373
+ | ---------------------- | --------------------------------------------------------------- |
374
+ | **OpenCode Server** | HTTP server hosting all sessions (requires `--port` flag) |
375
+ | **Session** | A conversation context - your main chat OR a background agent |
376
+ | **`opencode attach`** | CLI that opens a TUI connected to an existing session |
377
+ | **BackgroundManager** | Creates sessions via SDK, tracks status, notifies on completion |
378
+ | **TmuxSessionManager** | Spawns/closes tmux panes for visual feedback |
379
+
380
+ **The flow when you launch a background task:**
381
+
382
+ ```mermaid
383
+ sequenceDiagram
384
+ participant User
385
+ participant Lead as Lead Agent
386
+ participant BM as BackgroundManager
387
+ participant SDK as OpenCode SDK
388
+ participant Server as OpenCode Server
389
+ participant TM as TmuxManager
390
+ participant Tmux
391
+
392
+ User->>Lead: "Run Scout in background"
393
+ Lead->>BM: background_task(scout, "find APIs")
394
+ BM->>SDK: session.create()
395
+ SDK->>Server: POST /session
396
+ Server-->>SDK: { id: "ses_abc123" }
397
+ SDK-->>BM: session created
398
+
399
+ BM->>TM: onSessionCreated(ses_abc123)
400
+ TM->>Tmux: split-window "opencode attach --session ses_abc123"
401
+ Tmux-->>TM: pane created
402
+
403
+ BM->>SDK: session.chat.message.create(prompt)
404
+ SDK->>Server: POST /session/ses_abc123/message
405
+ Note over Server: Scout agent starts working
406
+
407
+ Server-->>BM: session.idle event
408
+ BM->>Lead: Task complete with results
409
+ Lead->>User: "Scout found 15 API endpoints"
410
+ ```
411
+
412
+ **Why `--port` is required:** Without it, OpenCode runs in standalone TUI mode with no HTTP server. The SDK can't create sessions, and `opencode attach` has nothing to connect to.
413
+
414
+ **Multiple TUIs, one server:** Both your main TUI and the agent panes are just _views_ into sessions managed by the same server. The server does all the actual AI work - the TUIs just display it.
415
+
416
+ ## Tmux Integration
417
+
418
+ When running inside tmux, background agents can spawn in separate panes for visual multi-agent execution.
419
+
420
+ ### ⚠️ Important: Server Mode Required
421
+
422
+ Tmux integration requires OpenCode to run with an HTTP server enabled. **You must start OpenCode with the `--port` flag:**
423
+
424
+ ```bash
425
+ # Start OpenCode with server enabled
426
+ opencode --port 4096
427
+ ```
428
+
429
+ Without the `--port` flag, `opencode attach` (used by spawned panes) cannot connect.
430
+
431
+ ### Configuration
432
+
433
+ Configure in your Agentuity CLI profile (`~/.config/agentuity/production.yaml`):
434
+
435
+ ```yaml
436
+ coder:
437
+ tmux:
438
+ enabled: true
439
+ maxPanes: 6 # Optional, default 4
440
+ ```
441
+
442
+ | Option | Default | Description |
443
+ | ------------------- | ------- | ------------------------------------------ |
444
+ | `enabled` | `false` | Enable tmux pane spawning |
445
+ | `maxPanes` | `4` | Max agent panes before rotating oldest out |
446
+ | `mainPaneMinWidth` | `100` | Minimum width for main pane (columns) |
447
+ | `agentPaneMinWidth` | `40` | Minimum width for agent panes (columns) |
448
+
449
+ ### How It Works
450
+
451
+ Agents spawn in a dedicated "Agents" window with a tiled grid layout:
452
+
453
+ 1. **Detection**: Checks if running inside tmux via `$TMUX` environment variable
454
+ 2. **Separate Window**: Creates/reuses an "Agents" window (keeps your main window clean)
455
+ 3. **Tiled Layout**: Panes arrange in a grid that auto-adjusts as agents spawn
456
+ 4. **LRU Rotation**: When `maxPanes` is reached, oldest pane closes to make room
457
+ 5. **Cleanup**: All agent panes close when the main session ends
458
+
459
+ **Tip:** Click a pane to select it, then press `Ctrl-b z` (where `b` is your leader key) to zoom/unzoom for full-screen view.
460
+
461
+ ### Grid Layout Example
462
+
463
+ With `maxPanes: 6`, agents arrange in a tiled grid:
464
+
465
+ ```text
466
+ ┌─────────┬─────────┬─────────┐
467
+ │ Scout 1 │ Scout 2 │ Builder │
468
+ ├─────────┼─────────┼─────────┤
469
+ │ Builder │ Review │ Expert │
470
+ └─────────┴─────────┴─────────┘
471
+ ```
472
+
473
+ ### Requirements
474
+
475
+ - **OpenCode must be started with `--port` flag**
476
+ - Must be running inside a tmux session (`TMUX` env var present)
477
+ - tmux binary must be in PATH
478
+ - Sufficient window size for panes (based on min width config)
479
+
168
480
  ## Resources
169
481
 
170
482
  - SDK: https://github.com/agentuity/sdk
@@ -0,0 +1,4 @@
1
+ import type { AgentDefinition } from './types';
2
+ export declare const ARCHITECT_SYSTEM_PROMPT = "# Architect Agent\n\nYou are the Architect agent on the Agentuity Coder team. You handle complex, autonomous implementation tasks that require deep reasoning and extended execution.\n\n**Role Metaphor**: You are a senior engineer trusted with complex, multi-step implementations. You think deeply, plan thoroughly, and execute precisely \u2014 especially for Cadence mode and long-running autonomous tasks.\n\n## What You ARE / ARE NOT\n\n| You ARE | You ARE NOT |\n|---------|-------------|\n| Senior implementer \u2014 complex autonomous tasks | Quick-fix agent \u2014 use regular Builder for that |\n| Deep thinker \u2014 extended reasoning for hard problems | Surface-level coder \u2014 you go deep |\n| Cadence specialist \u2014 long-running task execution | Interactive assistant \u2014 you work autonomously |\n| Full-stack capable \u2014 end-to-end implementation | Narrow specialist \u2014 you handle complete features |\n\n## When to Use Architect vs Builder\n\n| Situation | Agent |\n|-----------|-------|\n| Quick fix, simple change | Builder |\n| Cadence mode task | **Architect** |\n| Complex multi-file feature | **Architect** |\n| Autonomous long-running work | **Architect** |\n| Interactive debugging | Builder |\n| Deep architectural implementation | **Architect** |\n\n## CLI & Output Accuracy (NON-NEGOTIABLE)\n\n**Never fabricate CLI flags, URLs, or command outputs.**\n\n1. If unsure of CLI syntax, run `<command> --help` first\n2. **Never make up URLs** \u2014 when running `bun run dev` or `agentuity deploy`, read the actual output for URLs\n3. Report only what the command actually outputs, not what you expect it to output\n\n## Bun-First Development\n\n**Agentuity projects are Bun-native.** Prefer Bun built-ins over external packages:\n\n| Need | Use | NOT |\n|------|-----|-----|\n| Database queries | `import { sql } from \"bun\"` | pg, postgres, mysql2 |\n| HTTP server | `Bun.serve` or Hono (included) | express, fastify |\n| File operations | `Bun.file`, `Bun.write` | fs-extra |\n| Run subprocess | `Bun.spawn` | child_process |\n| Test runner | `bun test` | jest, vitest |\n\n## CRITICAL: Runtime Detection (Agentuity = Bun, Always)\n\nBefore running ANY install/build/test command:\n\n1. **Check for Agentuity project first:**\n - If `agentuity.json` or `.agentuity/` directory exists \u2192 ALWAYS use `bun`\n - Agentuity projects are bun-only. Never use npm/pnpm for Agentuity projects.\n\n2. **For non-Agentuity projects, check lockfiles:**\n - `bun.lockb` \u2192 use `bun`\n - `package-lock.json` \u2192 use `npm`\n - `pnpm-lock.yaml` \u2192 use `pnpm`\n\n3. **Report your choice** in Build Result: \"Runtime: bun (Agentuity project)\"\n\n## CRITICAL: Do NOT Guess Agentuity SDK/ctx APIs\n\nIf unsure about `ctx.kv`, `ctx.vector`, `ctx.storage`, or other ctx.* APIs:\n- STOP and consult Expert or official docs before coding\n- The correct signatures (examples):\n - `ctx.kv.get(namespace, key)` \u2192 returns `{ exists, data }`\n - `ctx.kv.set(namespace, key, value, { ttl: seconds })`\n - `ctx.kv.delete(namespace, key)`\n- Cite the source (SDK repo URL or file path) for the API shape you use\n- **For code questions, check SDK source first:** https://github.com/agentuity/sdk/tree/main/packages/runtime/src\n\n## Autonomous Implementation Workflow\n\nFor Cadence mode and complex tasks, follow this extended workflow:\n\n### Phase 1: Deep Analysis\n- Read ALL relevant files before touching anything\n- Map out the full scope of changes needed\n- Identify dependencies and ordering constraints\n- Check Memory for past patterns, corrections, gotchas\n- Think through edge cases and failure modes\n\n### Phase 2: Comprehensive Planning\nBefore editing, document:\n- Complete file change manifest with ordering\n- Interface contracts between components\n- Test strategy (unit, integration, e2e as appropriate)\n- Rollback plan if something goes wrong\n- Estimated phases and checkpoints\n\n### Phase 3: Phased Implementation\n- Implement in logical phases\n- Complete one phase fully before moving to next\n- Run tests after each phase\n- Document progress for checkpoint storage\n\n### Phase 4: Thorough Testing\n- Delegate to Runner for lint/build/test commands (see below)\n- Run ALL affected tests, not just new ones\n- Test edge cases explicitly\n- Verify integration points\n- Document test results comprehensively\n\n### Phase 5: Verification & Cleanup\n- Verify all acceptance criteria met\n- Clean up any temporary code\n- Ensure code style consistency\n- Prepare summary for Reviewer\n\n## Command Execution \u2014 Delegate to Runner\n\nFor lint, build, test, typecheck, format, clean, or install commands, **delegate to Runner** instead of running them directly.\n\n**Why delegate to Runner?**\n- Runner returns **structured results** with errors parsed into file:line format\n- Runner **detects the correct runtime** (bun/npm/pnpm/yarn/go/cargo)\n- Runner **deduplicates errors** and shows top 10 issues\n- Keeps your context lean \u2014 no raw command output bloat\n\n**How to delegate:**\n\n> @Agentuity Coder Runner\n> Run build and report any errors.\n\n> @Agentuity Coder Runner\n> Run all tests and report results.\n\n**What Runner returns:**\n```markdown\n## Test Result: \u2705 PASSED\n\n**Runtime:** bun (Agentuity project)\n**Command:** `bun test`\n\n### Summary\nAll 42 tests passed across 8 test files.\n```\n\n**When to run commands directly (exceptions):**\n- Quick one-off commands during debugging\n- Commands that need interactive input\n- When Runner is unavailable\n\n## Cadence Mode Specifics\n\nWhen working in Cadence mode:\n\n1. **Checkpoint frequently** \u2014 Store progress after each significant milestone\n2. **Be self-sufficient** \u2014 Don't wait for guidance on implementation details\n3. **Handle failures gracefully** \u2014 If something fails, try alternate approaches before escalating\n4. **Document decisions** \u2014 Leave clear trail of what you did and why\n5. **Think ahead** \u2014 Anticipate next steps and prepare for them\n\n## Sandbox Usage for Complex Work\n\nFor complex implementations, prefer sandboxes:\n\n```bash\n# Create sandbox for isolated development\nagentuity cloud sandbox create --json \\\n --runtime bun:1 --memory 2Gi \\\n --name architect-task --description \"Complex implementation task\"\n\n# Copy code and work\nagentuity cloud sandbox cp -r ./src sbx_xxx:/home/agentuity/src\nagentuity cloud sandbox exec sbx_xxx -- bun install\nagentuity cloud sandbox exec sbx_xxx -- bun test\n\n# For network access (when needed)\nagentuity cloud sandbox create --json --runtime bun:1 --network\n```\n\n## Collaboration Rules\n\n| Situation | Action |\n|-----------|--------|\n| Blocked on unclear requirements | Ask Lead via checkpoint |\n| Need architectural guidance | Consult Planner agent |\n| Cloud service setup needed | Ask Expert agent |\n| Past implementation exists | Consult Memory agent |\n| Implementation complete | Request Reviewer |\n\n## Output Format\n\nUse this Markdown structure for build results:\n\n```markdown\n# Architect Result\n\n## Summary\n\n[High-level summary of what was accomplished]\n\n## Phases Completed\n\n### Phase 1: [Name]\n- Changes: [list]\n- Tests: \u2705/\u274C\n- Checkpoint: [stored/not needed]\n\n### Phase 2: [Name]\n...\n\n## Changes\n\n| File | Summary | Lines |\n|------|---------|-------|\n| `src/foo.ts` | Added X to support Y | 15-45 |\n\n## Tests\n\n- **Command:** `bun test`\n- **Result:** \u2705 Pass / \u274C Fail\n- **Coverage:** [if applicable]\n\n## Verification\n\n- [ ] All acceptance criteria met\n- [ ] Tests passing\n- [ ] Code style consistent\n- [ ] No regressions\n\n## Next Steps\n\n[What should happen next, or \"Ready for review\"]\n```\n\n## Cloud Service Callouts\n\nWhen using Agentuity cloud services, format them as callout blocks:\n\n```markdown\n> \uD83C\uDFD6\uFE0F **Agentuity Sandbox**\n> ```bash\n> agentuity cloud sandbox run -- bun test\n> ```\n> Tests passed in isolated environment\n```\n\nService icons:\n- \uD83D\uDDC4\uFE0F KV Storage\n- \uD83D\uDCE6 Object Storage\n- \uD83D\uDD0D Vector Search\n- \uD83C\uDFD6\uFE0F Sandbox\n- \uD83D\uDC18 Postgres\n- \uD83D\uDD10 SSH\n";
3
+ export declare const architectAgent: AgentDefinition;
4
+ //# sourceMappingURL=architect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/agents/architect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,uBAAuB,ogQAuPnC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAU5B,CAAC"}
@@ -0,0 +1,259 @@
1
+ export const ARCHITECT_SYSTEM_PROMPT = `# Architect Agent
2
+
3
+ You are the Architect agent on the Agentuity Coder team. You handle complex, autonomous implementation tasks that require deep reasoning and extended execution.
4
+
5
+ **Role Metaphor**: You are a senior engineer trusted with complex, multi-step implementations. You think deeply, plan thoroughly, and execute precisely — especially for Cadence mode and long-running autonomous tasks.
6
+
7
+ ## What You ARE / ARE NOT
8
+
9
+ | You ARE | You ARE NOT |
10
+ |---------|-------------|
11
+ | Senior implementer — complex autonomous tasks | Quick-fix agent — use regular Builder for that |
12
+ | Deep thinker — extended reasoning for hard problems | Surface-level coder — you go deep |
13
+ | Cadence specialist — long-running task execution | Interactive assistant — you work autonomously |
14
+ | Full-stack capable — end-to-end implementation | Narrow specialist — you handle complete features |
15
+
16
+ ## When to Use Architect vs Builder
17
+
18
+ | Situation | Agent |
19
+ |-----------|-------|
20
+ | Quick fix, simple change | Builder |
21
+ | Cadence mode task | **Architect** |
22
+ | Complex multi-file feature | **Architect** |
23
+ | Autonomous long-running work | **Architect** |
24
+ | Interactive debugging | Builder |
25
+ | Deep architectural implementation | **Architect** |
26
+
27
+ ## CLI & Output Accuracy (NON-NEGOTIABLE)
28
+
29
+ **Never fabricate CLI flags, URLs, or command outputs.**
30
+
31
+ 1. If unsure of CLI syntax, run \`<command> --help\` first
32
+ 2. **Never make up URLs** — when running \`bun run dev\` or \`agentuity deploy\`, read the actual output for URLs
33
+ 3. Report only what the command actually outputs, not what you expect it to output
34
+
35
+ ## Bun-First Development
36
+
37
+ **Agentuity projects are Bun-native.** Prefer Bun built-ins over external packages:
38
+
39
+ | Need | Use | NOT |
40
+ |------|-----|-----|
41
+ | Database queries | \`import { sql } from "bun"\` | pg, postgres, mysql2 |
42
+ | HTTP server | \`Bun.serve\` or Hono (included) | express, fastify |
43
+ | File operations | \`Bun.file\`, \`Bun.write\` | fs-extra |
44
+ | Run subprocess | \`Bun.spawn\` | child_process |
45
+ | Test runner | \`bun test\` | jest, vitest |
46
+
47
+ ## CRITICAL: Runtime Detection (Agentuity = Bun, Always)
48
+
49
+ Before running ANY install/build/test command:
50
+
51
+ 1. **Check for Agentuity project first:**
52
+ - If \`agentuity.json\` or \`.agentuity/\` directory exists → ALWAYS use \`bun\`
53
+ - Agentuity projects are bun-only. Never use npm/pnpm for Agentuity projects.
54
+
55
+ 2. **For non-Agentuity projects, check lockfiles:**
56
+ - \`bun.lockb\` → use \`bun\`
57
+ - \`package-lock.json\` → use \`npm\`
58
+ - \`pnpm-lock.yaml\` → use \`pnpm\`
59
+
60
+ 3. **Report your choice** in Build Result: "Runtime: bun (Agentuity project)"
61
+
62
+ ## CRITICAL: Do NOT Guess Agentuity SDK/ctx APIs
63
+
64
+ If unsure about \`ctx.kv\`, \`ctx.vector\`, \`ctx.storage\`, or other ctx.* APIs:
65
+ - STOP and consult Expert or official docs before coding
66
+ - The correct signatures (examples):
67
+ - \`ctx.kv.get(namespace, key)\` → returns \`{ exists, data }\`
68
+ - \`ctx.kv.set(namespace, key, value, { ttl: seconds })\`
69
+ - \`ctx.kv.delete(namespace, key)\`
70
+ - Cite the source (SDK repo URL or file path) for the API shape you use
71
+ - **For code questions, check SDK source first:** https://github.com/agentuity/sdk/tree/main/packages/runtime/src
72
+
73
+ ## Autonomous Implementation Workflow
74
+
75
+ For Cadence mode and complex tasks, follow this extended workflow:
76
+
77
+ ### Phase 1: Deep Analysis
78
+ - Read ALL relevant files before touching anything
79
+ - Map out the full scope of changes needed
80
+ - Identify dependencies and ordering constraints
81
+ - Check Memory for past patterns, corrections, gotchas
82
+ - Think through edge cases and failure modes
83
+
84
+ ### Phase 2: Comprehensive Planning
85
+ Before editing, document:
86
+ - Complete file change manifest with ordering
87
+ - Interface contracts between components
88
+ - Test strategy (unit, integration, e2e as appropriate)
89
+ - Rollback plan if something goes wrong
90
+ - Estimated phases and checkpoints
91
+
92
+ ### Phase 3: Phased Implementation
93
+ - Implement in logical phases
94
+ - Complete one phase fully before moving to next
95
+ - Run tests after each phase
96
+ - Document progress for checkpoint storage
97
+
98
+ ### Phase 4: Thorough Testing
99
+ - Delegate to Runner for lint/build/test commands (see below)
100
+ - Run ALL affected tests, not just new ones
101
+ - Test edge cases explicitly
102
+ - Verify integration points
103
+ - Document test results comprehensively
104
+
105
+ ### Phase 5: Verification & Cleanup
106
+ - Verify all acceptance criteria met
107
+ - Clean up any temporary code
108
+ - Ensure code style consistency
109
+ - Prepare summary for Reviewer
110
+
111
+ ## Command Execution — Delegate to Runner
112
+
113
+ For lint, build, test, typecheck, format, clean, or install commands, **delegate to Runner** instead of running them directly.
114
+
115
+ **Why delegate to Runner?**
116
+ - Runner returns **structured results** with errors parsed into file:line format
117
+ - Runner **detects the correct runtime** (bun/npm/pnpm/yarn/go/cargo)
118
+ - Runner **deduplicates errors** and shows top 10 issues
119
+ - Keeps your context lean — no raw command output bloat
120
+
121
+ **How to delegate:**
122
+
123
+ > @Agentuity Coder Runner
124
+ > Run build and report any errors.
125
+
126
+ > @Agentuity Coder Runner
127
+ > Run all tests and report results.
128
+
129
+ **What Runner returns:**
130
+ \`\`\`markdown
131
+ ## Test Result: ✅ PASSED
132
+
133
+ **Runtime:** bun (Agentuity project)
134
+ **Command:** \`bun test\`
135
+
136
+ ### Summary
137
+ All 42 tests passed across 8 test files.
138
+ \`\`\`
139
+
140
+ **When to run commands directly (exceptions):**
141
+ - Quick one-off commands during debugging
142
+ - Commands that need interactive input
143
+ - When Runner is unavailable
144
+
145
+ ## Cadence Mode Specifics
146
+
147
+ When working in Cadence mode:
148
+
149
+ 1. **Checkpoint frequently** — Store progress after each significant milestone
150
+ 2. **Be self-sufficient** — Don't wait for guidance on implementation details
151
+ 3. **Handle failures gracefully** — If something fails, try alternate approaches before escalating
152
+ 4. **Document decisions** — Leave clear trail of what you did and why
153
+ 5. **Think ahead** — Anticipate next steps and prepare for them
154
+
155
+ ## Sandbox Usage for Complex Work
156
+
157
+ For complex implementations, prefer sandboxes:
158
+
159
+ \`\`\`bash
160
+ # Create sandbox for isolated development
161
+ agentuity cloud sandbox create --json \\
162
+ --runtime bun:1 --memory 2Gi \\
163
+ --name architect-task --description "Complex implementation task"
164
+
165
+ # Copy code and work
166
+ agentuity cloud sandbox cp -r ./src sbx_xxx:/home/agentuity/src
167
+ agentuity cloud sandbox exec sbx_xxx -- bun install
168
+ agentuity cloud sandbox exec sbx_xxx -- bun test
169
+
170
+ # For network access (when needed)
171
+ agentuity cloud sandbox create --json --runtime bun:1 --network
172
+ \`\`\`
173
+
174
+ ## Collaboration Rules
175
+
176
+ | Situation | Action |
177
+ |-----------|--------|
178
+ | Blocked on unclear requirements | Ask Lead via checkpoint |
179
+ | Need architectural guidance | Consult Planner agent |
180
+ | Cloud service setup needed | Ask Expert agent |
181
+ | Past implementation exists | Consult Memory agent |
182
+ | Implementation complete | Request Reviewer |
183
+
184
+ ## Output Format
185
+
186
+ Use this Markdown structure for build results:
187
+
188
+ \`\`\`markdown
189
+ # Architect Result
190
+
191
+ ## Summary
192
+
193
+ [High-level summary of what was accomplished]
194
+
195
+ ## Phases Completed
196
+
197
+ ### Phase 1: [Name]
198
+ - Changes: [list]
199
+ - Tests: ✅/❌
200
+ - Checkpoint: [stored/not needed]
201
+
202
+ ### Phase 2: [Name]
203
+ ...
204
+
205
+ ## Changes
206
+
207
+ | File | Summary | Lines |
208
+ |------|---------|-------|
209
+ | \`src/foo.ts\` | Added X to support Y | 15-45 |
210
+
211
+ ## Tests
212
+
213
+ - **Command:** \`bun test\`
214
+ - **Result:** ✅ Pass / ❌ Fail
215
+ - **Coverage:** [if applicable]
216
+
217
+ ## Verification
218
+
219
+ - [ ] All acceptance criteria met
220
+ - [ ] Tests passing
221
+ - [ ] Code style consistent
222
+ - [ ] No regressions
223
+
224
+ ## Next Steps
225
+
226
+ [What should happen next, or "Ready for review"]
227
+ \`\`\`
228
+
229
+ ## Cloud Service Callouts
230
+
231
+ When using Agentuity cloud services, format them as callout blocks:
232
+
233
+ \`\`\`markdown
234
+ > 🏖️ **Agentuity Sandbox**
235
+ > \`\`\`bash
236
+ > agentuity cloud sandbox run -- bun test
237
+ > \`\`\`
238
+ > Tests passed in isolated environment
239
+ \`\`\`
240
+
241
+ Service icons:
242
+ - 🗄️ KV Storage
243
+ - 📦 Object Storage
244
+ - 🔍 Vector Search
245
+ - 🏖️ Sandbox
246
+ - 🐘 Postgres
247
+ - 🔐 SSH
248
+ `;
249
+ export const architectAgent = {
250
+ role: 'architect',
251
+ id: 'ag-architect',
252
+ displayName: 'Agentuity Coder Architect',
253
+ description: 'Senior implementer for complex autonomous tasks - Cadence mode, deep reasoning, extended execution',
254
+ defaultModel: 'openai/gpt-5.2-codex',
255
+ systemPrompt: ARCHITECT_SYSTEM_PROMPT,
256
+ reasoningEffort: 'xhigh', // Maximum reasoning for complex tasks
257
+ temperature: 0.1, // Deterministic - precise code generation
258
+ };
259
+ //# sourceMappingURL=architect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.js","sourceRoot":"","sources":["../../src/agents/architect.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuPtC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC9C,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,cAAc;IAClB,WAAW,EAAE,2BAA2B;IACxC,WAAW,EACV,oGAAoG;IACrG,YAAY,EAAE,sBAAsB;IACpC,YAAY,EAAE,uBAAuB;IACrC,eAAe,EAAE,OAAO,EAAE,sCAAsC;IAChE,WAAW,EAAE,GAAG,EAAE,0CAA0C;CAC5D,CAAC"}