An OpenClaw channel plugin that bridges CSGClaw IM conversations into the OpenClaw gateway. It connects to the CSGClaw server via participant SSE (Server-Sent Events) for inbound messages and REST API for outbound replies.
┌─────────────┐ SSE /events ┌─────────────────────┐
│ │ ◄─────────────────────── │ │
│ CSGClaw │ │ OpenClaw Gateway │
│ Server │ ◄─────── REST POST ──────│ + csgclaw-extension│
│ │ /messages │ │
└─────────────┘ └─────────────────────┘
│ │
│ │
IM Clients Agent Runtimes
(Web / Feishu / (PicoClaw / Codex /
CLI / API) Custom agents)
Inbound flow:
- User sends a message in CSGClaw IM (room or DM)
- CSGClaw server emits an SSE event on
/api/v1/channels/csgclaw/participants/{id}/events - The plugin consumes the SSE stream, parses the event, and dispatches it into OpenClaw's reply pipeline
- The assigned agent generates a response
Outbound flow:
- Agent reply flows back through OpenClaw's channel send adapter
- The plugin POSTs the text to
/api/v1/channels/csgclaw/participants/{id}/messages - CSGClaw server delivers the reply to the IM client
- CSGClaw channel — full bidirectional IM bridge (DM + group rooms)
- Feishu bridge — optional Feishu channel pass-through via the same participant API
- Group mention filtering — only dispatches group messages when the bot is @-mentioned (configurable per room)
- Topic/thread support — preserves topic context for threaded conversations
- Multi-arch Docker image — pre-baked image with
csgclaw-cli+ plugins forlinux/amd64andlinux/arm64
├── index.ts # Plugin entry: defineChannelPluginEntry
├── setup-entry.ts # Setup entry for OpenClaw CLI wizard
├── openclaw.plugin.json # Plugin manifest (id, kind, channels)
├── src/
│ ├── channel.ts # Channel plugin definition (capabilities, routing, outbound)
│ ├── config.ts # Account resolution, API URL builders
│ ├── monitor.ts # SSE event consumer + inbound dispatch + outbound send
│ └── sse.ts # Minimal SSE stream reader over fetch()
── docker/ # Docker files (see docker/README.md)
│ ├── Dockerfile # Production image (pulls from npm)
│ ├── Dockerfile.base # Base image (OpenClaw runtime)
│ └── Dockerfile.ci # CI-only image (uses local dist)
├── .gitlab/ci.yml # GitLab CI: main branch → multi-arch buildx → ACR
└── Makefile # Build targets for local dev and CI image publishing
- Node.js >= 24.14.0
- pnpm >= 10
- Docker with Buildx (for image builds)
- A running CSGClaw server with participant API access
pnpm install --frozen-lockfile
pnpm run buildOutput goes to dist/.
Add to your openclaw.json (OpenClaw gateway config):
{
"channels": {
"csgclaw": {
"enabled": true,
"baseUrl": "http://127.0.0.1:18080",
"participantId": "your-bot-id",
"accessToken": "optional-token"
}
},
"plugins": {
"load": { "paths": ["./path-to/csgclaw-extension"] },
"entries": { "csgclaw": { "enabled": true } }
}
}| Field | Required | Description |
|---|---|---|
baseUrl |
Yes | CSGClaw server URL |
participantId |
Yes | Bot participant ID (also accepts botId) |
accessToken |
No | Bearer token for API auth |
enabled |
No | Enable/disable the channel (default: true) |
Environment variables are also supported: CSGCLAW_BASE_URL, CSGCLAW_PARTICIPANT_ID (or CSGCLAW_BOT_ID), CSGCLAW_ACCESS_TOKEN.
By default, the bot only responds in group rooms when @-mentioned. Configure per-room overrides:
{
"channels": {
"csgclaw": {
"groups": {
"room-abc": { "requireMention": false },
"*": { "requireMention": true }
}
}
}
}When both CSGClaw and Feishu channels are configured, the plugin can forward inbound Feishu events from the CSGClaw server and send replies through the Feishu participant API:
{
"channels": {
"csgclaw": {
"enabled": true,
"baseUrl": "http://127.0.0.1:18080",
"participantId": "my-bot"
},
"feishu": {
"enabled": true,
"accounts": {
"my-bot": {
"enabled": true,
"appId": "cli_xxx",
"appSecret": "xxx"
}
}
}
}
}The Dockerfile produces a ready-to-run OpenClaw gateway image with csgclaw-cli, the CSGClaw extension, and the Feishu plugin pre-installed.
# Build csgclaw-cli binaries from the sibling csgclaw repo
make prepare-csgclaw-cli CSGCLAW_DIR=../csgclaw
# Build and load into local Docker daemon
make image-local# Requires a buildx builder with ACR credentials
docker login <acr-registry>
make image TAG=20260609.1-csgclaw PLATFORMS=linux/amd64,linux/arm64| Component | Location in Image |
|---|---|
| OpenClaw runtime | /app |
| csgclaw-cli | /usr/local/bin/csgclaw-cli |
| CSGClaw plugin | /home/node/openclaw-plugins/csgclaw-extension/ |
| Feishu plugin | /home/node/openclaw-plugins/feishu/ |
| Target | Command | Output |
|---|---|---|
| Local dev | make image-local |
openclaw-csgclaw:local |
| ACR publish | make image TAG=<tag> |
<registry>/opencsghq/openclaw:<tag> |
| Base only | make base-image |
Pre-baked runtime base (Node + Python + CA certs) |
The project uses a dual-CI setup:
| Platform | Trigger | Purpose |
|---|---|---|
| GitHub Actions | Pull requests | TypeScript build check |
| GitLab CI | main branch push |
Multi-arch Docker build → push to ACR |
GitHub (source of truth)
git@github.com:OpenCSGs/openclaw-csgclaw-extension.git
│
│ GitLab Pull Mirror (Settings → Repository → Mirroring)
▼
GitLab (CI runner)
│
│ .gitlab/ci.yml (main branch triggered)
▼
ACR (Alibaba Cloud Container Registry)
opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsghq/openclaw:YYYYMMDD.N-csgclaw
GitLab CI automatically triggers when the main branch is updated via mirror sync. The default sync interval is 30 minutes.
To manually trigger an immediate sync and CI build:
- Go to GitLab Settings → Repository → Mirroring repositories
- Find the mirror entry for this repository
- Click the refresh button (🔄) next to the mirror entry
- Wait a few seconds, then check CI/CD → Pipelines for the build status
Image tag format: YYYYMMDD.{CI_PIPELINE_IID}-csgclaw
CI_PIPELINE_IIDis a GitLab project-level monotonic ID- Multiple pushes on the same day get unique tags:
20260609.1-csgclaw,20260609.2-csgclaw, etc.
pnpm install --frozen-lockfile
pnpm run build # → dist/# 1. Build plugin
pnpm install --frozen-lockfile
pnpm run build
# 2. Build csgclaw-cli from sibling repo
make prepare-csgclaw-cli CSGCLAW_DIR=../csgclaw
# 3. Build local image
make image-local- Update
versioninpackage.json - Update
CSGCLAW_EXTENSION_VERSIONinMakefileanddocker/Dockerfile - Update
OPENCLAW_BASE_VERSIONif the upstream OpenClaw version changed - Commit and push to
main - GitLab mirror sync triggers CI build automatically (or manually trigger sync)
- OpenClaw — AI coding agent gateway
- CSGClaw — Multi-agent orchestration server
- PicoClaw — Lightweight agent runtime
See LICENSE for details.