@orchestraworks/cli 0.3.0 → 0.5.1

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 (47) hide show
  1. package/README.md +23 -1256
  2. package/dist/cli/core/banner.d.ts +10 -0
  3. package/dist/cli/core/banner.js +63 -0
  4. package/dist/cli/core/invocation.js +1 -1
  5. package/dist/cli/core/package-root.d.ts +3 -2
  6. package/dist/cli/core/package-root.js +4 -4
  7. package/dist/cli/core/skill-pointer.d.ts +7 -2
  8. package/dist/cli/core/skill-pointer.js +13 -3
  9. package/dist/cli/factory/init.d.ts +1 -1
  10. package/dist/cli/factory/init.js +41 -13
  11. package/dist/cli/main.js +5 -3
  12. package/dist/cli/skill-install-fs.d.ts +0 -2
  13. package/dist/cli/skill-install-fs.js +0 -2
  14. package/dist/cli/skill.js +20 -7
  15. package/docs/REFERENCE.md +1278 -0
  16. package/node_modules/@orchestraworks/client/package.json +1 -1
  17. package/package.json +7 -8
  18. package/skills/orchestra/SKILL.md +151 -110
  19. package/skills/orchestra-fdk/SKILL.md +327 -120
  20. package/skills/orchestra-fdk/references/authoring.md +26 -15
  21. package/skills/orchestra-fdk/references/environment.md +39 -24
  22. package/templates/bug-fix/tsconfig.json +12 -0
  23. package/templates/engineering-team/lib/setup.sh +16 -0
  24. package/templates/engineering-team/package.json +1 -1
  25. package/templates/todo-factory/package.json +1 -1
  26. package/node_modules/@orchestraworks/workflow-render/LICENSE +0 -202
  27. package/node_modules/@orchestraworks/workflow-render/dist/constants.d.ts +0 -98
  28. package/node_modules/@orchestraworks/workflow-render/dist/context.d.ts +0 -37
  29. package/node_modules/@orchestraworks/workflow-render/dist/geometry-core.d.ts +0 -40
  30. package/node_modules/@orchestraworks/workflow-render/dist/graph-digest.d.ts +0 -4
  31. package/node_modules/@orchestraworks/workflow-render/dist/grid.d.ts +0 -33
  32. package/node_modules/@orchestraworks/workflow-render/dist/heuristic.d.ts +0 -7
  33. package/node_modules/@orchestraworks/workflow-render/dist/identity.d.ts +0 -9
  34. package/node_modules/@orchestraworks/workflow-render/dist/index.d.ts +0 -24
  35. package/node_modules/@orchestraworks/workflow-render/dist/index.js +0 -1
  36. package/node_modules/@orchestraworks/workflow-render/dist/layout.d.ts +0 -6
  37. package/node_modules/@orchestraworks/workflow-render/dist/normalize.d.ts +0 -33
  38. package/node_modules/@orchestraworks/workflow-render/dist/place.d.ts +0 -81
  39. package/node_modules/@orchestraworks/workflow-render/dist/ports.d.ts +0 -15
  40. package/node_modules/@orchestraworks/workflow-render/dist/presence.d.ts +0 -6
  41. package/node_modules/@orchestraworks/workflow-render/dist/route-cells.d.ts +0 -15
  42. package/node_modules/@orchestraworks/workflow-render/dist/sha256.d.ts +0 -3
  43. package/node_modules/@orchestraworks/workflow-render/dist/svg.d.ts +0 -7
  44. package/node_modules/@orchestraworks/workflow-render/dist/text.d.ts +0 -14
  45. package/node_modules/@orchestraworks/workflow-render/dist/types.d.ts +0 -310
  46. package/node_modules/@orchestraworks/workflow-render/dist/verify.d.ts +0 -26
  47. package/node_modules/@orchestraworks/workflow-render/package.json +0 -42
@@ -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, 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,9 +14,67 @@ 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
 
