orcastrator 0.2.20 → 0.2.24

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 (35) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -352
  3. package/dist/agents/codex/session.d.ts +6 -0
  4. package/dist/agents/codex/session.d.ts.map +1 -1
  5. package/dist/agents/codex/session.js +93 -58
  6. package/dist/cli/commands/help.d.ts.map +1 -1
  7. package/dist/cli/commands/help.js +8 -34
  8. package/dist/cli/commands/resume.d.ts +1 -3
  9. package/dist/cli/commands/resume.d.ts.map +1 -1
  10. package/dist/cli/commands/resume.js +4 -20
  11. package/dist/cli/commands/run-command.test-harness.d.ts.map +1 -1
  12. package/dist/cli/commands/run-command.test-harness.js +8 -0
  13. package/dist/cli/commands/run.d.ts +1 -3
  14. package/dist/cli/commands/run.d.ts.map +1 -1
  15. package/dist/cli/commands/run.js +11 -59
  16. package/dist/cli/commands/setup.d.ts +3 -8
  17. package/dist/cli/commands/setup.d.ts.map +1 -1
  18. package/dist/cli/commands/setup.js +97 -446
  19. package/dist/core/config-loader.d.ts.map +1 -1
  20. package/dist/core/config-loader.js +33 -20
  21. package/dist/core/planner.d.ts +10 -5
  22. package/dist/core/planner.d.ts.map +1 -1
  23. package/dist/core/planner.js +50 -17
  24. package/dist/core/task-runner.d.ts +5 -2
  25. package/dist/core/task-runner.d.ts.map +1 -1
  26. package/dist/core/task-runner.js +3 -16
  27. package/dist/types/effort.d.ts +3 -5
  28. package/dist/types/effort.d.ts.map +1 -1
  29. package/dist/types/effort.js +3 -6
  30. package/dist/types/index.d.ts +7 -10
  31. package/dist/types/index.d.ts.map +1 -1
  32. package/package.json +5 -7
  33. package/dist/agents/claude/session.d.ts +0 -10
  34. package/dist/agents/claude/session.d.ts.map +0 -1
  35. package/dist/agents/claude/session.js +0 -364
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bradley Inniss
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Orca
8
8
 
