@openmuster/muster 0.3.1-alpha.4 → 0.3.1-alpha.6

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 (58) hide show
  1. package/README.md +11 -7
  2. package/dist/{args-9ZZDcPxa.js → args-CaFBa2IP.js} +305 -23
  3. package/dist/cli.js +3 -3
  4. package/dist/index.d.ts +98 -19
  5. package/dist/index.js +107 -42
  6. package/dist/inspect/app.js +49 -26
  7. package/dist/{main-Doit2DDY.js → main-3kE64MlN.js} +195 -12
  8. package/dist/main-o4m_lGDG.js +6 -0
  9. package/dist/mcp-D6Xt2ixk.js +6 -0
  10. package/dist/{module-DjDMSEKu.js → module-BX2IjSiv.js} +2 -2
  11. package/dist/{module-D8qcE3e7.js → module-D9KdbEpS.js} +1 -1
  12. package/dist/skills/board/SKILL.md +5 -0
  13. package/dist/skills/loop-card/SKILL.md +22 -3
  14. package/dist/{steps-BUPRIOe3.js → steps-cnWo2Wvx.js} +299 -12
  15. package/docs/01-concepts/09-watchers.md +4 -32
  16. package/docs/01-concepts/10-schedules.md +1 -1
  17. package/docs/01-concepts/11-access.md +19 -3
  18. package/docs/01-concepts/13-budgets.md +66 -3
  19. package/docs/01-concepts/15-outgoing-webhooks.md +6 -19
  20. package/docs/01-concepts/16-workflows.md +42 -2
  21. package/docs/01-quickstart.md +74 -45
  22. package/docs/02-sync/01-overview.md +34 -2
  23. package/docs/02-sync/02-github.md +40 -19
  24. package/docs/02-sync/03-linear.md +103 -85
  25. package/docs/02-sync/04-slack.md +116 -111
  26. package/docs/02-sync/05-notion.md +46 -25
  27. package/docs/03-guides/01-coding-agents.md +51 -33
  28. package/docs/03-guides/02-swarm.md +30 -15
  29. package/docs/03-guides/03-factory.md +193 -80
  30. package/docs/03-guides/04-inspector.md +73 -42
  31. package/docs/03-guides/05-running-agents.md +62 -35
  32. package/docs/03-guides/06-sandboxed-agents.md +535 -305
  33. package/docs/03-guides/07-build-a-ui.md +86 -31
  34. package/docs/03-guides/08-ci.md +59 -36
  35. package/docs/03-guides/09-daemon.md +121 -53
  36. package/docs/03-guides/10-two-agents.md +31 -22
  37. package/docs/03-guides/11-person-in-the-loop.md +47 -34
  38. package/docs/03-guides/12-unattended.md +46 -27
  39. package/docs/03-guides/13-terminals.md +51 -39
  40. package/docs/03-guides/14-no-cloud.md +31 -19
  41. package/docs/03-guides/15-several-boards.md +61 -27
  42. package/docs/03-guides/16-non-code.md +29 -18
  43. package/docs/03-guides/17-mcp.md +37 -30
  44. package/docs/03-guides/18-a-board-on-a-server.md +66 -43
  45. package/docs/03-guides/19-a-card-queue.md +210 -121
  46. package/docs/03-guides/20-a-feedback-loop.md +412 -135
  47. package/docs/03-guides/21-running-the-loop.md +94 -64
  48. package/docs/03-guides/22-building-from-linear.md +100 -63
  49. package/docs/04-reference/01-cli.md +7 -0
  50. package/docs/04-reference/02-handle.md +11 -15
  51. package/docs/04-reference/03-http.md +1 -1
  52. package/docs/04-reference/04-events.md +2 -1
  53. package/docs/04-reference/05-errors.md +6 -0
  54. package/docs/04-reference/08-files.md +49 -0
  55. package/docs/index.md +1 -0
  56. package/package.json +1 -1
  57. package/dist/main-D5aX7Jaj.js +0 -6
  58. package/dist/mcp-Cm96TIb3.js +0 -6