24
+ ## The bug-fix fast path
25
+
26
+ `orchestra fdk init` without `--template` writes the bug-fix starter: one agent that takes a bug as its
27
+ first message and answers with a pull request and a report. Take this path when the developer wants one bug
28
+ fixed in a GitHub repository. Do steps 1 to 3 below first. Then:
29
+
30
+ 1. Make a new folder beside the codebase, `<codebase>/../orchestra-factory`, called `<factory>`. In it, run
31
+ `npm init -y`, then `npm install @orchestraworks/cli`.
32
+ 2. Write the starter. `<owner>/<name>` is the GitHub repository. Add `--model-key anthropic` or
33
+ `--model-key openai` only when the organization brings its own model key to the model gateway (step 6).
34
+
35
+ ```bash
36
+ npx orchestra fdk init --repository <owner>/<name>
37
+ ```
38
+
39
+ 3. Run `npm install`, then `npm run typecheck`. Both must pass.
40
+ 4. Fill in `<factory>/skills/codebase/SKILL.md` with how the codebase installs, tests and starts, and the
41
+ services it needs. When the codebase has an `AGENTS.md` or `CLAUDE.md`, write one line naming it instead.
42
+ 5. Set the shell inputs. `main.ts` reads them, and `init` printed each with what it is. They come with the
43
+ hand-over note: `ORCHESTRA_FDK_IMAGE_REPOSITORY`, `ORCHESTRA_FDK_RUNTIME_IMAGE`,
44
+ `ORCHESTRA_FDK_MODEL_GATEWAY_HOST`, `ORCHESTRA_FDK_IMAGE_PULL_ACCESS_KEY_ID` and
45
+ `ORCHESTRA_FDK_IMAGE_PULL_SECRET_ACCESS_KEY`, plus `ORCHESTRA_FDK_ANTHROPIC_API_KEY` or
46
+ `ORCHESTRA_FDK_OPENAI_API_KEY` with `--model-key`. Ask the developer to write them into a file only they
47
+ can read, as in step 6, and load it in each command that runs `orchestra`:
48
+ `set -a; . ~/.config/orchestra/fdk-inputs.env; set +a`. Docker on this computer must also be signed in
49
+ to the image registry, with the details in the same note.
50
+ 6. Run `npx orchestra fdk diff` and show the developer the change list. On their yes, run
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.
56
+ 7. Send the bug. The agent's id is `<factory name>-bugfix`, where the factory name is the one `init` printed:
57
+
58
+ ```bash
59
+ npx orchestra sessions start --agent-id <factory name>-bugfix --content "<the bug, in the reporter's words>" --output json
60
+ ```
61
+
62
+ The answer is `{"session":{…},"firstItem":{…}}`. The session id is `.session.id`.
63
+ 8. Wait for the turn to end, in the foreground, with one blocking command:
64
+
65
+ ```bash
66
+ npx orchestra sessions wait <session id> --timeout 540
67
+ ```
68
+
69
+ Do not start the wait in the background and end your turn. A headless agent exits when its turn ends,
70
+ and the waiting command goes with it. `--timeout 540` ends the wait before a ten-minute command limit.
71
+ When it times out, it prints the session's last status and exits non-zero: run the same command again.
72
+ 9. `sessions wait` shows no progress. To see what the agent did, read the conversation's items:
73
+ `npx orchestra sessions list-items <session id> --output json`. The rows are in `data`. The developer
74
+ can watch the same session live in the console at `https://app.orchestraworks.ai`.
75
+
76
+ **Check:** the session's status is `COMPLETE`, and its last message names the pull request and the report.
77
+
20
78
  ## The steps
21
79
 
22
80
  Do them in order. Each step ends with a check. Do not go on until the check passes.
@@ -24,33 +82,44 @@ Do them in order. Each step ends with a check. Do not go on until the check pass
24
82
  Before every apply, run the check in `references/environment.md` under "Before any cloud apply". It
25
83
  removes every local-only credential from the factory code.
26
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
+
27
89
  The factory is applied three times. The first apply comes before any token or input, so the developer sees
28
90
  the agents and pipelines first. The second apply adds the machine setup, after you prove it on this computer.
29
91
  The third apply adds the code host and tracker tokens and the inputs.
30
92
 
31
- 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":
32
94
 
33
- 1. Set up the machines (step 6).
34
- 2. Set up: make the repository run from a bundle (step 7).
35
- 3. Give the Manager Agent its role (step 8).
36
- 4. Connect the code (step 9).
37
- 5. Connect the tracker (step 9).
38
- 6. Study (step 11).
39
- 7. Experiment, round 1 (step 11).
40
- 8. Promote (later, the Manager Agent asks).
41
- 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).
42
101
 
43
102
  ### 1. Install the kit
44
103
 