9
- Coordinated agent run harness. Breaks down a task into a task graph, then executes it end-to-end via a persistent [Codex](https://github.com/ratley/codex-client) session with full context across tasks.
9
+ Coordinated agent run harness. Breaks a task into a graph, then executes it end-to-end via a persistent [Codex](https://github.com/ratley/codex-client) session.
10
10
 
11
11
  ## Install
12
12
 
@@ -14,465 +14,267 @@ Coordinated agent run harness. Breaks down a task into a task graph, then execut
14
14
  npm install -g orcastrator
15
15
  ```
16
16
 
17
- ## Run A Task
18
-
19
- Start with a plain-language task:
17
+ ## Quick Start
20
18
 
21
19
  ```bash
22
- orca "add auth to the app"
23
- ```
20
+ # 1. Go into a git repo
21
+ cd /path/to/repo
24
22
 
25
- Orca will create a run, plan tasks, run a pre-execution review/improvement pass on the task graph, execute the reviewed graph, and persist run state.
23
+ # 2. Run a task
24
+ orca "add input validation to the signup form in src/auth/signup.ts"
26
25
 
27
- ### Pre-execution review-improvement stage
26
+ # 3. Check status
27
+ orca status --last
28
28
 
29
- After planning, Orca runs a structured review pass that can edit the task graph before execution starts. The review output is schema-validated and supports concrete graph operations:
30
-
31
- - update task fields (`name`, `description`, `acceptance_criteria`)
32
- - add/remove task
33
- - add/remove dependency
29
+ # 4. Once done, open a PR
30
+ orca pr create --last
31
+ ```
34
32
 
35
- By default, Orca applies valid review improvements and continues execution. The edited graph is re-validated as a DAG. If the review stage output is invalid, Orca fails with an actionable error (`review.plan.onInvalid: "fail"`). Set `review.plan.onInvalid: "warn_skip"` to log a warning and continue with the original planner graph instead.
33
+ **Write specific goals.** Orca passes your task to a planner vague input produces vague plans.
36
34
 
37
- ### Post-execution review / fix cycles
35
+ - Bad: `"fix the bug"`
36
+ - Good: `"Fix the TypeError thrown on logout with an expired token in src/auth/session.ts. Ensure existing tests pass and add a regression test."`
38
37
 
39
- After task execution, Orca can run deterministic validation commands, then ask Codex to review findings and optionally auto-fix issues in bounded cycles.
38
+ ---
40
39
 
41
- - `review.execution.enabled` (default `true`)
42
- - `review.execution.maxCycles` (default `2`)
43
- - `review.execution.onFindings`:
44
- - `auto_fix` (default): apply fixes and continue until clean or max cycles
45
- - `report_only`: report findings and stop
46
- - `fail`: mark run failed when findings exist
47
- - `review.execution.validator.auto` (default `true`): auto-detect validator commands from `package.json`
48
- - Caveat: `ORCA_SKIP_VALIDATORS=1` forces this to `false` at runtime
49
- - `review.execution.validator.commands` (optional explicit command list)
50
- - `review.execution.prompt` (optional custom reviewer instruction)
40
+ ## Common Workflows
51
41
 
52
- When using the Codex executor, Orca enforces a strict reviewer JSON schema (`{summary, findings, fixed}`) as the primary path. If the first response is malformed, Orca issues one deterministic repair prompt (max 2 attempts total); if still invalid, it emits an `onFindings` event with an explicit parse error and stops auto-fix progression for that cycle.
42
+ ### Status & monitoring
53
43
 
54
- Run the dedicated integration coverage for this JSON retry/validation path with `npm run test:postexec-json`.
44
+ ```bash
45
+ orca status # list all runs
46
+ orca status --last # most recent run
47
+ orca status --run <run-id> # specific run
48
+ orca list # alias for status
49
+ ```
55
50
 
56
- Orca then prints a final post-execution review summary.
51
+ Run states: `planning` `running` `completed` | `failed` | `cancelled` | `waiting_for_answer`
57
52
 
58
- ## Spec And Plan Files
53
+ ### Answering questions
59
54
 
60
- Use a spec/plan markdown file when you already have a written breakdown:
55
+ If a run hits `waiting_for_answer`, it's blocked until you respond:
61
56
 
62
57
  ```bash
63
- orca --spec ./specs/feature.md
64
- orca --plan ./specs/feature.md
58
+ orca status --last # read the question
59
+ orca answer <run-id> "yes, use migration A" # unblock it
65
60
  ```
66
61
 
67
- If you only want planning (no execution):
62
+ ### Spec / plan files
63
+
64
+ Use a markdown spec instead of an inline task:
68
65
 
69
66
  ```bash
70
- orca plan --spec ./specs/feature.md
67
+ orca --spec ./specs/feature.md # plan + execute
68
+ orca plan --spec ./specs/feature.md # plan only, no execution
71
69
  ```
72
70
 
73
- ## Run Management
71
+ ### Failure & recovery
74
72
 
75
73
  ```bash
76
- orca status # list all runs (summary table)
77
- orca status --last # status of the most recent run
78
- orca status --run <run-id> # status of a specific run
79
-
80
- orca list
74
+ orca resume --last # retry from last checkpoint
75
+ orca cancel --last # abort
76
+ ```
81
77
 
82
- orca resume --last
83
- orca resume --run <run-id>
78
+ Common failures:
79
+ - `auth error` → re-auth Codex (`codex auth`) or set `OPENAI_API_KEY` / `ORCA_OPENAI_API_KEY`
80
+ - `no git repo` → `cd` into a git repo
81
+ - `plan invalid` → goal too vague; cancel and restate
82
+ - Session logs: `./session-logs/` (or `sessionLogs` config path)
84
83
 
85
- orca cancel --last
86
- orca cancel --run <run-id>
84
+ ### PR workflow
87
85
 
88
- orca answer <run-id> "yes, use migration A"
86
+ ```bash
87
+ orca pr draft --last # open a draft PR (won't trigger CI)
88
+ orca pr publish --last # un-draft it
89
+ orca pr create --last # draft + publish in one step
90
+ orca pr status --last # check PR and CI status
89
91
  ```
90
92
 
91
- ## PR Workflow
93
+ Orca always works on a branch — never pushes directly to main/master.
92
94
 
93
- ```bash
94
- orca pr
95
- orca pr draft --run <run-id>
96
- orca pr create --run <run-id>
97
- orca pr publish --run <run-id>
98
- orca pr status --run <run-id>
99
-
100
- orca pr publish --last
101
- orca pr publish --config ./orca.config.js # accepted, currently unused by PR command resolution
102
-
103
- # Non-TTY requires explicit run selection
104
- orca pr publish --run <run-id>
105
- orca pr publish --last
106
- ```
95
+ ---
107
96
 
108
97
  ## Config
109
98
 
110
- Orca auto-discovers config in this order:
99
+ Orca loads config in this order (later overrides earlier):
111
100
 
112
- 1. `~/.orca/config.js`
113
- 2. Project config: `./orca.config.ts` (preferred when both exist) or `./orca.config.js`
114
- 3. `--config <path>` (if passed)
101
+ 1. `~/.orca/config.ts` or `~/.orca/config.js` (global)
102
+ 2. `./orca.config.ts` or `./orca.config.js` (project)
103
+ 3. `--config <path>` (explicit)
115
104
 
116
- Later entries override earlier ones.
105
+ `.ts` is preferred over `.js` when both exist.
117
106
 
118
107
  ```ts
119
108
  // orca.config.ts
120
109
  import { defineOrcaConfig } from "orcastrator";
121
110
 
122
111
  export default defineOrcaConfig({
123
- executor: "codex",
124
- anthropicApiKey: process.env.ANTHROPIC_API_KEY,
125
- openaiApiKey: process.env.OPENAI_API_KEY,
126
- runsDir: "./.orca/runs",
112
+ executor: "codex", // only supported value
113
+ runsDir: "./.orca/runs", // default: ~/.orca/runs
127
114
  sessionLogs: "./session-logs",
128
115
  skills: ["./.orca/skills"],
129
116
  maxRetries: 1,
130
- claude: {
131
- model: "claude-sonnet-4-20250514",
132
- effort: "medium",
133
- useV2Preview: true,
134
- maxTurnsPerTask: 12,
135
- allowTextJsonFallback: false
136
- },
117
+
137
118
  codex: {
138
- enabled: true,
139
119
  model: "gpt-5.3-codex",
140
- effort: "medium",
141
- command: "codex",
120
+ effort: "medium", // "low" | "medium" | "high" — applies to all Codex turns
142
121
  timeoutMs: 300000,
143
- multiAgent: false,
122
+ multiAgent: false, // see Multi-agent section
144
123
  perCwdExtraUserRoots: [
145
124
  { cwd: process.cwd(), extraUserRoots: ["/tmp/shared-skills"] }
146
- ]
147
- },
148
- hooks: {
149
- onTaskComplete: async (event, context) => {
150
- console.log(`task done: ${event.taskId} (${event.taskName}) from pid ${context.pid}`);
151
- },
152
- onError: async (event) => {
153
- console.error(event.error);
154
- }
155
- },
156
- hookCommands: {
157
- onTaskComplete: "node ./scripts/on-task-complete.mjs",
158
- onComplete: "echo run complete",
159
- onError: "echo run failed"
160
- },
161
- pr: {
162
- enabled: true,
163
- requireConfirmation: true
125
+ ],
164
126
  },
127
+
165
128
  review: {
166
- // Deprecated compatibility aliases (prefer review.plan.*):
167
- // enabled: true,
168
- // onInvalid: "fail",
169
129
  plan: {
170
130
  enabled: true,
171
- onInvalid: "fail"
131
+ onInvalid: "fail", // "fail" | "warn_skip"
172
132
  },
173
133
  execution: {
174
134
  enabled: true,
175
135
  maxCycles: 2,
176
- onFindings: "auto_fix",
136
+ onFindings: "auto_fix", // "auto_fix" | "report_only" | "fail"
177
137
  validator: {
178
- auto: true,
179
- // commands: ["npm run validate"]
138
+ auto: true, // auto-detect validators from package.json
139
+ // commands: ["npm run validate"] // explicit override
180
140
  },
181
141
  // prompt: "Prefer minimal safe fixes"
182
- }
183
- }
184
- });
185
- ```
186
-
187
- ### Config field reference (OrcaConfig)
188
-
189
- Top-level: `executor`, `anthropicApiKey`, `openaiApiKey`, `runsDir`, `sessionLogs`, `skills`, `maxRetries`, `hooks`, `hookCommands`, `pr`, `review`, `claude`, `codex`.
190
-
191
- - `pr.enabled`, `pr.requireConfirmation`
192
- - `maxRetries` is part of `OrcaConfig`; current planner-generated task retries remain fixed in task graph contracts
193
- - `claude.model`, `claude.effort`, `claude.useV2Preview`, `claude.maxTurnsPerTask`, `claude.allowTextJsonFallback`
194
- - `codex.enabled`, `codex.model`, `codex.effort`, `codex.command`, `codex.timeoutMs`, `codex.multiAgent`, `codex.perCwdExtraUserRoots`
195
- - `review.plan.enabled`, `review.plan.onInvalid`
196
- - `review.execution.enabled`, `review.execution.maxCycles`, `review.execution.onFindings`, `review.execution.validator.auto`, `review.execution.validator.commands`, `review.execution.prompt`
197
- - Deprecated compatibility aliases: `review.enabled`, `review.onInvalid` (still accepted; prefer `review.plan.*`)
198
-
199
- ### Multi-agent mode
142
+ },
143
+ },
200
144
 
