@orchestraworks/cli 0.5.0 → 0.5.2

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: orchestra-fdk
3
- description: Use when building and applying an Orchestra factory with the factory development kit for a developer's codebase - installing the kit, signing in, the bug-fix fast path (one agent, one bug, a pull request), writing the engineering-team starter, explaining its plan, the first apply without tokens, proving the machines locally first and applying them, the "Set up" item that runs the repository from a git bundle, the role grant, then connecting the code host and the tracker, and starting Study. Reads the orchestra skill for the platform's ideas and references/environment.md for the machines.
3
+ description: Use when building and applying an Orchestra factory with the factory development kit for a developer's codebase - installing the kit, signing in, looking at the account to tell a new factory from a new environment for an existing one, the bug-fix fast path (one agent, one bug, a pull request), writing the engineering-team starter, explaining its plan, choosing how the agents reach a model, the first apply without tokens, proving the machines locally first and applying them, the "Set up" item that runs the repository from a git bundle, the steps the code cannot declare, connecting the code host and the tracker, and starting the Bootstrap. Reads the orchestra skill for the platform's ideas and references/environment.md for the machines.
4
4
  ---
5
5
 
6
6
  # Build and apply an Orchestra factory
@@ -14,6 +14,10 @@ The `orchestra` skill explains every idea named here, how the CLI works, and wha
14
14
  When this skill says "orchestra skill, section N", read that section of `orchestra/SKILL.md` in your skill
15
15
  folder. Use it to answer a case the steps do not cover, and never promise one of its "Cannot yet" lines.
16
16
 
17
+ The CLI's own help is the full list of commands and flags: `orchestra --help` and
18
+ `orchestra <noun> <verb> --help`. The kit's reference, `docs/REFERENCE.md`, ships in the package;
19
+ `references/authoring.md` says how to find it. This skill names a flag only where a step needs it.
20
+
17
21
  Ask questions with your question tool: `AskUserQuestion` in Claude Code, its counterpart in Codex. Ask one
18
22
  thing at a time. Never ask the developer to paste a token into the chat.
19
23
 
@@ -21,12 +25,12 @@ thing at a time. Never ask the developer to paste a token into the chat.
21
25
 
22
26
  `orchestra fdk init` without `--template` writes the bug-fix starter: one agent that takes a bug as its
23
27
  first message and answers with a pull request and a report. Take this path when the developer wants one bug
24
- fixed in a GitHub repository. Do steps 1 and 2 below first. Then:
28
+ fixed in a GitHub repository. Do steps 1 to 3 below first. Then:
25
29
 
26
30
  1. Make a new folder beside the codebase, `<codebase>/../orchestra-factory`, called `<factory>`. In it, run
27
31
  `npm init -y`, then `npm install @orchestraworks/cli`.
28
32
  2. Write the starter. `<owner>/<name>` is the GitHub repository. Add `--model-key anthropic` or
29
- `--model-key openai` only when the organization brings its own model key.
33
+ `--model-key openai` only when the organization brings its own model key to the model gateway (step 6).
30
34
 
31
35
  ```bash
32
36
  npx orchestra fdk init --repository <owner>/<name>
@@ -40,12 +44,15 @@ fixed in a GitHub repository. Do steps 1 and 2 below first. Then:
40
44
  `ORCHESTRA_FDK_MODEL_GATEWAY_HOST`, `ORCHESTRA_FDK_IMAGE_PULL_ACCESS_KEY_ID` and
41
45
  `ORCHESTRA_FDK_IMAGE_PULL_SECRET_ACCESS_KEY`, plus `ORCHESTRA_FDK_ANTHROPIC_API_KEY` or
42
46
  `ORCHESTRA_FDK_OPENAI_API_KEY` with `--model-key`. Ask the developer to write them into a file only they
43
- can read, as in step 9, and load it in each command that runs `orchestra`:
47
+ can read, as in step 6, and load it in each command that runs `orchestra`:
44
48
  `set -a; . ~/.config/orchestra/fdk-inputs.env; set +a`. Docker on this computer must also be signed in
45
49
  to the image registry, with the details in the same note.
46
50
  6. Run `npx orchestra fdk diff` and show the developer the change list. On their yes, run
47
- `npx orchestra fdk apply --require-approval never`. It builds and pushes the image, then prints a GitHub
48
- App install link and waits until the developer installs the app. Give them the link.
51
+ `npx orchestra fdk apply --require-approval never --install-timeout 0`. It builds and pushes the image,
52
+ prints a GitHub App install link, and stops without waiting. The link is shown once. Give it to the
53
+ developer, and ask them to say when the app is installed. Then run the same apply again: it finds the
54
+ installation and applies the rest. If the link was lost, add `--remint-install-links` to the apply. That
55
+ revokes the old link and prints a new one.
49
56
  7. Send the bug. The agent's id is `<factory name>-bugfix`, where the factory name is the one `init` printed:
50
57
 
51
58
  ```bash
@@ -75,21 +82,22 @@ Do them in order. Each step ends with a check. Do not go on until the check pass
75
82
  Before every apply, run the check in `references/environment.md` under "Before any cloud apply". It
76
83
  removes every local-only credential from the factory code.
77
84
 