45
- The kit is the `orchestra` command and the library the factory code imports. You installed it globally
46
- with `npm install -g @orchestraworks/cli` before this skill was linked. `npm update -g @orchestraworks/cli`
47
- keeps it and its skills current.
104
+ The kit is the `orchestra` command and the library the factory code imports. It was installed before this
105
+ skill was linked, in one of two places. Keep it and its skills current with the command that matches:
106
+
107
+ - Globally, with `npm install -g @orchestraworks/cli`. Update it with `npm update -g @orchestraworks/cli`.
108
+ Then `orchestra` runs in any folder.
109
+ - In the factory folder, with `npm install @orchestraworks/cli` there. Update it with
110
+ `npm update @orchestraworks/cli`, run in that folder. Run the command there as `npx orchestra`.
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`.
48
117
 
49
118
  1. Find the developer's codebase folder. Call it `<codebase>`.
50
- 2. Run `orchestra --help`.
119
+ 2. Run `npx --package @orchestraworks/cli orchestra --help`.
51
120
 
52
- **Check:** `orchestra --help` prints the command list, and `orchestra fdk init --help` lists `--template`.
53
- 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.
54
123
 
55
124
  The kit's full authoring reference is `references/authoring.md` in this skill's folder. Read it when you need
56
125
  a building block this skill does not cover.
@@ -58,25 +127,88 @@ a building block this skill does not cover.
58
127
  ### 2. Sign in
59
128
 
60
129
  1. Tell the developer: "A browser window will open. Sign in to Orchestra there and confirm."
61
- 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:
62
135
 
63
136
  ```bash
64
- orchestra auth login --org <organization>
137
+ npx --package @orchestraworks/cli orchestra auth login --org <organization>
65
138
  ```
66
139
 
67
- `<organization>` is the organization name from the hand-over note. The CLI opens the browser and waits
68
- for the answer on a local port of this computer. It signs in to `https://api.orchestraworks.ai` unless `ORCHESTRA_BASE_URL` or `--base-url` says otherwise. Its first line names the address.
69
- 3. If the browser cannot open on this computer, use `orchestra auth login --no-browser --org <organization>`.
70
- It asks for an API token at a hidden prompt. The developer creates the token in the console at
71
- `https://console.orchestraworks.ai` and types it into the terminal themselves.
140
+ This sign-in renews itself, so a long run stays signed in. The address it signs in to is its first line.
141
+ 3. Use this browser sign-in. `orchestra auth login --no-browser` asks for a token at a hidden prompt
142
+ instead, and a typed token cannot renew itself: it stops working when it expires. Use it only for a short
143
+ run, with a token someone hands the developer. Users cannot create their own API keys in the console
144
+ yet; that is coming. If no browser can open on this computer, tell the developer, and ask them to run
145
+ you on a computer where one can.
72
146
  4. Read the two lines the login prints: `Signed in as <email>.` and
73
147
  `Logged in to organization <id> (<slug>).` Tell the developer both. Note the organization id.
74
148
 
75
- To check the sign-in later, see the orchestra skill, section 16 (How the CLI works).
76
-
77
- **Check:** the login printed the developer's email and the organization from the hand-over note.
78
-
79
- ### 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
80
212
 
81
213
  Ask one question, with these three choices:
82
214
 
@@ -86,24 +218,30 @@ Ask one question, with these three choices:
86
218
 
87
219
  What each answer does:
88
220
 
89
- - *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.
90
223
  - *Todo app sample:* write it as below, with `--template todo-factory` in point 2. It works on the public
91
- `orchestraworks/todo-app`. Then go on with step 4.
224
+ `orchestraworks/todo-app`. Then go on with step 5.
92
225
  - *I already have a factory.ts:* copy their folder into `<factory>` (below). It needs `fdk.json` and a
93
- `"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
94
227
  own inputs.
95
228
 
96
229
  For the engineering team:
97
230
 
98
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.
99
233
  2. In `<factory>`, write the starter:
100
234
 
101
235
  ```bash
102
- orchestra fdk init --template engineering-team
236
+ npx --package @orchestraworks/cli orchestra fdk init --template engineering-team
103
237
  ```
104
238
 
239
+ Run it in the new, empty folder, with no kit installed there: the starter brings its own
240
+ `package.json`.
241
+
105
242
  It writes `README.md`, `main.ts`, `inputs.json`, `package.json`, `fdk.json`, `tsconfig.json`,
106
- `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.
107
245
  3. In `<factory>`, install what the starter's `package.json` names, the kit among them:
