@orkestrel/scaffold 0.0.21 → 0.0.22

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 (68) hide show
  1. package/dist/bin/scaffold.js +371 -140
  2. package/dist/bin/scaffold.js.map +1 -1
  3. package/dist/host/AGENTS.md +61 -42
  4. package/dist/host/CLAUDE.md +39 -408
  5. package/dist/host/agents/orchestration.md +454 -0
  6. package/dist/host/agents/skills/enterprise-bootstrap/SKILL.md +25 -7
  7. package/dist/host/agents/skills/orkestrel-align-packages/SKILL.md +2 -2
  8. package/dist/host/agents/skills/orkestrel-build-application/SKILL.md +42 -31
  9. package/dist/host/agents/skills/orkestrel-build-application/references/application.md +129 -0
  10. package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +3 -3
  11. package/dist/host/agents/skills/orkestrel-debrief/references/field-testing.md +2 -2
  12. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +167 -0
  13. package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +98 -0
  14. package/dist/host/agents/skills/orkestrel-falsify/references/reconcile.md +148 -0
  15. package/dist/host/agents/skills/orkestrel-harden-package/SKILL.md +4 -2
  16. package/dist/host/agents/skills/orkestrel-harden-package/references/centralization.md +5 -5
  17. package/dist/host/agents/skills/orkestrel-harden-package/references/research.md +2 -0
  18. package/dist/host/agents/skills/orkestrel-polish-surface/SKILL.md +11 -6
  19. package/dist/host/claude/agents/analyst.md +59 -0
  20. package/dist/host/claude/agents/application.md +1 -1
  21. package/dist/host/claude/agents/builder.md +1 -1
  22. package/dist/host/claude/agents/checker.md +5 -1
  23. package/dist/host/claude/agents/codex.md +120 -94
  24. package/dist/host/claude/agents/grok.md +44 -32
  25. package/dist/host/claude/agents/implementer.md +1 -1
  26. package/dist/host/claude/agents/orkestrel.md +1 -1
  27. package/dist/host/claude/agents/planner.md +9 -3
  28. package/dist/host/claude/agents/researcher.md +6 -5
  29. package/dist/host/claude/agents/reviewer.md +12 -6
  30. package/dist/host/claude/agents/scout.md +7 -4
  31. package/dist/host/claude/agents/verifier.md +1 -1
  32. package/dist/host/claude/rules/application.md +17 -16
  33. package/dist/host/claude/rules/architecture.md +41 -22
  34. package/dist/host/claude/rules/documentation.md +2 -1
  35. package/dist/host/claude/rules/names.md +7 -6
  36. package/dist/host/claude/rules/quality.md +65 -18
  37. package/dist/host/claude/rules/styles.md +1 -1
  38. package/dist/host/claude/rules/tests.md +12 -6
  39. package/dist/host/claude/rules/typescript.md +1 -1
  40. package/dist/host/claude/rules/workspace.md +6 -3
  41. package/dist/host/claude/settings.json +2 -0
  42. package/dist/host/claude/skills/orkestrel-falsify/SKILL.md +10 -0
  43. package/dist/host/codex/agents/analyst.toml +13 -4
  44. package/dist/host/codex/agents/checker.toml +1 -1
  45. package/dist/host/codex/agents/grok.toml +2 -1
  46. package/dist/host/codex/agents/opus.toml +1 -1
  47. package/dist/host/codex/agents/planner.toml +1 -1
  48. package/dist/host/codex/agents/researcher.toml +2 -2
  49. package/dist/host/codex/agents/reviewer.toml +1 -1
  50. package/dist/host/codex/agents/scout.toml +2 -2
  51. package/dist/host/codex/config.toml +23 -70
  52. package/dist/host/cursor/rules/orchestration.mdc +33 -0
  53. package/dist/host/guides/src/scaffold.md +301 -123
  54. package/dist/host/manifest.json +47 -1
  55. package/dist/host/tests/setupPolicy.ts +83 -3
  56. package/dist/src/core/index.cjs +404 -63
  57. package/dist/src/core/index.cjs.map +1 -1
  58. package/dist/src/core/index.d.cts +119 -41
  59. package/dist/src/core/index.d.ts +119 -41
  60. package/dist/src/core/index.js +401 -64
  61. package/dist/src/core/index.js.map +1 -1
  62. package/dist/src/server/index.cjs +83 -33
  63. package/dist/src/server/index.cjs.map +1 -1
  64. package/dist/src/server/index.d.cts +32 -16
  65. package/dist/src/server/index.d.ts +32 -16
  66. package/dist/src/server/index.js +84 -35
  67. package/dist/src/server/index.js.map +1 -1
  68. package/package.json +4 -4
