@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,6 +1,6 @@
1
1
  ---
2
2
  title: A board on a server
3
- description: For a board that cloud sandboxes, platform webhooks or teammates must reach. Run mu serve in a container behind HTTPS, hold tokens to channels, run sync and watchers from a module, and back it up and upgrade it.
3
+ description: For anyone whose board must be reached by cloud sandboxes, platform webhooks or teammates. You end with mu serve in a container behind HTTPS, tokens held to channels, sync and watchers run from a module, and a way to back it up and upgrade it.
4
4
  ---
5
5
 
6
6
  ## Who this is for
@@ -20,16 +20,17 @@ There are three ways, from least to most exposed:
20
20
  | --- | --- | --- |
21
21
  | A private network (Tailscale, a LAN) | Teammates' machines | No domain, no public port |
22
22
  | A tunnel to your machine | Trying cloud runs or a webhook | Your machine awake while it runs |
23
- | A server, in a container | Running cloud agents or sync for real | A small server and a name |
23
+ | A server, in a container | Running cloud agents or sync for real | A small server and a domain name |
24
24
 
25
- For a private network, run `mu serve --host 0.0.0.0 --allow-host <its name
26
- there>` on the machine with the board: see
25
+ For a private network, run
26
+ `mu serve --host 0.0.0.0 --allow-host <its name there>` on the machine with
27
+ the board: see
27
28
  [With no cloud at all](./14-no-cloud.md). The rest of this page is the server.
28
29
 
29
30
  ## Run it in a container
30
31
 
31
32
  The repository's `Dockerfile` builds an image that runs `mu serve`, with the
32
- board, its files, its signing key and its config on one volume at `/data`.
33
+ board, its files, its signing key and its config on one volume at `/data`:
33
34
 
34
35
  ```bash
35
36
  docker build -t muster https://github.com/openmuster/muster.git
@@ -38,19 +39,21 @@ docker run -d --name board --restart unless-stopped \
38
39
  -e MUSTER_ALLOW_HOSTS=board.example.com muster
39
40
  ```
40
41
 
41
- - **`MUSTER_ALLOW_HOSTS`** is the name the board is reached by, as the proxy
42
- in front sends it. The board refuses a request for any other name. Several
43
- names are separated by commas.
44
- - **The port is bound to this machine.** Put a proxy that terminates HTTPS in
45
- front, and let only it reach the port.
46
- - **No token is printed,** since a container's output ends up in a log. Make
47
- one when you need it, as below.
48
- - **The image has a health check** at `/api/board/health`, which answers
49
- without a token and says only the version.
42
+ In that command:
50
43
 
