@openmuster/muster 0.3.1-alpha.3 → 0.3.1-alpha.5
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 +16 -10
- package/dist/{args-DX9QSK1f.js → args-CaFBa2IP.js} +305 -23
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +67 -18
- package/dist/index.js +106 -41
- package/dist/inspect/app.js +79 -51
- package/dist/{main-DgrIMbeA.js → main-BeEB08iI.js} +397 -26
- package/dist/main-CLzQkYeG.js +6 -0
- package/dist/mcp-CAAZRJgv.js +6 -0
- package/dist/{module-C-HJjWWo.js → module-BX2IjSiv.js} +2 -2
- package/dist/{module-CxoN1MOe.js → module-D9KdbEpS.js} +1 -1
- package/dist/skills/board/SKILL.md +5 -0
- package/dist/{steps-DtzUdcBE.js → steps-FNDWY1P_.js} +16 -4
- package/docs/01-concepts/09-watchers.md +4 -32
- package/docs/01-concepts/10-schedules.md +1 -1
- package/docs/01-concepts/11-access.md +19 -3
- package/docs/01-concepts/13-budgets.md +66 -3
- package/docs/01-concepts/15-outgoing-webhooks.md +6 -19
- package/docs/01-concepts/16-workflows.md +22 -2
- package/docs/01-quickstart.md +74 -42
- package/docs/02-sync/01-overview.md +34 -2
- package/docs/02-sync/02-github.md +40 -19
- package/docs/02-sync/03-linear.md +103 -85
- package/docs/02-sync/04-slack.md +116 -111
- package/docs/02-sync/05-notion.md +46 -25
- package/docs/03-guides/01-coding-agents.md +51 -33
- package/docs/03-guides/02-swarm.md +30 -15
- package/docs/03-guides/03-factory.md +193 -80
- package/docs/03-guides/04-inspector.md +79 -29
- package/docs/03-guides/05-running-agents.md +62 -35
- package/docs/03-guides/06-sandboxed-agents.md +488 -305
- package/docs/03-guides/07-build-a-ui.md +86 -31
- package/docs/03-guides/08-ci.md +59 -36
- package/docs/03-guides/09-daemon.md +121 -53
- package/docs/03-guides/10-two-agents.md +31 -22
- package/docs/03-guides/11-person-in-the-loop.md +47 -34
- package/docs/03-guides/12-unattended.md +46 -27
- package/docs/03-guides/13-terminals.md +51 -39
- package/docs/03-guides/14-no-cloud.md +31 -19
- package/docs/03-guides/15-several-boards.md +61 -27
- package/docs/03-guides/16-non-code.md +29 -18
- package/docs/03-guides/17-mcp.md +37 -30
- package/docs/03-guides/18-a-board-on-a-server.md +66 -43
- package/docs/03-guides/19-a-card-queue.md +210 -121
- package/docs/03-guides/20-a-feedback-loop.md +298 -134
- package/docs/03-guides/21-running-the-loop.md +94 -64
- package/docs/03-guides/22-building-from-linear.md +81 -57
- package/docs/04-reference/01-cli.md +8 -0
- package/docs/04-reference/02-handle.md +10 -15
- package/docs/04-reference/03-http.md +1 -1
- package/docs/04-reference/04-events.md +2 -1
- package/docs/04-reference/05-errors.md +3 -0
- package/docs/04-reference/08-files.md +49 -0
- package/docs/index.md +22 -0
- package/package.json +1 -1
- package/dist/main-CdVlnWHy.js +0 -6
- package/dist/mcp-NueWYyQs.js +0 -6
|
@@ -1,55 +1,99 @@
|
|
|
1
1
|
---
|
|
2
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.
|
|
3
|
+
description: For a team that wants an agent to answer GitHub issues, Linear issues or Slack questions as they arrive. You end with sync bringing each one in as a thread and a watcher waking the agent, which replies, asks or starts work there.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Who this is for
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Your team takes questions and work as issues or chat messages, and you want
|
|
9
|
+
an agent to answer each one as it arrives. You start with one agent on one
|
|
10
|
+
GitHub repository. Later, when the answers need different instructions,
|
|
11
|
+
access or owners, you route each thread to a product's agent by label.
|
|
12
|
+
|
|
13
|
+
## Before you begin
|
|
14
|
+
|
|
15
|
+
Do these first:
|
|
16
|
+
|
|
17
|
+
- Install muster: see the [quickstart](../01-quickstart.md).
|
|
18
|
+
- Copy `templates/factory` and run `pnpm install` in it. Outside this
|
|
19
|
+
repository, point its `@openmuster/muster` dependency at a release: its
|
|
20
|
+
README shows how.
|
|
21
|
+
- Have a GitHub repository and a webhook secret for it: see
|
|
22
|
+
[GitHub](../02-sync/02-github.md).
|
|
23
|
+
- Have a public HTTPS name that reaches this machine, through a proxy or a
|
|
24
|
+
tunnel.
|
|
25
|
+
- Install and sign in to Claude Code. `lib/wake.ts` runs `claude --print`
|
|
26
|
+
unless `FACTORY_AGENT` names another command. Of the host's model
|
|
27
|
+
credentials, the wake passes on only `ANTHROPIC_API_KEY`.
|
|
28
|
+
|
|
29
|
+
## How it fits together
|
|
30
|
+
|
|
31
|
+
Each job has one part that does it:
|
|
32
|
+
|
|
33
|
+
| Job | Done by |
|
|
9
34
|
| --- | --- |
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
35
|
+
| Brings threads in from GitHub, Linear, Slack | [Sync](../02-sync/01-overview.md) |
|
|
36
|
+
| Wakes an agent when a thread has news | A [watcher](../01-concepts/09-watchers.md) |
|
|
37
|
+
| Limits the agent to its channels | A [token](../01-concepts/11-access.md) |
|
|
38
|
+
| Shows what is set up | The factory page |
|
|
39
|
+
|
|
40
|
+
You wire up the plumbing: who is woken, as whom, and with which access. The
|
|
41
|
+
agent makes the decisions: it judges from each thread what the thread needs.
|
|
42
|
+
|
|
43
|
+
`templates/factory` has these pieces:
|
|
14
44
|
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
- a [board module](../01-concepts/17-board-module.md) (`lib/board.ts`) with
|
|
46
|
+
the GitHub sync and the watcher
|
|
47
|
+
- a host that runs them (`host.ts`)
|
|
48
|
+
- a wake script (`lib/wake.ts`)
|
|
49
|
+
- the agent's instructions (`AGENT.md`)
|
|
50
|
+
- a page that also takes the webhooks
|
|
17
51
|
|
|
18
|
-
##
|
|
52
|
+
## Connect GitHub issues to an agent
|
|
19
53
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
the
|
|
24
|
-
|
|
25
|
-
`templates/factory`, with the webhook's secret in both:
|
|
54
|
+
### Start the page and the host
|
|
55
|
+
|
|
56
|
+
Put your repository in place of `acme/web` in `lib/board.ts`. Then start the
|
|
57
|
+
page and the host from `templates/factory`, each in its own terminal, with
|
|
58
|
+
the webhook's secret in both:
|
|
26
59
|
|
|
27
60
|
```bash
|
|
28
|
-
export GITHUB_WEBHOOK_SECRET
|
|
61
|
+
export GITHUB_WEBHOOK_SECRET=your_webhook_secret
|
|
29
62
|
pnpm dev
|
|
30
63
|
```
|
|
31
64
|
|
|
32
65
|
```bash
|
|
33
|
-
export GITHUB_WEBHOOK_SECRET
|
|
66
|
+
export GITHUB_WEBHOOK_SECRET=your_webhook_secret
|
|
34
67
|
pnpm host
|
|
35
68
|
```
|
|
36
69
|
|
|
37
|
-
The module names the secret with `env()`, so
|
|
38
|
-
file
|
|
39
|
-
|
|
70
|
+
The module names the secret with `env()`, so the secret is never in the
|
|
71
|
+
file. The page reads it on its first request. `host.ts` reads it when it
|
|
72
|
+
starts, and refuses to start while it is unset.
|
|
73
|
+
|
|
74
|
+
### Point GitHub's webhook at the page
|
|
75
|
+
|
|
76
|
+
Point GitHub's webhook at
|
|
40
77
|
`https://board.example.com/api/board/webhooks/gh`, and list
|
|
41
78
|
`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.
|
|
43
|
-
|
|
79
|
+
webhook reaches it through a proxy or a tunnel with a public HTTPS name.
|
|
80
|
+
|
|
81
|
+
The webhook brings a thread in. `host.ts` runs the watcher, and the sync's
|
|
44
82
|
catch-up and sending.
|
|
45
83
|
|
|
46
|
-
|
|
47
|
-
|
|
84
|
+
### Start the daemon for scheduled messages
|
|
85
|
+
|
|
86
|
+
A daemon that holds the
|
|
87
|
+
[`tick` lease](../01-concepts/09-watchers.md#the-daemon) sends scheduled
|
|
88
|
+
messages. Run it with `--no-module`, since `host.ts` already runs this
|
|
89
|
+
module:
|
|
48
90
|
|
|
49
91
|
```bash
|
|
50
92
|
mu daemon run --no-module
|
|
51
93
|
```
|
|
52
94
|
|
|
95
|
+
### Check that the agent answers
|
|
96
|
+
|
|
53
97
|
With all three running, check from `templates/factory` that the watcher
|
|
54
98
|
wakes the agent and that the agent answers:
|
|
55
99
|
|
|
@@ -57,17 +101,23 @@ wakes the agent and that the agent answers:
|
|
|
57
101
|
mu daemon check factory --module "$PWD/lib/board.ts" --in factory/issues
|
|
58
102
|
```
|
|
59
103
|
|
|
60
|
-
|
|
61
|
-
|
|
104
|
+
### Post the agent's replies back to GitHub
|
|
105
|
+
|
|
106
|
+
The template's sync brings threads in and sends nothing back. To have sync
|
|
107
|
+
post the agent's replies as comments, give the repository `mirror: true` and
|
|
62
108
|
the sync a `token: env('GITHUB_TOKEN')`: see [GitHub](../02-sync/02-github.md)
|
|
63
109
|
and [Sync](../02-sync/01-overview.md#in-a-board-module).
|
|
64
110
|
|
|
65
|
-
|
|
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.
|
|
111
|
+
## What you see
|
|
69
112
|
|
|
70
|
-
|
|
113
|
+
The page lists what is set up and what isn't, with the command for each. It
|
|
114
|
+
also shows who holds each role (`tick` for the daemon, `sync` and
|
|
115
|
+
`watch:factory` for the host), and the recent threads. `/board` shows every
|
|
116
|
+
thread, where you read and reply from a browser.
|
|
117
|
+
|
|
118
|
+
### What happens to a thread
|
|
119
|
+
|
|
120
|
+
Each issue goes through these steps:
|
|
71
121
|
|
|
72
122
|
1. Someone opens an issue. It becomes a thread in the mapped channel.
|
|
73
123
|
2. The watcher wakes the agent with the thread's ID. The agent reads it.
|
|
@@ -100,7 +150,11 @@ flowchart LR
|
|
|
100
150
|
A -->|reply| S
|
|
101
151
|
```
|
|
102
152
|
|
|
103
|
-
|
|
153
|
+
### Declare a router and a watcher per product
|
|
154
|
+
|
|
155
|
+
In the board module, declare the router's watcher and one watcher per
|
|
156
|
+
product. Each runs a [gate](../01-concepts/09-watchers.md#a-gate) before it
|
|
157
|
+
wakes its agent:
|
|
104
158
|
|
|
105
159
|
```ts board.ts
|
|
106
160
|
import { board, command, type Watch } from '@openmuster/muster'
|
|
@@ -127,6 +181,25 @@ export default board({
|
|
|
127
181
|
})
|
|
128
182
|
```
|
|
129
183
|
|
|
184
|
+
The module sets up these behaviours:
|
|
185
|
+
|
|
186
|
+
- **Each watcher has its own `as`.** A watcher never hears its own
|
|
187
|
+
[profile](../01-concepts/06-actors.md)'s writes. A product's agent that
|
|
188
|
+
writes as `router` can't hear the router's label.
|
|
189
|
+
- **It costs two agent sessions a question.** Each watcher runs in a loop of
|
|
190
|
+
its own. While idle, a loop looks for new events at least once a second.
|
|
191
|
+
The router's agent labels the thread, and the product's watcher hears the
|
|
192
|
+
label.
|
|
193
|
+
`coalesce` gathers the question and its label into one wake, once the
|
|
194
|
+
oldest is `30s` old.
|
|
195
|
+
- **A product's watcher hears more than the label arriving.** It also hears
|
|
196
|
+
later messages in the thread, the label being taken away, and any other
|
|
197
|
+
label changing on it. The gate handles the label leaving. Tell the agent to
|
|
198
|
+
reply only when the last message isn't its own. To answer the first
|
|
199
|
+
question only, drop `message.posted` from its `types`.
|
|
200
|
+
|
|
201
|
+
### Have the router write one label
|
|
202
|
+
|
|
130
203
|
The router's agent reads the thread and writes one label on it, and nothing
|
|
131
204
|
else. Its instructions name the products and what each covers, and end with
|
|
132
205
|
the command:
|
|
@@ -138,9 +211,12 @@ mu label <thread> product=billing --if-unset product
|
|
|
138
211
|
`--if-unset` makes the first answer stand: a second try exits 1 with
|
|
139
212
|
`label_conflict`, so have `route.sh` treat that as done. Use `product=none`
|
|
140
213
|
for what isn't a product question. It is a label like the others: it stops
|
|
141
|
-
the router from
|
|
214
|
+
the router's gate from waking the router again, and no watcher listens for
|
|
215
|
+
it.
|
|
216
|
+
|
|
217
|
+
### Gate each watcher
|
|
142
218
|
|
|
143
|
-
The two gates
|
|
219
|
+
The two gates stop the watchers from starting a model for nothing:
|
|
144
220
|
|
|
145
221
|
```bash
|
|
146
222
|
#!/bin/sh
|
|
@@ -154,11 +230,27 @@ mu read "$MUSTER_THREAD" --json | grep -q '"product":' && echo '{"wake": false}'
|
|
|
154
230
|
mu read "$MUSTER_THREAD" --json | grep -q "\"product\": \"$1\"" || echo '{"wake": false}'
|
|
155
231
|
```
|
|
156
232
|
|
|
233
|
+
A gate says no in one way only: `{"wake": false}` on its last line. Its exit
|
|
234
|
+
code isn't read, so a gate that prints nothing wakes the agent. That is why
|
|
235
|
+
the two scripts fail in opposite directions when `mu read` fails and `grep`
|
|
236
|
+
finds nothing:
|
|
237
|
+
|
|
238
|
+
- **`unlabelled.sh` wakes the router.** Its `&&` prints `{"wake": false}`
|
|
239
|
+
only when `grep` finds a label, so on a failed read it prints nothing.
|
|
240
|
+
- **`has-product.sh` keeps its agent asleep.** Its `||` prints
|
|
241
|
+
`{"wake": false}` whenever `grep` finds no match.
|
|
242
|
+
|
|
243
|
+
### Wake each agent with a pointer
|
|
244
|
+
|
|
157
245
|
`route.sh` and `answer.sh` do what the factory's `lib/wake.ts` does, with
|
|
158
|
-
other instructions: they pass a
|
|
159
|
-
|
|
246
|
+
other instructions: they pass a
|
|
247
|
+
[pointer](../01-concepts/09-watchers.md#what-a-wake-carries), and the agent
|
|
248
|
+
reads the thread itself.
|
|
160
249
|
|
|
161
|
-
Try the plumbing by hand
|
|
250
|
+
### Try the plumbing by hand
|
|
251
|
+
|
|
252
|
+
Post a question and label it, with you as the router, then list the
|
|
253
|
+
threads that carry the billing label:
|
|
162
254
|
|
|
163
255
|
```bash steps
|
|
164
256
|
mu post help "How do I change the card on my account?" --as ada
|
|
@@ -166,47 +258,68 @@ mu label 1 product=billing --if-unset product --as router
|
|
|
166
258
|
mu read help --label product=billing --as ada
|
|
167
259
|
```
|
|
168
260
|
|
|
169
|
-
|
|
261
|
+
To check the watchers end to end, run `mu daemon check billing`. A
|
|
262
|
+
product's watcher builds its check message with its label; the router's
|
|
263
|
+
can't be checked this way (see [What goes wrong](#what-goes-wrong)).
|
|
264
|
+
|
|
265
|
+
## What keeps it safe
|
|
266
|
+
|
|
267
|
+
The factory keeps three things apart: secrets, the text that arrives, and
|
|
268
|
+
who approves.
|
|
269
|
+
|
|
270
|
+
### Keep secrets away from the agent
|
|
271
|
+
|
|
272
|
+
The wake command gets a pointer and a clean environment. It never gets the
|
|
273
|
+
secrets the sync names.
|
|
274
|
+
|
|
275
|
+
### Treat what arrives as information, not orders
|
|
276
|
+
|
|
277
|
+
Text from a platform is data for the agent:
|
|
170
278
|
|
|
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
279
|
- What arrives from a platform informs the agent; it never authorizes it.
|
|
212
|
-
- A
|
|
280
|
+
- A `filter` on the sync can drop or rewrite text on its way in.
|
|
281
|
+
- "Label only" is an instruction to the router, not a limit. The router
|
|
282
|
+
reads text strangers wrote. On a served board give it a
|
|
283
|
+
[token](../01-concepts/11-access.md) limited to that channel.
|
|
284
|
+
|
|
285
|
+
### Get approvals where identity is verified
|
|
286
|
+
|
|
287
|
+
Nothing on a board proves that a particular person approved something. For a
|
|
288
|
+
merge, a deploy or a publish, have the agent ask where identity is verified:
|
|
289
|
+
a review on the pull request.
|
|
290
|
+
|
|
291
|
+
### Hold edited tasks for their owner
|
|
292
|
+
|
|
293
|
+
If someone other than a task's owner edits its brief, the board
|
|
294
|
+
[holds the task](../01-concepts/08-tasks.md#who-may-change-a-task) for its
|
|
295
|
+
owner.
|
|
296
|
+
|
|
297
|
+
## What goes wrong
|
|
298
|
+
|
|
299
|
+
These are the failures routing by label runs into:
|
|
300
|
+
|
|
301
|
+
- **`mu daemon check router` times out.** The router labels and never
|
|
302
|
+
replies. Check a product's watcher instead: `mu daemon check billing`.
|
|
303
|
+
- **A thread stays unsorted.** The router's agent exited 0 without writing a
|
|
304
|
+
label, and the watcher doesn't retry an agent that exits 0. The thread
|
|
305
|
+
stays unsorted until someone posts in it or labels it by hand.
|
|
306
|
+
- **A thread has the wrong label.** Fix it by hand:
|
|
307
|
+
`mu label <thread> product=api`. The api watcher wakes its agent, and the
|
|
308
|
+
gate keeps billing's asleep.
|
|
309
|
+
- **Messages sent while the board was down come in late.** Slack retries an
|
|
310
|
+
unanswered event three times, within minutes. After that, when the board
|
|
311
|
+
starts again, it reads what [Slack](../02-sync/04-slack.md) has since.
|
|
312
|
+
Edits and deletes made meanwhile aren't read: see
|
|
313
|
+
[After downtime](../02-sync/04-slack.md#after-downtime) for the limits.
|
|
314
|
+
|
|
315
|
+
## Related
|
|
316
|
+
|
|
317
|
+
Go further with these pages:
|
|
318
|
+
|
|
319
|
+
- [Watchers](../01-concepts/09-watchers.md): the daemon, gates and retries
|
|
320
|
+
- [Keep the daemon running](./09-daemon.md#check-that-a-watcher-wakes-something):
|
|
321
|
+
`mu daemon check`
|
|
322
|
+
- [GitHub](../02-sync/02-github.md) and [Slack](../02-sync/04-slack.md): what
|
|
323
|
+
each platform's sync brings in and sends back
|
|
324
|
+
- [Access](../01-concepts/11-access.md): tokens that limit an agent to its
|
|
325
|
+
channels
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: The inspector
|
|
3
|
-
description: For
|
|
3
|
+
description: For people who want to watch a board and act on it from a browser on their own machine. You end with a local page from mu inspect that shows tasks by state, channels, threads and live activity, where you can post, reply, start tasks and approve requests to join.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
## Open
|
|
6
|
+
## Open the inspector
|
|
7
|
+
|
|
8
|
+
Open the inspector, or a demo of it:
|
|
7
9
|
|
|
8
10
|
```bash
|
|
9
11
|
mu inspect
|
|
@@ -11,59 +13,107 @@ mu inspect --port 4500 --no-open
|
|
|
11
13
|
mu demo
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
`mu inspect` opens the board in a browser.
|
|
15
|
-
|
|
16
|
+
`mu inspect` opens the board in a browser. `--port 4500` serves it on port
|
|
17
|
+
4500, and `--no-open` doesn't open a browser. `mu demo` opens the page on a
|
|
18
|
+
scratch board and plays a run through every state, so you can watch one
|
|
19
|
+
happen.
|
|
16
20
|
|
|
17
21
|
## What it shows
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
The page shows:
|
|
24
|
+
|
|
25
|
+
- **Tasks by state:** open, waiting, ready, claimed, blocked, completed,
|
|
20
26
|
failed, canceled, all. Each row has the task's labels, who holds it and how
|
|
21
|
-
long the lease has left, what it waits
|
|
22
|
-
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
- **A
|
|
26
|
-
|
|
27
|
-
- **
|
|
27
|
+
long the [lease](../01-concepts/08-tasks.md#claims) has left, what it waits
|
|
28
|
+
for, or why it is [held](../01-concepts/08-tasks.md#states).
|
|
29
|
+
- **Channels:** each with its threads.
|
|
30
|
+
- **Activity:** the newest events on the board, each with its clock time.
|
|
31
|
+
- **A thread pane:** any task or thread, with its labels and files in full,
|
|
32
|
+
the whole date of each message, and who holds a task and until when.
|
|
33
|
+
- **A composer:** post in a channel, reply in a thread, or start a task. The
|
|
34
|
+
"as" field at the foot of the sidebar picks the
|
|
35
|
+
[profile](../01-concepts/06-actors.md) you write as.
|
|
36
|
+
- **Requests to join:** agents that asked for a token with `mu join`, each
|
|
28
37
|
with its code and note. Approve one with a channel, its permissions and how
|
|
29
38
|
long the token lasts, or deny it. See
|
|
30
39
|
[Access](../01-concepts/11-access.md#let-an-agent-ask-to-join).
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
place.
|
|
41
|
+
The page updates live as the board changes. The view is in the URL, so a link
|
|
42
|
+
opens the same place.
|
|
34
43
|
|
|
35
44
|
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.
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
tab when you ask for one. Enter opens a row too.
|
|
46
|
+
|
|
47
|
+
## Work through a list from the keyboard
|
|
48
|
+
|
|
49
|
+
In tasks and activity, these keys move through the list one row at a time:
|
|
50
|
+
|
|
51
|
+
| Key | What it does |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `j` or `↓` | Moves to the next row |
|
|
54
|
+
| `k` or `↑` | Moves to the previous row |
|
|
55
|
+
| `Enter` | Opens the thread of the row you are on |
|
|
56
|
+
| `Esc` | Closes the list of keys, the menu or the thread, in that order. Closing a thread puts you back on the row you opened it from |
|
|
57
|
+
| `?` | Shows every key |
|
|
58
|
+
|
|
59
|
+
While you type in the composer or the "as" field, every key is text and none
|
|
60
|
+
of these work. A key held with Cmd, Ctrl or Alt is left to the browser.
|
|
61
|
+
|
|
62
|
+
On a phone the sidebar is behind the menu button and a thread takes the whole
|
|
63
|
+
screen. On a tablet a thread opens over the list.
|
|
64
|
+
|
|
65
|
+
## Get notified of mentions
|
|
66
|
+
|
|
67
|
+
Press **notify me of mentions** in the sidebar and allow notifications. The
|
|
68
|
+
page then shows a notification for each new message that mentions you. It
|
|
69
|
+
does this while the page is open, in a background tab too. Click a
|
|
70
|
+
notification to open its thread.
|
|
71
|
+
|
|
72
|
+
A mention of you is `@` and your own handle, from anyone but you: what
|
|
73
|
+
`mu inbox` counts as a mention with no `--as`. A mention of a profile, such
|
|
74
|
+
as the one in the "as" field, isn't one. What you write from the page, as any
|
|
75
|
+
profile, never notifies you.
|
|
76
|
+
|
|
77
|
+
The button is only there until you answer. To change your answer later, use
|
|
78
|
+
the site settings of your browser for the page's address.
|
|
39
79
|
|
|
40
80
|
## Whose access it has
|
|
41
81
|
|
|
42
82
|
The page acts as you, so its server trusts nothing but its own page:
|
|
43
83
|
|
|
44
84
|
- 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.
|
|
46
|
-
`mu inspect` prints, after the `#`, and nowhere in what the server
|
|
47
|
-
|
|
48
|
-
that can do nothing. Open the printed link once and your browser keeps
|
|
49
|
-
token for that address, so links to a view work after that.
|
|
85
|
+
- Every board request needs a token made for that run. The token is in the
|
|
86
|
+
link `mu inspect` prints, after the `#`, and nowhere in what the server
|
|
87
|
+
sends. Anything on your machine can ask 127.0.0.1 for the page, and gets a
|
|
88
|
+
page that can do nothing. Open the printed link once and your browser keeps
|
|
89
|
+
the token for that address, so links to a view work after that.
|
|
50
90
|
- Writes must come from the page's own origin.
|
|
51
91
|
|
|
52
92
|
Try writes against a scratch board first (`--dir`): on a board with sync, a
|
|
53
93
|
reply in a mirrored thread reaches people.
|
|
54
94
|
|
|
55
|
-
## When not to
|
|
95
|
+
## When not to use the inspector
|
|
96
|
+
|
|
97
|
+
Use something else for:
|
|
56
98
|
|
|
57
|
-
-
|
|
58
|
-
|
|
99
|
+
- **Someone on another machine:** the inspector listens on 127.0.0.1 only.
|
|
100
|
+
Serve the board and give them a token, or
|
|
59
101
|
[build a page](./07-build-a-ui.md) for them.
|
|
60
|
-
-
|
|
102
|
+
- **An agent or a script:** `mu read`, `mu wait` and `mu tail` give it the
|
|
61
103
|
same board as text.
|
|
62
104
|
|
|
63
105
|
## What goes wrong
|
|
64
106
|
|
|
65
|
-
|
|
107
|
+
Each item is the symptom, then the cause and the fix:
|
|
108
|
+
|
|
109
|
+
- **"This page needs the link mu inspect printed":** you opened the page
|
|
66
110
|
without the token after the `#`, or with one from an earlier
|
|
67
111
|
`mu inspect`: each run makes a new one. Open the link it printed this time.
|
|
68
|
-
- **`The inspector doesn't answer for "<host>"
|
|
69
|
-
|
|
112
|
+
- **`The inspector doesn't answer for "<host>"`:** you reached the page under
|
|
113
|
+
another host name. Use the printed address.
|
|
114
|
+
- **You get no notifications, though the page asked and you allowed them.**
|
|
115
|
+
The operating system has to allow your browser to show notifications too:
|
|
116
|
+
on macOS in System Settings, Notifications. Chrome on Android shows none
|
|
117
|
+
from a page like this one.
|
|
118
|
+
- **A notification comes a minute late.** A browser slows a tab it hasn't
|
|
119
|
+
shown for a while; the page reads the board less often until you look.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Running agents
|
|
3
|
-
description: For handing a task, or a whole queue, to Claude Code, Codex or any command. mu run
|
|
3
|
+
description: For handing a task, or a whole queue, to Claude Code, Codex or any command. You end with mu run claiming the work, starting the agent in a clean environment, keeping the claim alive, and recording how it ended and what it cost.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Run an agent on one task
|
|
7
|
+
|
|
8
|
+
Give `mu run` a task ID and an agent, or any command after `--`:
|
|
7
9
|
|
|
8
10
|
```bash
|
|
9
11
|
mu run 12 --agent claude --cwd ~/code/web --as worker-1
|
|
@@ -11,48 +13,68 @@ mu run 12 --agent codex --cwd ~/code/web --as worker-2
|
|
|
11
13
|
mu run 12 --cwd ~/code/web -- ./my-agent --fast
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
`mu run` claims the task
|
|
15
|
-
|
|
16
|
-
`cost`, `tokens`, `session`,
|
|
16
|
+
`mu run` [claims](../01-concepts/08-tasks.md#claims) the task and starts the
|
|
17
|
+
agent in its own process group. It renews the claim while the agent works.
|
|
18
|
+
It records what the agent reported on the task: `cost`, `tokens`, `session`,
|
|
19
|
+
`agent`.
|
|
20
|
+
|
|
21
|
+
## Work through a queue
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
Add `--ready` and `--loop` to take the tasks in a channel one after another:
|
|
19
24
|
|
|
20
25
|
```bash
|
|
21
26
|
mu run --ready work/ --loop --agent claude --as worker-1
|
|
22
27
|
mu run --ready work/ --loop --agent claude --budget 5 --wait 10m
|
|
23
28
|
```
|
|
24
29
|
|
|
25
|
-
`--loop` takes one ready task after another, a fresh agent for each
|
|
26
|
-
nothing
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
`--loop` takes one ready task after another, with a fresh agent for each. It
|
|
31
|
+
stops when nothing has been ready for as long as `--wait` says. It stops at
|
|
32
|
+
once in these cases:
|
|
33
|
+
|
|
34
|
+
- on a usage limit or a sign-in error
|
|
35
|
+
- when its own `--budget` is spent (`--budget 5` is $5)
|
|
36
|
+
- when the board's [budget](../01-concepts/13-budgets.md) for the channel is
|
|
37
|
+
spent
|
|
29
38
|
|
|
30
39
|
## What the agent is told
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
The agent gets a pointer to the task, never the task's text. The pointer
|
|
42
|
+
says:
|
|
43
|
+
|
|
44
|
+
- which task it holds
|
|
45
|
+
- how to read it
|
|
46
|
+
- how to log its work
|
|
47
|
+
- how to [settle](../01-concepts/08-tasks.md#settling) it
|
|
48
|
+
|
|
49
|
+
The agent reads the thread itself with `mu read`.
|
|
34
50
|
|
|
35
51
|
## What the agent starts with
|
|
36
52
|
|
|
53
|
+
Each agent `mu run` starts gets:
|
|
54
|
+
|
|
37
55
|
- **A clean environment:** `PATH`, `HOME`, what that agent's own sign-in
|
|
38
56
|
needs, the board's variables, and what you pass with `--env K=V`. Secrets in
|
|
39
57
|
your shell don't reach it by accident.
|
|
40
|
-
- **Permissions on
|
|
41
|
-
skip-permissions flag, and
|
|
42
|
-
is the other way round: see
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- **
|
|
58
|
+
- **Permissions on:** `--bypass-permissions` turns on the agent's own
|
|
59
|
+
skip-permissions flag, and only when you pass it by name. In a cloud
|
|
60
|
+
sandbox it is the other way round: see
|
|
61
|
+
[Sandboxed agents](./06-sandboxed-agents.md).
|
|
62
|
+
- **Claude Code starts lean.** It gets a shell and file tools, without your
|
|
63
|
+
plugins, skills and connected tools. `--full` loads everything.
|
|
64
|
+
- **Codex gets a writable sandbox.** It covers its working folder and the
|
|
65
|
+
board's.
|
|
66
|
+
- **A worktree of its own, if you ask:** `--worktree <repo> --branch <name>`
|
|
47
67
|
makes `--cwd` a git worktree on a new branch.
|
|
48
68
|
|
|
49
69
|
## How it ends
|
|
50
70
|
|
|
71
|
+
What happens to the task depends on how the agent ends:
|
|
72
|
+
|
|
51
73
|
| The agent | The task |
|
|
52
74
|
| --- | --- |
|
|
53
75
|
| Settles it (complete, fail, block) | Is as the agent left it |
|
|
54
76
|
| Ends without settling it | Fails: "the agent ended without settling the task" |
|
|
55
|
-
|
|
|
77
|
+
| Reaches a usage limit or gets a sign-in error | Fails, without counting as a failed attempt. `mu tasks reopen` readies it again |
|
|
56
78
|
| Runs out of `--timeout` | Fails: "the agent ran out of time". Everything it started is stopped |
|
|
57
79
|
| Can't be started | Is released |
|
|
58
80
|
| Is stopped (Ctrl-C, SIGTERM) | Is released |
|
|
@@ -60,26 +82,31 @@ to settle it. Never the task's text. It reads the thread itself with `mu read`.
|
|
|
60
82
|
## Picking up where it left off
|
|
61
83
|
|
|
62
84
|
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.
|
|
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.
|
|
85
|
+
label. `--fresh` starts clean, and so does a different agent.
|
|
68
86
|
|
|
69
|
-
|
|
87
|
+
The agent may no longer have that session, such as one left in a cloud
|
|
88
|
+
sandbox that is gone. Then `mu run` forgets it and starts the agent fresh at
|
|
89
|
+
once, under the same claim: the task counts no failed attempt. A session you
|
|
90
|
+
name with `--resume` that the agent doesn't have fails the run instead, and
|
|
91
|
+
`mu run` doesn't record it.
|
|
92
|
+
|
|
93
|
+
## Run your own agent command
|
|
70
94
|
|
|
71
95
|
Anything that reads a prompt on stdin works after `--`. It gets the task's ID
|
|
72
|
-
in `MUSTER_TASK` and its profile in
|
|
96
|
+
in `MUSTER_TASK` and its [profile](../01-concepts/06-actors.md) in
|
|
97
|
+
`MUSTER_PROFILE`. With no usage to read,
|
|
73
98
|
muster records how it exited and nothing else.
|
|
74
99
|
|
|
75
|
-
## When not to
|
|
100
|
+
## When not to run an agent this way
|
|
101
|
+
|
|
102
|
+
Use something else for:
|
|
76
103
|
|
|
77
|
-
- **
|
|
78
|
-
|
|
104
|
+
- **An agent you don't trust with your machine:** here it runs as you, with
|
|
105
|
+
your files and your network. Give it a
|
|
79
106
|
[cloud sandbox](./06-sandboxed-agents.md) instead.
|
|
80
|
-
- **
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- **
|
|
84
|
-
stops it. Give it a `--timeout`. See
|
|
107
|
+
- **A step that is only a command:** a test run, say, with nothing to decide.
|
|
108
|
+
`mu tasks run <id> -- pnpm test` settles the task by its exit code, with no
|
|
109
|
+
agent.
|
|
110
|
+
- **A budget as the only limit on Codex:** Codex reports no cost, so a budget
|
|
111
|
+
never stops it. Give it a `--timeout`. See
|
|
85
112
|
[Budgets](../01-concepts/13-budgets.md).
|