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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +10 -6
  2. package/dist/{args-9ZZDcPxa.js → args-CaFBa2IP.js} +305 -23
  3. package/dist/cli.js +3 -3
  4. package/dist/index.d.ts +67 -18
  5. package/dist/index.js +106 -41
  6. package/dist/inspect/app.js +49 -26
  7. package/dist/{main-Doit2DDY.js → main-BeEB08iI.js} +158 -8
  8. package/dist/main-CLzQkYeG.js +6 -0
  9. package/dist/mcp-CAAZRJgv.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/{steps-BUPRIOe3.js → steps-FNDWY1P_.js} +16 -4
  14. package/docs/01-concepts/09-watchers.md +4 -32
  15. package/docs/01-concepts/10-schedules.md +1 -1
  16. package/docs/01-concepts/11-access.md +19 -3
  17. package/docs/01-concepts/13-budgets.md +66 -3
  18. package/docs/01-concepts/15-outgoing-webhooks.md +6 -19
  19. package/docs/01-concepts/16-workflows.md +22 -2
  20. package/docs/01-quickstart.md +74 -45
  21. package/docs/02-sync/01-overview.md +34 -2
  22. package/docs/02-sync/02-github.md +40 -19
  23. package/docs/02-sync/03-linear.md +103 -85
  24. package/docs/02-sync/04-slack.md +116 -111
  25. package/docs/02-sync/05-notion.md +46 -25
  26. package/docs/03-guides/01-coding-agents.md +51 -33
  27. package/docs/03-guides/02-swarm.md +30 -15
  28. package/docs/03-guides/03-factory.md +193 -80
  29. package/docs/03-guides/04-inspector.md +73 -42
  30. package/docs/03-guides/05-running-agents.md +62 -35
  31. package/docs/03-guides/06-sandboxed-agents.md +488 -305
  32. package/docs/03-guides/07-build-a-ui.md +86 -31
  33. package/docs/03-guides/08-ci.md +59 -36
  34. package/docs/03-guides/09-daemon.md +121 -53
  35. package/docs/03-guides/10-two-agents.md +31 -22
  36. package/docs/03-guides/11-person-in-the-loop.md +47 -34
  37. package/docs/03-guides/12-unattended.md +46 -27
  38. package/docs/03-guides/13-terminals.md +51 -39
  39. package/docs/03-guides/14-no-cloud.md +31 -19
  40. package/docs/03-guides/15-several-boards.md +61 -27
  41. package/docs/03-guides/16-non-code.md +29 -18
  42. package/docs/03-guides/17-mcp.md +37 -30
  43. package/docs/03-guides/18-a-board-on-a-server.md +66 -43
  44. package/docs/03-guides/19-a-card-queue.md +210 -121
  45. package/docs/03-guides/20-a-feedback-loop.md +298 -134
  46. package/docs/03-guides/21-running-the-loop.md +94 -64
  47. package/docs/03-guides/22-building-from-linear.md +81 -57
  48. package/docs/04-reference/01-cli.md +7 -0
  49. package/docs/04-reference/02-handle.md +10 -15
  50. package/docs/04-reference/03-http.md +1 -1
  51. package/docs/04-reference/04-events.md +2 -1
  52. package/docs/04-reference/05-errors.md +3 -0
  53. package/docs/04-reference/08-files.md +49 -0
  54. package/docs/index.md +1 -0
  55. package/package.json +1 -1
  56. package/dist/main-D5aX7Jaj.js +0 -6
  57. package/dist/mcp-Cm96TIb3.js +0 -6
@@ -1,21 +1,22 @@
1
1
  ---
2
2
  title: Two agents, one builds and one reviews
3
- description: For work where the agent saying it is done isn't enough. One agent builds, a second agent in a fresh session reviews once the build task completes, and a failed review sends the work back for another round.
3
+ description: For work where the agent saying it is done isn't enough. You end with one agent that builds, a second agent in a fresh session that reviews once the build task completes, and a failed review that sends the work back for another round.
4
4
  ---
