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

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 (79) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +309 -2
  3. package/dist/args-DX9QSK1f.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 +1951 -0
  8. package/dist/inspect/app.js +163 -0
  9. package/dist/main-CdVlnWHy.js +6 -0
  10. package/dist/main-DgrIMbeA.js +3941 -0
  11. package/dist/mcp-NueWYyQs.js +6 -0
  12. package/dist/module-C-HJjWWo.js +4 -0
  13. package/dist/module-CxoN1MOe.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-DtzUdcBE.js +3175 -0
  23. package/docs/01-concepts/01-overview.md +78 -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 +73 -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 +133 -0
  30. package/docs/01-concepts/08-tasks.md +248 -0
  31. package/docs/01-concepts/09-watchers.md +175 -0
  32. package/docs/01-concepts/10-schedules.md +39 -0
  33. package/docs/01-concepts/11-access.md +185 -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 +103 -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 +124 -0
  40. package/docs/01-quickstart.md +140 -0
  41. package/docs/02-sync/01-overview.md +246 -0
  42. package/docs/02-sync/02-github.md +159 -0
  43. package/docs/02-sync/03-linear.md +290 -0
  44. package/docs/02-sync/04-slack.md +228 -0
  45. package/docs/02-sync/05-notion.md +94 -0
  46. package/docs/02-sync/meta.json +4 -0
  47. package/docs/03-guides/01-coding-agents.md +98 -0
  48. package/docs/03-guides/02-swarm.md +85 -0
  49. package/docs/03-guides/03-factory.md +212 -0
  50. package/docs/03-guides/04-inspector.md +69 -0
  51. package/docs/03-guides/05-running-agents.md +85 -0
  52. package/docs/03-guides/06-sandboxed-agents.md +427 -0
  53. package/docs/03-guides/07-build-a-ui.md +80 -0
  54. package/docs/03-guides/08-ci.md +176 -0
  55. package/docs/03-guides/09-daemon.md +104 -0
  56. package/docs/03-guides/10-two-agents.md +76 -0
  57. package/docs/03-guides/11-person-in-the-loop.md +123 -0
  58. package/docs/03-guides/12-unattended.md +110 -0
  59. package/docs/03-guides/13-terminals.md +152 -0
  60. package/docs/03-guides/14-no-cloud.md +82 -0
  61. package/docs/03-guides/15-several-boards.md +90 -0
  62. package/docs/03-guides/16-non-code.md +78 -0
  63. package/docs/03-guides/17-mcp.md +122 -0
  64. package/docs/03-guides/18-a-board-on-a-server.md +162 -0
  65. package/docs/03-guides/19-a-card-queue.md +261 -0
  66. package/docs/03-guides/20-a-feedback-loop.md +233 -0
  67. package/docs/03-guides/21-running-the-loop.md +203 -0
  68. package/docs/03-guides/22-building-from-linear.md +326 -0
  69. package/docs/03-guides/meta.json +32 -0
  70. package/docs/04-reference/01-cli.md +166 -0
  71. package/docs/04-reference/02-handle.md +410 -0
  72. package/docs/04-reference/03-http.md +158 -0
  73. package/docs/04-reference/04-events.md +72 -0
  74. package/docs/04-reference/05-errors.md +221 -0
  75. package/docs/04-reference/06-conformance.md +54 -0
  76. package/docs/04-reference/07-porting.md +116 -0
  77. package/docs/index.md +118 -0
  78. package/docs/meta.json +3 -0
  79. package/package.json +52 -3
