English | 中文版
clibot is a lightweight middleware that bridges AI CLI tools (Claude Code, Codex, Gemini CLI, OpenCode) to IM platforms (Discord, Telegram, Feishu, DingTalk, QQ, WeChat). Use powerful desktop AI programming assistants from your phone with streaming responses - no public IP required.
- 🌍 No Public IP Required: All bots connect via long-connections (WebSocket/Long Polling). Deploy on your home/office computer behind NAT.
- 📱 Access Anywhere: Use desktop AI tools from mobile phone via IM apps
- 🎯 Unified Entry Point: Manage multiple AI tools through a single bot
- 🔌 Flexible Extension: Add new CLI or Bot by implementing interfaces
- ⚡ ACP Support: Streaming responses, no tmux required (for compatible CLIs)
- 🔄 Session Switch: Switch session adapter mode on-the-fly (e.g. claude ACP ↔ claude stdio) with conversation resume
- 📋 Session Templates: Create sessions instantly with
sn claude|codex|gemini <dir>— zero config - 💾 Session Persistence: Dynamic sessions survive restarts with automatic state restore
- ✂️ Auto Message Split: Long responses auto-split by line with rune-aware counting
- 🔒 Idle Auto-Cleanup: Inactive dynamic sessions are automatically cleaned up
- 🤖 Yolo Mode: Skip permission prompts for trusted sessions
For Claude Code users, an interactive skill is available for one-command setup:
/clibot setupThe skill handles everything: binary download, bot token setup, config generation, and service startup — all through a guided wizard. No manual config editing required.
See skills/clibot/ for details.
- Bot Account (Feishu/Discord/Telegram)
- ACP-Compatible CLI (e.g., claude-agent-acp) OR tmux (for Hook Mode)
For detailed installation instructions, see INSTALL.md.
Linux / macOS:
curl -sL https://raw.githubusercontent.com/keepmind9/clibot/main/scripts/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/keepmind9/clibot/main/scripts/install.ps1 | iexFrom source (requires Go 1.24+):
go install github.com/keepmind9/clibot@latestclibot update # Download latest version
clibot update --apply # Apply the downloaded updateclibot supports network proxies for accessing IM platforms in restricted networks.
# Using environment variables
export HTTP_PROXY="http://127.0.0.1:7890"
clibot serve
# Or configure in config.yaml
proxy:
enabled: true
url: "http://127.0.0.1:7890"- HTTP/HTTPS proxy
- SOCKS5 proxy
- Optional username/password authentication
See Proxy Configuration Guide for details.
Before configuring clibot, you need to get your user ID from the IM platform for whitelist and admin setup.
Step 1: Start clibot with whitelist temporarily disabled:
# ~/temp_config.yaml
security:
whitelist_enabled: false # Temporarily disable
bots:
telegram:
enabled: true
token: "YOUR_BOT_TOKEN"Step 2: Run clibot:
clibot serve --config ~/temp_config.yamlStep 3: Send echo command to your bot:
echo
Step 4: Bot replies with your user ID:
🔍 Your IM Information
Platform: telegram
User ID: 123456789
Step 5: Update your actual config with your user ID:
security:
whitelist_enabled: true
allowed_users:
telegram:
- "123456789" # Your actual user ID
admins:
telegram:
- "123456789" # Your actual user IDImportant: Delete ~/temp_config.yaml and restart with proper config.
# Create config directory
mkdir -p ~/.config/clibot
# Copy configuration template
cp configs/config.mini.yaml ~/.config/clibot/config.yaml
# Edit configuration (replace YOUR_* placeholders)
nano ~/.config/clibot/config.yamlclibot serve --config ~/.config/clibot/config.yamlBest for: claude-agent-acp, Gemini CLI with ACP, OpenCode with ACP
Advantages:
- ✅ No tmux required
- ✅ Streaming responses (real-time)
- ✅ Full-duplex communication
- ✅ Works on all platforms
Configuration:
sessions:
- name: "my-project"
work_dir: "/path/to/project"
start_cmd: "claude-agent-acp"
transport: "stdio://"Setup ACP CLI:
# Install ACP adapter for Claude Code
npm install -g @zed-industries/claude-agent-acp
# Gemini CLI
gemini --experimental-acp
# OpenCode CLI
opencode --acpBest for: Claude Code, Gemini CLI, OpenCode (default mode)
Advantages:
- ✅ Real-time notifications
- ✅ Accurate completion detection
Requirements:
⚠️ Requires tmux⚠️ Requires CLI hook configuration
Configuration:
sessions:
- name: "my-project"
work_dir: "/path/to/project"
start_cmd: "claude"See CLI Hook Configuration Guide for detailed setup.
Priority: ACP > Hook > Stdio
ACP Mode provides better user experience and should be preferred when available.
Best for: Codex, Gemini, OpenCode, Claude Code — when you want zero setup
Advantages:
- ✅ No tmux required
- ✅ No hook configuration required
- ✅ Works with any CLI that supports JSON output
How it works: Per-turn CLIs (Codex, Gemini, OpenCode) spawn a new process for each message. Claude-stdio keeps a long-lived process with bidirectional JSON communication. Session resume is supported via session IDs.
Configuration:
sessions:
- name: "codex"
cli_type: "codex-stdio"
work_dir: "/path/to/project"
cli_adapters:
codex-stdio:
timeout: "5m"Supported CLI types: codex-stdio, gemini-stdio, opencode-stdio (per-turn), claude-stdio (persistent)
- Create a Feishu app at Open Platform
- Get App ID and App Secret
- Configure bot:
bots:
feishu:
enabled: true
app_id: "cli_xxxxxxxxx"
app_secret: "xxxxxxxxxxxxxxxx"
# reply_mode: "card" # Streaming card reply with typewriter effect (default: "text")
# debounce_ms: 2000 # Merge rapid messages within window (0 = disabled)
# mention_in_group: true # Only respond when @mentioned in group chats (default: true)
# media_dir: "~/.clibot/feishu/media" # Directory for downloaded media
# media_ttl: "24h" # Media cache TTL ("0" to disable cleanup)
# max_media_size: 10485760 # Max media file size in bytes (0 = no limit)- Create a Discord application at Discord Developer Portal
- Create a bot and get token
- Invite bot to your server
- Configure:
bots:
discord:
enabled: true
token: "YOUR_BOT_TOKEN"
channel_id: "YOUR_CHANNEL_ID"- Create a bot via BotFather
- Get bot token
- Configure:
bots:
telegram:
enabled: true
token: "YOUR_BOT_TOKEN"- Create a QQ bot at QQ Open Platform
- Get App ID and App Secret
- Configure:
bots:
qq:
enabled: true
app_id: "YOUR_QQ_APP_ID"
app_secret: "YOUR_QQ_APP_SECRET"Note: QQ bot uses WebSocket for receiving messages and HTTP API for sending. Supports C2C (private chat) messages.
WeChat bot uses QR code login instead of a static token. On first run, scan the QR code with your WeChat app to authenticate.
- Enable the bot and run clibot:
- Scan the QR code when prompted (rendered in terminal)
- Click "Confirm" in WeChat to authorize
- Credentials are saved automatically for future runs
bots:
weixin:
enabled: true
# Optional: credentials file path (default: ~/.clibot/weixin/credentials.json)
# credentials_path: "~/.clibot/weixin/credentials.json"Note: The first login requires scanning the QR code in a terminal with a display. After initial authentication, credentials are stored and reused automatically. Session expiry (code -14) will require re-scanning.
slist # List all sessions
sn <template> <dir> [name] # Create session from template (e.g. sn claude ~/project)
snlist # List available templates
suse <session> # Switch to session
sswitch <session> <cli_type> # Switch session CLI type with resume (admin only)
snew <name> <type> <dir> [cmd] # Create new session (admin only)
sdel <name> # Delete session (admin only)
sclose [name] # Close session
sstatus [name] # Show session status
whoami # Show your info
status # Show all session status
echo # Show your IM info
help # Show help
tab # Send Tab key (autocomplete)
esc # Send Escape key
s-tab # Send Shift+Tab
enter # Send Enter key
ctrl-c # Send Ctrl+C (interrupt)
Note: These keywords simulate key presses via tmux send-keys. They only work in Hook mode. ACP mode uses direct protocol communication and does not support these keywords.
You: slist
Bot: Available Sessions:
• claude (acp)
• gemini (gemini)
You: suse claude
Bot: ✓ Switched to session: claude
You: help me write a python function to parse json
Bot: [AI response...]
# Create systemd user directory
mkdir -p ~/.config/systemd/user
# Install service file
cp deploy/clibot.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable clibot
systemctl --user start clibot
# View logs
journalctl --user -u clibot -f# Install supervisor
sudo apt-get install supervisor
# Install config file
sudo cp deploy/clibot.conf /etc/supervisor/conf.d/
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start clibotFor detailed deployment guide, see deploy/DEPLOYMENT.md.
whitelist_enabled: true)
Only whitelisted users can use clibot. Always configure allowed_users and admins in your config file.
clibot/
├── cmd/ # CLI entry point
├── internal/
│ ├── core/ # Core logic
│ ├── cli/ # CLI adapters
│ └── bot/ # Bot adapters
├── configs/ # Configuration templates
└── docs/ # Documentation
- INSTALL.md - Installation guide
- docs/en/setup/cli-hooks.md - CLI hook configuration
- deploy/DEPLOYMENT.md - Deployment guide
- AGENTS.md - Development guidelines
Contributions are welcome! Please read AGENTS.md for development guidelines.