← ClaudeAtlas

adapter-devlisted

SOP for developing new Agent CLI adapters in AgentHub. Agent should use when adding a new agent integration (e.g. Copilot, Gemini CLI, Qwen CLI) or debugging adapter issues around model resolution, environment, or stream parsing.
TokenDanceLab/AgentHub · ★ 2 · AI & Automation · score 68
Install: claude install-skill TokenDanceLab/AgentHub
# Adapter Dev -- AgentHub Adapter Development SOP ## When to Use - Adding a new AI agent CLI integration to AgentHub - Debugging adapter issues (model resolution, env propagation, event parsing) ## Adapter Interface Checklist Every adapter must implement `AgentAdapter` (see `edge-server/internal/adapters/adapter.go`): 1. **`Metadata()`** -- return `AdapterMetadata{ID, Name, Version, Description}` 2. **`Capabilities()`** -- return `AgentCapabilities` struct declaring feature support 3. **`BuildCommand(ctx)`** -- return binary path, args, env, workdir 4. **`ParseStream(ctx, stdout, stdin, emitter, run)`** -- read CLI stdout, emit typed events 5. **`NeedsStdin()`** -- whether CLI requires bidirectional stdin pipe ## Critical Patterns (Learned from Claude Code, OpenCode, Codex) ### 1. Model Alias Resolution Always call `ResolveModel(agentID, model)` in `BuildCommand`. Never pass raw alias strings to the CLI. After resolving, add the alias to `ModelAliases` in `model_config.go`. ### 2. Reasoning Effort Resolution Always call `ResolveReasoningEffort(agentID, effort)` in `BuildCommand`. Each CLI has different effort strings (Codex: `minimal`/`low`/`high`/`xhigh`; OpenCode: `--variant` flag). After resolving, add to `ReasoningEfforts` in `model_config.go`. ### 3. Environment Variables Return **nil or empty env** from `BuildCommand`. The process executor's `envForRun` is the single source of truth for `AGENTHUB_*` vars. ### 4. Stdin Protocol Only return `NeedsStdin() ==