108
246
 
109
247
  ```bash
@@ -112,11 +250,11 @@ For the engineering team:
112
250
 
113
251
  From now on, run `npx orchestra` in `<factory>`.
114
252
  4. Read `<factory>/README.md` whole. It says what the starter declares, and why.
115
- 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.
116
254
 
117
255
  **Check:** `npm run typecheck` passes in `<factory>`.
118
256
 
119
- ### 4. Read the plan and explain it
257
+ ### 5. Read the plan and explain it
120
258
 
121
259
  Before anything reaches the platform, show the developer what the factory is. Explain it from what the
122
260
  code produced, not from memory.
@@ -131,34 +269,28 @@ code produced, not from memory.
131
269
 
132
270
  **What each kind of thing is, and why it is there.**
133
271
 
134
- - *Agents* do the work: orchestra skill, section 2. There are four. The Manager Agent sets up the factory and
135
- 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
136
275
  each one uses.
137
- - *Environments* are the machines the agents work on: sections 4 and 5. Say each one's size and its network
138
- 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.
139
278
  - *Pipelines* are where work items live: sections 9 and 10.
140
279
  - *The warning* says the repository and the tracker are not connected yet. Part four explains it.
141
280
 
142
- **The gateway key.** It is the one key in the first apply. Explain it from the orchestra skill, section 7, in
143
- two parts:
144
-
145
- - *What it is for.* The model gateway is a hosted service that lets the organization manage model spending in
146
- one place. Every agent's model calls go through it, and the organization sees what each key spends and can
147
- cap it. Say where they see and set this today.
148
- - *What it is.* A key to `models.orchestraworks.ai`, stored as a secret. Our network edge adds it to each model
149
- call, so no agent and no person sees it. The gateway swaps it for the provider's own key and charges usage to
150
- the organization's credit at list price plus 10%. Without it, an agent's first message fails with "Invalid
151
- API key".
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.
152
284
 
153
- 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.
154
286
 
155
287
  **The pipelines and their stages.** Show this table, built from the `pipeline` entries in the plan: the
156
288
  name, the item prefix and the stages, in order.
157
289
 
158
290
  | Pipeline | Item prefix | Stages | What it is for |
159
291
  |---|---|---|---|
160
- | 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. |
161
- | 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. |
162
294
  | Features | `feat` | Backlog, Todo, In progress, In review, Done | New features. |
163
295
  | Support | `supp` | Triage, Answering, Waiting on requester, Resolved, Closed | Questions from the team's users. |
164
296
 
@@ -174,39 +306,122 @@ connects them and the warning goes away.
174
306
 
175
307
  **Check:** the developer has no more questions about the plan.
176
308
 
177
- ### 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)
178
371
 
179
372
  `orchestra fdk apply` makes the platform match the code. The developer approves the change list first.
180
373
 
181
- 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,
182
376
  unset it for this step.
183
377
  2. In `<factory>`, run `npx orchestra fdk diff`. It changes nothing.
184
- 3. Show the developer the change list in plain words: the four agents, their four machines, the gateway
185
- 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.
186
380
  4. Ask them to approve it, with your question tool.
187
- 5. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`. The flag is needed because your
188
- shell has no terminal to type "y" at. It is safe only after the developer approved the same change
189
- 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.
190
384
 
191
- **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.
192
387
 
193
- ### 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
194
391
 
195
392
  Read and follow `references/environment.md`, in this skill's folder. It finds how the codebase is installed,
196
393
  tested and started. It proves that on this computer first, in the local environment, and the cloud is the
197
394
  fallback. It writes what worked into `<factory>/lib/environment.ts` and `<factory>/lib/setup.sh`.
198
395
 
199
- 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.
200
398
 
201
399
  1. In `<factory>`, run `npx orchestra fdk diff`.
202
- 2. Explain what changed, in plain words: the setup script, the settings and the ports. Say that each new
203
- 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.
204
402
  3. Ask the developer to approve it, with your question tool.
