command-code 1.3.0 → 1.3.1
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 +6 -0
- package/dist/bundled/command-code-knowledge/reference/custom-agents.md +276 -42
- package/dist/bundled/mod-builder/reference/api.md +2 -2
- package/dist/bundled/mod-builder/reference/hooks-and-events.md +4 -1
- package/dist/bundled/mod-builder/reference/overview.md +2 -2
- package/dist/bundled/mod-builder/reference/ui.md +1 -14
- package/dist/bundled/mod-builder/reference/verify.md +2 -2
- package/dist/cli.mjs +2 -2
- package/package.json +2 -2
- package/vsix/commandcode-vscode.vsix +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,91 +1,325 @@
|
|
|
1
|
-
<!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/
|
|
1
|
+
<!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/agents/page.mdx. Regenerate: pnpm generate:knowledge -->
|
|
2
2
|
|
|
3
3
|
# Custom Agents
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A subagent is a separate worker Command Code hands a task to. It runs in its own context window with its own tools, system prompt, and (optionally) its own model. Command Code can run several at once, so work like editing three modules can happen in parallel instead of one at a time.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Three built-in agents are always available: **General**, **Explore**, and **Plan**. You can add your own as Markdown files.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Quick start
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The fastest way to make a subagent is to ask for one:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
create a code-reviewer subagent that reviews diffs for bugs and security issues
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Command Code writes the agent file for you. From then on it delegates to that agent when the task matches.
|
|
20
|
+
|
|
21
|
+
To manage agents yourself, run:
|
|
14
22
|
|
|
15
23
|
```text
|
|
16
24
|
/agents
|
|
17
25
|
```
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
That's it for getting started. The rest of this page covers making agents by hand, how delegation works, and the full file reference.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Built-in agents
|
|
32
|
+
|
|
33
|
+
These ship with Command Code and are always available. They're read-only - you can't edit or delete them.
|
|
34
|
+
|
|
35
|
+
| **Agent** | **When it runs** | **Tools** |
|
|
36
|
+
| --------- | ---------------- | --------- |
|
|
37
|
+
| **General** | The default when no other agent fits. Research and multi-step tasks. | All tools |
|
|
38
|
+
| **Explore** | Codebase search and understanding that touches many files. | Read-only: `read_file`, `read_directory`, `read_multiple_files`, `grep` |
|
|
39
|
+
| **Plan** | Designing an approach and weighing trade-offs. | `read_file`, `read_multiple_files` |
|
|
40
|
+
|
|
41
|
+
When Command Code delegates without naming an agent, the task goes to **General**.
|
|
20
42
|
|
|
21
43
|
---
|
|
22
44
|
|
|
23
|
-
##
|
|
45
|
+
## Creating an agent
|
|
46
|
+
|
|
47
|
+
### Ask Command Code (recommended)
|
|
48
|
+
|
|
49
|
+
Describe the agent in plain language, as shown in [Quick start](#quick-start). Command Code drafts the name, description, system prompt, and a sensible tool set, then saves the file. You review and adjust.
|
|
50
|
+
|
|
51
|
+
Choosing **Create agents with Command Code** in the `/agents` menu shows the same thing - it points you back to just asking:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
Create agents with Command Code
|
|
55
|
+
|
|
56
|
+
Ask Command Code to create or update subagents for you, e.g.
|
|
57
|
+
|
|
58
|
+
‣ "create a code-reviewer subagent that reviews diffs for bugs"
|
|
59
|
+
‣ "make a changelog agent that uses a fast model"
|
|
60
|
+
|
|
61
|
+
Or edit the files directly:
|
|
62
|
+
|
|
63
|
+
• .commandcode/agents/ (this project)
|
|
64
|
+
• ~/.commandcode/agents/ (all projects)
|
|
65
|
+
|
|
66
|
+
Docs: https://commandcode.ai/docs/core-concepts/custom-agents
|
|
67
|
+
|
|
68
|
+
Press Enter to go back and just ask
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### The /agents manager
|
|
72
|
+
|
|
73
|
+
Run `/agents` to open the manager. It lists two create actions, your custom agents grouped by scope, and the read-only defaults.
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
Agents (2 agents)
|
|
77
|
+
|
|
78
|
+
1. Create agents with Command Code (recommended)
|
|
79
|
+
2. Create manually
|
|
80
|
+
|
|
81
|
+
User agents
|
|
82
|
+
> changelog-writer
|
|
83
|
+
release-notes
|
|
24
84
|
|
|
25
|
-
|
|
85
|
+
Project agents
|
|
86
|
+
code-reviewer
|
|
26
87
|
|
|
27
|
-
|
|
88
|
+
Default agents (read-only)
|
|
89
|
+
General
|
|
90
|
+
Explore
|
|
91
|
+
Plan
|
|
28
92
|
|
|
29
|
-
|
|
30
|
-
| --------- | -------- | --------------- |
|
|
31
|
-
| **Project** | `.commandcode/agents/` in the current repo | Shared with the team; commit in Git. |
|
|
32
|
-
| **Personal** | `~/.commandcode/agents/` | Available in every project on your machine. |
|
|
93
|
+
↑↓ navigate · Enter to select · Esc to close
|
|
33
94
|
|
|
34
|
-
|
|
95
|
+
Agents live in .commandcode/agents/ (project) and
|
|
96
|
+
~/.commandcode/agents/ (all projects) - edit the files directly anytime.
|
|
97
|
+
Docs: https://commandcode.ai/docs/core-concepts/custom-agents
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Sections only appear when they have agents. With no custom agents, the title reads `Agents (No custom agents)`.
|
|
101
|
+
|
|
102
|
+
### The manual wizard
|
|
35
103
|
|
|
36
|
-
|
|
37
|
-
| ---------- | --------------- |
|
|
38
|
-
| **Generate with Command Code (recommended)** | Describe the agent’s role and when to use it; Command Code drafts configuration for you. |
|
|
39
|
-
| **Manual configuration** | Set the identifier, system prompt, “when to use” description, and tools yourself. |
|
|
104
|
+
Pick **Create manually** to fill in every field yourself. The steps are: location → identifier → system prompt → description → tools → model → confirm.
|
|
40
105
|
|
|
41
|
-
|
|
106
|
+
**Choose where it lives:**
|
|
42
107
|
|
|
43
|
-
|
|
108
|
+
```text
|
|
109
|
+
Create new agent
|
|
110
|
+
Choose location
|
|
44
111
|
|
|
45
|
-
|
|
112
|
+
> 1. Project (.commandcode/agents/)
|
|
113
|
+
2. Personal (~/.commandcode/agents/)
|
|
114
|
+
```
|
|
46
115
|
|
|
47
|
-
|
|
48
|
-
- **Description** (when to use it)
|
|
49
|
-
- **System prompt**
|
|
116
|
+
Project agents are committed with the repo and shared with your team. Personal agents live in your home directory and work in every project.
|
|
50
117
|
|
|
51
|
-
|
|
118
|
+
**Name it, prompt it, describe when to use it.** Three steps set the identifier (must be unique, not a reserved name), the system prompt, and the description Command Code matches against to decide when to delegate.
|
|
52
119
|
|
|
53
|
-
|
|
120
|
+
```text
|
|
121
|
+
Create new agent
|
|
122
|
+
Agent type (identifier)
|
|
123
|
+
|
|
124
|
+
Enter a unique identifier for your agent:
|
|
125
|
+
|
|
126
|
+
> code-reviewer_
|
|
127
|
+
e.g. code-reviewer, unit-tester
|
|
128
|
+
|
|
129
|
+
Enter to continue · Esc to cancel
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Select tools.** Categories toggle groups; **Show advanced options** lists individual tools. The first row saves your choice.
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
Create new agent
|
|
136
|
+
Select tools
|
|
137
|
+
|
|
138
|
+
> [ Continue ]
|
|
139
|
+
────────────────────────────────
|
|
140
|
+
[x] Read-only tools
|
|
141
|
+
[x] Edit tools
|
|
142
|
+
[ ] Execution tools
|
|
143
|
+
[x] Search tools
|
|
144
|
+
[ Show advanced options ]
|
|
145
|
+
|
|
146
|
+
3 tools selected
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Select model.** Keep the session model, or pin one this agent always uses.
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
Create new agent
|
|
153
|
+
Select model
|
|
54
154
|
|
|
155
|
+
> 1. Inherit from session (default)
|
|
156
|
+
2. Pick a specific model
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Confirm.** A summary shows every field before the file is written:
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
Create new agent
|
|
163
|
+
Confirm and save
|
|
164
|
+
|
|
165
|
+
Name: code-reviewer
|
|
166
|
+
Location: .commandcode/agents/ (project)
|
|
167
|
+
Tools: Read-only, Edit, Search
|
|
168
|
+
Model: Inherit from session
|
|
169
|
+
|
|
170
|
+
Description (Tells Command Code when to use this agent):
|
|
171
|
+
Use this agent when you are done writing code and want a
|
|
172
|
+
diff reviewed for bugs and security issues.
|
|
173
|
+
|
|
174
|
+
System Prompt:
|
|
175
|
+
You are a meticulous code reviewer. Prioritize correctness,
|
|
176
|
+
security, and clear feedback. Cite file paths and lines.
|
|
177
|
+
|
|
178
|
+
Press Enter to save · Esc to cancel
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Agents you add or edit are picked up on the next turn - no restart.
|
|
182
|
+
|
|
183
|
+
### Edit the file directly
|
|
184
|
+
|
|
185
|
+
An agent is a Markdown file. The front matter configures it; the body is the system prompt.
|
|
186
|
+
|
|
187
|
+
```markdown
|
|
188
|
+
---
|
|
189
|
+
name: code-reviewer
|
|
190
|
+
description: Use after writing code to review a diff for bugs and security issues.
|
|
191
|
+
tools: read_file, read_multiple_files, grep, glob
|
|
192
|
+
model: claude-sonnet-5
|
|
55
193
|
---
|
|
56
194
|
|
|
57
|
-
|
|
195
|
+
You are a meticulous code reviewer. Prioritize correctness, security, and clear
|
|
196
|
+
feedback. Cite file paths and line numbers. Be concise.
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Drop the file in `.commandcode/agents/` (project) or `~/.commandcode/agents/` (personal) and it loads on the next turn. Full field list is in the [Reference](#reference).
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## How it works
|
|
204
|
+
|
|
205
|
+
You don't call a subagent yourself. You describe what you want, and Command Code decides when to delegate by calling its built-in `agent` tool. The subagent runs in its own loop, does the work, and returns one result.
|
|
206
|
+
|
|
207
|
+
- **Parallel runs.** Command Code starts independent subagents at the same time by making several `agent` calls in one turn. Five explorers, or three agents each editing a different module, run together instead of in sequence.
|
|
208
|
+
- **Isolated context.** A subagent's file reads and reasoning stay in its own context window, so a long exploration doesn't fill up the main conversation.
|
|
209
|
+
- **Own model.** An agent can pin its own model, so a slow planner and a fast implementer keep separate prompt caches.
|
|
210
|
+
- **One level deep.** Subagents can't start their own subagents - the `agent` tool is removed from their tool set.
|
|
211
|
+
|
|
212
|
+
### Background runs
|
|
58
213
|
|
|
59
|
-
|
|
214
|
+
A run can be detached. When it's started in the background (or the agent sets `background: true`), the `agent` tool returns right away with an `agent_id` and the main session keeps going. The result is collected later with the `agent_output` tool, which can `wait` for it, check `status`, or `kill` the run.
|
|
60
215
|
|
|
61
|
-
|
|
62
|
-
- **`description`** - Tells Command Code **when** to use this agent.
|
|
63
|
-
- **`tools`** - Comma-separated tool list, **`"*"`** for all tools, or a restriction such as read-only style lists.
|
|
64
|
-
- **`model`** - Optional model this agent always runs on (any `/model` id, e.g. `deepseek/deepseek-v4-pro` or `claude-sonnet-5`). Omit it or set `model: inherit` to follow the session's current model. Per-agent models let you pin deep-reasoning models to architect/planner agents while implementation or docs agents ride faster, cheaper ones - each keeps its own prompt cache.
|
|
216
|
+
### Where agents load from
|
|
65
217
|
|
|
66
|
-
|
|
218
|
+
| **Source** | **Path** | **Notes** |
|
|
219
|
+
| ---------- | -------- | --------- |
|
|
220
|
+
| Bundled | (built-in) | General, Explore, Plan - always present, read-only |
|
|
221
|
+
| Personal | `~/.commandcode/agents/` | Every project on your machine |
|
|
222
|
+
| Project | `.commandcode/agents/` | Committed with the repo; shared with the team |
|
|
67
223
|
|
|
68
|
-
|
|
224
|
+
They load in that order and the **first** definition of a name wins. Files are re-scanned each turn, so adds, edits, and deletes take effect right away.
|
|
69
225
|
|
|
70
|
-
|
|
226
|
+
Reserved names (`explore`, `plan`, `review`, `general`) are used by built-in behavior. A custom file with one of these names is ignored.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Reference
|
|
231
|
+
|
|
232
|
+
### Frontmatter fields
|
|
233
|
+
|
|
234
|
+
Only these keys are read; anything else is ignored. All except `name` are optional.
|
|
235
|
+
|
|
236
|
+
The agent's id, the name Command Code delegates to. Defaults to the filename without `.md` (`code-reviewer.md` → `code-reviewer`). Characters outside `a-z A-Z 0-9 _ -` become `_`. Can't be a reserved name.
|
|
237
|
+
When to use the agent. This is the text Command Code matches against, so be specific. Defaults to empty.
|
|
238
|
+
Tools the agent may use. `"*"` grants all; otherwise a comma- or space-separated list (or a YAML array). Omit it and the agent gets no tools.
|
|
239
|
+
Deny list applied after `tools`. Deny beats allow, so pair it with `tools: "*"` to mean "everything except these". Same format as `tools`.
|
|
240
|
+
Model this agent always runs on: any `/model` id. See [Available models](https://commandcode.ai/docs/reference/cli/models) for the full list, or run `cmd --list-models`. Omit it (or set `model: inherit`) to follow the session model.
|
|
241
|
+
Caps the agent's loop. Default `100`.
|
|
242
|
+
Overrides the session's permission mode for this agent. One of `default`, `auto-accept`, `bypass`, `plan`, `dont-ask`. A session already in `plan` or `bypass` wins. Defaults to inheriting the session.
|
|
243
|
+
When `true`, every run detaches: the `agent` tool returns an `agent_id` and results come from `agent_output`.
|
|
244
|
+
When `true`, the agent's final message is shown verbatim in the feed instead of a short "done" line. The model still receives it as the result.
|
|
245
|
+
|
|
246
|
+
### Tools
|
|
247
|
+
|
|
248
|
+
Tool ids are the same names shown in the `/agents` wizard's advanced list. How `tools` is read:
|
|
249
|
+
|
|
250
|
+
- `tools: "*"` - every tool, including connected MCP tools.
|
|
251
|
+
- `tools: read_file, grep, glob` - an allowlist. Comma- or space-separated; a YAML array also works.
|
|
252
|
+
- Omitted - no tools.
|
|
253
|
+
|
|
254
|
+
Common ids by category:
|
|
255
|
+
|
|
256
|
+
| **Category** | **Tool ids** |
|
|
257
|
+
| ------------ | ------------ |
|
|
258
|
+
| Read-only | `read_file`, `read_directory`, `read_multiple_files`, `grep` |
|
|
259
|
+
| Edit | `edit_file`, `write_file` |
|
|
260
|
+
| Execution | `shell_command`, `run_command`, `kill_shell` |
|
|
261
|
+
| Search | `web_search`, `web_fetch` |
|
|
262
|
+
| Other | `glob`, `todo_write`, `task_create`, `task_update`, `task_list`, `task_get`, `task_output`, `task_stop`, `cron_create`, `cron_list`, `cron_delete`, `get_diagnostics`, `get_command_code_knowledge`, `taste`, `ask_user_question`, `sleep`, `config`, `enter_plan_mode`, `exit_plan_mode`, `enter_worktree`, `exit_worktree` |
|
|
263
|
+
|
|
264
|
+
MCP tools go in by their raw name, e.g. `mcp__github__get_me`. The `agent` and `agent_output` tools can't be granted - that's what keeps delegation one level deep.
|
|
265
|
+
|
|
266
|
+
### Models
|
|
267
|
+
|
|
268
|
+
The `model` field takes any id you'd pass to `/model`. To find one:
|
|
269
|
+
|
|
270
|
+
- See [Available models](https://commandcode.ai/docs/reference/cli/models) for the full list,
|
|
271
|
+
- open the `/model` picker, or
|
|
272
|
+
- run `cmd --list-models` in the shell.
|
|
273
|
+
|
|
274
|
+
Use ids exactly as `--list-models` prints them. Examples: `claude-opus-4-8`, `claude-sonnet-5`, `claude-haiku-4-5`, `moonshotai/kimi-k2.6`, `zai-org/glm-5.2`.
|
|
275
|
+
|
|
276
|
+
Omitting `model` is the same as `model: inherit` - the agent follows the session's `/model`. Pinning a model gives the agent its own prompt cache, so a slow planner and a fast implementer don't thrash each other's.
|
|
277
|
+
|
|
278
|
+
### Full example
|
|
279
|
+
|
|
280
|
+
Every field, with valid values. Copy it and delete what you don't need.
|
|
281
|
+
|
|
282
|
+
**.commandcode/agents/report-writer.md**
|
|
71
283
|
```markdown
|
|
72
284
|
---
|
|
73
|
-
name:
|
|
74
|
-
description: "
|
|
75
|
-
tools: "
|
|
76
|
-
|
|
285
|
+
name: report-writer
|
|
286
|
+
description: "Writes a structured research report from the current repo. Delegate long-form summarization and analysis tasks here."
|
|
287
|
+
tools: "*" # grant everything…
|
|
288
|
+
disallowedTools: shell_command, write_file # …except shells and file writes
|
|
289
|
+
model: claude-opus-4-8 # any /model id, or omit to inherit
|
|
290
|
+
maxTurns: 40 # cap the loop (default 100)
|
|
291
|
+
permissionMode: plan # default|auto-accept|bypass|plan|dont-ask
|
|
292
|
+
background: true # detach; collect via agent_output
|
|
293
|
+
showOutput: true # render the final report in the feed
|
|
77
294
|
---
|
|
78
295
|
|
|
79
|
-
You are a
|
|
80
|
-
|
|
296
|
+
You are a research report writer. You receive one self-contained task and
|
|
297
|
+
produce a complete, well-structured Markdown report as your final message.
|
|
298
|
+
|
|
299
|
+
- Gather only the files and facts the task requires.
|
|
300
|
+
- Work on your own - you can't ask follow-up questions.
|
|
301
|
+
- Your final message is the deliverable; make it complete.
|
|
81
302
|
```
|
|
82
303
|
|
|
83
|
-
|
|
304
|
+
Quick lookup:
|
|
305
|
+
|
|
306
|
+
| **Field** | **Type** | **Values** | **Default** |
|
|
307
|
+
| --------- | -------- | ---------- | ----------- |
|
|
308
|
+
| `name` | string | id, sanitized to `a-z A-Z 0-9 _ -`; not reserved | filename |
|
|
309
|
+
| `description` | string | any text | `""` |
|
|
310
|
+
| `tools` | string \| list | `"*"`, or comma/space-separated ids, or a YAML list | none |
|
|
311
|
+
| `disallowedTools` | string \| list | same format as `tools`; applied after it | - |
|
|
312
|
+
| `model` | string | any `/model` id, or `inherit` | inherit |
|
|
313
|
+
| `maxTurns` | integer | positive integer | `100` |
|
|
314
|
+
| `permissionMode` | string | `default`, `auto-accept`, `bypass`, `plan`, `dont-ask` | inherit |
|
|
315
|
+
| `background` | boolean | `true` / `false` | `false` |
|
|
316
|
+
| `showOutput` | boolean | `true` / `false` | `false` |
|
|
84
317
|
|
|
85
318
|
---
|
|
86
319
|
|
|
87
320
|
## Next steps
|
|
88
321
|
|
|
89
322
|
- [Interactive mode](https://commandcode.ai/docs/core-concepts/interactive-mode) - slash commands and session controls
|
|
323
|
+
- [Background tasks](https://commandcode.ai/docs/core-concepts/background-tasks) - detached, long-running work
|
|
90
324
|
- [Memory](./memory.md) - project and user instructions in `AGENTS.md`
|
|
91
325
|
- [Skills](./skills.md) - reusable skill packages vs. full subagents
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `cmd.cwd` | `string` | workspace root |
|
|
13
13
|
| `cmd.session` | `ModSessionApi \| undefined` | persistence seam; undefined until bound |
|
|
14
14
|
| `cmd.events` | `ModEventBus` | `emit(channel, data?)` / `on(channel, handler)` cross-mod bus |
|
|
15
|
-
| `cmd.ui` | `ModUi` | `notify` / `confirm` / `select` / `input`
|
|
15
|
+
| `cmd.ui` | `ModUi` | `notify` / `confirm` / `select` / `input` / `setStatus` / `widget` / `refreshWidgets` |
|
|
16
16
|
| `cmd.sessions` | `ModSessionControls` | `compact` / `tree` / `leafId` / `navigateTree` / `setLabel` |
|
|
17
17
|
|
|
18
18
|
## Registration (factory-time; each returns `Disposable`)
|
|
@@ -78,4 +78,4 @@ The per-hook contracts, ordering guarantees, and error policy are in [the hook c
|
|
|
78
78
|
|
|
79
79
|
## `on` event types
|
|
80
80
|
|
|
81
|
-
Any `AgentEvent['type']` - including `run_start`, `run_end`, `turn_start`, `turn_end`, `model_request_start`, `model_request_end`, `tool_running`, `tool_completed`, `tool_errored`, `subagent_start`, `subagent_stop`, `compaction_start`, `compaction_done`, `notice`, `session_titled`, `mod_error` - plus the two host lifecycle events `session_start` / `session_shutdown`. (`subagent_start`/`subagent_stop` are SubagentStart/Stop; `compaction_start`/`compaction_done` are Pre/PostCompact; `notice` is Notification.) The full payload catalog is in [the AgentEvent catalog](./hooks-and-events.md#agent-event-catalog).
|
|
81
|
+
Any `AgentEvent['type']` - including `run_start`, `run_end`, `turn_start`, `turn_end`, `model_request_start`, `model_request_end`, `tool_running`, `tool_completed`, `tool_errored`, `subagent_start`, `subagent_stop`, `subagent_progress`, `compaction_start`, `compaction_done`, `notice`, `session_titled`, `permission_mode_changed`, `config_setting_changed`, `mod_error` - plus the two host lifecycle events `session_start` / `session_shutdown`. (`subagent_start`/`subagent_stop` are SubagentStart/Stop; `compaction_start`/`compaction_done` are Pre/PostCompact; `notice` is Notification.) The full payload catalog is in [the AgentEvent catalog](./hooks-and-events.md#agent-event-catalog).
|
|
@@ -224,12 +224,15 @@ One sync sink, fan out with `createEventBus`. Payloads are snapshots - never liv
|
|
|
224
224
|
| `tool_update` | streaming tool progress | `partial` content |
|
|
225
225
|
| `tool_completed` / `tool_errored` | after afterToolCall | post-hook `result` / `error` text; `afterToolCall`'s `isError` can select which one fires |
|
|
226
226
|
| `tool_hooks` | emitted by the user-hooks mod, before the phase's terminal tool event | `phase: 'pre'\|'post'`, `lines`, `outcome` |
|
|
227
|
-
| `subagent_start` / `subagent_stop` | the `
|
|
227
|
+
| `subagent_start` / `subagent_stop` | the `agent` tool brackets a nested sub-agent run | `toolCallId`, `subagentType`; stop adds `tokensUsed` |
|
|
228
|
+
| `subagent_progress` | per child tool call inside a running sub-agent | `toolCallId`, `subagentType`, `toolName`, `toolInput`, `tokensUsed` |
|
|
228
229
|
| `api_retry` | retry loop, after 3 silent attempts | `attempt`, `error`, `delayMs` |
|
|
229
230
|
| `compaction_start` / `compaction_done` | compaction mod | `tokensSaved` (done, only when > 0) |
|
|
230
231
|
| `notice` | user-facing info/warning | `level`, `message` |
|
|
231
232
|
| `skill_loaded` | a skill was activated by an explicit user `/name` invocation | `name` |
|
|
232
233
|
| `session_titled` | the auto-generated session title was persisted | `title` |
|
|
234
|
+
| `permission_mode_changed` | the effective permission mode changed (shift+tab, `/plan`, enter/exit plan tools) | `mode` |
|
|
235
|
+
| `config_setting_changed` | a setting changed through the `config` tool | `setting`, `value`, `previousValue?` |
|
|
233
236
|
| `continuation_recovery` | a turn was auto-continued (pause/empty/length/intent) | `kind`, `attempt`, `maxAttempts` |
|
|
234
237
|
| `tool_input_coerced` | ModelClient rescued malformed (array/null) tool input | `rawType`, `recovered` |
|
|
235
238
|
| `tool_input_repaired` | repair layer healed tool input pre-execution | `rulesFired`, `hintCount`, `receivedKeys` |
|
|
@@ -209,7 +209,7 @@ Runnable, single-file example mods ship with Command Code inside the bundled `mo
|
|
|
209
209
|
|
|
210
210
|
- **Hooks mutate, `on` observes.** Event handlers cannot block tools or rewrite context; that is what `cmd.hooks` is for.
|
|
211
211
|
- **Project mods are trust-gated** like project skills: they load only after the workspace trust prompt, because a mod is arbitrary code. User-scope and `--mod` mods always load. There is no sandbox - install packages you trust. Package installs run npm with `--ignore-scripts` (mods are jiti-loaded TypeScript; they need no build step, so lifecycle scripts are pure attack surface).
|
|
212
|
-
- **Print mode loads user-scope and `--mod` mods only**, with the ui bridge degraded to headless defaults (confirm → false, select/input → undefined - never auto-approved; `setStatus`/`widget` render nowhere
|
|
212
|
+
- **Print mode loads user-scope and `--mod` mods only**, with the ui bridge degraded to headless defaults (confirm → false, select/input → undefined - never auto-approved; `setStatus`/`widget` render nowhere). Project mods stay out of headless runs because print never shows a trust prompt; pass `--dangerously-skip-permissions` to opt a repo's own mods into a headless run (CI).
|
|
213
213
|
- **Mod-queued messages don't echo in the feed** the way typed input does - they land in the transcript and steer the model, but the visible record is the model's response.
|
|
214
214
|
- **Rendering is line-based, not component-based.** `cmd.addRenderer` returns styled text lines the host prints as feed rows; mods do not mount React components into the TUI. That keeps renderers host-agnostic (the same mod renders in any future host) and a crashing renderer degrades to a warning notice, never a broken screen.
|
|
215
215
|
- **Reload is the `/reload` path.** Mods load once per process; `/reload` restarts the process, which re-discovers and re-imports every mod (jiti caches nothing between loads). There is no in-place hot swap.
|
|
@@ -225,6 +225,6 @@ The rest of this page is the complete reference, in order:
|
|
|
225
225
|
|
|
226
226
|
- [ModApi reference](./api.md#mod-api-reference) — every field, registration verb, and live method.
|
|
227
227
|
- [Hooks and events](./hooks-and-events.md#hooks-and-events) — the mutating lifecycle, the `AgentEvent` catalog.
|
|
228
|
-
- [UI surface](./ui.md#ui-surface) — dialogs,
|
|
228
|
+
- [UI surface](./ui.md#ui-surface) — dialogs, footer status, editor widgets, custom feed rendering.
|
|
229
229
|
- [Packaging and install](./packaging.md#packaging-and-install) — `cmd mods add`, manifests, filtering, scopes.
|
|
230
230
|
- [Verify a mod](./verify.md#verify-a-mod) — load it, list it, test it, ship it.
|
|
@@ -7,19 +7,7 @@ Everything a mod can put on screen rides `cmd.ui`, `cmd.addRenderer`, and `cmd.s
|
|
|
7
7
|
## Notifications and dialogs
|
|
8
8
|
|
|
9
9
|
- `cmd.ui.notify(message)` - a `notice` feed row.
|
|
10
|
-
- `cmd.ui.confirm({title})` / `cmd.ui.select({title, options})` / `cmd.ui.input({title})` - the Interaction question modal in the TUI. Headless, each resolves its deterministic default: confirm → `false`, select/input → `undefined` - never auto-approved.
|
|
11
|
-
|
|
12
|
-
### Timed dialogs
|
|
13
|
-
|
|
14
|
-
Each dialog accepts `{timeoutMs, timeoutValue}`: after `timeoutMs` the dialog auto-resolves `timeoutValue` (default: the dialog's headless default). The TUI shows a visible countdown and dismisses the modal at the deadline; on a TIMED dialog a dismissal without an answer (auto-dismiss or Esc) also resolves `timeoutValue`. Headless, a timed dialog resolves `timeoutValue` immediately - it never blocks a print run.
|
|
15
|
-
|
|
16
|
-
```ts
|
|
17
|
-
const proceed = await cmd.ui.confirm({
|
|
18
|
-
title: 'Deploy to staging?',
|
|
19
|
-
timeoutMs: 15_000,
|
|
20
|
-
timeoutValue: true, // no answer in 15s = go ahead
|
|
21
|
-
});
|
|
22
|
-
```
|
|
10
|
+
- `cmd.ui.confirm({title, message?})` / `cmd.ui.select({title, options})` / `cmd.ui.input({title, placeholder?})` - the Interaction question modal in the TUI. Headless, each resolves its deterministic default: confirm → `false`, select/input → `undefined` - never auto-approved.
|
|
23
11
|
|
|
24
12
|
## Footer status segments and editor widgets
|
|
25
13
|
|
|
@@ -55,7 +43,6 @@ Rendering is deliberately **line-based, not component-based**: mods return style
|
|
|
55
43
|
| `notify` | notice feed row | printed notice |
|
|
56
44
|
| `confirm` | modal | resolves `false` |
|
|
57
45
|
| `select` / `input` | modal | resolves `undefined` |
|
|
58
|
-
| timed dialog | countdown, auto-resolve at deadline | resolves `timeoutValue` immediately |
|
|
59
46
|
| `setStatus` | no-op (wire-up pending) | no-op |
|
|
60
47
|
| `widget` | no-op (wire-up pending) | no-op |
|
|
61
48
|
| `showEntry` | rendered feed row | dropped |
|
|
@@ -26,7 +26,7 @@ Your mod must appear, with no load warnings. If it does not appear, the warning
|
|
|
26
26
|
- **Tool** - ask the model to use it by name ("call count_todos"). The tool call renders in the feed like any built-in.
|
|
27
27
|
- **Hook** - trigger the behavior it guards (for a `beforeToolCall` blocker, ask for the blocked action and watch the block reason land as the tool result).
|
|
28
28
|
- **Input interception** - type the pattern `transformInput` matches and confirm the rewrite/consume happened.
|
|
29
|
-
- **Status / widget** - the footer segment
|
|
29
|
+
- **Status / widget** - `cmd.ui.setStatus` / `cmd.ui.widget` / `cmd.ui.refreshWidgets` must return without throwing and hand back a `Disposable`. They render **nothing** today (TUI wire-up pending - see the [UI surface](./ui.md#ui-surface) note), so don't expect a footer segment or editor widget to appear yet; only verify the calls are safe.
|
|
30
30
|
- **Renderer** - `cmd.showEntry` rows render styled; an unregistered type pretty-prints as JSON.
|
|
31
31
|
|
|
32
32
|
### Test: block-dangerous-commands guards rm -rf
|
|
@@ -51,7 +51,7 @@ Mods load once per process. After editing the file, run `/reload` - it restarts
|
|
|
51
51
|
cmd -p "exercise the mod" --mod ./your-mod.ts
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Print mode loads user-scope and `--mod` mods with the UI bridge degraded to deterministic defaults (confirm → false, select/input → undefined
|
|
54
|
+
Print mode loads user-scope and `--mod` mods with the UI bridge degraded to deterministic defaults (confirm → false, select/input → undefined). A mod that must work in CI should behave sensibly under those defaults.
|
|
55
55
|
|
|
56
56
|
## Working from the bundled examples
|
|
57
57
|
|