Files
openclaw-skill/chapters/05-agents.md
Selig 4c966a3ad2 Initial commit: OpenClaw Skill Collection
6 custom skills (assign-task, dispatch-webhook, daily-briefing,
task-capture, qmd-brain, tts-voice) with technical documentation.
Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
2026-03-13 10:58:30 +08:00

156 lines
5.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 5. Agent Team 架構設計
### 5.1 行動任務 Team
#### 架構圖
```
使用者 (Telegram)
┌──────────────────────────────────────────────────┐
│ OpenClaw (x550v) │
│ Skill 庫assign-task, dispatch-webhook, │
│ project-review, code-review │
│ │ │
│ ┌──────────▼──────────┐ │
│ │ 主 Agent (main) │ │
│ │ Model: Gemini Flash│ │
│ │ 收 Telegram 訊息 │ │
│ └──────┬──────────────┘ │
└────────────────┼─────────────────────────────────┘
│ 分派任務Skill / Webhook / API
┌────────┴────────────────┐
│ │
┌───────▼──────────┐ ┌──────────▼─────────────┐
│ VPS-A │ │ VPS-B │
│ Claude Code │ │ OpenCode / Other LLMs │
│ (Opus/Sonnet) │ │ (Codex / Gemini / …) │
│ │ │ │
│ 角色:專案經理 │ │ 角色:專案經理/執行者 │
│ ・主要專案開發 │ │ ・其他專案開發 │
│ ・Webhook 接收 │ │ ・Webhook 接收 │
│ ・回報結果 │ │ ・回報結果 │
└──────────────────┘ └────────────────────────┘
│ │
└──────────┬──────────────┘
執行結果回傳 Telegram
```
#### 角色說明
| 角色 | 模型 | 位置 | 職責 |
|------|------|------|------|
| 協調者 (Coordinator) | Gemini Flash | OpenClaw x550v | 接收需求,分派任務,彙整回報 |
| 專案經理-A (PM-A) | Claude Code Opus | VPS-A | 主要專案規劃、架構設計、任務分派 |
| 專案經理-B (PM-B) | OpenCode Codex | VPS-B | 其他專案規劃、多 LLM 調度 |
| 開發執行者 | Sonnet / Gemini / 其他 | VPS-A/B | 實際寫程式、測試、文件 |
#### 任務流程
```
1. 使用者在 Telegram 描述任務
2. OpenClaw 主 agent 接收,判斷任務類型
3. 呼叫 assign-task skill
├── 主要專案 → 觸發 VPS-A Webhook (Claude Code)
└── 其他專案 → 觸發 VPS-B Webhook (OpenCode)
4. PM 接收任務,制定計劃,分派給執行者
5. 執行者完成任務,回報 PM
6. PM 整理結果,透過 API 回傳 OpenClaw
7. OpenClaw 回報使用者Telegram
```
#### Webhook 設計
**VPS-A Webhook Endpoint**Claude Code 接收端)
```
POST https://vps-a.example.com/webhook/openclaw
Headers:
X-OpenClaw-Token: <shared-secret>
Content-Type: application/json
Body:
{
"task_id": "task-uuid",
"type": "project_development",
"project": "project-name",
"description": "任務描述",
"priority": "high|normal|low",
"context": { ... },
"callback_url": "https://oclaw.nature.edu.kg/webhook/callback",
"callback_token": "<session-token>"
}
```
**回傳格式**
```json
{
"task_id": "task-uuid",
"status": "completed|failed|in_progress",
"summary": "執行摘要",
"artifacts": ["file1.py", "README.md"],
"next_steps": ["部署測試", "code review"]
}
```
### 5.2 生活安排 Team
#### 架構圖
```
使用者 (Telegram)
┌──────────────────────────────────────────────┐
│ OpenClaw 生活安排 Agent │
│ Model: Gemini Flash / Claude Sonnet │
│ │
│ Skill 庫: │
│ ・calendar-check 行事曆查詢 │
│ ・schedule-plan 行程規劃 │
│ ・daily-briefing 每日摘要 │
│ ・reminder-set 提醒設定 │
│ ・task-capture 快速記錄待辦 │
└──────────────────────────────────────────────┘
├── Google Calendar API
├── 天氣 API
├── cron (OpenClaw 內建排程)
└── Telegram 推送
```
#### 功能說明
| 功能 | 觸發方式 | 說明 |
|------|---------|------|
| 每日簡報 | cron 每早 8:00 | 今日行程 + 天氣 + 待辦摘要 |
| 行程安排 | Telegram 指令 | 新增/查詢 Google Calendar |
| 提醒設定 | Telegram 指令 | 設定 cron job 定時提醒 |
| 快速待辦 | Telegram 指令 | 記錄到 workspace/TODO.md |
| 週報 | cron 每週日晚 | 本週完成事項彙整 |
#### Cron Job 設定範例
```bash
# 每日 8:00 早安簡報
openclaw cron add \
--name "daily-briefing" \
--cron "0 8 * * *" \
--session main \
--system-event "請執行每日簡報:查詢今日行程、天氣,整理待辦事項,用繁體中文發送到 Telegram"
# 每週日 21:00 週報
openclaw cron add \
--name "weekly-review" \
--cron "0 21 * * 0" \
--session main \
--system-event "請整理本週完成的工作、學習重點,以及下週計劃,發送週報到 Telegram"
```