85
+ A *clean diff* is a `npx orchestra fdk diff` that creates, updates and deletes no agent, environment or
86
+ pipeline. While a token or key is loaded, each secret it fills shows `value-write-pending` on every diff, even
87
+ right after an apply. That is expected, and a clean diff may show it.
88
+
78
89
  The factory is applied three times. The first apply comes before any token or input, so the developer sees
79
90
  the agents and pipelines first. The second apply adds the machine setup, after you prove it on this computer.
80
91
  The third apply adds the code host and tracker tokens and the inputs.
81
92
 
82
- After the first apply, the steps follow the Onboarding order:
93
+ After the first apply, the steps follow the order of the starter's README, "After apply":
83
94
 
84
- 1. Set up the machines (step 6).
85
- 2. Set up: make the repository run from a bundle (step 7).
86
- 3. Give the Manager Agent its role (step 8).
87
- 4. Connect the code (step 9).
88
- 5. Connect the tracker (step 9).
89
- 6. Study (step 11).
90
- 7. Experiment, round 1 (step 11).
91
- 8. Promote (later, the Manager Agent asks).
92
- 9. Invite the team (later).
95
+ 1. Set up the machines (step 8).
96
+ 2. Grant the Manager Agent its role and create the score metrics (step 9).
97
+ 3. Set up: make the repository run from a bundle (step 10).
98
+ 4. Connect the code and the tracker (steps 11 and 12).
99
+ 5. The Bootstrap (step 13).
100
+ 6. Commissioning (later, when the Bootstrap passes).
93
101
 
94
102
  ### 1. Install the kit
95
103
 
@@ -97,14 +105,21 @@ The kit is the `orchestra` command and the library the factory code imports. It
97
105
  skill was linked, in one of two places. Keep it and its skills current with the command that matches:
98
106
 
99
107
  - Globally, with `npm install -g @orchestraworks/cli`. Update it with `npm update -g @orchestraworks/cli`.
108
+ Then `orchestra` runs in any folder.
100
109
  - In the factory folder, with `npm install @orchestraworks/cli` there. Update it with
101
110
  `npm update @orchestraworks/cli`, run in that folder. Run the command there as `npx orchestra`.
102
111
 
112
+ Use one way to run the command in each place:
113
+
114
+ - Where no factory folder with the kit exists yet (steps 2 to 4), run
115
+ `npx --package @orchestraworks/cli orchestra`. With a global install, plain `orchestra` works too.
116
+ - In a factory folder after its `npm install`, run `npx orchestra`.
117
+
103
118
  1. Find the developer's codebase folder. Call it `<codebase>`.
104
- 2. Run `orchestra --help`, or `npx orchestra --help` in the factory folder.
119
+ 2. Run `npx --package @orchestraworks/cli orchestra --help`.
105
120
 
106
- **Check:** `orchestra --help` prints the command list, and `orchestra fdk init --help` lists `--template`.
107
- Node 22 or later is needed.
121
+ **Check:** the help prints the command list, and `fdk init --help` lists `--template`. Node 22 or later is
122
+ needed.
108
123
 
109
124
  The kit's full authoring reference is `references/authoring.md` in this skill's folder. Read it when you need
110
125
  a building block this skill does not cover.
@@ -112,16 +127,17 @@ a building block this skill does not cover.
112
127
  ### 2. Sign in
113
128
 
114
129
  1. Tell the developer: "A browser window will open. Sign in to Orchestra there and confirm."
115
- 2. Run, with a command timeout of at least five minutes:
130
+ 2. Run `npx --package @orchestraworks/cli orchestra auth login`, with a command timeout of at least five
131
+ minutes. The CLI opens the browser
132
+ and waits for the answer on a local port of this computer, so the browser must run on this same
133
+ computer. When the developer belongs to one organization, the login selects it. When they belong to
134
+ several, the login stops and asks you to name one. Ask the developer which, then run:
116
135
 
117
136
  ```bash
118
- orchestra auth login --org <organization>
137
+ npx --package @orchestraworks/cli orchestra auth login --org <organization>
119
138
  ```
120
139
 
121
- `<organization>` is the organization name from the hand-over note. The CLI opens the browser and waits
122
- for the answer on a local port of this computer, so the browser must run on this same computer. It
123
- signs in to `https://api.orchestraworks.ai` unless `ORCHESTRA_BASE_URL` or `--base-url` says otherwise.
124
- Its first line names the address. This sign-in renews itself, so a long run stays signed in.
140
+ This sign-in renews itself, so a long run stays signed in. The address it signs in to is its first line.
125
141
  3. Use this browser sign-in. `orchestra auth login --no-browser` asks for a token at a hidden prompt
126
142
  instead, and a typed token cannot renew itself: it stops working when it expires. Use it only for a short
127
143
  run, with a token someone hands the developer. Users cannot create their own API keys in the console
@@ -130,11 +146,69 @@ a building block this skill does not cover.
130
146
  4. Read the two lines the login prints: `Signed in as <email>.` and
131
147
  `Logged in to organization <id> (<slug>).` Tell the developer both. Note the organization id.
132
148
 
