@orkestrel/scaffold 0.0.20 → 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 (69) hide show
  1. package/dist/bin/scaffold.js +385 -148
  2. package/dist/bin/scaffold.js.map +1 -1
  3. package/dist/host/AGENTS.md +61 -42
  4. package/dist/host/CLAUDE.md +39 -387
  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 +4 -4
  12. package/dist/host/agents/skills/orkestrel-debrief/references/instruction-audit.md +12 -0
  13. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +167 -0
  14. package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +98 -0
  15. package/dist/host/agents/skills/orkestrel-falsify/references/reconcile.md +148 -0
  16. package/dist/host/agents/skills/orkestrel-harden-package/SKILL.md +4 -2
  17. package/dist/host/agents/skills/orkestrel-harden-package/references/centralization.md +5 -5
  18. package/dist/host/agents/skills/orkestrel-harden-package/references/research.md +2 -0
  19. package/dist/host/agents/skills/orkestrel-polish-surface/SKILL.md +11 -6
  20. package/dist/host/claude/agents/analyst.md +59 -0
  21. package/dist/host/claude/agents/application.md +1 -1
  22. package/dist/host/claude/agents/builder.md +1 -1
  23. package/dist/host/claude/agents/checker.md +5 -1
  24. package/dist/host/claude/agents/codex.md +120 -87
  25. package/dist/host/claude/agents/grok.md +44 -32
  26. package/dist/host/claude/agents/implementer.md +1 -1
  27. package/dist/host/claude/agents/orkestrel.md +3 -3
  28. package/dist/host/claude/agents/planner.md +9 -3
  29. package/dist/host/claude/agents/researcher.md +6 -5
  30. package/dist/host/claude/agents/reviewer.md +17 -6
  31. package/dist/host/claude/agents/scout.md +7 -4
  32. package/dist/host/claude/agents/verifier.md +1 -1
  33. package/dist/host/claude/rules/application.md +17 -16
  34. package/dist/host/claude/rules/architecture.md +41 -22
  35. package/dist/host/claude/rules/documentation.md +2 -1
  36. package/dist/host/claude/rules/names.md +7 -6
  37. package/dist/host/claude/rules/quality.md +71 -14
  38. package/dist/host/claude/rules/styles.md +1 -1
  39. package/dist/host/claude/rules/tests.md +18 -2
  40. package/dist/host/claude/rules/typescript.md +1 -1
  41. package/dist/host/claude/rules/workspace.md +6 -3
  42. package/dist/host/claude/settings.json +2 -0
  43. package/dist/host/claude/skills/orkestrel-falsify/SKILL.md +10 -0
  44. package/dist/host/codex/agents/analyst.toml +15 -2
  45. package/dist/host/codex/agents/checker.toml +1 -1
  46. package/dist/host/codex/agents/grok.toml +2 -1
  47. package/dist/host/codex/agents/opus.toml +1 -1
  48. package/dist/host/codex/agents/planner.toml +1 -1
  49. package/dist/host/codex/agents/researcher.toml +2 -2
  50. package/dist/host/codex/agents/reviewer.toml +4 -2
  51. package/dist/host/codex/agents/scout.toml +2 -2
  52. package/dist/host/codex/config.toml +23 -64
  53. package/dist/host/cursor/rules/orchestration.mdc +33 -0
  54. package/dist/host/guides/src/scaffold.md +419 -150
  55. package/dist/host/manifest.json +47 -1
  56. package/dist/host/tests/setupPolicy.ts +130 -12
  57. package/dist/src/core/index.cjs +2059 -913
  58. package/dist/src/core/index.cjs.map +1 -1
  59. package/dist/src/core/index.d.cts +202 -47
  60. package/dist/src/core/index.d.ts +202 -47
  61. package/dist/src/core/index.js +2050 -914
  62. package/dist/src/core/index.js.map +1 -1
  63. package/dist/src/server/index.cjs +83 -33
  64. package/dist/src/server/index.cjs.map +1 -1
  65. package/dist/src/server/index.d.cts +32 -16
  66. package/dist/src/server/index.d.ts +32 -16
  67. package/dist/src/server/index.js +84 -35
  68. package/dist/src/server/index.js.map +1 -1
  69. package/package.json +7 -5
