@openmuster/muster 0.0.0-stage → 0.3.1-alpha.3

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 (79) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +309 -2
  3. package/dist/args-DX9QSK1f.js +7043 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +31 -0
  6. package/dist/index.d.ts +2138 -0
  7. package/dist/index.js +1951 -0
  8. package/dist/inspect/app.js +163 -0
  9. package/dist/main-CdVlnWHy.js +6 -0
  10. package/dist/main-DgrIMbeA.js +3941 -0
  11. package/dist/mcp-NueWYyQs.js +6 -0
  12. package/dist/module-C-HJjWWo.js +4 -0
  13. package/dist/module-CxoN1MOe.js +439 -0
  14. package/dist/skills/board/SKILL.md +214 -0
  15. package/dist/skills/board/references/build-a-ui.md +63 -0
  16. package/dist/skills/board/references/claude.md +54 -0
  17. package/dist/skills/board/references/codex.md +61 -0
  18. package/dist/skills/board/references/software-factory.md +89 -0
  19. package/dist/skills/board/references/swarm.md +165 -0
  20. package/dist/skills/configure-factory/SKILL.md +116 -0
  21. package/dist/skills/loop-card/SKILL.md +95 -0
  22. package/dist/steps-DtzUdcBE.js +3175 -0
  23. package/docs/01-concepts/01-overview.md +78 -0
  24. package/docs/01-concepts/02-boards.md +71 -0
  25. package/docs/01-concepts/03-channels.md +56 -0
  26. package/docs/01-concepts/04-threads.md +73 -0
  27. package/docs/01-concepts/05-labels.md +65 -0
  28. package/docs/01-concepts/06-actors.md +66 -0
  29. package/docs/01-concepts/07-events.md +133 -0
  30. package/docs/01-concepts/08-tasks.md +248 -0
  31. package/docs/01-concepts/09-watchers.md +175 -0
  32. package/docs/01-concepts/10-schedules.md +39 -0
  33. package/docs/01-concepts/11-access.md +185 -0
  34. package/docs/01-concepts/12-files-and-data.md +79 -0
  35. package/docs/01-concepts/13-budgets.md +35 -0
  36. package/docs/01-concepts/14-runners.md +103 -0
  37. package/docs/01-concepts/15-outgoing-webhooks.md +177 -0
  38. package/docs/01-concepts/16-workflows.md +350 -0
  39. package/docs/01-concepts/17-board-module.md +124 -0
  40. package/docs/01-quickstart.md +140 -0
  41. package/docs/02-sync/01-overview.md +246 -0
  42. package/docs/02-sync/02-github.md +159 -0
  43. package/docs/02-sync/03-linear.md +290 -0
  44. package/docs/02-sync/04-slack.md +228 -0
  45. package/docs/02-sync/05-notion.md +94 -0
  46. package/docs/02-sync/meta.json +4 -0
  47. package/docs/03-guides/01-coding-agents.md +98 -0
  48. package/docs/03-guides/02-swarm.md +85 -0
  49. package/docs/03-guides/03-factory.md +212 -0
  50. package/docs/03-guides/04-inspector.md +69 -0
  51. package/docs/03-guides/05-running-agents.md +85 -0
  52. package/docs/03-guides/06-sandboxed-agents.md +427 -0
  53. package/docs/03-guides/07-build-a-ui.md +80 -0
  54. package/docs/03-guides/08-ci.md +176 -0
  55. package/docs/03-guides/09-daemon.md +104 -0
  56. package/docs/03-guides/10-two-agents.md +76 -0
  57. package/docs/03-guides/11-person-in-the-loop.md +123 -0
  58. package/docs/03-guides/12-unattended.md +110 -0
  59. package/docs/03-guides/13-terminals.md +152 -0
  60. package/docs/03-guides/14-no-cloud.md +82 -0
  61. package/docs/03-guides/15-several-boards.md +90 -0
  62. package/docs/03-guides/16-non-code.md +78 -0
  63. package/docs/03-guides/17-mcp.md +122 -0
  64. package/docs/03-guides/18-a-board-on-a-server.md +162 -0
  65. package/docs/03-guides/19-a-card-queue.md +261 -0
  66. package/docs/03-guides/20-a-feedback-loop.md +233 -0
  67. package/docs/03-guides/21-running-the-loop.md +203 -0
  68. package/docs/03-guides/22-building-from-linear.md +326 -0
  69. package/docs/03-guides/meta.json +32 -0
  70. package/docs/04-reference/01-cli.md +166 -0
  71. package/docs/04-reference/02-handle.md +410 -0
  72. package/docs/04-reference/03-http.md +158 -0
  73. package/docs/04-reference/04-events.md +72 -0
  74. package/docs/04-reference/05-errors.md +221 -0
  75. package/docs/04-reference/06-conformance.md +54 -0
  76. package/docs/04-reference/07-porting.md +116 -0
  77. package/docs/index.md +118 -0
  78. package/docs/meta.json +3 -0
  79. package/package.json +52 -3
