You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generalize agentic-kit's current Claude+Codex dual execution substrate into capability-driven multi-host routing, then add OpenCode as the first third routable execution host.
Do not implement this work by merely changing OpenCode's canRouteActivities flag. That flag is a safety gate. It may become true only after a real execution adapter and generalized orchestrator can launch, supervise, interpret, cancel, and verify OpenCode workers.
Problem
The routing policy is increasingly capability-driven, but execution is still coupled to @claude-flow/codex and the vocabulary/assumptions of exactly two worker platforms:
ak dual run delegates to claude-flow-codex;
workers execute through claude -p or codex exec;
templates and escalation ladders assume Claude/Codex platform identifiers;
configuration and documentation define dual as the Claude+Codex collaboration substrate;
there is no OpenCode worker launcher, structured-result interpreter, cancellation contract, or readiness probe.
OpenCode now exposes credible automation surfaces:
The exact names may follow existing lifecycle vocabulary, but execution and configuration lifecycle must remain distinct concerns.
Each adapter must define:
executable/readiness detection;
command/API construction;
working-directory and environment handling;
model and agent normalization;
structured event/output parsing;
success/failure/cancellation interpretation;
timeout and signal behavior;
permission/sandbox policy;
authentication/provider readiness facts;
transcript/evidence correlation;
cleanup and orphan prevention.
Initial adapters:
Host
Execution surface
Claude Code
claude -p
Codex CLI
codex exec
OpenCode
initially evaluate opencode run --format json --auto; compare against ACP/server attachment before fixing the contract
The OpenCode transport choice must be recorded in an ADR with observed tradeoffs. Prefer the smallest reliable surface that supports deterministic completion, cancellation, structured evidence, and repo mutation.
2. Generalized orchestrator
Separate pipeline orchestration from claude-flow-codex platform assumptions:
materialize workers from the canonical per-activity policy;
resolve a host-worker adapter by registry capability;
honor dependency ordering and bounded concurrency;
share only explicitly supported coordination state;
propagate cancellation and timeout;
collect normalized worker results;
apply ordered escalation consistently across hosts;
prevent unsupported hosts from entering a runnable plan.
Determine whether to:
extend/replace the upstream adapter;
add an agentic-kit-owned thin generalized adapter; or
introduce a versioned adapter interface with claude-flow-codex retained as the Claude/Codex implementation.
The decision must be grounded in upstream capabilities and recorded before implementation is locked in.
3. Vocabulary and CLI compatibility
dual currently means Claude+Codex. Adding a third routable peer must not silently redefine it.
Design and document one of:
a new generalized command such as ak run / ak swarm run while retaining ak dual as a compatibility projection; or
a versioned generalization with an explicit migration/deprecation path.
An accepted ADR defines generalized orchestration, CLI vocabulary, migration, and OpenCode transport.
Claude, Codex, and OpenCode satisfy one tested host-worker execution contract.
Existing ak dual workflows remain compatible or have an explicit, tested migration path.
OpenCode becomes canRouteActivities: true only in the same change that makes its runnable contract real.
An explicit activity can route to OpenCode and complete a sandboxed repository mutation.
Timeout, cancellation, permissions, authentication, and malformed-output behavior are deterministic.
Ordered cross-host escalation is tested.
Automatic routing cannot silently introduce an unknown metered provider.
Host/provider/model provenance remains normalized and evidence-backed.
pnpm run check passes.
pnpm run test:surface passes.
Relevant live smoke tests pass on the exact final head.
A ruflo swarm reviews architecture, implementation, testing, security, docs, and migration.
qe-court convenes on the exact final head and returns a passing cross-vendor verdict, or all blocking findings are remediated and the court is reconvened.
This issue should be the source of truth for the immediate follow-on activity. Keep #67 focused on complete managed-host integration and honest non-routability.
Managed OpenCode CLI parity
OpenCode must retain the same managed-CLI lifecycle as Claude and Codex while routing is generalized:
an enabled but absent OpenCode CLI is installed as opencode-ai by ak host pick, setup, or sync;
npm-managed versions participate in the shared version-drift/update path;
external/brew/mise/native installs are detected but never shadowed or overwritten;
ak host, setup, sync, status, and teardown converge or remove only agentic-kit-owned OpenCode integration artifacts;
installation success alone is not execution readiness: wiring follows post-install detection, and routing remains disabled until the worker adapter contract is proven.
Required parity coverage: enabled-absent install, declined/failed install, npm version drift, external-install preservation, post-install wiring, status visibility, and marker-precise teardown.
Live baseline recorded 2026-07-29: opencode-ai 1.18.9 was installed through npm, enabled with ak host pick --host claude,codex,opencode --yes, and status reports the CLI, managed MCP wiring, converted agents, and npm ownership as healthy.
Summary
Generalize agentic-kit's current Claude+Codex
dualexecution substrate into capability-driven multi-host routing, then add OpenCode as the first third routable execution host.This is the immediate follow-on to:
Do not implement this work by merely changing OpenCode's
canRouteActivitiesflag. That flag is a safety gate. It may becometrueonly after a real execution adapter and generalized orchestrator can launch, supervise, interpret, cancel, and verify OpenCode workers.Problem
The routing policy is increasingly capability-driven, but execution is still coupled to
@claude-flow/codexand the vocabulary/assumptions of exactly two worker platforms:ak dual rundelegates toclaude-flow-codex;claude -porcodex exec;dualas the Claude+Codex collaboration substrate;OpenCode now exposes credible automation surfaces:
opencode runfor non-interactive execution;--model,--agent,--format json,--dir, and--auto;opencode serveprocess;The remaining limitation is therefore agentic-kit's orchestration integration, not a categorical inability of OpenCode to execute headlessly.
Goals
ak dual.dualbehavior.Non-goals
ak dualcompatibility surface without a documented migration and deprecation decision.canRouteActivities: trueprecede a verified execution adapter.Proposed architecture
1. Host-worker adapter contract
Introduce a contract conceptually covering:
The exact names may follow existing lifecycle vocabulary, but execution and configuration lifecycle must remain distinct concerns.
Each adapter must define:
Initial adapters:
claude -pcodex execopencode run --format json --auto; compare against ACP/server attachment before fixing the contractThe OpenCode transport choice must be recorded in an ADR with observed tradeoffs. Prefer the smallest reliable surface that supports deterministic completion, cancellation, structured evidence, and repo mutation.
2. Generalized orchestrator
Separate pipeline orchestration from
claude-flow-codexplatform assumptions:Determine whether to:
claude-flow-codexretained as the Claude/Codex implementation.The decision must be grounded in upstream capabilities and recorded before implementation is locked in.
3. Vocabulary and CLI compatibility
dualcurrently means Claude+Codex. Adding a third routable peer must not silently redefine it.Design and document one of:
ak run/ak swarm runwhile retainingak dualas a compatibility projection; orRequirements:
ak dualinvocations retain behavior during the compatibility window;ak host pick --routevalidates againstcanRouteActivities;4. Routing and model normalization
OpenCode model identifiers use
provider/model. The canonical policy must keep these axes distinct:Define:
5. Permission and unattended-execution safety
Ground and test OpenCode's non-interactive permission semantics:
--auto;Document which policy is owned by agentic-kit and which remains user-owned.
6. Cost safety and provider provenance
OpenCode can route inference through multiple providers. Therefore:
unknown, not inferred from model naming or host identity;7. Observability and normalized results
Define a normalized worker result that can represent:
OpenCode JSON/ACP/server events must be tested against recorded fixtures with secrets removed.
Implementation slices
canRouteActivities: falseuntil adapter conformance and integration tests pass.ak dualcompatibility.Required tests
Adapter conformance
Claude/Codex regression
OpenCode integration
Routing/migration
Evidence and qe-court
Acceptance criteria
ak dualworkflows remain compatible or have an explicit, tested migration path.canRouteActivities: trueonly in the same change that makes its runnable contract real.pnpm run checkpasses.pnpm run test:surfacepasses.Dependencies and ordering
main.This issue should be the source of truth for the immediate follow-on activity. Keep #67 focused on complete managed-host integration and honest non-routability.
Managed OpenCode CLI parity
OpenCode must retain the same managed-CLI lifecycle as Claude and Codex while routing is generalized:
opencode-aibyak host pick, setup, or sync;ak host, setup, sync, status, and teardown converge or remove only agentic-kit-owned OpenCode integration artifacts;Required parity coverage: enabled-absent install, declined/failed install, npm version drift, external-install preservation, post-install wiring, status visibility, and marker-precise teardown.
Live baseline recorded 2026-07-29:
opencode-ai1.18.9 was installed through npm, enabled withak host pick --host claude,codex,opencode --yes, and status reports the CLI, managed MCP wiring, converted agents, and npm ownership as healthy.