133
- To check the sign-in later, see the orchestra skill, section 16 (How the CLI works).
134
-
135
- **Check:** the login printed the developer's email and the organization from the hand-over note.
136
-
137
- ### 3. Write the factory
149
+ **Check:** the login printed the developer's email and the organization the developer named.
150
+
151
+ ### 3. Look before you ask: a new factory or a new environment
152
+
153
+ An organization usually holds one factory, or none yet. Read what it holds before you ask the developer
154
+ anything. These commands only read. `--all-pages` follows every page, and prints the rows as one array:
155
+
156
+ ```bash
157
+ npx --package @orchestraworks/cli orchestra agents list --all-pages --output json
158
+ npx --package @orchestraworks/cli orchestra environments list --all-pages --output json
159
+ npx --package @orchestraworks/cli orchestra pipelines list --all-pages --output json
160
+ npx --package @orchestraworks/cli orchestra workflows list --all-pages --output json
161
+ ```
162
+
163
+ A row that an apply made carries the label `sfdk.managedBy`, whose value is the factory's name.
164
+
165
+ 1. Infer what the developer most likely wants:
166
+ - *No agents and no pipelines:* the account is empty. Infer **a new factory**.
167
+ - *Rows labeled with a factory name:* a factory exists. Infer **a new environment for that factory**,
168
+ such as another repository, a bigger machine, or a machine of the team's own.
169
+ - *Rows with no label:* someone made them by hand or with the CLI. Infer a new factory. If a row's slug
170
+ is one the starter declares, such as `manager-agent`, the apply updates that row: say so before step 7.
171
+ 2. Tell the developer what you found, in one or two sentences, for example: "This organization already has
172
+ the factory `factory`, with the agents Manager Agent, Engineer Agent lg, md, sm and bare."
173
+ 3. Ask once, with your question tool, with the inferred choice first and marked as the recommendation.
174
+ Then follow the branch below for the answer.
175
+
176
+ **A new factory.** Go on with step 4, or with the bug-fix fast path.
177
+
178
+ The starters build one factory per organization. When the organization already holds a factory and the
179
+ developer wants another one, make a separate organization for it:
180
+
181
+ 1. Create it: `npx --package @orchestraworks/cli orchestra organizations create --name "<name>"`. Read
182
+ `organizations create --help` for its other flags. When the command refuses, the developer creates the
183
+ organization in the console at `https://app.orchestraworks.ai`.
184
+ 2. Sign in to it as step 2 says, with `--org <the new organization>`.
185
+ 3. Start again at step 3, in the new organization.
186
+
187
+ **A new environment for the existing factory.** Do not run `orchestra fdk init`. Edit the factory that
188
+ exists instead:
189
+
190
+ 1. Find the existing factory's folder: the folder with `fdk.json` and `main.ts`. Ask the developer where it
191
+ is when it is not on this computer.
192
+ 2. Load the factory's inputs, the same way every earlier apply loaded them. The engineering-team starter
193
+ reads `~/.config/orchestra/tokens.env`; the bug-fix starter reads `~/.config/orchestra/fdk-inputs.env`.
194
+ Load the file with `set -a; . <file>; set +a`, and never print it. Ask the developer when the file is
195
+ not there. An apply without these inputs removes the token rules the factory has now.
196
+ 3. With the inputs loaded, run `npm install` and `npx orchestra fdk diff` in that folder. It must be a clean
197
+ diff before you edit anything. If it is not, show the changes to the developer and ask what to keep.
198
+ 4. Add the environment, and the agent that works on it:
199
+ - Engineering-team starter: call `declareEnvironment` in `main.ts`, as the existing agents do.
200
+ - Bug-fix starter: add a `new Environment(factory, "<name>", …)` beside `runtime` in `main.ts`, and an
201
+ `Agent` on it.
202
+ 5. Prove the new environment with `references/environment.md`, sections 1 to 6, then come back here. Prove
203
+ the environment and the agent you added, not the existing ones.
204
+ 6. Apply as step 12 says, with the inputs loaded: diff, explain, approve, apply. The diff after it is clean.
205
+ 7. Give the new agent its first work, and wait for it. Engineering-team starter: create an item in the
206
+ right pipeline and assign it to the new agent, as step 10 does, then wait as step 10 says. Bug-fix
207
+ starter: start a session with the new agent and wait, as the fast path's points 7 to 9 say.
208
+
209
+ **Check:** the developer confirmed one of the two choices.
210
+
211
+ ### 4. Write the factory
138
212
 
139
213
  Ask one question, with these three choices:
140
214
 
@@ -144,24 +218,30 @@ Ask one question, with these three choices:
144
218
 
145
219
  What each answer does:
146
220
 
147
- - *Engineering team:* go on below.
221
+ - *Engineering team:* go on below. This starter connects Bitbucket and Jira only. For a GitHub repository,
222
+ take the bug-fix fast path instead.
148
223
  - *Todo app sample:* write it as below, with `--template todo-factory` in point 2. It works on the public
149
- `orchestraworks/todo-app`. Then go on with step 4.
224
+ `orchestraworks/todo-app`. Then go on with step 5.
150
225
  - *I already have a factory.ts:* copy their folder into `<factory>` (below). It needs `fdk.json` and a
151
- `"type": "module"` package. Install the kit in it as in point 3, then go on with step 4, using their
226
+ `"type": "module"` package. Install the kit in it as in point 3, then go on with step 5, using their
152
227
  own inputs.
153
228
 
154
229
  For the engineering team:
155
230
 
156
231
  1. Make a new, empty folder beside the codebase: `<codebase>/../orchestra-factory`. Call it `<factory>`.
232
+ Do not install the kit in it before point 2.
157
233
  2. In `<factory>`, write the starter:
158
234
 