@@ -1,414 +1,45 @@
1
1
  @AGENTS.md
2
+ @.agents/orchestration.md
2
3
 
3
- # Operating contract
4
+ # Claude Code bridge
4
5
 
5
- `AGENTS.md` and its applicable `.claude/rules/*.md` files govern code. This file governs
6
- orchestration. User instructions win; coding rules win on code substance; this file wins only
7
- on agent operation. `.codex/config.toml` is the Codex-side mirror of this file, not a second
8
- policy.
9
-
10
- Every dispatch must tell the executor to read `AGENTS.md`, the applicable rule files, the
11
- dispatch-named skill and its required references, and the governing guide/spec before acting.
12
-
13
- ## The four engines
14
-
15
- One workflow runs across both providers. Each engine has one job, and no engine takes another's.
16
-
17
- | Engine | Job | Posture |
18
- | --------------- | ----------------------------------------------------------------------- | ------------------------------------------------- |
19
- | **Fable** | Top-level orchestration and final acceptance in Claude Code | Owns the goal, plan, reconciliation, and decision |
20
- | **Cursor Grok** | Research, scouting, context-heavy reading, distillation | Read-only; returns evidence, never decisions |
21
- | **Opus 5** | Subjective and creative design, design-fit review, and implementation | Proposes, audits, and implements; never accepts |
22
- | **GPT-5.6 Sol** | Objective and realistic analysis, correctness audit, and implementation | Proposes, audits, and implements; never accepts |
23
-
24
- - **Fable orchestrates and accepts, and does nothing else.** It is never a subagent, never a
25
- Codex route, and Codex must never invoke it.
26
- - **Grok absorbs context.** Any task whose cost is reading — mapping terrain, surveying prior
27
- art, sweeping a large diff, reconciling scattered sources — goes to Grok, which returns
28
- distilled evidence with `file:line` pointers and no raw dumps.
29
- - **Opus 5 and Sol are explicit adversaries during design.** Opus argues the subjective case
30
- (shape, taste, naming, ergonomics, what the API should feel like); Sol argues the objective
31
- case (what the code, contracts, and constraints actually permit). They run independently on
32
- the same brief and disagree on the record.
33
- - **Opus 5 and Sol are mirrored implementers.** Nontrivial implementation routes to either:
34
- the Orchestrator picks per unit — objective, constraint-heavy, mechanical-precision work
35
- favours Sol; subjective, API-shape, naming, and documentation-voice work favours Opus.
36
- Terra and Cursor Composer are not implementation routes and no `composer` role exists.
37
- - **After implementation Opus 5 and Sol audit independently** — Opus on design fit, Sol on
38
- correctness and constraint satisfaction — and the orchestrator reconciles their evidence
39
- into one verdict.
40
- - **Lower-cost native agents (Sonnet, Terra) do fully specified units and read-only
41
- evidence only.** A specified rename, an app-layer expansion, a conformance checklist, a
42
- gate run, a bounded primary-source question, a reconnaissance sweep. They never
43
- substitute for Grok, Opus 5, or Sol: `researcher` and `scout` are the native evidence
44
- lanes for bounded questions and the fallback when the Grok bench is dark, never the
45
- route for repository-scale absorption or judgment.
46
-
47
- The orchestrator reconciles; no external engine reconciles itself or accepts its own work.
48
- In Claude Code the orchestrator is the top-level Fable session. When Codex is primary, the
49
- Sol-led Codex main session reconciles in Fable's place and the rest of the model is unchanged.
50
-
51
- ## Scope
52
-
53
- - The top-level agent is the **Orchestrator**: it preserves the goal, plan, decisions,
54
- cross-unit state, integration, and final acceptance.
55
- - A dispatched subagent is an **Executor**: it performs its bounded assignment directly,
56
- spawns nothing, and returns the required distillate.
57
- - For a typo, a one-line fix, or one lookup, work directly. Orchestrate when isolation,
58
- parallelism, independent review, or substantial context justifies it.
59
-
60
- ## Roles
61
-
62
- One role set, mirrored per provider. Name the role and state its engine explicitly in every
63
- dispatch, even when the role file pins it.
64
-
65
- | Job | Claude role (`.claude/agents/`) | Codex role (`.codex/agents/`) | Engine |
66
- | ---------------------------------------- | ------------------------------- | ----------------------------- | ----------------------------- |
67
- | Research, scouting, distillation | `grok` | `grok` | Cursor Grok (bridge) |
68
- | Creative design and alternatives | `planner` | `planner` | Opus 5 (native / bridge) |
69
- | Design-fit review and audit | `reviewer` | `reviewer` | Opus 5 (native / bridge) |
70
- | Objective analysis and correctness audit | `codex` route `analyst` | `analyst` | GPT-5.6 Sol (bridge / native) |
71
- | Nontrivial implementation (objective) | `codex` route `implementer` | `implementer` | GPT-5.6 Sol (bridge / native) |
72
- | Nontrivial implementation (subjective) | `implementer` | `implementer` route `opus` | Opus 5 (native / bridge) |
73
- | Fully specified mechanical unit | `builder` | `builder` | Sonnet / Terra |
74
- | Fully specified app-layer unit | `application` | `application` | Sonnet / Terra |
75
- | Bounded primary-source research | `researcher` | `researcher` | Sonnet / Terra |
76
- | Repository reconnaissance | `scout` | `scout` | Sonnet / Terra |
77
- | Mechanical conformance evidence | `checker` | `checker` | Sonnet / Terra |
78
- | Gate evidence | `verifier` | `verifier` | Sonnet / Terra |
79
- | Ecosystem evidence | `orkestrel` | `orkestrel` | Sonnet / Terra |
80
-
81
- - A **bridge** role is a cheap driver whose only work is invoking another provider's CLI. It
82
- never implements, judges, or endorses the result.
83
- - Claude role frontmatter accepts Claude models only. Grok is reached through `grok`, Sol
84
- through `codex`; never put an external model in `model:`.
85
- - Use Claude aliases (`fable`, `opus`, `sonnet`), never fixed Claude IDs or `inherit`. Never
86
- set `CLAUDE_CODE_SUBAGENT_MODEL`; it flattens the engine split.
87
- - The main Claude session uses `fable` via `/model fable` or `"model": "fable"`; if configured
88
- otherwise its Orchestrator duties are unchanged.
89
- - Opus roles use high effort; Sonnet and Terra roles use low or medium; bridge drivers use the
90
- cheapest tier that can run a CLI.
91
- - Role files pin engine, effort, tools, permissions, and charter. Claude Code
92
- hot-reloads edits to existing role files.
93
-
94
- ## Permission and safety floor
95
-
96
- Every role honours this floor and no dispatch may widen it.
97
-
98
- - **Agents are autonomous.** Constrain only what is a genuine security or destruction risk;
99
- do not gate routine work behind approval prompts or turn budgets. Roles run to completion
100
- and finish their assignment patiently.
101
- - **Read-only roles carry no `Edit` and no `Write`.** The tool allowlist is the guarantee.
102
- The Orchestrator includes the actual diff and status evidence in every review dispatch.
103
- `verifier` has no edit/write tools and never fixes a failure.
104
- - **Writing roles run in the main checkout, strictly serialized.** One writer at a time,
105
- dispatched from a clean committed baseline; each owns disjoint files and treats every
106
- shared file as report-only.
107
- - No role commits, pushes, tags, publishes, installs dependencies, or runs a destructive
108
- command.
109
- - No role reads, prints, copies, uploads, or packages a secret: `CURSOR_API_KEY`, Codex auth
110
- files, `.env*`, `.npmrc`, `auth.json`, keys, or tokens.
111
- - Concurrent executors never run tree-wide `format`, lint `--fix`, or `build`; they validate
112
- read-only and scoped to their own files.
113
- - Hooks stay light. A Stop hook may run only cheap changed-file verification such as
114
- `git diff --check`; it never duplicates the gate suite. Gates belong to `verifier`.
115
-
116
- ## Context and decomposition
117
-
118
- - Keep the main context at decision level. Send large reads, repository scans, raw logs and
119
- diffs, and exploratory sweeps to `grok`; consume the distillate.
120
- - Decompose by required context and independently verifiable acceptance criteria, not by task
121
- type.
122
- - Instructions flow down fully specified; findings flow up smaller than the context consumed.
123
- - Parallelize independent work; serialize dependencies and shared-file contention.
124
- - The Orchestrator owns the plan and every final decision. Design engines propose; writers
125
- execute; auditors advise.
126
-
127
- ## Writing concurrency
128
-
129
- Concurrent executors share a filesystem unless isolated. Prevent clobbered edits, tree-wide
130
- formatter and build races, cache phantoms, and validation cross-talk:
131
-
132
- 1. Serialize writing executors in the main checkout; commit a checkpoint before each
133
- writing dispatch so git is the rollback mechanism.
134
- 2. Assign disjoint owned files plus explicit shared and off-limits files.
135
- 3. Shared files are report-only; executors return exact patches for serial integration.
136
- 4. Concurrent executors run only read-only, scoped validation. A tree-wide result may contain
137
- siblings' in-flight failures; an executor reports only its owned scope.
138
- 5. After integration, clear shared caches when needed, then one independent `verifier` runs the
139
- authoritative tree-wide sweep. Writer self-reports never establish green.
140
-
141
- ## Execution loop
142
-
143
- At session start, before planning, the Orchestrator records bench liveness with the two cheap
144
- probes (`codex --version`; `agent`/`agent.cmd` `--version`) and plans routing against that
145
- record. Probes are read-only; a dark bench is noted with its fallback, never silently
146
- absorbed.
147
-
148
- 1. **Absorb.** Dispatch `grok` for terrain, prior art, and the reading the decision needs. In
149
- an Orkestrel repo dispatch `orkestrel` alongside it for live package state. Skip only when
150
- the ground is already known.
151
- 2. **Design adversarially.** Dispatch `planner` (Opus 5) and `analyst` (Sol) on the SAME brief,
152
- in parallel, without showing either the other's answer. Reconcile them yourself into one
153
- plan: units, dependencies, ownership, parallel/serial order, acceptance criteria, risks.
154
- Surface the plan before dispatch, including a routing ledger: every unit names its role
155
- AND engine. A unit whose work class belongs to a bench (reading-heavy → Grok; objective
156
- audit or objective implementation → Sol) that is routed to a Claude-native agent without a
157
- recorded bench-dark deviation is a dispatch deviation.
158
- 3. **Implement.** Route each nontrivial objective unit to the Sol `implementer` and each
159
- nontrivial subjective unit to the Opus `implementer` — main checkout, one sole writer at a
160
- time. Route a fully specified, taste-free unit to `builder`. Never route implementation to
161
- an engine the unit's judgment load exceeds.
162
- 4. **Integrate.** Evaluate each distillate against its acceptance criteria; apply shared-file
163
- patches serially; route cross-cutting findings.
164
- 5. **Audit adversarially.** Every nontrivial implementation gets `reviewer` (Opus 5, design
165
- fit) and `analyst` (Sol, correctness and constraints) independently, plus `checker` for
166
- mechanical conformance. An audit brief states its subject as numbered falsifiable claims
167
- and requires per-claim CONFIRMED/BROKEN with evidence, per the Falsification law in
168
- `.claude/rules/quality.md`. In a fix round the unit's auditor is an engine that did not
169
- write it. Multi-round audits use one fixed verdict shape with a single terminal line,
170
- defined by the campaign skill. Reconcile their evidence; a finding neither engine can
171
- substantiate against the evidence is dropped on the record.
172
- 6. **Verify.** One independent `verifier` runs the authoritative gates.
173
- 7. **Accept.** The Orchestrator decides and reports concise outcomes, decisions, evidence, and
174
- remaining risk.
175
-
176
- ## Deviation protocol
177
-
178
- When reality diverges from a writing dispatch:
179
-
180
- 1. The writer stops and reports: expected, found, exact evidence, done/not done, and at most
181
- one short hypothesis. It does not investigate, improvise, or alter the plan.
182
- 2. The Orchestrator triages:
183
- - obvious correction → tighten and re-dispatch;
184
- - missing mechanical evidence → dispatch `verifier`;
185
- - unknown terrain → dispatch `grok` with the report and the plan slice;
186
- - unknown design or root cause → dispatch `planner` and `analyst` on the question.
187
- 3. The Orchestrator decides, updates the plan, and re-dispatches.
188
-
189
- Workflow failures use the same ladder; do not absorb their raw logs into the main context.
6
+ `AGENTS.md` governs code. `.agents/orchestration.md` governs agent operation, and every harness
7
+ follows it. This file adds only what Claude Code does differently, and cannot weaken either.
190
8
 
