🚀 Delegate complex programming tasks to Claude Code CLI from your OpenClaw agents
Quick Start • Features • Examples • Deployment •
🌐 Languages: English | 简体中文
OpenClaw Claude Code Bridge allows your OpenClaw agents to delegate complex programming tasks to Claude Code CLI. Think of it as giving your AI assistant access to a senior developer who can:
- 🔨 Write production-quality code from scratch
- 🐛 Debug complex issues across multiple files
- 🔄 Refactor legacy codebases with architectural insights
- 🧪 Write comprehensive tests and documentation
- 📊 Analyze codebases and provide architectural recommendations
curl -sSL https://raw.githubusercontent.com/TheSoulGiver/openclaw-claude-code/main/scripts/install.sh | bash-
Clone the repository
git clone https://github.com/TheSoulGiver/openclaw-claude-code.git cd openclaw-claude-code -
Install Claude Code CLI (if not already installed)
npm install -g @anthropic-ai/claude-cli
-
Install the plugin
./scripts/install.sh
-
Restart OpenClaw Gateway
openclaw gateway restart
- Multi-file projects: Handle complex refactoring across multiple files
- Architecture decisions: Get expert-level architectural recommendations
- Code analysis: Deep analysis of existing codebases
- Test generation: Comprehensive test suites with edge cases
Your OpenClaw agent automatically decides when to use Claude Code vs. built-in tools:
| Task | Built-in Tools | Claude Code |
|---|---|---|
| Simple scripts (< 30 lines) | ✅ Direct execution | ❌ |
| Multi-file refactoring | ❌ | ✅ Perfect fit |
| Quick config changes | ✅ Fast and efficient | ❌ |
| Complex debugging | ❌ | ✅ Expert analysis |
- Iterative development: Continue previous sessions for complex projects
- Context preservation: Full conversation history maintained
- Background execution: Long-running tasks don't block your agent
- Zero dependencies: Pure TypeScript, no external libraries
- Error recovery: Graceful handling of Claude Code CLI issues
- Logging: Comprehensive logging for debugging
- Docker support: Containerized deployment ready
// Your agent can now say:
await claude_code({
task: "Refactor the auth system in src/ to use JWT instead of sessions. Update all related files and tests.",
work_dir: "/path/to/project"
});await claude_code({
task: "Analyze this Express.js API and suggest performance optimizations. Focus on database queries and caching.",
work_dir: "/path/to/api"
});await claude_code({
task: "Generate comprehensive unit tests for the user service, including edge cases and error scenarios.",
session_id: "previous-session-id" // Continue from previous context
});graph LR
A[OpenClaw Agent] -->|Complex coding task| B[Claude Code Bridge]
B -->|Spawns process| C[Claude Code CLI]
C -->|Analyzes & codes| D[Your Project Files]
D -->|Results| C
C -->|Success/Error| B
B -->|Final result| A
- Task Assessment: Your agent determines if a task is complex enough for Claude Code
- Context Preparation: The bridge prepares the task context and project information
- CLI Execution: Spawns Claude Code CLI with the appropriate parameters
- Result Processing: Processes the output and provides structured feedback
- Error Handling: Gracefully handles failures and provides debugging information
docker-compose up -d# Install to OpenClaw extensions directory
cp -r plugins/claude-code-bridge ~/.openclaw/extensions/
openclaw gateway restartSee GitHub Actions workflow for automated testing and deployment.
Create .env file (see .env.example):
# Claude Code CLI path (auto-detected if in PATH)
CLAUDE_CODE_CLI_PATH=/path/to/claude
# Default working directory
CLAUDE_CODE_WORK_DIR=/default/workspace
# Timeout for long-running tasks (seconds)
CLAUDE_CODE_TIMEOUT=300
# Maximum number of iterations per session
CLAUDE_CODE_MAX_TURNS=10- Sandboxed execution: Claude Code runs in controlled environment
- Path validation: All file paths are validated before execution
- Timeout protection: Prevents runaway processes
- Error isolation: Failures don't crash your OpenClaw instance
We welcome contributions! See CONTRIBUTING.md for guidelines.
git clone https://github.com/TheSoulGiver/openclaw-claude-code.git
cd openclaw-claude-code
npm install
npm run build
npm testApache 2.0 License. See LICENSE for details.
If this plugin helps you build better OpenClaw agents, please give it a star! ⭐
Made with 💙 for the OpenClaw community