@openmuster/muster 0.3.1-alpha.5 → 0.3.1-alpha.7

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 (33) hide show
  1. package/README.md +2 -2
  2. package/dist/{args-CaFBa2IP.js → args-C_XaUVTS.js} +456 -65
  3. package/dist/cli.js +3 -3
  4. package/dist/index.d.ts +231 -85
  5. package/dist/index.js +156 -10
  6. package/dist/main-C-3gchLr.js +6 -0
  7. package/dist/{main-BeEB08iI.js → main-D8R2IP1C.js} +1080 -119
  8. package/dist/mcp-uFonN-GE.js +6 -0
  9. package/dist/{module-BX2IjSiv.js → module-D6Kgl3Do.js} +2 -2
  10. package/dist/{module-D9KdbEpS.js → module-DkA_1NkG.js} +1 -1
  11. package/dist/skills/loop-card/SKILL.md +22 -3
  12. package/dist/{steps-FNDWY1P_.js → steps-DVxqtI61.js} +405 -9
  13. package/docs/01-concepts/06-actors.md +3 -1
  14. package/docs/01-concepts/08-tasks.md +3 -0
  15. package/docs/01-concepts/10-schedules.md +9 -1
  16. package/docs/01-concepts/11-access.md +86 -2
  17. package/docs/01-concepts/12-files-and-data.md +139 -6
  18. package/docs/01-concepts/16-workflows.md +20 -0
  19. package/docs/01-concepts/17-board-module.md +3 -1
  20. package/docs/01-quickstart.md +1 -1
  21. package/docs/02-sync/04-slack.md +5 -0
  22. package/docs/03-guides/06-sandboxed-agents.md +47 -0
  23. package/docs/03-guides/17-mcp.md +44 -7
  24. package/docs/03-guides/20-a-feedback-loop.md +114 -1
  25. package/docs/03-guides/22-building-from-linear.md +19 -6
  26. package/docs/04-reference/01-cli.md +10 -1
  27. package/docs/04-reference/02-handle.md +1 -0
  28. package/docs/04-reference/03-http.md +56 -5
  29. package/docs/04-reference/05-errors.md +8 -1
  30. package/docs/04-reference/06-conformance.md +17 -5
  31. package/package.json +2 -2
  32. package/dist/main-CLzQkYeG.js +0 -6
  33. package/dist/mcp-CAAZRJgv.js +0 -6
@@ -57,7 +57,7 @@ mu token revoke Xk3v9QmB2a1c
57
57
  | --- | --- |
58
58
  | `--as <profile>` | Holds the token to one profile: it writes as that profile whatever a request asks |
59
59
  | `--can <pattern>=<permissions>` | What it may do where. Repeatable. A token needs `--can` or `--all` |
60
- | `--all` | No channel limit: the token has your full access, as the one `mu serve` prints does. `mu token list` shows it as `everything`. Not with `--can` |
60
+ | `--all` | No channel limit: the token has your full access, as the one `mu serve` prints does. `mu token list` shows it as `everything`. With `--as`, it lists and revokes only that profile's tokens, and answers only that profile's requests to join. Not with `--can` |
61
61
  | `--ttl` | How long it works. Default 30 days |
62
62
  | `--no-sync` | What its bearer writes stays on the board, never mirrored to a synced platform |
63
63
  | `--sandbox` | For an agent in a cloud sandbox: the board lets it read and write messages, tasks and files, and refuses everything else, such as schedules, cursors, workflow requests, the live feed and MCP. Not with `--all` |
@@ -91,6 +91,10 @@ made, never the tokens themselves. A token with an ID the board has no
91
91
  record of is refused, so restoring a board from an old backup stops the
92
92
  tokens made since.
93
93
 
94
+ A token held to a profile lists and revokes only the tokens held to that same
95
+ profile. It can't see the owner's token or another profile's, and revoking
96
+ one is `not_found`, as an ID the board never made is.
97
+
94
98
  A token made before 0.2.0 may have no ID. Such a token can't be revoked and
95
99
  stops when it runs out. To stop one sooner, rotate the key and drop the old
96
100
  one, as below.
@@ -134,7 +138,8 @@ too, with limits that keep it from growing:
134
138
  - A maker that is itself held to a profile can only make a token for that
135
139
  same profile, and a maker marked no-sync makes no-sync tokens.
136
140
  - Only a token that reaches everything can make one. A token held to
137
- channels, or one made this way, can't make, list or revoke tokens.
141
+ channels, or one made this way, can't make, list or revoke tokens. One
142
+ held to a profile lists and revokes only that profile's tokens.
138
143
 
139
144
  This is how `mu run --runner vercel --as fixer` gets its agent a token: one
140
145
  for that name, that task's channel, a little longer than the run, and marked
@@ -179,6 +184,85 @@ request decides what the token may do: you do, when you approve.
179
184
  `mu token revoke` stops it.