201
- Codex supports experimental [multi-agent workflows](https://developers.openai.com/codex/multi-agent) where it can spawn parallel sub-agents for complex tasks.
145
+ pr: {
146
+ enabled: true,
147
+ requireConfirmation: true,
148
+ },
202
149
 
203
- To enable it in Orca, set `codex.multiAgent: true` in your config:
150
+ hooks: {
151
+ onTaskComplete: async (event, context) => {
152
+ console.log(`task done: ${event.taskId} from pid ${context.pid}`);
153
+ },
154
+ onError: async (event) => { console.error(event.error); },
155
+ },
204
156
 
205
- ```js
206
- export default {
207
- codex: { multiAgent: true }
208
- };
157
+ hookCommands: {
158
+ onComplete: "echo run complete",
159
+ onError: "echo run failed",
160
+ onTaskComplete: "node ./scripts/on-task-complete.mjs",
161
+ },
162
+ });
209
163
  ```
210
164
 
211
- When enabled, Orca adds `multi_agent = true` to your global `~/.codex/config.toml`. If you already have multi-agent enabled in your Codex config, it will work automatically without setting anything in Orca.
212
-
213
- > **Note:** Multi-agent is off by default because enabling it modifies your global Codex configuration. It is currently an experimental Codex feature.
214
-
215
- ## Reference
216
-
217
- ### Flags
218
-
219
- Global:
220
-
221
- - `-h, --help`
222
- - `-V, --version`
223
-
224
- `orca` / `orca run`:
225
-
226
- - positional: `[task]`
227
- - also works: `--task <text>`, `-p, --prompt <text>`
228
- - `--spec <path>`
229
- - `--plan <path>`
230
- - `--config <path>`
231
- - `--codex-only` (force Codex executor for this run)
232
- - `--claude-only` (force Claude executor for this run)
233
- - `--codex-effort <low|medium|high>`
234
- - `--claude-effort <low|medium|high|max>`
235
- - `--on-milestone <cmd>`
236
- - `--on-task-complete <cmd>`
237
- - `--on-task-fail <cmd>`
238
- - `--on-invalid-plan <cmd>`
239
- - `--on-findings <cmd>`
240
- - `--on-complete <cmd>`
241
- - `--on-error <cmd>`
165
+ ### Review cycle
242
166
 
243
- `orca plan`:
167
+ After planning, Orca runs a pre-execution review that can edit the task graph (add/remove tasks, update fields, adjust dependencies) before execution starts.
244
168
 
245
- - `--spec <path>`
246
- - `--config <path>`
247
- - `--on-milestone <cmd>`
248
- - `--on-error <cmd>`
169
+ After execution, Orca runs validation commands and asks Codex to review findings. With `onFindings: "auto_fix"`, it applies fixes and retries up to `maxCycles` times, then reports. Set `ORCA_SKIP_VALIDATORS=1` to skip validator auto-detection at runtime.
249
170
 
250
- `orca status`:
251
-
252
- - `--run <run-id>`
253
- - `--last`
254
- - `--config <path>`
255
-
256
- `orca resume`:
257
-
258
- - `--run <run-id>`
259
- - `--last`
260
- - `--config <path>`
261
- - `--codex-only`
262
- - `--claude-only`
263
- - `--codex-effort <low|medium|high>`
264
- - `--claude-effort <low|medium|high|max>`
265
-
266
- `orca cancel`:
267
-
268
- - `--run <run-id>`
269
- - `--last`
270
- - `--config <path>`
171
+ ### Multi-agent mode
271
172
 
272
- `orca answer`:
173
+ Set `codex.multiAgent: true` to spawn parallel Codex agents per task. Faster for large refactors with independent subtasks; higher token cost. **Note:** this writes `multi_agent = true` to your global `~/.codex/config.toml`.
273
174
 
274
- - positional: `[run-id] [answer]`
275
- - `--run <id>`
175
+ ### Skills
276
176
 
277
- `orca list`:
177
+ Orca auto-loads skills in this precedence order (first name wins):
278
178
 
279
- - `--config <path>`
179
+ 1. `config.skills[]`
180
+ 2. `./.orca/skills/` (project-local)
181
+ 3. `~/.orca/skills/` (global)
182
+ 4. Bundled defaults (includes `code-simplifier`)
280
183
 
281
- `orca pr draft|create|publish|status`:
184
+ Inject additional app-server-visible skills via `codex.perCwdExtraUserRoots`.
282
185
 
283
- - `--run <run-id>`
284
- - `--last`
285
- - `--config <path>` (accepted for compatibility; currently unused by PR command run resolution)
186
+ ---
286
187
 
287
- `orca pr publish`:
188
+ ## CLI Reference
288
189
 
289
- - `--run <run-id>`
290
- - `--last`
291
- - `--config <path>` (accepted for compatibility; currently unused by PR command run resolution)
292
- - If neither `--run` nor `--last` is provided: interactive run picker in TTY; non-TTY requires `--run` or `--last`
190
+ ```
191
+ orca <task> Start a run
192
+ orca --spec <path> Run from a spec file
193
+ orca plan --spec <path> Plan only, no execution
194
+
195
+ orca status [--last | --run <id>] Run status
196
+ orca list List all runs
197
+ orca resume [--last | --run <id>] Retry from checkpoint
198
+ orca cancel [--last | --run <id>] Abort a run
199
+ orca answer <run-id> "<text>" Answer a waiting question
200
+
201
+ orca pr draft [--last | --run <id>] Open draft PR
202
+ orca pr create [--last | --run <id>] Create and publish PR
203
+ orca pr publish [--last | --run <id>] Un-draft an existing PR
204
+ orca pr status [--last | --run <id>] PR and CI status
205
+ (non-TTY: --run or --last required)
206
+
207
+ orca skills List loaded skills
208
+ orca setup Interactive setup wizard
209
+ ```
293
210
 
294
- `orca skills`:
211
+ **Key flags for `orca` (run):**
295
212
 
296
- - `--config <path>`
213
+ - `--codex-only` — force Codex executor
214
+ - `--codex-effort <low|medium|high>` — override effort for this run
215
+ - `--config <path>` — explicit config file
216
+ - `--on-complete <cmd>`, `--on-error <cmd>`, `--on-task-complete <cmd>`, `--on-findings <cmd>`, etc.
297
217
 
298
- `orca setup`:
218
+ **Key flags for `orca resume`:**
299
219
 
300
- - `--anthropic-key <key>` override Anthropic API key (written to config)
301
- - `--openai-key <key>` — override OpenAI API key (written to config)
302
- - `--executor <codex|claude>` — explicitly set executor in written config
303
- - `--global` — save to `~/.orca/config.js` (default)
304
- - `--project` — save to `./orca.config.js`
305
- - `--project-config-template` — write typed project hook template to `./orca.config.ts`
306
- - `--skip-project-config` — skip project config prompt
220
+ - `--codex-only`, `--codex-effort <low|medium|high>`, `--config <path>`, `--run <id>`, `--last`
307
221
 
308
- `orca help`:
222
+ **`orca setup` flags:**
309
223
 
310
- - positional: `[command]`show help for a specific command (e.g. `orca help plan`)
311
- - no flags; also works as `orca --help` or `orca <command> --help`
224
+ - `--openai-key <key>`write key to config
225
+ - `--executor <codex>` set executor
226
+ - `--ts` — write TypeScript config
227
+ - `--global` — write to `~/.orca/config.js`
228
+ - `--project` — write to `./orca.config.js`
312
229
 
313
230
  ### Hooks
314
231
 
315
- Hook names:
316
-
317
- - `onMilestone`
318
- - `onTaskComplete`
319
- - `onTaskFail`
320
- - `onInvalidPlan`
321
- - `onFindings`
322
- - `onComplete`
323
- - `onError` (fires on run failures and hook-dispatch failures)
324
-
325
- Run hooks from CLI with `--on-...` flags or from config via `hooks` / `hookCommands`.
326
- Unknown hook keys in config are rejected at load time with an explicit allowed-hook list.
327
-
328
- Hook contract:
329
- - Function hooks (`config.hooks`) are the primary path and are strongly typed per hook event.
330
- - Every function hook receives `(event, context)` where `context` is deterministic: `{ cwd, pid, invokedAt }`.
331
- - Command hooks (`--on-...` and `config.hookCommands`) receive the full event payload as JSON over stdin.
332
- - Orca no longer injects hook payload via `ORCA_*` env vars.
333
-
334
- Smoke-test the hook contract (function + command + concurrency): `npm run smoke:hooks`.
232
+ Available hook names: `onMilestone`, `onTaskComplete`, `onTaskFail`, `onInvalidPlan`, `onFindings`, `onComplete`, `onError`.
335
233
 
336
- ### Run ID Format
337
-
338
- Run IDs are generated as:
339
-
340
- - `<slug>-<unix-ms>-<hex4>`
341
- - Example: `feature-auth-1766228123456-1a2b`
342
-
343
- ### Config File Locations
344
-
345
- - Global: `~/.orca/config.js`
346
- - Project: `./orca.config.js` or `./orca.config.ts`
347
- - Explicit: `--config <path>`
348
-
349
- ### Project Instruction Files
350
-
351
- During planning, Orca automatically injects project instruction files when present:
352
-
353
- 1. `AGENTS.md`
354
- 2. `CLAUDE.md`
355
-
356
- Files are discovered from the project root (nearest `.git` from the spec/task context) and injected in that order.
357
-
358
- If both filenames resolve to the same underlying file (for example, `CLAUDE.md` symlinked to `AGENTS.md`), Orca injects that content only once and keeps the first entry in order (`AGENTS.md`).
359
-
360
- ### Project Skills
361
-
362
- Orca auto-loads skills in this precedence order (first matching skill name wins):
363
-
364
- 1. `config.skills[]`
365
- 2. `./.orca/skills/` (project-local, from current working directory)
366
- 3. `~/.orca/skills/` (global)
367
- 4. Bundled defaults from the Orca package: `<orca package root>/.orca/skills/`
234
+ - Function hooks (`config.hooks`): receive `(event, context)` where `context = { cwd, pid, invokedAt }`
235
+ - Command hooks (`config.hookCommands` / `--on-*` flags): receive full event JSON over stdin
236
+ - Unknown hook keys in config are rejected at load time
368
237
 
369
- This repo ships a bundled default `code-simplifier` skill at `./.orca/skills/code-simplifier/SKILL.md`, and it loads even when Orca runs in arbitrary target repositories. Project/global/config skills can still override it by reusing the same skill name. Planner/reviewer/executor prompts explicitly apply `code-simplifier` guidance for all code-writing and code-review steps while keeping behavior unchanged unless a task explicitly requires behavior changes.
238
+ ### Run ID format
370
239
 
371
- When Orca uses the Codex executor, each turn is sent with both:
372
- - a text input item (`{ type: "text", text: ... }`), and
373
- - explicit skill input items (`{ type: "skill", name, path }`) for every loaded skill in the same precedence order above.
240
+ `<slug>-<unix-ms>-<hex4>` e.g. `feature-auth-1766228123456-1a2b`
374
241
 
375
- At session startup, Orca also calls Codex app-server `skills/list` with `forceReload: true` (and optional `codex.perCwdExtraUserRoots`) so additional app-server-visible skills can be appended deterministically without overriding Orca-local precedence.
242
+ ### Run state locations
376
243
 
377
- This keeps Codex skill loading deterministic instead of relying only on prompt/context pickup.
378
-
379
- ### Run State Locations
380
-
381
- - Run status: `<runsDir>/<run-id>/status.json`
244
+ - Status: `<runsDir>/<run-id>/status.json`
382
245
  - Answer payloads: `<runsDir>/<run-id>/answer.txt`
383
- - `runsDir` defaults to `~/.orca/runs` unless overridden by `ORCA_RUNS_DIR`.
246
+ - `runsDir` defaults to `~/.orca/runs` (override with `ORCA_RUNS_DIR`)
384
247
 
385
- ## Development
248
+ ### Project instruction files
386
249
 
387
- Install dependencies with npm (primary lockfile):
250
+ Orca injects `AGENTS.md` into planning context when found at the project root.
388
251
 
389
- ```bash
390
- npm install
391
- ```
252
+ ---
392
253
 
393
- Run local development and tests with Bun (faster runtime for this project):
254
+ ## Development
394
255
 
395
256
  ```bash
396
- bun run src/cli/index.ts "your task here"
257
+ npm install # canonical install (use npm for deps)
258
+ bun run src/cli/index.ts "task" # local dev
397
259
  bun test src
398
260
  npm run test:postexec-json
399
261
  ```
400
262
 
401
- ## Validation pipeline
402
-
403
- Use the full validation gate before opening/publishing changes:
263
+ Full validation gate (runs lint → type-check → tests → build):
404
264
 
405
265
  ```bash
406
266
  npm run validate
407
267
  ```
408
268
 
409
- This runs, in order:
410
-
411
- 1. `npm run lint` (Oxlint syntax/style/static rules)
412
- 2. `npm run lint:type-aware` (Oxlint + tsgolint alpha type-aware + type-check diagnostics)
413
- 3. `npm run typecheck` (TypeScript Native Preview via `tsgo --noEmit`, with environment fallback to `tsc --noEmit`)
414
- 4. `npm run test`
415
- 5. `npm run build`
416
-
417
- `npm run build` remains `tsc` because the native preview compiler is used here as a fast typecheck gate; production JS emission stays on stable `typescript` for predictable package output.
418
-
419
- ## GitHub release tracking (tags only)
420
-
421
- Orca includes a lightweight GitHub Actions workflow at `.github/workflows/release.yml`:
422
-
423
- - Trigger: push a tag matching `v*` (workflow only releases SemVer tags like `v0.4.0` or `v0.4.0-rc.1`)
424
- - Behavior: create or update the matching GitHub Release
425
- - Notes: auto-generated by GitHub (`generate_release_notes: true`)
426
-
427
- This workflow is for release tracking/changelogs only. It does not publish to npm.
428
-
429
- ## npm publish automation (GitHub Actions)
269
+ ### Package manager policy
430
270
 
431
- Orca includes a publish workflow at `.github/workflows/publish.yml`.
271
+ - **npm** canonical for deps, CI, and publish (`package-lock.json`)
272
+ - **Bun** — used as runtime/test runner locally (`bun.lock`)
432
273
 
433
- - Primary trigger: push a tag matching `v*` (for example `v1.2.3` or `v1.2.3-rc.1`)
434
- - Optional fallback: manual `workflow_dispatch`
435
- - Required secret: `NPM_TOKEN`
436
- - Behavior: checkout → Node setup (npm registry auth) → safety checks → `npm ci` → `npm run validate` → publish if version is not already on npm
274
+ Commit both lockfiles. When changing deps: `npm install && bun install`.
437
275
 
438
- Safety checks enforced before publish:
276
+ ---
439
277
 
440
- 1. Tag must be SemVer-like (`vX.Y.Z` with optional prerelease/build metadata)
441
- 2. Release commit must be reachable from the repository default branch
442
- 3. `package.json` version must match the tag version (without the leading `v`)
443
- 4. If the version already exists on npm, publish is skipped as a safe no-op
444
-
445
- ### Safe setup
446
-
447
- 1. In GitHub, open **Settings → Secrets and variables → Actions** for this repository.
448
- 2. Add a repository secret named `NPM_TOKEN`.
449
- - Create this token in npm as a granular automation/publish token scoped only to `orcastrator`.
450
- 3. Use least privilege, avoid reusing broad account tokens, and rotate the token periodically.
451
-
452
- ### Safe run flow
453
-
454
- 1. Bump `package.json` to the intended release version.
455
- 2. Create and push a matching tag, for example: `git tag v1.2.3 && git push origin v1.2.3`.
456
- 3. Verify the package on npm after the workflow completes.
457
- 4. If needed, run the same workflow manually from **Actions → npm Publish → Run workflow** as a fallback (use an existing tag so the workflow publishes that exact tagged commit).
458
-
459
- ## Package manager + lockfile policy
460
-
461
- Orca uses a mixed runtime/tooling model on purpose:
462
-
463
- - **npm is canonical for dependency resolution, release builds, and deterministic installs**.
464
- - **Bun is used as a runtime/test runner in local workflows** (`dev`, `start`, `test`).
465
-
466
- Commit both lockfiles:
467
-
468
- - `package-lock.json` — canonical dependency graph for npm/CI/publish
469
- - `bun.lock` — Bun runtime resolution parity for local Bun commands
470
-
471
- When dependencies change, update both lockfiles in the same PR:
472
-
473
- ```bash
474
- npm install
475
- bun install
476
- ```
278
+ ## License
477
279
 
478
- This keeps npm and Bun behavior aligned without forcing a disruptive full migration.
280
+ MIT see [LICENSE](./LICENSE).