Channels
Claude Code Bridge
OpenClaw plugin bridging Claude Code to Telegram, WhatsApp and Discord
Install
npm install
npm
README
# openclaw-claude-code-bridge
OpenClaw plugin that bridges Claude Code sessions to any OpenClaw channel (WhatsApp, Telegram, Discord).
## How it works
```
You (WhatsApp/Telegram) → OpenClaw → this plugin → Claude Code (stream-json) → response → you
```
Uses Claude Code's `--input-format stream-json --output-format stream-json` for persistent, multi-turn sessions. The Claude Code process stays alive between messages, preserving full context and enabling long-running workflows.
## Install
```bash
openclaw plugins install openclaw-claude-code-bridge
```
## Commands
| Command | What it does |
|---------|-------------|
| `/cc_resume` | Bind this conversation to a Claude Code session |
| `/cc_status` | Show session state |
| `/cc_stop` | Interrupt current run |
| `/cc_detach` | Unbind conversation |
| `/cc_agent <name>` | Switch AIOX agent (@dev, @qa, etc) |
| `/cc_model <model>` | Switch model (opus, sonnet, haiku) |
| `/cc_sessions` | List all active sessions |
## Usage
1. Install the plugin
2. In any OpenClaw conversation: `/cc_resume`
3. Pick or create a session
4. Talk normally — messages route to Claude Code
5. Use `/cc_agent dev` to switch to @dev agent
6. Use `/cc_stop` to interrupt
## Architecture
```
+-------------------------------------------------+
| OpenClaw (gateway) |
| WhatsApp / Telegram / Discord channels |
+-------------------+-----------------------------+
| plugin interface
+-------------------v-----------------------------+
| openclaw-claude-code-bridge |
| +-- index.ts (plugin registration) |
| +-- session-manager.ts (multi-session) |
| +-- session.ts (stream-json subprocess) |
| +-- message-router.ts (chat <-> claude) |
+-------------------+-----------------------------+
| stdin/stdout NDJSON
+-------------------v-----------------------------+
| Claude Code CLI |
| --input-format stream-json |
| --output-format stream-json |
| (persistent process, multi-turn) |
+-------------------------------------------------+
```
## Why not Claude Agent SDK?
The SDK spawns a new process per `query()` call with ~12s overhead and no session persistence. The stream-json approach keeps one process alive across all turns with full context preservation and automatic compaction.
## AIOX Integration
This plugin knows about AIOX agents. Use `/cc_agent dev` to send `@dev` to the Claude Code session, switching the active AIOX agent. All AIOX workflows, handoffs, and subagents work normally.
## Development
```bash
git clone https://github.com/wandersonarruda1-stack/openclaw-claude-code-bridge
cd openclaw-claude-code-bridge
npm install
npm run build
# Link to local OpenClaw for testing
openclaw plugins install --link /path/to/openclaw-claude-code-bridge
```
## License
MIT
channels
Comments
Sign in to leave a comment