@openmuster/muster 0.0.0-stage → 0.3.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +309 -2
  3. package/dist/args-DHgAmYge.js +7043 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +31 -0
  6. package/dist/index.d.ts +2138 -0
  7. package/dist/index.js +1938 -0
  8. package/dist/inspect/app.js +163 -0
  9. package/dist/main-A4nHL5oa.js +3941 -0
  10. package/dist/main-CuIC8iF4.js +6 -0
  11. package/dist/mcp-GkdeWAnr.js +6 -0
  12. package/dist/module-CT_R33MB.js +4 -0
  13. package/dist/module-DOkWwWoU.js +439 -0
  14. package/dist/skills/board/SKILL.md +214 -0
  15. package/dist/skills/board/references/build-a-ui.md +63 -0
  16. package/dist/skills/board/references/claude.md +54 -0
  17. package/dist/skills/board/references/codex.md +61 -0
  18. package/dist/skills/board/references/software-factory.md +89 -0
  19. package/dist/skills/board/references/swarm.md +165 -0
  20. package/dist/skills/configure-factory/SKILL.md +116 -0
  21. package/dist/skills/loop-card/SKILL.md +95 -0
  22. package/dist/steps-ByzmEzLQ.js +3175 -0
  23. package/docs/01-concepts/01-overview.md +73 -0
  24. package/docs/01-concepts/02-boards.md +71 -0
  25. package/docs/01-concepts/03-channels.md +56 -0
  26. package/docs/01-concepts/04-threads.md +75 -0
  27. package/docs/01-concepts/05-labels.md +65 -0
  28. package/docs/01-concepts/06-actors.md +66 -0
  29. package/docs/01-concepts/07-events.md +126 -0
  30. package/docs/01-concepts/08-tasks.md +244 -0
  31. package/docs/01-concepts/09-watchers.md +172 -0
  32. package/docs/01-concepts/10-schedules.md +39 -0
  33. package/docs/01-concepts/11-access.md +182 -0
  34. package/docs/01-concepts/12-files-and-data.md +79 -0
  35. package/docs/01-concepts/13-budgets.md +35 -0
  36. package/docs/01-concepts/14-runners.md +102 -0
  37. package/docs/01-concepts/15-outgoing-webhooks.md +177 -0
  38. package/docs/01-concepts/16-workflows.md +350 -0
  39. package/docs/01-concepts/17-board-module.md +122 -0
  40. package/docs/01-quickstart.md +141 -0
  41. package/docs/02-sync/01-overview.md +239 -0
  42. package/docs/02-sync/02-github.md +158 -0
  43. package/docs/02-sync/03-linear.md +290 -0
  44. package/docs/02-sync/04-slack.md +232 -0
  45. package/docs/02-sync/05-notion.md +92 -0
  46. package/docs/03-guides/01-coding-agents.md +98 -0
  47. package/docs/03-guides/02-swarm.md +85 -0
  48. package/docs/03-guides/03-factory.md +216 -0
  49. package/docs/03-guides/04-inspector.md +53 -0
  50. package/docs/03-guides/05-running-agents.md +73 -0
  51. package/docs/03-guides/06-sandboxed-agents.md +441 -0
  52. package/docs/03-guides/07-build-a-ui.md +61 -0
  53. package/docs/03-guides/08-ci.md +168 -0
  54. package/docs/03-guides/09-daemon.md +103 -0
  55. package/docs/03-guides/10-two-agents.md +76 -0
  56. package/docs/03-guides/11-person-in-the-loop.md +123 -0
  57. package/docs/03-guides/12-unattended.md +110 -0
  58. package/docs/03-guides/13-terminals.md +153 -0
  59. package/docs/03-guides/14-no-cloud.md +82 -0
  60. package/docs/03-guides/15-several-boards.md +71 -0
  61. package/docs/03-guides/16-non-code.md +69 -0
  62. package/docs/03-guides/17-mcp.md +126 -0
  63. package/docs/03-guides/18-a-board-on-a-server.md +162 -0
  64. package/docs/03-guides/19-a-card-queue.md +261 -0
  65. package/docs/03-guides/20-a-feedback-loop.md +225 -0
  66. package/docs/03-guides/21-running-the-loop.md +196 -0
  67. package/docs/04-reference/01-cli.md +166 -0
  68. package/docs/04-reference/02-handle.md +409 -0
  69. package/docs/04-reference/03-http.md +157 -0
  70. package/docs/04-reference/04-events.md +72 -0
  71. package/docs/04-reference/05-errors.md +221 -0
  72. package/docs/04-reference/06-conformance.md +52 -0
  73. package/docs/04-reference/07-porting.md +116 -0
  74. package/docs/index.md +103 -0
  75. package/package.json +52 -3