159
235
  ```bash
160
- orchestra fdk init --template engineering-team
236
+ npx --package @orchestraworks/cli orchestra fdk init --template engineering-team
161
237
  ```
162
238
 
239
+ Run it in the new, empty folder, with no kit installed there: the starter brings its own
240
+ `package.json`.
241
+
163
242
  It writes `README.md`, `main.ts`, `inputs.json`, `package.json`, `fdk.json`, `tsconfig.json`,
164
- `agents/` and `lib/`. It overwrites nothing. If a file is in the way, it writes nothing and names it.
243
+ `agents/`, `lib/` and `onboarding/`. It overwrites nothing. If a file is in the way, it writes nothing
244
+ and names it.
165
245
  3. In `<factory>`, install what the starter's `package.json` names, the kit among them:
166
246
 
167
247
  ```bash
@@ -170,11 +250,11 @@ For the engineering team:
170
250
 
171
251
  From now on, run `npx orchestra` in `<factory>`.
172
252
  4. Read `<factory>/README.md` whole. It says what the starter declares, and why.
173
- 5. Leave `inputs.json` empty for now. Step 9 fills it in.
253
+ 5. Leave `inputs.json` empty for now. Step 11 fills it in.
174
254
 
175
255
  **Check:** `npm run typecheck` passes in `<factory>`.
176
256
 
177
- ### 4. Read the plan and explain it
257
+ ### 5. Read the plan and explain it
178
258
 
179
259
  Before anything reaches the platform, show the developer what the factory is. Explain it from what the
180
260
  code produced, not from memory.
@@ -189,34 +269,28 @@ code produced, not from memory.
189
269
 
190
270
  **What each kind of thing is, and why it is there.**
191
271
 
192
- - *Agents* do the work: orchestra skill, section 2. There are four. The Manager Agent sets up the factory and
193
- grades the others. The three Engineer Agents (lg, md and sm) fix bugs and build features. Say which AI model
272
+ - *Agents* do the work: orchestra skill, section 2. There are five. The Manager Agent sets up the factory
273
+ and grades the others. The three Engineer Agents (lg, md and sm) fix bugs and build features. Engineer
274
+ Agent bare takes only the Bootstrap's baseline replays, to show what the study adds. Say which AI model
194
275
  each one uses.
195
- - *Environments* are the machines the agents work on: sections 4 and 5. Say each one's size and its network
196
- rules.
276
+ - *Environments* are the machines the agents work on: sections 4 and 5. There are four: Engineer Agent bare
277
+ uses the same one as Engineer Agent lg. Say each one's size and its network rules.
197
278
  - *Pipelines* are where work items live: sections 9 and 10.
198
279
  - *The warning* says the repository and the tracker are not connected yet. Part four explains it.
199
280
 
200
- **The gateway key.** It is the one key in the first apply. Explain it from the orchestra skill, section 7, in
201
- two parts:
281
+ **The gateway key.** The starter's code as written sends every agent's model calls through the model
282
+ gateway, with one gateway key: orchestra skill, section 7. The key is a key to `models.orchestraworks.ai`,
283
+ stored as a secret. Our network edge adds it to each model call, so no agent and no person sees it.
202
284
 
203
- - *What it is for.* The model gateway is a hosted service that lets the organization manage model spending in
204
- one place. Every agent's model calls go through it, and the organization sees what each key spends and can
205
- cap it. Say where they see and set this today.
206
- - *What it is.* A key to `models.orchestraworks.ai`, stored as a secret. Our network edge adds it to each model
207
- call, so no agent and no person sees it. The gateway swaps it for the provider's own key and charges usage to
208
- the organization's credit at list price plus 10%. Without it, an agent's first message fails with "Invalid
209
- API key".
210
-
211
- If they want to bring their own provider keys instead, the same section says what that costs.
285
+ Say that this is one of three options. Step 6 asks which one the developer has.
212
286
 
213
287
  **The pipelines and their stages.** Show this table, built from the `pipeline` entries in the plan: the
214
288
  name, the item prefix and the stages, in order.
215
289
 
216
290
  | Pipeline | Item prefix | Stages | What it is for |
217
291
  |---|---|---|---|
218
- | Onboarding | `onbd` | Todo, In progress, Needs review, Done | Setting up the factory: Set up, Study, the Experiment rounds, Promote and every Replay item. It goes away after the Engineer Agents start real work. |
219
- | Bugs | `bug` | Triage, Parked, In progress, In review, Done, Won't fix | Bugs. Parked holds a kind of bug the Engineer Agents have not yet proven they can fix. |
292
+ | Onboarding | `onbd` | Todo, In progress, Needs review, Done | Setting up the factory: Set up, the Bootstrap and every Replay item. It goes away at commissioning. |
293
+ | Bugs | `bug` | Triage, Parked, In progress, In review, Done, Won't fix | Bugs. Parked holds a bug that waits until the Bootstrap passes, or one a person set aside. |
220
294
  | Features | `feat` | Backlog, Todo, In progress, In review, Done | New features. |
221
295
  | Support | `supp` | Triage, Answering, Waiting on requester, Resolved, Closed | Questions from the team's users. |
222
296
 
@@ -232,39 +306,122 @@ connects them and the warning goes away.
232
306
 
233
307
  **Check:** the developer has no more questions about the plan.
234
308
 
235
- ### 5. The first apply (no tokens)
309
+ ### 6. Choose how the agents reach a model
310
+
311
+ Each agent needs a way to reach its AI model. There are three options, and the developer uses the one that
312
+ matches what they already have. Ask which they have, with your question tool, or infer it from what is set
313
+ up, such as an existing factory's model Secret or `ModelProviderKey`. Then follow that option. For plan
314
+ questions, send the developer to **Settings › Plan & usage** in the console.
315
+
316
+ **A Claude or Codex subscription.** The developer signs in a real terminal on their own computer. Run from
317
+ your shell, its browser step hangs. You never read or copy the value.
318
+
319
+ - *Claude.* `claude setup-token` prints a long-lived token. The developer saves it in the private file
320
+ below, as `ORCHESTRA_FDK_CLAUDE_CODE_OAUTH_TOKEN`. The factory stores it as a Secret, and the network edge
321
+ adds it to calls to `api.anthropic.com`. The machine holds only a placeholder token and an empty API key.
322
+ Declare the Claude sign-in recipe from `references/authoring.md`, "Secrets are recipes, never values".
323
+ Never put the token in the environment's settings: they are stored and shown in plain text.
324
+ - *Codex.* A personal access token, which begins `at-`. A ChatGPT Business or Enterprise member makes it
325
+ at `chatgpt.com/admin/access-tokens`, when the workspace owner allows it. Or a separate ChatGPT sign-in:
326
+ `CODEX_HOME=<dir> codex login`, never a copy of the developer's own `~/.codex` sign-in. A separate
327
+ sign-in must live on a `/home` volume that every machine using it shares, because each renewal
328
+ replaces the sign-in. After the copy, a new `codex login` in `~/.codex` signs the cloud copy out.
329
+ Keep a Codex sign-in off the model gateway: the gateway refuses its requests with `model_not_found`.
330
+ Not released yet: the worker settings that put a Codex sign-in on a machine. Until they are, use the
331
+ model gateway or an OpenAI API key for a `codex` agent.
332
+
333
+ An agent on a subscription turns the model gateway off: remove `enableModelGateway: true` from its model
334
+ settings.
335
+
336
+ **An Orchestra account, through the model gateway.** One endpoint reaches OpenAI, Anthropic and open
337
+ models. The organization can also route models: `orchestra model-configs` sets which providers serve a
338
+ model and in which order, so a call falls back to the next provider, and `orchestra model-aliases` gives a
339
+ model the organization's own name. The organization can add its own provider key to the gateway as a
340
+ `ModelProviderKey` (orchestra skill, section 7). The starter's code as written uses this option, so it
341
+ needs no edit.
342
+
343
+ **Their own provider API key.** The key is a Secret that the network edge adds to calls straight to the
344
+ provider, with no gateway in between. For Anthropic, add `x-api-key: ${secret}` on `api.anthropic.com`;
345
+ for OpenAI, add `authorization: Bearer ${secret}` on `api.openai.com`. Read the key from a shell variable
346
+ such as `ORCHESTRA_FDK_ANTHROPIC_API_KEY`, and turn `enableModelGateway` off for the agent.
347
+ `references/authoring.md` shows the Secret and the rule.
348
+
349
+ For a subscription or an own key, the apply reads the token or key from the shell, so it must be saved
350
+ before step 7:
351
+
352
+ 1. Ask the developer to make a file only they can read, outside the codebase:
353
+
354
+ ```bash
355
+ mkdir -p ~/.config/orchestra && touch ~/.config/orchestra/tokens.env && chmod 600 ~/.config/orchestra/tokens.env
356
+ ```
357
+
358
+ 2. Ask them to add one line to it, filled in by them, such as `ORCHESTRA_FDK_CLAUDE_CODE_OAUTH_TOKEN=...`.
359
+ Step 11 adds the Bitbucket and Jira tokens to the same file later.
360
+ 3. Load the file into each apply's shell without printing it: `set -a; . ~/.config/orchestra/tokens.env;
361
+ set +a`.
362
+
363
+ Then edit `<factory>/main.ts` and `<factory>/lib/environment.ts`, and run `npm run typecheck` and
364
+ `npx orchestra fdk synth`.
365
+
366
+ **Check:** the developer chose an option, and the plan shows it: a gateway rule for the model gateway, or a
367
+ Secret and a rule on the provider's host for a subscription or an own key. For those two, the file exists
368
+ with mode 600 (`stat`). Do not read its contents.
369
+
370
+ ### 7. The first apply (no code host or tracker tokens)
236
371
 
237
372
  `orchestra fdk apply` makes the platform match the code. The developer approves the change list first.
238
373
 
239
- 1. Use a shell that has not loaded the tokens. If `ORCHESTRA_FDK_BITBUCKET_TOKEN` or `ORCHESTRA_FDK_JIRA_TOKEN` is set,
374
+ 1. For a subscription or an own key (step 6), load the token or key from the private file. Use a shell without the
375
+ Bitbucket and Jira tokens: if `ORCHESTRA_FDK_BITBUCKET_TOKEN` or `ORCHESTRA_FDK_JIRA_TOKEN` is set,
240
376
  unset it for this step.
241
377
  2. In `<factory>`, run `npx orchestra fdk diff`. It changes nothing.
242
- 3. Show the developer the change list in plain words: the four agents, their four machines, the gateway
243
- key and its secret, and the four pipelines.
378
+ 3. Show the developer the change list in plain words: the five agents, their four machines, the keys and
379
+ their secrets, and the four pipelines.
244
380
  4. Ask them to approve it, with your question tool.
245
- 5. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`. The flag is needed because your
246
- shell has no terminal to type "y" at. It is safe only after the developer approved the same change
247
- list.
381
+ 5. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`. The flag is needed
382
+ because your shell has no terminal to type "y" at. It is safe only after the developer approved the
383
+ same change list.
248
384
 
249
- **Check:** a second `npx orchestra fdk diff` shows no change, and `<factory>/fdk.out/result.json` exists.
385
+ An organization on the `individual` plan cannot store a key or add one at the network edge, so this apply
386
+ stops with a plan error. Tell the developer, and point them to **Settings › Plan & usage** in the console.
250
387
 
251
- ### 6. Set up the machines
388
+ **Check:** a second `npx orchestra fdk diff` is a clean diff, and `<factory>/fdk.out/result.json` exists.
389
+
390
+ ### 8. Set up the machines
252
391
 
253
392
  Read and follow `references/environment.md`, in this skill's folder. It finds how the codebase is installed,
254
393
  tested and started. It proves that on this computer first, in the local environment, and the cloud is the
255
394
  fallback. It writes what worked into `<factory>/lib/environment.ts` and `<factory>/lib/setup.sh`.
256
395
 
257
- Then apply the machine setup. No token is loaded yet.
396
+ Then apply the machine setup, in a shell loaded as in step 7: the model token or key of step 6 if there
397
+ is one, and no Bitbucket or Jira token yet.
258
398
 
259
399
  1. In `<factory>`, run `npx orchestra fdk diff`.
260
- 2. Explain what changed, in plain words: the setup script, the settings and the ports. Say that each new
261
- machine gets them, and that running machines keep their old setup.
400
+ 2. Explain what changed, in plain words: the setup script, the settings and the ports.
401
+ Say that each new machine gets them, and that running machines keep their old setup.
262
402
  3. Ask the developer to approve it, with your question tool.
263
403
  4. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`.