@@ -1,24 +1,26 @@
1
1
  ---
2
2
  title: A feedback loop
3
- description: For steering a project from reports in Slack, Linear, GitHub, Notion or your app. Each report is triaged into a spec, an agent opens a pull request, and a trusted reply starts another round on the same pull request.
3
+ description: For steering a project from reports in Slack, Linear, GitHub, Notion or your app. You end with a loop that triages each report into a spec, has an agent open a pull request, and starts another round on that pull request from a trusted reply.
4
4
  ---
5
5
 
6
6
  ## Who this is for
7
7
 
8
8
  You build something with agents and want to steer it from wherever you are:
9
- a report in Slack, a Linear issue, a Notion page, a button in the app itself. Each report
10
- should become a card with a proper title and spec, the change should come
11
- back as a pull request with screenshots, and a reply on the card should send
12
- it round again, on the same pull request, until it is right.
9
+ a report in Slack, a Linear issue, a Notion page, a button in the app
10
+ itself. Each report should become a card with a proper title and spec. The
11
+ change should come back as a pull request with screenshots. A reply on the
12
+ card should start another round, on the same pull request, until it is
13
+ right.
13
14
 
14
15
  **You need:** what [A card queue](./19-a-card-queue.md) needs (muster where
15
16
  the board is, `mu serve` behind a tunnel or a proxy, a Vercel project for the
16
17
  sandboxes, a GitHub App on the repository, a model key), and the keys for
17
18
  the sources you sync.
18
19
 
19
- ## The parts
20
+ ## How it fits together
20
21
 
21
- `templates/loop` is a board module and a workflow file:
22
+ `templates/loop` is a [board module](../01-concepts/17-board-module.md) and a
23
+ workflow file:
22
24
 
23
25
  ```mermaid
24
26
  flowchart LR
@@ -31,58 +33,89 @@ flowchart LR
31
33
  C -->|a trusted reply| W
32
34
  ```
33
35
 