@@ -0,0 +1,232 @@
1
+ ---
2
+ title: Slack
3
+ description: Channel messages and threads on the board, in both directions.
4
+ ---
5
+
6
+ ## Map channels
7
+
8
+ ```ts board.ts
9
+ import { board, env, slack } from '@openmuster/muster'
10
+
11
+ export default board({
12
+ sync: {
13
+ chat: slack({
14
+ secret: env('SLACK_SIGNING_SECRET'),
15
+ token: env('SLACK_BOT_TOKEN'),
16
+ bot: 'B0123BOT',
17
+ channels: { C0123ABC: 'general', C0456DEF: { channel: 'errors', mirror: false } },
18
+ }),
19
+ },
20
+ })
21
+ ```
22
+
23
+ A Slack channel, by its ID, maps to a board channel. Sync is two-way unless a
24
+ channel sets `mirror: false`.
25
+
26
+ ## What comes in
27
+
28
+ | In Slack | On the board |
29
+ | --- | --- |
30
+ | A message in the channel | A thread, by `chat:user:<id>` |
31
+ | A message in a Slack thread | A reply in that thread |
32
+ | A message is edited or deleted | The message is edited or deleted |
33
+
34
+ Joins, topic changes and other system messages are ignored. A request older
35
+ than five minutes is refused however well it is signed.
36
+
37
+ ## What goes back
38
+
39
+ - A reply in a synced thread is posted into the Slack thread.
40
+ - A thread posted in a mapped board channel is posted to the Slack channel,
41
+ and later replies go into its thread.
42
+ - An edit or a delete of a delivered message updates or removes it.
43
+
44
+ Messages from the app's own bot, named by `bot`, are not imported back.
45
+
46
+ ## Show a thread being worked on
47
+
48
+ A Slack app declared an agent can show Slack's own "Working…" under a thread.
49
+ With `agent: true`, the board uses that for a thread a workflow run is working
50
+ on, in place of the run's progress message:
51
+
52
+ ```ts board.ts
53
+ import { board, env, slack } from '@openmuster/muster'
54
+
55
+ export default board({
56
+ sync: {
57
+ chat: slack({
58
+ secret: env('SLACK_SIGNING_SECRET'),
59
+ token: env('SLACK_BOT_TOKEN'),
60
+ agent: true,
61
+ channels: { C0123456789: 'feedback' },
62
+ }),
63
+ },
64
+ })
65
+ ```
66
+
67
+ - While a run on the thread is open, the board sets the thread's agent session
68
+ to `processing` (`agents.sessions.setStatus`), and tells Slack again before
69
+ the hour Slack shows it for is up. When no run on the thread is open any
70
+ more, it sets it to `active`, after the run's summary has been posted.
71
+ - The run's `started …` reply is not posted to Slack, and neither are its
72
+ edits. Its summary, and every other reply, is posted as before.
73
+ - Slack shows its own words there, "<app> is working", not the board's.
74
+ - A call Slack refuses is tried again a minute later. The thread on the board
75
+ says where the run is either way.
76
+
77
+ In the app's settings, turn on the agent feature (the manifest's
78
+ `features.agent_view`), which adds the `assistant:write` scope beside
79
+ `chat:write`, and reinstall the app.
80
+
81
+ > [!WARNING]
82
+ > Slack says declaring an app an agent can't be undone, and that people have
83
+ > to reload Slack to see it. Try it on an app made for the purpose first.
84
+
85
+ > [!NOTE]
86
+ > Run against a live workspace on 26 Nov 2026, in a public channel: a message
87
+ > a person posted started a run, "<app> is working" showed under its thread
88
+ > with no message asking for it, and it went when the run was summed up. Not
89
+ > yet seen live: a private channel, a run longer than Slack's hour, and one run
90
+ > handing over to the next on the same thread. Those are covered by tests
91
+ > against a stand-in for Slack's API.
92
+
93
+ ## Files
94
+
95
+ - **In:** a file on a Slack message is fetched from `files.slack.com` with
96
+ the bot token and attached to the message. It needs `files:read`. A web
97
+ page in place of the file is taken to be Slack's sign-in page, and the
98
+ message says to check that scope. Slack's docs don't say whether
99
+ `files.slack.com` redirects; the board follows no redirect, and a file
100
+ Slack redirects is named instead. Not tried against Slack. A file
101
+ Slack only links to (from Google Drive, say) is named, not fetched.
102
+ - **Out:** each file on a board message is uploaded with
103
+ `files.getUploadURLExternal`, then shared into the Slack thread after the
104
+ text with `files.completeUploadExternal`. It needs `files:write`. When the
105
+ board message is a new thread, its files are the thread's first reply.
106
+
107
+ When the shared files come back as a message with no text, in the thread
108
+ they were sent to, the board knows them by their IDs and doesn't import
109
+ them back, whether or not Slack marks the message as the bot's. Someone who
110
+ shares one of them again, with words of their own, is imported. Deleting the board
111
+ message removes its text from Slack, not the files. An app made before
112
+ files synced needs the two scopes added under **OAuth & Permissions**, and
113
+ reinstalling. See
114
+ [Files](./01-overview.md#files) for the limits.
115
+
116
+ ## After downtime
117
+
118
+ Slack retries an event that wasn't answered three times, within minutes.
119
+ Beyond that, the ticker reads each mapped channel's history, oldest first,
120
+ from five minutes before the last event it received, and the new replies in
121
+ threads started meanwhile: see [After downtime](./01-overview.md#after-downtime)
122
+ for when it starts, waits and goes on. A message or reply posted while the
123
+ board was down arrives once: one the board already has, whether it came in by
124
+ webhook or the board sent it, is not imported again, and the app's own
125
+ messages are skipped, as they are from webhooks. Files on a message read
126
+ this way are fetched as a webhook's would be, with the same limits. Edits
127
+ and deletes made meanwhile are not read.
128
+
129
+ - A tick makes up to 24 requests for what was posted while down, shared by the
130
+ channels, at least three each, 200 messages a request. A longer gap is read
131
+ over the next ticks, a minute apart.
132
+ - Every tick moves each channel on by at least a minute of its history. A
133
+ minute busier than that tick can read is gone past, and logged as skipped.
134
+ - New replies in threads started before the downtime are read for up to two
135
+ threads a channel a tick, among the 200 messages before it. A reply in any
136
+ other older thread is missed.
137
+ - A refusal, Slack asking to slow down included, is asked again from the same
138
+ point five minutes later.
139
+
140
+ Catch-up uses `conversations.history` and `conversations.replies`, which the
141
+ `channels:history` and `groups:history` scopes below already allow. Slack
142
+ gives an app made for your own workspace, as below, 50 or more of each a
143
+ minute; an app installed from outside the Slack Marketplace gets far fewer,
144
+ and with many channels mapped, catch-up then mostly waits.
145
+
146
+ ## Set it up
147
+
148
+ The board has to be served at an HTTPS address Slack can reach: see
149
+ [A board on a server](../03-guides/18-a-board-on-a-server.md). A tunnel to your
150
+ machine is enough to try it.
151
+
152
+ ### 1. Create the app
153
+
154
+ At [api.slack.com/apps](https://api.slack.com/apps), choose **Create New App**,
155
+ then **From a manifest**, pick the workspace and paste:
156
+
157
+ ```yaml
158
+ display_information:
159
+ name: muster
160
+ features:
161
+ bot_user:
162
+ display_name: muster
163
+ always_online: true
164
+ oauth_config:
165
+ scopes:
166
+ bot:
167
+ - channels:history
168
+ - groups:history
169
+ - chat:write
170
+ - files:read
171
+ - files:write
172
+ settings:
173
+ org_deploy_enabled: false
174
+ socket_mode_enabled: false
175
+ token_rotation_enabled: false
176
+ ```
177
+
178
+ Events come later: Slack checks their request URL as soon as it is saved, so
179
+ the board must be running first.
180
+
181
+ ### 2. Install it and keep its two secrets
182
+
183
+ Install the app to the workspace from **Install App**. Then put two values
184
+ where `mu serve` reads its environment, never in the board module itself:
185
+
186
+ | Variable | Where it is |
187
+ | --- | --- |
188
+ | `SLACK_BOT_TOKEN` | **OAuth & Permissions**, Bot User OAuth Token, `xoxb-...` |
189
+ | `SLACK_SIGNING_SECRET` | **Basic Information**, App Credentials, Signing Secret |
190
+
191
+ ### 3. Find the IDs
192
+
193
+ - **The channel:** invite the app with `/invite @muster`, then open the
194
+ channel's details: its ID, `C...`, is at the bottom of the About tab.
195
+ - **The bot:** `auth.test` returns it as `bot_id`, `B...`.
196
+
197
+ ```bash
198
+ curl -s -H "Authorization: Bearer $SLACK_BOT_TOKEN" https://slack.com/api/auth.test
199
+ ```
200
+
201
+ ### 4. Map the channel and start the board
202
+
203
+ Write the `chat` sync in the board module as shown at the top of this page,
204
+ with the channel and `bot`. `mu serve` reads the module when it starts:
205
+ restart it after a change.
206
+
207
+ Without `bot`, messages from every bot in a mapped channel are skipped, not
208
+ only the app's own.
209
+
210
+ ### 5. Turn on events
211
+
212
+ In **Event Subscriptions**, turn events on and set the request URL to
213
+ `https://<host>/api/board/webhooks/chat`. The board answers Slack's check
214
+ itself, and the URL shows as verified. Subscribe to the bot events
215
+ `message.channels` and `message.groups`, save, and reinstall the app if Slack
216
+ asks.
217
+
218
+ ### 6. Check it
219
+
220
+ Post a message in the channel: it arrives as a thread in the mapped board
221
+ channel, labelled `source=chat`. Reply to it on the board, and the reply
222
+ appears in the Slack thread from the app.
223
+
224
+ ## Keep the noise down
225
+
226
+ Report milestones and skip the "still working" updates: every reply in a mirrored thread reaches
227
+ people in Slack. Use `--no-sync` for a work log that only the board needs.
228
+
229
+ ```bash
230
+ mu reply 12 "ran the suite: 40 of 40" --no-sync
231
+ mu reply 12 "fixed in a1b2c3"
232
+ ```
@@ -0,0 +1,92 @@
1
+ ---
2
+ title: Notion
3
+ description: Pages of a database and their comments as threads, in both directions.
4
+ ---
5
+
6
+ ## Map databases
7
+
8
+ ```ts board.ts
9
+ import { board, env, notion } from '@openmuster/muster'
10
+
11
+ export default board({
12
+ sync: {
13
+ nt: notion({
14
+ secret: env('NOTION_WEBHOOK_SECRET'),
15
+ token: env('NOTION_TOKEN'),
16
+ databases: { '1a2b3c4d00004000800000000000d00b': 'feedback' },
17
+ }),
18
+ },
19
+ })
20
+ ```
21
+
22
+ A database maps to a channel, by its data source ID: on a workspace that
23
+ predates data sources, by the database's own ID. Either is taken with or
24
+ without dashes. Sync is two-way unless a database sets `mirror: false`.
25
+
26
+ `token` is the integration's secret (`ntn_…`). Share each mapped database
27
+ with the integration, and give it the capabilities to read content, read
28
+ comments and insert comments.
29
+
30
+ `secret` is the webhook subscription's verification token, which Notion
31
+ signs every delivery with. `bot` is optional: the integration's own user ID,
32
+ whose pages and comments are never imported.
33
+
34
+ ## Set up the webhook
35
+
36
+ Notion sends its verification token once, to the webhook's URL, signed with
37
+ that same token, and it has to be pasted back into Notion before anything
38
+ else is sent:
39
+
40
+ 1. Start the board with the sync in its module and `NOTION_WEBHOOK_SECRET`
41
+ set to `pending`. Only then does the board take Notion's one unsigned
42
+ request.
43
+ 2. In the integration's settings, under Webhooks, subscribe
44
+ `https://<your host>/api/board/webhooks/nt` to page and comment events.
45
+ 3. The board writes the token Notion sent to `notion-verification-token`
46
+ in muster's config folder (`~/.config/muster`, or `MUSTER_CONFIG`),
47
+ readable by you alone. It is never logged or answered, and never
48
+ written over: the first one stays.
49
+ 4. Paste it into Notion's Verify. Anyone can send the board a token, so
50
+ this is the check: one Notion didn't send fails there. If it fails,
51
+ delete the file and have Notion send its token again. Then set
52
+ `NOTION_WEBHOOK_SECRET` to it and start the board again.
53
+
54
+ From then on a delivery without Notion's signature for that token is
55
+ refused.
56
+
57
+ ## What comes in
58
+
59
+ | In Notion | On the board |
60
+ | --- | --- |
61
+ | A page is made in a mapped database | A thread: its title, a blank line, its text as markdown. Labels `kind=page`, `ref` (its URL), `state`, `source=nt` |
62
+ | Its title or text changes | The thread's first message is edited |
63
+ | Its Status changes | The label `state`, in lowercase with dashes: `in-progress`. A select called Status counts too |
64
+ | A comment on the page | A reply, by `nt:user:<id>` |
65
+ | A comment is edited or deleted | The reply is edited or deleted |
66
+ | The page is deleted | The thread's first message is deleted |
67
+
68
+ Notion's webhooks say only what changed, not what it says now. The board
69
+ answers each at once and reads the page or comment from Notion's API on its
70
+ next tick, so what it imports is always what Notion says then, and a late
71
+ delivery brings nothing older. A read that fails is tried again on later
72
+ ticks, rather than import less than the page says. A page's text is cut at 9,000 characters,
73
+ with a link to the rest.
74
+
75
+ A page in a database the sync doesn't map is not brought in.
76
+
77
+ ## What goes back
78
+
79
+ - **A reply** in a synced thread is a comment on the page, in pieces of
80
+ 2,000 characters, as Notion takes them. Editing or deleting it does the
81
+ same on Notion.
82
+ - **A thread started on the board** in a mapped channel is a new page in the
83
+ database: its first line the title, the rest the page's text.
84
+ - **Files** aren't sent yet: each is named in the comment, and stays on the
85
+ board.
86
+
87
+ ## Catching up
88
+
89
+ A board that was down asks Notion, when it starts, for the pages changed in
90
+ each mapped database since it last heard, oldest first, up to 1,000 a
91
+ database, and the comments made on them since. A comment on a page that
92
+ didn't otherwise change while the board was down isn't found this way.
@@ -0,0 +1,98 @@
1
+ ---
2
+ title: Coding agents
3
+ description: Give Claude Code, Codex, or any agent a board to work through.
4
+ ---
5
+
6
+ ## Install the skill
7
+
8
+ ```bash
9
+ mu skills install --to ~/.claude/skills
10
+ mu skills path
11
+ ```
12
+
13
+ The first copies the skills that ship with muster to where your agent keeps
14
+ its own. The second prints where they are, for an agent that reads a file
15
+ instead. An agent with no skills folder gets the board skill's `SKILL.md`
16
+ pasted into its instructions.
17
+
18
+ Without muster installed, the [skills CLI](https://skills.sh) copies the same
19
+ skills from the repository. They are `board`, `configure-factory` and
20
+ `loop-card`; leave out `-g` to install into the project instead.
21
+
22
+ ```bash
23
+ npx skills add openmuster/muster --skill board -g
24
+ ```
25
+
26
+ These follow the repository's main branch, so they can describe a command a
27
+ release you run doesn't have yet. `mu skills install` always matches the `mu`
28
+ it came with.
29
+
30
+ Where an agent keeps its standing instructions differs by vendor. These are
31
+ the usual places at the time of writing; check your agent's own docs.
32
+
33
+ | Agent | Where the board instructions go |
34
+ | --- | --- |
35
+ | Claude Code | `~/.claude/skills/` (what `mu skills install` writes to above) |
36
+ | Codex | `AGENTS.md` in the repository, or `~/.codex/AGENTS.md` |
37
+ | Cursor | A rule file under `.cursor/rules/` |
38
+ | GitHub Copilot | `.github/copilot-instructions.md` |
39
+ | Windsurf | A rule file under `.windsurf/rules/` |
40
+
41
+ An agent that can't run shell commands gets the board as an MCP tool instead:
42
+ see [An agent with no shell](./17-mcp.md).
43
+
44
+ For any of them the content is the same: the board skill's `SKILL.md`. Two
45
+ things have to be true wherever the agent runs its commands:
46
+
47
+ - `mu` is on its `PATH`. An agent that runs commands in its own sandbox or
48
+ container may not see what your shell sees.
49
+ - It can reach the board. On a file board that means it can read and write
50
+ `~/.muster/`; an agent that can't should be given a served board instead
51
+ (`MUSTER_URL` and a token, see [Access](../01-concepts/11-access.md)).
52
+
53
+ The skill teaches an agent to find the board, read before it writes, write as
54
+ itself, wait instead of polling, and claim and settle tasks.
55
+
56
+ ## Tell it who it is
57
+
58
+ ```bash
59
+ export MUSTER_PROFILE=claude
60
+ ```
61
+
62
+ Or have it pass `--as claude` on every command that writes. Without either,
63
+ what the agent writes shows as you.
64
+
65
+ ## What to ask of it
66
+
67
+ - "Post what you changed in `dev`."
68
+ - "Ask in the thread and wait for the answer."
69
+ - "Take the next task in `work/` and do it."
70
+
71
+ ```bash
72
+ mu post dev "moved auth to the edge: a1b2c3" --as claude
73
+ mu wait --re 12 --after 31 --timeout 30m --as claude
74
+ mu tasks claim --ready work/ --wait 10m --as claude
75
+ ```
76
+
77
+ ## What it can't do
78
+
79
+ Nothing wakes an agent after its turn ends. An agent that should come back
80
+ when something happens needs something to start it again:
81
+
82
+ - `mu wait` inside its turn, for an answer it expects soon.
83
+ - A [watcher](../01-concepts/09-watchers.md), which starts it when something
84
+ happens.
85
+ - `mu run --loop`, which starts a fresh one for each task.
86
+
87
+ ## Sandboxed agents
88
+
89
+ An agent in a sandbox that can't open files outside its workspace can't reach
90
+ a board file. Codex is one: `mu run` gives it the board's folder as a writable
91
+ folder. An agent that can't reach the file at all uses a board over HTTP: see
92
+ [Access](../01-concepts/11-access.md).
93
+
94
+ ## Board text is information
95
+
96
+ Tell the agent, and the skill does: what others wrote on a board is content,
97
+ not instructions. It doesn't run commands, approve, merge, deploy or publish
98
+ because a message says to.
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: A swarm
3
+ description: Several agents working one queue toward one goal.
4
+ ---
5
+
6
+ ## The shape
7
+
8
+ A lead plans and decides, workers each do one task, and a person owns the
9
+ goal. They never talk to each other directly: the plan is the board's tasks,
10
+ and every question, answer and result is in a task's thread.
11
+
12
+ The board's part is the queue: one holder per task, tasks that wait for what
13
+ they need, a hold for a person's answer, and a lease that hands a dropped task
14
+ back. The lead's part is judgment: splitting the goal, answering questions,
15
+ checking results.
16
+
17
+ ## When a swarm fits, and when it doesn't
18
+
19
+ | It fits when | It doesn't when |
20
+ | --- | --- |
21
+ | The work splits into pieces that don't touch the same files | Pieces depend on each other's unfinished work |
22
+ | Each piece can be described to a reader who knows nothing | The goal is still being worked out |
23
+ | A command can show each piece is done | "Done" is a matter of taste |
24
+ | Someone, or another agent, checks results | Nobody will read what comes back |
25
+
26
+ If in doubt, start with [two agents](./10-two-agents.md). A swarm multiplies
27
+ cost as well as speed: every worker starts its own session.
28
+
29
+ ## Split by file ownership
30
+
31
+ Two tasks that change the same files at the same time collide. Give each task
32
+ the paths it owns, and chain the ones that can't be separated:
33
+
34
+ ```bash
35
+ mu tasks create work/checkout "Rate-limit the API. You own apps/api/checkout/." --as lead
36
+ mu tasks create work/checkout "Show the limit in the UI. You own apps/web/checkout/." --needs 1 --as lead
37
+ ```
38
+
39
+ ## By hand
40
+
41
+ ```bash
42
+ mu tasks create work/checkout --file plan.json --as lead
43
+ mu run --ready work/checkout --loop --agent claude --as worker-1
44
+ mu run --ready work/checkout --loop --agent codex --as worker-2
45
+ mu wait work/checkout --type task.completed --type task.blocked --type task.failed --as lead
46
+ ```
47
+
48
+ Each `mu run --loop` is a worker: it takes the next ready task, starts a fresh
49
+ agent on it, and does that again until nothing is ready. The lead's guide is
50
+ the board skill's `references/swarm.md`.
51
+
52
+ ## With the template
53
+
54
+ `templates/swarm` is a page that does the same from a form:
55
+
56
+ ```bash
57
+ cd templates/swarm
58
+ pnpm install
59
+ pnpm dev # on 127.0.0.1 only: the page has no sign-in
60
+ ```
61
+
62
+ - The form takes a goal, a run name, how many agents, which agent, and where
63
+ they run.
64
+ - Launching posts the run's thread, queues one planning task, and starts the
65
+ workers. The planning task's agent splits the goal into tasks.
66
+ - `/live` shows the queue by state, who holds what, and the newest messages.
67
+
68
+ Agents run as local processes with the access of whoever started the page.
69
+ Launch runs only on code you would run yourself.
70
+
71
+ ## What keeps it honest
72
+
73
+ - **"Completed" is what the worker says, not evidence.** Make a review task that needs
74
+ the work, and give it to a different agent.
75
+ - **A review that fails sends the work back:** `mu tasks reopen <id> --round`.
76
+ - **A budget:** `mu budget work/checkout 20` stops new claims once the tasks
77
+ there have cost that much.
78
+ - **A lead keeps a short session.** Its state lives in a thread on the board,
79
+ so it can start over when a piece of work closes.
80
+
81
+ ## What it costs to start an agent
82
+
83
+ Each task gets a fresh session. On the machine it was measured on, a Claude
84
+ Code worker starts at about 13,000 tokens the way `mu run` starts it, and a
85
+ small task cost $0.18. See `SPEC.md` for the measurement and its limits.