264
404
 
265
- **Check:** the checks in `references/environment.md` pass, and a second `npx orchestra fdk diff` shows no change.
405
+ **Check:** the checks in `references/environment.md` pass, and a second `npx orchestra fdk diff` is a clean
406
+ diff.
407
+
408
+ ### 9. The steps the code cannot declare
409
+
410
+ Do these before Set up starts, in the README's order: the first two steps of "After apply: steps the code
411
+ cannot declare" in `<factory>/README.md`. It holds the exact commands.
412
+
413
+ 1. **Grant the Manager Agent the `agent-manager` role**, for the whole organization. The Manager Agent
414
+ works on items in every pipeline, reads the Engineer Agents' sessions, and changes the Engineer Agents.
415
+ An agent starts with only `agent-worker`. The role list you send replaces the old one, so keep every
416
+ entry it has now. Ask the developer to approve: "Give the Manager Agent the agent-manager role in the
417
+ whole organization?" On a yes, send the update with `--require-approval never`.
418
+ 2. **Create the score metrics**: `bash onboarding/create-score-metrics.sh`, once, in `<factory>`. The
419
+ Manager Agent writes each replay's scores into them.
420
+
421
+ **Check:** `npx orchestra organization-memberships get <membership id>` lists both roles, and
422
+ `npx orchestra metrics list --output json` lists the five `replay-` metrics.
266
423
 
