Phase 6.4 - Modular Architecture: - Add lewooogo-brain adapters for LLM providers - Add lewooogo-data dual memory (Redis + PostgreSQL) - Implement consensus engine for multi-agent decisions - Add incident memory service for historical context Phase 9 - Agent Teams (Claude Agent SDK): - Add base agent class with Claude Sonnet 4 integration - Implement action planner, blast radius, and security agents - Add agent API endpoints and proposal workflow - Integrate ADR-009 OpenClaw Agent Teams architecture DevOps & CI/CD: - Add GitHub Actions CI/CD workflows (ci.yaml, cd.yaml) - Add pre-commit hooks and secrets baseline - Add docker-compose for local development - Update Kubernetes network policies Frontend Improvements: - Add auto-healing error boundary component - Update i18n messages for agent features - Enhance dual-state incident card with execution feedback Documentation: - Add 7 ADRs covering MCP, design system, architecture decisions - Update ARCHITECTURE_MEMORY.md with modular design - Add GLOBAL_RULES.md and SOUL.md for project identity Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.4 KiB
4.4 KiB
Telegram + Agent Teams 整合指南
版本: v1.0 日期: 2026-03-23 狀態: 實驗功能
概述
透過 Claude Code Channels 功能,讓統帥可以從 Telegram 遠端控制 Agent Teams。
前置需求
| 項目 | 需求 |
|---|---|
| Claude Code | >= 2.1.32 (目前: 2.1.81 ✅) |
| Agent Teams | 已啟用 ✅ |
| Telegram Bot | 已建立 (Token 在 .env) |
設定步驟
步驟 1: 確認環境變數
# 確認已加入 ~/.zshrc
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
# 驗證
echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS # 應顯示 1
步驟 2: 安裝 Telegram Plugin
# 啟動 Claude Code
claude
# 在 Claude 對話中執行
/plugin install telegram@claude-plugins-official
步驟 3: 配置 Bot Token
# 在 Claude 對話中執行 (使用 AWOOOI 的 Bot Token)
# 注意:使用 Claude Code 專用 Bot,不要用 OpenClaw Bot
# Claude Code Bot: @wooowooowooobot
/telegram:configure 8075645931:AAH-EGKMo8ZC4QJs-Nc1_0s92xHrGdQvdpg
步驟 4: 以 Channels 模式啟動
# 重新啟動 Claude Code with Telegram Channel
claude --channels plugin:telegram@claude-plugins-official
步驟 5: 配對 Telegram
- 在 Telegram 找到你的 Bot,發送任意訊息
- Bot 會回傳配對碼 (例如:
ABC123) - 在 Claude Code 中執行:
/telegram:access pair ABC123 - 鎖定白名單:
/telegram:access policy allowlist
使用方式
從 Telegram 發指令
# 建立 Agent Team
Create an agent team with 3 teammates:
- Architect: docs/ + memory/
- Frontend: apps/web/
- Backend: apps/api/
# 查詢狀態
show task status
# 審查程式碼
review apps/web/ for i18n violations
遠端批准操作
當 Claude 需要批准時,Telegram 會收到請求:
[Claude Code] 需要批准:
執行 kubectl apply -n awoooi-prod
回覆 "yes XXXXX" 批准,或 "no" 拒絕
回覆:
yes XXXXX
安全機制
| 機制 | 說明 |
|---|---|
| Sender Allowlist | 只有配對的 Telegram 用戶能發指令 |
| Permission Relay | 危險操作需遠端批准 |
| Local Listener | 不暴露公開 URL |
整合 AWOOOI 工作流
┌─────────────────────────────────────────────────┐
│ 統帥 Telegram │
│ ┌─────────────────────────────────────────┐ │
│ │ 「審查今天的 PR」 │ │
│ └─────────────────────────────────────────┘ │
│ ↓ │
│ Claude Code + Agent Teams │
│ ├── @security 資安審查 │
│ ├── @quality 代碼品質 │
│ └── 彙整 → Telegram 通知 │
│ ↓ │
│ ┌─────────────────────────────────────────┐ │
│ │ 「審查完成:2 個 P1 問題,已自動修復」 │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘
Hooks 整合 (任務完成通知)
在 ~/.claude/settings.json 加入:
{
"hooks": {
"TaskCompleted": [
{
"type": "command",
"command": "curl -X POST https://api.telegram.org/bot$OPENCLAW_TG_BOT_TOKEN/sendMessage -d chat_id=$OPENCLAW_TG_CHAT_ID -d text='[Claude Code] 任務完成'"
}
]
}
}
故障排除
| 問題 | 解決 |
|---|---|
| Plugin 安裝失敗 | 確認 Claude Code >= 2.1.32 |
| 配對碼無效 | 重新發送訊息給 Bot |
| 指令無回應 | 確認 --channels 模式啟動 |