@@ -1,393 +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. In a fix round the unit's auditor is an engine that did not write
167
- it. Multi-round audits use one fixed verdict shape with a single terminal line, defined by
168
- the campaign skill. Reconcile their evidence; a finding neither engine can substantiate
169
- against the evidence is dropped on the record.
170
- 6. **Verify.** One independent `verifier` runs the authoritative gates.
171
- 7. **Accept.** The Orchestrator decides and reports concise outcomes, decisions, evidence, and
172
- remaining risk.
173
-
174
- ## Deviation protocol
175
-
176
- When reality diverges from a writing dispatch:
177
-
178
- 1. The writer stops and reports: expected, found, exact evidence, done/not done, and at most
179
- one short hypothesis. It does not investigate, improvise, or alter the plan.
180
- 2. The Orchestrator triages:
181
- - obvious correction → tighten and re-dispatch;
182
- - missing mechanical evidence → dispatch `verifier`;
183
- - unknown terrain → dispatch `grok` with the report and the plan slice;
184
- - unknown design or root cause → dispatch `planner` and `analyst` on the question.
185
- 3. The Orchestrator decides, updates the plan, and re-dispatches.
186
-
187
- 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.
188
8
 
189
9
  ## Dispatch mechanism
190
10
 
191
- - **Native first.** A model native to the running harness launches through that harness's own
192
- agent and workflow mechanism in Claude Code, Claude subagents via the Agent tool and
193
- Workflows; in a Codex session, Codex-native agents; in Cursor, Cursor-native sessions. MCP
194
- and CLI transports exist solely to reach a model that is NOT native to the running harness;
195
- never route a native model through its own CLI or an MCP loopback.
196
- - Use the Agent tool when later control flow depends on the previous result.
197
- - Use a Workflow for a known deterministic fan-out, staged pipeline, or loop; serialize
198
- writing nodes — never two concurrent writers in the tree.
199
- - Every node names a role and its engine.
200
-
201
- Every dispatch contains:
202
-
203
- - **Role/engine** — named role and explicit engine.
204
- - **Objective** one concrete outcome.
205
- - **Context** the evidence slice, paths, decisions, `AGENTS.md`, applicable rules, the
206
- skill name and required references (or explicit none), and the guide/spec.
207
- - **Scope** owned files, shared and off-limits files, allowed tools, permission limits.
208
- - **Output** the exact distilled return shape; no process diary.
209
- - **Deviation contract** — required stop/report behaviour for writers.
210
- - **Acceptance criteria** — independently checkable completion conditions.
211
- - **Review evidence** — for `reviewer` and `checker`, the actual diff and status output;
212
- omitting either is a dispatch deviation. For any claim about a rendered or externally
213
- driven surface, the capture portfolio is the review input and source is corroboration.
214
-
215
- After reconciling findings into briefs, walk the retained finding list once: every finding
216
- names the brief item that carries it. A finding with no carrier is a dropped finding.
217
-
218
- ## Bench mechanics
219
-
220
- External engines widen capacity; they never inherit authority. Their output is a proposal or
221
- hypothesis until it is verified against source and accepted by the Orchestrator. Every bridge
222
- verifies its CLI is present before running and stops with a deviation report naming the
223
- fallback when it is not. Benches are cross-provider reach only: a model native to the running
224
- harness never crosses a bridge.
225
-
226
- Four bench laws apply to every external engine:
227
-
228
- - **Transport by work class.** A short interactive exchange (one bounded question or a
229
- follow-up on a live thread, expected to finish in about two minutes) may use an MCP
230
- transport where one exists. Long-running work — audits, implementation units, anything
231
- multi-minute — uses the journaled CLI and never MCP: an interrupted MCP call loses its
232
- session invisibly, while a journal survives any client-side failure.
233
- - **Journal first.** Every bench invocation leaves a tailable on-disk record under
234
- `tmp/<bench>/` (`tmp/codex/`, `tmp/cursor/`): the brief as a file, the event stream or
235
- output log, and the final answer. Every long exec also carries exactly one Monitor on its
236
- journal — a filtered tail that emits milestones (commands run, files changed, agent
237
- messages, terminal states) and never the raw event firehose — so progress arrives in the
238
- conversation while the journal stays tailable for depth. The filter exits on the exec's
239
- terminal event, so the monitor's lifecycle matches the exec's and no watcher outlives its
240
- subject. The journal's mtime is the liveness signal; the session id in the journal head is
241
- the recovery handle. Briefs never travel as fragile shell arguments.
242
- - **Tracked, never loose.** Every bench unit is registered in the session task registry at
243
- launch — subject, journal path, session id — and completed there at acceptance, so "what is
244
- running" always has a first-class answer instead of a recollection of a command.
245
- - **Ephemeral journals.** Everything under `tmp/` is unit evidence, never committed. Bridges
246
- never delete journals; the Orchestrator sweeps `tmp/codex/` and `tmp/cursor/` once at
247
- campaign acceptance, after the final gate evidence is recorded. A journal surviving past
248
- its campaign is residue.
249
-
250
- Every long bench exec is launched by the Orchestrator as a harness-tracked background command
251
- under a hard time cap, never detached from inside a bridge agent: the harness owns the
252
- lifecycle, completion re-invokes the session, and the cap kills a wedged bench loudly instead
253
- of trusting the bridge to report its own failure. A wedged bridge is silent, and silence must
254
- never read as progress. A stalled journal or a cap-killed exec follows the deviation ladder,
255
- with the session id from the journal head as the recovery handle. Size the cap from the
256
- observed high mark of comparable units plus an independently budgeted gate allowance plus
257
- explicit slack, never from the estimate alone. The first use of any CLI flag, subcommand,
258
- quoting form, or stdin combination happens in a throwaway probe, never inside a dispatched
259
- unit.
260
-
261
- ### Cursor Grok
262
-
263
- - Reached only through the `grok` role, in ask mode:
264
- `<agent-cli> -p --trust --mode=ask --model "$CURSOR_GROK_MODEL" "<brief>" | tee tmp/cursor/<unit>.log`.
265
- `<agent-cli>` resolves as bare `agent`, then `agent.cmd` (Windows installs ship only
266
- `.cmd`/`.ps1` shims, so bare `agent` does not resolve in Bash), then
267
- `"$LOCALAPPDATA/cursor-agent/agent.cmd"` — verified with `--version` before first use. Long
268
- briefs are written to `tmp/cursor/<unit>-brief.md` and the prompt points at the file. The
269
- tee'd log is the bench's journal.
270
- - A long ask-mode run obeys the same launch, stream, and ledger discipline as a Codex exec:
271
- the Orchestrator starts it as a harness-tracked background command under a time cap,
272
- registers the unit in the task registry, and arms one Monitor on the tee'd log for
273
- milestones. The `grok` bridge drafts the brief; it never detaches a run and ends its turn.
274
- - Read-only. `--force` never appears. Nothing it returns is applied.
275
- - Read the exact model id from `agent models` and store it in `CURSOR_GROK_MODEL`. Never guess
276
- or substitute.
277
- - Never expose `CURSOR_API_KEY` in a command, a log, or a report.
278
- - **Cursor is an MCP client, not a server.** The CLI ships no server mode; `.cursor/mcp.json`
279
- (project-level, shared by editor and CLI) registers the `codex` and `claude` MCP servers so
280
- Grok sessions reach Sol and Opus tool-natively — the client-side inverse of the other
281
- benches. Approve once per machine with `agent mcp enable codex` / `agent mcp enable claude`.
282
- - Fallback when the CLI, model, or authentication is unavailable: state the gap and hand the
283
- reading to the Orchestrator, `planner`, or `analyst` directly.
284
-
285
- ### Codex Sol
286
-
287
- - Reached from Claude Code only through the `codex` role, on journaled, resumable
288
- `codex exec`; in a Codex session these are native agents.
289
- - **Every run is journaled and resumable.** `--json` streams the event log to
290
- `tmp/codex/<unit>.jsonl` (gitignored; the Monitor emits its milestones and the user tails it
291
- for depth — nobody polls), `--output-last-message` captures the final answer as a file, and
292
- the session id from the journal head goes in the unit's task registry entry and every bridge
293
- report so follow-ups continue the same session via `codex exec resume <session-id>` with
294
- context intact. `--output-schema` is available when the Orchestrator wants a
295
- machine-checkable return shape.
296
- - **Transport is chosen by work class.** The MCP wiring (`.mcp.json` registers
297
- `codex mcp-server`; verified tools `codex` to start a session, `codex-reply` to continue
298
- one; settings enable project MCP servers without prompting, so the wiring works headless —
299
- including Claude Code Cloud once the codex binary is installed and device-authed) serves
300
- short interactive exchanges only, and the bridge persists the thread id to
301
- `tmp/codex/<unit>.session` the moment a response carries it — an interrupted MCP call with
302
- no persisted id is unrecoverable and treated as failed. Long-running work (audits,
303
- implementation units) always uses the journaled CLI, and the Orchestrator — never a bridge
304
- agent — launches it as a harness-tracked background command: the brief at
305
- `tmp/codex/<unit>-brief.md`, then one
306
- `timeout <cap> codex exec --json … < /dev/null > tmp/codex/<unit>.jsonl` with
307
- `--output-last-message`, started through the shell's background-task mechanism so the exec
308
- appears in the session's task list, its completion re-invokes the session, and the cap kills
309
- a wedged bench loudly. Stdin is always closed with `< /dev/null`: a background-launched exec
310
- can inherit an open stdin pipe and wedge forever at "Reading additional input from stdin..."
311
- before its first event, and a cap kill is the only thing that would ever surface it.
312
- The journal remains the durable, resumable record and the session id the recovery handle. A
313
- bridge that backgrounds an exec and ends its turn orphans it — no owner, no completion
314
- signal, no death notice — so bridges keep two jobs only: drafting briefs and short MCP
315
- exchanges. Placeholder wait loops and wait-promise reports are deviations. Every exec names
316
- its working directory with `-C`, and an exec rooted outside a trusted git repository dies at
317
- launch unless `--skip-git-repo-check` is passed, so cross-repo and fleet-container work
318
- rooted outside a checkout always passes it. A launch is not a launch until the journal grows
319
- past its header: the Orchestrator confirms the event stream advanced beyond the
320
- session-configured head before recording the exec started, and treats an instantly-dead
321
- journal as a failed launch whose tail is the evidence. Recovery ladder on interruption:
322
- persisted-id `codex-reply` re-emission → fresh CLI session with the same brief file → for an
323
- interrupted CLI exec, the journal survives and the Orchestrator chooses resume or fresh.
324
- - **The inverse bridge exists too:** Claude Code exposes `claude mcp serve`, registered in
325
- Codex's global config (`codex mcp add claude -- claude mcp serve`) so Codex-primary
326
- sessions reach Claude/Opus as first-class MCP tools instead of shelling to the CLI.
327
- - `analyst` runs `gpt-5.6-sol` at high effort with `--sandbox read-only` in the current
328
- checkout, for objective analysis, the adversarial design argument, diagnosis, and the
329
- post-implementation correctness audit.
330
- - `implementer` runs `gpt-5.6-sol` at high effort with `--sandbox workspace-write` in the
331
- main checkout as the sole writer from a clean committed baseline, for bounded
332
- implementation.
333
- - **The exec sandbox denies network** (`--unshare-net`). Any unit that needs the registry or
334
- any other remote endpoint — lockfile generation, real installs, live fetches — belongs to
335
- the Orchestrator's own tracked commands or a network-capable native agent, never to a Codex
336
- exec. A Sol exec observed hanging on `npm` until its cap fires is the signature of this
337
- misroute, not of a slow bench.
338
- - Raise the analyst to `xhigh` only for a stated hard reasoning need. `gpt-5.6-terra` serves
339
- only explicitly mechanical, taste-free roles. `gpt-5.6-luna` requires a proven repeatable,
340
- high-volume workload.
341
- - The bridge never commits, pushes, installs, authenticates, or reads credentials.
342
- - Claude Code Cloud setup installs `@openai/codex` globally but never authenticates; the
343
- snapshotted setup state must contain no Codex credentials.
344
- - At the start of each live Cloud session the user runs `codex login --device-auth` and
345
- completes ChatGPT approval in the browser. `scripts/codex.sh` only reports readiness; it
346
- never installs, authenticates, logs out, reads the auth cache, or performs a model call.
347
- - A probe that finds the binary present but authentication unavailable starts recovery in the
348
- same turn instead of recording the bench dark and waiting: the Orchestrator backgrounds
349
- `codex login --device-auth` with its output captured to `tmp/codex/login.log`, surfaces the
350
- verification URL and one-time code to the user the moment they appear there, arms a watcher
351
- on completion, and re-probes `codex login status` when it fires. The bench comes live
352
- mid-session with no restart; a session that sits dark until the user asks for the login has
353
- failed the probe, not the bench.
354
- - If that recovery cannot complete — device login unavailable, declined, or expired — the
355
- Codex bench is dark. Fall back to `planner`/`reviewer` (Opus 5) and `builder`, and say so.
356
- Never substitute an API key, access token, copied `auth.json`, or another login flow unless
357
- the user changes this policy.
358
-
359
- Codex environment defaults:
360
-
361
- ```text
362
- CODEX_ANALYST_MODEL=gpt-5.6-sol
363
- CODEX_ANALYST_EFFORT=high
364
- CODEX_IMPLEMENTER_MODEL=gpt-5.6-sol
365
- CODEX_IMPLEMENTER_EFFORT=high
366
- ```
367
-
368
- ### Claude Opus from Codex
369
-
370
- - Reached only through the Codex `planner` and `reviewer` bridges, which invoke the local
371
- Claude CLI pinned to `--model opus`.
372
- - Read-only: the bridge passes a brief and returns the response; it applies nothing.
373
- - Never pin `fable` and never route orchestration or acceptance across the bridge.
374
- - Fallback when the CLI or authentication is unavailable: state the gap, run the design or
375
- design-audit pass in the Sol main session, and record that the subjective adversary was
376
- missing from that round.
377
-
378
- ## Acceptance laws
379
-
380
- - No writer's and no external engine's self-assessment is authoritative.
381
- - Do not let a lower-cost native agent stand in for Grok, Opus 5, or Sol; do not spend Opus 5
382
- on discovery or mechanical edits; do not route judgment-bearing implementation away from Sol.
383
- A bench substitution is legitimate only when the same session records the bench dark (CLI
384
- missing, auth expired, model unavailable) — the fallback is then named in the plan, not
385
- improvised silently.
386
- - Do not run the design adversaries on different briefs, or show either one the other's answer
387
- before both have returned.
388
- - Do not accept unreviewed implementation, unverified hypotheses, shared-tree writing races,
389
- implicit engines, fixed Claude IDs, or verbose completed-work residue.
390
- - A claim about a rendered or externally driven surface is evidenced by its capture or a real
391
- foreign client driving it, never by source alone; where no such surface exists this law is
392
- inert.
393
- - 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.