267
- ### 7. Set up: run the repository from a bundle
424
+ ### 10. Set up: run the repository from a bundle
268
425
 
269
426
  The Manager Agent has no access to the code host yet. So it gets the code as a *git bundle*: one file that
270
427
  holds the repository's history. This item is also the cloud's confirmation of what you proved on this
@@ -273,18 +430,18 @@ computer.
273
430
  1. Find the default branch: `git -C <codebase> symbolic-ref refs/remotes/origin/HEAD`.
274
431
  2. Cut the bundle outside the codebase:
275
432
  `git -C <codebase> bundle create <codebase>/../orchestra-setup.bundle <default branch>`.
276
- 3. Upload it: `npx orchestra files create --file <codebase>/../orchestra-setup.bundle --output json`. Note the
277
- file id.
433
+ 3. Upload it: `npx orchestra files create --file <codebase>/../orchestra-setup.bundle --output json`. Note
434
+ the file id.
278
435
  4. The kit cannot declare items. Create them in the Onboarding pipeline, in this order:
279
436
 
280
437
  ```bash
281
438
  npx orchestra work-items create --pipeline onboarding --title "Set up" --description "<what done means>" --output json
282
- npx orchestra work-items create --pipeline onboarding --title "Study" --output json
283
- npx orchestra work-items create --pipeline onboarding --title "Experiment, round 1" --output json
439
+ npx orchestra work-items create --pipeline onboarding --title "Bootstrap" --description "<the threshold>" --output json
284
440
  ```
285
441
 
286
442
  The Set up description says:
287
- - Get the bundle with `orchestra files get-content <file id>`, and clone the code from it.
443
+ - Get the bundle with `orchestra files get-content <file id> --output-file setup.bundle`, and clone the
444
+ code from it under `/work`.
288
445
  - Install with the internet. Then run the stack with local settings only, such as the local Supabase
289
446
  stack's. Write those settings files, such as `.env.local`, from what `references/environment.md`
290
447
  found.
