-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Closed
Copy link
Description
Summary
Make /consult and /debate work via ACP (Agent Client Protocol) as a universal agent-to-agent communication protocol. ALL major AI coding tools now support ACP - this isn't Kiro-specific, it's a cross-platform upgrade.
The ACP Ecosystem (verified Feb 2026)
ACP Agents - every major AI tool
| Agent | ACP Command | Package | Stars |
|---|---|---|---|
| Kiro | kiro-cli acp |
Native | - |
| GitHub Copilot | copilot --acp --stdio |
Native | - |
| OpenAI Codex | codex-acp |
npx @zed-industries/codex-acp |
422 |
| Claude | claude-agent-acp |
npx @zed-industries/claude-agent-acp |
1,000 |
| Gemini CLI | Gemini CLI (Google's reference ACP impl) | Native | - |
| OpenCode | opencode acp |
Native | - |
| Mistral Vibe | ACP-compatible | - | - |
| Cline | ACP-compatible | - | - |
| Goose (Square) | ACP-compatible | - | - |
| 30+ more | Listed at zed.dev/acp | Various | - |
ACP Protocol
- Spec: agentclientprotocol.com (Apache licensed, created by Zed)
- Transport: JSON-RPC 2.0 over stdio (local) or HTTP/WebSocket (remote, WIP)
- Libraries: TypeScript, Python, Rust, Kotlin
- Core methods: initialize, session/new, session/prompt, session/cancel
- Features: Tool calls, terminal, file system, MCP-over-ACP, slash commands
- Session: Persistent with resume/fork/delete
ACP Clients (Editors supporting ACP)
Zed (primary), JetBrains (coming), Neovim (CodeCompanion/avante.nvim), Emacs, Obsidian
Current agentsys consult/debate architecture
/consult gemini → Bash({ command: 'gemini "Review this..."' })
/consult codex → Bash({ command: 'codex exec "Check this..."' })
/consult claude → Bash({ command: 'claude "Second opinion..."' })
/debate → Sequential Bash calls to proposer + challenger
Problems:
- Requires each AI CLI to be installed and on PATH
- Different invocation syntax per tool
- No structured response format
- Doesn't work inside Kiro/Cursor/Copilot (no Bash tool in those contexts)
- No session persistence or context sharing
Proposed: ACP-native consult/debate
Architecture
/consult gemini → spawn gemini-cli ACP → initialize → session/new → session/prompt
/consult codex → spawn codex-acp ACP → initialize → session/new → session/prompt
/consult claude → spawn claude-agent-acp → initialize → session/new → session/prompt
/consult copilot → spawn copilot --acp → initialize → session/new → session/prompt
/debate → spawn proposer ACP agent → get position
→ spawn challenger ACP agent → get counter-position
→ synthesize verdict
ACP consultation flow (universal)
// 1. Spawn ACP agent subprocess
const agent = spawn(acpCommand, acpArgs, { stdio: ['pipe', 'pipe', 'pipe'] });
// 2. Initialize (JSON-RPC 2.0)
send({ jsonrpc: "2.0", method: "initialize", params: {
protocolVersion: "0.1",
clientInfo: { name: "agentsys", version: "5.3.0" },
clientCapabilities: { fs: true, terminal: true }
}, id: 1 });
// 3. Create session
send({ jsonrpc: "2.0", method: "session/new", params: {
cwd: process.cwd()
}, id: 2 });
// 4. Send consultation prompt
send({ jsonrpc: "2.0", method: "session/prompt", params: {
sessionId: sessionId,
content: [{ type: "text", text: "Review this code for thread safety..." }]
}, id: 3 });
// 5. Collect response from session/notification events
// AgentMessageChunk → accumulate text
// TurnEnd → consultation complete
// 6. Cleanup
agent.kill();ACP provider registry
// lib/consult/acp-providers.js
const ACP_PROVIDERS = {
'gemini': {
command: 'gemini',
args: [], // Gemini CLI is already ACP-native
env: {},
name: 'Gemini CLI'
},
'codex': {
command: 'npx',
args: ['@zed-industries/codex-acp'],
env: { OPENAI_API_KEY: '${OPENAI_API_KEY}' },
name: 'OpenAI Codex'
},
'claude': {
command: 'npx',
args: ['@zed-industries/claude-agent-acp'],
env: { ANTHROPIC_API_KEY: '${ANTHROPIC_API_KEY}' },
name: 'Claude'
},
'copilot': {
command: 'copilot',
args: ['--acp', '--stdio'],
env: {},
name: 'GitHub Copilot'
},
'kiro': {
command: 'kiro-cli',
args: ['acp'],
env: {},
name: 'Kiro'
},
'opencode': {
command: 'opencode',
args: ['acp'],
env: {},
name: 'OpenCode'
}
};Debate via ACP
async function debate(topic, proposerTool, challengerTool) {
// Round 1: Proposer
const proposerResponse = await acpConsult(proposerTool,
`Argue FOR: ${topic}. Present your strongest case.`);
// Round 2: Challenger
const challengerResponse = await acpConsult(challengerTool,
`Argue AGAINST: ${topic}.\n\nThe proposer argued:\n${proposerResponse}\n\nPresent your counter-arguments.`);
// Round 3: Verdict (use current agent)
return { proposer: proposerResponse, challenger: challengerResponse };
}
// Usage:
// /debate "microservices vs monolith" --proposer=gemini --challenger=codexImplementation plan
Phase 1: ACP client library (lib/consult/acp-client.js)
- Generic ACP client: spawn, initialize, session/new, session/prompt, collect response
- Provider registry with command/args/env per tool
- Timeout handling, error recovery, graceful shutdown
Phase 2: Update /consult skill
- Replace Bash subprocess calls with ACP client
- Auto-detect available ACP providers (check if command exists on PATH)
- Structured JSON output from ACP responses
- Works on ALL platforms (Claude Code, Kiro, OpenCode, Codex, Cursor)
Phase 3: Update /debate skill
- Multi-round ACP exchanges: proposer → challenger → verdict
- Configurable proposer/challenger tools (
--proposer=gemini --challenger=codex) - Cross-tool debates (e.g., Gemini proposes, Copilot challenges, Codex judges)
Phase 4: Platform transforms
- Install ACP steering files for Kiro (
.kiro/steering/acp-consultation.md) - Install ACP commands for Cursor (
.cursor/commands/consult.md) - Document ACP availability per platform
Phase 5: Tests
- Unit tests for ACP client (mock subprocess)
- Integration tests with each ACP provider
- Debate round tests
- Provider detection tests
Why this is better than Bash subprocesses
| Aspect | Current (Bash) | Proposed (ACP) |
|---|---|---|
| Protocol | Ad-hoc CLI invocation | Standardized JSON-RPC 2.0 |
| Session | None | Persistent, resumable |
| Context | Text in/text out | Structured content blocks, files, images |
| Tools | None | Full tool call support |
| Platform | Claude Code only (Bash tool) | ALL platforms (subprocess spawning is universal) |
| Providers | 5 (custom per-tool syntax) | 30+ (one protocol) |
| Error handling | Exit codes only | Structured error responses |
| Streaming | No | AgentMessageChunk events |
Acceptance criteria
- ACP client library (
lib/consult/acp-client.js) with provider registry -
/consultuses ACP for all supported providers -
/debateuses ACP for cross-tool structured debates - Provider auto-detection (which ACP agents are available)
- Works on all 5 agentsys platforms
- Kiro steering files installed for ACP consultation
- Tests for ACP client, consult, debate
- Documented: ACP provider matrix and setup instructions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels