pi-subagents 0.6.1 → 0.8.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.
- package/CHANGELOG.md +83 -0
- package/README.md +257 -21
- package/agent-management.ts +502 -0
- package/agent-manager-chain-detail.ts +116 -0
- package/agent-manager-detail.ts +185 -0
- package/agent-manager-edit.ts +284 -0
- package/agent-manager-list.ts +264 -0
- package/agent-manager-parallel.ts +302 -0
- package/agent-manager.ts +388 -0
- package/agent-serializer.ts +102 -0
- package/agent-templates.ts +60 -0
- package/agents.ts +87 -0
- package/async-execution.ts +5 -5
- package/chain-clarify.ts +272 -241
- package/chain-execution.ts +17 -6
- package/chain-serializer.ts +153 -0
- package/execution.ts +28 -22
- package/index.ts +343 -7
- package/package.json +1 -1
- package/render-helpers.ts +78 -0
- package/render.ts +1 -1
- package/run-history.ts +55 -0
- package/schemas.ts +17 -3
- package/settings.ts +8 -3
- package/subagent-runner.ts +12 -2
- package/text-editor.ts +270 -0
- package/types.ts +1 -1
- package/utils.ts +20 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.8.0] - 2026-02-09
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Management mode for `subagent` tool** via `action` field — the LLM can now discover, create, modify, and delete agent/chain definitions at runtime without manual file editing or restarts. Five actions:
|
|
9
|
+
- `list` — discover agents and chains with scope + description
|
|
10
|
+
- `get` — full detail for agent or chain, including path and system prompt/steps
|
|
11
|
+
- `create` — create agent (`.md`) or chain (`.chain.md`) definitions from `config`; immediately usable
|
|
12
|
+
- `update` — merge-update agent or chain fields, including rename with chain reference warnings
|
|
13
|
+
- `delete` — remove agent or chain definitions with dangling reference warnings
|
|
14
|
+
- **New `agent-management.ts` module** with all management handlers, validation, and serialization helpers
|
|
15
|
+
- **New management params** in tool schema: `action`, `chainName`, `config`
|
|
16
|
+
- **Agent/chain CRUD safeguards**
|
|
17
|
+
- Name sanitization (lowercase-hyphenated) for create/rename
|
|
18
|
+
- Scope-aware uniqueness checks across agents and chains
|
|
19
|
+
- File-path collision checks to prevent overwriting non-agent markdown files
|
|
20
|
+
- Scope disambiguation for update/delete when names exist in both user and project scope
|
|
21
|
+
- Not-found errors include available names for fast self-correction
|
|
22
|
+
- Per-step validation warnings for model registry and skill availability
|
|
23
|
+
- Validate-then-mutate ordering — all validation completes before any filesystem mutations
|
|
24
|
+
- **Config field mapping**: `tools` (comma-separated with `mcp:` prefix support), `reads` -> `defaultReads`, `progress` -> `defaultProgress`
|
|
25
|
+
- **Uniform field clearing** — all optional string fields accept both `false` and `""` to clear
|
|
26
|
+
- **JSON string parsing for `config` param** — handles `Type.Any()` delivering objects as JSON strings through the tool framework
|
|
27
|
+
|
|
28
|
+
## [0.7.0] - 2026-02-09
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **Agents Manager overlay** — browse, view, edit, create, and delete agent definitions from a TUI opened via `Ctrl+Shift+A` or the `/agents` command
|
|
32
|
+
- List screen with search/filter, scope badges (user/project), chain badges
|
|
33
|
+
- Detail screen showing resolved prompt, recent runs, all frontmatter fields
|
|
34
|
+
- Edit screen with field-by-field editing, model picker, skill picker, thinking picker, full-screen prompt editor
|
|
35
|
+
- Create from templates (Blank, Scout, Planner, Implementer, Code Reviewer, Blank Chain)
|
|
36
|
+
- Delete with confirmation
|
|
37
|
+
- Launch directly from overlay with task input and skip-clarify toggle (`Tab`)
|
|
38
|
+
- **Chain files** — `.chain.md` files define reusable multi-step chains with YAML-style frontmatter per step, stored alongside agent `.md` files
|
|
39
|
+
- Chain serializer with round-trip parse/serialize fidelity
|
|
40
|
+
- Three-state config semantics: `undefined` (inherit), value (override), `false` (disable)
|
|
41
|
+
- Chain detail screen with flow visualization and dependency map
|
|
42
|
+
- Chain edit screen (raw file editing)
|
|
43
|
+
- Create new chains from the template picker or save from the chain-clarify TUI (`W`)
|
|
44
|
+
- **Save overrides from clarify TUI** — press `S` to persist model/output/reads/skills/progress overrides back to the agent's frontmatter file, or `W` (chain mode) to save the full chain configuration as a `.chain.md` file
|
|
45
|
+
- **Multi-select and parallel from overlay** — select agents with `Tab`, then `Ctrl+R` for sequential chain or `Ctrl+P` to open the parallel builder
|
|
46
|
+
- Parallel builder: add same agent multiple times, set per-slot task overrides, shared task input
|
|
47
|
+
- Progressive footer: 0 selected (default hints), 1 selected (`[ctrl+r] run [ctrl+p] parallel`), 2+ selected (`[ctrl+r] chain [ctrl+p] parallel`)
|
|
48
|
+
- Selection count indicator in footer
|
|
49
|
+
- **Slash commands with per-step tasks** — `/run`, `/chain`, and `/parallel` execute subagents with full live progress rendering and tab-completion. Results are sent to the conversation for the LLM to discuss.
|
|
50
|
+
- Per-step tasks with quotes: `/chain scout "scan code" -> planner "analyze auth"`
|
|
51
|
+
- Per-step tasks for parallel: `/parallel scanner "find bugs" -> reviewer "check style"`
|
|
52
|
+
- `--` delimiter also supported: `/chain scout -- scan code -> planner -- analyze auth`
|
|
53
|
+
- Shared task (no `->`): `/chain scout planner -- shared task`
|
|
54
|
+
- Tab completion for agent names, aware of task sections (quotes and `--`)
|
|
55
|
+
- Inline per-step config: `/chain scout[output=ctx.md] "scan code" -> planner[reads=ctx.md] "analyze auth"`
|
|
56
|
+
- Supported keys: `output`, `reads` (`+` separates files), `model`, `skills`, `progress`
|
|
57
|
+
- Works on all three commands: `/run agent[key=val]`, `/chain`, `/parallel`
|
|
58
|
+
- **Run history** — per-agent JSONL recording of task, exit code, duration, timestamp
|
|
59
|
+
- Recent runs shown on agent detail screen (last 5)
|
|
60
|
+
- Lazy JSONL rotation (keeps last 1000 entries)
|
|
61
|
+
- **Thinking level as first-class agent field** — `thinking` frontmatter field (off, minimal, low, medium, high, xhigh) editable in the Agents Manager
|
|
62
|
+
- Picker with arrow key navigation and level descriptions
|
|
63
|
+
- At runtime, appended as `:level` suffix to the model string
|
|
64
|
+
- Existing suffix detection prevents double-application
|
|
65
|
+
- Displayed on agent detail screen
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
- **Parallel live progress** — top-level parallel execution (`tasks: [...]`) now shows live progress for all concurrent tasks. Each task's `onUpdate` updates its slot in a shared array and emits a merged view, so the renderer can display per-task status, current tools, recent output, and timing in real time. Previously only showed results after all tasks completed.
|
|
69
|
+
- **Slash commands frozen with no progress** — `/run`, `/chain`, and `/parallel` called `runSync`/`executeChain` directly, bypassing the tool framework. No `onUpdate` meant zero live progress, and `await`-ing execution blocked the command handler, making inputs unresponsive. Now all three route through `sendToolCall` → LLM → tool handler, getting full live progress rendering and responsive input for free.
|
|
70
|
+
- **`/run` model override silently dropped** — `/run scout[model=gpt-4o] task` now correctly passes the model through to the tool handler. Added `model` field to the tool schema for single-agent runs.
|
|
71
|
+
- **Quoted tasks with `--` inside split incorrectly** — the segment parser now checks for quoted strings before the `--` delimiter, so tasks like `scout "analyze login -- flow"` parse correctly instead of splitting on the embedded ` -- `.
|
|
72
|
+
- **Chain first-step validation in per-step mode** — `/chain scout -> planner "task"` now correctly errors instead of silently assigning planner's task to scout. The first step must have its own task when using `->` syntax.
|
|
73
|
+
- **Thinking level ignored in async mode** — `async-execution.ts` now applies thinking suffix to the model string before serializing to the runner, matching sync behavior
|
|
74
|
+
- **Step-level model override ignored in async mode** — `executeAsyncChain` now uses `step.model ?? agent.model` as the base for thinking suffix, matching the sync path in `chain-execution.ts`
|
|
75
|
+
- **mcpDirectTools not set in async mode** — `subagent-runner.ts` now sets `MCP_DIRECT_TOOLS` env var per step, matching the sync path in `execution.ts`
|
|
76
|
+
- **`{task}` double-corruption in saved chain launches** — stopped pre-replacing `{task}` in the overlay launch path; raw user task passed as top-level param to `executeChain()`, which uses `params.task` for `originalTask`
|
|
77
|
+
- **Agent serializer `skill` normalization** — `normalizedField` now maps `"skill"` to `"skills"` on the write path
|
|
78
|
+
- **Clarify toggle determinism** — all four ManagerResult paths (single, chain, saved chain, parallel) now use deterministic JSON with `clarify: !result.skipClarify`, eliminating silent breakage from natural language variants
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
- Agents Manager single-agent and saved-chain launches default to quick run (skip clarify TUI) — the user already reviewed config in the overlay. Multi-agent ad-hoc chains default to showing the clarify TUI so users can configure per-step tasks, models, output files, and skills before execution. Toggle with `Tab` in the task-input screen.
|
|
82
|
+
- Extracted `applyThinkingSuffix(model, thinking)` helper from inline logic in `execution.ts`, shared with `async-execution.ts`
|
|
83
|
+
- Text editor: added word navigation (Alt+Left/Right, Ctrl+Left/Right), word delete (Alt+Backspace), paste support
|
|
84
|
+
- Agent discovery (`agents.ts`): loads `.chain.md` files via `loadChainsFromDir`, exposes `discoverAgentsAll` for overlay
|
|
85
|
+
|
|
3
86
|
## [0.6.0] - 2026-02-02
|
|
4
87
|
|
|
5
88
|
### Added
|
package/README.md
CHANGED
|
@@ -39,8 +39,9 @@ Use `agentScope` parameter to control discovery: `"user"` (default), `"project"`
|
|
|
39
39
|
---
|
|
40
40
|
name: scout
|
|
41
41
|
description: Fast codebase recon
|
|
42
|
-
tools: read, grep, find, ls, bash, mcp:chrome-devtools
|
|
42
|
+
tools: read, grep, find, ls, bash, mcp:chrome-devtools # mcp: requires pi-mcp-adapter
|
|
43
43
|
model: claude-haiku-4-5
|
|
44
|
+
thinking: high # off, minimal, low, medium, high, xhigh
|
|
44
45
|
skill: safe-bash, chrome-devtools # comma-separated skills to inject
|
|
45
46
|
output: context.md # writes to {chain_dir}/context.md
|
|
46
47
|
defaultReads: context.md # comma-separated files to read
|
|
@@ -51,6 +52,8 @@ interactive: true # (parsed but not enforced in v1)
|
|
|
51
52
|
Your system prompt goes here (the markdown body after frontmatter).
|
|
52
53
|
```
|
|
53
54
|
|
|
55
|
+
The `thinking` field sets a default extended thinking level for the agent. At runtime it's appended as a `:level` suffix to the model string (e.g., `claude-sonnet-4-5:high`). If the model already has a thinking suffix (from a chain-clarify override), the agent's default is not double-applied.
|
|
56
|
+
|
|
54
57
|
**MCP Tools**
|
|
55
58
|
|
|
56
59
|
Agents can use MCP server tools directly (requires the [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) extension). Add `mcp:` prefixed entries to the `tools` field:
|
|
@@ -76,8 +79,151 @@ The MCP adapter's metadata cache must be populated for direct tools to work. On
|
|
|
76
79
|
|
|
77
80
|
**Resolution priority:** step override > agent frontmatter > disabled
|
|
78
81
|
|
|
82
|
+
## Quick Commands
|
|
83
|
+
|
|
84
|
+
| Command | Description |
|
|
85
|
+
|---------|-------------|
|
|
86
|
+
| `/run <agent> <task>` | Run a single agent with a task |
|
|
87
|
+
| `/chain agent1 "task1" -> agent2 "task2"` | Run agents in sequence with per-step tasks |
|
|
88
|
+
| `/parallel agent1 "task1" -> agent2 "task2"` | Run agents in parallel with per-step tasks |
|
|
89
|
+
| `/agents` | Open the Agents Manager overlay |
|
|
90
|
+
|
|
91
|
+
All commands validate agent names locally and tab-complete them, then route through the tool framework for full live progress rendering. Results are sent to the conversation for the LLM to discuss.
|
|
92
|
+
|
|
93
|
+
### Per-Step Tasks
|
|
94
|
+
|
|
95
|
+
Use `->` to separate steps and give each step its own task with quotes or `--`:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
/chain scout "scan the codebase" -> planner "create implementation plan"
|
|
99
|
+
/parallel scanner "find security issues" -> reviewer "check code style"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Both double and single quotes work. The `--` delimiter also works: `/chain scout -- scan code -> planner -- analyze auth`.
|
|
103
|
+
|
|
104
|
+
Steps without a task inherit behavior from the execution mode: chain steps get `{previous}` (output from the prior step), parallel steps get the first available task as a fallback.
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
/chain scout "analyze auth" -> planner -> implementer
|
|
108
|
+
# scout: "analyze auth", planner: gets scout's output, implementer: gets planner's output
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Shared task (no `->`):** Space-separated agents with a single `--` task:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
/chain scout planner -- analyze the auth system
|
|
115
|
+
/parallel scout reviewer -- check for security issues
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Inline Per-Step Config
|
|
119
|
+
|
|
120
|
+
Append `[key=value,...]` to any agent name to override its defaults:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
/chain scout[output=context.md] "scan code" -> planner[reads=context.md] "analyze auth"
|
|
124
|
+
/run scout[model=anthropic/claude-sonnet-4] summarize this codebase
|
|
125
|
+
/parallel scanner[output=scan.md] "find issues" -> reviewer[output=review.md] "check style"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
| Key | Example | Description |
|
|
129
|
+
|-----|---------|-------------|
|
|
130
|
+
| `output` | `output=context.md` | Write results to file (relative to chain dir for `/chain`/`/parallel`, temp dir for `/run`) |
|
|
131
|
+
| `reads` | `reads=a.md+b.md` | Read files before executing (`+` separates multiple) |
|
|
132
|
+
| `model` | `model=anthropic/claude-sonnet-4` | Override model for this step |
|
|
133
|
+
| `skills` | `skills=planning+review` | Override skills (`+` separates multiple) |
|
|
134
|
+
| `progress` | `progress` | Enable progress tracking |
|
|
135
|
+
|
|
136
|
+
Set `output=false`, `reads=false`, or `skills=false` to explicitly disable.
|
|
137
|
+
|
|
138
|
+
## Agents Manager
|
|
139
|
+
|
|
140
|
+
Press **Ctrl+Shift+A** or type `/agents` to open the Agents Manager overlay — a TUI for browsing, viewing, editing, creating, and launching agents and chains.
|
|
141
|
+
|
|
142
|
+
**Screens:**
|
|
143
|
+
|
|
144
|
+
| Screen | Description |
|
|
145
|
+
|--------|-------------|
|
|
146
|
+
| List | Browse all agents and chains with search/filter, scope badges, chain badges |
|
|
147
|
+
| Detail | View resolved prompt, frontmatter fields, recent run history |
|
|
148
|
+
| Edit | Edit fields with specialized pickers (model, thinking, skills, prompt editor) |
|
|
149
|
+
| Chain Detail | View chain steps with flow visualization and dependency map |
|
|
150
|
+
| Parallel Builder | Build parallel execution slots, add same agent multiple times, per-slot task overrides |
|
|
151
|
+
| Task Input | Enter task and launch with optional skip-clarify toggle |
|
|
152
|
+
| New Agent | Create from templates (Blank, Scout, Planner, Implementer, Code Reviewer, Blank Chain) |
|
|
153
|
+
|
|
154
|
+
**List screen keybindings:**
|
|
155
|
+
- `↑↓` — navigate agents/chains
|
|
156
|
+
- `Enter` — view detail
|
|
157
|
+
- Type any character — search/filter
|
|
158
|
+
- `Tab` — toggle selection (agents only)
|
|
159
|
+
- `Ctrl+N` — new agent from template
|
|
160
|
+
- `Ctrl+K` — clone current item
|
|
161
|
+
- `Ctrl+D` or `Del` — delete current item
|
|
162
|
+
- `Ctrl+R` — run selected (1 agent: launch, 2+: sequential chain)
|
|
163
|
+
- `Ctrl+P` — open parallel builder (from selection or cursor agent)
|
|
164
|
+
- `Esc` — clear query, then selection, then close overlay
|
|
165
|
+
|
|
166
|
+
**Parallel builder keybindings:**
|
|
167
|
+
- `↑↓` — navigate slots
|
|
168
|
+
- `Ctrl+A` — add agent (opens search picker)
|
|
169
|
+
- `Del` or `Ctrl+D` — remove slot
|
|
170
|
+
- `Enter` — edit per-slot task override
|
|
171
|
+
- `Ctrl+R` — continue to task input (requires 2+ slots)
|
|
172
|
+
- `Esc` — back to list
|
|
173
|
+
|
|
174
|
+
**Task input keybindings:**
|
|
175
|
+
- `Enter` — launch (or quick run if skip-clarify is on)
|
|
176
|
+
- `Tab` — toggle skip-clarify (defaults to on for all manager launches)
|
|
177
|
+
- `Esc` — back
|
|
178
|
+
|
|
179
|
+
**Multi-select workflow:** Select agents with `Tab`, then press `Ctrl+R` for a sequential chain or `Ctrl+P` to open the parallel builder. The parallel builder lets you add the same agent multiple times, set per-slot task overrides, and launch N agents in parallel. Slots without a custom task use the shared task entered on the next screen.
|
|
180
|
+
|
|
181
|
+
## Chain Files
|
|
182
|
+
|
|
183
|
+
Chains are `.chain.md` files stored alongside agent files. They define reusable multi-step pipelines.
|
|
184
|
+
|
|
185
|
+
**Chain file locations:**
|
|
186
|
+
|
|
187
|
+
| Scope | Path |
|
|
188
|
+
|-------|------|
|
|
189
|
+
| User | `~/.pi/agent/agents/{name}.chain.md` |
|
|
190
|
+
| Project | `.pi/agents/{name}.chain.md` |
|
|
191
|
+
|
|
192
|
+
**Format:**
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
---
|
|
196
|
+
name: scout-planner
|
|
197
|
+
description: Gather context then plan implementation
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## scout
|
|
201
|
+
output: context.md
|
|
202
|
+
|
|
203
|
+
Analyze the codebase for {task}
|
|
204
|
+
|
|
205
|
+
## planner
|
|
206
|
+
reads: context.md
|
|
207
|
+
model: anthropic/claude-sonnet-4-5:high
|
|
208
|
+
progress: true
|
|
209
|
+
|
|
210
|
+
Create an implementation plan based on {previous}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Each `## agent-name` section defines a step. Config lines (`output`, `reads`, `model`, `skills`, `progress`) go immediately after the header. A blank line separates config from the task text. Chains support the same three-state semantics as tool params: omitted (inherit from agent), value (override), `false` (disable).
|
|
214
|
+
|
|
215
|
+
Chains can be created from the Agents Manager template picker ("Blank Chain"), or saved from the chain-clarify TUI during execution.
|
|
216
|
+
|
|
79
217
|
## Features (beyond base)
|
|
80
218
|
|
|
219
|
+
- **Slash Commands**: `/run`, `/chain`, `/parallel` with tab-completion and live progress
|
|
220
|
+
- **Agents Manager Overlay**: Browse, view, edit, create, delete, and launch agents/chains from a TUI (`Ctrl+Shift+A`)
|
|
221
|
+
- **Management Actions**: LLM can list, inspect, create, update, and delete agent/chain definitions via `action` field
|
|
222
|
+
- **Chain Files**: Reusable `.chain.md` files with per-step config, saveable from the clarify TUI
|
|
223
|
+
- **Multi-select & Parallel**: Select agents in the overlay, launch as chain or parallel
|
|
224
|
+
- **Run History**: Per-agent JSONL recording of task, exit code, duration; shown on detail screen
|
|
225
|
+
- **Thinking Level**: First-class `thinking` frontmatter field with picker UI and runtime suffix application
|
|
226
|
+
- **Agent Templates**: Create agents from presets (Scout, Planner, Implementer, Code Reviewer, Blank Chain)
|
|
81
227
|
- **Skill Injection**: Agents declare skills in frontmatter; skills get injected into system prompts
|
|
82
228
|
- **Parallel-in-Chain**: Fan-out/fan-in patterns with `{ parallel: [...] }` steps within chains
|
|
83
229
|
- **Chain Clarification TUI**: Interactive preview/edit of chain templates and behaviors before execution
|
|
@@ -127,6 +273,8 @@ Single and parallel modes also support the clarify TUI for previewing/editing pa
|
|
|
127
273
|
- `w` - Edit writes/output file (single, chain only)
|
|
128
274
|
- `r` - Edit reads list (chain only)
|
|
129
275
|
- `p` - Toggle progress tracking (chain only)
|
|
276
|
+
- `S` - Save current overrides to agent's frontmatter file (all modes)
|
|
277
|
+
- `W` - Save chain configuration to a `.chain.md` file (chain only)
|
|
130
278
|
|
|
131
279
|
*Model selector mode:*
|
|
132
280
|
- `↑↓` - Navigate model list
|
|
@@ -150,10 +298,13 @@ Single and parallel modes also support the clarify TUI for previewing/editing pa
|
|
|
150
298
|
- `Esc` - Save changes and exit
|
|
151
299
|
- `Ctrl+C` - Discard changes and exit
|
|
152
300
|
- `←→` - Move cursor left/right
|
|
301
|
+
- `Alt+←→` - Move cursor by word
|
|
153
302
|
- `↑↓` - Move cursor up/down by display line (auto-scrolls)
|
|
154
303
|
- `Page Up/Down` or `Shift+↑↓` - Move cursor by viewport (12 lines)
|
|
155
304
|
- `Home/End` - Start/end of current display line
|
|
156
305
|
- `Ctrl+Home/End` - Start/end of text
|
|
306
|
+
- `Alt+Backspace` - Delete word backward
|
|
307
|
+
- Paste supported (multi-line in multi-line editors)
|
|
157
308
|
|
|
158
309
|
## Skills
|
|
159
310
|
|
|
@@ -249,14 +400,78 @@ Skills are specialized instructions loaded from SKILL.md files and injected into
|
|
|
249
400
|
{ dir: "/tmp/pi-async-subagent-runs/a53ebe46-..." }
|
|
250
401
|
```
|
|
251
402
|
|
|
403
|
+
## Management Actions
|
|
404
|
+
|
|
405
|
+
Agent definitions are not loaded into LLM context by default. Management actions let the LLM discover, inspect, create, and modify agent and chain definitions at runtime through the `subagent` tool — no manual file editing or restart required. Newly created agents are immediately usable in the same session. Set `action` and omit execution payloads (`task`, `chain`, `tasks`).
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
// Discover all agents and chains (management defaults to both scopes)
|
|
409
|
+
{ action: "list" }
|
|
410
|
+
{ action: "list", agentScope: "project" }
|
|
411
|
+
|
|
412
|
+
// Inspect one agent or chain (searches both scopes)
|
|
413
|
+
{ action: "get", agent: "scout" }
|
|
414
|
+
{ action: "get", chainName: "review-pipeline" }
|
|
415
|
+
|
|
416
|
+
// Create agent
|
|
417
|
+
{ action: "create", config: {
|
|
418
|
+
name: "Code Scout",
|
|
419
|
+
description: "Scans codebases for patterns and issues",
|
|
420
|
+
scope: "user",
|
|
421
|
+
systemPrompt: "You are a code scout...",
|
|
422
|
+
model: "anthropic/claude-sonnet-4",
|
|
423
|
+
tools: "read, bash, mcp:github/search_repositories",
|
|
424
|
+
skills: "parallel-scout",
|
|
425
|
+
thinking: "high",
|
|
426
|
+
output: "context.md",
|
|
427
|
+
reads: "shared-context.md",
|
|
428
|
+
progress: true
|
|
429
|
+
}}
|
|
430
|
+
|
|
431
|
+
// Create chain (presence of steps creates .chain.md)
|
|
432
|
+
{ action: "create", config: {
|
|
433
|
+
name: "review-pipeline",
|
|
434
|
+
description: "Scout then review",
|
|
435
|
+
scope: "project",
|
|
436
|
+
steps: [
|
|
437
|
+
{ agent: "scout", task: "Scan {task}", output: "context.md" },
|
|
438
|
+
{ agent: "reviewer", task: "Review {previous}", reads: ["context.md"] }
|
|
439
|
+
]
|
|
440
|
+
}}
|
|
441
|
+
|
|
442
|
+
// Update agent fields (merge semantics)
|
|
443
|
+
{ action: "update", agent: "scout", config: { model: "openai/gpt-4o" } }
|
|
444
|
+
{ action: "update", agent: "scout", config: { output: false, skills: "" } } // clear optional fields
|
|
445
|
+
{ action: "update", chainName: "review-pipeline", config: {
|
|
446
|
+
steps: [
|
|
447
|
+
{ agent: "scout", task: "Scan {task}", output: "context.md" },
|
|
448
|
+
{ agent: "reviewer", task: "Improved review of {previous}", reads: ["context.md"] }
|
|
449
|
+
]
|
|
450
|
+
}}
|
|
451
|
+
|
|
452
|
+
// Delete definitions
|
|
453
|
+
{ action: "delete", agent: "scout" }
|
|
454
|
+
{ action: "delete", chainName: "review-pipeline" }
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Notes:
|
|
458
|
+
- `create` uses `config.scope` (`"user"` or `"project"`), not `agentScope`.
|
|
459
|
+
- `update`/`delete` use `agentScope` only for scope disambiguation when the same name exists in both scopes.
|
|
460
|
+
- Agent config mapping: `reads -> defaultReads`, `progress -> defaultProgress`, and `tools` supports `mcp:` entries that map to direct MCP tools.
|
|
461
|
+
- To clear any optional field, set it to `false` or `""` (e.g., `{ model: false }` or `{ skills: "" }`). Both work for all string-typed fields.
|
|
462
|
+
|
|
252
463
|
## Parameters
|
|
253
464
|
|
|
254
465
|
| Param | Type | Default | Description |
|
|
255
466
|
|-------|------|---------|-------------|
|
|
256
|
-
| `agent` | string | - | Agent name (single mode) |
|
|
467
|
+
| `agent` | string | - | Agent name (single mode) or target for management get/update/delete |
|
|
257
468
|
| `task` | string | - | Task string (single mode) |
|
|
469
|
+
| `action` | string | - | Management action: `list`, `get`, `create`, `update`, `delete` |
|
|
470
|
+
| `chainName` | string | - | Chain name for management get/update/delete |
|
|
471
|
+
| `config` | object | - | Agent or chain config for management create/update |
|
|
258
472
|
| `output` | `string \| false` | agent default | Override output file for single agent |
|
|
259
473
|
| `skill` | `string \| string[] \| false` | agent default | Override skills (comma-separated string, array, or false to disable) |
|
|
474
|
+
| `model` | string | agent default | Override model for single agent |
|
|
260
475
|
| `tasks` | `{agent, task, cwd?, skill?}[]` | - | Parallel tasks (sync only) |
|
|
261
476
|
| `chain` | ChainItem[] | - | Sequential steps with behavior overrides (see below) |
|
|
262
477
|
| `clarify` | boolean | true (chains) | Show TUI to preview/edit chain; implies sync mode |
|
|
@@ -282,6 +497,7 @@ Skills are specialized instructions loaded from SKILL.md files and injected into
|
|
|
282
497
|
| `reads` | `string[] \| false` | agent default | Override files to read from chain dir |
|
|
283
498
|
| `progress` | boolean | agent default | Override progress.md tracking |
|
|
284
499
|
| `skill` | `string \| string[] \| false` | agent default | Override skills or disable all |
|
|
500
|
+
| `model` | string | agent default | Override model for this step |
|
|
285
501
|
|
|
286
502
|
*Parallel step fields:*
|
|
287
503
|
|
|
@@ -302,6 +518,7 @@ Skills are specialized instructions loaded from SKILL.md files and injected into
|
|
|
302
518
|
| `reads` | `string[] \| false` | agent default | Override files to read |
|
|
303
519
|
| `progress` | boolean | agent default | Override progress tracking |
|
|
304
520
|
| `skill` | `string \| string[] \| false` | agent default | Override skills or disable all |
|
|
521
|
+
| `model` | string | agent default | Override model for this task |
|
|
305
522
|
|
|
306
523
|
Status tool:
|
|
307
524
|
|
|
@@ -360,16 +577,22 @@ Session files (JSONL) are stored under a per-run session dir (temp by default).
|
|
|
360
577
|
|
|
361
578
|
## Live progress (sync mode)
|
|
362
579
|
|
|
363
|
-
During sync execution, the collapsed view shows
|
|
580
|
+
During sync execution, the collapsed view shows real-time progress for single, chain, and parallel modes.
|
|
581
|
+
|
|
582
|
+
**Chains:**
|
|
364
583
|
- Header: `... chain 1/2 | 8 tools, 1.4k tok, 38s`
|
|
365
584
|
- Chain visualization with status: `✓scout → ●planner` (✓=done, ●=running, ○=pending, ✗=failed)
|
|
366
585
|
- Current tool: `> read: packages/tui/src/...`
|
|
367
586
|
- Recent output lines (last 2-3 lines)
|
|
368
|
-
|
|
587
|
+
|
|
588
|
+
**Parallel:**
|
|
589
|
+
- Header: `... parallel 2/4 | 12 tools, 2.1k tok, 15s`
|
|
590
|
+
- Per-task step cards showing status icon, agent name, model, tool count, and duration
|
|
591
|
+
- Current tool and recent output for each running task
|
|
369
592
|
|
|
370
593
|
Press **Ctrl+O** to expand the full streaming view with complete output per step.
|
|
371
594
|
|
|
372
|
-
> **Note:** Chain visualization is only shown for sequential chains. Chains with parallel steps show
|
|
595
|
+
> **Note:** Chain visualization (the `✓scout → ●planner` line) is only shown for sequential chains. Chains with parallel steps show per-step cards instead.
|
|
373
596
|
|
|
374
597
|
## Async observability
|
|
375
598
|
|
|
@@ -403,20 +626,33 @@ Legacy events (still emitted):
|
|
|
403
626
|
## Files
|
|
404
627
|
|
|
405
628
|
```
|
|
406
|
-
├── index.ts
|
|
407
|
-
├── agents.ts
|
|
408
|
-
├── skills.ts
|
|
409
|
-
├── settings.ts
|
|
410
|
-
├── chain-clarify.ts
|
|
411
|
-
├── chain-execution.ts
|
|
412
|
-
├──
|
|
413
|
-
├── execution.ts
|
|
414
|
-
├──
|
|
415
|
-
├──
|
|
416
|
-
├──
|
|
417
|
-
├──
|
|
418
|
-
├──
|
|
419
|
-
├──
|
|
420
|
-
├──
|
|
421
|
-
|
|
629
|
+
├── index.ts # Main extension, tool registration, overlay dispatch
|
|
630
|
+
├── agents.ts # Agent + chain discovery, frontmatter parsing
|
|
631
|
+
├── skills.ts # Skill resolution, caching, and discovery
|
|
632
|
+
├── settings.ts # Chain behavior resolution, templates, chain dir
|
|
633
|
+
├── chain-clarify.ts # TUI for chain/single/parallel clarification
|
|
634
|
+
├── chain-execution.ts # Chain orchestration (sequential + parallel)
|
|
635
|
+
├── chain-serializer.ts # Parse/serialize .chain.md files
|
|
636
|
+
├── async-execution.ts # Async/background execution support
|
|
637
|
+
├── execution.ts # Core runSync, applyThinkingSuffix
|
|
638
|
+
├── render.ts # TUI rendering (widget, tool result display)
|
|
639
|
+
├── artifacts.ts # Artifact management
|
|
640
|
+
├── formatters.ts # Output formatting utilities
|
|
641
|
+
├── schemas.ts # TypeBox parameter schemas
|
|
642
|
+
├── utils.ts # Shared utility functions
|
|
643
|
+
├── types.ts # Shared types and constants
|
|
644
|
+
├── subagent-runner.ts # Async runner (detached process)
|
|
645
|
+
├── notify.ts # Async completion notifications
|
|
646
|
+
├── agent-manager.ts # Overlay orchestrator, screen routing, CRUD
|
|
647
|
+
├── agent-manager-list.ts # List screen (search, multi-select, progressive footer)
|
|
648
|
+
├── agent-manager-detail.ts # Detail screen (resolved prompt, runs, fields)
|
|
649
|
+
├── agent-manager-edit.ts # Edit screen (pickers, prompt editor)
|
|
650
|
+
├── agent-manager-parallel.ts # Parallel builder screen (slot management, agent picker)
|
|
651
|
+
├── agent-manager-chain-detail.ts # Chain detail screen (flow visualization)
|
|
652
|
+
├── agent-management.ts # Management action handlers (list, get, create, update, delete)
|
|
653
|
+
├── agent-serializer.ts # Serialize agents to markdown frontmatter
|
|
654
|
+
├── agent-templates.ts # Agent/chain creation templates
|
|
655
|
+
├── render-helpers.ts # Shared pad/row/header/footer helpers
|
|
656
|
+
├── run-history.ts # Per-agent run recording (JSONL)
|
|
657
|
+
└── text-editor.ts # Shared text editor (word nav, paste)
|
|
422
658
|
```
|