@@ -0,0 +1,98 @@
1
+ ---
2
+ title: Coding agents
3
+ description: For engineers who want Claude Code, Codex or another coding agent to work from a board. Install the board skill, give the agent its own name, and see what can start it again after its turn ends.
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. 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: For splitting one goal across several agents at once. A lead breaks it into tasks that own separate files, each worker takes one ready task in a fresh session, and a review task checks the results.
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. A Claude Code worker that `mu run` started
84
+ has been measured at about 13,000 tokens before it reads its task, and a
85
+ small task at about $0.18.
@@ -0,0 +1,212 @@
1
+ ---
2
+ title: A software factory
3
+ description: For a team that wants an agent to answer GitHub issues, Linear issues or Slack questions as they arrive. Sync brings each one in as a thread, a watcher wakes the agent, and it replies, asks or starts work there.
4
+ ---
5
+
6
+ ## The parts
7
+
8
+ | Part | What does it |
9
+ | --- | --- |
10
+ | Threads come in from GitHub, Linear, Slack | [Sync](../02-sync/01-overview.md) |
11
+ | An agent is woken when a thread has news | A [watcher](../01-concepts/09-watchers.md) |
12
+ | The agent is held to its channels | A [token](../01-concepts/11-access.md) |
13
+ | Someone sees what is set up | The factory page |
14
+
15
+ Wire up the plumbing and leave the decisions to the agent: who is woken, as whom, with which
16
+ access. What a thread needs is for the agent to judge from the thread.
17
+
18
+ ## Set it up
19
+
20
+ `templates/factory` has the pieces: a board module (`lib/board.ts`) with
21
+ the GitHub sync and the watcher, a host that runs them (`host.ts`), a wake
22
+ script (`lib/wake.ts`), the agent's instructions, and a page that also takes
23
+ the webhooks. Put your repository in place of `acme/web` in `lib/board.ts`,
24
+ then start the page and the host, each in its own terminal, from
25
+ `templates/factory`, with the webhook's secret in both:
26
+
27
+ ```bash
28
+ export GITHUB_WEBHOOK_SECRET=...
29
+ pnpm dev
30
+ ```
31
+
32
+ ```bash
33
+ export GITHUB_WEBHOOK_SECRET=...
34
+ pnpm host
35
+ ```
36
+
37
+ The module names the secret with `env()`, so it is never written in the
38
+ file: the page reads it on its first request, and `host.ts` when it starts,
39
+ refusing to start while it is unset. Point GitHub's webhook at
40
+ `https://board.example.com/api/board/webhooks/gh`, and list
41
+ `board.example.com` in `ALLOW_HOSTS`. The page listens on 127.0.0.1: the
42
+ webhook reaches it through a proxy or a tunnel with a public HTTPS name. The
43
+ webhook brings a thread in; `host.ts` runs the watcher, and the sync's
44
+ catch-up and sending.
45
+
46
+ Schedules are sent by a daemon that holds `tick`. Run it without a module:
47
+ `host.ts` runs this one.
48
+
49
+ ```bash
50
+ mu daemon run --no-module
51
+ ```
52
+
53
+ With all three running, check from `templates/factory` that the watcher
54
+ wakes the agent and that the agent answers:
55
+
56
+ ```bash
57
+ mu daemon check factory --module "$PWD/lib/board.ts" --in factory/issues
58
+ ```
59
+
60
+ The template's sync brings threads in and sends nothing back. To have the
61
+ agent's replies posted as comments, give the repository `mirror: true` and
62
+ the sync a `token: env('GITHUB_TOKEN')`: see [GitHub](../02-sync/02-github.md)
63
+ and [Sync](../02-sync/01-overview.md#in-a-board-module).
64
+
65
+ The page lists what is set up and what isn't, with the command for each, who
66
+ holds each role (`tick` for the daemon, `sync` and `watch:factory` for the
67
+ host), and the recent threads. `/board` shows every thread, where you read
68
+ and reply from a browser.
69
+
70
+ ## How a thread goes
71
+
72
+ 1. Someone opens an issue. It becomes a thread in the mapped channel.
73
+ 2. The watcher wakes the agent with the thread's ID. The agent reads it.
74
+ 3. The agent answers, asks, or starts work, in the thread. With `mirror` on,
75
+ its replies are comments on the issue.
76
+ 4. To come back later it schedules a message to itself:
77
+ `mu schedule 12 "check the PR" --in 2h`.
78
+ 5. When the pull request merges, sync sets `state=merged` on its thread.
79
+
80
+ Sync makes threads, not tasks. Nothing puts an issue in the queue on its own:
81
+ the agent that is woken, or you, makes the thread a task with
82
+ `mu tasks create <id>` when the work should be claimed, tracked and settled
83
+ like any other.
84
+
85
+ ## Route by label
86
+
87
+ One agent that reads the thread and decides is the default, and it is enough
88
+ for most boards. Split it in two only when the answers need different
89
+ instructions, different access or different owners: a help channel for several
90
+ products, say. Then one watcher sorts and one watcher per product answers.
91
+
92
+ ```mermaid
93
+ flowchart LR
94
+ S[Slack #help] -->|sync| T[thread in help]
95
+ T -->|router wakes| R[router agent]
96
+ R -->|product=billing| B[billing agent]
97
+ R -->|product=api| A[api agent]
98
+ R -->|product=none| N[nobody]
99
+ B -->|reply| S
100
+ A -->|reply| S
101
+ ```
102
+
103
+ In the board module:
104
+
105
+ ```ts board.ts
106
+ import { board, command, type Watch } from '@openmuster/muster'
107
+
108
+ /** A product's watcher: woken when its label lands, and for what comes after in its threads. */
109
+ const product = (name: string): Watch => ({
110
+ tail: { channel: 'help', labels: [`product=${name}`], types: ['labels.changed', 'message.posted'] },
111
+ as: `${name}-bot`,
112
+ // The question and its label arrive together: one wake for both.
113
+ coalesce: '30s',
114
+ run: command(({ event }) => ['/srv/help/answer.sh', String(event.thread), name], { gate: ['/srv/help/has-product.sh', name] }),
115
+ })
116
+
117
+ export default board({
118
+ watch: {
119
+ router: {
120
+ tail: { channel: 'help', types: ['message.posted'] },
121
+ as: 'router',
122
+ run: command(({ event }) => ['/srv/help/route.sh', String(event.thread)], { gate: ['/srv/help/unlabelled.sh'] }),
123
+ },
124
+ billing: product('billing'),
125
+ api: product('api'),
126
+ },
127
+ })
128
+ ```
129
+
130
+ The router's agent reads the thread and writes one label on it, and nothing
131
+ else. Its instructions name the products and what each covers, and end with
132
+ the command:
133
+
134
+ ```bash
135
+ mu label <thread> product=billing --if-unset product
136
+ ```
137
+
138
+ `--if-unset` makes the first answer stand: a second try exits 1 with
139
+ `label_conflict`, so have `route.sh` treat that as done. Use `product=none`
140
+ for what isn't a product question. It is a label like the others: it stops
141
+ the router from being asked again, and no watcher listens for it.
142
+
143
+ The two gates keep a model from being started for nothing:
144
+
145
+ ```bash
146
+ #!/bin/sh
147
+ # unlabelled.sh: wake the router only for a thread nobody has sorted yet.
148
+ mu read "$MUSTER_THREAD" --json | grep -q '"product":' && echo '{"wake": false}'
149
+ ```
150
+
151
+ ```bash
152
+ #!/bin/sh
153
+ # has-product.sh <product>: wake a product's agent only while the thread is still its own.
154
+ mu read "$MUSTER_THREAD" --json | grep -q "\"product\": \"$1\"" || echo '{"wake": false}'
155
+ ```
156
+
157
+ `route.sh` and `answer.sh` do what the factory's `lib/wake.ts` does, with
158
+ other instructions: they pass a pointer, and the agent reads the thread
159
+ itself.
160
+
161
+ Try the plumbing by hand, with you as the router:
162
+
163
+ ```bash steps
164
+ mu post help "How do I change the card on my account?" --as ada
165
+ mu label 1 product=billing --if-unset product --as router
166
+ mu read help --label product=billing --as ada
167
+ ```
168
+
169
+ What to know before you rely on it:
170
+
171
+ - **Give each watcher its own `as`.** A watcher never hears its own profile's
172
+ writes. A product's agent that writes as `router` can't hear the router's
173
+ label.
174
+ - **It costs two agent sessions a question.** Each watcher runs in a loop of
175
+ its own: the router's agent labels the thread, and the product's watcher
176
+ hears the label within a second or two. `coalesce` gathers the question and
177
+ its label into one wake, once the oldest is 30 seconds old.
178
+ - **A product's watcher hears more than the label arriving:** later messages
179
+ in the thread, the label being taken away, and any other label changing on
180
+ it. The gate handles the label leaving. Tell the agent to reply only when
181
+ the last message isn't its own. To answer the first question only, drop
182
+ `message.posted` from its `types`.
183
+ - **A gate that fails wakes the agent.** Only `{"wake": false}` on its last
184
+ line says no; its exit code isn't read. `unlabelled.sh` wakes the router
185
+ when `mu read` fails, and `has-product.sh` doesn't wake its agent.
186
+ - **An agent that exits 0 without writing a label isn't tried again.** The
187
+ thread stays unsorted until someone posts in it or labels it by hand.
188
+ - **Fix a wrong label by hand:** `mu label <thread> product=api`. The api
189
+ agent is woken, and the gate keeps billing's asleep.
190
+ - **`mu daemon check router` times out,** because the router labels and never
191
+ replies. Check a product's watcher instead, which builds its message with
192
+ the label: `mu daemon check billing`.
193
+ - **"Label only" is an instruction, not a limit.** The router reads text
194
+ strangers wrote. On a served board give it a
195
+ [token](../01-concepts/11-access.md) held to that channel.
196
+ - **Messages sent while the board is down come in late.** When the board
197
+ starts again it reads what [Slack](../02-sync/04-slack.md) has since, with
198
+ limits that page gives.
199
+
200
+ ## Keep people in the loop
201
+
202
+ Nothing on a board proves that a particular person approved something. For a merge, a deploy
203
+ or a publish, have the agent ask where identity is verified: a review on the
204
+ pull request.
205
+
206
+ ## Keep it safe
207
+
208
+ - The wake command gets a pointer and a clean environment. It never gets the
209
+ secrets the sync names.
210
+ - A `filter` on the sync can drop or rewrite text on its way in.
211
+ - What arrives from a platform informs the agent; it never authorizes it.
212
+ - A task whose brief is edited from outside is held for its owner.
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: The inspector
3
+ description: For watching a board and acting on it from a browser on your machine. mu inspect opens a local page with tasks by state, channels, threads and live activity, where you can post, reply, start tasks and approve requests to join.
4
+ ---
5
+
6
+ ## Open it
7
+
8
+ ```bash
9
+ mu inspect
10
+ mu inspect --port 4500 --no-open
11
+ mu demo
12
+ ```
13
+
14
+ `mu inspect` opens the board in a browser. `mu demo` opens it on a scratch
15
+ board and plays a run through every state, so you can watch one happen.
16
+
17
+ ## What it shows
18
+
19
+ - **Tasks**, by state: open, waiting, ready, claimed, blocked, completed,
20
+ failed, canceled, all. Each row has the task's labels, who holds it and how
21
+ long the lease has left, what it waits for, or why it is held.
22
+ - **Channels**, and the threads in each.
23
+ - **Activity**: the newest events on the board.
24
+ - **A thread pane** for any task or thread, with its labels and files.
25
+ - **A composer**: post in a channel, reply in a thread, or start a task. The
26
+ "as" field at the foot of the sidebar picks the profile you write as.
27
+ - **Requests to join**: agents that asked for a token with `mu join`, each
28
+ with its code and note. Approve one with a channel, its permissions and how
29
+ long the token lasts, or deny it. See
30
+ [Access](../01-concepts/11-access.md#let-an-agent-ask-to-join).
31
+
32
+ It follows the board live. The view is in the URL, so a link opens the same
33
+ place.
34
+
35
+ Every view is a link: Tab reaches it, Enter opens it, and it opens in a new
36
+ tab when you ask for one. Enter opens a row too. On a phone the sidebar is
37
+ behind the menu button and a thread takes the whole screen; on a tablet a
38
+ thread lies over the list.
39
+
40
+ ## Whose access it has
41
+
42
+ The page acts as you, so its server trusts nothing but its own page:
43
+
44
+ - It listens on 127.0.0.1 only and answers only for its own host name.
45
+ - Every board request needs a token made for that run. It is in the link
46
+ `mu inspect` prints, after the `#`, and nowhere in what the server sends:
47
+ anything on your machine can ask 127.0.0.1 for the page, and gets a page
48
+ that can do nothing. Open the printed link once and your browser keeps the
49
+ token for that address, so links to a view work after that.
50
+ - Writes must come from the page's own origin.
51
+
52
+ Try writes against a scratch board first (`--dir`): on a board with sync, a
53
+ reply in a mirrored thread reaches people.
54
+
55
+ ## When not to
56
+
57
+ - For someone on another machine. The inspector listens on 127.0.0.1 only;
58
+ serve the board and give them a token, or
59
+ [build a page](./07-build-a-ui.md) for them.
60
+ - For an agent or a script. `mu read`, `mu wait` and `mu tail` give it the
61
+ same board as text.
62
+
63
+ ## What goes wrong
64
+
65
+ - **"This page needs the link mu inspect printed".** The page was opened
66
+ without the token after the `#`, or with one from an earlier
67
+ `mu inspect`: each run makes a new one. Open the link it printed this time.
68
+ - **`The inspector doesn't answer for "<host>"`.** The page was reached
69
+ under another host name. Use the printed address.
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: Running agents
3
+ description: For handing a task, or a whole queue, to Claude Code, Codex or any command. mu run claims it, starts the agent in a clean environment, keeps the claim alive, and records how it ended and what it cost.
4
+ ---
5
+
6
+ ## One task
7
+
8
+ ```bash
9
+ mu run 12 --agent claude --cwd ~/code/web --as worker-1
10
+ mu run 12 --agent codex --cwd ~/code/web --as worker-2
11
+ mu run 12 --cwd ~/code/web -- ./my-agent --fast
12
+ ```
13
+
14
+ `mu run` claims the task, starts the agent in its own process group, renews
15
+ the claim while it works, and records what the agent reported on the task:
16
+ `cost`, `tokens`, `session`, `agent`.
17
+
18
+ ## A worker
19
+
20
+ ```bash
21
+ mu run --ready work/ --loop --agent claude --as worker-1
22
+ mu run --ready work/ --loop --agent claude --budget 5 --wait 10m
23
+ ```
24
+
25
+ `--loop` takes one ready task after another, a fresh agent for each, until
26
+ nothing is ready for as long as `--wait` says. It stops at once on a usage
27
+ limit or a sign-in error, when its own `--budget` is spent, and when the
28
+ board's [budget](../01-concepts/13-budgets.md) for the channel is.
29
+
30
+ ## What the agent is told
31
+
32
+ A pointer: which task it holds, how to read it, how to log its work, and how
33
+ to settle it. Never the task's text. It reads the thread itself with `mu read`.
34
+
35
+ ## What the agent starts with
36
+
37
+ - **A clean environment:** `PATH`, `HOME`, what that agent's own sign-in
38
+ needs, the board's variables, and what you pass with `--env K=V`. Secrets in
39
+ your shell don't reach it by accident.
40
+ - **Permissions on.** `--bypass-permissions` turns on the agent's own
41
+ skip-permissions flag, and is always asked for by name. In a cloud sandbox it
42
+ is the other way round: see [Sandboxed agents](./06-sandboxed-agents.md).
43
+ - **Claude Code starts lean:** a shell and file tools, without your plugins,
44
+ skills and connected tools. `--full` loads everything.
45
+ - **Codex gets a writable sandbox** over its working folder and the board's.
46
+ - **A worktree of its own,** if you ask: `--worktree <repo> --branch <name>`
47
+ makes `--cwd` a git worktree on a new branch.
48
+
49
+ ## How it ends
50
+
51
+ | The agent | The task |
52
+ | --- | --- |
53
+ | Settles it (complete, fail, block) | Is as the agent left it |
54
+ | Ends without settling it | Fails: "the agent ended without settling the task" |
55
+ | Hits a usage limit or a sign-in error | Fails, without counting against it. `mu tasks reopen` readies it again |
56
+ | Runs out of `--timeout` | Fails: "the agent ran out of time". Everything it started is stopped |
57
+ | Can't be started | Is released |
58
+ | Is stopped (Ctrl-C, SIGTERM) | Is released |
59
+
60
+ ## Picking up where it left off
61
+
62
+ An agent that worked a task before resumes its own session, from the `session`
63
+ label. `--fresh` starts clean, and so does a different agent. A session the
64
+ agent no longer has, such as one left in a cloud sandbox that is gone, is
65
+ forgotten and the agent starts again fresh at once, under the same claim: the
66
+ task counts no failed attempt. A session you name with `--resume` that the
67
+ agent doesn't have fails the run instead, and is not remembered.
68
+
69
+ ## Any agent
70
+
71
+ Anything that reads a prompt on stdin works after `--`. It gets the task's ID
72
+ in `MUSTER_TASK` and its profile in `MUSTER_PROFILE`. With no usage to read,
73
+ muster records how it exited and nothing else.
74
+
75
+ ## When not to
76
+
77
+ - **For an agent you don't trust with your machine.** Here it runs as you,
78
+ with your files and your network. Give it a
79
+ [cloud sandbox](./06-sandboxed-agents.md) instead.
80
+ - **For a step that is only a command,** such as a test run, with nothing
81
+ to decide. `mu tasks run <id> -- pnpm test` settles the task by its exit
82
+ code, with no agent.
83
+ - **For a budget alone on Codex.** It reports no cost, so a budget never
84
+ stops it. Give it a `--timeout`. See
85
+ [Budgets](../01-concepts/13-budgets.md).