Skip to content

Make the agent CLI a port: Claude Code as one adapter, add Kilo & OpenCode#20

Merged
jellologic merged 1 commit into
mainfrom
feat/agent-cli-port
Jul 22, 2026
Merged

Make the agent CLI a port: Claude Code as one adapter, add Kilo & OpenCode#20
jellologic merged 1 commit into
mainfrom
feat/agent-cli-port

Conversation

@jellologic

Copy link
Copy Markdown
Owner

Closes #19.

Extracts an AgentCliPort so the agent CLI is pluggable the way providers already are. The core computes a neutral LaunchIntent (baseUrl, credential, per-tier models, skipPermissions, extendedContext) and each adapter lowers it into its own CLI.

What changed

  • Claude Code is now the reference adapter. Its ANTHROPIC_*/CLAUDE_CODE_* env building, the [1m] suffix, compat flags, auto-compact and binary spec moved out of core/ into src/adapters/agents/claude-code/.
  • Kilo (@kilocode/cli) and OpenCode (opencode-ai) adapters reach the existing provider presets over the Anthropic transport (@ai-sdk/anthropic), lowering the intent into an inline config (KILO_CONFIG_CONTENT / OPENCODE_CONFIG_CONTENT) + args — no file written. Capability gaps (4 tiers → 1 slot, [1m]) warn on stderr, never silently drop.
  • Selection: profile.agent, swisscode config agent <profile> <id>, and --cc-agent <id>.
  • Per-adapter binary resolution keeps the self-alias/recursion guard; execve stays the launch mechanism.

Verification

  • 475/475 tests pass, 0 type errors.
  • golden.test.ts proves the Claude Code env plan is byte-identical — existing launches are unchanged.
  • New architecture test bans ANTHROPIC_*/CLAUDE_CODE_* literals from core/ and ports/.
  • End-to-end smoke test (isolated config + shim) verified all three agents.

Caveat

Kilo/OpenCode config schemas match their documented patterns but aren't confirmed against a live install; every uncertain string is behind a single named constant with a test, so a fix is one line.

Follow-up (not in this PR)

The setup wizard's agent-step was deferred — selection works via config agent / --cc-agent.

…nCode

Extracts an AgentCliPort (issue #19). The core now computes a neutral
LaunchIntent (baseUrl, credential, per-tier models, skipPermissions,
extendedContext) and each agent adapter lowers it into its own CLI.

- Claude Code becomes the reference adapter; its ANTHROPIC_*/CLAUDE_CODE_*
  lowering, the [1m] suffix, compat flags, auto-compact and binary spec move
  out of core/ into src/adapters/agents/claude-code/.
- New Kilo (@kilocode/cli) and OpenCode (opencode-ai) adapters reach the same
  provider presets over the Anthropic transport, lowering the intent into an
  inline config (KILO_CONFIG_CONTENT / OPENCODE_CONFIG_CONTENT) + args; no file
  is written. Capability gaps (tiers, [1m]) warn, never silently drop.
- Selectable via profile.agent, 'swisscode config agent', and --cc-agent.
- Per-adapter binary resolution keeps the self-alias/recursion guard; execve
  stays the launch mechanism.

golden.test.ts proves the Claude Code env plan is byte-identical; a new
architecture test bans ANTHROPIC_*/CLAUDE_CODE_* literals from core/ and ports/.
475 tests green, typecheck clean.
@jellologic
jellologic merged commit a0b1fbc into main Jul 22, 2026
@jellologic
jellologic deleted the feat/agent-cli-port branch July 22, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the agent CLI a port (Claude Code as one adapter)

1 participant