@@ -0,0 +1,203 @@
1
+ ---
2
+ title: Running the feedback loop
3
+ description: For running the feedback loop once it is set up. Go live, choose who is trusted, plan and approve cards, answer blocked tasks, send a card round again, and fix one that stops.
4
+ ---
5
+
6
+ ## Who this is for
7
+
8
+ You set up [a feedback loop](./20-a-feedback-loop.md) and now run it: cards
9
+ come in from Slack, Linear, GitHub, Notion or your app, agents work them, and you
10
+ step in when a card needs you. This page is what you do then, in the order
11
+ it comes up.
12
+
13
+ **You need:** the loop's `board.ts` and `workflows.json` (in
14
+ `templates/loop`), a host the platforms and the sandboxes can reach, and the
15
+ keys the guide lists.
16
+
17
+ ## Go live
18
+
19
+ 1. **The board's address.** The platforms' webhooks and the sandboxes reach
20
+ the board over HTTPS: a named tunnel or a proxy to `mu serve`'s port. Put
21
+ the address in the environment as `MUSTER_SANDBOX_URL`, ending in
22
+ `/api/board`.
23
+ 2. **The workflows.** Copy `workflows.json` to `~/.config/muster/` and set
24
+ `repo` in each of its three workflows to your repository.
25
+ 3. **Who is trusted.** Set `LOOP_TRUSTED` to the actor IDs who may start work
26
+ without an approval and may approve: `slack:user:U0123`,
27
+ `lin:user:<uuid>`, an app's `<your principal>+<profile>`. You, with no
28
+ profile, always are. A GitHub author never is.
29
+ 4. **Where you hear.** Set `NOTIFY_CMD` to a command that takes one line: a
30
+ push to your phone, a message to yourself. Without it the loop tells you
31
+ nothing, and you read the board.
32
+ 5. **A budget.** Cap what the cards may cost, every run under them included:
33
+
34
+ ```bash
35
+ mu budget cards 25
36
+ ```
37
+
38
+ 6. **Start it**, with the secrets `board.ts` names in its environment:
39
+
40
+ ```bash
41
+ mu serve --module "$PWD/templates/loop/board.ts" --allow-host board.example.com
42
+ ```
43
+
44
+ 7. **Point each platform at it**, at `https://<host>/api/board/webhooks/<key>`,
45
+ where `<key>` is the sync's name in `board.ts`: `slack`, `lin`, `gh`,
46
+ `nt`. Each platform's page says what to subscribe to and which scopes its
47
+ token needs: [Slack](../02-sync/04-slack.md),
48
+ [Linear](../02-sync/03-linear.md), [GitHub](../02-sync/02-github.md),
49
+ [Notion](../02-sync/05-notion.md). Notion's webhook is verified once
50
+ first: start with `NOTION_WEBHOOK_SECRET=pending`, and follow its page.
51
+ 8. **Who the loop writes as.** What the loop says on a platform is written
52
+ by an app of its own, not by you, once each platform has one:
53
+
54
+ | Platform | What to set up | In the environment |
55
+ | --- | --- | --- |
56
+ | GitHub | The GitHub App your workers push with, with read and write on Issues added and accepted on the organization | `GITHUB_APP_ID`, `GITHUB_APP_KEY_FILE` |
57
+ | Linear | An OAuth application with client credentials tokens turned on. One made for the board: such a token replaces an installation of the same application made through the authorization page | `LINEAR_CLIENT_ID`, `LINEAR_CLIENT_SECRET`, and `LINEAR_APP_WEBHOOK_SECRET` with `agent: true` to show the issue being worked on |
58
+ | Slack | The bot you already have. To show "is working" under a thread while a card is worked on, turn on the app's agent feature, reinstall it, and add `agent: true` to `slack()` in `board.ts`. Slack doesn't let an app stop being an agent | `SLACK_BOT_TOKEN`, `SLACK_SIGNING_SECRET` |
59
+ | Notion | The integration's own token: it already writes as the integration | `NOTION_TOKEN`, `NOTION_WEBHOOK_SECRET` |
60
+
61
+ Each sync page says more: [GitHub](../02-sync/02-github.md#who-the-comments-are-by),
62
+ [Linear](../02-sync/03-linear.md#who-the-comments-are-by),
63
+ [Slack](../02-sync/04-slack.md#show-a-thread-being-worked-on). To check,
64
+ reply on a card from each source and look at who wrote the comment there.
65
+ A reply by someone in `LOOP_TRUSTED` on a card held `working` starts
66
+ another round, so check on a card that isn't being worked on.
67
+ 9. **Your app's button.** Make it a token that can only post reports, and
68
+ keep it on the app's server:
69
+
70
+ ```bash
71
+ mu token create --as pino-app --can 'cards/app=post' --ttl 90d
72
+ ```
73
+
74
+ Then file one report from each source and watch it go through: held
75
+ `triage`, a spec on the card, `working`, a pull request.
76
+
77
+ ## What a card shows while it works
78
+
79
+ Each run on a card, triage and then the work, starts with one reply from
80
+ `mu serve`: `started card: 3 tasks in cards/slack/card-57`. That reply is edited
81
+ as the run goes, to say where each task is (`#58 completed, #59 claimed, #60
82
+ waiting`), so the thread on Slack, GitHub or Notion shows one comment that
83
+ changes. When the run ends, its summary is a new reply, with each task's
84
+ result and the pull request, so everyone following the thread is told.
85
+
86
+ On Slack, with `agent: true`, that reply isn't posted: the thread shows
87
+ "<app> is working" under it while a run is open, and the summary when it
88
+ ends. On Linear, with `agent: true`, the issue shows the application's agent
89
+ session working, with where the run is, and its last words as the session's
90
+ response. Without it, Linear gets the reply as first written, since edits
91
+ don't go to Linear.
92
+
93
+ ## What you hear about
94
+
95
+ | The line | What to do |
96
+ | --- | --- |
97
+ | `card #12 needs your approval` | Read the spec on the card, then approve it or leave it |
98
+ | `task #31 is blocked` | An agent needs a decision: answer it |
99
+ | `card #12's change is done for now` | Review the pull request, and reply on the card if it needs another round |
100
+ | `card #12 has a plan to read` | Read the planner's answer on the card: reply to it, or move the card to ready |
101
+ | `card #12 looks like a duplicate of #9` | Read both. Cancel #12, or label it `approved=yes` to work it anyway |
102
+ | `card #12 was declined` | Read the triage's summary on the card: edit the report, move it to ready again, or cancel it |
103
+
104
+ ## Start and park cards
105
+
106
+ A card from Notion or Linear follows its status: move the page to Ready or
107
+ the issue to Todo to start it, and to Not started or Backlog to park it. The
108
+ loop sets In progress and Done itself. A card from anywhere else is ready
109
+ when it comes in; park or start it with a label:
110
+
111
+ ```bash
112
+ mu label 12 stage=backlog
113
+ mu label 12 stage=ready
114
+ ```
115
+
116
+ ## Plan a card
117
+
118
+ Move a card to planning (Notion's Planning, Linear's Triage, or
119
+ `stage=planning`) and an agent answers on it with questions and a draft. Reply
120
+ on the card to answer; each reply is its next round. Move it to ready when the
121
+ draft is right: the triage writes the spec from it.
122
+
123
+ ## Approve a card
124
+
125
+ A report from someone not in `LOOP_TRUSTED` waits, held `approval`, with the
126
+ triage agent's spec as a reply on it. Read the spec, not only the report: the
127
+ spec is what the work will do.
128
+
129
+ ```bash
130
+ mu read 12
131
+ mu label 12 approved=yes
132
+ ```
133
+
134
+ The inspector's label does the same. A label
135
+ from anyone not trusted does nothing. If the report changes after the spec
136
+ was written, it is triaged again, and you approve the new spec.
137
+
138
+ ## Answer a blocked task
139
+
140
+ An agent that can't go on without a decision blocks its task with where
141
+ things stand, `->`, and what it needs. Answer in the task's thread, then
142
+ unblock it, as yourself:
143
+
144
+ ```bash
145
+ mu tasks cards/ --state blocked
146
+ mu read 31
147
+ mu reply 31 "Keep the old heading."
148
+ mu tasks unblock 31
149
+ ```
150
+
151
+ A worker takes it again: the run's own, if it is still waiting for work, or
152
+ one the loop starts for that run.
153
+
154
+ ## Another round
155
+
156
+ Once a card's run has ended, a reply on the card by someone trusted sends the
157
+ work and its review back with that reply, and the work carries on from its
158
+ branch: the same pull request gets another commit. Reply where the card is:
159
+ in the Slack thread, on the Linear issue, on the GitHub issue, on the Notion
160
+ page, or on the board.
161
+
162
+ - **One round at a time.** A reply made while a round runs waits for it to
163
+ end, and goes into the next.
164
+ - **Several replies** made between rounds go into one round together.
165
+ - **A review comment on the pull request** doesn't start one: reply on the
166
+ card.
167
+
168
+ ## When something stops
169
+
170
+ | What you see | Why | What to do |
171
+ | --- | --- | --- |
172
+ | A card held `declined` | The triage agent found nothing to change in this repository, or stopped; its summary on the card says which | Edit the report to say more, or move it to ready again (`mu label 12 stage=ready`, or the page's Status): it is triaged again. Or cancel it: `mu tasks cancel 12` |
173
+ | A card stays `approval` | Nobody trusted has approved it | Approve it, or cancel it |
174
+ | A task held `push_conflict`, a `push` label on the work | Someone pushed to `mu/task-<id>` while the agent worked; the branch was left as they left it | Read the branch. Then reply on the card: the next round starts from the branch as it is now |
175
+ | A task held `push_failed` | GitHub refused the push. The reply on the task quotes what it said | Fix what it names (the App's Contents permission, a rule on the branch), then reply on the card. If it names nothing you can fix, reply on the card to try again |
176
+ | Workers stop with `over_budget`, and nothing is claimed | The cards have spent their budget | Raise it (`mu budget cards 50`), or wait |
177
+ | A card held `edited` for a moment | Its author changed the report | Nothing: it is triaged again, or parked again |
178
+ | A card stays `backlog` though its page says Ready | The status was set by someone other than the sync, or Notion's webhook didn't reach the board | Move it out of Ready and back in Notion; check the webhook's deliveries |
179
+ | `couldn't set its Notion status` on the card | The integration can't edit the page, or the database has no option by that name | Give the integration "Update content", or add the option, or change `write` in `LOOP_STAGES` |
180
+ | A card held `done` | The review approved it, but the card couldn't be completed (its budget is spent, say) | Nothing: a trusted reply starts another round as usual |
181
+ | No card for a report | The source isn't reaching the board | `mu daemon status` names the module's sync; check the platform's webhook deliveries |
182
+
183
+ ## Rotate and stop
184
+
185
+ Replace an app's token by making a new one, giving it to the app, and
186
+ revoking the old:
187
+
188
+ ```bash
189
+ mu token list
190
+ mu token revoke Xk3v9QmB2a1c
191
+ ```
192
+
193
+ To stop the loop, stop `mu serve`. What the platforms send while it is down
194
+ doesn't reach it. When it starts again the board catches up, within each
195
+ platform's limits. GitHub and Linear catch up only with a token or an app.
196
+ Slack can miss a reply in an older thread. Notion misses a comment on a page
197
+ that didn't otherwise change. On GitHub, Linear and Slack, edits and deletes
198
+ made meanwhile are not read. Each
199
+ platform's page says what its catch-up misses: [GitHub](../02-sync/02-github.md#catching-up),
200
+ [Linear](../02-sync/03-linear.md#catching-up),
201
+ [Slack](../02-sync/04-slack.md#after-downtime),
202
+ [Notion](../02-sync/05-notion.md#catching-up). To take a source out, remove its sync from `board.ts` and its
203
+ webhook from the platform.
@@ -0,0 +1,326 @@
1
+ ---
2
+ title: Building from Linear
3
+ description: For a team or a solo builder who plans in Linear and wants coding agents to build it. Keep the spec in the repository, move an issue to Todo, and get a pull request back on it, with screenshots, and another round from any comment.
4
+ ---
5
+
6
+ ## Who this is for
7
+
8
+ You plan in Linear: a project with goals, milestones and issues. You want
9
+ agents to build it while you do something else, and you want to steer them
10
+ from Linear, on your desktop or the Linear app on your phone, with GitHub
11
+ holding the change.
12
+
13
+ This guide is the Linear side of the [feedback loop](./20-a-feedback-loop.md)
14
+ template. That guide and [Running the feedback loop](./21-running-the-loop.md)
15
+ cover the machinery. This one covers how to lay out the project, the spec and
16
+ the issues so agents build the right thing, and what you do from where.
17
+
18
+ ## How it fits together
19
+
20
+ Each of these lives in one place:
21
+
22
+ | What | Where | Why there |
23
+ | --- | --- | --- |
24
+ | Goals, milestones and the order of work | The Linear project | People read and reorder it there |
25
+ | The build prompt: hard rules, goals, how an agent shows its work | `AGENTS.md` and a spec file in the repository | Every agent reads the repository. A Linear document never reaches its sandbox |
26
+ | One change | One Linear issue, which is one card and one pull request | A card is one branch |
27
+ | Questions and decisions about a change | Comments on the issue | They reach the agents, and stay with the issue |
28
+ | The change itself | The pull request | Linear shows its address, the summary and screenshots as comments |
29
+ | Who may start work | `LOOP_TRUSTED` | An issue from anyone else waits for your approval |
30
+
31
+ A change goes through these steps. You move an issue into Triage, Backlog
32
+ and Todo; the loop moves it to In Progress and Done:
33
+
34
+ ```mermaid
35
+ flowchart LR
36
+ T[Triage] -->|planner asks, you answer in comments| T
37
+ T -->|you move it| Todo
38
+ B[Backlog] -->|you move it| Todo
39
+ Todo -->|triage writes the spec| S{trusted?}
40
+ S -->|no| A[waits for approval]
41
+ A -->|approved=yes| W
42
+ S -->|yes| W[In Progress: spec, work, review in sandboxes]
43
+ W -->|review approves| D[Done]
44
+ D -->|your comment| W
45
+ W -->|your comment| W
46
+ ```
47
+
48
+ ## What you need
49
+
50
+ - A board that Linear's webhooks can reach: [A board on a server](./18-a-board-on-a-server.md).
51
+ - The loop template set up from a clone of the repository:
52
+ [A feedback loop](./20-a-feedback-loop.md#set-it-up), then
53
+ [Running the feedback loop](./21-running-the-loop.md#go-live).
54
+ - A Linear OAuth application with client credentials tokens turned on, so
55
+ comments and status changes come from the app, not from you:
56
+ [Linear sync](../02-sync/03-linear.md#who-the-comments-are-by).
57
+ - A GitHub App that can push to the repository, and a cloud runner for the
58
+ agents: [Agents in cloud sandboxes](./06-sandboxed-agents.md).
59
+ - `AGENTS.md` and a spec in the repository, written for an agent. See below.
60
+
61
+ ## Set up Linear for agents
62
+
63
+ **Give the codebase one team.** The loop's workflows build one repository
64
+ (`repo` in `workflows.json`), and sync maps a team to a channel. In the
65
+ template's `board.ts`, map the team whose issues are about this repository,
66
+ and no other:
67
+
68
+ ```ts board.ts
69
+ import { env, linear } from '@openmuster/muster'
70
+
71
+ export const sync = {
72
+ lin: linear({
73
+ secret: env('LINEAR_WEBHOOK_SECRET'),
74
+ clientId: env('LINEAR_CLIENT_ID'),
75
+ clientSecret: env('LINEAR_CLIENT_SECRET'),
76
+ teams: { ENG: 'cards/linear' },
77
+ }),
78
+ }
79
+ ```
80
+
81
+ **Keep the statuses the loop reads.** A card follows its issue's status:
82
+
83
+ | Linear status | The card | Who sets it |
84
+ | --- | --- | --- |
85
+ | Triage | Planning: an agent asks questions and drafts | You |
86
+ | Backlog | Parked: nothing runs | You |
87
+ | Todo | Triaged into a spec, then built | You |
88
+ | In Progress | Being built | The loop, when the work starts |
89
+ | Done | The review approved the change | The loop |
90
+ | Canceled, Duplicate | Canceled | You |
91
+
92
+ Moving an issue to In Progress or Done yourself moves nothing: those are the
93
+ statuses the loop writes. A status the loop doesn't know parks the card. If
94
+ your team's statuses have other names, map them with `LOOP_STAGES`
95
+ ([Stages](./20-a-feedback-loop.md#stages)).
96
+
97
+ **Trust yourself.** An issue starts work without an approval only if its
98
+ author is in `LOOP_TRUSTED`. Linear users appear on the board by their user
99
+ ID, so comment on any synced issue and read the ID off the reply:
100
+
101
+ ```bash
102
+ mu read cards/linear
103
+ export LOOP_TRUSTED=lin:user:3f2a9c1e-4b7d-4e0a-9a51-7c2d8e6b1f03
104
+ ```
105
+
106
+ Everyone else's issues wait for an approval. A GitHub author is never
107
+ trusted.
108
+
109
+ **Show the issue as worked on.** With `agent: true`, the issue shows the
110
+ app's agent session while a run works on it, with where the run is, and the
111
+ run's last words as the session's response. It needs the OAuth application's
112
+ own webhook, with only Agent session events, and its signing secret:
113
+
114
+ ```ts board.ts
115
+ import { env, linear } from '@openmuster/muster'
116
+
117
+ export const sync = {
118
+ lin: linear({
119
+ secret: env('LINEAR_WEBHOOK_SECRET'),
120
+ clientId: env('LINEAR_CLIENT_ID'),
121
+ clientSecret: env('LINEAR_CLIENT_SECRET'),
122
+ agent: true,
123
+ appSecret: env('LINEAR_APP_WEBHOOK_SECRET'),
124
+ teams: { ENG: 'cards/linear' },
125
+ }),
126
+ }
127
+ ```
128
+
129
+ Without it, the issue gets the run's first progress comment as it was first
130
+ written, and the summary when the run ends.
131
+
132
+ ## Write the spec once, in the repository
133
+
134
+ Every agent in the loop reads `AGENTS.md` and the project's spec before
135
+ anything else. They run in sandboxes with a clone of the repository and the
136
+ card, and nothing else: a spec kept only in a Linear document is one they
137
+ never see. Commit it, have `AGENTS.md` point to it, and link it from the
138
+ Linear project's description so people find it too.
139
+
140
+ Write it as a brief to an agent:
141
+
142
+ ```markdown SPEC.md
143
+ # Inbox: build prompt
144
+
145
+ You are building Inbox, a keyboard-first desktop mail client for one user,
146
+ in React and TypeScript.
147
+
148
+ ## Hard rules
149
+
150
+ - Never send real email in tests, CI, demo mode or screenshots. Tests use mocks.
151
+ - Every pull request passes `pnpm test` and `pnpm typecheck`.
152
+ - Every pull request that changes the UI includes screenshots (see 5).
153
+
154
+ ## Goals
155
+
156
+ 1. Instant. Everything renders from a local store. (2)
157
+ 2. Calm. One centred feed, monochrome, the system font. (3)
158
+ 3. Keyboard first. Every action has a shortcut and is in the ⌘K menu. (4)
159
+
160
+ ## 5. Screenshots
161
+
162
+ `pnpm demo` runs the app in a browser with sample mail and no account.
163
+ Screenshot the screens your change touches, in light and dark.
164
+ ```
165
+
166
+ - **Hard rules first:** what must never happen, and what every pull request
167
+ must have.
168
+ - **Goals, numbered,** each pointing to the section that details it.
169
+ - **A way for the agent to see its work.** A demo mode with sample data lets
170
+ an agent build, test and screenshot in a sandbox with no credentials. The
171
+ work agent takes the screenshots the spec asks for, and no others: a spec
172
+ that asks for none gets none.
173
+
174
+ ## Plan a feature with an agent
175
+
176
+ Put a new feature in **Triage**. The loop gives it a planner: an agent that
177
+ reads the issue and the repository, builds nothing, and answers on the issue
178
+ with its questions, numbered, and a draft of the change.
179
+
180
+ 1. Answer in a comment. Each comment by someone trusted is the planner's next
181
+ round, from Linear on your desktop or your phone.
182
+ 2. When the change is too big for one pull request, the planner says how it
183
+ would split it. File each part as its own issue in the project, under its
184
+ milestone, in the order they build on each other. The planner doesn't file
185
+ issues itself.
186
+ 3. Move the issue to **Todo** when the draft is right. The triage writes the
187
+ spec from the planner's newest draft and what was said on the issue since.
188
+
189
+ For a whole project, start with one issue in Triage that describes it
190
+ ("Plan the first version of Inbox"), answer the planner, then file the split
191
+ it suggests as the project's issues.
192
+
193
+ ## Write issues an agent can finish
194
+
195
+ - **Change the issue itself until the work starts.** An edited title or
196
+ description reaches the board, and the issue is triaged again from its new
197
+ text. A comment made before the work starts doesn't reach the triage; in
198
+ Triage it goes to the planner. Once the issue is In Progress, say changes in
199
+ a comment: that is what starts another round.
200
+ - **One issue, one pull request.** A card is one branch. Split anything
201
+ bigger.
202
+ - **Say how to check it.** The triage writes the spec as a title, what to
203
+ change and why, and how to check it works. The closer the issue is to that,
204
+ the less it has to guess.
205
+ - **Order dependent issues yourself.** Every issue in Todo gets its own run,
206
+ at once, each starting from the default branch. Move an issue that builds
207
+ on another to Todo once the other's pull request is merged. Issues that
208
+ touch different code can go together.
209
+ - **Cap the spend.** `mu budget cards 50` stops new work on cards once they
210
+ have cost $50 in all.
211
+ - Labels, the assignee, the priority and the project arrive as labels on the
212
+ card (`tag.bug=bug`, `priority=high`), for your own filters. The loop
213
+ doesn't route on them.
214
+
215
+ ## Let it build
216
+
217
+ Move the issue to Todo. On the issue you see, in order:
218
+
219
+ 1. **The spec,** written by the triage, as a comment. If the triage finds
220
+ nothing to change in this repository, it says why, and the card is held
221
+ `declined`. Edit the issue to say more, and it is triaged again. Or move
222
+ it to Triage and work it out with the planner first.
223
+ 2. **Approval,** for an issue whose author isn't trusted. The card waits
224
+ until someone trusted runs `mu label <card> approved=yes`, or sets the
225
+ label in the inspector. Read the spec, not only the issue: the spec is what
226
+ the work does.
227
+ 3. **In Progress,** set by the loop, and the agent session working, with
228
+ `agent: true`.
229
+ 4. **The summary** when the run ends: each step's result, and the pull
230
+ request's address. The work pushes `mu/task-<id>` and opens the pull
231
+ request, titled with the card's title.
232
+ 5. **The screenshots** of the round, uploaded to Linear and linked from the
233
+ comment. Experimental: files sent through an OAuth app haven't been
234
+ checked against a live workspace.
235
+ 6. **Done,** set by the loop when the review approves. Merging the pull
236
+ request is yours.
237
+
238
+ ## Iterate from Linear
239
+
240
+ - **Comment on the issue** for another round on the same pull request: the
241
+ comment goes to the agent, the work and its review run again, and the
242
+ commit lands on the same branch. A comment made while a round runs waits
243
+ for it to end. A comment on an issue that is Done reopens it, and the loop
244
+ sets In Progress again.
245
+ - **Comment on the issue, not on the pull request.** A comment on the pull
246
+ request doesn't start a round.
247
+ - **Keep the decision on the issue.** "The accent should be this colour" is a
248
+ comment on the issue. How the agent got there is the pull request's
249
+ business.
250
+
251
+ ## What needs the board
252
+
253
+ Most of the work happens in Linear. Three things don't:
254
+
255
+ | To do this | Do it here |
256
+ | --- | --- |
257
+ | Start, park, plan or cancel a change | Linear: the issue's status |
258
+ | Answer the planner, or ask for another round | Linear: a comment on the issue |
259
+ | Approve someone else's issue | The board: `mu label <card> approved=yes`, or the inspector |
260
+ | Answer an agent that blocked on a decision | The board: `mu reply <task> "…"`, then `mu tasks unblock <task>` |
261
+ | See what waits on you | The board: `mu tasks cards/ --state blocked`, or `NOTIFY_CMD` |
262
+
263
+ An agent that blocks mid-run blocks its own task, which isn't the card, so
264
+ its question doesn't reach Linear. Set `NOTIFY_CMD` so you hear about it:
265
+ [What you hear about](./21-running-the-loop.md#what-you-hear-about).
266
+
267
+ ## Feedback from the app you are building
268
+
269
+ Paper cuts don't need planning. Give the app a token that can only post
270
+ reports, and send them from the app's server:
271
+
272
+ ```bash
273
+ mu token create --as my-app --can 'cards/app=post' --ttl 90d
274
+ ```
275
+
276
+ A report from the app is ready when it arrives: the triage turns it into a
277
+ card, which waits for your approval unless the app's reports are trusted
278
+ ([Your app's feedback button](https://github.com/openmuster/muster/tree/main/templates/loop#your-apps-feedback-button)).
279
+ Use Triage in Linear for what you want to talk through first, and Todo for
280
+ what you already know.
281
+
282
+ ## Coming back later
283
+
284
+ Everything about a change is on its issue: the spec, each round's summary
285
+ and screenshots, and the pull request. The project's issue list says what is
286
+ done, what is in progress and what is next. On the board,
287
+ `mu tasks cards/ --state blocked` lists what waits on you.
288
+
289
+ ## When not to
290
+
291
+ - **For work you can't split into pull-request-sized issues.** A card is one
292
+ branch.
293
+ - **With the spec only in Linear.** Agents read the repository.
294
+ - **For issues from people you wouldn't hand an agent.** Approval is per
295
+ card: read each spec before you approve it.
296
+ - **For a single label-triggered pass with no rounds.**
297
+ [A card queue](./19-a-card-queue.md) is smaller: label an issue `agent` and
298
+ get a spec, a pull request and a review back once.
299
+
300
+ ## What goes wrong
301
+
302
+ - **Nothing happens when an issue moves to Todo.** The webhook isn't reaching
303
+ the board (Linear's webhook settings list each delivery; `mu daemon status`
304
+ names the sync), the issue is in a team that isn't mapped, or its status
305
+ has a name the loop doesn't know, which parks it.
306
+ - **A round ignores what you wrote in the description.** The issue was
307
+ edited after its work started. Say the change in a comment, which starts a
308
+ round.
309
+ - **A card waits for approval on your own issue.** Your Linear user ID isn't
310
+ in `LOOP_TRUSTED`.
311
+ - **The status doesn't change.** The loop writes it as the OAuth app, with
312
+ its sync's scopes. Linear ends an app's earlier tokens when one is asked for
313
+ with other scopes, so a sync given its own `scopes` needs the same in its
314
+ `SOURCES` entry ([Stages](./20-a-feedback-loop.md#stages)).
315
+ - **Two pull requests conflict.** Two issues in Todo changed the same code.
316
+ Merge one, resolve the other's branch, then comment on its issue if it
317
+ needs another round: the round starts from the branch as you left it.
318
+
319
+ ## Next
320
+
321
+ - [A feedback loop](./20-a-feedback-loop.md): every stage, planning, related
322
+ and duplicate cards.
323
+ - [Running the feedback loop](./21-running-the-loop.md): going live,
324
+ approving, answering, and what to do when something stops.
325
+ - [Linear sync](../02-sync/03-linear.md): what comes in, what goes back, and
326
+ the OAuth app.
@@ -0,0 +1,32 @@
1
+ {
2
+ "title": "Guides",
3
+ "pages": [
4
+ "---Agents on a board---",
5
+ "01-coding-agents",
6
+ "05-running-agents",
7
+ "04-inspector",
8
+ "13-terminals",
9
+ "17-mcp",
10
+ "---Work from your tools---",
11
+ "22-building-from-linear",
12
+ "20-a-feedback-loop",
13
+ "21-running-the-loop",
14
+ "19-a-card-queue",
15
+ "03-factory",
16
+ "08-ci",
17
+ "---Patterns---",
18
+ "10-two-agents",
19
+ "11-person-in-the-loop",
20
+ "12-unattended",
21
+ "02-swarm",
22
+ "16-non-code",
23
+ "---Where it runs---",
24
+ "15-several-boards",
25
+ "09-daemon",
26
+ "14-no-cloud",
27
+ "18-a-board-on-a-server",
28
+ "06-sandboxed-agents",
29
+ "---Build your own---",
30
+ "07-build-a-ui"
31
+ ]
32
+ }