⚠️ Work in Progress - This project is actively under development. Features may change and documentation is being updated continuously.
Agent Client Protocol (ACP) servers for Claude Code and OpenAI Codex, enabling seamless integration with Zed editor and other ACP-compatible clients.
This package provides working ACP implementations for both Claude Code and Codex agents:
- ✅ Claude Code Agent: Fully functional with session management and streaming
⚠️ Codex Agent: Functional but may require additional configuration depending on your Codex setup- 📚 Documentation: Comprehensive but being continuously improved
- 🔧 Wrapper Solutions: Multiple installation options available for different use cases
- 🤖 Dual Agent Support: Supports both Claude Code and OpenAI Codex
- 🔄 Streaming Responses: Real-time streaming output from both agents
- 🛠️ Tool Call Mapping: Automatic mapping of tool calls to ACP protocol
- 📝 Session Management: Persistent sessions with resume capability
- ⚙️ Flexible Configuration: Environment-based configuration options
- 🎯 Zed Integration: Designed specifically for Zed editor integration
# Install globally for CLI usage
npm install -g zedcode-acps
# Or install locally in your project
npm install zedcode-acps- Install Claude Code: Follow Claude Code installation guide
- Set up authentication:
claude setup-token
- Install OpenAI Codex: Follow the OpenAI Codex installation guide
- Set up authentication as required by Codex
- Ensure Codex is accessible in your PATH or set
CODEX_PATHenvironment variable
# Start Claude ACP server
zedcode-acp-claude
# With debug logging
ACP_DEBUG=true zedcode-acp-claude
# With custom permission mode
ACP_PERMISSION_MODE=acceptEdits zedcode-acp-claude# Start Codex ACP server
zedcode-acp-codex
# With debug logging
ACP_DEBUG=true zedcode-acp-codex
# With custom codex path
CODEX_PATH=/usr/local/bin/codex zedcode-acp-codex# Install globally
npm install -g zedcode-acps
# Use in Zed settings.json
{
"agent_servers": {
"codex": {
"command": "npx",
"args": ["zedcode-acp-codex"]
}
}
}For a cleaner Zed configuration without absolute paths:
# From the project directory
git clone https://github.com/SuperagenticAI/zedcode-acps.git
cd zedcode-acps
pnpm install && pnpm build
# Install system-wide wrapper
sudo ./install-wrapper.shThen use this simple Zed config:
{
"agent_servers": {
"codex": {
"command": "zedcode-acp-codex",
"args": []
}
}
}# Clone and build
git clone https://github.com/SuperagenticAI/zedcode-acps.git
cd zedcode-acps
pnpm install && pnpm build
# Use project-specific wrapper in Zed
{
"agent_servers": {
"codex": {
"command": "/path/to/zedcode-acps/user-wrapper.js",
"args": []
}
}
}To use these agents with the Zed editor, you need to add an agent_servers configuration to your settings.json file. You can open your settings.json file by navigating to Zed > Settings > Open Settings.
Below is a comprehensive example that shows how to configure both the Claude and Codex agents with various options. You can copy and paste this into your settings.json file and modify it to your needs.
For a complete reference, you can also see the zed-configuration-example.json file.
{
"agent_servers": {
"claude-code": {
"command": "npx",
"args": ["zedcode-acp-claude"],
"env": {
"ACP_DEBUG": "false",
"ACP_PERMISSION_MODE": "default"
}
},
"claude-code-permissive": {
"command": "npx",
"args": ["zedcode-acp-claude"],
"env": {
"ACP_PERMISSION_MODE": "acceptEdits",
"ACP_DEBUG": "false"
}
},
"codex": {
"command": "npx",
"args": ["zedcode-acp-codex"],
"env": {
"ACP_DEBUG": "false",
"CODEX_PATH": "codex"
}
},
"claude-code-debug": {
"command": "npx",
"args": ["zedcode-acp-claude"],
"env": {
"ACP_DEBUG": "true",
"ACP_PERMISSION_MODE": "acceptEdits"
}
},
"codex-debug": {
"command": "npx",
"args": ["zedcode-acp-codex"],
"env": {
"ACP_DEBUG": "true"
}
}
}
}command: The command to execute to start the agent. We recommend using"npx"to run the agents, as it doesn't require global installation.args: A list of arguments to pass to the command. The first argument should be the name of the agent executable ("zedcode-acp-claude"or"zedcode-acp-codex").env: A map of environment variables to set for the agent process.ACP_DEBUG: Set to"true"to enable debug logging, which is useful for troubleshooting.ACP_PERMISSION_MODE: For the Claude agent, this controls how the agent handles file edits. See the Permission Modes section for more details.CODEX_PATH: For the Codex agent, this specifies the path to thecodexexecutable.
| Variable | Description | Default | Agents |
|---|---|---|---|
ACP_DEBUG |
Enable verbose logging | false |
Both |
ACP_PERMISSION_MODE |
Claude permission mode | default |
Claude |
CODEX_PATH |
Path to codex executable | codex |
Codex |
The bridge supports different permission modes for Claude's file operations:
default: Asks for permission on file operations (default)acceptEdits: Auto-accepts file edits, still asks for other operations (recommended)bypassPermissions: Bypasses all permission checks (use with caution!)plan: Planning mode with restricted operations
You can also change permission mode during a conversation by including special markers in your prompt:
[ACP:PERMISSION:ACCEPT_EDITS]- Switch to acceptEdits mode[ACP:PERMISSION:BYPASS]- Switch to bypassPermissions mode[ACP:PERMISSION:DEFAULT]- Switch back to default mode
Example:
[ACP:PERMISSION:ACCEPT_EDITS]
Please update all the TypeScript files to use the new API
import { ClaudeACPAgent, CodexACPAgent, createServer } from 'zedcode-acps'
// Create a Claude server
const claudeServer = createServer('claude')
// Create a Codex server
const codexServer = createServer('codex')
// Or create agents directly
import { AgentSideConnection } from '@zed-industries/agent-client-protocol'
const connection = new AgentSideConnection(
(client) => new ClaudeACPAgent(client),
input,
output
)Both agents support the following ACP capabilities:
- Session Management: Create, load, and manage conversation sessions
- Streaming Responses: Real-time message streaming
- Tool Calls: Execute and track tool/function calls
- Cancellation: Graceful request cancellation
- Error Handling: Robust error reporting and recovery
The Claude agent wraps the @anthropic-ai/claude-code SDK and provides:
- Direct integration with Claude's streaming API
- Session persistence and resumption
- Permission mode management
- Tool call detection and mapping
- Real-time response streaming
The Codex agent interfaces with the OpenAI Codex CLI and provides:
- Process spawning and management with automatic Node.js detection
- JSON-RPC communication via
codex protosubcommand - Protocol version compatibility fixes
- Output parsing and streaming
- Tool call extraction
- Cross-platform compatibility
- Graceful process cleanup
# Clone the repository
git clone https://github.com/SuperagenticAI/zedcode-acps.git
cd zedcode-acps
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Run in development
pnpm run dev:claude # Claude server
pnpm run dev:codex # Codex server# Type checking
pnpm run typecheck
# Linting
pnpm run lint
# Formatting
pnpm run formatNote: This is a work-in-progress project. Contributions are welcome but please expect active development and potential breaking changes.
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes following the existing patterns
- Test your changes with both agents
- Update documentation as needed
- Submit a pull request
- Follow existing TypeScript patterns
- Test with both Claude Code and Codex agents
- Update README.md for any configuration changes
- Add appropriate error handling and logging
This bridge uses Claude Code's built-in authentication. You need to authenticate Claude Code first:
# Login with your Anthropic account
claude setup-token
# Or if you're already logged in through the Claude Code CLI, it will use that sessionThe bridge will automatically use the existing Claude Code authentication from ~/.claude/config.json.
Follow OpenAI's authentication setup for Codex as per their documentation.
Make sure you're authenticated with Claude Code:
claude setup-tokenThe bridge correctly maintains session context using Claude's native session management. Each ACP session maps to a Claude session that persists throughout the conversation.
Tool calls are fully supported. Ensure your Zed client is configured to handle tool call updates properly.
Error: Command 'zedcode-acp-claude' not found
Solutions:
- Ensure global installation:
npm install -g zedcode-acps - Check PATH:
echo $PATHshould include npm global bin directory - Use full path in Zed config:
/usr/local/bin/zedcode-acp-claude
This occurs when the Codex binary is a Node.js script (common with npm installations):
Solution: The agent automatically detects Node.js scripts and spawns them correctly. If you encounter this error:
- Verify Codex installation:
which codex - Check if it's executable:
ls -la $(which codex) - Try setting explicit path:
"CODEX_PATH": "/usr/local/bin/codex"
If Codex sessions hang on initialization:
Check the logs:
# Enable debug logging
ACP_DEBUG=true zedcode-acp-codex
# Check protocol fixer logs (if using wrapper)
tail -f /tmp/protocol-fixer.logCommon causes:
- Codex authentication issues
- Protocol version mismatches (handled by protocol-fixer.js)
- Process communication failures
If you see protocol version errors, the package includes automatic fixes:
For system-wide installation (recommended for Zed):
# From the project directory
sudo ./install-wrapper.shThen use this Zed config:
{
"agent_servers": {
"codex": {
"command": "zedcode-acp-codex",
"args": [],
"env": {}
}
}
}For project-specific usage:
{
"agent_servers": {
"codex": {
"command": "/path/to/zedcode-acps/user-wrapper.js",
"args": [],
"env": {}
}
}
}The agent automatically detects if Codex is a Node.js script by checking:
- File extension (.js)
- Shebang line (#!/usr/bin/env node)
- File contents
If detection fails, you can force Node.js execution by setting the path to the actual script:
{
"env": {
"CODEX_PATH": "/usr/local/lib/node_modules/@openai/codex/bin/codex.js"
}
}Enable debug logging for detailed troubleshooting:
ACP_DEBUG=true zedcode-acp-claude
ACP_DEBUG=true zedcode-acp-codexThis will output detailed logs to stderr, including:
- Session management operations
- Message processing steps
- Tool call details
- Protocol communication
- Error conditions
The package includes several wrapper scripts to handle compatibility issues:
- Purpose: Fixes protocol version mismatches between Zed and ACP library
- Function: Intercepts JSON-RPC messages and converts string protocol versions to numbers
- Logging: Creates detailed logs in
/tmp/protocol-fixer.logfor debugging
- Purpose: Provides path-independent execution for project-specific installations
- Function: Automatically finds project directory and launches protocol-fixer
- Usage: Can be used directly in Zed config without hardcoded paths
- Purpose: Creates a system-wide wrapper for clean Zed configuration
- Function: Installs a global
zedcode-acp-codexcommand that works from any directory - Result: Enables simple Zed config without absolute paths
The bridge uses a two-step session management approach:
- Creates an ACP session ID initially
- On first message, obtains and stores the agent's session ID
- Uses session resumption for subsequent messages to maintain context
- Client → Wrapper: JSON-RPC messages via stdin/stdout
- Wrapper → Agent: Protocol fixes applied, forwarded to agent
- Agent → CLI: Converted to agent-specific format (Claude SDK/Codex proto)
- CLI → Agent: Stream of response messages
- Agent → Client: Converted back to ACP protocol format
- ✅ Full ACP protocol implementation
- ✅ Session persistence with Claude's native session management
- ✅ Streaming responses
- ✅ Text content blocks
- ✅ Claude SDK integration
- ✅ Tool call support with proper status updates
- ✅ Session loading capability
- ✅ Permission management with configurable modes
- ✅ Rich content display (todo lists, tool usage)
- ✅ Codex CLI integration
- Image/audio content blocks
- Advanced error handling
- Session export/import
- Enhanced Codex streaming
MIT License - see LICENSE file for details.
- Anthropic for Claude Code
- OpenAI for Codex
- Zed Industries for the Agent Client Protocol
- Super-Agentic AI for project sponsorship
- The open-source community for tools and libraries