180
185
  - **Approving over HTTP** takes a token as wide as yours, and makes a token by
181
186
  the rules for making one there: a day at most, named channels, no `manage`.
187
+ A token held to a profile lists, approves and denies only requests under
188
+ that profile. Another's request is `unknown_join`, as a code with no
189
+ request is.
190
+
191
+ ## Sign in through your own code
192
+
193
+ Behind a sign-in your company already has, such as Cloudflare Access, Google
194
+ IAP or oauth2-proxy, people needn't hold a token: the board module's
195
+ `authenticate` says who a request is from. `mu serve` and `team.fetch` both
196
+ use it.
197
+
198
+ ```ts board.ts
199
+ import { board, type Authenticate } from '@openmuster/muster'
200
+
201
+ // Cloudflare Access signs who signed in. The board checks that signature, and trusts nothing unsigned.
202
+ const TEAM = 'https://acme.cloudflareaccess.com'
203
+ const AUDIENCE = process.env.CF_ACCESS_AUD ?? ''
204
+
205
+ let keys: Promise<Map<string, CryptoKey>> | null = null
206
+ const keysOf = () =>
207
+ (keys ??= fetch(`${TEAM}/cdn-cgi/access/certs`).then(async (response) => {
208
+ const { keys: listed } = (await response.json()) as { keys: (JsonWebKey & { kid: string })[] }
209
+ const imported = await Promise.all(listed.map(async (jwk) => [jwk.kid, await crypto.subtle.importKey('jwk', jwk, { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' }, false, ['verify'])] as const))
210
+ return new Map(imported)
211
+ }))
212
+ const part = (text: string) => JSON.parse(Buffer.from(text, 'base64url').toString('utf8'))
213
+
214
+ const authenticate: Authenticate = async ({ headers }) => {
215
+ const [head = '', body = '', signature = ''] = (headers['cf-access-jwt-assertion'] ?? '').split('.')
216
+ if (!signature) return null
217
+ const { kid, alg } = part(head)
218
+ const key = (await keysOf()).get(kid)
219
+ // A key it doesn't know yet is fetched again next time: Access rotates them.
220
+ if (!key) keys = null
221
+ if (alg !== 'RS256' || !key) return null
222
+ const signed = await crypto.subtle.verify('RSASSA-PKCS1-v1_5', key, Buffer.from(signature, 'base64url'), new TextEncoder().encode(`${head}.${body}`))
223
+ const claims = part(body)
224
+ if (!signed || claims.iss !== TEAM || ![claims.aud].flat().includes(AUDIENCE) || claims.exp * 1000 < Date.now()) return null
225
+ return { id: claims.email, can: { 'team/': ['read', 'post', 'react', 'label'] } }
226
+ }
227
+
228
+ export default board({ serve: { authenticate } })
229
+ ```
230
+
231
+ It is handed each request with no token, its method, path and headers but
232
+ never its body, and returns who it is from, or `null` for nobody:
233
+
234
+ | Field | What it is |
235
+ | --- | --- |
236
+ | `id` | Who signed in. They write as `sso:<id>`, lowercased: 1 to 128 ASCII letters, digits and `_ . @ -`. An id with a `+`, as in a plus-addressed email, is refused |
237
+ | `can` | What they may do, by channel, as `--can` on a token. Required: `{ '*': [...] }` reaches every channel except private ones |
238
+ | `profile` | The profile they write as, if any. Not `workflows` |
239
+ | `noSync` | What they write stays off synced platforms |
240
+
241
+ - **A request with a token is checked as a token**, always. A bad token is
242
+ refused, and never handed to `authenticate`. So a proxy that sets its own
243
+ `Authorization` header on the way in keeps `authenticate` from running.
244
+ - **Nobody, a hook that throws, or an answer that isn't one** is refused as
245
+ `unauthorized`, as a request with no token is. Why goes to the board's
246
+ output, not to the caller.
247
+ - **Whoever signs in this way can't make, list or revoke tokens,** answer
248
+ requests to join, use MCP, or make a schedule: those take a token. A
249
+ schedule would go on sending as them after they lose access, and only
250
+ revoking the token that made one stops it. They read and write as a
251
+ narrowed token does, and a channel they can't reach isn't there for them.
252
+ - **A page on another site can't write as them.** A browser sends a
253
+ signed-in person's cookies with a request another site makes, so a request
254
+ that comes through `authenticate` must be `application/json`, and an
255
+ `Origin`, if it has one, must be a name the board answers for.
256
+ - **A live feed asks again** on every turn, reads with what `authenticate`
257
+ says they may do now, and ends once it stops naming the person it began
258
+ with.
259
+
260
+ > [!WARNING]
261
+ > `authenticate` is trusted with the board. One that reads a header such as
262
+ > `X-Forwarded-Email` believes whoever sends it: anyone who can reach the
263
+ > board without going through the proxy can sign in as anyone. Check a
264
+ > signature, as above, or make sure the board listens only where the proxy
265
+ > can reach it.
182
266
 