205
403
  4. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`.
206
404
 
207
- **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.
208
412
 
209
- ### 7. Set up: run the repository from a bundle
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.
423
+
424
+ ### 10. Set up: run the repository from a bundle
210
425
 
211
426
  The Manager Agent has no access to the code host yet. So it gets the code as a *git bundle*: one file that
212
427
  holds the repository's history. This item is also the cloud's confirmation of what you proved on this
@@ -215,18 +430,18 @@ computer.
215
430
  1. Find the default branch: `git -C <codebase> symbolic-ref refs/remotes/origin/HEAD`.
216
431
  2. Cut the bundle outside the codebase:
217
432
  `git -C <codebase> bundle create <codebase>/../orchestra-setup.bundle <default branch>`.
218
- 3. Upload it: `npx orchestra files create --file <codebase>/../orchestra-setup.bundle --output json`. Note the
219
- file id.
433
+ 3. Upload it: `npx orchestra files create --file <codebase>/../orchestra-setup.bundle --output json`. Note
434
+ the file id.
220
435
  4. The kit cannot declare items. Create them in the Onboarding pipeline, in this order:
221
436
 
222
437
  ```bash
223
438
  npx orchestra work-items create --pipeline onboarding --title "Set up" --description "<what done means>" --output json
224
- npx orchestra work-items create --pipeline onboarding --title "Study" --output json
225
- 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
226
440
  ```
227
441
 
228
442
  The Set up description says:
229
- - 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`.
230
445
  - Install with the internet. Then run the stack with local settings only, such as the local Supabase
231
446
  stack's. Write those settings files, such as `.env.local`, from what `references/environment.md`
232
447
  found.
@@ -240,39 +455,24 @@ computer.
240
455
  - Done means the stack is up and validation passes. The tests do not decide Done.
241
456
  - Prove that an Engineer Agent can run the tests from the same bundle.
242
457
 
243
- Leave "Study" and "Experiment, round 1" unassigned in Todo.
244
- 5. Start Set up: `npx orchestra work-items assign <set-up item id> --agent-id manager-agent`. Assigning starts
245
- 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.
246
462
  6. Watch it: `npx orchestra work-items get <id> --output json` lists the item's `sessions`. Run
247
- `npx orchestra sessions wait <session id> --timeout 3600`. The developer can watch the same session in the console at
248
- `https://console.orchestraworks.ai`.
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
465
+ `https://app.orchestraworks.ai`.
249
466
  7. When it ends, read the agent's report with the developer. Fix a failed step in the environment: go back
250
- to `references/environment.md`, prove the fix on this computer, apply it as in step 6, then assign the
251
- 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.
252
472
 
253
473
  **Check:** the report shows the stack up, validation passing at a machine endpoint, and the test result.
254
474
 
255
- ### 8. Give the Manager Agent its role
256
-
257
- The Manager Agent works on items in every pipeline, reads the Engineer Agents' sessions, and changes the
258
- Engineer Agents. An agent starts with only `agent-worker`. The `agent-manager` role allows the rest. The
259
- kit cannot grant a role to an agent, so do it with the CLI:
260
-
261
- 1. Find the organization id: `npx orchestra organizations list --output json`.
262
- 2. Find the Manager Agent's membership:
263
- `npx orchestra organization-memberships list --organization-id <org id> --q manager-agent --output json`.
264
- Note its `id` and its `roleAssignments`.
265
- 3. Find the role id: `npx orchestra roles list --limit 100 --output json`. Note the `id` of the role whose
266
- `name` is `agent-manager`.
267
- 4. Write `grant.json` in `<factory>`: `{"roleAssignments": [...]}` holding every assignment from point 2
268
- unchanged, plus `{"roleId": "<agent-manager role id>"}` with no `projectId`. The list replaces the old
269
- one, so keep the old entries, `agent-worker` included.
270
- 5. Ask the developer to approve: "Give the Manager Agent the agent-manager role in the whole organization?"
271
- 6. On a yes: `npx orchestra organization-memberships update <membership id> --body @grant.json --require-approval never`.
272
-
273
- **Check:** `npx orchestra organization-memberships get <membership id>` lists both roles.
274
-
275
- ### 9. Connect the code and the tracker
475
+ ### 11. Connect the code and the tracker
276
476
 
277
477
  The agents reach Bitbucket and Jira with two personal API tokens. The platform stores each one as a
278
478
  *Secret*, a value the agents never see: the network edge adds it to their requests. You never see the
@@ -281,7 +481,7 @@ values either. Connect the code first, then the tracker.
281
481
  1. Fill in `<factory>/inputs.json`. Read the values from `<codebase>` where you can, and ask for the rest:
282
482
  - `repositoryUrl`: the repository's HTTPS address, from `git -C <codebase> remote get-url origin`.
