Drive your local Claude Code / OpenAI Codex / Google Gemini CLI from Lark. A lightweight bot: one command to start, scan a QR to mint a Lark PersonalAgent app, then DM the bot from Feishu to send screenshots, attach files, run scripts, edit code — every action runs on your own machine.
中文版: README.zh.md
One human prompt → three bots (claude / codex / gemini) introduce themselves to each other, using lark-cli to discover group members and dispatch @-mentioned greetings — all on a single laptop, all in one Lark group. Full walkthrough →
The real superpower is bringing several local CLIs into the same Lark group as bots, then letting humans and bots interleave. A few real scenarios:
- Multi-bot A2A in a group. Drop both
claude-botandcodex-botinto the same group. Ask claude "what are the concurrency risks here?", then @-mention codex "review claude's suggestions for missed edge cases." Two bots cross-check each other in chat — you read the consensus. Agent-to-agent collaboration on a Feishu group as the platform. - Humans + multiple bots triaging together. Production bug channel: engineer @-mentions
claude-botto repro from a screenshot and draft a fix, QA @-mentionscodex-botto run regression, PM @-mentionsgemini-botto summarise the timeline and impact. Three bots run on your machine; their outputs all land in the same group so everyone sees the full chain. - Have the bot ship code right in the group. DM (or @-mention) "add a stripe webhook handler in
src/payment.ts". The bot reads your local code, writes new files, runs tests — the whole PR streams into a Lark card. Teammate spots an issue in the diff? They quote-reply the card with their note, the bot incorporates and continues. Multi-human review + bot execution, all in one thread. - Keep going after leaving the desk. Had an idea at dinner? DM the bot from your phone; it runs on your home laptop, you
git diffat work the next day.
Session continuity is automatic — claude --session, codex exec resume, gemini --resume — so multi-turn context follows the conversation. Each bot keeps its own session per chat, so multiple bots in one group don't cross-bleed.
git clone https://github.com/wang14597/lark-multi-cli-bridge.git
cd lark-multi-cli-bridge
pnpm install && pnpm build
node ./bin/lmcb.mjs init # interactive: pick backend, scan QR, done
node ./bin/lmcb.mjs start --foregroundinit walks you through:
- Pick a backend —
claude/codex/gemini(whichever CLI you have). - Scan a QR with the Lark mobile app. Lark auto-creates a PersonalAgent app under your tenant and returns
app_id/app_secretto lmcb. No browser, no developer console required. - Bot YAML is written to
~/.lark-multi-cli-bridge/bots/<name>.yaml(chmod 600). Then DM the bot.
Full walkthrough: docs/quickstart.md
User-visible behaviors, in order of how often they matter:
- Read images and files you send. Screenshots, PDFs, code files — all downloaded to local disk and injected into the prompt as
[Attached <kind>: <abs path>]so the CLI canReadthem with full path. - Modify your local files. The CLI runs on your machine with its normal filesystem access. Use
/cd <path>to scope the working directory;/wsto save and switch named workspaces. - Stream output live. Text, tool calls (
> ✅ **Bash** — pnpm test), tool failures (inline↳ AssertionError: …), thinking panel — all stream into a single Lark card. ⏹ button stops the run mid-stream;/stopdoes the same. - Quote-reply attribution. First card per turn replies the user's message, so the original gets a
N 条回复badge and the card renders under回复 <user>:— groups stay legible. - Cross-message continuity. The CLI's native session id is preserved per chat, so follow-ups remember what you were just discussing.
- Slash commands in chat —
/help,/new,/cd,/ws,/status,/stop,/timeout,/access,/sessions,/reconnect,/doctor. - Attachment-aware groups. @-mention to invoke in groups; reply-quote to point the bot at a specific message; the bridge expands
merge_forwardparents so the bot sees the actual thread context.
Designed for one developer's bots on one machine, but inside that scope it scales cleanly:
- Different backends side by side.
claude-bot+codex-bot+gemini-botfrom one supervisor; each gets its own Lark identity, crash budget, and conversation state. - Same backend, multiple personas. Run
claude-personal-botandclaude-team-botfrom separate Lark apps with their own access lists and cwds. - Same chat, multiple bots, no bleed. SessionStore is keyed per
(chatId, botName)— claude's UUID and codex's thread_id never cross-feed, so a single group can hold parallel conversations with different agents. - Per-bot
lark-cliidentity. Everylark-clicall from inside the LLM subprocess routes to the calling bot's profile via a per-bot PATH shim (--profile <app_id>pinned). No identity leakage even with many bots active.
| Doc | Description |
|---|---|
| docs/quickstart.md | Step-by-step setup and first run (includes lmcb init walkthrough and agent-skill install) |
| docs/configuration.md | bot.yaml knobs: skill prompt injection, LLM card-button callbacks (__claude_cb), codex skip_git_repo_check |
| docs/architecture.md | Process topology, module map, IPC, on-disk state |
| docs/adapter-authoring.md | How to add a 4th CLI backend |
| docs/faq.md | Troubleshooting and common questions |
Active development. v0.7.1 released; an [Unreleased] batch covering quote-reply, per-(chatId, botName) session scoping, gemini 0.44 stream-json, Lark SDK pino logging, and the CardKit 2.0 stop-button fix is queued for v0.7.2 — see CHANGELOG.md.
Tested manually with Lark on macOS. Linux works for foreground mode; the launchd daemon is macOS-only (systemd unit generation is deferred).
This project was inspired by and builds on zarazhangrui/lark-coding-agent-bridge — a lightweight bot bridging Feishu/Lark with a local Claude Code / Codex CLI. lark-multi-cli-bridge extends that idea to multiple CLI backends (Claude Code / OpenAI Codex / Google Gemini) running as separate bots under one supervisor. Many thanks to the original author for the groundwork.
MIT. See LICENSE.