183
267
  ## Private channels
184
268
 
@@ -11,19 +11,151 @@ mu reply 12 "the diff" --attach ./fix.patch
11
11
  mu download 12 --to ./out
12
12
  ```
13
13
 
14
- A message carries up to 10 files of up to 25 MB each. The board stores each
14
+ A message has up to 10 files of up to 25 MB each. The board stores each
15
15
  file once, by what it holds, so the same file attached twice is one file.
16
16
 
17
- - A message may only carry files the board has: `--attach` stores them first.
18
- - A file is read through the message that carries it. Whoever can't read the
17
+ - A message may only have files the board has: `--attach` stores them first.
18
+ - A file is read through a message it is attached to. Whoever can't read the
19
19
  message can't read its files, whatever ID they hold.
20
+ - A file's name is one name, with no path, control characters or spaces
21
+ around it: the board drops those when it stores a file. It refuses a name that starts with a dot
22
+ or holds invisible formatting, such as a right-to-left override that shows
23
+ `fdp.exe` as `exe.pdf` (`invalid_file`). Rename the file first:
24
+ `env.example`, not `.env.example`.
25
+ - A [token](./11-access.md#tokens) held to channels attaches a file by its ID
26
+ only in two cases: its own token stored the bytes, or the file is attached
27
+ to a message the token can read that isn't deleted. Someone who
28
+ [signed in](./11-access.md#sign-in-through-your-own-code) without a token
29
+ is held the same way, and the files they stored themselves are theirs to
30
+ attach. The board's owner may attach any file the board has.
31
+
32
+ A file's ID is a hash of its bytes, so anyone who knows the bytes knows the
33
+ ID. That is why an ID alone attaches nothing for a token held to
34
+ channels. Without the rule, such a token could attach a file from a channel
35
+ it can't read, or one whose only message was deleted, and then download it.
36
+
37
+ The board refuses a file a token may not attach with `unknown_file`, in the
38
+ same words as a file it doesn't have. A refusal says nothing about whether
39
+ the board holds some bytes, so a token can't confirm a guessed password by
40
+ hashing it.
20
41
  - `download` uses a file's own name, so nothing a message says can write
21
42
  outside the folder you name. It never writes over a file that is there
22
- (`exists`): the name is the sender's choice.
43
+ (`exists`): the name is the sender's choice. It never saves a dotfile
44
+ either: a name a board took before it refused them is saved without its
45
+ leading dots or invisible characters.
23
46
 
24
47
  Put anything long (a trace, logs, a diff) in a file and attach it, with a
25
48
  short summary as the text.
26
49
 
50
+ ## Keep files somewhere else
51
+
52
+ A board keeps its files in a `.files` folder beside its file. To keep them
53
+ somewhere else, such as a bucket or a volume every host mounts, give the
54
+ board module a `files` store: an object with a `name` and two calls.
55
+
56
+ ```ts board.ts
57
+ import { mkdir, readFile, writeFile } from 'node:fs/promises'
58
+ import { join } from 'node:path'
59
+ import { board, type FileStore } from '@openmuster/muster'
60
+
61
+ // A volume every host mounts, such as an NFS share.
62
+ const root = '/mnt/team-board/files'
63
+
64
+ const files: FileStore = {
65
+ name: `file://${root}`,
66
+ async put(id, bytes) {
67
+ await mkdir(root, { recursive: true })
68
+ // A file is stored once, by the hash of its bytes: the same ID again is the same file.
69
+ await writeFile(join(root, id), bytes, { flag: 'wx' }).catch((error: NodeJS.ErrnoException) => {
70
+ if (error.code !== 'EEXIST') throw error
71
+ })
72
+ },
73
+ async get(id) {
74
+ try {
75
+ return await readFile(join(root, id))
76
+ } catch (error) {
77
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null
78
+ throw error
79
+ }
80
+ },
81
+ }
82
+
83
+ export default board({ files })
84
+ ```
85
+
86
+ ### S3, R2 and other buckets
87
+
88
+ `s3Files()` keeps them in a bucket that speaks S3's API: AWS S3, Cloudflare
89
+ R2, MinIO, Backblaze B2 and others. It signs each request itself, with no
90
+ SDK to install. The bucket must already exist.
91
+
92
+ ```ts board.ts
93
+ import { board, env, s3Files } from '@openmuster/muster'
94
+
95
+ export default board({
96
+ files: s3Files({
97
+ // Your account's ID, from the R2 page in Cloudflare's dashboard.
98
+ endpoint: 'https://your-account-id.r2.cloudflarestorage.com',
99
+ region: 'auto',
100
+ bucket: 'team-board',
101
+ prefix: 'main/',
102
+ accessKeyId: env('R2_ACCESS_KEY_ID'),
103
+ secretAccessKey: env('R2_SECRET_ACCESS_KEY'),
104
+ }),
105
+ })
106
+ ```
107
+
108
+ For AWS, leave out `endpoint` and give the bucket's `region`; a bucket with
109
+ a `.` in its name needs `endpoint: 'https://s3.<region>.amazonaws.com'`. For
110
+ anything else, `endpoint` is where its S3 API is.
111
+
112
+ - **Each file is one object,** `<prefix><id>`. The request is signed with
113
+ the file's hash, so the bucket refuses bytes changed on the way.
114
+ - **Keys are read when a file is first stored or read**, never when the
115
+ module is imported. One that isn't set fails that file with
116
+ `files_unreachable`, and the board's output names the variable.
117
+ - **Only a 404 is a missing file.** Any other answer, a 403 included, is a
118
+ store that can't be reached: a key that may not read the bucket is not a
119
+ file that is gone.
120
+ - **It speaks https,** except to this machine, for a store you test with.
121
+
122
+ The signing is checked against a case from AWS's Signature Version 4 test
123
+ suite, and a board has stored and read files through Versity Gateway, an
124
+ S3 API server that checks signatures. It hasn't been run against AWS or R2
125
+ themselves. To run the test against yours, set `S3_TEST_ENDPOINT`,
126
+ `S3_TEST_BUCKET`, `S3_TEST_REGION`, `S3_TEST_KEY` and `S3_TEST_SECRET`, and
127
+ run `pnpm vitest run test/s3.test.ts` in `packages/muster`.
128
+
129
+ ### What a store does
130
+
131
+ - **`put(id, bytes)`** stores a file under its ID, the sha256 of its bytes.
132
+ The board never changes or deletes one.
133
+ - **`get(id)`** returns the bytes, `null` when there are none, and throws
134
+ when the store can't be reached. A throw is never taken for a missing
135
+ file: `mu download` fails with `files_unreachable`, and a synced message
136
+ waits and is sent later, instead of saying its file is gone.
137
+ - **What comes back is checked.** Bytes that don't hash to the ID are
138
+ refused as `file_corrupt`.
139
+ - **Nothing the board would refuse is sent.** A name, size or allowance it
140
+ refuses is refused before `put`, and a file is read only for someone who
141
+ can read a message it is attached to.
142
+ - **Files from synced platforms go there too**, and a message going out to
143
+ one is sent its files from there.
144
+
145
+ The board remembers the store's `name`. A process that opens the board with
146
+ no store, or another one, is refused files with `files_elsewhere`, instead
147
+ of storing them where the board never looks. Only `mu serve` and
148
+ `mu daemon` load the module, so with a store, attach and download through
149
+ the server: set `MUSTER_URL` and `MUSTER_TOKEN`. Files stored in the folder
150
+ before the store are still read from it.
151
+
152
+ To move to another store, copy the files across, then give the new one
153
+ `replaces: '<old name>'` once. To move back to the folder, copy them into
154
+ it and give `files: backToDisk('<old name>')` once.
155
+
156
+ `mu backup` copies the board's file and its `.files` folder. Files in a
157
+ store stay there: back the store up with what it provides.
158
+
27
159
  ## What a delete leaves on disk
28
160
 
29
161
  Deleting a message takes it out of every read: `mu read`, search, the feed
@@ -33,8 +165,9 @@ take the bytes off the disk:
33
165
  - **The log keeps the event as it was written.** The board's tables are
34
166
  rebuilt from the log, so the log is never changed. The text of a deleted
35
167
  message is still in the board's file, for whoever can open that file.
36
- - **A deleted message's files stay** in the `.files` folder beside the board:
37
- a file is stored once, by what it holds, and another message may carry it.
168
+ - **A deleted message's files stay** in the `.files` folder beside the board,
169
+ or in its store:
170
+ a file is stored once, by what it holds, and another message may have it attached.
38
171
  - **What a synced platform sent is not kept twice.** Once a webhook's content
39
172
  is on the board, the board keeps only that it took that delivery.
40
173
  - **An agent's run log** is kept for 30 days under `runs` in the config
@@ -142,6 +142,26 @@ on thread 812; it doesn't run anything itself, and it returns at once.
142
142
  `{thread}` and `{channel}` work too. A title is one line, defused, at most
143
143
  72 characters, and never part of the task's text: no agent reads it.
144
144
  `"title": "{on.title}"`.
145
+ - **A step's `refs` names the issues its pull request refers to.** The
146
+ pull request a task opens ends its body with `Refs ENG-123`, which
147
+ Linear's GitHub integration reads as a link to the issue that doesn't
148
+ close it. `{thread.ref}` is the asking thread's `ref` label as sync made
149
+ the thread: a Linear issue's key. Like a title, `refs` is filled when the
150
+ daemon makes the task, recorded on it as `workflow.refs`, and never part
151
+ of its text; a label set since counts for nothing. Once filled it must be
152
+ 1 to 5 keys, separated by commas or spaces, each an upper case letter, up
153
+ to 9 more letters or digits, a hyphen and up to 7 digits (`ENG-123`).
154
+ Anything else, one bad key included, gives no `Refs` line at all, and so
155
+ does a later round, whose description is a comment. `"refs":
156
+ "{thread.ref}"`.
157
+ - **Only sync gives `{thread.ref}`.** Anyone can post a message with a `ref`
158
+ label, so it is read from the board's record of the thread's first
159
+ message, and only when sync wrote that message: a thread posted on the
160
+ board gives none. A person who files a Linear issue by hand gets the key
161
+ Linear gave it, which is the one issue that thread is about. The worst a
162
+ filled value can do is link up to 5 issues, never close one: the line
163
+ says `Refs`, and the key a workflow names is checked again before it is
164
+ posted.
145
165
  - **`{steps.<key>.result}` is an earlier step's result,** quoted into the
146
166
  task as `{thread.text}` is: the same line (`The result of step "plan", #43,
