External Runtimesdoc/{zh,en}/design/runtime/external-runtimes.md

Claude Code and Codex as Runtimes, and Runtimes Working Together

简体中文 · Status: research and proposal, 2026-11-21; the owner answered every question (section 8) and reviews this before building. Nothing here is built. Section 2 states what exist

简体中文 · Status: research and proposal, 2026-11-21; the owner answered every question (section 8) and reviews this before building. Nothing here is built. Section 2 states what exists; sections 4–6 are proposed. 2026-11-27: the claude-code and codex plugins that R1 and R2 built were folded into the external plugin; section 6f says how to configure them now.

1. Goal

  1. Claude Code (CC) and Codex become runtime plugins at the same execution boundary as the builtin agent (Execute(ctx, RunInput, RuntimeHost) (Result, error), architecture section 2). Each declares its capabilities, and the Host adds no CC- or Codex-specific branches.
  2. Runtimes work together on one task. For example, CC develops; Codex runs the tests and reviews; its findings go back to CC to fix; Codex reviews again until it passes. Another pattern sends one question to both and returns a combined answer with each one's own reply.

2. What exists (checked 2026-11-21 against 3f0df00)

  • ◆Runtime contract. pkg/plugin/roles.go: Runtime.Execute. The RuntimeHost offers Progress, Checkpoint, Commit, Send, Steering and the Caller calls (Tools, CallTool, Ask, Skills, PutArtifact, …). A process plugin can be a runtime over JSON-RPC (runtime/execute, pkg/plugin/rpc/methods.go). Manifests declare resumable and steering.
  • ◆Children. delegate (P8) runs sub-agents inside the builtin agent. plugin.ChildOpener (pkg/plugin/workspace.go, built in parallel sub-agents slice 2) opens a child host with the run's identity and scopes in the child's own worktree, and MergeChild applies the child's changes to the task. A child always runs the same runtime; no Host mechanism runs another runtime as a child.
  • ◆Loops and checks. Goal mode repeats runs until a check command passes. Verification and review mode are designed; review mode is not built.
  • ◆Interactions. Ask is the durable question and approval protocol (AGENTS.md section 2): bound to the run, the interaction id and the authorized principal.
  • ◆Untrusted answers. A sub-agent's answer reaches its parent wrapped as untrusted (results.Untrusted, 3f0df00). /login always runs on the connection's own runtime, which has the login skill (internal/host/engine/login_commands.go).
  • ◆Gaps. Result has no usage, so an external runtime's tokens and cost do not reach the budget or the model_calls audit. There is no workflow runtime.

3. The two CLIs, headless

Claude CodeCodex
Headless entryclaude -p --input-format stream-json --output-format stream-json --verbose (checked on 2.1.323)codex app-server: JSON-RPC over stdio, bidirectional (docs); codex exec --json is the older JSONL path
One taska session; each user message on stdin is a turna thread; turn/start starts a turn
Resume--resume <session-id> or a fixed --session-id <uuid>the thread id (thread resume)
Approvals--permission-prompt-tool <mcp tool>: an MCP tool answers each permission request (headless docs)the server sends item/commandExecution/requestApproval (and file-change approvals); the client answers
Sandbox--permission-mode, --allowedTools/--disallowedTools, --add-dir; the working directorysandbox (read-only, workspace-write, …) and approvalPolicy per thread
Extra tools--mcp-config with --strict-mcp-configMCP servers in its config (-c overrides)
Eventsstream-json messages: assistant text, tool use and results, a final result with usage and costitem/started, item/completed, deltas, turn/completed with usage
Mid-turn inputmore stream-json user messages on stdininterrupting a turn; steering a turn in progress (to verify)
Schemasthe stream-json messages are documented; no generated schemacodex app-server can generate JSON Schema for its version, so regenerate after upgrades

Facts to verify against the installed versions before building: the exact Codex method names and approval payloads (generate the schema), whether Codex runs natively on Windows, the CC message shapes for --include-partial-messages, and what each does with SIGTERM while a prompt waits (CC leaves the prompt unanswered).

4. Adapters

4.1 Form

The adapters are first-party Go builtin plugins, plugins/claude-code and plugins/codex (each with one orchestrator and providers for the process, the event mapping and the bridge). Builtin, because the adapter needs the RuntimeHost directly to answer approvals while the CLI waits. Builtin gives it no extra privilege; its grants are configured like any instance's. Each spawns the vendor CLI as a child process through childenv (no Host secrets in its environment), in the run's workspace. (2026-11-27: both were folded into the external plugin, presets claude and codex; section 6f.)

4.2 Call chain (one run)