191
9
  ## Dispatch mechanism
192
10
 
193
- - **Native first.** A model native to the running harness launches through that harness's own
194
- agent and workflow mechanism in Claude Code, Claude subagents via the Agent tool and
195
- Workflows; in a Codex session, Codex-native agents; in Cursor, Cursor-native sessions. MCP
196
- and CLI transports exist solely to reach a model that is NOT native to the running harness;
197
- never route a native model through its own CLI or an MCP loopback.
198
- - Use the Agent tool when later control flow depends on the previous result.
199
- - Use a Workflow for a known deterministic fan-out, staged pipeline, or loop; serialize
200
- writing nodes — never two concurrent writers in the tree.
201
- - Every node names a role and its engine.
202
-
203
- Every dispatch is a file before it is a launch:
204
-
205
- - The brief is written to a file under `tmp/`, named for its unit, before the unit is
206
- launched, whatever engine executes it. A brief composed only inside a launch argument
207
- cannot be corrected, resumed, or re-run once that call ends.
208
- - The unit's returned report is captured to a file beside its brief under the same unit name,
209
- so a unit's instruction and its outcome are one pair on disk.
210
- - A re-run amends its brief instead of restating it: a mid-campaign correction produces a
211
- successor file recording what changed and why, and the original stays. A fix round's brief
212
- names the findings it carries and where each came from.
213
- - Brief and report files are unit evidence, not deliverables. They are never committed, and
214
- they are swept when the campaign that produced them is accepted.
215
- - Anything in a brief or a report that must outlive the campaign is promoted into a durable
216
- artifact a commit message, a guide, a rule, a retrospective — before the sweep. What is
217
- only in a swept file did not survive.
218
-
219
- Every dispatch contains:
220
-
221
- - **Role/engine** — named role and explicit engine.
222
- - **Objective** one concrete outcome.
223
- - **Context** the evidence slice, paths, decisions, `AGENTS.md`, applicable rules, the
224
- skill name and required references (or explicit none), and the guide/spec.
225
- - **Unknowns** what the Orchestrator does not yet know that the unit needs, named as
226
- unknown, with how the unit reports back on it. A brief that cannot be fully specified says
227
- so instead of shipping a guess the executor would have to invent an answer around.
228
- - **Scope** — owned files, shared and off-limits files, allowed tools, permission limits.
229
- - **Execution** — the executor performs the assignment directly and spawns nothing. Every
230
- brief states it; an executor deep in a task does not re-read this contract.
231
- - **Output** — the exact distilled return shape; no process diary.
232
- - **Deviation contract** — required stop/report behaviour for writers.
233
- - **Acceptance criteria** — independently checkable completion conditions.
234
- - **Review evidence** — for `reviewer` and `checker`, the actual diff and status output;
235
- omitting either is a dispatch deviation. For any claim about a rendered or externally
236
- driven surface, the capture portfolio is the review input and source is corroboration.
237
-
238
- After reconciling findings into briefs, walk the retained finding list once: every finding
239
- names the brief item that carries it. A finding with no carrier is a dropped finding.
240
-
241
- ## Bench mechanics
242
-
243
- External engines widen capacity; they never inherit authority. Their output is a proposal or
244
- hypothesis until it is verified against source and accepted by the Orchestrator. Every bridge
245
- verifies its CLI is present before running and stops with a deviation report naming the
246
- fallback when it is not. Benches are cross-provider reach only: a model native to the running
247
- harness never crosses a bridge.
248
-
249
- Four bench laws apply to every external engine:
250
-
251
- - **Transport by work class.** A short interactive exchange (one bounded question or a
252
- follow-up on a live thread, expected to finish in about two minutes) may use an MCP
253
- transport where one exists. Long-running work — audits, implementation units, anything
254
- multi-minute — uses the journaled CLI and never MCP: an interrupted MCP call loses its
255
- session invisibly, while a journal survives any client-side failure.
256
- - **Journal first.** Every bench invocation leaves a tailable on-disk record beside its brief
257
- under `tmp/<bench>/` (`tmp/codex/`, `tmp/cursor/`): the event stream or output log and the
258
- final answer. Every long exec also carries exactly one Monitor on its journal — a filtered
259
- tail that emits milestones (commands run, files changed, agent messages, terminal states)
260
- and never the raw event firehose — so progress arrives in the conversation while the
261
- journal stays tailable for depth. The filter exits on the exec's terminal event, so the
262
- monitor's lifecycle matches the exec's and no watcher outlives its subject. The journal's
263
- mtime is the liveness signal; the session id in the journal head is the recovery handle.
264
- - **Tracked, never loose.** Every bench unit is registered in the session task registry at
265
- launch — subject, journal path, session id — and completed there at acceptance, so "what is
266
- running" always has a first-class answer instead of a recollection of a command.
267
- - **Ephemeral journals.** Bridges never delete journals; the Orchestrator sweeps them with
268
- the campaign's other unit evidence at acceptance, after the final gate evidence is
269
- recorded. A journal surviving past its campaign is residue.
270
-
271
- Every long bench exec is launched by the Orchestrator as a harness-tracked background command
272
- under a hard time cap, never detached from inside a bridge agent: the harness owns the
273
- lifecycle, completion re-invokes the session, and the cap kills a wedged bench loudly instead
274
- of trusting the bridge to report its own failure. A wedged bridge is silent, and silence must
275
- never read as progress. A stalled journal or a cap-killed exec follows the deviation ladder,
276
- with the session id from the journal head as the recovery handle. Size the cap from the
277
- observed high mark of comparable units plus an independently budgeted gate allowance plus
278
- explicit slack, never from the estimate alone. The first use of any CLI flag, subcommand,
279
- quoting form, or stdin combination happens in a throwaway probe, never inside a dispatched
280
- unit.
281
-
282
- ### Cursor Grok
283
-
284
- - Reached only through the `grok` role, in ask mode:
285
- `<agent-cli> -p --trust --mode=ask --model "$CURSOR_GROK_MODEL" "<prompt>" | tee tmp/cursor/<unit>.log`.
286
- `<agent-cli>` resolves as bare `agent`, then `agent.cmd` (Windows installs ship only
287
- `.cmd`/`.ps1` shims, so bare `agent` does not resolve in Bash), then
288
- `"$LOCALAPPDATA/cursor-agent/agent.cmd"` — verified with `--version` before first use. The
289
- prompt points at the unit's brief file, `tmp/cursor/<unit>-brief.md`. The tee'd log is the
290
- bench's journal.
291
- - A long ask-mode run obeys the same launch, stream, and ledger discipline as a Codex exec:
292
- the Orchestrator starts it as a harness-tracked background command under a time cap,
293
- registers the unit in the task registry, and arms one Monitor on the tee'd log for
294
- milestones. The `grok` bridge drafts the brief; it never detaches a run and ends its turn.
295
- - Read-only. `--force` never appears. Nothing it returns is applied.
296
- - Read the exact model id from `agent models` and store it in `CURSOR_GROK_MODEL`. Never guess
297
- or substitute.
298
- - Never expose `CURSOR_API_KEY` in a command, a log, or a report.
299
- - **Cursor is an MCP client, not a server.** The CLI ships no server mode; `.cursor/mcp.json`
300
- (project-level, shared by editor and CLI) registers the `codex` and `claude` MCP servers so
301
- Grok sessions reach Sol and Opus tool-natively — the client-side inverse of the other
302
- benches. Approve once per machine with `agent mcp enable codex` / `agent mcp enable claude`.
303
- - Fallback when the CLI, model, or authentication is unavailable: state the gap and hand the
304
- reading to the Orchestrator, `planner`, or `analyst` directly.
305
-
306
- ### Codex Sol
307
-
308
- - Reached from Claude Code only through the `codex` role, on journaled, resumable
309
- `codex exec`; in a Codex session these are native agents.
310
- - **Every run is journaled and resumable.** `--json` streams the event log to
311
- `tmp/codex/<unit>.jsonl` (gitignored; the Monitor emits its milestones and the user tails it
312
- for depth — nobody polls), `--output-last-message` captures the final answer as a file, and
313
- the session id from the journal head goes in the unit's task registry entry and every bridge
314
- report so follow-ups continue the same session via `codex exec resume <session-id>` with
315
- context intact. `--output-schema` is available when the Orchestrator wants a
316
- machine-checkable return shape.
317
- - **Transport is chosen by work class.** The MCP wiring (`.mcp.json` registers
318
- `codex mcp-server`; verified tools `codex` to start a session, `codex-reply` to continue
319
- one; settings enable project MCP servers without prompting, so the wiring works headless —
320
- including Claude Code Cloud once the codex binary is installed and device-authed) serves
321
- short interactive exchanges only, and the bridge persists the thread id to
322
- `tmp/codex/<unit>.session` the moment a response carries it — an interrupted MCP call with
323
- no persisted id is unrecoverable and treated as failed. Long-running work (audits,
324
- implementation units) always uses the journaled CLI, and the Orchestrator — never a bridge
325
- agent — launches it as a harness-tracked background command: the brief at
326
- `tmp/codex/<unit>-brief.md`, then one
327
- `timeout <cap> codex exec --json … < /dev/null > tmp/codex/<unit>.jsonl` with
328
- `--output-last-message`, started through the shell's background-task mechanism so the exec
329
- appears in the session's task list, its completion re-invokes the session, and the cap kills
330
- a wedged bench loudly. Stdin is always closed with `< /dev/null`: a background-launched exec
331
- can inherit an open stdin pipe and wedge forever at "Reading additional input from stdin..."
332
- before its first event, and a cap kill is the only thing that would ever surface it.
333
- The journal remains the durable, resumable record and the session id the recovery handle. A
334
- bridge that backgrounds an exec and ends its turn orphans it — no owner, no completion
335
- signal, no death notice — so bridges keep two jobs only: drafting briefs and short MCP
336
- exchanges. Placeholder wait loops and wait-promise reports are deviations. Every exec names
337
- its working directory with `-C`, and an exec rooted outside a trusted git repository dies at
338
- launch unless `--skip-git-repo-check` is passed, so cross-repo and fleet-container work
339
- rooted outside a checkout always passes it. A launch is not a launch until the journal grows
340
- past its header: the Orchestrator confirms the event stream advanced beyond the
341
- session-configured head before recording the exec started, and treats an instantly-dead
342
- journal as a failed launch whose tail is the evidence. Recovery ladder on interruption:
343
- persisted-id `codex-reply` re-emission → fresh CLI session with the same brief file → for an
344
- interrupted CLI exec, the journal survives and the Orchestrator chooses resume or fresh.
345
- - **The inverse bridge exists too:** Claude Code exposes `claude mcp serve`, registered in
346
- Codex's global config (`codex mcp add claude -- claude mcp serve`) so Codex-primary
347
- sessions reach Claude/Opus as first-class MCP tools instead of shelling to the CLI.
348
- - `analyst` runs `gpt-5.6-sol` at high effort with `--sandbox read-only` in the current
349
- checkout, for objective analysis, the adversarial design argument, diagnosis, and the
350
- post-implementation correctness audit.
351
- - `implementer` runs `gpt-5.6-sol` at high effort with `--sandbox workspace-write` in the
352
- main checkout as the sole writer from a clean committed baseline, for bounded
353
- implementation.
354
- - **The exec sandbox denies network** (`--unshare-net`). Any unit that needs the registry or
355
- any other remote endpoint — lockfile generation, real installs, live fetches — belongs to
356
- the Orchestrator's own tracked commands or a network-capable native agent, never to a Codex
357
- exec. A Sol exec observed hanging on `npm` until its cap fires is the signature of this
358
- misroute, not of a slow bench.
359
- - Raise the analyst to `xhigh` only for a stated hard reasoning need. `gpt-5.6-terra` serves
360
- only explicitly mechanical, taste-free roles. `gpt-5.6-luna` requires a proven repeatable,
361
- high-volume workload.
362
- - The bridge never commits, pushes, installs, authenticates, or reads credentials.
363
- - Claude Code Cloud setup installs `@openai/codex` globally but never authenticates; the
364
- snapshotted setup state must contain no Codex credentials.
365
- - At the start of each live Cloud session the user runs `codex login --device-auth` and
366
- completes ChatGPT approval in the browser. `scripts/codex.sh` only reports readiness; it
367
- never installs, authenticates, logs out, reads the auth cache, or performs a model call.
368
- - A probe that finds the binary present but authentication unavailable starts recovery in the
369
- same turn instead of recording the bench dark and waiting: the Orchestrator backgrounds
370
- `codex login --device-auth` with its output captured to `tmp/codex/login.log`, surfaces the
371
- verification URL and one-time code to the user the moment they appear there, arms a watcher
372
- on completion, and re-probes `codex login status` when it fires. The bench comes live
373
- mid-session with no restart; a session that sits dark until the user asks for the login has
374
- failed the probe, not the bench.
375
- - If that recovery cannot complete — device login unavailable, declined, or expired — the
376
- Codex bench is dark. Fall back to `planner`/`reviewer` (Opus 5) and `builder`, and say so.
377
- Never substitute an API key, access token, copied `auth.json`, or another login flow unless
378
- the user changes this policy.
379
-
380
- Codex environment defaults:
381
-
382
- ```text
383
- CODEX_ANALYST_MODEL=gpt-5.6-sol
384
- CODEX_ANALYST_EFFORT=high
385
- CODEX_IMPLEMENTER_MODEL=gpt-5.6-sol
386
- CODEX_IMPLEMENTER_EFFORT=high
387
- ```
388
-
389
- ### Claude Opus from Codex
390
-
391
- - Reached only through the Codex `planner` and `reviewer` bridges, which invoke the local
392
- Claude CLI pinned to `--model opus`.
393
- - Read-only: the bridge passes a brief and returns the response; it applies nothing.
394
- - Never pin `fable` and never route orchestration or acceptance across the bridge.
395
- - Fallback when the CLI or authentication is unavailable: state the gap, run the design or
396
- design-audit pass in the Sol main session, and record that the subjective adversary was
397
- missing from that round.
398
-
399
- ## Acceptance laws
400
-
401
- - No writer's and no external engine's self-assessment is authoritative.
402
- - Do not let a lower-cost native agent stand in for Grok, Opus 5, or Sol; do not spend Opus 5
403
- on discovery or mechanical edits; do not route judgment-bearing implementation away from Sol.
404
- A bench substitution is legitimate only when the same session records the bench dark (CLI
405
- missing, auth expired, model unavailable) — the fallback is then named in the plan, not
406
- improvised silently.
407
- - Do not run the design adversaries on different briefs, or show either one the other's answer
408
- before both have returned.
409
- - Do not accept unreviewed implementation, unverified hypotheses, shared-tree writing races,
410
- implicit engines, fixed Claude IDs, or verbose completed-work residue.
411
- - A claim about a rendered or externally driven surface is evidenced by its capture or a real
412
- foreign client driving it, never by source alone; where no such surface exists this law is
413
- inert.
414
- - Final acceptance belongs only to the Orchestrator, after independent audit and gate evidence.
11
+ - Use the Agent tool for a single dispatch, including when later control flow depends on its result.
12
+ - Use a Workflow for a deterministic fan-out, staged pipeline, or loop. Serialize writing nodes.
13
+ - Recover an interrupted Workflow with `resumeFromRunId`.
14
+ - Never dispatch an adversarial lane with a context-inheriting subagent type such as `fork`. A lane
15
+ must start clean, or it inherits the Orchestrator's framing and stops being independent.
16
+
17
+ ## Models
18
+
19
+ - Use the aliases `opus` and `sonnet`. Never use a fixed Claude model ID and never use `inherit`.
20
+ - Never set `CLAUDE_CODE_SUBAGENT_MODEL`. It flattens the engine split.
21
+ - Run the main session on `opus` at high effort, set by `/model opus` or `"model": "opus"`. Opus 5
22
+ is the Orchestrator in this harness. Its Orchestrator duties are unchanged if it is configured
23
+ otherwise.
24
+ - The Orchestrator shares its engine with `planner`, `reviewer`, and the Opus `implementer`. Run
25
+ the Sol `analyst` in every design round and every audit round so the judgment is not single-engine.
26
+ - Claude role frontmatter accepts Claude models only. Reach Grok through `grok`, and Sol through
27
+ `analyst` and `codex`. Never put an external model in `model:`.
28
+ - Claude Code hot-reloads edits to existing role files.
29
+
30
+ ## Bench wiring
31
+
32
+ - `.mcp.json` registers `codex mcp-server` for short interactive exchanges with Sol. Project MCP
33
+ servers are enabled without prompting, so the wiring works headless.
34
+ - `.claude/skills/<name>/SKILL.md` is a bridge that loads the canonical skill from
35
+ `.agents/skills/<name>/SKILL.md`. It adds no independent process.
36
+ - Claude Code exposes `claude mcp serve`, which is how a Codex-primary session reaches Opus 5.
37
+
38
+ ## Claude Code Cloud
39
+
40
+ - Cloud setup installs `@openai/codex` globally and never authenticates. The snapshotted setup
41
+ state must contain no Codex credentials.
42
+ - At the start of each live Cloud session the user runs `codex login --device-auth` and completes
43
+ ChatGPT approval in the browser.
44
+ - `scripts/codex.sh` only reports readiness. It never installs, authenticates, logs out, reads the
45
+ auth cache, or performs a model call.