0004 — Engines
Status: accepted · 2026-09-29
- Status: accepted
- Date: 2026-09-29
Context
Conch starts as a facade over Claude Code but should later drive other runtimes — Codex CLI, the Anthropic API directly, or OpenRouter keys — without rewrites.
Decision
- An
Engineinterface (apps/server/src/engines/types.ts) with four capabilities:detect()(installed? signed in? how?), optionallogin()andsetApiKey(), andrunTurn()which yields a small, normalisedEngineEventstream (session, text, thinking, tool start/end, done). - Everything above the engine — conversations, permissions, memory, personality, the
wire protocol, the UI — depends only on that interface.
EngineIdin the protocol already reservescodex-cli,anthropic-apiandopenrouter. - Claude Code is implemented with the Claude Agent SDK, pointing
pathToClaudeCodeExecutableat the user's ownclaudeso Conch shares their version, login, settings, MCP servers andCLAUDE.mdfiles. Status comes fromclaude auth status --json; sign-in drivesclaude auth login. - A mock engine implements the same interface for UI development and end-to-end
tests (
CONCH_ENGINE=mock,CONCH_MOCK_STATE=not-installed|signed-out|ready).
Consequences
Adding an engine is one folder under engines/ plus a registry entry. Engines that
lack tools natively (plain API) will need Conch-side tool execution; the HostTool
abstraction is the seam for that.