5
5
 
6
6
  ## Who this is for
7
7
 
8
8
  You have work worth checking, and "the agent said it's done" isn't enough.
9
- You don't need a swarm for this: two tasks, where the second waits for the
10
- first.
9
+ You don't need a [swarm](./02-swarm.md) for this: two tasks, where the second
10
+ waits for the first.
11
11
 
12
12
  **You need:** muster, and one agent CLI installed and signed in. Two different
13
13
  vendors (Claude Code and Codex, say) review each other better than one vendor
14
14
  twice, but a fresh session of the same agent still beats none.
15
15
 
16
- ## Steps
16
+ ## Queue the work and its review
17
17
 
18
- Make the work, and a review that can't start until the work is done.
18
+ Create a build task, and a review task that can't start until the build task
19
+ completes:
19
20
 
20
21
  ```bash steps
21
22
  mu tasks create work/login "Follow only same-origin paths after login. You own apps/web/login/. Done when the login tests pass." --label role=build --as lead
@@ -23,8 +24,8 @@ mu tasks create work/login "Review the fix for task 1: try an off-site URL, a pr
23
24
  mu tasks work/login --state all --as lead
24
25
  ```
25
26
 
26
- The review is `waiting`. It becomes `ready` when task 1 completes, and not
27
- before.
27
+ The review is [`waiting`](../01-concepts/08-tasks.md#states). It becomes
28
+ `ready` when task 1 completes, and not before.
28
29
 
29
30
  Start the builder, then the reviewer, each on its own kind of task:
30
31
 
@@ -38,39 +39,47 @@ reviewer has not seen the builder's reasoning, only its result.
38
39
 
39
40
  ## What you see
40
41
 
42
+ Read the channel:
43
+
41
44
  ```bash steps
42
45
  mu read work/login --as lead
43
46
  ```
44
47
 
45
- Each task's thread holds its plan, each step with the command that was run,
48
+ Each task's thread shows its plan, each step with the command the agent ran,
46
49
  and the result. The reviewer's thread says what it tried and what happened.
47
50
 
48
51
  ## If the review fails
49
52
 
50
- A review that finds a real problem fails, with what it found as its reason.
51
- Send the work back for another round, and reopen the review so it runs again
52
- afterwards. Task IDs are message IDs, so the review here is task 3:
53
+ A review that finds a problem fails, with what it found as its reason. Send
54
+ the work back for another round, and reopen the review so it runs again
55
+ afterwards. Task IDs skip numbers (each task takes 2 places in the board's
56
+ log), so the review here is task 3:
53
57
 
54
58
  ```bash
55
59
  mu tasks reopen 1 --round --as lead
56
60
  mu tasks reopen 3 --as lead
57
61
  ```
58
62
 
59
- The work is `ready` again with the review's findings in reach, and the review
60
- waits for it once more. A review left as it ended does not run again. Three
61
- rounds on the same kind of finding means the approach is wrong: stop and
62
- rethink it.
63
+ The work is `ready` again, and the builder can read the review's findings on
64
+ the board. The review waits for the work once more. If you don't reopen the
65
+ review, it stays failed and doesn't run again. Three rounds on the same kind
66
+ of finding means the approach is wrong: stop and rethink it.
67
+
68
+ ## When not to add a reviewer
63
69
 
64
- ## When not to
70
+ Skip the second agent, or change how you use it, in these cases:
65
71
 
66
- - For a change you will read yourself anyway, the second agent is cost without
67
- benefit.
68
- - A reviewer told only "review this" approves. Give it three or four specific
69
- things to try to break.
72
+ - **A change you will read yourself anyway:** the second agent is cost
73
+ without benefit.
74
+ - **A reviewer told only "review this":** it approves. Give it three or four
75
+ specific things to try to break.
70
76
 
71
77
  ## What goes wrong
72
78
 
73
- - **Both agents take the same task.** They can't: a task has one holder. But
74
- without `--label` either may take either task. Label them.
79
+ Each item is the symptom, then the cause and the fix:
80
+
81
+ - **Either agent takes either task.** A task has one holder, so both can't
82
+ take the same one. But without `--label` either may take either task. Label
83
+ them.
75
84
  - **The reviewer reviews its own work.** Give the two different `--as` names
76
85
  and different labels, and say in the review's text whose work it is.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: A person in the loop
3
- description: For agents that should stop and ask you when a decision is yours. The agent blocks its task with the question, you find and answer it on the board, and a watcher can tell you when one is waiting.
3
+ description: For anyone whose agents should stop and ask when a decision is theirs. You end with agents that block a task with their question, a way to find and answer it on the board, and a watcher that tells you when one is waiting.
4
4
  ---
5
5
 
6
6
  ## Who this is for
@@ -8,14 +8,14 @@ description: For agents that should stop and ask you when a decision is yours. T
8
8
  You want an agent to stop and ask when a decision is yours, not guess. And you
9
9
  want to find those questions without watching a terminal.
10
10
 
11
- **You need:** muster. For a ping on your phone, the daemon and anything that
12
- can send you a notification from a command.
11
+ **You need:** muster. For a ping on your phone, you also need the daemon and
12
+ a command that can send you a notification.
13
13
 
14
14
  ## How a question works
15
15
 
16
- An agent that hits a decision it shouldn't make writes the question in its
17
- task's thread, with what it would choose, and blocks the task. Here you make
18
- the task as yourself, and the agent writes as `claude`.
16
+ An agent that reaches a decision it shouldn't make writes the question in
17
+ its task's thread, with what it would choose. Then it blocks the task. Here
18
+ you make the task as yourself, and the agent writes as `claude`:
19
19
 
20
20
  ```bash steps
21
21
  mu tasks create work/billing "Set the retry limit for failed payments and document it."
@@ -24,22 +24,26 @@ mu reply 1 "Question: retry 3 times or 5? I would pick 3: the provider's docs sa
24
24
  mu tasks block 1 "retry 3 times or 5?" --kind needs_input --as claude
25
25
  ```
26
26
 
27
- The task is now `blocked`, and the agent is done with it. Nobody is waiting on
28
- a process: the question lives on the board.
27
+ The task is now [`blocked`](../01-concepts/08-tasks.md#states), and the
28
+ agent is done with it. No process is waiting: the question is stored on the
29
+ board.
29
30
 
30
31
  ## Find what is waiting for you
31
32
 
33
+ List the blocked tasks, then read the one you want:
34
+
32
35
  ```bash steps
33
36
  mu tasks --state blocked
34
37
  mu read 1
35
38
  ```
36
39
 
37
- ## Answer
40
+ ## Answer and unblock the task
38
41
 
39
42
  Reply in the thread, then unblock. Only a task's owner (whoever made it) may
40
- unblock it: blocking ended the agent's claim, so nobody holds the task.
41
- Whichever agent is free next takes it
42
- and reads the thread from the top, your answer included.
43
+ unblock it: blocking ended the agent's
44
+ [claim](../01-concepts/08-tasks.md#claims), so nobody holds the task. The
45
+ next free agent takes it and reads the thread from the top, your answer
46
+ included:
43
47
 
44
48
  ```bash steps
45
49
  mu reply 1 "3. Revisit if the provider raises the limit."
@@ -47,22 +51,28 @@ mu tasks unblock 1
47
51
  mu tasks --state ready
48
52
  ```
49
53
 
50
- ## An agent that stays and waits
54
+ ## Have the agent wait for your answer
51
55
 
52
- For a quick question the agent can wait inside its turn instead of blocking:
56
+ For a question you can answer within the timeout, the agent can wait inside
57
+ its turn instead of blocking:
53
58
 
54
59
  ```bash
55
- mu wait --re 1 --after 3 --timeout 30m --as claude
60
+ mu wait --re 1 --after 4 --timeout 30m --as claude
56
61
  ```
57
62
 
58
- It returns when a reply lands, or exits 1 after the timeout. A timeout is
63
+ `--after 4` starts after the agent's own question: `mu reply` printed it as
64
+ `#4`, and that is its place in the event log. The wait returns when a reply
65
+ arrives, or exits 1 after the timeout. A timeout is
59
66
  silence, not an answer: the agent should block the task then, not decide for
60
67
  you.
61
68
 
62
- ## A ping when something needs you
69
+ ## Get notified when a task blocks
63
70
 
64
- A watcher runs your command when a task blocks. Put it in your board module,
65
- `~/.config/muster/board.ts`, and run `mu daemon run`:
71
+ A [watcher](../01-concepts/09-watchers.md#watchers) runs your command when a
72
+ task blocks. Put it in your
73
+ [board module](../01-concepts/17-board-module.md),
74
+ `~/.config/muster/board.ts`, and run `mu daemon run`, or
75
+ [keep the daemon running](./09-daemon.md):
66
76
 
67
77
  ```ts board.ts
68
78
  import { board, command } from '@openmuster/muster'
@@ -82,23 +92,26 @@ email. It gets the thread's ID, never the question's text, so nothing a
82
92
  stranger wrote ends up in a shell command. See
83
93
  [Watchers](../01-concepts/09-watchers.md).
84
94
 
85
- `kinds: ['!backlog']` leaves out tasks parked for later (below): they are
86
- blocked too, but nobody is asking you anything. Try a filter by hand first:
95
+ `kinds: ['!backlog']` leaves out tasks set aside for later (see
96
+ [Hold work for later](#hold-work-for-later)): they are blocked too, but
97
+ nobody is asking you anything. Try a filter by hand first:
87
98
  `mu tail work/ --type task.blocked --kind '!backlog'`.
88
99
 
89
- ## Work that isn't for now
100
+ ## Hold work for later
90
101
 
91
102
  Not every blocked task is a question. To write down work no agent should take
92
- yet, make it held:
103
+ yet, create it already blocked with
104
+ [`--hold`](../01-concepts/08-tasks.md#parking-work-for-later):
93
105
 
94
106
  ```bash steps
95
107
  mu tasks create work/payments "Move retries to the new provider." --hold backlog --reason "after the migration"
96
108
  mu tasks claim --ready work/payments --as claude || echo "nothing to take"
97
109
  ```
98
110
 
99
- The claim finds nothing: a `--ready` claim never takes a blocked task. The
100
- task is made and held in one write, so no agent can claim it in between. When
101
- its time comes, unblock it like any other:
111
+ The claim finds nothing: a `--ready` claim never takes a blocked task.
112
+ `--hold` creates and blocks the task in one write, so no agent can claim it in
113
+ between. When its time comes, unblock it like any other, with the ID `create`
114
+ printed (8 here):
102
115
 
103
116
  ```bash steps
104
117
  mu tasks unblock 8
@@ -108,16 +121,16 @@ mu tasks --state ready
108
121
  `backlog` is a convention, not a rule: any kind works, and the board treats
109
122
  them all alike. Pick one and filter on it.
110
123
 
111
- ## Approvals
124
+ ## Approve irreversible steps outside the board
112
125
 
113
- A message on a board does not prove who wrote it: an agent writes with its
114
- person's access. For anything that can't be undone (a merge, a deploy, a
115
- publish), have the agent ask for the approval somewhere identity is checked,
116
- such as a review on the pull request, and treat the board as where the
126
+ A message on a board does not prove who wrote it: an agent writes with the
127
+ access of the person who runs it. For anything that can't be undone (a merge,
128
+ a deploy, a publish), have the agent ask for approval where identity is
129
+ checked, such as a review on the pull request. Treat the board as where the
117
130
  question was asked.
118
131
 
119
- ## When not to
132
+ ## When not to ask a person
120
133
 
121
134
  Don't route every small choice to a person. Tell the agent which decisions are
122
- yours (spending, scope, anything irreversible) and let it make the rest and
123
- say why in a line.
135
+ yours (spending, scope, anything irreversible). Let it make the rest and say
136
+ why in a line.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Running unattended
3
- description: For leaving agents to work through a queue overnight on one machine. Write tasks a command can check, set a budget, start looping workers, and read in the morning what finished, what failed and what waits for you.
3
+ description: For anyone leaving agents to work through a queue overnight on one machine. You end with tasks a command can check, a budget, looping workers, and a morning read of what finished, what failed and what waits for you.
4
4
  ---
5
5
 
6
6
  ## Who this is for
@@ -12,12 +12,12 @@ this machine, without it costing more than you decided.
12
12
 
13
13
  ## Queue the work
14
14
 
15
- Each task is written for a reader who knows nothing: what to make, which files
16
- are theirs, and the command that shows it is done.
15
+ Write each task for a reader who knows nothing: what to make, which files are
16
+ theirs, and the command that shows it is done.
17
17
 
18
18
  Task IDs skip numbers (each task takes two places in the board's log), so the
19
19
  first task on a new board is 1 and the second is 3. Use the IDs `create`
20
- prints.
20
+ prints:
21
21
 
22
22
  ```bash steps
23
23
  mu tasks create work/api "Add input validation to POST /orders. You own apps/api/orders/. Done when pnpm test apps/api/orders passes." --as ada
@@ -27,43 +27,53 @@ mu tasks work/ --as ada
27
27
 
28
28
  ## Set a limit before you leave
29
29
 
30
+ Set a [budget](../01-concepts/13-budgets.md) on `work`, then check it:
31
+
30
32
  ```bash steps
31
33
  mu budget work 20 --as ada
32
34
  mu budget --as ada
33
35
  ```
34
36
 
35
- Once the tasks under `work` have cost 20 dollars, no new one can be claimed
36
- there. A budget counts what `mu run` records; it is a brake, not a bill. Set
37
- a spend limit with your model provider too.
37
+ Once the tasks under `work` have cost $20, the board refuses new claims
38
+ there. A budget counts only what `mu run` records: it stops new claims, and it
39
+ isn't your bill. Set a spend limit with your model provider too.
38
40
 
39
41
  ## Start workers that keep going
40
42
 
43
+ Start a worker that takes ready tasks one after another:
44
+
41
45
  ```bash
42
46
  mu run --ready work/ --loop --wait 10m --agent claude --as night-1
43
47
  ```
44
48
 
45
- `--loop` takes the next ready task, starts a fresh agent on it, and goes
46
- again. `--wait 10m` keeps it waiting that long for work before it stops. Run a
47
- second one under another name for two at a time.
49
+ `--loop` takes the next ready task, starts a fresh agent on it, then takes
50
+ the next one. `--wait 10m` keeps the worker waiting up to 10 minutes for work
51
+ before it stops. For 2 workers at a time, run a second one under another
52
+ name.
48
53
 
49
54
  ## What keeps it safe while you're away
50
55
 
51
- - **A task can't be taken twice.** One holder, under a lease.
56
+ While you are away, these hold:
57
+
58
+ - **A task can't be taken twice.** One agent holds it at a time, under a
59
+ [lease](../01-concepts/08-tasks.md#claims).
52
60
  - **A worker that dies loses its task.** Its claim lapses and the task goes
53
61
  back to the queue.
54
- - **A task that keeps failing is parked.** After two attempts that ended
55
- without a result the board blocks it as `failing`, so it stops eating
56
- tokens. It waits for you.
57
- - **A usage limit stops the worker,** it doesn't burn retries. The task it
58
- was on is left `failed`, with the limit as its reason: see below.
59
- - **A question blocks its task** and the worker moves to the next one.
62
+ - **A task that keeps failing is blocked.** After two attempts that ended
63
+ without a result the board blocks it as `failing`, so no agent spends more
64
+ tokens on it. It waits for you.
65
+ - **A usage limit stops the worker.** It doesn't spend retries on the limit.
66
+ The task it was on is left `failed`, with the limit as its reason: see
67
+ [Restart after a usage limit](#restart-after-a-usage-limit).
68
+ - **A question blocks its task.** The worker moves to the next one.
60
69
 
61
- ## After a usage limit
70
+ ## Restart after a usage limit
62
71
 
63
- The worker stops, because the next task would meet the same limit. The task
72
+ The worker stops, because the next task would fail on the same limit. The task
64
73
  it was working on is `failed`, and a failed task isn't taken again until its
65
74
  owner reopens it. Starting the worker again doesn't retry it. When the limit
66
- has lifted:
75
+ has lifted, list the failed tasks, reopen each by the ID the list shows (12
76
+ here), and start the worker again:
67
77
 
68
78
  ```bash
69
79
  mu tasks work/ --state failed
@@ -74,14 +84,17 @@ mu run --ready work/ --loop --wait 10m --agent claude --as night-1
74
84
  Read the reason before you reopen: a task that failed for another cause is
75
85
  in the same list. muster doesn't wait a limit out for you.
76
86
 
77
- ## Things that should happen on a clock
87
+ ## Schedule a morning check
78
88
 
79
- The daemon sends scheduled messages and runs watchers. Keep it running:
89
+ The [daemon](../01-concepts/09-watchers.md#the-daemon) sends scheduled
90
+ messages and runs watchers. Keep it running:
80
91
 
81
92
  ```bash
82
93
  mu daemon install
83
94
  ```
84
95
 
96
+ Then schedule a message for the morning, and check it is queued:
97
+
85
98
  ```bash steps
86
99
  mu schedule work/notes "morning check: what is blocked?" --in 8h --as ada
87
100
  mu schedule list --as ada
@@ -89,7 +102,9 @@ mu schedule list --as ada
89
102
 
90
103
  See [Keep the daemon running](./09-daemon.md).
91
104
 
92
- ## The morning after
105
+ ## Review the results in the morning
106
+
107
+ List every task, then the blocked ones, then what was spent:
93
108
 
94
109
  ```bash steps
95
110
  mu tasks work/ --state all --as ada
@@ -98,13 +113,17 @@ mu budget --as ada
98
113
  ```
99
114
 
100
115
  Read the blocked ones first: they are questions, or tasks that failed twice.
101
- A task held as `backlog` is work parked for later, not a question.
102
- Then the completed ones' results. `mu inspect` shows the same in a browser.
116
+ A task held as `backlog` is work set aside for later, not a question. Then
117
+ read the results of the completed ones. `mu inspect` shows the same in a
118
+ browser.
119
+
120
+ ## When not to run unattended
103
121
 
104
- ## When not to
122
+ Don't leave these to agents overnight:
105
123
 
106
124
  - Work whose result you can't check by a command. Unattended agents need a
107
125
  test to pass or fail, not taste.
108
126
  - Anything with access you wouldn't leave a contractor alone with. Local
109
127
  agents run with your access; see
110
- [Agents in cloud sandboxes](./06-sandboxed-agents.md) for a boundary.
128
+ [Agents in cloud sandboxes](./06-sandboxed-agents.md) for agents that run
129
+ apart from your machine.
@@ -1,38 +1,41 @@
1
1
  ---
2
2
  title: With your terminal
3
- description: For agents you run as interactive sessions in tmux, Herdr or Rex panes. A watcher wakes an idle pane by typing a pointer to what changed, after a gate checks that the agent is idle.
3
+ description: For anyone who runs agents as interactive sessions in tmux, Herdr or Rex panes. You end with a watcher that wakes an idle pane by typing a pointer to what changed, after a gate checks that the agent is idle.
4
4
  ---
5
5
 
6
6
  ## Who this is for
7
7
 
8
8
  You run agents as interactive sessions, each in its own terminal pane, and
9
- want them to work off one board. muster doesn't care which terminal you use:
10
- it never talks to one. This page is about the one thing terminals add, waking
11
- a session that is sitting idle.
9
+ want them to work off one board. muster never talks to a terminal, so any
10
+ terminal works. This page is about the one thing terminals add: waking a
11
+ session that is sitting idle.
12
12
 
13
13
  **You need:** muster, and your panes.
14
14
 
15
- ## The basics, in any terminal
15
+ ## Give each pane a profile
16
16
 
17
- One pane per agent. Each gets a name, set once in that pane's shell:
17
+ Use one pane per agent. Give each a
18
+ [profile](../01-concepts/06-actors.md) name, set once in that pane's shell:
18
19
 
19
20
  ```bash
20
21
  export MUSTER_PROFILE=worker-1
21
22
  ```
22
23
 
23
24
  Then tell the agent in that pane how to work: install the board skill
24
- (`mu skills install --to ~/.claude/skills`, or your agent's own skills
25
- folder), or paste `skills/board/SKILL.md` into its instructions.
26
- From there the agent takes tasks and waits on the board itself:
25
+ (`npx skills add openmuster/muster`, or
26
+ `mu skills install --to ~/.claude/skills`), or paste
27
+ `skills/board/SKILL.md` into its instructions. From there the agent takes
28
+ tasks and waits on the board itself:
27
29
 
28
30
  ```bash
29
31
  mu tasks claim --ready work/ --wait 10m
30
32
  mu wait --re 12 --after 31 --timeout 30m
31
33
  ```
32
34
 
33
- An agent that is mid-turn can wait like this. One that has ended its turn is
34
- idle, and nothing on the board can make it type. That is what the rest of this
35
- page is for.
35
+ `--re 12` waits on thread 12, and `--after 31` returns only events after
36
+ event 31. An agent that is mid-turn can wait like this. One that has ended
37
+ its turn is idle, and nothing on the board can make it type. That is what the
38
+ rest of this page is for.
36
39
 
37
40
  ## Two ways to get work to an idle agent
38
41
 
@@ -44,22 +47,26 @@ page is for.
44
47
  Prefer the first. A pane running `mu run --loop` is a worker that needs no
45
48
  waking and no terminal tooling.
46
49
 
47
- ## Waking a pane, safely
50
+ ## Wake a pane safely
48
51
 
49
- A watcher runs a command when a board event matches. To wake a pane, that
50
- command types one line into it. Three rules keep that from going wrong:
52
+ A [watcher](../01-concepts/09-watchers.md#watchers) runs a command when a
53
+ board event matches. To wake a pane, that command types one line into it.
54
+ Three rules keep that from going wrong:
51
55
 
52
- - **Type a pointer, never the message.** The line is `mu read <id>`. Text a
53
- stranger wrote must not be typed into a shell or an agent's prompt by a
54
- script.
55
- - **Only when the agent is idle.** Keys sent mid-turn land in the wrong place,
56
- and an Enter can answer a permission prompt. Use a gate that checks.
57
- - **One watcher per pane,** with the pane named in the watcher. Don't route by
56
+ - **Type a pointer, never the message.** The line is `mu read <id>`, a
57
+ [pointer](../01-concepts/09-watchers.md#what-a-wake-carries) to what
58
+ changed. A script must never type text a stranger wrote into a shell or an
59
+ agent's prompt.
60
+ - **Only when the agent is idle.** Keys sent mid-turn go into the agent's
61
+ input, and an Enter can answer a permission prompt. Use a
62
+ [gate](../01-concepts/09-watchers.md#a-gate) that checks.
63
+ - **One watcher per pane.** Name the pane in the watcher. Don't route by
58
64
  anything read from the board.
59
65
 
60
66
  ### tmux
61
67
 
62
- In your board module, `~/.config/muster/board.ts`:
68
+ In your [board module](../01-concepts/17-board-module.md),
69
+ `~/.config/muster/board.ts`:
63
70
 
64
71
  ```ts board.ts
65
72
  import { board, command } from '@openmuster/muster'
@@ -77,10 +84,11 @@ export default board({
77
84
  })
78
85
  ```
79
86
 
80
- Here `lead` is the tmux session the agent runs in; `tmux list-panes -a` shows
81
- every pane's address if you need one pane of several.
87
+ Here `lead` is the tmux session the agent runs in. To target one pane in a
88
+ session with several, `tmux list-panes -a` shows every pane's address.
82
89
 
83
- `wake-pane.sh`:
90
+ `wake-pane.sh` types the pointer into the pane and presses Enter. Put it at
91
+ the path the watcher's command names:
84
92
 
85
93
  ```bash
86
94
  #!/bin/sh
@@ -89,10 +97,11 @@ tmux send-keys -t "$1" -l "A task changed. Read it: mu read $2"
89
97
  tmux send-keys -t "$1" Enter
90
98
  ```
91
99
 
92
- `pane-idle.sh` decides whether now is a good time and prints its answer as its
93
- last line: `{"wake": false}` skips the wake, and the watcher tries again on
94
- the next event. What "idle" looks like depends on your agent; one way is to
95
- look at the pane's last line for the agent's input prompt:
100
+ `pane-idle.sh` is the gate. It checks whether the agent is idle and prints
101
+ its answer as its last line. `{"wake": false}` skips the wake, and the
102
+ watcher tries again on the next event. What "idle" looks like depends on your
103
+ agent. One way is to look at the pane's last line for the agent's input
104
+ prompt:
96
105
 
97
106
  ```bash
98
107
  #!/bin/sh
@@ -105,15 +114,17 @@ esac
105
114
 
106
115
  A watcher's command starts with a small, clean environment. If tmux needs a
107
116
  socket path, pass it: `tmux -S /path/to/socket ...`, or name the variable
108
- in `command()`'s `env`. Start the daemon with `mu daemon run`, then
109
- check that the pane wakes and its agent answers: `mu daemon check <watcher>`.
117
+ in `command()`'s `env`.
118
+
119
+ Start the daemon with `mu daemon run`. Then check that the pane wakes and its
120
+ agent answers: `mu daemon check <watcher>`.
110
121
 
111
122
  ### Herdr
112
123
 
113
124
  [Herdr](https://herdr.dev) is a terminal multiplexer for coding agents. It
114
125
  knows whether an agent is idle, so it does the gate's job itself: its
115
126
  `agent prompt` command submits text to a named agent and can wait until the
116
- agent has taken it.
127
+ agent has taken it:
117
128
 
118
129
  ```ts board.ts
119
130
  import { board, command } from '@openmuster/muster'
@@ -134,9 +145,10 @@ Run the daemon from inside the Herdr session, so `herdr` reaches it. Check
134
145
 
135
146
  ### Rex
136
147
 
137
- Rex is a terminal with a CLI that manages its sessions, tabs and panes. The
138
- same recipe applies: a watcher whose command asks `rex` to run a line in the
139
- pane that holds the agent. Its commands differ by version, so read
148
+ Rex is a terminal with a command-line interface (CLI) that manages its
149
+ sessions, tabs and panes. The same recipe applies: a watcher whose command
150
+ asks `rex` to run a line in the pane that holds the agent. Rex's commands
151
+ differ by version, so read
140
152
  `rex --help` for how to address a pane and send it input, and keep the three
141
153
  rules above.
142
154
 
@@ -145,8 +157,8 @@ rules above.
145
157
  > before you rely on it. The Herdr and Rex recipes follow those tools' docs
146
158
  > and haven't been run end to end.
147
159
 
148
- ## When not to
160
+ ## When not to wake panes
149
161
 
150
- If every agent can be a fresh session per task, skip waking altogether. It is
151
- simpler, costs less (no long conversation re-sent each turn), and survives a
152
- closed terminal.
162
+ If every agent can be a fresh session per task, skip waking altogether. It
163
+ needs no gate and no terminal scripts, costs less (no long conversation
164
+ re-sent each turn), and survives a closed terminal.