147
167
  quoted as written: …`), fence, defusing and cap. A step may name only a
@@ -10,7 +10,9 @@ A board module is a TypeScript file whose default export, or `team`, is a
10
10
 
11
11
  - `watch`: [watchers](./09-watchers.md), what to listen for and what to do;
12
12
  - `sync`: [GitHub, Linear, Slack and Notion](../02-sync/01-overview.md);
13
- - `hooks`: [outgoing webhooks](./15-outgoing-webhooks.md).
13
+ - `hooks`: [outgoing webhooks](./15-outgoing-webhooks.md);
14
+ - `serve`: how it is served, such as [`authenticate`](./11-access.md#sign-in-through-your-own-code), who a request with no token is from;
15
+ - `files`: [where its files are kept](./12-files-and-data.md#keep-files-somewhere-else), when not beside it.
14
16
 
15
17
  ```ts board.ts
16
18
  import { board, command, env, github } from '@openmuster/muster'
@@ -15,7 +15,7 @@ mu --version
15
15
  ```
16
16
 
17
17
  That is the latest release, and `mu --version` says which one you have. To
18
- pin a version, name it: `npm install -g @openmuster/muster@0.3.1-alpha.5`.
18
+ pin a version, name it: `npm install -g @openmuster/muster@0.3.1-alpha.7`.
19
19
  Every release is also a tarball on GitHub, which npm installs from its URL:
20
20
  `https://github.com/openmuster/muster/releases/latest/download/muster.tgz`.