283
483
  Write it as `https://bitbucket.org/<workspace>/<repository>`.
284
- - `repositoryDefaultBranch`: the default branch from step 7.
484
+ - `repositoryDefaultBranch`: the default branch from step 10.
285
485
  - `jiraSite`: the Jira site host, such as `acme.atlassian.net`. Ask.
286
486
  - `jiraEmail`: the Atlassian account email the Jira token belongs to. Ask.
287
487
  2. Ask the developer to create two tokens:
@@ -289,13 +489,14 @@ values either. Connect the code first, then the tracker.
289
489
  with the Bitbucket scopes to read and write repositories and pull requests.
290
490
  - The tracker: a Jira API token, at the same page, without scopes. A token with scopes works only
291
491
  through `api.atlassian.com`, which this starter does not add the token to.
292
- 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:
293
494
 
294
495
  ```bash
295
496
  mkdir -p ~/.config/orchestra && touch ~/.config/orchestra/tokens.env && chmod 600 ~/.config/orchestra/tokens.env
296
497
  ```
297
498
 
298
- with these two lines, filled in by them:
499
+ Then they add these two lines, filled in by them:
299
500
 
300
501
  ```
301
502
  ORCHESTRA_FDK_BITBUCKET_TOKEN=...
@@ -305,28 +506,30 @@ values either. Connect the code first, then the tracker.
305
506
  4. Load the file into a command's shell without printing it:
306
507
  `set -a; . ~/.config/orchestra/tokens.env; set +a`.
307
508
 
308
- You may use the same tokens on this computer to read past pull requests and issues, for example for the
309
- Study item. Load the file the same way and send `Authorization: Bearer $ORCHESTRA_FDK_BITBUCKET_TOKEN` to
310
- `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
311
512
  `https://<jiraSite>/rest/api/3/`. Never print a token, and never write one into a file in `<codebase>` or
312
513
  `<factory>`.
313
514
 
515
+ Other code hosts and trackers connect through a *connection*: orchestra skill, section 17.
516
+
314
517
  **Check:** the file exists and has mode 600 (`stat`). Do not read its contents. With the tokens loaded,
315
518
  `npx orchestra fdk synth` writes an empty `fdk.out/warnings.json`.
316
519
 
317
- ### 10. The token apply
520
+ ### 12. The token apply
318
521
 
319
522
  1. In `<factory>`, with the tokens loaded, run `npx orchestra fdk diff`.
320
- 2. Explain only what changed since step 6, in plain words:
523
+ 2. Explain only what changed since step 8, in plain words:
321
524
  - *The token secrets.* The Bitbucket token (twice: once for the API, once for git) and the Jira token
322
525
  are stored as secrets. No one sees their values.
323
526
  - *The Manager Agent's machine.* It gets rules that add the Bitbucket token on `api.bitbucket.org` and
324
527
  `bitbucket.org`, and the Jira token on the Jira site. So it can clone, open pull requests and read
325
528
  issues.
326
529
  - *The Engineer Agents' machines.* They get deny rules for Bitbucket and for the Jira site. Say why:
327
- the Engineer Agents first redo past issues, called replays, to show how well they work. A replay
328
- must not see the real fix. So they cannot reach Bitbucket or Jira until commissioning, when they
329
- 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.
330
533
  - The Manager Agent's instructions now name the repository and the tracker.
331
534
  3. Ask the developer to approve it, with your question tool.
332
535
  4. On a yes, run `npx orchestra fdk apply --require-approval never` in `<factory>`, with the tokens loaded.
@@ -334,21 +537,25 @@ Study item. Load the file the same way and send `Authorization: Bearer $ORCHESTR
334
537
  Run every later apply with the tokens loaded. An apply without them takes the token rules off the
335
538
  Manager Agent's machine again.
336
539
 
337
- **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
338
543
 
339
- ### 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.
340
546
 
341
- 1. Assign Study: `npx orchestra work-items assign <study item id> --agent-id manager-agent`. Watch it as in
342
- step 7.
343
- 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.
344
551
 
345
- 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".
346
553
 
347
- **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.
348
555
 
349
556
  ## Beyond the steps
350
557
 
351
- - What the platform can and cannot do yet: the orchestra skill, sections 1 to 18. Read the section for the idea
352
- 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.
353
560
  - Where an agent's knowledge goes (instructions, platform skills, codebase skills, the customer's own skills,
354
561
  versions): the orchestra skill, section 19.