@@ -298,39 +455,24 @@ computer.
298
455
  - Done means the stack is up and validation passes. The tests do not decide Done.
299
456
  - Prove that an Engineer Agent can run the tests from the same bundle.
300
457
 
301
- Leave "Study" and "Experiment, round 1" unassigned in Todo.
302
- 5. Start Set up: `npx orchestra work-items assign <set-up item id> --agent-id manager-agent`. Assigning starts
303
- the Manager Agent's conversation on the item.
458
+ The Bootstrap description holds the two values of "The Bootstrap threshold" in `<factory>/README.md`.
459
+ Leave the Bootstrap unassigned in Todo.
460
+ 5. Start Set up: `npx orchestra work-items assign <set-up item id> --agent-id manager-agent`. Assigning
461
+ starts the Manager Agent's conversation on the item.
304
462
  6. Watch it: `npx orchestra work-items get <id> --output json` lists the item's `sessions`. Run
305
- `npx orchestra sessions wait <session id> --timeout 3600`. The developer can watch the same session in the console at
463
+ `npx orchestra sessions wait <session id> --timeout 540` in the foreground, and run it again when it
464
+ times out, as the fast path says. The developer can watch the same session in the console at
306
465
  `https://app.orchestraworks.ai`.
307
466
  7. When it ends, read the agent's report with the developer. Fix a failed step in the environment: go back
308
- to `references/environment.md`, prove the fix on this computer, apply it as in step 6, then assign the
309
- item again to wake the agent.
467
+ to `references/environment.md`, prove the fix on this computer, apply it as in step 8, then assign the
468
+ item again to wake the agent. Note the time before you assign. The session can still show the last
469
+ turn's `COMPLETE`, and then `sessions wait` returns at once. So run
470
+ `npx orchestra sessions get <session id> --output json` first, and wait only once its `lastActiveAt` is
471
+ later than that time.
310
472
 
311
473
  **Check:** the report shows the stack up, validation passing at a machine endpoint, and the test result.
312
474
 
313
- ### 8. Give the Manager Agent its role
314
-
315
- The Manager Agent works on items in every pipeline, reads the Engineer Agents' sessions, and changes the
316
- Engineer Agents. An agent starts with only `agent-worker`. The `agent-manager` role allows the rest. The
317
- kit cannot grant a role to an agent, so do it with the CLI:
318
-
319
- 1. Find the organization id: `npx orchestra organizations list --output json`.
320
- 2. Find the Manager Agent's membership:
321
- `npx orchestra organization-memberships list --organization-id <org id> --q manager-agent --output json`.
322
- Note its `id` and its `roleAssignments`.
323
- 3. Find the role id: `npx orchestra roles list --limit 100 --output json`. Note the `id` of the role whose
324
- `name` is `agent-manager`.
325
- 4. Write `grant.json` in `<factory>`: `{"roleAssignments": [...]}` holding every assignment from point 2
326
- unchanged, plus `{"roleId": "<agent-manager role id>"}` with no `projectId`. The list replaces the old
327
- one, so keep the old entries, `agent-worker` included.
328
- 5. Ask the developer to approve: "Give the Manager Agent the agent-manager role in the whole organization?"
329
- 6. On a yes: `npx orchestra organization-memberships update <membership id> --body @grant.json --require-approval never`.
330
-
331
- **Check:** `npx orchestra organization-memberships get <membership id>` lists both roles.
332
-
333
- ### 9. Connect the code and the tracker
475
+ ### 11. Connect the code and the tracker
334
476
 
335
477
  The agents reach Bitbucket and Jira with two personal API tokens. The platform stores each one as a
336
478
  *Secret*, a value the agents never see: the network edge adds it to their requests. You never see the
@@ -339,7 +481,7 @@ values either. Connect the code first, then the tracker.
339
481
  1. Fill in `<factory>/inputs.json`. Read the values from `<codebase>` where you can, and ask for the rest:
340
482
  - `repositoryUrl`: the repository's HTTPS address, from `git -C <codebase> remote get-url origin`.
341
483
  Write it as `https://bitbucket.org/<workspace>/<repository>`.
342
- - `repositoryDefaultBranch`: the default branch from step 7.
484
+ - `repositoryDefaultBranch`: the default branch from step 10.
343
485
  - `jiraSite`: the Jira site host, such as `acme.atlassian.net`. Ask.
344
486
  - `jiraEmail`: the Atlassian account email the Jira token belongs to. Ask.
345
487
  2. Ask the developer to create two tokens:
@@ -347,13 +489,14 @@ values either. Connect the code first, then the tracker.
347
489
  with the Bitbucket scopes to read and write repositories and pull requests.
348
490
  - The tracker: a Jira API token, at the same page, without scopes. A token with scopes works only
349
491
  through `api.atlassian.com`, which this starter does not add the token to.
350
- 3. Ask the developer to write both into a file only they can read, outside the codebase:
492
+ 3. Ask the developer to add both to the private file of step 6. If it does not exist yet, they make it
493
+ first:
351
494
 
352
495
  ```bash
353
496
  mkdir -p ~/.config/orchestra && touch ~/.config/orchestra/tokens.env && chmod 600 ~/.config/orchestra/tokens.env
354
497
  ```
355
498
 
356
- with these two lines, filled in by them:
499
+ Then they add these two lines, filled in by them:
357
500
 