21
21
 
@@ -176,6 +176,11 @@ than five minutes is refused however well it is signed.
176
176
  - A thread posted in a mapped board channel is posted to the Slack channel,
177
177
  and later replies go into its thread.
178
178
  - An edit or a delete of a delivered message updates or removes it.
179
+ - Text that came from another platform, such as a GitHub comment in a
180
+ channel that Slack also mirrors, can't notify a whole channel or group.
181
+ `<!channel>`, `<!here>`, `<!everyone>` and `<!subteam^...>` in it are posted
182
+ with an invisible word joiner after the `<`, so they read the same and ping
183
+ nobody. What is written on the board is posted as it is.
179
184
 
180
185
  Messages from the app's own bot, named by `bot`, are not imported back.
181
186
 
@@ -195,6 +195,53 @@ Without `--push`, `mu run` uses a GitHub App that is set to clone a private
195
195
  repository, the same way, and pushes nothing. A public repository the App
196
196
  isn't installed on is cloned without it.
197
197
 
198
+ ### Let the agent describe the pull request
199
+
200
+ The pull request's body is one line from muster: the task, the profile and
201
+ the runner. To say more, have the agent write a description to
202
+ `/tmp/mu-pull-request-<id>.md` in its sandbox, where `<id>` is its task's
203
+ number. The file is outside the checkout, so it is never committed. Tell the
204
+ agent what to put there in the task or the prompt: what changed, how it was
205
+ checked. With no such file, or an empty one, the body is muster's line
206
+ alone.
207
+
208
+ `mu run` reads the file once the agent is done, up to 256 KB; a bigger one
209
+ isn't read. Then it removes the file, so a later round starts with none. It posts the description under muster's line, made inert first:
210
+
211
+ - no character reference (`&#64;`) is read, and an `@` mentions nobody;
212
+ - every `[` and `]` is made fullwidth, so no link, image, link definition or
213
+ footnote forms, and no HTML or bare address renders;
214
+ - an image on any other host is replaced by its alt text, so GitHub fetches
215
+ nothing the agent chose;
216
+ - `#123`, `owner/repo#123`, `GH-123` and the address of an issue or pull
217
+ request refer to nothing, so a closing keyword (`Fixes #12`) closes
218
+ nothing;
219
+ - an issue key such as `ENG-123`, a letter, more letters or digits, a
220
+ hyphen and a number, in any case, gets a non-breaking hyphen (U+2011)
221
+ that looks the same, so Linear's GitHub integration links nothing, and
222
+ `Fixes ENG-123` closes nothing on merge; text of the same shape, such as
223
+ `node-22`, gets it too, so code copied from the description may need its
224
+ hyphen typed again;
225
+ - it is cut at 20,000 characters.
226
+
227
+ The one image that renders is a relative path to a file in the pushed
228
+ commit, such as `![the inbox](docs/inbox.png)`. `mu run` rewrites it to that
229
+ file's address, pinned to the commit. GitHub shows it to anyone who can read
230
+ the repository. A path that isn't in the commit, or climbs out of the
231
+ repository, stays as text, and at most 20 are shown. A shown image's path
232
+ and alt text keep letters, digits, spaces and `. - _` alone, up to 200 and
233
+ 100 characters, and name no issue key either. The pull request's title and
234
+ commit message name no issue key in the same way.
235
+
236
+ In the round that opens the pull request, the description follows muster's
237
+ line in the body. When the task's workflow step has `refs`, the body ends
238
+ with a line such as `Refs ENG-123`, added after the description is made
239
+ inert, so that key alone links: see
240
+ [Workflows](../01-concepts/16-workflows.md#asking-for-a-run). In a later round, it is a comment on the pull request:
241
+ the body, and anything a person wrote in it, stays as it is. A comment
242
+ GitHub refuses doesn't fail the run: the change is pushed, and `mu run`
243
+ prints a warning and replies on the task with `comment_failed`.
244
+
198
245
  ### Another round on the same pull request
199
246
 
200
247
  A task run again after it pushed, reopened with `mu tasks reopen 12 --round`
@@ -66,9 +66,9 @@ How the served tool behaves:
66
66
  - **Give an agent a token held to its own profile.** A token not
67
67
  [held to a profile](../01-concepts/11-access.md#tokens) writes as the
68
68
  profile in an `x-muster-profile` header, or as its owner without one.
69
- - **A request holds one message, and the response answers it.** There is no
70
- stream: the tool never pushes, and a `wait` returns within 50s like any
71
- call.
69
+ - **A request holds one message, and the response answers it.** The answer
70
+ is JSON, or server-sent events when it streams: an event subscription or
71
+ task updates. See [MCP](../04-reference/03-http.md#mcp).
72
72
  - **Only tokens work.** muster doesn't support OAuth sign-in, which some
73
73
  clients offer for remote servers: paste the token into the client's header
74
74
  setting.
@@ -105,10 +105,44 @@ The tool reads and writes the board, and nothing else on the machine:
105
105
  | `--dir`, `--url`, `--board`, `--as` | Whoever starts the server sets which board, and the name to write under |
106
106
  | Anything after `--` | It is a command line for your machine |
107
107
  | `token`, `budget`, `backup`, `skills`, `download` | The owner's, or they write files |
108
- | `tail` | It streams; use `wait` |
108
+ | `tail` | It streams; use `wait`, or the events extension below |
109
109
 
110
- A `wait` with no `--timeout` gets 50s, so a tool call always returns. The
111
- agent waits again if it needs to.
110
+ A tool call returns within 50s. A `wait` with no `--timeout`, or a longer
111
+ one, gets 50s, and a claim or an inbox read with a longer `--wait` is held to
112
+ 50s. The agent waits again if it needs to.
113
+
114
+ When the client gives up on a call, by cancelling it or closing the
115
+ connection, the command stops. A claim that hadn't taken a task yet takes
116
+ nothing, so no task is left held for an agent that stopped listening.
117
+
118
+ ## Wait without holding a call open
119
+
120
+ A client that speaks MCP revision 2026-07-28 can use two extensions, which
121
+ `server/discover` lists:
122
+
123
+ - **Tasks** (`io.modelcontextprotocol/tasks`): a `wait`, or a claim or inbox
124
+ read with `--wait`, answers at once with a task ID. The command runs on for
125
+ the whole wait it asked for, past 50s. The client reads the result with
126
+ `tasks/get`, has it pushed with `subscriptions/listen`, or stops it with
127
+ `tasks/cancel`.
128
+ - **Events** (`io.modelcontextprotocol/events`): the board's event log, the
129
+ one `mu tail` reads, with the same filters. The client polls with
130
+ `events/poll` from a cursor, or keeps `events/stream` open and gets each
131
+ event as it is written.
132
+
133
+ A claim made inside a task stays with the agent only once the client has the
134
+ result. If the client cancels the task first, or the task expires after 24
135
+ hours, or the server stops, the claim is released and the task is ready again.
136
+
137
+ Tasks live in the memory of the process that runs them. Restarting `mu mcp`
138
+ or `mu serve` forgets them, and a client that asks about one is told it
139
+ doesn't exist. A task belongs to the token and profile that started it, and
140
+ to any other caller it doesn't exist either.
141
+
142
+ Events are offered for polling and streaming, not webhook delivery:
143
+ [outgoing webhooks](../01-concepts/15-outgoing-webhooks.md), declared in a
144
+ [board module](../01-concepts/17-board-module.md), do that. A client of an
145
+ earlier revision gets the tool as before, without either extension.
112
146
 
113
147
  ## Check it works
114
148
 
@@ -121,7 +155,10 @@ mu read general
121
155
  ```
122
156
 
123
157
  > [!NOTE]
124
- > Only Claude Code has been tried as a client.
158
+ > Claude Code has been tried as a client, and so has the official MCP
159
+ > TypeScript client (`@modelcontextprotocol/client` 2.4.0) in both protocol
160
+ > eras, with its tasks extension (`@modelcontextprotocol/ext-tasks` 0.2.3).
161
+ > No client of the events extension has been tried yet.
125
162
 
126
163
  ## When not to use MCP
127
164
 
@@ -49,6 +49,8 @@ flowchart LR
49
49
  - `edited`: its author changed the report
50
50
  - `queued`: its change, or its next round, waits for a run to end, under a
51
51
  cap on runs
52
+ - `waiting-on`: its change waits for the Linear issues blocking it to be
53
+ done
52
54
  - **Each source has its own channel.** The channels are under `cards/`:
53
55
  `cards/slack`, `cards/linear`, `cards/github`, `cards/notion`,
54
56
  `cards/app`. A card's runs are in channels under the card's own, so the
@@ -161,6 +163,46 @@ The mapping is `SOURCES` in `board.ts`, by sync key. To replace an entry, set
161
163
  export LOOP_STAGES='{"nt":{"type":"notion","token":"NOTION_TOKEN","stages":{"inbox":"backlog","go":"ready"},"write":{"working":"doing","done":"shipped"}}}'
162
164
  ```
163
165
 
166
+ ## Wait for the issues a card depends on
167
+
168
+ A card from Linear waits while an issue blocking it isn't done. The loop
169
+ reads the card's "blocked by" relations through Linear's API, with the same
170
+ credentials it writes statuses with, when the card's change is about to
171
+ start. With no Linear credentials, the loop reads nothing and nothing waits.
172
+
173
+ When a blocker is done:
174
+
175
+ - **Canceled or Duplicate:** always done.
176
+ - **An issue whose card's work has a pull request:** done once that pull
177
+ request is merged into the default branch, whatever Linear says. The loop
178
+ writes Done when the review approves, before anyone merges, so Linear's
179
+ Done isn't enough here. The loop reads the pull requests from the work's
180
+ branch on GitHub with the GitHub App the workers push with, and the card
181
+ says why it still waits: the pull request is open, was closed without
182
+ merging, or was merged into another branch.
183
+ - **Any other issue:** done when Linear says it is Done. This covers an
184
+ issue on a team the board doesn't sync, a card whose run changed nothing,
185
+ and an issue someone finished by hand.
186
+
187
+ How a card waits:
188
+
189
+ - **It is held `waiting-on`, and says once which issues it waits on.** The
190
+ line names each issue by its identifier and why it waits. When some of
191
+ them are done, the card names the ones left, once.
192
+ - **Only the start waits.** The triage runs as before, so the spec is on the
193
+ card when the blockers are done. A card already `working` goes on, and its
194
+ rounds start as before.
195
+ - **The loop checks again on 3 occasions.** When any run of the loop ends,
196
+ when a card's Linear status changes, and every 10 minutes from one
197
+ schedule in `loop/recheck`, which no sync maps. The schedule finds what
198
+ sends the board nothing: an issue on another team, a relation removed in
199
+ Linear, a board that was down. The loop makes the schedule when the first
200
+ card waits, and cancels it once none do.
201
+ - **Two issues blocking each other both wait.** Each card says the other
202
+ waits on it too: remove one of the 2 relations in Linear.
203
+ - **A blocked card moves like a parked one.** Move its issue to Backlog and
204
+ it is parked; back to Todo, and the loop triages it again.
205
+
164
206
  ## Plan a card with an agent
165
207
 
166
208
  A card in planning gets an agent that shapes it with the people who asked,
@@ -228,6 +270,55 @@ A round's reply on the card says which comments it took; comments too long
228
270
  for one round wait for the next. A card that is done comes back the same
229
271
  way: a trusted reply reopens it, and its status is In progress again.
230
272
 
273
+ ## Screenshots in pull requests
274
+
275
+ A pull request can show a round's screenshots, in a private repository too,
276
+ with no bucket, storage account or extra secret. The images are files
277
+ committed with the change: they live in the repository, and whoever can read
278
+ it can see them. The loop's workflows don't say which screenshots to take.
279
+ The project's own spec does, in `AGENTS.md` or `SPEC.md` in its repository.
280
+
281
+ Tell the agents there:
282
+
283
+ - **Where to save them:** a folder in the repository, such as
284
+ `docs/screenshots/card-<card>/`. They are committed, so they are merged
285
+ with the change. Pick a path you are happy to keep, or prune it after the
286
+ merge.
287
+ - **To attach each one to the work task too:** with
288
+ `mu reply <task> "<what it shows>" --attach <file>`. The loop copies them
289
+ onto the card, and from there to its mirrors in Slack and Linear.
290
+ - **To link them from the description:** in
291
+ `/tmp/mu-pull-request-<task>.md`, by relative path, such as
292
+ `![inbox dark](docs/screenshots/card-12/inbox-dark.png)`. muster rewrites
293
+ each to the file's address, pinned to the pushed commit, so it renders in
294
+ the pull request. At most 20 are shown, and each part of a path keeps
295
+ letters, digits, spaces and `. - _` alone. The rules are in
296
+ [Let the agent describe the pull request](./06-sandboxed-agents.md#let-the-agent-describe-the-pull-request).
297
+ - **Which themes:** light and dark, if you want both.
298
+
299
+ The review step checks them. It downloads the images the work task
300
+ attached that round, and the ones the change commits, and looks at each. It
301
+ compares them with the spec and the project's spec: the screenshots asked
302
+ for are there, they show the change, and light and dark are both there when
303
+ asked for. A missing or wrong screenshot is something to change, not an
304
+ approve. When the project's spec asks for none, the work takes none and the
305
+ review skips this.
306
+
307
+ For example, in the project's spec:
308
+
309
+ ```markdown AGENTS.md
310
+ ## Screenshots
311
+
312
+ Every pull request that changes the UI includes screenshots of the screens
313
+ it touches, in light and dark. `pnpm demo` runs the app with sample data.
314
+
315
+ - Save them in `docs/screenshots/card-<card>/`, one PNG per screen and
316
+ theme, named like `inbox-dark.png`.
317
+ - Attach each to your task: `mu reply <task> "<what it shows>" --attach <file>`.
318
+ - Link each from the pull request's description by its relative path:
319
+ `![inbox dark](docs/screenshots/card-12/inbox-dark.png)`.
320
+ ```
321
+
231
322
  ## Run several repositories on one board
232
323
 
233
324
  Each repository is a project. A project's cards are in its own channel,
@@ -326,6 +417,9 @@ once on the card, and starts when a run ends, oldest card first:
326
417
  - **A change, or a round, that waits is held `queued`.** Your comments wait
327
418
  with it, and the round takes them when it starts.
328
419
  - **A planning round that waits stays in `planning`.**
420
+ - **A card both blocked and past a cap is held `waiting-on` first.** It
421
+ names its blockers, and only once they are done waits for a place, held
422
+ `queued`.
329
423
  - **A task you answered while every place is taken is held `queued` too.** It
330
424
  goes on before any card when a run ends.
331
425
 
@@ -353,7 +447,11 @@ What shows up as a card runs:
353
447
  approval, a task blocked on a decision, or a round that is done. A line
354
448
  about a project's card starts with the project's name:
355
449
  `acme: card #12 needs your approval`.
356
- - **The pull request:** one per card, with a commit per round.
450
+ - **The pull request:** one per card, with a commit per round. The work
451
+ agent writes its description: what changed, how it was checked, and the
452
+ screenshots the way the project's spec asks for them. A later round's
453
+ description is a comment on it. See
454
+ [Let the agent describe the pull request](./06-sandboxed-agents.md#let-the-agent-describe-the-pull-request).
357
455
 
358
456
  ## When not to use the loop
359
457
 
@@ -382,6 +480,21 @@ Symptoms, causes and fixes:
382
480
  whose agent stopped (out of time, a usage limit) the same way, and its
383
481
  summary says so.
384
482
 
483
+ - **A card says `waiting: its blockers couldn't be read from Linear
484
+ (linear_read_failed)`.** Linear refused or didn't answer the loop's read of
485
+ its relations within 15 seconds, or the issue has more than 500 relations,
486
+ more than the loop reads. The card is held `waiting-on`, and the loop tries
487
+ again every 10 minutes. Check the Linear credentials in `SOURCES` can read
488
+ the team's issues.
489
+ - **A card waits on an issue that is Done.** That issue's pull request isn't
490
+ merged into the default branch yet, as the card says. Merge it: the card
491
+ starts within 10 minutes, or when the next run ends.
492
+ - **A card says `waiting: its blockers couldn't be read from GitHub`.** The
493
+ code says why: `github_app_missing` (no `GITHUB_APP_ID` and key where the
494
+ board runs), `github_app_not_installed`, `github_app_failed`, or
495
+ `github_read_failed` (the App lacks Pull requests: read, or GitHub didn't
496
+ answer). See [Errors](../04-reference/05-errors.md).
497
+
385
498
  ## Related guides
386
499
 
387
500
  Where to go next: