Integration
Claude
OpenClaw gateway plugin for code assistant integration
Install
npm install -g
Configuration Example
{
"tool": "claude_code_run",
"params": {
"prompt": "Refactor this function to use async/await",
"model": "sonnet"
}
}
README
<p align="center">
<img src="https://img.shields.io/badge/OpenClaw-Claude_Code_Plugin-blue?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0tMiAxNWwtNS01IDEuNDEtMS40MUwxMCAxNC4xN2w3LjU5LTcuNTlMMTkgOGwtOSA5eiIvPjwvc3ZnPg==" alt="OpenClaw Claude Code Plugin"/>
</p>
<h1 align="center">OpenClaw Claude Code Plugin</h1>
<p align="center">
<strong>Bridge Claude's AI to every messaging platform through OpenClaw</strong>
</p>
<p align="center">
<a href="#-quick-install"><img src="https://img.shields.io/badge/install-one_liner-brightgreen?style=flat-square" alt="One-liner install"/></a>
<img src="https://img.shields.io/badge/python-3.10+-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.10+"/>
<img src="https://img.shields.io/badge/node.js-22+-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js 22+"/>
<img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT License"/>
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey?style=flat-square" alt="Platforms"/>
<img src="https://img.shields.io/badge/tests-597%20passing-success?style=flat-square" alt="Tests"/>
<img src="https://img.shields.io/badge/coverage-80%25+-yellow?style=flat-square" alt="Coverage"/>
</p>
<p align="center">
<a href="#-quick-install">Install</a> •
<a href="#-how-it-works">How It Works</a> •
<a href="#-usage-guide">Usage</a> •
<a href="#%EF%B8%8F-configuration">Config</a> •
<a href="#-sandbox-modes">Sandbox</a> •
<a href="#-troubleshooting">Help</a>
</p>
---
## What Is This?
The OpenClaw Claude Code Plugin lets users on **WhatsApp, Telegram, Discord, iMessage, Slack, and Signal** interact with Claude's AI through natural conversation — no terminal access needed. It bridges Claude Code CLI's headless mode with OpenClaw's multi-channel gateway.
### Key Features
| Feature | Description |
|:--------|:------------|
| **Multi-Turn Agentic Tasks** | Full agentic loops -- edit files, run commands, iterate until done |
| **Streaming Responses** | Text deltas delivered within 200ms of CLI receipt |
| **Persistent Sessions** | Multi-turn conversations saved to disk with dual expiration |
| **Auto Pruning** | When tokens exceed limits, oldest 70% of turns are summarized |
| **Tool Execution** | Run bash, Python, and file operations in 4 sandbox modes |
| **Slash Commands** | `/claude`, `/model`, `/reset`, `/sandbox`, `/session` |
| **Multi-Model** | Auto-detect latest Claude model or manually switch |
| **Configurable Effort** | Set AI effort level: `low`, `medium`, `high`, `max` |
| **API Key Auth** | `bare_mode` for headless/CI -- no OAuth needed |
| **Observability** | Structured JSON logging + optional Prometheus metrics |
| **Security** | No credential storage, inputs sanitized, sessions chmod 600 |
---
## Quick Install
### macOS / Linux
```bash
curl -sSL https://raw.githubusercontent.com/Muminur/openclaw-claude-plugin/main/install.sh | bash
```
### Windows (PowerShell)
```powershell
irm https://raw.githubusercontent.com/Muminur/openclaw-claude-plugin/main/install.ps1 | iex
```
> **What the installer does** (on a fresh machine):
>
> | Step | macOS | Linux (Ubuntu/Fedora/Arch) | Windows |
> |:-----|:------|:--------------------------|:--------|
> | 1. Git | `brew install git` | `apt/dnf/pacman` | `winget install Git.Git` |
> | 2. Python 3.10+ | `brew install [email protected]` | `apt/dnf/pacman` | `winget install Python.Python.3.12` |
> | 3. Node.js 22+ | `brew install node@22` | NodeSource setup | `winget install OpenJS.NodeJS` |
> | 4. Claude CLI | `npm install -g @anthropic-ai/claude-code` | same | same |
> | 5. OpenClaw | `npm install -g @openclaw/gateway` | same | same |
> | 6. Plugin | Clone, pip install, register in config | same | same |
>
> Existing installations are detected and skipped. Nothing is overwritten.
### Custom Install Location
```bash
# Mac/Linux
OPENCLAW_PLUGIN_DIR=/path/to/plugins/dir curl -sSL https://raw.githubusercontent.com/Muminur/openclaw-claude-plugin/main/install.sh | bash
# Windows
irm https://raw.githubusercontent.com/Muminur/openclaw-claude-plugin/main/install.ps1 | iex -PluginDir "C:\path\to\plugins"
```
### Manual Install
```bash
# Install dependencies manually
pip install openclaw-claude-plugin
npm install -g @anthropic-ai/claude-code
npm install -g @openclaw/gateway
# Verify
claude --version # Expected: 2.1.0+
claude models --json # Should list models (auth check)
```
---
## How It Works
```
OpenClaw Claude Code Plugin
+-----------------------------------------------------------------+
| |
| User (WhatsApp / Telegram / Discord / Slack / iMessage / Web) |
| | |
| @claude hi |
| | |
| v |
| +-------------------+ |
| | OpenClaw Gateway | |
| | (Node.js 22+ host)| |
| +--------+----------+ |
| | |
| message_received event |
| | |
| v |
| +---------------------+ |
| | Plugin Bridge | |
| | (src/bridge/index.js)| |
| +--------+------------+ |
| | |
| spawn claude -p --output-format stream-json |
| | |
| v |
| +---------------------+ |
| | Claude Code CLI | |
| | (headless mode) | |
| +--------+------------+ |
| | |
| NDJSON stream events |
| | |
| v |
| +---------------------+ |
| | Plugin Bridge | |
| | (parse + deliver) | |
| +--------+------------+ |
| | |
| channel delivery |
| | |
| v |
| User sees response |
| |
+-----------------------------------------------------------------+
```
### Message Flow (Step by Step)
1. **Message arrives** -- Gateway fires `message_received` event
2. **Plugin intercepts** -- If message starts with `@claude`, the bridge extracts the prompt
3. **CLI invocation** -- Spawns `claude -p "<prompt>" --output-format stream-json` (with `--resume` for existing sessions)
4. **Stream parsing** -- Reads NDJSON line by line, extracting text deltas and tool calls
5. **Session tracking** -- Saves the Claude session ID to disk for multi-turn conversations
6. **Response delivery** -- Text is returned via the OpenClaw channel delivery system
### Session Lifecycle
```
First message Subsequent messages Token limit hit
| | |
v v v
+--------+ +-----------+ +-------------+
| Create | ------> | Resume | ------> | Prune: 70% |
| session| | (--resume)| | summarized |
+--------+ +-----------+ +-------------+
| |
v v
Idle > 60min OR Context reduced,
Age > 48h conversation
| continues
v
+-------------+
| Expired |
| & deleted |
+-------------+
|
v
Next message =
fresh session
```
---
## Usage Guide
Once installed, the plugin works across **all OpenClaw channels** -- WhatsApp, Telegram, Discord, Slack, iMessage, and webchat. No code changes needed.
### 1. `@claude` Prefix (Any Channel)
Type `@claude` followed by your message:
```
@claude explain the difference between async and await in Python
```
**Multi-turn conversations** work automatically -- the plugin tracks sessions per channel and uses `--resume` to continue:
```
@claude what design patt
... (truncated)
integration
Comments
Sign in to leave a comment