Skip to content

TheSoulGiver/openclaw-claude-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenClaw Claude Code
GitHub stars GitHub forks GitHub issues PRs Welcome

OpenClaw Claude Code

OpenClaw Claude Code Bridge

🚀 Delegate complex programming tasks to Claude Code CLI from your OpenClaw agents

Quick StartFeaturesExamplesDeployment

🌐 Languages: English | 简体中文

Documentation

License TypeScript Node.js Claude Code Zero Dependencies


🤖 What is this?

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

⚡ Quick Start

One-Line Installation

curl -sSL https://raw.githubusercontent.com/TheSoulGiver/openclaw-claude-code/main/scripts/install.sh | bash

Manual Installation

  1. Clone the repository

    git clone https://github.com/TheSoulGiver/openclaw-claude-code.git
    cd openclaw-claude-code
  2. Install Claude Code CLI (if not already installed)

    npm install -g @anthropic-ai/claude-cli
  3. Install the plugin

    ./scripts/install.sh
  4. Restart OpenClaw Gateway

    openclaw gateway restart

🎯 Features

🛠️ Programming Task Delegation

  • 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

📊 Intelligent Routing

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

🔄 Session Management

  • Iterative development: Continue previous sessions for complex projects
  • Context preservation: Full conversation history maintained
  • Background execution: Long-running tasks don't block your agent

🐳 Production Ready

  • 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

💡 Examples

Example 1: Multi-file Refactoring

// 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"
});

Example 2: Architecture Analysis

await claude_code({
  task: "Analyze this Express.js API and suggest performance optimizations. Focus on database queries and caching.",
  work_dir: "/path/to/api"
});

Example 3: Test Generation

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
});

🏗️ How It Works

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
Loading
  1. Task Assessment: Your agent determines if a task is complex enough for Claude Code
  2. Context Preparation: The bridge prepares the task context and project information
  3. CLI Execution: Spawns Claude Code CLI with the appropriate parameters
  4. Result Processing: Processes the output and provides structured feedback
  5. Error Handling: Gracefully handles failures and provides debugging information

🚀 Deployment Options

Docker Deployment

docker-compose up -d

Traditional Installation

# Install to OpenClaw extensions directory
cp -r plugins/claude-code-bridge ~/.openclaw/extensions/
openclaw gateway restart

CI/CD Integration

See GitHub Actions workflow for automated testing and deployment.

⚙️ Configuration

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

📚 Documentation

🛡️ Security

  • 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

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick Development Setup

git clone https://github.com/TheSoulGiver/openclaw-claude-code.git
cd openclaw-claude-code
npm install
npm run build
npm test

📄 License

Apache 2.0 License. See LICENSE for details.

⭐ Show Your Support

If this plugin helps you build better OpenClaw agents, please give it a star! ⭐


Made with 💙 for the OpenClaw community

Releases

No releases published

Packages

 
 
 

Contributors