34
- - **A card is a thread and a task.** Its hold says where it is: `backlog`
35
- while it is parked, `planning` while an agent shapes it with you, `triage`, `approval`, `working`,
36
- `declined` when the triage made no card, `done` when its run was approved
37
- but it couldn't be completed, or `edited` when its author changed the
38
- report.
39
- - **Each source has its own channel** under `cards/`: `cards/slack`,
40
- `cards/linear`, `cards/github`, `cards/notion`, `cards/app`. A card's runs are in channels
41
- under its own, so the card is what Slack and Linear mirror.
36
+ - **A card is a thread and a task.** Its
37
+ [hold](../01-concepts/08-tasks.md#states) (the kind of block on its task)
38
+ says where it is:
39
+ - `backlog`: [parked](../01-concepts/08-tasks.md#parking-work-for-later),
40
+ and nothing runs until it is moved to ready
41
+ - `planning`: an agent shapes it with you
42
+ - `triage`: an agent is turning the report into a spec
43
+ - `approval`: the spec is on the card, and the report's author isn't
44
+ trusted
45
+ - `working`: the `card` workflow is making the change, as a pull request
46
+ - `duplicate`: the triage found the same request on another card
47
+ - `declined`: the triage made no card
48
+ - `done`: its run was approved but it couldn't be completed
49
+ - `edited`: its author changed the report
50
+ - `queued`: its change, or its next round, waits for a run to end, under a
51
+ cap on runs
52
+ - `waiting-on`: its change waits for the Linear issues blocking it to be
53
+ done
54
+ - **Each source has its own channel.** The channels are under `cards/`:
55
+ `cards/slack`, `cards/linear`, `cards/github`, `cards/notion`,
56
+ `cards/app`. A card's runs are in channels under the card's own, so the
57
+ card is what Slack and Linear mirror.
42
58
  - **The triage agent writes the card.** It reads the report and the
43
59
  repository, changes nothing, and completes with a title on the first line,
44
60
  then what to change and how to check it. The spec goes on the card as a
45
61
  reply, written as `triage`, only when the triage run's own worker completed
46
62
  it.
47
- - **The card run quotes that reply** with `{on.text}`, fenced as content,
48
- not instructions. The triage step alone reads the report.
63
+ - **The card run quotes that reply.** It quotes it with `{on.text}`, fenced
64
+ as content, not instructions. Only the triage step reads the report.
49
65
 
50
66
  ## Set it up
51
67
 
68
+ Copy the workflows, set who is trusted, and start the board with the loop's
69
+ module:
70
+
52
71
  ```bash
53
72
  cp templates/loop/workflows.json ~/.config/muster/
54
73
  export LOOP_TRUSTED=slack:user:U0123,lin:user:3f2a9c1e-4b7d-4e0a-9a51-7c2d8e6b1f03
55
74
  mu serve --module "$PWD/templates/loop/board.ts" --allow-host board.example.com
56
75
  ```
57
76
 
77
+ Replace the IDs in `LOOP_TRUSTED` with your own:
78
+ [Who may start work](#who-may-start-work) says how to write one.
79
+
58
80
  Edit `board.ts` for your Slack channel's ID, your Linear team's key and your
59
81
  repository, and `workflows.json` for your repository. Put the settings in the
60
- environment `mu serve` starts with, as for [a card queue](./19-a-card-queue.md#set-it-up),
61
- with the secrets `board.ts` names in `env()`.
82
+ environment `mu serve` starts with, as for
83
+ [a card queue](./19-a-card-queue.md#set-it-up), with the secrets `board.ts`
84
+ names in `env()`.
85
+
86
+ For more than one repository, set this up once and add each repository as a
87
+ project:
88
+ [Run several repositories on one board](#run-several-repositories-on-one-board).
62
89
 
63
90
  ## Who may start work
64
91
 
65
- `LOOP_TRUSTED` is a comma-separated list of actor IDs: a Slack user is
66
- `<sync key>:user:<their ID>`, an app posting with a token you made is
67
- `<your principal>+<its profile>`. You, as yourself with no profile, always
68
- are. Read it each time a card moves, so a change takes effect at once.
69
-
70
- - **A trusted author's report** is worked as soon as it is triaged, as long
71
- as it is as they first wrote it.
72
- - **Anyone else's** waits, held `approval`, and you are told. Someone trusted
73
- labels it `approved=yes` (`mu label 12 approved=yes`, or in the inspector).
74
- A label by anyone else does nothing.
75
- - **An author sync couldn't name** is never trusted, nor a GitHub author:
76
- GitHub's sync names one by login, which can change hands, so a GitHub
77
- issue always waits for an approval.
78
- - **The work never reads the report.** The card run quotes the spec that was
79
- triaged (and approved, where it had to be) with `{on.text}`, never the
80
- report itself.
92
+ `LOOP_TRUSTED` is a comma-separated list of actor IDs. A Slack user is
93
+ `<sync key>:user:<their ID>`. An app posting with a token you made is
94
+ `<your principal>+<its profile>`
95
+ ([principals and profiles](../01-concepts/06-actors.md#principals-and-profiles)).
96
+ You, as yourself with no profile, are always trusted. The loop reads the
97
+ list each time a card moves, so a change takes effect at once.
98
+
99
+ How the loop uses it:
100
+
101
+ - **A trusted author's report needs no approval.** Its work starts as soon
102
+ as the triage writes the spec, as long as the report is as they first
103
+ wrote it.
104
+ - **Anyone else's report waits.** The card is held `approval`, and the loop
105
+ tells you. Someone trusted labels it `approved=yes`
106
+ (`mu label 12 approved=yes`, or in the [inspector](./04-inspector.md)). A
107
+ label by anyone else does nothing.
108
+ - **An author the sync couldn't name is never trusted.** Nor is a GitHub
109
+ author: GitHub's sync names one by login, which can change hands, so a
110
+ GitHub issue always waits for an approval.
111
+ - **The work never reads the report.** The card run quotes the spec the
112
+ triage wrote (and someone approved, where it had to be) with `{on.text}`,
113
+ never the report itself.
81
114
 
82
115
  ## Stages
83
116
 
84
- A card starts where its source says. Only a ready card is triaged; a parked
85
- one waits, and nothing runs for it.
117
+ A card starts where its source says. The loop triages only a ready card; a
118
+ parked one waits, and nothing runs for it. The stages, by source:
86
119
 
87
120
  | Stage | Notion Status | Linear state | Anywhere else: `stage` label | The card |
88
121
  | --- | --- | --- | --- | --- |
@@ -93,134 +126,378 @@ one waits, and nothing runs for it.
93
126
  | done | Done, written by the loop | Done, written by the loop | | completed |
94
127
  | canceled | | Canceled, Duplicate | | canceled |
95
128
 
129
+ How the stages behave:
130
+
96
131
  - **The source's status moves the card.** Move a Notion page to Ready, or a
97
- Linear issue to Todo, and its card is triaged. Move it back to Not started
98
- or Backlog and it is parked again, unless a run is going: then it stays
99
- `working`, and the card says so.
100
- - **Only the source's own sync moves it.** A card's source is read from how
101
- the board recorded its first message, never from a label. A `state` label
102
- anyone else sets moves nothing, and is never read later.
103
- - **Sources without a status** (Slack, GitHub, your app, the inspector) are
104
- ready when they come in. Someone trusted parks one with
105
- `mu label 12 stage=backlog`, and starts it with `stage=ready`. Anyone
106
- else's `stage` label does nothing.
107
- - **A status the loop doesn't know** parks the card.
108
- - **The loop writes the status back:** In progress when the work starts, and
109
- Done when the review completes with `approve`, which also completes the
110
- card. A write that fails is said on the card, as `loop`, and the card goes
111
- on. Notion's integration needs the "Update content" capability for it.
112
- Linear's status is written by the same OAuth app its sync comments as
113
- (`LINEAR_CLIENT_ID`, `LINEAR_CLIENT_SECRET`), even when a `LINEAR_API_KEY`
114
- is also set; with no app, by that key. The loop asks for the app's token
115
- with its sync's scopes: Linear ends an app's earlier tokens when one is
116
- asked for with other scopes, the sync's among them. A sync given its own
117
- `scopes` needs the same `scopes` in its `SOURCES` entry.
118
- - **A parked card that is edited** stays parked, and is triaged from its new
119
- text when it is moved to ready.
120
-
121
- The mapping is `SOURCES` in `board.ts`, by sync key. `LOOP_STAGES` replaces
122
- an entry with JSON in the same shape:
132
+ Linear issue to Todo, and the loop triages its card. Move it back to Not
133
+ started or Backlog and the loop parks it again, unless a run is going:
134
+ then it stays `working`, and the card says so.
135
+ - **Only the source's own sync moves it.** The loop reads a card's source
136
+ from how the board recorded its first message, never from a label. A
137
+ `state` label anyone else sets moves nothing, and is never read later.
138
+ - **Cards from sources without a status are ready when they come in.** These
139
+ sources are Slack, GitHub, your app and the inspector. Someone trusted
140
+ parks one with `mu label 12 stage=backlog`, and starts it with
141
+ `stage=ready`. Anyone else's `stage` label does nothing.
142
+ - **A status the loop doesn't know parks the card.**
143
+ - **The loop writes the status back.** It writes In progress when the work
144
+ starts, and Done when the review completes with `approve`, which also
145
+ completes the card. When a write fails, the loop says so on the card, as
146
+ `loop`, and the card goes on. Notion's integration needs the "Update
147
+ content" capability for it.
148
+ - **The loop writes Linear's status as the sync's OAuth app.** That is the
149
+ app the sync comments as (`LINEAR_CLIENT_ID`, `LINEAR_CLIENT_SECRET`), even
150
+ when a `LINEAR_API_KEY` is also set. With no app, the loop writes it with
151
+ that key.
152
+ - **A sync given its own `scopes` needs the same `scopes` in its `SOURCES`
153
+ entry.** The loop asks for the app's token with its sync's scopes. Linear
154
+ revokes an app's earlier tokens, the sync's among them, when one is asked
155
+ for with other scopes.
156
+ - **A parked card that is edited stays parked.** When it is moved to ready,
157
+ the loop triages it from its new text.
158
+
159
+ The mapping is `SOURCES` in `board.ts`, by sync key. To replace an entry, set
160
+ `LOOP_STAGES` to JSON in the same shape:
123
161
 
124
162
  ```bash
125
163
  export LOOP_STAGES='{"nt":{"type":"notion","token":"NOTION_TOKEN","stages":{"inbox":"backlog","go":"ready"},"write":{"working":"doing","done":"shipped"}}}'
126
164
  ```
127
165
 
128
- ## Planning
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
+
206
+ ## Plan a card with an agent
129
207
 
130
208
  A card in planning gets an agent that shapes it with the people who asked,
131
- before anything is built: the `planning` workflow, one step that reads the
132
- report and the repository and changes nothing.
133
-
134
- - **It answers on the card,** as `planner`: its questions, numbered, then the
135
- card as it stands (a title, what to change, how to check it), and how it
136
- would split a change too big for one pull request.
137
- - **Each trusted reply is its next round,** on the same task: the comments go
138
- to it, fenced as content, and it answers again. Replies made while it
139
- works wait for its answer. Anyone else's replies aren't shown to it.
140
- - **Move it to ready** (Ready, Todo, or `stage=ready`) when the card is
141
- right. The triage writes the spec from the newest plan and what was said
142
- on the card since it, and what was said in planning starts no round of the
143
- work.
144
- - **Edit the report** in planning and a new planner starts from the new
145
- text; the old plan is not shown to the triage.
146
- - One planner per card. Moved back to planning later, it goes on when
147
- someone replies.
209
+ before anything is built. This is the `planning` workflow: one step that
210
+ reads the report and the repository and changes nothing. How planning
211
+ works:
212
+
213
+ - **It answers on the card, as `planner`.** The answer gives its questions,
214
+ numbered, then the card as it stands (a title, what to change, how to
215
+ check it). It also says how it would split a change too big for one pull
216
+ request.
217
+ - **Each trusted reply is its next round, on the same task.** The loop sends
218
+ it the comments, fenced as content, and it answers again. Replies made
219
+ while it works wait for its answer. Anyone else's replies aren't shown to
220
+ it.
221
+ - **Move it to ready when the card is right.** Use Ready, Todo, or
222
+ `stage=ready`. The triage writes the spec from the newest plan and what was
223
+ said on the card since it. What was said in planning starts no round of
224
+ the work.
225
+ - **Editing the report in planning starts a new planner.** It starts from
226
+ the new text, and the triage never sees the old plan.
227
+ - **Each card has one planner.** When the card moves back to planning later,
228
+ its planner goes on when someone replies.
148
229
 
149
230
  ## Related and duplicate cards
150
231
 
151
- Each triage is shown the other cards, newest first, by number, hold and
152
- first line, as many as fit in what a run quotes (2,000 characters, after the
153
- plan when there is one). The list is a reply on the card, written as `cards` and kept on
154
- the board: it never reaches Slack, Linear or Notion. The triage step quotes
155
- it with `{on.text}`, as content.
156
-
157
- - **Related:** a triage result that starts with `related: #36, #16` labels
158
- the card `related=36,16` and says so on the card, by number only: the card
159
- is mirrored where it came from, and another card's words may be private to
160
- its own source. When both cards are
161
- Linear issues of the same sync, the issues are related in Linear too.
162
- - **The same request:** `duplicate-of: #36` holds the card `duplicate`, with
163
- its spec on it, and you are told. Someone trusted labels it `approved=yes`
164
- to work it anyway, or you cancel it. A duplicate the triage wrote no card
165
- for is triaged again when it is moved to ready.
232
+ The loop shows each triage the other cards, newest first: each one's number,
233
+ hold and first line. It shows as many as fit in what a run quotes: 2,000
234
+ characters, after the plan when there is one. The list is a reply on the
235
+ card, written as `cards`, and stays on the board: it never reaches Slack,
236
+ Linear or Notion. The triage step quotes it with `{on.text}`, as content.
237
+
238
+ How related and duplicate cards work:
239
+
240
+ - **Related:** when a triage result starts with `related: #36, #16`, the
241
+ loop labels the card `related=36,16` and says so on the card. It names the
242
+ other cards by number only: the card is mirrored where it came from, and
243
+ another card's words may be private to its own source. When both cards are
244
+ Linear issues of the same sync, the loop relates the issues in Linear too.
245
+ - **The same request:** when a result starts with `duplicate-of: #36`, the
246
+ loop holds the card `duplicate`, with its spec on it, and tells you.
247
+ Someone trusted labels it `approved=yes` to work it anyway, or you cancel
248
+ it. When a duplicate the triage wrote no card for is moved to ready, the
249
+ loop triages it again.
166
250
  - **A public source sees only public cards.** What a triage writes is
167
- mirrored where its card came from, so a card from a public source (GitHub
168
- issues; `LOOP_PUBLIC` lists the channels, comma separated) is shown only
169
- other public cards. A card from Slack, Linear, Notion or your app sees all.
170
- - **Only cards of this loop count.** A number that isn't another card's (the
171
- card itself, a run's task, any other thread) is left out. The lines are
172
- taken off the spec.
251
+ mirrored where its card came from. So a card from a public source (GitHub
252
+ issues; `LOOP_PUBLIC` lists the channels, comma separated) sees only other
253
+ public cards. A card from Slack, Linear, Notion or your app sees all.
254
+ - **Only cards of this loop count.** The loop leaves out a number that isn't
255
+ another card's (the card itself, a run's task, any other thread). It takes
256
+ the `related` and `duplicate-of` lines off the spec.
173
257
  - **Nothing is split.** A report that asks for several things is one card;
174
258
  the spec can list follow-ups for you to file.
175
259
 
176
- ## Another round
260
+ ## Start another round from a reply
177
261
 
178
- A reply on the card by someone trusted, once its run has ended, is another
179
- round. The comment goes to the work task, the work and then its review are
180
- sent back (`mu tasks reopen <id> --round`), and a worker takes them. The work
181
- starts from its branch: see
262
+ A reply on the card by someone trusted, once its run has ended, starts
263
+ another round. The loop sends the comment to the work task and reopens the
264
+ work and then its review (`mu tasks reopen <id> --round`), and a worker
265
+ takes them. The work starts from its branch: see
182
266
  [Another round on the same pull request](./06-sandboxed-agents.md#another-round-on-the-same-pull-request).
183
- A comment made while a round runs waits for it to end. A round's reply on
184
- the card says which comments it took; comments too long for one round wait
185
- for the next. A card that is done comes back the
186
- same way: a trusted reply reopens it, and its status is In progress again.
267
+ A comment made while a round runs waits for it to end.
268
+
269
+ A round's reply on the card says which comments it took; comments too long
270
+ for one round wait for the next. A card that is done comes back the same
271
+ way: a trusted reply reopens it, and its status is In progress again.
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
+
322
+ ## Run several repositories on one board
323
+
324
+ Each repository is a project. A project's cards are in its own channel,
325
+ `cards/<project>/<source>`, such as `cards/acme/linear`, and its runs work on
326
+ its own repository. Everything else is shared: one board, one `mu serve`,
327
+ one set of prompts. The cards right under `cards/` keep running on
328
+ `workflows.json` as before, so you can add projects to a loop that already
329
+ runs. Keep work on a separate board only when it must stay apart, such as a
330
+ client's under an NDA: see
331
+ [Several repositories, several boards](./15-several-boards.md).
332
+
333
+ ### Name each project and its repository
334
+
335
+ Write `loop-projects.json` beside `workflows.json`, in `~/.config/muster/`:
336
+
337
+ ```json loop-projects.json
338
+ {
339
+ "projects": {
340
+ "acme": { "repo": "https://github.com/acme/web", "runner": "vercel", "maxRuns": 2 },
341
+ "globex": {
342
+ "repo": "https://github.com/globex/site",
343
+ "runner": "e2b",
344
+ "template": "globex-go",
345
+ "trusted": ["lin:user:9b1d4e7a-2c3f-4a8b-b6e0-5f1a2d3c4e5f"]
346
+ }
347
+ }
348
+ }
349
+ ```
350
+
351
+ A project's name is a channel segment: lowercase letters, numbers, `_` and
352
+ `-`, and not the name of a source (`slack`, `linear`, `github`, `notion`,
353
+ `app`). Each project takes these settings:
354
+
355
+ | Setting | Meaning |
356
+ | --- | --- |
357
+ | `repo` | The repository its runs work on, as an HTTPS clone address. Required |
358
+ | `runner` | `vercel`, `cloudflare` or `e2b`. Left out, the one in `workflows.json` |
359
+ | `template` | The E2B template its sandboxes are made from, with `runner` set to `e2b`. Give a Go repository and a pnpm repository each the tools it needs |
360
+ | `model` | The model its agents use |
361
+ | `trusted` | Who may start work on its cards, in place of `LOOP_TRUSTED` |
362
+ | `public` | Its sources that anyone can read, by name (`["github"]`), in place of the ones `LOOP_PUBLIC` names |
363
+ | `maxRuns` | The most runs of it going at once |
364
+
365
+ ### Map each project's sources to its channel
366
+
367
+ In `board.ts`, map each tracker team, Slack channel or repository to its
368
+ project's channel. Give each repository one team of its own, so a card's
369
+ project is never in doubt:
370
+
371
+ ```ts board.ts
372
+ import { env, linear } from '@openmuster/muster'
373
+
374
+ export const sync = {
375
+ lin: linear({
376
+ secret: env('LINEAR_WEBHOOK_SECRET'),
377
+ clientId: env('LINEAR_CLIENT_ID'),
378
+ clientSecret: env('LINEAR_CLIENT_SECRET'),
379
+ teams: { ACME: 'cards/acme/linear', GLOBEX: 'cards/globex/linear' },
380
+ }),
381
+ }
382
+ ```
383
+
384
+ A card's runs then go to its own project's workflows. Its triage is shown
385
+ only its own project's cards, so a public repository's triage never sees a
386
+ private project's words.
387
+
388
+ ### Write each project's workflows
389
+
390
+ Write the template's three workflows again for each project, then restart
391
+ `mu serve`, which reads them when it starts:
392
+
393
+ ```bash
394
+ node templates/loop/projects.ts ~/.config/muster/loop-projects.json > ~/.config/muster/workflows.json
395
+ ```
396
+
397
+ Each project gets `triage.<project>`, `planning.<project>` and
398
+ `card.<project>`. They have the template's prompts and your project's
399
+ repository, runner, template and model. The daemon refuses to run one on
400
+ another project's cards. Write them again whenever you change
401
+ `loop-projects.json`.
402
+
403
+ ### Limit what each project spends and runs
404
+
405
+ A [budget](../01-concepts/13-budgets.md) on a project's channel covers all
406
+ its runs:
407
+
408
+ ```bash
409
+ mu budget cards/acme 20
410
+ ```
411
+
412
+ `maxRuns` caps how many of a project's runs go at once, and `LOOP_MAX_RUNS`
413
+ caps all the loop's runs on the board. A run counts from when it is asked for
414
+ until it ends, or until it waits on a person. A card past a cap waits, says so
415
+ once on the card, and starts when a run ends, oldest card first:
416
+
417
+ - **A change, or a round, that waits is held `queued`.** Your comments wait
418
+ with it, and the round takes them when it starts.
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`.
423
+ - **A task you answered while every place is taken is held `queued` too.** It
424
+ goes on before any card when a run ends.
425
+
426
+ ### Give each project's app its own token
427
+
428
+ An app that posts reports needs a token for its own project's channel only:
429
+
430
+ ```bash
431
+ mu token create --as acme-app --can 'cards/acme/=read,post'
432
+ ```
187
433
 
188
434
  ## What you see
189
435
 
190
- - **The card** in Slack, Linear, GitHub or Notion, wherever the report came
191
- from: the spec, the run's start and summary, the screenshots of each round,
192
- and the pull request's address. GitHub and Notion take no files from the
193
- board, so there each screenshot is named instead.
194
- - **The screenshots** are the ones the project's spec asks for. The work
195
- agent takes them and attaches them to its task, and they are copied onto
436
+ What shows up as a card runs:
437
+
438
+ - **The card:** in Slack, Linear, GitHub or Notion, wherever the report came
439
+ from. It shows the spec, the run's start and summary, the screenshots of
440
+ each round, and the pull request's address. GitHub and Notion take no
441
+ files from the board, so there each screenshot is named instead.
442
+ - **The screenshots:** the ones the project's spec asks for. The work agent
443
+ takes them and attaches them to its task, and the loop copies them onto
196
444
  the card when the round ends. A project whose spec asks for none gets
197
445
  none.
198
- - **A line from `NOTIFY_CMD`**, when it is set: a card that needs your
199
- approval, a task blocked on a decision, a round that is done.
200
- - **The pull request,** one per card, with a commit per round.
446
+ - **A line from `NOTIFY_CMD`:** when it is set, for a card that needs your
447
+ approval, a task blocked on a decision, or a round that is done. A line
448
+ about a project's card starts with the project's name:
449
+ `acme: card #12 needs your approval`.
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).
455
+
456
+ ## When not to use the loop
201
457
 
202
- ## When not to
458
+ Don't use the loop:
203
459
 
204
460
  - For a report you wouldn't hand a stranger's agent: approval is per card,
205
461
  so read the spec before you approve it.
206
462
  - For work that needs several pull requests: a card is one branch.
207
- - For PR review comments as the trigger: a comment on the pull request
208
- doesn't start a round yet. Reply on the card.
463
+ - For pull request review comments as the trigger: a comment on the pull
464
+ request doesn't start a round yet. Reply on the card.
209
465
 
210
466
  ## What goes wrong
211
467
 
212
- - **A round's push is refused** with `push_conflict` when someone pushed to
213
- the branch while the agent worked. The task says so, and the review waits:
214
- read the thread, then reopen the work.
215
- - **A run asked on an edited spec** starts nothing (`asked_message_changed`):
216
- a card that changed after it was triaged is triaged again.
217
- - **The triage agent fails** a report that isn't a change to make here, with
218
- why, in the triage run's summary on the card. The card is held `declined`,
219
- says so, and you are told. Edit the report, or move it to ready again, to
220
- try again; or cancel it. A triage whose agent stopped (out of time, a usage
221
- limit) is declined the same way, and its summary says so.
468
+ Symptoms, causes and fixes:
222
469
 
223
- ## Next
470
+ - **A round's push is refused with `push_conflict`.** Someone pushed to the
471
+ branch while the agent worked. The task says so, and the review waits:
472
+ read the thread, then reopen the work.
473
+ - **A run asked on an edited spec starts nothing.** The error is
474
+ `asked_message_changed`. The card changed after its triage, so the loop
475
+ triages it again.
476
+ - **The triage agent fails a report that isn't a change to make here.** It
477
+ says why in the triage run's summary on the card. The loop holds the card
478
+ `declined`, says so on the card, and tells you. Edit the report, or move it
479
+ to ready again, to try again; or cancel it. The loop declines a triage
480
+ whose agent stopped (out of time, a usage limit) the same way, and its
481
+ summary says so.
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
+
498
+ ## Related guides
499
+
500
+ Where to go next:
224
501
 
225
502
  - [Building from Linear](./22-building-from-linear.md): laying out a Linear
226
503
  project, its spec and its issues for this loop, and what to do from Linear
@@ -229,5 +506,5 @@ same way: a trusted reply reopens it, and its status is In progress again.
229
506
  approving, answering a blocked task, another round, and what to do when
230
507
  something stops.
231
508
  - The `loop-card` skill teaches an agent each step (triage, spec, work,
232
- review): `mu skills install --to ~/.claude/skills` installs it with the
509
+ review): `npx skills add openmuster/muster` installs it with the
233
510
  others.