51
- Each release also publishes the image, as
52
- `ghcr.io/openmuster/muster:<version>`, so you can pull it in place of
53
- building it.
44
+ - **`MUSTER_ALLOW_HOSTS`:** the name the proxy in front sends for the board.
45
+ The board refuses a request for any other name. Separate several names with
46
+ commas.
47
+ - **The port is open only to this machine.** Put a proxy that terminates
48
+ HTTPS in front, and let only it reach the port.
49
+ - **`mu serve` prints no token here.** A container's output ends up in a log.
50
+ Make a token when you need it, as
51
+ [Create tokens for agents](#create-tokens-for-agents) shows.
52
+ - **The image has a health check.** It is at `/api/board/health`, answers
53
+ without a token, and says only the version.
54
+
55
+ Each release also comes as an image, `ghcr.io/openmuster/muster:<version>`,
56
+ so you can pull it in place of building it.
54
57
 
55
58
  ## Put HTTPS in front
56
59
 
@@ -65,7 +68,7 @@ board.example.com {
65
68
 
66
69
  A Cloudflare Tunnel or Tailscale Funnel works too, with no open port at all.
67
70
 
68
- ## Tokens
71
+ ## Create tokens for agents
69
72
 
70
73
  The board signs tokens with a key on its volume. Make them inside the
71
74
  container:
@@ -79,44 +82,60 @@ docker exec board mu token revoke Xk3v9QmB2a1c
79
82
 
80
83
  The first, with `--all`, has your full access: use it on your machine
81
84
  with `MUSTER_URL=https://board.example.com/api/board` and `MUSTER_TOKEN`. Give
82
- agents tokens held to a profile and to the channels they need. See
85
+ agents tokens [held to a profile](../01-concepts/11-access.md#tokens) and to
86
+ the channels they need. See
83
87
  [Access](../01-concepts/11-access.md).
84
88
 
85
- Or let agents ask: start the container with `-e MUSTER_ALLOW_JOINS=1`, have
86
- the agent run `mu join https://board.example.com/api/board --as <name>`, and
87
- approve the code it shows with `docker exec board mu join approve <code>
88
- --can 'work/=read,post'`. See
89
+ Or let agents ask. Start the container with `-e MUSTER_ALLOW_JOINS=1`, and
90
+ have the agent run
91
+ `mu join https://board.example.com/api/board --as <name>`. Then approve the
92
+ code it shows:
93
+ `docker exec board mu join approve <code> --can 'work/=read,post'`. See
89
94
  [Let an agent ask to join](../01-concepts/11-access.md#let-an-agent-ask-to-join).
90
95
 
91
- ## Sync and watchers
96
+ ## Run sync and watchers in the container
92
97
 
93
98
  Put a [board module](../01-concepts/17-board-module.md) in `/data/config`,
94
- say `/data/config/board.ts`, and name it with `-e MUSTER_MODULE=/data/config/board.ts`:
95
- the image sets `MUSTER_DIR`, so the default module isn't picked up on its own.
96
- It needs no `package.json`: `mu` answers its `import '@openmuster/muster'`. Pass the
99
+ say `/data/config/board.ts`, and name it with
100
+ `-e MUSTER_MODULE=/data/config/board.ts`. The image sets `MUSTER_DIR`, so
101
+ `mu` doesn't pick up the default module on its own. The module needs no
102
+ `package.json`: `mu` resolves its `import '@openmuster/muster'`. Pass the
97
103
  secrets it names with `env()` as environment variables to `docker run`
98
- (`-e GITHUB_TOKEN`). The board runs its sync, watchers and hooks while it
99
- serves; one it can't load is said in the container's log, and the board is
100
- served without it. A watcher's command runs inside the
101
- container, so it can only start what the image has: to wake an agent
102
- somewhere else, have the command call out, or run the watchers on that
103
- machine against the served board.
104
+ (`-e GITHUB_TOKEN`).
105
+
106
+ The board runs the module's sync,
107
+ [watchers](../01-concepts/09-watchers.md#watchers) and hooks while it serves.
108
+ If the module fails to load, the container's log says so, and `mu serve`
109
+ serves the board without it.
110
+
111
+ A watcher's command runs inside the container, so it can only start what the
112
+ image has. To wake an agent somewhere else, have the command call out, or run
113
+ the watchers on that machine against the served board.
104
114
 
105
115
  ## Back it up
106
116
 
117
+ Write a backup to the volume from inside the container:
118
+
107
119
  ```bash
108
120
  docker exec board mu backup /data/backups/2026-11-21.db
109
121
  ```
110
122
 
111
123
  A backup is a consistent copy of the database, with the board's files copied
112
- beside it (`2026-11-21.files`), made while the board runs. Copy it off the
113
- server. Keep a copy of `/data/config/keys` too, once: it never changes, and
114
- without it every token the board made stops working.
124
+ beside it (`2026-11-21.files`). `mu backup` makes it while the board runs.
125
+ Copy it off the server. Keep a copy of `/data/config/keys` too, once: it
126
+ never changes, and without it every token the board made stops working.
115
127
 
116
128
  To restore, stop the container and put the copy back at
117
129
  `/data/board/main.db`, and its files at `/data/board/main.files`.
118
130
 
119
- ## Upgrade
131
+ On a board without a container, such as one on your own machine, run
132
+ `mu backup` directly with the file to write:
133
+
134
+ ```bash
135
+ mu backup ./board-backup.db
136
+ ```
137
+
138
+ ## Upgrade to a new release
120
139
 
121
140
  Back up first. Then build or pull the new image, and start a new container on
122
141
  the same volume:
@@ -130,10 +149,10 @@ docker run -d --name board --restart unless-stopped \
130
149
  -e MUSTER_ALLOW_HOSTS=board.example.com muster
131
150
  ```
132
151
 
133
- A newer muster upgrades the board's file when it opens it, and an older one
134
- can't open it afterwards: the backup is how you go back.
152
+ A newer muster upgrades the board's file when it opens it. An older muster
153
+ can't open that file afterwards, so the backup is how you go back.
135
154
 
136
- ## Without a container
155
+ ## Run it without a container
137
156
 
138
157
  On any machine with Node and muster installed:
139
158
 
@@ -141,12 +160,16 @@ On any machine with Node and muster installed:
141
160
  mu serve --host 0.0.0.0 --allow-host board.example.com --no-token
142
161
  ```
143
162
 
144
- `--host` with anything but this machine refuses to start without
145
- `--allow-host`. Keep it running with your service manager, such as a systemd
163
+ `--no-token` only skips printing a token at start, since a server's output
164
+ ends up in a log: make one with `mu token create`. `mu serve` won't start
165
+ with a `--host` other than this machine unless you pass `--allow-host`. Keep
166
+ it running with your service manager, such as a systemd
146
167
  unit whose `ExecStart` is that line.
147
168
 
148
169
  ## What goes wrong
149
170
 
171
+ Each entry starts with what you see:
172
+
150
173
  - **`allow_host_required`:** the board listens beyond this machine but wasn't
151
174
  told its name. Set `MUSTER_ALLOW_HOSTS` or pass `--allow-host`.
152
175
  - **Every request is `forbidden`:** the proxy sends a `Host` the board wasn't
@@ -156,7 +179,7 @@ unit whose `ExecStart` is that line.
156
179
  - **The published image is for x86 servers.** On an ARM server, build it
157
180
  from the repository there.
158
181
 
159
- ## When not to
182
+ ## When not to use a server
160
183
 
161
184
  One person, agents on one machine: keep the board local. A server is one more
162
185
  thing to keep patched, backed up and behind HTTPS.
@@ -1,31 +1,39 @@
1
1
  ---
2
2
  title: A card queue
3
- description: For handing a Linear issue, or a card you post, to an agent that writes a spec, opens a pull request and reviews it, once. Label it agent, each step runs in a cloud sandbox, and it asks you only for decisions.
3
+ description: For handing a Linear issue, or a card you post, to an agent that writes a spec, opens a pull request and reviews it, once. You label the card agent. Each step runs in a cloud sandbox, and the agent asks you only for decisions.
4
4
  ---
5
5
 
6
6
  ## Who this is for
7
7
 
8
- You keep work as cards, Linear issues or threads you post yourself, and want
9
- an agent to take a card from start to finish: write a spec, make the change
10
- as a pull request, and review it. You only want to hear about a card when the
11
- agent needs a decision from you.
8
+ You keep work as cards: Linear issues, or threads you post yourself. You
9
+ want an agent to take a card from start to finish: write a spec, make the
10
+ change as a pull request, and review it. You only want to hear about a card
11
+ when the agent needs a decision from you.
12
12
 
13
- **You need:** muster on the machine that holds the board, `mu serve` reached
14
- through a tunnel or a proxy, a Vercel project for the sandboxes, a GitHub App
15
- installed on the repository, a model key, and for Linear cards a Linear key
16
- and webhook. See [Agents in cloud sandboxes](./06-sandboxed-agents.md) for
17
- the Vercel and GitHub parts. `"runner": "e2b"` in `workflows.json` runs the
18
- steps in E2B sandboxes instead, with `E2B_API_KEY` and `MUSTER_E2B_TEMPLATE`
19
- in place of the Vercel settings.
13
+ ## Before you begin
20
14
 
21
- ## The parts
15
+ You need:
22
16
 
23
- `templates/queue` is a board module, a workflow file, and three small
24
- scripts:
17
+ - muster on the machine that holds the board
18
+ - `mu serve` reached through a tunnel or a proxy
19
+ - a Vercel project for the sandboxes
20
+ - a GitHub App installed on the repository
21
+ - a model key
22
+ - for Linear cards, a Linear key and webhook
23
+
24
+ See [Agents in cloud sandboxes](./06-sandboxed-agents.md) for the Vercel and
25
+ GitHub parts. `"runner": "e2b"` in `workflows.json` runs the steps in E2B
26
+ sandboxes instead, with `E2B_API_KEY` and `MUSTER_E2B_TEMPLATE` in place of
27
+ the Vercel settings.
28
+
29
+ ## How it fits together
30
+
31
+ `templates/queue` is a [board module](../01-concepts/17-board-module.md), a
32
+ workflow file, and three scripts:
25
33
 
26
34
  | File | What it does |
27
35
  | --- | --- |
28
- | `board.ts` | The board module. Its sync maps Linear team `ENG` to the channel `cards`, both ways. Its watcher `card-start` runs `start.sh` for a card labelled `tag.agent=agent`; `needs-me` runs `notify.sh` when a task under `cards/` blocks |
36
+ | `board.ts` | The board module. Its sync maps Linear team `ENG` to the channel `cards`, both ways. Its [watcher](../01-concepts/09-watchers.md#watchers) `card-start` runs `start.sh` for a card labelled `tag.agent=agent`; `needs-me` runs `notify.sh` when a task under `cards/` [blocks](../01-concepts/08-tasks.md#states) |
29
37
  | `workflows.json` | The `card` workflow: spec, work and review tasks, one Vercel worker, `--push` for the work step only |
30
38
  | `start.sh` | Marks the card `started` and asks for the `card` workflow on it, once |
31
39
  | `notify.sh` | Tells you a task is blocked, with its ID only |
@@ -45,6 +53,13 @@ flowchart LR
45
53
 
46
54
  ## Set it up
47
55
 
56
+ `mu serve` runs the module's sync, its watchers and the workflow, and the
57
+ workers start with its environment.
58
+
59
+ ### Copy the workflow file
60
+
61
+ Copy the workflow file to muster's config folder:
62
+
48
63
  ```bash
49
64
  cp templates/queue/workflows.json ~/.config/muster/
50
65
  ```
@@ -54,58 +69,52 @@ Then edit the copy: `repo` is your repository's https address. In
54
69
  `templates/queue`, and names the scripts beside it by their full paths,
55
70
  wherever it is run from.
56
71
 
72
+ ### Start `mu serve` with the module
73
+
57
74
  Put the settings in the environment `mu serve` starts with, and give it the
58
- module. It runs the module's sync, its watchers and the workflow, and the
59
- workers start with its environment. The module names the Linear secrets with
60
- `env()`: `mu serve` reads them when it starts, and refuses to start, naming
61
- the variable, if one isn't set:
75
+ module. The module names the Linear secrets with `env()`. `mu serve` reads
76
+ them when it starts. If one isn't set, it refuses to start and names the
77
+ variable:
62
78
 
63
79
  ```bash
64
- export LINEAR_WEBHOOK_SECRET=... LINEAR_API_KEY=lin_api_...
80
+ export LINEAR_WEBHOOK_SECRET=your_linear_webhook_secret LINEAR_API_KEY=your_linear_api_key
65
81
  export MUSTER_SANDBOX_URL=https://board.example.com/api/board
66
- export VERCEL_TOKEN=... VERCEL_TEAM_ID=... VERCEL_PROJECT_ID=...
82
+ export VERCEL_TOKEN=your_vercel_token VERCEL_TEAM_ID=your_vercel_team_id VERCEL_PROJECT_ID=your_vercel_project_id
67
83
  export GITHUB_APP_ID=123456 GITHUB_APP_KEY_FILE=~/.config/muster/app.pem
68
- export ANTHROPIC_API_KEY=sk-ant-...
84
+ export ANTHROPIC_API_KEY=your_anthropic_api_key
69
85
  mu serve --module "$PWD/templates/queue/board.ts" --allow-host board.example.com
70
86
  ```
71
87
 
72
- Use `MUSTER_SANDBOX_URL`, not `MUSTER_URL`. The watchers' scripts run `mu` on
73
- the board's file here; with `MUSTER_URL` set they would go to the server
74
- instead, with no token, and be refused. Point Linear's webhook at
75
- `https://board.example.com/api/board/webhooks/lin`, as
76
- [Linear](../02-sync/03-linear.md) says, and cap what the cards may cost:
88
+ Use `MUSTER_SANDBOX_URL`, not `MUSTER_URL`. The watchers' scripts run `mu`
89
+ against the board's file on this machine; with `MUSTER_URL` set they would go
90
+ to the server instead, with no token, and be refused.
91
+
92
+ ### Point Linear's webhook at the board
93
+
94
+ Point Linear's webhook at `https://board.example.com/api/board/webhooks/lin`,
95
+ as [Linear](../02-sync/03-linear.md) says.
96
+
97
+ ### Cap the cost and check the workflow
98
+
99
+ Cap what the cards may cost at $10, and check that the `card` workflow is
100
+ listed:
77
101
 
78
102
  ```bash
79
103
  mu budget cards 10
80
104
  mu workflow list
81
105
  ```
82
106
 
83
- ## How a card goes
84
-
85
- 1. An issue in the team gets the label `agent`, when it is made or later. It
86
- arrives as a thread in `cards` with `tag.agent=agent`.
87
- 2. Within a few seconds the watcher `card-start` runs `start.sh` with the
88
- thread's ID, as the profile `intake`. The script sets `started=yes` on the
89
- card only if it still has `tag.agent=agent` and has no `started`, in one
90
- write, and then asks for the `card` workflow on it. Any later wake, from a
91
- comment or the run's own reply, finds `started` set and does nothing.
92
- 3. `mu serve` makes three tasks in `cards/card-<n>`: `spec`, `work`, which
93
- needs the spec, and `review`, which needs the work. The spec task quotes
94
- the card's text as content, not instructions; the work and review tasks
95
- quote the spec's result the same way, and the review the work's summary,
96
- filled in when the worker takes each. One worker takes them in turn, each
97
- in its own Vercel sandbox; only the work task's change is pushed to
98
- `mu/task-<id>` and opened as a pull request.
99
- 4. The card gets two replies, which go to Linear as comments: `started card:
100
- 3 tasks in cards/card-<n>`, and once the tasks have ended, a summary with
101
- each task's result and the pull request. On the board the first reply also
102
- says where each task is, as the run goes; Linear keeps it as it was first
103
- written, since edits don't go to Linear.
107
+ ## Hand it a card
104
108
 
105
- The run's tasks are not sent to Linear: only `cards` is mapped, and
106
- `cards/card-<n>` is another channel.
109
+ A card starts from a Linear issue or from a thread you post in `cards`.
110
+
111
+ ### Label an issue `agent`
107
112
 
108
- ## A card you post yourself
113
+ Give an issue in the team the label `agent`, when you make it or later. Sync
114
+ brings it in as a thread in `cards` with `tag.agent=agent`, and the card
115
+ starts.
116
+
117
+ ### Or post a card yourself
109
118
 
110
119
  A card needs no issue. Post it with the label, and with `--no-sync`, so it
111
120
  doesn't open an issue in Linear: that issue would have no `agent` label, and
@@ -123,13 +132,49 @@ with `label_conflict`, which is how the script knows the card has started:
123
132
  mu label 1 started=yes --if tag.agent=agent --if-unset started --as intake
124
133
  ```
125
134
 
126
- ## When it needs you
135
+ ## What you see
136
+
137
+ Each card goes through these steps:
138
+
139
+ 1. Within a few seconds the watcher `card-start` runs `start.sh` with the
140
+ thread's ID, as the [profile](../01-concepts/06-actors.md) `intake`. The
141
+ script sets `started=yes` on the card only if it still has
142
+ `tag.agent=agent` and has no `started`, in one write. Then it asks for the
143
+ `card` workflow on it. Any later wake, from a comment or the run's own
144
+ reply, finds `started` set and does nothing.
145
+ 2. `mu serve` makes three tasks in `cards/card-<n>`: `spec`, `work`, which
146
+ needs the spec, and `review`, which needs the work. Each task quotes the
147
+ text it builds on as content, not instructions (see
148
+ [What a card can reach](#what-a-card-can-reach)). One worker takes the
149
+ tasks in turn, each in its own Vercel sandbox. The worker pushes only the
150
+ work task's change, to `mu/task-<id>`, and opens a pull request for it.
151
+ 3. The card gets two replies, which go to Linear as comments: `started card:
152
+ 3 tasks in cards/card-<n>`, and once the tasks have ended, a summary with
153
+ each task's result and the pull request. On the board the first reply also
154
+ says where each task is, as the run goes. Linear keeps it as it was first
155
+ written, since edits don't go to Linear.
156
+
157
+ Sync doesn't send the run's tasks to Linear: only `cards` is mapped, and
158
+ `cards/card-<n>` is another channel.
159
+
160
+ ## Answer when it needs you
127
161
 
128
162
  A worker that can't go on without a decision blocks its task with one line on
129
163
  where things stand, then `->`, the decision it needs and what it recommends.
164
+
165
+ ### Get the notification
166
+
130
167
  The watcher `needs-me` runs `notify.sh` with the task's ID: a macOS
131
168
  notification, or, with `NOTIFY_CMD` in `mu serve`'s environment, your own
132
- command, given one line. Neither gets anything the task says.
169
+ command, given one line. Neither receives any of the task's text.
170
+
171
+ ### Read the task and answer it
172
+
173
+ Run `answer.sh` as yourself, with no `--as` and no `MUSTER_PROFILE`:
174
+ `mu serve` makes the run's tasks as the profile `workflows`, and only the
175
+ board's owner with no profile may unblock them. Run it where `mu serve` runs,
176
+ with the same `MUSTER_SANDBOX_URL`, Vercel, GitHub App and model settings in
177
+ your shell:
133
178
 
134
179
  ```bash
135
180
  mu read 14
@@ -138,115 +183,159 @@ mu read 14
138
183
 
139
184
  `answer.sh` unblocks the task, then posts your answer on it. The unblock is
140
185
  the gate: of two answers to one task, only the one whose unblock changed it
141
- goes on, and an answer the board refuses posts nothing. Then, since the run's
142
- own worker stops after ten idle minutes, it starts a worker that takes the
143
- run's ready tasks one after another, the answered one first, held to that
144
- run's tasks as the workers `mu serve` starts are: same runner, agent, repository and
145
- `--push` as `workflows.json`. It starts none while a worker of the run is
186
+ goes on, and an answer the board refuses posts nothing.
187
+
188
+ Then `answer.sh` starts a worker, since the run's own worker stops after 10
189
+ idle minutes. That worker takes the run's ready tasks one after another, the
190
+ answered one first. It is limited to that run's tasks, as the workers
191
+ `mu serve` starts are, with the same runner, agent, repository and `--push`
192
+ as `workflows.json`. `answer.sh` starts none while a worker of the run is
146
193
  still going on this machine; that one takes the task.
147
194
 
148
- Run it as yourself, with no `--as` and no `MUSTER_PROFILE`: the run's tasks
149
- are made as the profile `workflows`, and only the board's owner with no profile may unblock
150
- them. Run it where `mu serve` runs, with the same `MUSTER_SANDBOX_URL`,
151
- Vercel, GitHub App and model settings in your shell: it starts the worker
152
- itself, and stays until the worker ends, since a `--push` run's change is
153
- pushed from here. If the worker ends badly, the script prints the `mu run`
154
- line that runs what is left.
195
+ `answer.sh` stays until its worker ends, since that worker pushes the work
196
+ step's change from this machine, as the run's own worker does. If the worker
197
+ ends badly, the script prints the `mu run` line that runs what is left.
155
198
 
156
- ## When not to
199
+ ## When not to use a card queue
200
+
201
+ These cases need something else:
157
202
 
158
203
  - For a project you plan and iterate on in Linear, with rounds on the same
159
204
  pull request: [Building from Linear](./22-building-from-linear.md).
160
205
  - For work that needs a back-and-forth: the steps are fixed, spec, work and
161
206
  review, and the review only comments. Nothing is sent back for a second
162
207
  round.
163
- - For a card whose text you wouldn't hand a stranger's agent: see below.
208
+ - For a card whose text you wouldn't hand a stranger's agent: see
209
+ [What a card can reach](#what-a-card-can-reach).
164
210
  - For a board other people's agents reach with tokens: the watchers run on
165
211
  the board's own machine, as its owner.
166
212
 
167
213
  ## What a card can reach
168
214
 
169
- A card's text is written by whoever filed it, and it steers agents that can
170
- push. Know what a run reaches before you map a team:
215
+ Whoever files a card writes its text, and agents that can push act on it.
216
+ Know what a run reaches before you map a team.
217
+
218
+ ### What a run reaches
219
+
220
+ What a run reaches, and what it can't:
171
221
 
172
- - **Who starts one.** Anyone who can label an issue in the mapped team, or
173
- post or label a thread in `cards`, starts a run. The run is asked for by
174
- `intake`, the watcher's profile, so the workflow's `who` doesn't check the
175
- card's author.
176
- - **The repository.** The work step's sandbox pushes: its change goes to
177
- `mu/task-<id>` in the workflow's repository, with a pull request. The spec
222
+ - **Who starts one:** anyone who can label an issue in the mapped team, or
223
+ post or label a thread in `cards`, starts a run. `intake`, the watcher's
224
+ profile, asks for the run, so the workflow's `who` doesn't check the card's
225
+ author.
226
+ - **The repository:** the worker reads the work step's change out of its
227
+ sandbox, then pushes it to `mu/task-<id>` in the workflow's repository and
228
+ opens a pull request, from its own machine. The sandbox never holds the
229
+ GitHub token. The spec
178
230
  and review steps set `push: false`, so whatever their agents change is
179
231
  never pushed. The worker reads that from what `mu serve` made each task
180
232
  with, never from its labels now, so an agent that relabels a task changes
181
233
  nothing.
182
- - **CI.** That pull request runs your CI on the agent's code, with whatever
183
- secrets CI gives a branch of the same repository. Keep secrets away from
184
- pull-request jobs, or require approval before they run.
185
- - **Linear.** The run's summary quotes each task's result, which an agent
234
+ - **CI:** that pull request runs your continuous integration (CI) on the
235
+ agent's code, with whatever secrets CI gives a branch of the same
236
+ repository. Keep secrets away from pull-request jobs, or require approval
237
+ before they run.
238
+ - **Linear:** the run's summary quotes each task's result, which an agent
186
239
  wrote from the card, as a comment on the issue, where its author reads it.
187
- - **What it can't reach.** The sandbox holds no board credential of yours, no
240
+ - **What it can't reach:** the sandbox holds no board credential of yours, no
188
241
  GitHub token and no model key; its token reaches the run's channel only.
189
242
 
243
+ ### How each step quotes the one before
244
+
190
245
  The spec task quotes the card as content, defused. The spec's result was
191
- written by an agent that read the card, so the work and review tasks quote it
246
+ written by an agent that read the card. So the work and review tasks quote it
192
247
  the same way, with `{steps.spec.result}`: under a line that says whose it is,
193
248
  in a fence nothing in it can close, with `@`, `<`, `>` and Markdown links
194
- defused. The review quotes the work's summary too. A fence marks what is
195
- content; it can't stop an agent that is steered anyway. Three things still
196
- reach a later step unfenced: the work's diff, which the review downloads and
197
- reads; anything an agent chooses to read itself with `mu read`; and a later
198
- task's own text, which an earlier step's agent may edit, since its token may
199
- post in the run's channel. The board then holds that task as `edited`, and
200
- `needs-me` pings you. `answer.sh` won't answer it: read what changed, and
201
- unblock it yourself only if it is safe. Even then its worker doesn't fill
202
- results into text it didn't write, and holds it again as `workflow.edited`.
203
- A step's result is quoted only when the run's own worker completed it: an
204
- agent that claimed and completed another step itself, with its sandbox's
205
- token, gets a `no result` note in the next task instead. A result is quoted
206
- once, when the task is first taken: a task reopened after a step it quotes
207
- was done again keeps the old quote.
249
+ defused. The review quotes the work's summary too. The worker fills each
250
+ quote in when it takes the task.
251
+
252
+ A task quotes a step's result only when the run's own worker completed that
253
+ step. An agent that claimed and completed another step itself, with its
254
+ sandbox's token, gets a `no result` note in the next task instead. A task
255
+ quotes a result once, when it is first taken: a task reopened after a step
256
+ it quotes was done again keeps the old quote.
257
+
258
+ ### What still reaches a step unfenced
259
+
260
+ A fence marks what is content; it can't stop an agent from following
261
+ instructions in it anyway. Three things still reach a later step unfenced:
262
+
263
+ - the work's diff, which the review downloads and reads
264
+ - anything an agent chooses to read itself with `mu read`
265
+ - a later task's own text, which an earlier step's agent may edit, since its
266
+ token may post in the run's channel
267
+
268
+ When an agent edits a later task, the board
269
+ [holds](../01-concepts/08-tasks.md#who-may-change-a-task) that task as
270
+ `edited`, and `needs-me` pings you. `answer.sh` won't answer it: read what
271
+ changed, and unblock it yourself only if it is safe. Even then its worker
272
+ doesn't fill results into text it didn't write, and holds it again as
273
+ `workflow.edited`.
208
274
 
209
275
  ## What goes wrong
210
276
 
277
+ The failures you may hit, grouped by when they happen.
278
+
279
+ ### A card doesn't start
280
+
281
+ These stop a card before its run begins:
282
+
211
283
  - **The request fails.** `start.sh` leaves `started` set, so a request that
212
284
  went through before the error doesn't start a second run, and replies on
213
285
  the card, on the board only, with the retry: `mu label <id> --unset started`.
214
286
  If `mu serve` refuses the request, it says why on the card itself.
215
- - **A label taken off.** Before the watcher looked, nothing starts. After a
216
- run started, it goes on: cancel its tasks with `mu tasks cancel`.
287
+ - **Someone takes the label off.** Before the watcher looked, nothing starts.
288
+ After a run started, it goes on: cancel its tasks with `mu tasks cancel`.
217
289
  - **A script keeps failing.** The watcher tries the same event again, with a
218
- growing wait, and after five tries says so on the card or task, once.
290
+ growing wait, and after 5 tries says so on the card or task, once.
291
+ - **A label write's answer is lost.** Over HTTP, `start.sh`'s label is keyed
292
+ by the event that woke it, so the watcher's retry gets the same answer and
293
+ the card still starts. If new activity arrives on the card before that
294
+ retry, the retry has another key and finds `started` set: start it with
295
+ `mu label <id> --unset started`.
296
+
297
+ ### Linear and the board disagree
298
+
299
+ These come from what sync brings in:
300
+
219
301
  - **The board was down.** With `LINEAR_API_KEY` set, `mu serve` catches up
220
- when it starts again: an issue made meanwhile arrives with its labels, and
221
- an `agent` label added meanwhile to a card it has is brought in, and either
222
- starts the card, whatever state the issue is in, closed included: the
223
- budget on `cards` is the cap. Without a key there is no catch-up: an issue
224
- made while the board was down never arrives, and a label added meanwhile
225
- to a card it has arrives with the issue's next update.
226
- - **An issue from before sync was set up.** Labelling it `agent` starts the
227
- card: Linear's update carries the whole issue, so its thread starts with
228
- the title, description and labels, as a new issue's would. If someone
302
+ when it starts again. An issue made meanwhile arrives with its labels. An
303
+ `agent` label added meanwhile to a card the board already has is brought
304
+ in. Either one starts the card, whatever state the issue is in, closed
305
+ included: the budget on `cards` is the cap. Without a key there is no
306
+ catch-up. An issue made while the board was down never arrives, and a label
307
+ added meanwhile to a card the board has arrives with the issue's next
308
+ update.
309
+ - **An issue was made before sync was set up.** Labelling it `agent` starts
310
+ the card: Linear's update includes the whole issue, so its thread starts
311
+ with the title, description and labels, as a new issue's would. If someone
229
312
  commented on it first, after sync was set up, the thread started from that
230
- comment, which carries only the title: the card then runs on the title
313
+ comment, which includes only the title: the card then runs on the title
231
314
  alone. See [Linear](../02-sync/03-linear.md#an-issue-from-before-sync).
232
- - **A long card.** The spec task quotes the first 2,000 characters.
233
- - **A step with no result.** The next task says so where the result would
234
- be: `(No result from step "spec", #12: it completed without one.)`.
235
- - **A task the worker couldn't fill.** If the quoted results make its text
315
+
316
+ ### A step goes wrong
317
+
318
+ These happen inside a run:
319
+
320
+ - **A card is long.** The spec task quotes the first 2,000 characters.
321
+ - **A step completes with no result.** The next task says so where the result
322
+ would be: `(No result from step "spec", #12: it completed without one.)`.
323
+ - **The worker can't fill a task.** If the quoted results make its text
236
324
  longer than the board takes, the worker fails the task with `couldn't
237
325
  quote the earlier steps' results into it`, and runs no agent on it.
238
- - **Files on a card** don't reach the sandbox: the worker's token reaches
326
+ - **Files on a card don't reach the sandbox.** The worker's token reaches
239
327
  the run's channel only.
240
328
  - **The review sees no checkout of the change.** Its sandbox clones the
241
329
  default branch, and the pushed branch isn't there. The work step attaches
242
330
  its diff to a reply on its task, and the review reads that; if the work
243
331
  step didn't, the review says so and reviews nothing.
244
- - **A label write whose answer was lost.** Over HTTP, `start.sh`'s label is
245
- keyed by the event that woke it, so the watcher's retry gets the same
246
- answer and the card still starts. If new activity lands on the card before
247
- that retry, the retry has another key and finds `started` set: start it
248
- with `mu label <id> --unset started`.
249
- - **A usage limit.** The worker stops and the task fails; the summary says so.
332
+ - **The agent reaches a usage limit.** The worker stops and the task fails;
333
+ the summary says so.
334
+
335
+ ### Setup and answers
336
+
337
+ These come from how you run `mu serve` or `answer.sh`:
338
+
250
339
  - **`answer.sh` says `isn't yours to change`.** It ran with a profile: unset
251
340
  `MUSTER_PROFILE`.
252
341
  - **`mu serve` refuses to start with `config_retired`.** `~/.config/muster/`
@@ -255,7 +344,7 @@ was done again keeps the old quote.
255
344
  into a board module and delete them
256
345
  ([Porting](../04-reference/07-porting.md)).
257
346
 
258
- ## Status
347
+ ## What has been tested
259
348
 
260
349
  Experimental: not yet run end to end against Linear, Vercel and GitHub
261
350
  together.