358
501
  ```
359
502
  ORCHESTRA_FDK_BITBUCKET_TOKEN=...
@@ -363,28 +506,30 @@ values either. Connect the code first, then the tracker.
363
506
  4. Load the file into a command's shell without printing it:
364
507
  `set -a; . ~/.config/orchestra/tokens.env; set +a`.
365
508
 
366
- You may use the same tokens on this computer to read past pull requests and issues, for example for the
367
- Study item. Load the file the same way and send `Authorization: Bearer $ORCHESTRA_FDK_BITBUCKET_TOKEN` to
368
- `https://api.bitbucket.org/2.0/`. For Jira, use Basic auth with `jiraEmail` and `$ORCHESTRA_FDK_JIRA_TOKEN` on
509
+ You may use the same tokens on this computer to read past pull requests and issues. Load the file the same
510
+ way and send `Authorization: Bearer $ORCHESTRA_FDK_BITBUCKET_TOKEN` to `https://api.bitbucket.org/2.0/`.
511
+ For Jira, use Basic auth with `jiraEmail` and `$ORCHESTRA_FDK_JIRA_TOKEN` on
369
512
  `https://<jiraSite>/rest/api/3/`. Never print a token, and never write one into a file in `<codebase>` or
370
513
  `<factory>`.
371
514
 
515
+ Other code hosts and trackers connect through a *connection*: orchestra skill, section 17.
516
+
372
517
  **Check:** the file exists and has mode 600 (`stat`). Do not read its contents. With the tokens loaded,
373
518
  `npx orchestra fdk synth` writes an empty `fdk.out/warnings.json`.
374
519
 
375
- ### 10. The token apply
520
+ ### 12. The token apply
376
521
 
377
522
  1. In `<factory>`, with the tokens loaded, run `npx orchestra fdk diff`.
378
- 2. Explain only what changed since step 6, in plain words:
523
+ 2. Explain only what changed since step 8, in plain words:
379
524
  - *The token secrets.* The Bitbucket token (twice: once for the API, once for git) and the Jira token
380
525
  are stored as secrets. No one sees their values.
381
526
  - *The Manager Agent's machine.* It gets rules that add the Bitbucket token on `api.bitbucket.org` and
382
527
  `bitbucket.org`, and the Jira token on the Jira site. So it can clone, open pull requests and read
383
528
  issues.
384
529
  - *The Engineer Agents' machines.* They get deny rules for Bitbucket and for the Jira site. Say why:
385
- the Engineer Agents first redo past issues, called replays, to show how well they work. A replay
386
- must not see the real fix. So they cannot reach Bitbucket or Jira until commissioning, when they
387
- start real work. They get the code as a file the Manager Agent uploads.
530
+ in the Bootstrap, the Engineer Agents redo past pull requests, called replays, to show how well they
531
+ work. A replay must not see the real fix. So they cannot reach Bitbucket or Jira until commissioning,
532
+ when they start real work. They get the code as a file the Manager Agent uploads.
388
533
  - The Manager Agent's instructions now name the repository and the tracker.
389
534
  3. Ask the developer to approve it, with your question tool.
390
535
  4. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`, with the tokens loaded.
@@ -392,21 +537,25 @@ Study item. Load the file the same way and send `Authorization: Bearer $ORCHESTR
392
537
  Run every later apply with the tokens loaded. An apply without them takes the token rules off the
393
538
  Manager Agent's machine again.
394
539
 
395
- **Check:** a second `npx orchestra fdk diff`, with the tokens loaded, shows no change.
540
+ **Check:** a second `npx orchestra fdk diff`, with the tokens loaded, is a clean diff.
541
+
542
+ ### 13. The Bootstrap
396
543
 
397
- ### 11. Study, then Experiment
544
+ The Bootstrap teaches the Engineer Agents this codebase, then tests them on past pull requests they have
545
+ not seen. `<factory>/README.md`, "Bootstrap", says each step and the threshold.
398
546
 
399
- 1. Assign Study: `npx orchestra work-items assign <study item id> --agent-id manager-agent`. Watch it as in
400
- step 7.
401
- 2. Once Study is in Done, assign "Experiment, round 1" to `manager-agent` the same way.
547
+ 1. Once Set up is in Done, assign the Bootstrap:
548
+ `npx orchestra work-items assign <bootstrap item id> --agent-id manager-agent`. Watch it as in step 10.
549
+ 2. The Manager Agent creates the Replay items and scores them. It moves the Bootstrap to Done on a pass,
550
+ or to Needs review after two rounds that do not pass. Read its report with the developer.
402
551
 
403
- Promote and Invite the team come after the experiments. The Manager Agent asks for them in Needs review.
552
+ Commissioning comes after a pass: `<factory>/README.md`, "Commissioning".
404
553
 
405
- **Check:** Study is in Done, and "Experiment, round 1" has a session.
554
+ **Check:** the Bootstrap has a session, and the Onboarding pipeline lists its Replay items.
406
555
 
407
556
  ## Beyond the steps
408
557
 
409
- - What the platform can and cannot do yet: the orchestra skill, sections 1 to 18. Read the section for the idea
410
- in question.
558
+ - What the platform can and cannot do yet: the orchestra skill, sections 1 to 19. Read the section for the
559
+ idea in question.
411
560
  - Where an agent's knowledge goes (instructions, platform skills, codebase skills, the customer's own skills,
412
561
  versions): the orchestra skill, section 19.