text
Execute(in, host)
 ├─ workspace: the run's checkout (CallContext.Workspace path); refuse without one
 ├─ login: the CLI's status (cached a minute); logged out → runtime.login_needed (4.5)
 ├─ bridge: start an MCP endpoint for this run (4.3); write a per-run MCP config
 ├─ spawn: claude -p ... --session-id/--resume <id> --mcp-config <cfg> --permission-prompt-tool mcp__orquelo__approve
 │         or codex app-server; thread/start{cwd, sandbox, approvalPolicy} or resume the thread
 ├─ send:  in.Text (+ attachments as files in the workspace, + the goal and locale as a short preface)
 ├─ loop:  events → host.Progress; tool events → journal (Commit entries); usage → accumulated
 │         approval request → host.Ask(approval) → answer the CLI
 │         ask_user (bridge tool) → host.Ask(question) → tool result
 │         steering messages (host.Steering) → next stdin message / turn input
 ├─ end:   final text → Result; new files → PutArtifact when asked for
 └─ checkpoint: {vendor, session/thread id, turn count} at each turn boundary

4.3 The bridge: approvals, questions and Orquelo tools

A per-run MCP server that the CLI connects to. The adapter starts it on a loopback socket with a random token and a deadline. The CLI's MCP config launches orquelo mcp-bridge --run <token>, a small stdio-to-socket relay, so it works the same on all three systems. It offers:

  • ◆approve, CC's permission prompt tool. Each request becomes host.Ask with Kind: approval, showing the tool and a digest of its arguments. The Host binds the answer to the run, the interaction and the approver (AGENTS.md section 2). Codex approvals arrive over app-server and take the same path without the bridge.
  • ◆ask_user: the CLI's questions to the person, as durable interactions. A disconnected client does not cancel them.
  • ◆Orquelo tools: built 2026-11-27 as orquelo_tools (design); the bridge is pkg/runtimebridge, shared by claude-code, codex and external. Originally not in the first version (the owner's choice, 2026-11-21): the bridge offers only approve and ask_user, and the CLIs use their own tools. Later it may add host.Tools of the instance's uses, the authorized set (AGENTS.md section 8), never the whole catalog, called through host.CallTool so that guards, approvals and the tool ledger apply.

4.4 Mapping and capabilities

ConcernMapping
Capabilitiesresumable: true (resume the session or thread from the checkpoint); steering: true for CC, and for Codex once mid-turn input is verified; no direct_tools
Workspacerequired; the CLI's cwd is the checkout; CC gets no --add-dir beyond it; Codex sandbox: workspace-write for writers, read-only for reviewers
Permissionsthe instance's permission_mode/sandbox and allow/deny lists in config; anything outside them asks through 4.3
Cancelctx done: CC closes stdin, then SIGTERM (no SIGTERM on Windows: kill after the wait); Codex interrupts the turn, then stops the process; a prompt waiting in the CLI is closed as an interaction first
Pause on restartat the next turn boundary: save the checkpoint and return run.paused; the next Host resumes the session with "continue"
Usagenew optional Result.Usage (tokens, cost, model) from the final events, written to model_calls with Purpose: external_runtime. This is a contract change (section 6)
Auththe CLI's own login, made through the unified login (4.5); Orquelo holds no key or token for them
Localethe reply language goes into the preface (task/Context sets it, AGENTS.md section 4); CLI output is not translated
PlatformsCC: macOS, Linux, Windows; Codex: macOS, Linux, Windows to verify; manifests declare platforms and refuse unsupported ones at load
FailuresCLI missing: the instance is unavailable with a prerequisite reason; not logged in: the run ends with runtime.login_needed (4.5); a crash mid-turn leaves the run for recovery (resume once, then fail and say so); a broken stream line is logged and skipped, then three in a row fail the run

4.5 Logins (built on the unified login, ADR 0012, S5 and S6)

The adapters add nothing to the login mechanism; they rely on what is built:

  • ◆Where the login is. For now Orquelo serves one person (ADR 0012, decision 11): an admin logs in, and the login lands where the CLI keeps it anyway, in the Host user's home (~/.claude, ~/.codex). The adapters run the CLI as that user with HOME passed through childenv; they never read, copy or pass a token. No API key option, no credentials list.
  • ◆Logging in. An admin sends /login claude or /login codex in a direct chat. This is login scenario L2. The generic login skill checks the status (claude auth status --json, Codex's login status), runs the CLI's login as a background job, and shows its link and code with sign_in_show. A pasted code goes through sign_in_ask. It closes with credential_close. claude auth login is a browser sign-in; whether it can print a link and take a pasted code without a browser, and Codex's device-code login, are to be verified. A note for either goes into the login skill only if the model cannot manage alone (login design, section 3). A group, or someone who is not an admin, is refused (login.direct_only, login.admins_only).
  • ◆Not logged in. At the start of a run the adapter checks the CLI's status. The result is cached for a minute and runs no model. If the CLI is logged out, the run ends at once with the stable code runtime.login_needed and a localized message. An admin is told to send /login <cli> in a direct chat; anyone else is told to ask an admin. The instance stays ready, because a login needs no reload. A login that expires mid-run ends that run the same way, and the session is kept for a resume after the next login.
  • ◆Logging out. "Log me out of codex" runs the CLI's own logout (L7); the next run reports runtime.login_needed.
  • ◆Who may use them (the owner's choice, 2026-11-21: through authorization). The login acts for everyone who uses the bot, and runs through @claude or @codex spend the admin's subscription with the admin's account. Orquelo's existing authorization therefore decides who reaches them: the instance's scope (users, conversations, connections) and the approval rules, as for any instance. There is no adapter-specific check. The shipped example scopes them to the admins, and the operator widens it. A route or a workflow role the person may not use is refused before anything starts.
  • ◆/login while bound. /login stays on the connection's own runtime even in a conversation bound to @claude (sigils S5 keeps it a Trigger decision), so the login skill is always the one that runs.
  • ◆Known limits, inherited. The CLI's token is a file of the Host's OS user, readable by any shell command of that user (login design, section 8). The CLIs run their own tools as that user, so their sandbox (Codex's sandbox, CC's permission prompts through Orquelo's approvals) is the confinement. Several people need the per-person sandbox homes of login design section 8; the adapter then runs the CLI with that person's HOME, with no other change.
  • ◆Place. The CLIs run only on this machine (the owner's answer of 2026-11-21); no remote execution provider is planned.

5. Runtimes working together

5.1 Cross-runtime children (the one Host mechanism)

Extend ChildSpec with Runtime: the id of another runtime instance in the parent's uses. OpenChild then returns a child host, and a new RunChild(ctx, spec, input) (Result, error) has the Host run that runtime's Execute as a child. A child keeps the parent's identity, scopes and authorization, and has its own worktree (isolation: worktree) or the parent's checkout read-only. Its record is keyed (parent run, child key) and is the same after a restart. Its usage settles against the parent's budget. Its approvals are separate interactions, labelled with the child's runtime and task. A child's reply reaches its parent, or the next workflow step, wrapped as untrusted, as sub-agents' answers are (results.Untrusted). Text from Codex is data for Claude Code, never instructions. This is a kernel change; it needs an ADR before it is built (0013; 0011 and 0012 are taken).

delegate gains runtime: <id> (limited to the runtimes in the agent's uses, so the model sees only authorized names). An ad-hoc conversation ("ask Codex to review this") then works through the builtin agent with no new runtime. With read_only: true, which the model sets when the person asks for a delegation that must change nothing, the child runs read-only (context refactor slice 8): the runtime keeps its shell in its own read-only mode (Codex's read-only sandbox, Claude Code's plan mode), a runtime without one is refused, and of the Host's tools the child sees and runs only those marked read-only; any other is refused with reason read_only. An MCP server's own read-only hint is not trusted for this.

5.2 Workflows: a few step kinds

A builtin workflow runtime runs a list of steps from its instance's config, deterministically, budgeted and resumable, rather than leaving the loop to a model. Five step kinds cover both patterns:

StepDoes
runruns a runtime as a child (5.1), named by runtime: or by a role:, with an input template; workspace: task (the task worktree), read-only, or own (its own worktree); optional output_schema its reply must follow
checkthe Host runs a command in the workspace (verification, as goal mode's check): exit code and output tail, never a model's claim
parallelseveral runs at once (listed, or one per runtime of a role list with each), waiting for all up to timeout; one failing does not stop the others
looprepeats its steps until its goal is met. It has no round limit: it runs as a goal and ends by goal mode's rules (below); rounds are counted only for the report
summarizeone model call over the named outputs; its text is the run's reply; attach adds outputs as files; the model is selectable: model: in the config, summary=<model> in a call, the agent's model when neither is given

The two patterns are configurations of these steps, shipped with Orquelo (orquelo init adds them when the claude and codex instances exist):

yaml
- id: develop
  plugin: workflow
  uses: [claude, codex, kimi]
  config:
    command: develop              # /develop [dev=… review=…] <task>
    roles: {dev: claude, review: codex}   # defaults; a call may name others from uses
    steps:
      - loop: {until: "check.passed && review.verdict == 'pass'"}   # the goal; no round limit
        steps:
          - run: {role: dev, as: dev, workspace: task,
                  input: "{{task}}{{#if review}}\nFix these findings:\n{{review.findings}}\nFailing check:\n{{check.tail}}{{/if}}"}
          - check: {command: "go test ./...", as: check}     # optional: without it, until reads the review alone
          - run: {role: review, as: review, workspace: read-only,
                  input: "Review this change for: {{task}}\n{{diff}}\nTests: {{check.summary}}",
                  output_schema: findings}
      - summarize: {model: kimi, input: "Rounds {{rounds}}; changed {{diff.stat}}; open: {{review.findings}}"}

- id: ask-all
  plugin: workflow
  uses: [claude, codex, kimi]
  config:
    command: ask-all                  # /ask-all [each=claude,codex] <question>
    roles: {each: [claude, codex]}    # a call may name others from uses
    steps:
      - parallel: {timeout: 10m, each: each, as: replies,
                   run: {workspace: read-only, input: "{{task}}"}}
      - summarize: {model: kimi, attach: [replies],
                    input: "Compare and combine: agreement, disagreement, which is better supported, recommendation."}
  • ◆Roles (the owner's choice, 2026-11-21). A workflow names its roles and their default runtimes in roles:. A call may choose others: /develop dev=codex review=claude <task>, /ask-all each=claude,codex <question>. A role takes only a runtime in the workflow's uses that the person is authorized to use (4.5), and anything else is refused with the list of allowed runtimes before a step starts. The same runtime may take both roles, but a separate reviewer is the point of the loop, so the summary says when they were the same.
  • ◆The check is optional in develop (the owner's choice): without a check step, until reads review.verdict == 'pass' alone, and the summary says no tests ran.
  • ◆Calling and progress. command: registers the / command (5.3). Every step reports progress ("Round 2 · Claude Code is fixing…", "Tests: 1 failed", "Codex review: 2 findings").
  • ◆Children and recovery. Each run is a cross-runtime child keyed by its place in the steps (loop[2].review). The workflow saves its checkpoint after every step, so a restart resumes at the current step without rerunning a finished child, and a Host stop pauses it at the next step boundary. The children's approval cards come to the requester, labelled with the runtime and the step.
  • ◆Structured replies. A reply that does not fit output_schema is asked for once more; then the step fails, and the summary says so. The findings schema is {verdict: pass|changes, findings: [{severity, file, line, title, detail}]}.
  • ◆The loop is a goal (the owner's choice, 2026-11-21). /develop <task> sets a goal for the session with the task as its text: the built goal mode (internal/host/goals, /goal) owns its state, budget and continuation, and the workflow is the runtime of its rounds. The until condition is the goal's "met": the check passes (when there is one) and the reviewer's verdict is pass. The reviewer is the separate judge that goal mode already allows. It ends by goal mode's rules, never by a round count:
  • ◆met: until holds; the report says what changed and lists any low findings left;
  • ◆blocked: no progress: the reviewer returns the same findings, or the check fails with the same output, three rounds in a row; or the developer changes nothing in a round; or a question expires. The report gives the reason and the findings still open;
  • ◆exhausted: the goal's budget is used up: working time, tokens (external runtimes report theirs through Result.Usage) and model calls, with goal mode's defaults and the operator's goal_limits; /goal continue extends it;
  • ◆cancelled: /goal stop, /cancel, /new or /done. /goal show shows the round, the last check and the open findings. Each run also has a timeout, so a step that hangs fails rather than stalling the goal.
  • ◆Result. The summary is the reply, and fan-out attaches each reply. develop's changes stay in the task worktree for /done or /ws restore.
  • ◆Not in the first version: workflow files written by users (.orquelo/workflows/ at the install levels), conditions beyond until, and branching. Only these two scenarios exist so far (AGENTS.md section 11).

5.3 How people call it (the owner's choice, 2026-11-21)

@ switches who you talk to, and / runs a procedure once (sigils):

WantSyntaxBehavior
Talk to Claude Code or Codex@claude <question>, @codex <question>the route binds the conversation; follow-ups continue the same session until /exit, another @, /new or route_idle
One question to several/ask-all [each=claude,codex] <question>runs the ask-all workflow once; the conversation stays where it was
Develop, test, review, fix/develop [dev=… review=…] <task>runs the develop workflow once; /done and /ws restore afterwards go to the normal runtime
Ad hocno sigil: "ask Codex to review this"the default agent delegates (5.1)

Neither @claude @codex (two routes would leave the binding ambiguous, and the sigil grammar refuses it) nor @develop (binding to a procedure that has ended) is used. A workflow's command is a / directive of kind command that names its target runtime and runs it once without binding. That is a small addition to sigils slice S5.

5.4 Where the orchestration lives

OptionFitsCost
The agent's model orchestrates with delegate(runtime=…)ad-hoc requests in chatloops depend on the model; budgets hold, but stopping rules are soft
A workflow runtime with steps in configrepeatable loops (review, fan-out)new step kinds are code; new workflows are config

Recommendation: both, on the same 5.1 mechanism. Fixed patterns go in workflow, and everything else through delegate.

5.5 Owners

StateOwner
CLI process, session/thread id, turn boundarythe adapter (checkpoint)
Child record, scopes, budget reservation, approvalsthe Host
Worktrees, merge of a developer's changesthe workspace provider (localenv)
Rounds, verdicts, fan-out resultsthe workflow runtime (checkpoint)
Deliveries of progress and the final reportthe Host (Presentation, Delivery)

6. Contract changes (all proposed)

  • ◆ChildSpec.Runtime and RunChild (ADR 0013); delegate runtime parameter.
  • ◆Result.Usage (optional; JSON-compatible); model_calls.purpose = external_runtime.
  • ◆A goal's judge: the workflow reports each round's reviewer verdict and a digest of its findings to the Host (a goal-round report on the runtime host). The Host, which owns goal state, decides met (check passed, when there is one, and verdict pass) and counts three equal finding digests in a row as no progress, as it already does with a failing check's output (fail_digest). A runtime cannot declare its own goal met.
  • ◆The workflow config (command, steps of the five kinds, output_schema: findings) and the route-once / command of sigils S5.
  • ◆orquelo mcp-bridge, a hidden CLI subcommand: a relay with a per-run token, refused without one.
  • ◆New plugins: claude-code, codex, workflow, each with bilingual display text and documented in the orquelo-docs skills when built.
  • ◆Budget: the adapters and the workflow are about 2–2.5k lines of production code (estimate); the owner decides the raise.

6a. Built: R1 (2026-11-21)

Folded on 2026-11-27: plugins/claude-code was deleted and the external preset claude runs Claude Code (section 6f). This section and 6b record what R1 and R2 built.
  • ◆R1a, the @ routes: see sigils section 13.
  • ◆R1b, claude-code (plugins/claude-code), built as sections 4.1–4.5 describe, with these differences:
  • ◆command is a list (an argv prefix), default [claude]. On the owner's machine it is [cl, run, claude]: cl sets the proxy and locale, and with run it does not add --dangerously-skip-permissions.
  • ◆permission_mode defaults to bypassPermissions (the owner's decision, 2026-11-21): Claude Code acts without approval cards. An instance that sets default, acceptEdits or plan gets Claude Code's permission prompts as Orquelo approvals; the console-claude acceptance app sets default.
  • ◆The workspace comes from two new optional interfaces: plugin.WorkspaceLocator, which localenv implements with the directory its tools use, and plugin.WorkspaceHost on the runtime host.
  • ◆Usage goes through the optional plugin.UsageReporter rather than a Result.Usage field; the Host writes it to model_calls with purpose external_runtime.
  • ◆Its own model turns and tool uses go to the run's trace through the optional plugin.SpanReporter (run traces section 8, S7): names, times and failures, never content. A runtime child's usage and steps nest under its child.
  • ◆Claude Code's session is a UUID derived from the Orquelo session and the directory, because Claude Code keeps its sessions per working directory; a run in another directory starts a new one. A removal from the Orquelo session starts a new one too (the key includes the content version), and in a session several people share each person has their own, since a CLI session holds its tool output (review #264 B5, 2026-12-05). Whether a session exists is kept in the instance's data directory.
  • ◆env is extra environment for Claude Code only, for example HOME where its login is when the Host's own HOME differs (the acceptance tests give each case its own). serve --preflight warns about an instance whose command is missing (a builtin's registered check) and still passes; orquelo exec refuses an unavailable runtime at once.
  • ◆The bridge is orquelo mcp-bridge, an internal stdio relay to a per-run loopback socket that checks a token.
  • ◆Claude Code and Codex wait inside their approval and question calls, so their questions are Question.Hold: the Host does not park the run after ask_grace (which used to answer the CLI with an error, read as a refusal) and waits up to the question's deadline (question_timeout), keeping the run's slot meanwhile (fixed 2026-11-26). A held question lives in that call: when the call ends unanswered, as at a Host restart, the CLI takes it as refused and does not ask again, so the Host closes the question (question.closed, reason call_ended) instead of leaving it open for an answer that would be recorded and then ignored (T10, 2026-12-03).
  • ◆A turn ends at Claude Code's result; its text is the reply. Messages sent while it runs are passed to Claude Code; one sent too late is requeued by the Host as the next run.
  • ◆Checked live on 2026-11-21 through the console with cl run claude: a reply with the [claude] label; a second run remembering the first; a Write permission prompt as an Orquelo approval, with /approve writing the file and /reject leaving none; usage rows. Unit tests use a fake Claude Code (plugins/claude-code): the login refusal, a turn with progress and usage, a broken stream, the bridge's token and both decisions. A steering message is passed on once (the Host returns all of a run's messages on each call).

6b. Built: R2 (2026-11-21)

Folded on 2026-11-27: plugins/codex was deleted and the external preset codex with connect: app-server runs Codex (section 6f).
  • ◆codex (plugins/codex), built as sections 4.1–4.5 describe, through codex app-server (JSON-RPC over stdio, checked on 0.171.0-alpha.13), with these differences:
  • ◆command is a list, default [codex]; on the owner's machine [cl, run, <ChatGPT.app's bundled codex>] (cl codex would add --ask-for-approval never). env as for claude-code.
  • ◆approval (never, on-request, untrusted) is Codex's approvalPolicy, default never (the owner's decision, 2026-11-21): Codex works within its sandbox without approval cards, and what the sandbox forbids fails. With a policy that asks, item/commandExecution/requestApproval and item/fileChange/requestApproval become Orquelo approvals naming the command (with its directory and Codex's reason) or the files; approve answers accept, anything else decline. item/tool/requestUserInput becomes questions; other server requests are refused.
  • ◆sandbox is workspace-write (default), read-only or danger-full-access (the owner's answer, 2026-11-21).
  • ◆One Codex thread per Orquelo session and directory, keyed as the Claude Code session above (content version; each person in a shared session); its id is kept in the instance's data directory, and a thread Codex no longer has is started anew. Each run starts one app-server process; a turn ends at turn/completed, its last agent message is the reply, and the per-call token usage of the turn is summed into model_calls.
  • ◆Steering goes through turn/steer, each message once. Cancel sends turn/interrupt, waits briefly, then stops the process (terminate, kill after five seconds). Login is codex login status (exit 0), cached a minute.
  • ◆Platforms: macOS and Linux; Windows is not declared until checked.
  • ◆Codex reads its own ~/.codex/config.toml, including the MCP servers configured there.
  • ◆Launch arguments and the proxy (the owner's request, 2026-11-21), for both adapters:
  • ◆args are extra arguments passed as given: for claude-code after Orquelo's own (for example [--add-dir, /data, --effort, high]), for codex after app-server (for example [-c, model_reasoning_effort="high"]).
  • ◆Both manifests declare egress: env (ADR 0011): with an egress provider such as proxy (mihomo), the Host's proxy variables, with the instance's own proxy credentials, are passed to the CLI and its login check, so routes the admin sets for claude or codex apply to their traffic. Without a provider nothing is added. The instance's env comes last and wins. cl sets its own proxy, so an instance that should follow Orquelo's proxy runs the CLI directly rather than through cl.
  • ◆orquelo exec now gives egress providers a router as serve does, and keeps installed prerequisites in the configured state directory, not its temporary one, so the proxy's binary is installed once.
  • ◆Checked live on 2026-11-21: orquelo exec with the proxy instance and Codex started directly; Codex completed, and its environment had HTTPS_PROXY with the codex proxy user.
  • ◆Checked live on 2026-11-21 with orquelo exec: under the default policy Codex wrote a file in the workspace and replied; with approval: on-request a network command came back as an approval question naming the command and Codex's reason. Unit tests use a fake app-server (plugins/codex): the login refusal, a turn with progress and usage, resume, the policy and sandbox passed, both decisions, a failed turn and cancel.

6c. Built: R3 (2026-11-21)

  • ◆Cross-runtime children as ADR 0013 decides. Instead of extending ChildSpec, the optional host interface plugin.ChildRunner has ChildRuntimes (the runtimes in the caller's uses that are ready and that the person may use) and RunChild(ChildRun{Key, Runtime, Text}). The Host's record is the table run_children, keyed (run, key).
  • ◆The child works in the parent's checkout (the owner's answer, 2026-11-21) with its own permission defaults; a read-only or own-worktree child comes with R4. It has its own session (<session>/child:<key>), so two children never continue each other's Claude Code session or Codex thread. Its progress and questions carry its runtime ([codex] …), and its question keys are namespaced by the child key. It gets no steering, writes nothing to the conversation's session, and cannot run children.
  • ◆delegate gains runtime, listing only ChildRuntimes. With sub-agents too, a call names agent or runtime. The reply is [runtime <id> finished] plus the answer wrapped as untrusted. A refused runtime is a tool error ("Not run: …"), and a failed child is reported as failed. Neither fails the run.
  • ◆Acceptance app console-delegate (the owner's approval, 2026-11-21): the agent with claude (asking for approval) and codex in its uses.
  • ◆Unit tests: internal/host/engine (TestRunChild: the listing, a finished child not run again, a failed one, refusals, no grandchildren, the records) and plugins/agent (TestDelegateRuntime).

6d. Built: R4a, the workflow runtime (2026-11-21)

Replaced on 2026-11-26: the step language below was deleted; workflows are Starlark scripts judged by the Host (workflows in Starlark, ADR 0014). This section and 6e record what R4 built.
  • ◆The general step language (the owner's choice, 2026-11-21) is in plugins/workflow: run, check, parallel, loop and summarize as in 5.2. Inputs are templates with {{task}}, {{rounds}}, {{roles}} (each role's runtimes, saying when one runtime took two roles), {{history}} (a line per round: each run's answer, each check, each review's findings), {{diff}}, {{<as>}}, {{<as>.<field>}} and {{#if <path>}}…{{/if}}. An unknown name renders empty.
  • ◆Checked when it loads: every role, runtime and model in the steps is in the instance's uses (the plugin gets them as the new plugin.Env.Uses), at most one loop at the top holding only run, check and parallel, and a model for each summary. A wrong workflow is unavailable, with the reason.
  • ◆check and {{diff}} run through the run's shell tool, so the Host runs them under its policy and keeps them in the tool ledger. A check's result is the exit code.
  • ◆output_schema: findings: the reply is read with the shared package pkg/findings, which the Host will also use to judge a round. A reply that is not a review is asked for once more in the same session (the new ChildRun.Session), then the step fails. Each role keeps one session across the run's steps.
  • ◆A call may override roles (dev=codex, each=claude,codex for a list role) and the summary model (summary=), only with runtimes the person may use; anything else is refused naming the allowed ones. Members are named only as role= (the owner's choice, 2026-11-21): the question's first word is never read as a runtime.
  • ◆A read-only step (2026-11-22): run takes workspace: task (the default, the conversation's checkout) or read-only, so a reviewer cannot change what it reviews. The Host passes ChildRun.ReadOnly to the child as RunInput.ReadOnly, and only to a runtime whose manifest declares read_only: true; any other is refused (runtime.child_denied). claude-code then runs in plan mode and codex in the read-only sandbox, whatever their configured mode, each in a session of its own (…:read-only). Nothing can let a read-only step write (review #264 B6, 2026-12-05): an ACP agent's every permission request is refused, never_ask or not; claude-code gets no allowed_tools and no approve permission prompt, so no one can approve leaving plan mode; codex runs with approvalPolicy: never and its approval requests are declined unasked; and a read-only tool the step calls stays read-only in its own nested calls. A step's own worktree is still to come.
  • ◆In R4a, a loop's steps run once per run. R4b makes them the rounds of a goal and adds the / command.

6e. Built: R4b, /develop as a goal (2026-11-21)

  • ◆The command. A workflow's command comes from its configuration through the optional plugin.DirectiveProvider, checked as manifest directives are. The / table of a conversation also offers the commands of the other runtimes its connection lists, as long as the person may use them; a name the conversation's own runtime has stays its. Such a command runs once on its runtime, with no pin.
  • ◆A goal on the workflow. With a loop, the command's target is goal (plugin.CommandGoal). The Host first asks the workflow to check the text (plugin.CommandChecker), so a role outside its uses, or not allowed for the person, starts nothing ("Not started: …" names the allowed runtimes). Then it sets the session's goal as /goal does, with runtime set (the goals table gains runtime). Rounds go to that runtime; so do /goal show, stop and continue, which follow the conversation's latest goal. Other messages stay where they were.
  • ◆Judged by the Host's own records. At a round's end the Host reads the round's check: calls in the tool ledger (their exit codes) and the replies of its reviewer children (ChildRun.Review, run_children.review, read with pkg/findings). The round meets the goal when every check passed and every review passed. The same findings three rounds in a row end it blocked (same_findings), as the same failing check does (same_failure); a failed round ends it blocked; the budget ends it exhausted. The goal-mode rule of two rounds without a tool call does not apply, and there is no "changed nothing" rule (the owner's answer).
  • ◆Between rounds the workflow keeps the call and the outputs in its data directory, per goal. A round's reply is a short report. When the round ends the goal by the same rules (met, or a third repeat), the workflow runs the steps after the loop at once, so the summary arrives with the Host's notice. An exhausted goal gets the notice alone.
  • ◆Unit tests: internal/host/engine (TestWorkflowGoal: a refused role sets no goal, met in two rounds with the findings reaching the developer, the conversation not pinned; TestWorkflowGoalBlocked: the same findings three times, /goal reaching the goal).
  • ◆Unit tests: plugins/workflow (the config checks, a round with the re-ask, overrides, a parallel step with one failure) and pkg/findings.

6f. Folded into external (2026-11-27)

The owner decided on 2026-11-27 that one plugin runs every third-party coding agent: plugins/claude-code and plugins/codex were deleted, and the external plugin (external runtimes over the CLI and ACP) took over what they did. Sections 6a and 6b record what they built.

  • ◆Configuration. Instance ids do not change, so @claude, @codex, @cc, delegate and workflow roles keep working; only the plugin: line changes, and the instance names a preset:
yaml
  - id: claude
    plugin: external
    config: {preset: claude, command: [cl, run, claude]}
  - id: codex
    plugin: external
    config: {preset: codex, connect: app-server, command: [cl, run, codex]}
  • ◆Old configurations are refused, not migrated (the owner's choice). An instance that names plugin: claude-code or plugin: codex is refused at preflight with plugin "claude-code" was removed, and external took its place: use plugin: external with config preset: claude (...). The refusal comes from the general manifest field replaces (pkg/plugin Manifest.Replaces), so the Host has no case for these two plugins.
  • ◆Settings that carry over. command is the CLI's program in place of the preset's (such as [cl, run, claude]); it replaces the first word of the preset's command lines that start with the CLI, and of login_status, but not an ACP adapter such as npx, and without a preset it is the command line of the way of connecting (cli.command, acp.command or app_server.command) when that is not set. permission_mode (Claude Code's name) and sandbox (Codex's name) are aliases of mode. approval is Codex's app-server approval policy. allowed_tools, disallowed_tools, model, effort, add_dirs, never_ask, orquelo_tools, args, turn_timeout and env keep their names.
  • ◆Claude Code over its CLI. The claude preset runs claude -p --input-format stream-json --output-format stream-json --verbose with cli.input: claude-stream-json: the prompt and the messages sent while it runs go to its stdin, which closes at its result. cli.approve (--permission-prompt-tool mcp__orquelo__approve) makes the run's approve tool its permission prompt tool, so its permission prompts become Orquelo approvals; it is used unless never_ask. The run's MCP server offers ask_user either way, which cli.ask_allow (--allowedTools mcp__orquelo__ask_user) allows without a prompt: never_ask turns off permission prompts, not questions (Feishu #260, 2026-11-29). An ACP agent that shares Orquelo's tools gets ask_user too. The tool lists go through --allowedTools and --disallowedTools, the run's MCP server through --mcp-config. --strict-mcp-config is gone: Claude Code now also sees its own MCP servers, as every external CLI does.
  • ◆Codex over its app-server. connect: app-server runs codex {mcp} app-server (app_server.command; {mcp} is where cli.mcp's arguments go). Codex's approval requests and questions become Orquelo approvals and questions, and messages sent while it works reach it. The sandbox is workspace-write by default, and a read-only step runs in read-only. connect: cli (codex exec --json) and connect: acp (through an npx adapter) remain for Codex, and connect: acp for Claude Code. As the codex plugin declared only macOS and Linux, preflight refuses connect: app-server on Windows until it is checked there.
  • ◆The default now asks. The old plugins acted without asking by default (Claude Code bypassPermissions, Codex approval never: the owner's choice of 2026-11-21). Under external the default follows its never_ask, false by default: the claude preset asks through approval cards, and Codex over app-server asks on request, only when it wants to leave its workspace-write sandbox (approval empty means never with never_ask, else on-request). never_ask: true restores the old behaviour.
  • ◆Steering. The external manifest declares steering, as both old plugins did, so a message sent while a run works joins it: Claude Code over its CLI (cli.input) and Codex over app-server (turn/steer) read it. A connection that cannot take one (agy or TRAE over their CLI, ACP) never reads it, and the Host starts it as the next run, as for every runtime that leaves a message unread. ACP has no way to add a message to a running turn, so an ACP instance can set steer: interrupt (2026-11-28): a message sent while the agent works cancels its turn (session/cancel), and once that turn has ended it goes, with any others sent meanwhile, as the next prompt in the same session. The agent keeps what it did and read, the step it was in the middle of is cut off, and the run's reply is the last prompt's. steer takes only interrupt, and only with connect: acp; preflight refuses anything else. Checked with real agy 1.5.18 over ACP: a long essay task, then a correction sent 12 s later; the essay turn was cancelled and agy did the correction in the same run.
  • ◆Also changed. Tool steps reach run traces with the attribute external.step (previously claude-code.step). For any CLI that is not logged in, the message tells an admin to send /login <cli> in a direct chat (external.login_admin), which the login skill handles.
  • ◆Checked for real (2026-11-27): real Claude Code through the folded claude preset with permission_mode: default, in a scratch Host's console: asked to create a file, its Write came back as an Orquelo approval card, /approve settled it, and the file was written. A config still naming plugin: claude-code was refused at preflight with the message above. Not checked: Codex over app-server and exec (Codex is not installed on the machine where this was built), and steering into a real Claude Code turn.

7. Slices and acceptance

SliceContentAcceptance (real channel and CLI; blocked without credentials)
R1claude-code adapter: run, progress, approvals through the bridge, resume, cancela console task edits a file through CC; an approval card appears and a denial stops the edit; a restart mid-task resumes the session; logged out, the run answers runtime.login_needed, and after an admin's /login claude in a direct chat the next run works
R2codex adapter over app-serverthe same for Codex; a read-only reviewer cannot write
R3cross-runtime children (ADR 0013), delegate(runtime)"ask Codex to review" from the agent; the child's approval is labelled; a restart does not rerun a finished child
R4workflow with the five step kinds; /develop as a goala seeded bug: CC fixes it, Codex finds a second issue, CC fixes it, review passes (met); a never-passing task ends blocked on repeated findings, and a small budget ends exhausted; /goal continue resumes
R5ask-all (parallel, summarize) and /ask-allone question to CC and Codex; the summary names agreement and difference; a timed-out child is reported

8. The owner's answers (2026-11-21)

  1. Auth. Answered: the CLIs' own logins through the unified login (4.5), one person for now.
  2. Where they run. Answered: only on this machine.
  3. Who may use them. Answered: through Orquelo's authorization (instance scope and approval rules, 4.5); the example scopes them to the admins.
  4. Default posture. Answered: through authorization: CC's permission prompts become Orquelo approvals; a reviewer runs read-only.
  5. Orquelo tools in the CLIs. Answered: only approvals and questions in the first version (4.3).
  6. The loop. Answered: it is a goal and ends when the goal is met, blocked by no progress, out of budget or cancelled, with no round limit; the check step is optional; roles can be chosen per call (5.2).
  7. Summaries. Answered: the summary model is selectable (config model:, a call's summary=), the agent's model by default (5.2).
  8. Budget. Answered: raise it as needed for R1–R5 (about 2.5k lines).

9. Sources