Summary
Create an engine registry that maps engine names to AgentAdapter implementations and wire it into the runtime's execute_agent() function, replacing the current hardcoded if engine == "react" / elif engine == "plan" branching.
Parent issue: #408
Scope
New module: core/engine_registry.py
EngineRegistry class:
class EngineRegistry:
_engines: dict[str, type[AgentAdapter]] = {}
@classmethod
def register(cls, name: str, adapter_class: type[AgentAdapter]):
cls._engines[name] = adapter_class
@classmethod
def get(cls, name: str) -> AgentAdapter:
if name not in cls._engines:
raise ValueError(f"Unknown engine '{name}'. Available: {cls.available()}")
return cls._engines[name]()
@classmethod
def available(cls) -> list[str]:
return sorted(cls._engines.keys())
@classmethod
def check_requirements(cls, name: str) -> dict[str, bool]:
"""Check if engine's requirements are met (API keys, binaries)."""
...
-
Built-in registrations:
-
BuiltInReactAdapter — wraps existing ReactAgent to satisfy AgentAdapter protocol:
- Takes
AgentContext, builds the 3-layer system prompt internally
- Returns
AgentResult from AgentStatus
- This keeps ReactAgent working exactly as before
Changes to core/runtime.py
- Refactor
execute_agent():
- Replace
if engine == "react" branching with registry lookup
- Use
ContextPackager to build AgentContext
- Call
adapter.execute()
- Map
AgentResult back to AgentState for runtime state management
- Keep verification gate logic outside the adapter (CodeFrame owns gates)
Changes to cli/app.py
- Update
--engine flag:
- Accept any registered engine name
cf work start <id> --execute --engine claude-code
- Add
cf engines list command showing available engines and their requirements
- Add
cf engines check <name> to validate requirements (API keys, binaries)
Changes to AGENTS.md / CODEFRAME.md support
- Default engine configurable per-workspace:
engine: claude-code # or: built-in, codex, aider, plan
Acceptance Criteria
Dependencies
Summary
Create an engine registry that maps engine names to
AgentAdapterimplementations and wire it into the runtime'sexecute_agent()function, replacing the current hardcodedif engine == "react"/elif engine == "plan"branching.Parent issue: #408
Scope
New module:
core/engine_registry.pyEngineRegistryclass:Built-in registrations:
"built-in"→BuiltInReactAdapter(wraps existing ReactAgent)"plan"→BuiltInPlanAdapter(wraps existing Agent)"claude-code"→ClaudeCodeAdapter(from [Phase 4] Claude Code Engine Adapter #411)"codex"→CodexAdapter(from [Phase 4] Codex/OpenAI Engine Adapter (App-Server Protocol) #412)"aider"→AiderAdapter(from [Phase 4] Aider Engine Adapter #413)BuiltInReactAdapter— wraps existing ReactAgent to satisfy AgentAdapter protocol:AgentContext, builds the 3-layer system prompt internallyAgentResultfromAgentStatusChanges to
core/runtime.pyexecute_agent():if engine == "react"branching with registry lookupContextPackagerto buildAgentContextadapter.execute()AgentResultback toAgentStatefor runtime state managementChanges to
cli/app.py--engineflag:cf work start <id> --execute --engine claude-codecf engines listcommand showing available engines and their requirementscf engines check <name>to validate requirements (API keys, binaries)Changes to
AGENTS.md/CODEFRAME.mdsupportAcceptance Criteria
EngineRegistrymaps engine names to adapter classesBuiltInReactAdapterwraps ReactAgent (no behavior change)execute_agent()uses registry instead of hardcoded branching--engineflag accepts any registered enginecf engines listshows available engines with requirement status--engine reactand--engine planstill work (mapped to built-in adapters)Dependencies