multiclaw 0.3.1 → 0.4.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/README.md CHANGED
@@ -9,13 +9,21 @@ Multi-agent orchestration CLI. Define a pipeline of AI agents, give them a requi
9
9
 
10
10
  ## Prerequisites
11
11
 
12
- At least one AI runtime must be installed:
13
-
14
- | Runtime | Install |
15
- |---------|---------|
16
- | `claude` (default) | `npm install -g @anthropic-ai/claude-code` |
17
-
18
- > **Future support:** We plan to add support for additional runtimes (Codex, OpenCode, Cursor) in upcoming releases.
12
+ multiclaw orchestrates agents from any installed **provider**. Every provider talks
13
+ to multiclaw over the same [Agent Client Protocol (ACP)](https://agentclientprotocol.com)
14
+ — the underlying *runtime* is always `acp`; the **provider** is the agent product you
15
+ choose. Install one or more:
16
+
17
+ | Provider | CLI | Install |
18
+ |----------|-----|---------|
19
+ | OpenCode | `opencode` | `npm install -g opencode` |
20
+ | Claude | `claude-agent-acp` (bundled) | install the Claude Code CLI (`claude`) and run `claude` to log in |
21
+ | Codex | `codex-acp` (bundled) | install the Codex CLI (`codex`) and run `codex login` |
22
+ | Cursor | `cursor-agent` | `curl https://cursor.com/install \| bash` |
23
+
24
+ `multiclaw init` auto-detects which providers are installed and only offers those;
25
+ `multiclaw doctor` shows the full picture (installed versions, auth hints, available
26
+ models). Codex and Cursor need an API key or login before they can run.
19
27
 
20
28
  ## Install
21
29
 
@@ -29,11 +37,15 @@ npm install -g multiclaw
29
37
  # 1. Scaffold a config in the current directory
30
38
  multiclaw init
31
39
 
32
- # 2. Run an orchestration
33
- multiclaw run "Build a REST API for a todo list" --ui
40
+ # 2. Open the interactive console
41
+ multiclaw
42
+
43
+ # ...or run a single orchestration headlessly
44
+ multiclaw run "Build a REST API for a todo list"
34
45
  ```
35
46
 
36
- `--ui` opens a real-time Dashboard in the browser. Omit it to run headless.
47
+ `multiclaw` with no subcommand opens a full-screen terminal console. Use `multiclaw run` for
48
+ headless execution (CI, piped output).
37
49
 
38
50
  ## Commands
39
51
 
@@ -45,6 +57,20 @@ Prompts:
45
57
  - **Project name** — defaults to the current directory name
46
58
  - **Preset** — pipeline template (see [Presets](#presets))
47
59
  - **Work directory** — where agents read and write files
60
+ - **Provider** — which agent product to use (`claude`, `opencode`, `codex`, `cursor`). Only installed providers are offered; missing ones are listed with install hints.
61
+ - **Model preference** — role-based tier defaults (recommended) or a specific tier/model
62
+ - **Per-agent overrides** (optional) — pick individual agents and set a model for each
63
+
64
+ ### `multiclaw doctor`
65
+
66
+ Diagnose the local environment: which providers are installed (with versions), what auth
67
+ each needs, how many models each exposes, and whether the current config's agents all
68
+ resolve to an installed provider. Exits non-zero if no provider is available.
69
+
70
+ ```bash
71
+ multiclaw doctor # full environment check
72
+ multiclaw doctor --config ./multiclaw.config.ts # also validates the config
73
+ ```
48
74
 
49
75
  ### `multiclaw run <requirement> [options]`
50
76
 
@@ -53,24 +79,11 @@ Runs the orchestration defined in your config file.
53
79
  | Option | Description |
54
80
  |--------|-------------|
55
81
  | `--config <path>` | Path to config file. Auto-discovers `multiclaw.config.ts` if omitted. |
56
- | `--ui` | Start the Dashboard server and open it in the browser. |
57
- | `--port <port>` | Dashboard port. Requires `--ui`. Default: `3210`. |
58
- | `--server-url <url>` | Stream events to a running `multiclaw serve` instance. |
59
- | `--no-leader` | Skip the leader agent and use the default pipeline directly. |
82
+ | `--no-leader` | (Batch mode only) Skip the leader and run the full configured team. Has no effect in the interactive console — the leader is always used there. |
60
83
 
61
84
  The `<requirement>` string is injected into every agent's prompt as `{{requirement}}`.
62
85
 
63
- Each run creates an isolated timestamped subdirectory inside `workDir` (e.g. `workspace/run-2026-10-08T12-00-00`).
64
-
65
- ### `multiclaw serve [options]`
66
-
67
- Start a persistent Dashboard server. Useful for CI or when you want a permanent URL to monitor runs.
68
-
69
- | Option | Description |
70
- |--------|-------------|
71
- | `--port <port>` | Port to listen on. Default: `3210`. |
72
-
73
- Connect a run to it with `multiclaw run "..." --server-url http://localhost:3210`.
86
+ Each run creates an isolated timestamped subdirectory inside `workDir` (e.g. `workspace/.multiclaw/runs/run-2026-10-08T12-00-00`).
74
87
 
75
88
  ## Config file
76
89
 
@@ -96,18 +109,21 @@ export default defineConfig({
96
109
  continueOnError: false, // optional; keep running if an agent fails
97
110
  maxConcurrency: 4, // optional; max agents running at once
98
111
 
99
- dashboard: {
100
- port: 3210,
101
- autoOpen: true,
112
+ // Project-wide defaults applied to every agent that doesn't override them.
113
+ // One line replaces repeating provider/model across all preset agents.
114
+ defaults: {
115
+ provider: "claude", // which agent product runs the team
116
+ model: "sonnet", // default model (overridable per agent)
102
117
  },
103
118
 
104
119
  agents: [
105
120
  {
106
121
  id: "architect", // unique identifier, used in dependsOn
107
122
  name: "Architect", // display name
108
- icon: "◆", // optional; shown in terminal and dashboard
109
- runtime: "claude", // optional; default: "claude"
110
- model: "opus", // optional; override default model for this agent
123
+ icon: "◆", // optional; shown in the console
124
+ provider: "claude", // optional; default: config.defaults.provider
125
+ modelTier: "strong", // optional; "strong" | "balanced" | "fast"
126
+ model: "opus", // optional; overrides tier/default for this agent
111
127
  systemPrompt: "You are a software architect.", // optional
112
128
  taskPrompt: `Design the system for {{requirement}}.
113
129
  Read the brief at {{file:brief.md}} and write architecture.md.`,
@@ -133,30 +149,32 @@ Read the brief at {{file:brief.md}} and write architecture.md.`,
133
149
 
134
150
  | Field | Type | Required | Description |
135
151
  |-------|------|----------|-------------|
136
- | `name` | string | ✓ | Project name, shown in the dashboard. |
137
- | `workDir` | string | ✓ | Base directory where agents read and write files. |
152
+ | `name` | string | ✓ | Project name, shown in the console header. |
153
+ | `workDir` | string | ✓ | Base directory where agents read and write files. Every console turn shares it. |
138
154
  | `agents` | AgentDefinition[] | ✓ | The agent pipeline (see Agent fields below). |
139
155
  | `leader` | AgentDefinition | | Optional routing agent (see [Leader](#leader)). |
140
156
  | `useLeader` | boolean | | Enable or disable the leader agent. Default: `true` when leader is configured. |
157
+ | `defaults` | object | | Project-wide `{ provider?, model?, command? }` applied to every agent that does not override them. Keeps generated configs short. |
141
158
  | `context` | Record<string, string> | | Variables available as `{{key}}` in every prompt. `requirement` is injected automatically. |
142
159
  | `logDir` | string | | Log output directory. Default: `workDir/.multiclaw/logs`. |
143
160
  | `continueOnError` | boolean | | Keep running when an agent fails. Default: `false`. |
144
161
  | `maxConcurrency` | number | | Max agents running in parallel. Default: unlimited. |
145
- | `dashboard.port` | number | | Dashboard port. Default: `3210`. |
146
- | `dashboard.autoOpen` | boolean | | Open the dashboard in a browser automatically. Default: `true`. |
147
162
 
148
163
  ### Agent fields
149
164
 
150
165
  | Field | Type | Required | Description |
151
166
  |-------|------|----------|-------------|
152
167
  | `id` | string | ✓ | Unique identifier. Used in `dependsOn`. |
153
- | `name` | string | ✓ | Display name shown in terminal and dashboard. |
168
+ | `name` | string | ✓ | Display name shown in the agent list. |
154
169
  | `taskPrompt` | string | ✓ | Prompt sent to the AI runtime. Supports template variables. |
155
170
  | `systemPrompt` | string | | Optional system prompt prepended to `taskPrompt`. |
156
171
  | `icon` | string | | Unicode icon shown next to the agent name. |
157
- | `runtime` | string | | `claude` (default). Additional runtimes coming soon. |
158
- | `model` | string | | Override the default model for this agent. E.g. `"opus"`, `"sonnet"`, `"haiku"`. Takes precedence over `models`. |
159
- | `models` | Record<string, string> | | Map of runtime names to model names. Used when `model` is not set. E.g. `{ claude: "opus", openai: "gpt-4" }`. |
172
+ | `description` | string | | One-line role, shown beside the agent's name on the console's first screen. Every built-in preset sets one. |
173
+ | `provider` | string | | Agent product this agent runs on: `claude`, `opencode`, `codex`, or `cursor`. Defaults to `config.defaults.provider`. All providers speak the same `acp` runtime. |
174
+ | `runtime` | string | | **Legacy.** Always `"acp"` today. Use `provider` instead. Retained for backward compatibility. |
175
+ | `modelTier` | `"strong"` \| `"balanced"` \| `"fast"` | | Declares the capability this agent needs; the catalog maps each tier to a provider-specific model id. Ignored when `model` is set. |
176
+ | `model` | string | | Override the model id for this agent (provider-specific, e.g. `"opus"`, `"sonnet"`, `"haiku"` for Claude). Takes precedence over `modelTier` and `models`. |
177
+ | `models` | Record<string, string> | | Map of provider id (or the legacy `"acp"`) to a model id, e.g. `{ claude: "sonnet", opencode: "opencode/big-pickle" }`. Used when `model`/`modelTier` are unset. |
160
178
  | `tools` | string[] | | Allowed tools. Default: `["Read", "Write", "Bash"]`. |
161
179
  | `dependsOn` | string[] | | Agent ids that must complete before this agent starts. |
162
180
  | `timeout` | number | | Per-agent timeout in ms. Default: `600000` (10 min). |
@@ -184,16 +202,122 @@ Stage 3: backend-developer │ ui-designer ← parallel
184
202
  Stage 4: code-reviewer │ devops ← parallel
185
203
  ```
186
204
 
187
- ## Dashboard
205
+ ## Interactive console
188
206
 
189
- The real-time web UI shows:
207
+ `multiclaw` with no subcommand opens a full-screen terminal console. It is a **turn-based
208
+ conductor loop**, not a chat: each turn you type is one complete orchestration run of the whole
209
+ pipeline, and the console stays open so you can run the next one.
190
210
 
191
- - Stage timeline with agent status (running / done / failed / skipped)
192
- - Live streaming logs per agent
193
- - Per-agent duration and retry count
194
- - Elapsed time while running; total time on completion
211
+ ```
212
+ ◆ multiclaw · dev-team turn 2 · 00:12
213
+ ────────────────────────────────────────────────────────────────────────────
214
+ ✓ ◆ Leader ──▸ ① ⠹ ◇ Architect ──▸ ② ○ ◇ Developer ──▸ ③ ○ ◇ Reviewer
215
+
216
+ TEAM 1/4 │ Architect · sonnet-4 · ⠹ running 4.2s ▼
217
+ ✓ ◆ Leader 3.1s │ Read packages/core/src/orchestrator/…
218
+ › ⠹ ◇ Architect 4.2s │ Grep "withTimeout" in packages/core/src
219
+ ○ ◇ Developer — │ Edit utils/timeout.ts — abort-safe
220
+ ○ ◇ Reviewer — │ Bash pnpm -r test
221
+
222
+ » also add tests
223
+ › type to queue a follow-up…
224
+ ⠹ running 4.2s · 1/4 agents · 1 queued enter queues · ctrl+c cancel
225
+ ```
195
226
 
196
- Start it with `--ui` on `run`, or run `multiclaw serve` for a persistent instance.
227
+ | Region | Shows |
228
+ |--------|-------|
229
+ | Header | Project name, turn number, and the phase or elapsed time |
230
+ | Pipeline rail | The leader, then each stage in order, joined by `──▸` |
231
+ | Team panel | One row per agent: status glyph, name, live time, and progress (`1/4`) |
232
+ | Stream panel | Live output of the focused agent, with a `▼` live / `⏸` parked marker |
233
+ | Reply panel | What the leader answered, when a turn needed no pipeline |
234
+ | Review banner | `viewing turn N …` while a past turn is open |
235
+ | Queue strip | Follow-ups typed mid-run, in the order they will run |
236
+ | Prompt | Where you type — live even while a turn is running |
237
+ | Hint bar | Aggregate status on the left, the keys that work *right now* on the right |
238
+
239
+ Status glyphs: `○` queued · `◐` running (a spinner while live) · `↻` retrying · `✓` done ·
240
+ `✗` failed · `⊘` skipped.
241
+
242
+ **First run.** Before the first turn the body shows the team from your config — each agent with the
243
+ `description` of what it is for — rather than an empty pane. `tab` moves the `›` caret down the list;
244
+ once a turn is running the caret follows whichever agent is speaking.
245
+
246
+ **Not every turn needs the team.** The leader decides that first. Ask it a question, or say hello,
247
+ and it answers in prose: the body swaps to the reply, the footer reads `✓ answered`, and no agent
248
+ runs. When the request is a real task but too vague to plan, the leader asks instead — the footer
249
+ reads `? needs your input` and your next line is the answer.
250
+
251
+ ### Keys
252
+
253
+ The prompt always holds focus, so exactly two keys are reserved: `?` and `/`, and only while the
254
+ line is empty *and* the console is idle. Everything else is a named key or an ordinary character,
255
+ which is what keeps typing a requirement from tripping over shortcuts.
256
+
257
+ | Key | Action |
258
+ |-----|--------|
259
+ | `enter` | Run the typed requirement — or queue it while a turn is running |
260
+ | `tab` / `shift+tab` | Cycle the focused agent |
261
+ | `↑` `↓` `pgup` `pgdn` | Scroll the focused agent's stream |
262
+ | `←` `→` `home` `end` | Move the caret |
263
+ | `esc` | Stop reading a past turn, clear the line, or close an overlay |
264
+ | `?` | Key map (idle, empty line only) |
265
+ | `/` | Command menu (empty line only) |
266
+ | `ctrl+l` | Clear the focused agent's log |
267
+ | `ctrl+c` | Cancel the running turn *and its queue*; again when idle to quit |
268
+
269
+ Scrolling up parks the stream and scrolling back to the bottom resumes it, so there is no follow
270
+ toggle to remember. While a turn runs the pane follows whichever agent starts next, until you cycle
271
+ the focus by hand.
272
+
273
+ **Typing while the team works.** The prompt stays live. Anything you submit mid-run joins the queue
274
+ strip above it and starts as the next turn the moment the console goes idle — so a thought you have
275
+ while watching the output is never lost. Cancelling drops the queue with the turn, since "cancel"
276
+ should mean stop.
277
+
278
+ Cancelling aborts the in-flight agents and their child processes rather than leaving them running in
279
+ the background.
280
+
281
+ ### Commands
282
+
283
+ Type `/` on an empty line for a filtered list.
284
+
285
+ | Command | Action |
286
+ |---------|--------|
287
+ | `/agents` | List the configured team |
288
+ | `/focus <id>` | Focus an agent by id |
289
+ | `/clear` | Clear the focused agent's log |
290
+ | `/history` | Browse finished turns |
291
+ | `/cancel` | Cancel the running turn and its queue |
292
+ | `/help` | Key map |
293
+ | `/quit` | Exit |
294
+
295
+ The console renders on the alternate screen buffer, so your shell scrollback is preserved.
296
+
297
+ ### Workspace
298
+
299
+ The console is iterative, so every turn runs against the **same** `workDir` — a follow-up like "now
300
+ add tests for that" sees the files the previous turn wrote. `task-plan.json` is cleared at the start
301
+ of each turn so a plan left over from an earlier requirement can never be re-applied. Only the logs
302
+ are per-run: `workDir/.multiclaw/runs/run-<timestamp>/logs/`.
303
+
304
+ `multiclaw run` is deliberately different: it sandboxes each invocation in its own
305
+ `run-<timestamp>/` directory.
306
+
307
+ ### History
308
+
309
+ `/history` lists finished turns newest first, with each turn's outcome, duration, agent count and
310
+ requirement. `↑` `↓` select and `enter` opens one for reading — the panes render that turn behind a
311
+ `viewing turn N` banner, and `esc` returns to the live turn. Scrolling and `tab` apply to what you
312
+ are reading, never to the turn that is still running. The turn on screen is not listed, and the last
313
+ 20 finished turns are kept.
314
+
315
+ On a narrow terminal (under 72 columns) the team panel is dropped and the stream takes the full
316
+ width; on a short one (under 16 rows) the pipeline rail goes too. The header, prompt and hint bar are
317
+ never dropped.
318
+
319
+ > **No TTY?** The console needs an interactive terminal. In CI, in a pipe, or over a non-TTY SSH
320
+ > session it exits with a message pointing at `multiclaw run`, which runs the same pipeline headless.
197
321
 
198
322
  ## Logs
199
323
 
@@ -229,7 +353,24 @@ Presets are pipeline templates you can pick during `multiclaw init`:
229
353
 
230
354
  ## Leader
231
355
 
232
- The `leader` field adds a routing agent that runs **before** the main pipeline. It reads the requirement and inspects the codebase, then decides which agents are actually needed for this task. Agents the leader omits are skipped.
356
+ The `leader` field adds a routing agent that runs **before** the main pipeline. It reads the requirement and inspects the codebase, then decides what the turn actually needs:
357
+
358
+ | Decision | Meaning |
359
+ |----------|---------|
360
+ | `run` | It is a task the leader can scope — name the minimum set of agents needed |
361
+ | `reply` | A greeting or a question it can answer on the spot; no agent runs |
362
+ | `ask` | A real task, but too vague to plan; it asks the one question that unblocks it |
363
+
364
+ The leader is asked for a single JSON object:
365
+
366
+ ```json
367
+ {"mode": "run", "run": ["backend-developer", "code-reviewer"]}
368
+ {"mode": "reply", "message": "Hi — ask me for a change to this project."}
369
+ {"mode": "ask", "message": "Which database should I target?"}
370
+ ```
371
+
372
+ A bare `{"run": [...]}` with no `mode` is still accepted as a run. Anything else the leader writes is
373
+ treated as its answer, so a leader that replies in prose still ends the turn in words.
233
374
 
234
375
  ```typescript
235
376
  export default defineConfig({
@@ -243,9 +384,9 @@ export default defineConfig({
243
384
  })
244
385
  ```
245
386
 
246
- For a minor bug fix the leader might decide only `backend-developer` and `code-reviewer` are needed, skipping the design stages. For a greenfield feature it runs the full pipeline.
387
+ For a minor bug fix the leader might decide only `backend-developer` and `code-reviewer` are needed, skipping the design stages. For a greenfield feature it runs the full pipeline. For `hello` it answers, and nobody is spent on it.
247
388
 
248
- If the leader fails or produces invalid output, multiclaw falls back to running all agents.
389
+ Agent IDs are always a **subset** of the configured team: an invented id is reported and dropped, never added. A `run` naming no configured agent is a failure, not a green "done". If the leader cannot be reached at all, multiclaw warns and falls back to the full configured team.
249
390
 
250
391
  ### Disabling the leader
251
392
 
@@ -319,7 +460,8 @@ See [`examples/dev-team/`](https://github.com/shipengqi/multiclaw/tree/main/exam
319
460
 
320
461
  ```bash
321
462
  cd examples/dev-team
322
- pnpm dev
463
+ pnpm dev # opens the interactive console
464
+ pnpm run run # ...or one headless run
323
465
  ```
324
466
 
325
467
  ## License