I Built a Bot That Runs Claude Code From Chat
Why Build This
Anyone who has used Claude Code knows how powerful it is — it can read code, modify code, run commands, and perform refactoring. But there’s one problem: you have to be in a terminal to use it.
That means you need to sit in front of your computer, open a terminal, and interact with Claude Code from there. On the go, on your phone, or want your team to use it too? No luck.
So I thought: what if we could connect Claude Code to Lark and turn it into a group chat bot?
Just @ it in the chat, and it can help you modify code, investigate issues, or run tests. No terminal needed, no SSH required — works right from your phone.
That’s how CCBot was born.
OpenClaw: The Inspiration
Before building CCBot, I studied an open-source project called OpenClaw.
OpenClaw is a self-hosted personal AI assistant built by Peter Steinberger (founder of PSPDFKit), released under the MIT license. Its core philosophy is simple: AI should run on your own devices and interact through the chat tools you already use.
It’s far more ambitious than CCBot:
- 20+ messaging channels: WhatsApp, Telegram, Slack, Discord, Lark, WeChat, iMessage… virtually every chat tool you can think of
- Multi-model support: OpenAI, Anthropic, Google, Ollama (local models), DeepSeek, and a dozen more AI providers
- Native apps: macOS menu bar app, iOS app, Android app — all serving as “nodes” for the assistant, providing device-specific capabilities (camera, screen recording, voice, etc.)
- Browser control: Controls a standalone Chrome instance via Playwright — browsing, form-filling, screenshots
- Voice interaction: Wake word detection, continuous voice conversation, text-to-speech
- Live Canvas: An AI-powered visual workspace where AI can render and manipulate visuals in real time
- Automation: Scheduled tasks, webhooks, Gmail subscriptions, polling
- Plugin system: Lean core with 70+ extensions loaded via plugins
- Memory system: Vector storage based on LanceDB, plus workspace memory files
On the tech side, OpenClaw uses TypeScript + Node.js, managed as a pnpm monorepo, with Hono as the web gateway, Lit for the control panel UI, and SQLite + sqlite-vec for data storage and vector search. Deployment is flexible — Docker, Fly.io, Nix, or bare metal.
For security, it uses a single-operator trust model — each gateway instance has one trusted user, secured through DM pairing, whitelisting, sandboxing, and execution approval. It’s not a multi-tenant platform — it’s your personal assistant.
The biggest takeaway from OpenClaw: AI assistants shouldn’t be locked into a specific interface — they should show up in the tools you use every day.
But OpenClaw is a general-purpose AI assistant, while I wanted something more focused — specifically bringing Claude Code’s programming capabilities into Lark. No need to support 20 channels or multi-model switching — just do “Lark + Claude Code” well.
And that’s how CCBot came to be.
What Is CCBot
CCBot is an open-source Lark bot that brings Claude Code’s programming capabilities directly into Lark group chats.
In one sentence: @ CCBot in Lark is like using Claude Code in the terminal.
Key features:
- Lark WebSocket long connection — no public IP needed, no callback URL to configure
- Claude Code
--printmode — with session context, supporting multi-turn conversations - PM2 process management — background daemon, one-command start/stop
- Per-user message queue — multiple users can use it simultaneously without conflicts
- Auto-splitting long messages — Claude’s lengthy replies are automatically split into multiple Lark messages
- Lark Markdown rendering — code blocks, lists, bold text, and other formatting display correctly
How to Use
Installation
npm install -g @ccbot/cli
Configure the Lark Bot
- Create a custom app on the Lark Open Platform
- Add the “Bot” capability
- Event subscription → set to “Long Connection” mode
- Add event:
im.message.receive_v1 - Grant permissions:
im:message.p2p_msg:readonly(receive direct messages)im:message.group_at_msg:readonly(receive group @ messages)im:message:send_as_bot(send messages as bot)
- Publish the app and note down the App ID and App Secret
Start
Navigate to your project directory and run:
ccbot start
On first launch, you’ll be prompted for configuration:
? Claude Code path: claude
? Anthropic Base URL: https://api.anthropic.com
? Anthropic Auth Token: sk-xxx
? Feishu App ID: cli_xxx
? Feishu App Secret: ***
? Timeout in ms: 300000
Configuration is saved in ccbot.json in the current directory and loaded automatically on subsequent starts.
Usage
In Lark group chats or direct messages:
- Send a message or @ CCBot, and it will invoke Claude Code to handle your request
- Send
/newto reset the session - Send
/stopto stop the current request - Send
/statusto check session status - Send
/versionto check the version
Management
ccbot stop # Stop
ccbot restart # Restart
ccbot status # Check status
ccbot logs # View logs
ccbot delete # Remove from pm2
Technical Implementation
The architecture is straightforward:
Lark message → CCBot Server → Claude Code CLI (--print) → Lark reply
CCBot receives messages through Lark’s WebSocket long connection, invokes the local claude --print command to process them, and sends the results back to Lark.
Key design decisions:
- WebSocket long connection: Unlike traditional Lark bots that require a public IP and callback URL, CCBot uses long connection mode — it can run on an intranet machine
- Session management: Each user has an independent session context, making multi-turn conversations coherent
- Message queue: Requests from the same user are processed sequentially to avoid concurrency conflicts
- PM2 daemon: PM2 manages the process with auto-restart on crash and automatic log rotation
The project itself is a Lerna + Nx monorepo containing two sub-packages:
@ccbot/cli: Core CLI tool@ccbot/index: Website (ccbot.dev)
Use Cases
- Solo developers: Let Claude Code help you modify code right from your phone
- Small teams: Share a Claude Code instance in a Lark group — everyone can use it
- Remote work: Operate directly from Lark without SSH-ing into your dev machine
- Code review: Drop code snippets into the chat and let CCBot help review them
CCBot vs OpenClaw
| Dimension | CCBot | OpenClaw |
|---|---|---|
| Focus | Claude Code Lark bot | General-purpose personal AI assistant |
| Channels | Lark | 20+ channels |
| AI Backend | Claude Code CLI | Multi-model support |
| Deployment | One-line npm install -g | Docker/Fly.io/Nix |
| Native Apps | None | macOS/iOS/Android |
| Plugin System | None | 70+ extensions |
| Best For | Developers using Lark + Claude Code | Power users wanting an all-in-one AI assistant |
In short: CCBot is the screwdriver in a Swiss Army knife — does one thing, but does it well. OpenClaw is the whole Swiss Army knife.
If you just want to use Claude Code in Lark, CCBot is up and running in five minutes. If you want an all-in-one AI assistant that connects to every chat tool, supports voice, and can control a browser, check out OpenClaw.
Links
More Articles
- Claude Code /fast: Same Opus, 2x Speed — Worth It?
- Claude Code /init: Generate CLAUDE.md in 10 Seconds
- Claude Code MCP: Give Your AI Access to Any Tool
- Claude Code /model: Opus vs Sonnet vs Haiku Guide
- Claude Code in 2026: The Only Setup Guide You Need
- The Complete Guide to Claude: From Chat to Code to Automation
- CCBot - 24x Development Efficiency Boost
- Shocking! This Tool Lets Programmers Finish 95 Minutes of Work in 4 Minutes! 24x Efficiency Boost
- Claude Code /add-dir: The Monorepo Command You Miss
- Claude Code /compact: Free Up Context, Keep Progress
- Claude Code /btw Command Explained: Quick Side Questions Without Breaking Flow
- Claude Code /stats: See How Much AI Does For You
- Claude Code /status Command Explained: Your Session Dashboard
- Why AI-First Startups Only Need One Programming Language
- Best Practice for External Knowledge in Claude Code: GitHub MCP + Context7
- Claude Code Token-Saving Tip: The Power of the Exclamation Mark
- Claude Code /resume Command Explained: Don't Let Your Conversations Go to Waste
- Claude Code /usage Command Explained: Know Your Remaining Quota
- Claude Code /tasks Command Explained: Master Your Background Tasks
- Claude Code Skills Explained: Build Your Custom Command Library
- Claude Code /plan Explained: Think Before You Code
- Claude Code /memory Explained: Make AI Truly Remember Your Project
- cc-ping: Ping All Your Claude Code Configs in One Command