Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b0cf98e422 | |||
| a8fa922095 | |||
| be24de9ced | |||
| fed64cc279 |
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 梁思筑(architect)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:开发 Agent
|
||||
> OpenClaw Agent ID: `architect` | Multica Agent UUID: `40abd41a-62d0-416d-bc44-92c1f758d87a`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'architect' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 40abd41a-62d0-416d-bc44-92c1f758d87a --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=architect)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=40abd41a-62d0-416d-bc44-92c1f758d87a)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO + 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO + 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:100 轮
|
||||
|
||||
- 接近 80%(80 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO + 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 架构设计进度
|
||||
6. ✅ 技术方案评审状态
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 梁思筑(architect)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 文墨言(contentspecialist)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:业务 Agent
|
||||
> OpenClaw Agent ID: `contentspecialist` | Multica Agent UUID: `8321b0bf-7d89-4ece-927a-0780f42ad396`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'contentspecialist' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 8321b0bf-7d89-4ece-927a-0780f42ad396 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=contentspecialist)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=8321b0bf-7d89-4ece-927a-0780f42ad396)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:30 轮
|
||||
|
||||
- 接近 80%(24 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 内容发布计划
|
||||
6. ✅ 素材准备状态
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 文墨言(contentspecialist)专用配置
|
||||
@@ -1,235 +0,0 @@
|
||||
# HEARTBEAT.md - 陆怀瑾(coo)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:高频 Agent
|
||||
> OpenClaw Agent ID: `coo` | Multica Agent UUID: `1c38b437-b54d-4784-bda3-29ce4c8a6722`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'coo' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 1c38b437-b54d-4784-bda3-29ce4c8a6722 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=coo)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=1c38b437-b54d-4784-bda3-29ce4c8a6722)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:10 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 20 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1200:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1200:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 30 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO(自我监控) |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO(自我监控) |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(1h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:50 轮
|
||||
|
||||
- 接近 80%(40 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO(自我监控)
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ **全平台积压巡检**:WorkBoard + Multica 全局待办数
|
||||
6. ✅ 资源负载均衡检查
|
||||
7. ✅ 风险识别与预警
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 陆怀瑾(coo)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 徐聪(costcodev)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:开发 Agent
|
||||
> OpenClaw Agent ID: `costcodev` | Multica Agent UUID: `46bdd4a6-5c64-475a-92ef-36a763602fa1`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'costcodev' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 46bdd4a6-5c64-475a-92ef-36a763602fa1 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=costcodev)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=46bdd4a6-5c64-475a-92ef-36a763602fa1)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO + 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO + 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:100 轮
|
||||
|
||||
- 接近 80%(80 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO + 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 代码开发进度
|
||||
6. ✅ PR/Code Review 状态
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 徐聪(costcodev)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 程伯予(cvexpert)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:业务 Agent
|
||||
> OpenClaw Agent ID: `cvexpert` | Multica Agent UUID: `4a8696fd-6531-40da-8956-ef84d7ea3c43`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'cvexpert' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 4a8696fd-6531-40da-8956-ef84d7ea3c43 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=cvexpert)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=4a8696fd-6531-40da-8956-ef84d7ea3c43)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:30 轮
|
||||
|
||||
- 接近 80%(24 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 求职服务队列
|
||||
6. ✅ 客户反馈跟踪
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 程伯予(cvexpert)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 苏锦绘(designer)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:开发 Agent
|
||||
> OpenClaw Agent ID: `designer` | Multica Agent UUID: `13bd8968-cc2a-4934-90c7-957a2d3c09c2`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'designer' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 13bd8968-cc2a-4934-90c7-957a2d3c09c2 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=designer)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=13bd8968-cc2a-4934-90c7-957a2d3c09c2)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO + 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO + 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:100 轮
|
||||
|
||||
- 接近 80%(80 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO + 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 设计稿进度
|
||||
6. ✅ UI/UX 评审状态
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 苏锦绘(designer)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 苏慎(lawyer)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:业务 Agent
|
||||
> OpenClaw Agent ID: `lawyer` | Multica Agent UUID: `6fb0fbd2-16a6-4566-ba7a-d2c136baec25`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'lawyer' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 6fb0fbd2-16a6-4566-ba7a-d2c136baec25 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=lawyer)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=6fb0fbd2-16a6-4566-ba7a-d2c136baec25)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:30 轮
|
||||
|
||||
- 接近 80%(24 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 合同审查队列
|
||||
6. ✅ 合规检查项
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 苏慎(lawyer)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 顾析策(marketanalysis)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:业务 Agent
|
||||
> OpenClaw Agent ID: `marketanalysis` | Multica Agent UUID: `5ed91729-658f-4654-98f0-3e0313022002`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'marketanalysis' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id 5ed91729-658f-4654-98f0-3e0313022002 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=marketanalysis)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=5ed91729-658f-4654-98f0-3e0313022002)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:30 轮
|
||||
|
||||
- 接近 80%(24 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 市场分析任务
|
||||
6. ✅ 竞品数据更新
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 顾析策(marketanalysis)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 钟帧韵(mediaspecialist)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:业务 Agent
|
||||
> OpenClaw Agent ID: `mediaspecialist` | Multica Agent UUID: `e2b587d4-1d16-447c-8ad9-e2a01358ff0a`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'mediaspecialist' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id e2b587d4-1d16-447c-8ad9-e2a01358ff0a --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=mediaspecialist)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=e2b587d4-1d16-447c-8ad9-e2a01358ff0a)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:30 轮
|
||||
|
||||
- 接近 80%(24 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 视频制作进度
|
||||
6. ✅ 媒体素材准备状态
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 钟帧韵(mediaspecialist)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 严维序(opengineer)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:开发 Agent
|
||||
> OpenClaw Agent ID: `opengineer` | Multica Agent UUID: `d3804433-9e2e-4199-a92b-a153049b3bc9`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'opengineer' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id d3804433-9e2e-4199-a92b-a153049b3bc9 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=opengineer)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=d3804433-9e2e-4199-a92b-a153049b3bc9)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO + 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO + 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:100 轮
|
||||
|
||||
- 接近 80%(80 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO + 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 部署状态检查
|
||||
6. ✅ 服务器/服务健康状况
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 严维序(opengineer)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 沈路明(productmanager)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:开发 Agent
|
||||
> OpenClaw Agent ID: `productmanager` | Multica Agent UUID: `a101fa88-d821-4839-9754-e04580d5fd68`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'productmanager' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id a101fa88-d821-4839-9754-e04580d5fd68 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=productmanager)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=a101fa88-d821-4839-9754-e04580d5fd68)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO + 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO + 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:100 轮
|
||||
|
||||
- 接近 80%(80 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO + 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ PRD 进度检查
|
||||
6. ✅ 需求变更跟踪
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 沈路明(productmanager)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 胡蓉(projectmanager)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:开发 Agent
|
||||
> OpenClaw Agent ID: `projectmanager` | Multica Agent UUID: `d877b8c3-b230-4073-b3f7-80e148cfdb71`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'projectmanager' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id d877b8c3-b230-4073-b3f7-80e148cfdb71 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=projectmanager)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=d877b8c3-b230-4073-b3f7-80e148cfdb71)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO + 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO + 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:100 轮
|
||||
|
||||
- 接近 80%(80 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO + 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 项目进度检查
|
||||
6. ✅ 依赖项完成状态
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 胡蓉(projectmanager)专用配置
|
||||
@@ -1,235 +0,0 @@
|
||||
# HEARTBEAT.md - 刘诗妮(secretary)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:高频 Agent
|
||||
> OpenClaw Agent ID: `secretary` | Multica Agent UUID: `b024fcdc-30ff-420d-b289-498041466e1b`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'secretary' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id b024fcdc-30ff-420d-b289-498041466e1b --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=secretary)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=b024fcdc-30ff-420d-b289-498041466e1b)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:10 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 20 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1200:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1200:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 30 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 COO |
|
||||
| Multica | 添加评论 → status=blocked → 通知 COO |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(1h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:50 轮
|
||||
|
||||
- 接近 80%(40 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 全局任务积压巡检
|
||||
6. ✅ 业务入口检查
|
||||
7. ✅ 各 Agent 状态巡检
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 刘诗妮(secretary)专用配置
|
||||
@@ -1,234 +0,0 @@
|
||||
# HEARTBEAT.md - 陆云帆(taobaospecialist)的心跳配置
|
||||
|
||||
> 模板版本:v1.1 (BIZ-24) | 分类:业务 Agent
|
||||
> OpenClaw Agent ID: `taobaospecialist` | Multica Agent UUID: `e0f62d8f-9568-4f41-8ad4-b73d79a163a7`
|
||||
|
||||
---
|
||||
|
||||
## 📋 全任务源统一监控(每次心跳必检)
|
||||
|
||||
> **核心原则:发现任何来源的任务都必须立即执行,不得遗漏。**
|
||||
|
||||
### 三源检查
|
||||
|
||||
#### 第一优先级:OpenClaw WorkBoard 卡片
|
||||
|
||||
```bash
|
||||
# 检查 WorkBoard 中分配给我的待办卡片
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
my_cards = [c for c in data.get('cards', [])
|
||||
if c.get('agentId') == 'taobaospecialist' and c.get('status') == 'todo']
|
||||
for c in my_cards:
|
||||
print(f'WORKBOARD TODO: {c["id"][:8]} [priority={c.get("priority","?")}] {c["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第二优先级:Multica Issues
|
||||
|
||||
```bash
|
||||
# 检查 Multica 中分配给我的待办 Issue
|
||||
multica issue list --assignee-id e0f62d8f-9568-4f41-8ad4-b73d79a163a7 --status todo --output json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
data = json.load(sys.stdin)
|
||||
for issue in data:
|
||||
print(f'MULTICA TODO: {issue["identifier"]} [{issue.get("priority","?")}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
#### 第三优先级:待办文档
|
||||
|
||||
```bash
|
||||
# 检查工作区待办文档
|
||||
grep -n '\[ \]' TODO.md AGENTS.md 2>/dev/null || echo "无待办文档中未完成项"
|
||||
```
|
||||
|
||||
### 三源合并决策
|
||||
|
||||
```
|
||||
心跳开始
|
||||
↓
|
||||
检查 WorkBoard 待办卡片(agentId=taobaospecialist)
|
||||
↓
|
||||
检查 Multica Issues 待办(assignee=e0f62d8f-9568-4f41-8ad4-b73d79a163a7)
|
||||
↓
|
||||
检查待办文档
|
||||
↓
|
||||
合并去重 → 按优先级排序 → 依次执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 禁止请示规则(最高优先级,自动执行)
|
||||
|
||||
> **核心规则:发现分配给自己的任务 → 立即执行,不得向用户请示!**
|
||||
> 心跳是后台自动行为,用户在大多数时候并不在线,请示会导致任务卡死。
|
||||
|
||||
### 执行流程(严格执行,无需确认)
|
||||
|
||||
1. **三源检查待办** — WorkBoard + Multica + 待办文档
|
||||
2. **立即执行,不得请示** — 发现待办后直接执行
|
||||
3. **检查进行中任务** — 确认认领的任务状态
|
||||
4. **完成任务** — 通过对应平台汇报结果
|
||||
|
||||
### ⚠️ 绝对禁止行为
|
||||
|
||||
- ❌ 不得问"要不要做这个任务"
|
||||
- ❌ 不得等用户确认再执行
|
||||
- ❌ 不得以"需要更多信息"为由拒绝执行
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ 超时检测规则
|
||||
|
||||
### 心跳频率:15 分钟
|
||||
|
||||
每次心跳跨平台执行以下检测:
|
||||
|
||||
1. 检查 WorkBoard 进行中任务的更新时间
|
||||
2. 检查 Multica 进行中 issues 的更新时间
|
||||
3. 超过 30 分钟无进展 → 标记为"疑似超时"
|
||||
4. 疑似超时 → 追加一次完整心跳尝试推进
|
||||
5. 确认超时 → 进入自动恢复流程
|
||||
|
||||
### 跨平台超时检测脚本
|
||||
|
||||
```bash
|
||||
# WorkBoard 超时检测
|
||||
echo "=== WorkBoard 超时检测 ==="
|
||||
openclaw workboard list --json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
inprogress = [c for c in data.get('cards', []) if c.get('status') == 'in_progress']
|
||||
now = time.time()
|
||||
for c in inprogress:
|
||||
updated = c.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ WB TIMEOUT: {c["id"][:8]} [{c.get("agentId","?")}] {c["title"]}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "=== Multica 超时检测 ==="
|
||||
multica issue list --status in_progress --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, time
|
||||
data = json.load(sys.stdin)
|
||||
now = time.time()
|
||||
for issue in data:
|
||||
updated = issue.get('updated_at', '')
|
||||
if updated:
|
||||
age = now - time.mktime(time.strptime(updated[:19], '%Y-%m-%dT%H:%M:%S'))
|
||||
if age > 1800:
|
||||
print(f'⏰ MUL TIMEOUT: {issue["identifier"]} [{issue.get("assignee_id","?")[:12]}] {issue["title"]}')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 自动恢复规则
|
||||
|
||||
### 触发条件
|
||||
|
||||
- 超 45 分钟无进展 → 自动重新调度
|
||||
|
||||
### 恢复操作(按平台)
|
||||
|
||||
| 平台 | 操作 |
|
||||
|------|------|
|
||||
| WorkBoard | 添加评论 → release claim → 通知 创建者 |
|
||||
| Multica | 添加评论 → status=blocked → 通知 创建者 |
|
||||
| 待办文档 | 标注超时 → 转为卡片(可选) |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 依赖检查前置规则
|
||||
|
||||
### 强制检查流程
|
||||
|
||||
1. 认领任务前,读取依赖字段(depends_on / parent_issue_id)
|
||||
2. 逐一检查每个依赖任务的状态
|
||||
3. 依赖未满足 → 不认领(保持 todo)
|
||||
4. 超过等待阈值(2h)→ 通知依赖任务执行者
|
||||
|
||||
### 双平台依赖检查
|
||||
|
||||
```bash
|
||||
# WorkBoard 依赖检查
|
||||
openclaw workboard read <card-id> --json 2>/dev/null | python3 -c "
|
||||
import sys, json
|
||||
card = json.load(sys.stdin)
|
||||
deps = card.get('dependsOn', [])
|
||||
if deps:
|
||||
for dep in deps:
|
||||
if dep.get('status') != 'done':
|
||||
print(f'⛔ WB 依赖未满足: {dep["id"]} → status={dep.get("status","?")}')
|
||||
sys.exit(1)
|
||||
print('✅ 所有 WB 依赖已满足')
|
||||
else:
|
||||
print('✅ 无 WB 依赖,可以启动')
|
||||
"
|
||||
|
||||
# Multica 依赖检查
|
||||
multica issue get <issue-id> --output json 2>/dev/null | python3 -c "
|
||||
import sys, json, subprocess
|
||||
issue = json.load(sys.stdin)
|
||||
parent_id = issue.get('parent_issue_id')
|
||||
if parent_id:
|
||||
result = subprocess.run(['multica', 'issue', 'get', parent_id, '--output', 'json'],
|
||||
capture_output=True, text=True)
|
||||
parent = json.loads(result.stdout)
|
||||
if parent.get('status') != 'done':
|
||||
print(f'⛔ MUL 父 Issue {parent["identifier"]} 未完成')
|
||||
sys.exit(1)
|
||||
print(f'✅ 父 Issue {parent["identifier"]} 已完成')
|
||||
else:
|
||||
print('✅ 无父 Issue 依赖,可以启动')
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛑 最大轮次限制
|
||||
|
||||
### 限制值:30 轮
|
||||
|
||||
- 接近 80%(24 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 创建者
|
||||
|
||||
### 跨平台轮次跟踪
|
||||
|
||||
- **WorkBoard**:通过 workboard_heartbeat 的 note 记录轮次
|
||||
- **Multica**:通过 issue comment 记录轮次进度
|
||||
- **待办文档**:在工作日志中记录
|
||||
|
||||
---
|
||||
|
||||
## 🫀 心跳执行清单
|
||||
|
||||
### 每次心跳必须检查
|
||||
|
||||
1. ✅ **全任务源检查**:WorkBoard + Multica + 待办文档
|
||||
2. ✅ 进行中任务超时检测(跨平台)
|
||||
3. ✅ 依赖检查
|
||||
4. ✅ 轮次计数器更新
|
||||
5. ✅ 淘宝店铺运营指标
|
||||
6. ✅ 竞品动态跟踪
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 全局关键规则
|
||||
|
||||
1. **心跳不打断对话** — 用户正在对话时延后执行
|
||||
2. **非紧急事项延后汇报** — 等下一轮心跳或用户询问
|
||||
3. **发现任务立即执行,不得请示**(任何来源)
|
||||
4. **超时任务按自动恢复流程处理**(跨平台)
|
||||
5. **依赖未满足不启动**
|
||||
6. **达到轮次上限自动暂停**
|
||||
7. **避免任务遗漏** — 三源必须全部检查,缺一不可
|
||||
|
||||
|
||||
---
|
||||
|
||||
> 基于 BIZ-24 v1.1 模板生成 | 陆云帆(taobaospecialist)专用配置
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
sequenceDiagram
|
||||
participant OC as OpenClaw
|
||||
participant GW as API Gateway
|
||||
participant LB as 负载均衡器
|
||||
participant QM as 队列管理器
|
||||
participant RL as Rate Limiter
|
||||
participant P as Provider
|
||||
participant CD as Cooldown Detector
|
||||
participant ST as 统计引擎
|
||||
|
||||
OC->>GW: POST /v1/chat/completions
|
||||
GW->>LB: 路由到目标池
|
||||
|
||||
Note over LB: Weighted RR 5-10s刷新<br/>weight=(max_rpm-current_rpm)/max_rpm
|
||||
|
||||
LB->>RL: BEGIN IMMEDIATE 事务 检查 RPM + 预占
|
||||
|
||||
alt RPM 不足
|
||||
RL->>QM: 入队等待 超时30s
|
||||
QM-->>RL: 令牌可用
|
||||
end
|
||||
|
||||
RL-->>LB: 允许转发
|
||||
|
||||
LB->>P: 转发请求
|
||||
P-->>LB: 响应
|
||||
|
||||
alt 200 OK
|
||||
LB->>ST: INSERT ON CONFLICT 记录 usage_logs
|
||||
LB-->>GW: 正常响应
|
||||
else 429 Too Many Requests
|
||||
LB->>CD: 上报429
|
||||
CD->>P: 移入冷却池 cooldown_until=now+30s×2^n
|
||||
|
||||
LB->>LB: 重新选择 Provider B
|
||||
|
||||
alt Provider B 正常
|
||||
LB->>P: 转发到 Provider B
|
||||
P-->>LB: 200 OK
|
||||
end
|
||||
|
||||
alt 主池全部冷却
|
||||
Note over LB: 降级 Fallback 池<br/>检查即将恢复的Provider<br/>剩余<10s 等待
|
||||
|
||||
alt Fallback 可用
|
||||
LB->>P: 转发 Fallback Provider
|
||||
P-->>LB: 200 OK +降级标记
|
||||
else Fallback 也全冷却
|
||||
LB->>P: 紧急通道 1 Provider 10% RPM
|
||||
alt 紧急通道成功
|
||||
P-->>LB: 200 OK
|
||||
else
|
||||
LB-->>OC: 503 Service Unavailable
|
||||
OC->>OC: OpenClaw 自身 fallback
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 152 KiB |
@@ -1,71 +0,0 @@
|
||||
erDiagram
|
||||
providers ||--o{ provider_usage_logs : has
|
||||
providers ||--o{ cooldown_events : triggers
|
||||
providers ||--o| provider_health : monitors
|
||||
|
||||
providers {
|
||||
string id PK
|
||||
string name
|
||||
string api_key
|
||||
string endpoint_url
|
||||
string model_prefix
|
||||
string pool
|
||||
string status
|
||||
string source
|
||||
int rpm_limit
|
||||
int tpm_limit
|
||||
float weight
|
||||
float cost_per_1k
|
||||
string cooldown_until
|
||||
string metadata
|
||||
}
|
||||
|
||||
provider_usage_logs {
|
||||
string id PK
|
||||
string provider_id FK
|
||||
string model
|
||||
int prompt_tokens
|
||||
int completion_tokens
|
||||
int total_tokens
|
||||
float cost
|
||||
int request_count
|
||||
int error_count
|
||||
int avg_latency_ms
|
||||
string hour_bucket
|
||||
}
|
||||
|
||||
cooldown_events {
|
||||
string id PK
|
||||
string provider_id FK
|
||||
int consecutive_count
|
||||
int cooldown_seconds
|
||||
string response_summary
|
||||
string started_at
|
||||
string ended_at
|
||||
}
|
||||
|
||||
provider_health {
|
||||
string provider_id PK
|
||||
string state
|
||||
int last_latency_ms
|
||||
int last_status_code
|
||||
float success_rate_5m
|
||||
int consecutive_failures
|
||||
}
|
||||
|
||||
daily_stats {
|
||||
string id PK
|
||||
string date
|
||||
string pool
|
||||
int total_requests
|
||||
int total_errors
|
||||
int total_tokens
|
||||
float total_cost
|
||||
int unique_providers
|
||||
}
|
||||
|
||||
system_config {
|
||||
string key PK
|
||||
string value
|
||||
string description
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB |
@@ -1,121 +0,0 @@
|
||||
# NVIDIA Provider Keys Reference for Sidecar V2
|
||||
# =============================================
|
||||
# ⚠️ SECURITY: This file contains sensitive API key material.
|
||||
# In Sidecar V2 production deployment, API keys are stored as
|
||||
# AES-256-GCM ciphertext in SQLite (providers.api_key column).
|
||||
# The plaintext keys below are for V2 initial provisioning only.
|
||||
#
|
||||
# Usage: Import into Sidecar V2 via WebUI Admin or POST /api/v2/providers
|
||||
# After import, this file should be stored in a secure location
|
||||
# (Bitwarden / password manager) and NOT kept in plaintext on disk.
|
||||
#
|
||||
# Created: 2026-06-25 | By: 梁思筑 (architect)
|
||||
# Total providers: 11 | Pool: main | RPM each: 40 | Total RPM capacity: 440
|
||||
|
||||
providers:
|
||||
- account: bizwings
|
||||
email: vincent@bizwingsinc.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: "主账号"
|
||||
|
||||
- account: "98053"
|
||||
email: 98053@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: liuweicheng84
|
||||
email: liuweicheng84@gmail.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: vx18088980513
|
||||
email: vx18088980513@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: "64391942"
|
||||
email: 64391942@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: cgtest1
|
||||
email: cgtest1@bizwingsinc.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: "测试账号1"
|
||||
|
||||
- account: cgtest2
|
||||
email: cgtest2@bizwingsinc.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: "测试账号2"
|
||||
|
||||
- account: "15876517651"
|
||||
email: 1248106918@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: "19584586741"
|
||||
email: 414133763@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: "18874954146"
|
||||
email: 350894172@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
- account: "2405483110"
|
||||
email: 2405483110@qq.com
|
||||
api_key: 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
|
||||
endpoint_url: https://integrate.api.nvidia.com/v1
|
||||
model_prefix: "nvidia/"
|
||||
pool: main
|
||||
rpm_limit: 40
|
||||
notes: ""
|
||||
|
||||
# Aggregated stats
|
||||
summary:
|
||||
total_providers: 11
|
||||
total_rpm_capacity: 440
|
||||
pools:
|
||||
main: 11
|
||||
fallback: 0
|
||||
@@ -1,58 +0,0 @@
|
||||
flowchart TB
|
||||
subgraph OC["OpenClaw Gateway"]
|
||||
OC_SCHED["OpenClaw 调度器"]
|
||||
OC_FB["OpenClaw Fallback<br/>传统配置链路"]
|
||||
end
|
||||
|
||||
subgraph SIDECAR["Sidecar V2 systemd/Docker"]
|
||||
direction TB
|
||||
|
||||
subgraph ENTRY["入口层"]
|
||||
GW["API Gateway :9190<br/>FastAPI + 路由匹配"]
|
||||
end
|
||||
|
||||
subgraph CORE["核心调度层"]
|
||||
LB["负载均衡器<br/>Weighted RR 5-10s刷新"]
|
||||
QM["队列管理器<br/>FIFO + 优先级<br/>容量500 + 溢出策略"]
|
||||
end
|
||||
|
||||
subgraph POOLS["Provider 池层"]
|
||||
MP["主池 Main Pool"]
|
||||
FP["Fallback 池"]
|
||||
CP["冷却池<br/>Cooldown Pool"]
|
||||
end
|
||||
|
||||
subgraph FLOW["流控层"]
|
||||
RL["Rate Limiter<br/>Per-Provider Token Bucket"]
|
||||
CD["Cooldown Detector<br/>429检测+指数退避<br/>+紧急通道10%RPM"]
|
||||
end
|
||||
|
||||
subgraph STATS["存储与统计层"]
|
||||
MT["Metrics :9191<br/>Prometheus"]
|
||||
ST["统计引擎<br/>Token/费用/调用量"]
|
||||
DB[("SQLite WAL<br/>sidecar_v2.db<br/>+ cron备份")]
|
||||
end
|
||||
|
||||
subgraph WEBUI["WebUI 层 :9190"]
|
||||
UI["Dashboard<br/>SSE 实时推送"]
|
||||
AP["Admin API<br/>Provider CRUD<br/>Bearer Token 鉴权"]
|
||||
end
|
||||
end
|
||||
|
||||
OC_SCHED --> GW
|
||||
GW --> LB
|
||||
LB --> QM
|
||||
QM --> RL
|
||||
RL --> MP
|
||||
RL --> FP
|
||||
MP -.->|"429 触发冷却"| CP
|
||||
MP -->|"全部冷却"| FP
|
||||
FP -->|"全部冷却"| OC_FB
|
||||
CP -.->|"冷却结束恢复"| MP
|
||||
RL --> CD
|
||||
CD -.->|"紧急通道 10% RPM"| MP
|
||||
LB --> MT
|
||||
MT --> ST
|
||||
ST --> DB
|
||||
DB --> UI
|
||||
AP --> DB
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 143 KiB |
@@ -12,10 +12,8 @@
|
||||
| [产品/](产品/) | PRD、需求分析 | 沈路明 (productmanager) | — |
|
||||
| [技术/](技术/) | 开发规范、代码审查 | 徐聪 (costcodev) | — |
|
||||
| [设计/](设计/) | UI设计、品牌规范 | 苏绘锦 (designer) | — |
|
||||
| [运维/](运维/) | 部署流程、故障排查、服务器运维 | 严维序 (opengineer) | 3 |
|
||||
| [运营/](运营/) | 活动策划、数据分析 | 陆怀瑾 (coo) | — |
|
||||
| [行政/](行政/) | 合同、报销流程 | 刘诗妮 (secretary) | — |
|
||||
| [规范/](规范/) | 运维标准、安全基线、合规要求 | 严维序 (opengineer) | — |
|
||||
|
||||
## 知识条目格式
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
|
||||
## 知识范围
|
||||
|
||||
涵盖开发规范、代码审查、架构设计、技术选型等技术团队核心知识。
|
||||
|
||||
> ⚠️ 部署运维知识已迁移至 [运维/](../运维/) 领域。
|
||||
涵盖开发规范、代码审查、架构设计、部署运维、技术选型等技术团队知识。
|
||||
|
||||
## 条目清单
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# 规范领域知识
|
||||
|
||||
**责任人**:严维序(opengineer)
|
||||
**审核人**:陆怀瑾(coo)
|
||||
|
||||
## 知识范围
|
||||
|
||||
涵盖运维规范、安全标准、合规要求等规范类知识条目,支撑团队标准化运作。
|
||||
|
||||
## 条目清单
|
||||
|
||||
| 文件名 | 说明 | 状态 |
|
||||
|--------|------|------|
|
||||
| [服务器运维标准_v1.0.md](../运维/服务器运维标准_v1.0.md) | 服务器巡检、监控、备份运维标准 | 见运维域 |
|
||||
|
||||
## 待建设
|
||||
|
||||
- 数据库运维标准
|
||||
- 安全审计基线
|
||||
- 数据合规处理流程
|
||||
|
||||
---
|
||||
|
||||
> 维护者:严维序(opengineer)
|
||||
> 最后更新:2026-06-24
|
||||
@@ -1,27 +0,0 @@
|
||||
# 运维领域知识
|
||||
|
||||
**责任人**:严维序(opengineer)
|
||||
**审核人**:陆怀瑾(coo)
|
||||
|
||||
## 知识范围
|
||||
|
||||
涵盖服务器运维、部署流程、故障排查、监控配置、安全保障等运维团队核心知识。
|
||||
|
||||
## 条目清单
|
||||
|
||||
| 文件名 | 说明 | 状态 |
|
||||
|--------|------|------|
|
||||
| [部署流程_v1.0.md](部署流程_v1.0.md) | 服务部署 SOP 与变更管理流程 | ✅ |
|
||||
| [故障排查手册_v1.0.md](故障排查手册_v1.0.md) | 常见故障定位与处置方案 | ✅ |
|
||||
| [服务器运维标准_v1.0.md](服务器运维标准_v1.0.md) | 服务器巡检、监控、备份运维标准 | 🆕 |
|
||||
|
||||
## 待建设
|
||||
|
||||
- 数据库运维指南
|
||||
- 安全加固检查清单
|
||||
- 灾备与应急恢复预案
|
||||
|
||||
---
|
||||
|
||||
> 维护者:严维序(opengineer)
|
||||
> 最后更新:2026-06-24
|
||||
@@ -1,274 +0,0 @@
|
||||
# 故障排查手册
|
||||
|
||||
## 元数据
|
||||
|
||||
| 属性 | 值 |
|
||||
|------|-----|
|
||||
| **领域** | 运维 |
|
||||
| **责任人** | 严维序(opengineer) |
|
||||
| **版本** | v1.0 |
|
||||
| **创建日期** | 2026-06-24 |
|
||||
| **最后更新** | 2026-06-24 |
|
||||
| **标签** | 故障排查, 运维, 排障 |
|
||||
|
||||
## 概述
|
||||
|
||||
本手册汇总 BizWings 环境中常见的系统与服务故障定位方法和修复方案。覆盖 SSH 连接、Nginx、数据库、磁盘、Docker 等核心场景。
|
||||
|
||||
---
|
||||
|
||||
## 一、SSH 连接故障
|
||||
|
||||
### 1.1 连接超时
|
||||
|
||||
```bash
|
||||
# 诊断步骤
|
||||
ssh -vvv root@<ip> -p <port> # 查看详细连接日志
|
||||
ping <ip> # 检查网络连通性
|
||||
nmap <ip> -p <port> # 检查端口状态
|
||||
```
|
||||
|
||||
**常见原因**:
|
||||
- 目标服务器防火墙未开放端口
|
||||
- 源 IP 未加入白名单
|
||||
- 服务器负载过高,sshd 响应慢
|
||||
|
||||
**解决方案**:
|
||||
1. 检查服务器防火墙:`iptables -L -n` 或 `ufw status`
|
||||
2. 检查 sshd 是否运行:`systemctl status sshd`
|
||||
3. 检查负载:`top -n1 | head -5`
|
||||
|
||||
### 1.2 认证失败
|
||||
|
||||
```bash
|
||||
# 诊断步骤
|
||||
ssh -p <port> root@<ip> # 尝试密码登录
|
||||
# Permission denied (publickey,password) 提示
|
||||
```
|
||||
|
||||
**常见原因**:
|
||||
- 密码错误(检查 TOOLS.md 中记录)
|
||||
- SSH 密钥认证配置错误
|
||||
- `/etc/ssh/sshd_config` 中 `PasswordAuthentication no`
|
||||
|
||||
**解决方案**:
|
||||
1. 确认密码与 TOOLS.md 一致
|
||||
2. 检查 `sshd_config`:`grep PasswordAuthentication /etc/ssh/sshd_config`
|
||||
3. 临时允许密码登录:`sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && systemctl reload sshd`
|
||||
|
||||
---
|
||||
|
||||
## 二、Nginx 服务异常
|
||||
|
||||
### 2.1 Nginx 启动失败 / 卡在 activating
|
||||
|
||||
```bash
|
||||
# 诊断步骤
|
||||
systemctl status nginx # 查看状态
|
||||
journalctl -u nginx --no-pager -n 50 # 查看日志
|
||||
nginx -t # 配置语法检查
|
||||
```
|
||||
|
||||
**根因(经验)**:进程残留导致端口占用
|
||||
|
||||
```bash
|
||||
# 修复
|
||||
pkill -9 nginx # 强制清理残留进程
|
||||
sleep 2
|
||||
systemctl start nginx # 重新启动
|
||||
systemctl status nginx # 确认状态
|
||||
```
|
||||
|
||||
### 2.2 502 Bad Gateway
|
||||
|
||||
```bash
|
||||
# 诊断步骤
|
||||
curl -I http://localhost:<upstream-port> # 检查上游服务
|
||||
ss -tlnp | grep <upstream-port> # 检查端口监听
|
||||
systemctl status <upstream-service> # 检查上游进程
|
||||
```
|
||||
|
||||
**常见原因**:
|
||||
- 上游服务未启动或崩溃
|
||||
- 连接池耗尽
|
||||
|
||||
**解决方案**:
|
||||
1. 重启上游服务:`systemctl restart <service>`
|
||||
2. 检查 `upstream` 配置是否正确
|
||||
|
||||
### 2.3 日志轮转失败
|
||||
|
||||
```bash
|
||||
# 诊断步骤
|
||||
cat /var/log/nginx/error.log | head # 查看是否有日志无法写入
|
||||
ls -la /var/log/nginx/ # 查看日志文件
|
||||
/usr/sbin/logrotate -d /etc/logrotate.d/nginx # 测试 logrotate
|
||||
```
|
||||
|
||||
**修复方案**:
|
||||
```bash
|
||||
# 修改 /etc/logrotate.d/nginx 中的 postrotate 脚本
|
||||
# 将 invoke-rc.d nginx rotate 改为:
|
||||
postrotate
|
||||
systemctl reload nginx
|
||||
endscript
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 三、数据库连接故障
|
||||
|
||||
### 3.1 MySQL 连接失败
|
||||
|
||||
```bash
|
||||
# 诊断步骤
|
||||
mysql -h <host> -P <port> -u root -p # 测试连接
|
||||
telnet <host> <port> # 检查端口
|
||||
systemctl status mysql # 检查服务
|
||||
```
|
||||
|
||||
**常见原因**:
|
||||
- 服务未运行
|
||||
- 防火墙未放行 3306 端口
|
||||
- 用户权限 / host 限制
|
||||
- 连接数超限
|
||||
|
||||
**解决方案**:
|
||||
```bash
|
||||
# 检查连接数
|
||||
mysql -e "SHOW VARIABLES LIKE 'max_connections';"
|
||||
mysql -e "SHOW PROCESSLIST;"
|
||||
|
||||
# 检查用户权限
|
||||
mysql -e "SELECT user, host FROM mysql.user WHERE user='root';"
|
||||
```
|
||||
|
||||
### 3.2 MySQL 空间不足
|
||||
|
||||
```bash
|
||||
# 诊断
|
||||
df -h # 磁盘空间
|
||||
mysql -e "SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024,2) AS size_mb FROM information_schema.tables GROUP BY table_schema ORDER BY size_mb DESC;"
|
||||
```
|
||||
|
||||
**解决方案**:
|
||||
- 清理过期 binlog:`PURGE BINARY LOGS BEFORE DATE_SUB(NOW(), INTERVAL 7 DAY);`
|
||||
- 清理临时表
|
||||
- 扩展磁盘
|
||||
|
||||
---
|
||||
|
||||
## 四、磁盘空间告警
|
||||
|
||||
### 4.1 诊断
|
||||
|
||||
```bash
|
||||
df -h # 查看各分区使用率
|
||||
du -sh /* 2>/dev/null | sort -rh | head -10 # 找到大文件目录
|
||||
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null # 大文件定位
|
||||
```
|
||||
|
||||
### 4.2 清理方案
|
||||
|
||||
```bash
|
||||
# Docker 日志和镜像清理
|
||||
docker system prune -af --volumes # 清理未使用的 Docker 资源
|
||||
|
||||
# 系统日志轮转
|
||||
journalctl --vacuum-time=7d # 清理 7 天前的 journal 日志
|
||||
|
||||
# 应用日志归档
|
||||
find /var/log -name "*.log" -mtime +30 -exec gzip {} \; # 压缩旧日志
|
||||
find /var/log -name "*.gz" -mtime +90 -delete # 删除 90 天前的压缩日志
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 五、Docker 容器异常
|
||||
|
||||
### 5.1 容器停止
|
||||
|
||||
```bash
|
||||
docker ps -a | grep <container> # 查看容器状态
|
||||
docker logs <container> --tail 50 # 查看最近日志
|
||||
```
|
||||
|
||||
**修复**:
|
||||
```bash
|
||||
docker start <container> # 手动启动
|
||||
docker compose -f <path> up -d # 使用 Compose 重启
|
||||
```
|
||||
|
||||
### 5.2 Docker API 无响应
|
||||
|
||||
```bash
|
||||
systemctl status docker # 检查 Docker 服务
|
||||
journalctl -u docker --no-pager -n 50 # 查看 Docker 日志
|
||||
```
|
||||
|
||||
**修复**:
|
||||
```bash
|
||||
systemctl restart docker # 重启 Docker 守护进程
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 六、系统进程故障
|
||||
|
||||
### 6.1 端口被占用
|
||||
|
||||
```bash
|
||||
ss -tlnp | grep <port> # 查看占用端口的进程
|
||||
fuser -k <port>/tcp # 强制释放端口
|
||||
```
|
||||
|
||||
### 6.2 systemd 服务异常
|
||||
|
||||
```bash
|
||||
systemctl status <service> # 检查状态
|
||||
journalctl -u <service> --no-pager -n 100 # 查看服务日志
|
||||
|
||||
# 常用修复
|
||||
systemctl daemon-reload # 重载 unit 文件
|
||||
systemctl restart <service> # 重启
|
||||
systemctl enable <service> # 设置开机自启
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 七、日志分析工具
|
||||
|
||||
### 7.1 常用命令
|
||||
|
||||
```bash
|
||||
# 实时日志跟踪
|
||||
tail -f /var/log/<app>/access.log
|
||||
|
||||
# 错误过滤
|
||||
grep -i "error\|exception\|failed" /var/log/<app>/app.log | tail -50
|
||||
|
||||
# 时间范围过滤
|
||||
awk '/2026-06-24 10:00/,/2026-06-24 11:00/' /var/log/<app>/app.log
|
||||
```
|
||||
|
||||
### 7.2 关键检查点
|
||||
|
||||
| 故障表现 | 优先检查 | 常见根因 |
|
||||
|----------|----------|----------|
|
||||
| 服务无响应 | systemctl status | 进程 OOM / 崩溃 |
|
||||
| API 返回错误 | 应用日志 + Nginx 日志 | 代码 bug / 上游依赖异常 |
|
||||
| 高延迟 | top + ss + 应用日志 | 资源争抢 / 死锁 |
|
||||
| 数据库异常 | MySQL error log | 慢查询 / 连接数超限 |
|
||||
|
||||
---
|
||||
|
||||
## 相关条目
|
||||
|
||||
- [部署流程_v1.0.md](部署流程_v1.0.md)
|
||||
- [服务器运维标准_v1.0.md](服务器运维标准_v1.0.md)
|
||||
|
||||
## 变更记录
|
||||
|
||||
| 日期 | 版本 | 变更说明 | 变更人 |
|
||||
|------|------|----------|--------|
|
||||
| 2026-06-24 | v1.0 | 初始创建 | 严维序 |
|
||||
@@ -1,177 +0,0 @@
|
||||
# 服务器运维标准
|
||||
|
||||
## 元数据
|
||||
|
||||
| 属性 | 值 |
|
||||
|------|-----|
|
||||
| **领域** | 运维 |
|
||||
| **责任人** | 严维序(opengineer) |
|
||||
| **版本** | v1.0 |
|
||||
| **创建日期** | 2026-06-24 |
|
||||
| **最后更新** | 2026-06-24 |
|
||||
| **标签** | 运维, 监控, 巡检, 备份 |
|
||||
|
||||
## 概述
|
||||
|
||||
本文档定义 BizWings 团队所有服务器的日常运维标准,包括巡检频率、监控指标、备份策略和安全基线。适用于所有生产环境服务器(阿里云 / 家庭内网 / HP 服务器)。
|
||||
|
||||
---
|
||||
|
||||
## 一、服务器巡检标准
|
||||
|
||||
### 1.1 巡检频率
|
||||
|
||||
| 类型 | 频率 | 执行方式 |
|
||||
|------|------|----------|
|
||||
| 心跳自检 | 每 10 分钟 | openclaw 心跳自动巡检 |
|
||||
| 深度巡检 | 每日一次 | 手动执行 `python3 $SCRIPTS/heartbeat_helper.py opengineer` |
|
||||
| 全量巡检 | 每周一次 | 逐个检查全部服务器 |
|
||||
|
||||
### 1.2 巡检清单
|
||||
|
||||
#### 资源负载
|
||||
```bash
|
||||
# 磁盘使用率(警告 > 80%,严重 > 90%)
|
||||
df -h | grep -v tmpfs
|
||||
|
||||
# CPU 负载
|
||||
uptime
|
||||
|
||||
# 内存使用
|
||||
free -h
|
||||
|
||||
# 网络 IO
|
||||
sar -n DEV 1 3
|
||||
```
|
||||
|
||||
#### 服务状态
|
||||
```bash
|
||||
# 核心服务清单(按实际部署确认)
|
||||
systemctl status nginx mysql docker sshd
|
||||
|
||||
# Docker 容器健康
|
||||
docker ps | grep -c "Up"
|
||||
```
|
||||
|
||||
#### 日志异常
|
||||
```bash
|
||||
# 最近 10 分钟的错误日志
|
||||
journalctl --since "10 min ago" -p err --no-pager | tail -20
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 二、监控指标定义
|
||||
|
||||
### 2.1 告警阈值
|
||||
|
||||
| 指标 | 警告 (WARN) | 严重 (CRIT) | 处理 |
|
||||
|------|-------------|-------------|------|
|
||||
| 磁盘使用率 | > 80% | > 90% | 清理日志 / 扩容 |
|
||||
| CPU 负载 (1min) | > 4.0 | > 8.0 | 检查异常进程 |
|
||||
| 内存使用率 | > 85% | > 95% | 检查 OOM 风险 |
|
||||
| 根分区 inode | > 80% | > 90% | 清理小文件 |
|
||||
| 服务进程 | 停止 | — | 重启服务 |
|
||||
| 端口监听 | 消失 | — | 检查服务状态 |
|
||||
| Docker 容器 | 非 Up | — | docker start / compose up |
|
||||
|
||||
### 2.2 日志监控
|
||||
|
||||
- 系统日志:`journalctl -p err` 重点关注
|
||||
- 应用日志:`error`, `exception`, `failed`, `timeout` 关键词监控
|
||||
- Nginx 日志:5xx 错误率 > 1% 时触发调查
|
||||
|
||||
---
|
||||
|
||||
## 三、备份策略
|
||||
|
||||
### 3.1 数据库备份
|
||||
|
||||
```bash
|
||||
# MySQL 全量备份(建议每日凌晨执行)
|
||||
mysqldump --all-databases --single-transaction --quick | gzip > /backup/db/all-$(date +%Y%m%d).sql.gz
|
||||
```
|
||||
|
||||
### 3.2 配置备份
|
||||
- 服务器配置文件:`/backup/conf/<server>/` 目录
|
||||
- 每次变更前执行:`cp <config> <config>.$(date +%Y%m%d-%H%M%S).bak`
|
||||
|
||||
### 3.3 Docker 数据备份
|
||||
```bash
|
||||
# 思源笔记备份(已配置每日 3:00)
|
||||
tar czf /backup/siyuan/siyuan-data-$(date +%Y%m%d).tar.gz -C <data-dir> .
|
||||
```
|
||||
|
||||
### 3.4 备份保留策略
|
||||
|
||||
| 类型 | 保留期限 |
|
||||
|------|----------|
|
||||
| 数据库全量备份 | 30 天 |
|
||||
| 配置备份 | 90 天 |
|
||||
| Docker 数据 | 7 天 |
|
||||
| 日志归档 | 90 天 |
|
||||
|
||||
---
|
||||
|
||||
## 四、变更管理标准
|
||||
|
||||
### 4.1 变更准入
|
||||
|
||||
- ✅ 每次变更前必须备份原始文件
|
||||
- ✅ 高危操作(防火墙、内核、数据库)必须保留回滚方案
|
||||
- ✅ 变更前评估影响范围
|
||||
- ✅ 变更后验证服务状态
|
||||
- ❌ 禁止在无备份的情况下直接修改生产配置
|
||||
- ❌ 禁止在高峰时段执行非紧急变更
|
||||
|
||||
### 4.2 变更分级
|
||||
|
||||
| 级别 | 示例 | 要求 |
|
||||
|------|------|------|
|
||||
| 低风险 | 普通应用更新 | 备份 → 部署 → 验证 |
|
||||
| 中风险 | 配置修改 | 备份 → 预演 → 部署 → 验证 |
|
||||
| 高风险 | 内核 / 防火墙 / 数据库 | 备份 → 预演 → 通知 → 部署 → 验证 → 监控 |
|
||||
|
||||
---
|
||||
|
||||
## 五、安全基线
|
||||
|
||||
### 5.1 基本要求
|
||||
|
||||
- [ ] SSH 禁止 root 密码登录(高风险服务器)
|
||||
- [ ] 防火墙最小权限原则
|
||||
- [ ] 非必要端口不对外开放
|
||||
- [ ] 定期更新系统安全补丁
|
||||
- [ ] 日志审计开启
|
||||
|
||||
### 5.2 密码管理
|
||||
|
||||
- 服务器密码统一记录在 TOOLS.md
|
||||
- 数据库密码统一管理
|
||||
- 禁止在代码中硬编码密码
|
||||
|
||||
---
|
||||
|
||||
## 六、服务器清单与分类
|
||||
|
||||
| 环境 | 服务器数 | 用途 | 巡检频率 |
|
||||
|------|----------|------|----------|
|
||||
| 阿里云生产 | 3 | 应用服务、数据库 | 每次心跳 |
|
||||
| 家庭内网生产 | 4 | 应用、数据库、PVE | 每次心跳 |
|
||||
| HP 测试 | 3 | 测试、NAS | 每日 |
|
||||
| 树莓派 | 1 | 辅助设备 | 每日 |
|
||||
|
||||
详细清单见 TOOLS.md「SSH/WinRM 服务器清单」
|
||||
|
||||
---
|
||||
|
||||
## 相关条目
|
||||
|
||||
- [部署流程_v1.0.md](部署流程_v1.0.md)
|
||||
- [故障排查手册_v1.0.md](故障排查手册_v1.0.md)
|
||||
|
||||
## 变更记录
|
||||
|
||||
| 日期 | 版本 | 变更说明 | 变更人 |
|
||||
|------|------|----------|--------|
|
||||
| 2026-06-24 | v1.0 | 初始创建 | 严维序 |
|
||||
@@ -1,202 +0,0 @@
|
||||
# 服务部署流程 SOP
|
||||
|
||||
## 元数据
|
||||
|
||||
| 属性 | 值 |
|
||||
|------|-----|
|
||||
| **领域** | 运维 |
|
||||
| **责任人** | 严维序(opengineer) |
|
||||
| **版本** | v1.0 |
|
||||
| **创建日期** | 2026-06-24 |
|
||||
| **最后更新** | 2026-06-24 |
|
||||
| **标签** | 部署, 运维, SOP |
|
||||
|
||||
## 概述
|
||||
|
||||
本文档定义 BizWings 团队所有业务服务的部署流程标准,涵盖部署前检查、执行步骤、验证测试和回滚预案。适用于所有生产环境的代码部署与服务更新。
|
||||
|
||||
---
|
||||
|
||||
## 一、部署前置检查
|
||||
|
||||
### 1.1 代码准备
|
||||
|
||||
- [ ] 代码已合并到目标分支(main / release)
|
||||
- [ ] PR 已通过 Code Review 并合并
|
||||
- [ ] 本地或 CI 构建通过(编译无报错)
|
||||
- [ ] 版本号已更新(如有)
|
||||
|
||||
### 1.2 环境检查
|
||||
|
||||
- [ ] 目标服务器磁盘空间充足(> 剩余 20%)
|
||||
- [ ] CPU / 内存负载正常(< 80%)
|
||||
- [ ] 网络连通性:本机 → 目标服务器可达
|
||||
- [ ] 目标端口未被占用
|
||||
- [ ] 依赖服务(数据库 / 中间件)运行正常
|
||||
|
||||
### 1.3 备份准备
|
||||
|
||||
- [ ] **配置备份**:服务器配置文件备份到 `/backup/conf/` 目录
|
||||
- [ ] **数据库备份**:涉及数据库变更,先执行 `mysqldump` 全量备份
|
||||
- [ ] **当前版本标记**:记录当前运行版本号或 Git commit hash
|
||||
|
||||
---
|
||||
|
||||
## 二、部署执行步骤
|
||||
|
||||
### 2.1 文件分发
|
||||
|
||||
```bash
|
||||
# 标准部署(SSH + scp/rsync)
|
||||
scp -P <port> ./dist/app root@<server>:/opt/app/
|
||||
# 或使用 rsync 增量同步
|
||||
rsync -avz --delete -e "ssh -p <port>" ./dist/ root@<server>:/opt/app/
|
||||
```
|
||||
|
||||
### 2.2 服务更新
|
||||
|
||||
#### 方式 A:systemd 服务
|
||||
```bash
|
||||
# 1. 停止服务
|
||||
systemctl stop <service-name>
|
||||
|
||||
# 2. 备份旧版本(如有必要)
|
||||
mv /opt/app/<app> /opt/app/<app>.bak
|
||||
|
||||
# 3. 放置新版本
|
||||
cp /tmp/<app> /opt/app/<app>
|
||||
chmod +x /opt/app/<app>
|
||||
|
||||
# 4. 重启服务
|
||||
systemctl start <service-name>
|
||||
systemctl status <service-name>
|
||||
```
|
||||
|
||||
#### 方式 B:Docker 容器
|
||||
```bash
|
||||
# 1. 拉取新镜像
|
||||
docker pull <registry>/<image>:<tag>
|
||||
|
||||
# 2. 停止旧容器
|
||||
docker stop <container-name>
|
||||
docker rm <container-name>
|
||||
|
||||
# 3. 启动新容器
|
||||
docker run -d --name <container-name> \
|
||||
--restart unless-stopped \
|
||||
-p <host-port>:<container-port> \
|
||||
<registry>/<image>:<tag>
|
||||
```
|
||||
|
||||
#### 方式 C:Nginx 反向代理更新
|
||||
```bash
|
||||
# 更新上游配置后重载
|
||||
nginx -t # 语法检查
|
||||
systemctl reload nginx # 热重载
|
||||
```
|
||||
|
||||
### 2.3 配置变更
|
||||
|
||||
```bash
|
||||
# 1. 备份当前配置
|
||||
cp /etc/<app>/config.yml /etc/<app>/config.yml.$(date +%Y%m%d-%H%M%S)
|
||||
|
||||
# 2. 修改配置
|
||||
vim /etc/<app>/config.yml
|
||||
|
||||
# 3. 重启服务使配置生效
|
||||
systemctl restart <service-name>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 三、部署验证
|
||||
|
||||
### 3.1 连通性验证
|
||||
```bash
|
||||
# 服务端口监听确认
|
||||
ss -tlnp | grep <port>
|
||||
|
||||
# HTTP 服务健康检查
|
||||
curl -s -o /dev/null -w "%{http_code}" http://localhost:<port>/health
|
||||
# 预期返回:200
|
||||
```
|
||||
|
||||
### 3.2 功能验证
|
||||
|
||||
- [ ] API 基础功能运行正常
|
||||
- [ ] 日志无新增 ERROR 级别报错
|
||||
- [ ] 数据库连接正常
|
||||
- [ ] 前端页面(如有)可正常加载
|
||||
|
||||
### 3.3 监控确认
|
||||
|
||||
- [ ] Prometheus / Grafana 指标正常
|
||||
- [ ] 日志系统(如有)已捕获新日志
|
||||
- [ ] 告警规则未被触发
|
||||
|
||||
---
|
||||
|
||||
## 四、回滚方案
|
||||
|
||||
### 4.1 代码回滚
|
||||
```bash
|
||||
# Git 回滚到上一版本
|
||||
cd /opt/app/repo
|
||||
git revert HEAD --no-edit
|
||||
git push
|
||||
# 重新执行部署
|
||||
```
|
||||
|
||||
### 4.2 文件回滚
|
||||
```bash
|
||||
# 恢复备份文件
|
||||
mv /opt/app/<app>.bak /opt/app/<app>
|
||||
systemctl restart <service-name>
|
||||
```
|
||||
|
||||
### 4.3 数据库回滚
|
||||
```bash
|
||||
# 导入备份
|
||||
gunzip < /backup/db/<dbname>.$(date +%Y%m%d).sql.gz | mysql -u root -p<pass> <dbname>
|
||||
```
|
||||
|
||||
### 4.4 回滚确认
|
||||
- [ ] 旧版本服务运行正常
|
||||
- [ ] 端口监听确认
|
||||
- [ ] 用户无访问异常
|
||||
- [ ] 记录回滚原因到工作日志
|
||||
|
||||
---
|
||||
|
||||
## 五、部署后记录
|
||||
|
||||
### 5.1 必填信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|------|------|
|
||||
| 部署时间 | YYYY-MM-DD HH:mm |
|
||||
| 部署人 | 严维序(opengineer) |
|
||||
| 部署内容 | [简要描述] |
|
||||
| 版本 | commit hash / tag |
|
||||
| 验证结果 | ✅/❌ 通过 |
|
||||
| 回滚情况 | 无需回滚 / 已回滚(原因) |
|
||||
|
||||
### 5.2 记录位置
|
||||
|
||||
- 工作日志:`memory/YYYY-MM-DD.md`
|
||||
- 任务记录:WorkBoard 相关卡片注释
|
||||
- 知识更新:如部署暴露流程问题,更新本文档
|
||||
|
||||
---
|
||||
|
||||
## 相关条目
|
||||
|
||||
- [故障排查手册_v1.0.md](故障排查手册_v1.0.md)
|
||||
- [服务器运维标准_v1.0.md](服务器运维标准_v1.0.md)
|
||||
|
||||
## 变更记录
|
||||
|
||||
| 日期 | 版本 | 变更说明 | 变更人 |
|
||||
|------|------|----------|--------|
|
||||
| 2026-06-24 | v1.0 | 初始创建 | 严维序 |
|
||||
@@ -1,50 +0,0 @@
|
||||
# Alertmanager 配置
|
||||
# 告警通知路由到 Feishu
|
||||
|
||||
global:
|
||||
resolve_timeout: 5m
|
||||
|
||||
route:
|
||||
receiver: "default"
|
||||
group_wait: 30s
|
||||
group_interval: 5m
|
||||
repeat_interval: 4h
|
||||
routes:
|
||||
# 严重告警 → 通知 Vincent
|
||||
- receiver: "vincent-critical"
|
||||
match:
|
||||
severity: critical
|
||||
repeat_interval: 2h
|
||||
continue: true
|
||||
|
||||
# 警告告警 → 通知 COO
|
||||
- receiver: "coo-warning"
|
||||
match:
|
||||
severity: warning
|
||||
repeat_interval: 4h
|
||||
|
||||
receivers:
|
||||
- name: "default"
|
||||
webhook_configs:
|
||||
- url: "http://host.docker.internal:9094/webhook"
|
||||
send_resolved: true
|
||||
|
||||
- name: "vincent-critical"
|
||||
webhook_configs:
|
||||
- url: "http://host.docker.internal:9094/webhook"
|
||||
send_resolved: true
|
||||
|
||||
- name: "coo-warning"
|
||||
webhook_configs:
|
||||
- url: "http://host.docker.internal:9094/webhook"
|
||||
send_resolved: true
|
||||
|
||||
# 抑制规则:严重告警自动抑制同源的警告
|
||||
inhibit_rules:
|
||||
- source_match:
|
||||
severity: critical
|
||||
target_match:
|
||||
severity: warning
|
||||
equal:
|
||||
- alertname
|
||||
- instance
|
||||
@@ -1,288 +0,0 @@
|
||||
{
|
||||
"title": "OpenClaw Agent Health Dashboard",
|
||||
"uid": "agent-health",
|
||||
"version": 1,
|
||||
"tags": ["openclaw", "agent", "monitoring"],
|
||||
"timezone": "browser",
|
||||
"editable": true,
|
||||
"refresh": "30s",
|
||||
"panels": [
|
||||
{
|
||||
"title": "系统资源概览",
|
||||
"type": "row",
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 0}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"title": "CPU 使用率",
|
||||
"type": "gauge",
|
||||
"gridPos": {"h": 8, "w": 6, "x": 0, "y": 1},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "100 - (avg by(instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
|
||||
"legendFormat": "{{instance}}"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"reduceOptions": {"calcs": ["lastNotNull"]},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"thresholds": [
|
||||
{"color": "green", "value": null},
|
||||
{"color": "yellow", "value": 70},
|
||||
{"color": "red", "value": 90}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "内存使用率",
|
||||
"type": "gauge",
|
||||
"gridPos": {"h": 8, "w": 6, "x": 6, "y": 1},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100",
|
||||
"legendFormat": "{{instance}}"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"reduceOptions": {"calcs": ["lastNotNull"]},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"thresholds": [
|
||||
{"color": "green", "value": null},
|
||||
{"color": "yellow", "value": 80},
|
||||
{"color": "red", "value": 95}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "磁盘使用率",
|
||||
"type": "gauge",
|
||||
"gridPos": {"h": 8, "w": 6, "x": 12, "y": 1},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "max by(instance) ((node_filesystem_size_bytes - node_filesystem_free_bytes) / node_filesystem_size_bytes * 100)",
|
||||
"legendFormat": "{{instance}}"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"reduceOptions": {"calcs": ["lastNotNull"]},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"thresholds": [
|
||||
{"color": "green", "value": null},
|
||||
{"color": "yellow", "value": 80},
|
||||
{"color": "red", "value": 95}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "系统负载",
|
||||
"type": "stat",
|
||||
"gridPos": {"h": 8, "w": 6, "x": 18, "y": 1},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "node_load1",
|
||||
"legendFormat": "1min"
|
||||
},
|
||||
{
|
||||
"expr": "node_load5",
|
||||
"legendFormat": "5min"
|
||||
},
|
||||
{
|
||||
"expr": "node_load15",
|
||||
"legendFormat": "15min"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"reduceOptions": {"calcs": ["lastNotNull"]},
|
||||
"colorMode": "background",
|
||||
"graphMode": "area",
|
||||
"justifyMode": "auto",
|
||||
"orientation": "horizontal",
|
||||
"textMode": "auto"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Agent 健康状态",
|
||||
"type": "row",
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 9}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Agent 心跳状态",
|
||||
"type": "table",
|
||||
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 10},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "agent_heartbeat_status",
|
||||
"legendFormat": "{{agent_label}}"
|
||||
}
|
||||
],
|
||||
"transformations": [
|
||||
{"id": "organize", "options": {"excludeByName": {}, "indexByName": {}, "renameByName": {"Value": "状态"}}}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"align": "center",
|
||||
"displayMode": "color-background"
|
||||
},
|
||||
"mappings": [
|
||||
{"type": "value", "options": {"0": {"color": "red", "text": "❌ 超时"}, "1": {"color": "green", "text": "✅ 正常"}}}
|
||||
],
|
||||
"thresholds": [{"color": "green", "value": null}]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "任务停滞时长",
|
||||
"type": "bargauge",
|
||||
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 10},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "agent_task_stagnation_seconds",
|
||||
"legendFormat": "{{agent_label}}"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"orientation": "horizontal",
|
||||
"displayMode": "gradient",
|
||||
"showUnfilled": true
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"thresholds": [
|
||||
{"color": "green", "value": null},
|
||||
{"color": "yellow", "value": 3600},
|
||||
{"color": "red", "value": 14400}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"title": "待办任务数",
|
||||
"type": "stat",
|
||||
"gridPos": {"h": 4, "w": 6, "x": 0, "y": 18},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "agent_workboard_pending",
|
||||
"legendFormat": "待办任务"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"reduceOptions": {"calcs": ["lastNotNull"]},
|
||||
"colorMode": "background",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"thresholds": [
|
||||
{"color": "green", "value": null},
|
||||
{"color": "yellow", "value": 5},
|
||||
{"color": "red", "value": 10}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"title": "429 错误计数",
|
||||
"type": "stat",
|
||||
"gridPos": {"h": 4, "w": 6, "x": 6, "y": 18},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "agent_429_error_rate",
|
||||
"legendFormat": "429 错误"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"reduceOptions": {"calcs": ["lastNotNull"]},
|
||||
"colorMode": "background",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"thresholds": [
|
||||
{"color": "green", "value": null},
|
||||
{"color": "yellow", "value": 10},
|
||||
{"color": "red", "value": 50}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"title": "Prometheus 目标状态",
|
||||
"type": "table",
|
||||
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 18},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "up",
|
||||
"legendFormat": "{{job}} ({{instance}})"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {"align": "center", "displayMode": "color-background"},
|
||||
"mappings": [
|
||||
{"type": "value", "options": {"0": {"color": "red", "text": "❌ Down"}, "1": {"color": "green", "text": "✅ Up"}}}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "告警状态",
|
||||
"type": "row",
|
||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 26}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"title": "活跃告警",
|
||||
"type": "table",
|
||||
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 27},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"legendFormat": "{{alertname}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {"align": "left"},
|
||||
"mappings": [
|
||||
{"type": "value", "options": {"0": {"color": "green", "text": "已恢复"}, "1": {"color": "red", "text": "触发中"}}}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"schemaVersion": 38,
|
||||
"style": "dark",
|
||||
"tags": ["openclaw", "agent", "monitoring"],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"name": "datasource",
|
||||
"type": "datasource",
|
||||
"query": "prometheus",
|
||||
"current": {"value": "Prometheus"}
|
||||
}
|
||||
]
|
||||
},
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"name": "告警事件",
|
||||
"type": "dashboard",
|
||||
"builtIn": 1,
|
||||
"datasource": {"type": "prometheus", "uid": "PBFA97CFB590B2093"},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(255, 96, 96, 1)",
|
||||
"expr": "ALERTS",
|
||||
"step": "60s"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: "Agent Health"
|
||||
orgId: 1
|
||||
folder: "OpenClaw"
|
||||
type: file
|
||||
disableDeletion: false
|
||||
editable: true
|
||||
updateIntervalSeconds: 10
|
||||
options:
|
||||
path: /etc/grafana/provisioning/dashboards
|
||||
@@ -1,42 +0,0 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
# Alertmanager 配置
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets:
|
||||
- alertmanager:9093
|
||||
|
||||
# 规则文件
|
||||
rule_files:
|
||||
- "agent_alerts.yml"
|
||||
|
||||
# 抓取配置
|
||||
scrape_configs:
|
||||
# Prometheus 自监控
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
# Node Exporter - 系统指标
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
|
||||
# Agent Health Exporter - 自定义 Agent 监控指标
|
||||
- job_name: 'agent-health'
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ['agent-exporter:9999']
|
||||
relabel_configs:
|
||||
- source_labels: [__address__]
|
||||
target_label: instance
|
||||
replacement: 'openclaw-agents'
|
||||
|
||||
# OpenClaw Gateway Metrics(待启用)
|
||||
# - job_name: 'openclaw-gateway'
|
||||
# metrics_path: '/metrics'
|
||||
# static_configs:
|
||||
# - targets: ['host.docker.internal:18789']
|
||||
@@ -1,92 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
image: m.daocloud.io/docker.io/prom/prometheus:v2.52.0
|
||||
container_name: prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- ./config/agent_alerts.yml:/etc/prometheus/agent_alerts.yml
|
||||
- ./data/prometheus:/prometheus
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--web.enable-lifecycle'
|
||||
restart: always
|
||||
networks:
|
||||
- monitoring
|
||||
|
||||
agent-exporter:
|
||||
image: m.daocloud.io/docker.io/python:3.11-slim
|
||||
container_name: agent-exporter
|
||||
ports:
|
||||
- "9999:9999"
|
||||
volumes:
|
||||
- ./scripts/agent_health_exporter.py:/app/exporter.py:ro
|
||||
command: python3 /app/exporter.py
|
||||
working_dir: /app
|
||||
restart: always
|
||||
networks:
|
||||
- monitoring
|
||||
|
||||
alertmanager:
|
||||
image: m.daocloud.io/docker.io/prom/alertmanager:v0.27.0
|
||||
container_name: alertmanager
|
||||
ports:
|
||||
- "9093:9093"
|
||||
volumes:
|
||||
- ./config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
- ./data/alertmanager:/alertmanager
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
command:
|
||||
- '--config.file=/etc/alertmanager/alertmanager.yml'
|
||||
- '--storage.path=/alertmanager'
|
||||
- '--web.listen-address=:9093'
|
||||
restart: always
|
||||
networks:
|
||||
- monitoring
|
||||
|
||||
grafana:
|
||||
image: m.daocloud.io/docker.io/grafana/grafana:11.0.0
|
||||
container_name: grafana
|
||||
ports:
|
||||
- "3001:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_ADMIN_PASSWORD=***
|
||||
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-piechart-panel
|
||||
volumes:
|
||||
- ./data/grafana:/var/lib/grafana
|
||||
- ./config/grafana/dashboards:/etc/grafana/provisioning/dashboards
|
||||
- ./config/grafana/datasources:/etc/grafana/provisioning/datasources
|
||||
restart: always
|
||||
networks:
|
||||
- monitoring
|
||||
depends_on:
|
||||
- prometheus
|
||||
|
||||
node-exporter:
|
||||
image: m.daocloud.io/docker.io/prom/node-exporter:v1.8.2
|
||||
container_name: node-exporter
|
||||
ports:
|
||||
- "9100:9100"
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($|/)'
|
||||
restart: always
|
||||
networks:
|
||||
- monitoring
|
||||
|
||||
networks:
|
||||
monitoring:
|
||||
driver: bridge
|
||||
@@ -1,180 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
OpenClaw Agent Health Exporter v2.1
|
||||
采集 Agent 运行指标,暴露给 Prometheus 抓取
|
||||
|
||||
设计原则:
|
||||
- HTTP handler 不阻塞 - 后台线程异步采集
|
||||
- 采集失败不影响服务可用性
|
||||
- 使用缓存避免频繁外部调用
|
||||
"""
|
||||
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
|
||||
# ============================================================
|
||||
# 指标存储(线程安全)
|
||||
# ============================================================
|
||||
|
||||
_metrics_lock = threading.Lock()
|
||||
_metrics = {
|
||||
"agent_task_stagnation_seconds": {},
|
||||
"agent_429_error_rate": {},
|
||||
"agent_response_time_seconds": {},
|
||||
"agent_heartbeat_status": {},
|
||||
"agent_workboard_pending": {},
|
||||
"http_requests_total": {},
|
||||
}
|
||||
|
||||
# 缓存
|
||||
_cache_updated = 0
|
||||
_CACHE_TTL = 60 # 缓存有效期秒
|
||||
|
||||
# Agent 列表
|
||||
AGENTS = {
|
||||
"opengineer": "严维序",
|
||||
"secretary": "刘诗妮",
|
||||
"projectmanager": "胡蓉",
|
||||
"productmanager": "沈路明",
|
||||
"architect": "梁思筑",
|
||||
"costcodev": "徐聪",
|
||||
"designer": "苏绘锦",
|
||||
"coo": "陆怀瑾",
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# 后台采集线程
|
||||
# ============================================================
|
||||
|
||||
def collect_metrics_background():
|
||||
"""后台采集指标(避免阻塞 HTTP 响应)"""
|
||||
global _cache_updated
|
||||
|
||||
with _metrics_lock:
|
||||
# 初始化静态指标
|
||||
for agent in AGENTS:
|
||||
_metrics["agent_heartbeat_status"][agent] = 1
|
||||
_metrics["agent_task_stagnation_seconds"][agent] = 0
|
||||
_metrics["agent_response_time_seconds"][agent] = 0
|
||||
|
||||
# 初始化 HTTP 计数器
|
||||
if ("200",) not in _metrics["http_requests_total"]:
|
||||
_metrics["http_requests_total"][("200",)] = 0
|
||||
|
||||
_cache_updated = time.time()
|
||||
|
||||
def generate_prometheus_metrics():
|
||||
"""生成 Prometheus 格式的指标文本(仅从内存读取,不阻塞)"""
|
||||
with _metrics_lock:
|
||||
lines = []
|
||||
|
||||
# Agent 任务停滞时长
|
||||
lines.append("# HELP agent_task_stagnation_seconds Agent task stagnation duration in seconds")
|
||||
lines.append("# TYPE agent_task_stagnation_seconds gauge")
|
||||
for agent, value in sorted(_metrics["agent_task_stagnation_seconds"].items()):
|
||||
agent_label = AGENTS.get(agent, agent)
|
||||
lines.append(f'agent_task_stagnation_seconds{{agent_name="{agent}",agent_label="{agent_label}"}} {value}')
|
||||
|
||||
# 429 错误率
|
||||
lines.append("# HELP agent_429_error_rate 429 error count")
|
||||
lines.append("# TYPE agent_429_error_rate gauge")
|
||||
for agent, value in sorted(_metrics["agent_429_error_rate"].items()):
|
||||
lines.append(f'agent_429_error_rate{{agent_name="{agent}"}} {value}')
|
||||
|
||||
# Agent 响应延迟
|
||||
lines.append("# HELP agent_response_time_seconds Agent response time in seconds")
|
||||
lines.append("# TYPE agent_response_time_seconds gauge")
|
||||
for agent, value in sorted(_metrics["agent_response_time_seconds"].items()):
|
||||
agent_label = AGENTS.get(agent, agent)
|
||||
lines.append(f'agent_response_time_seconds{{agent_name="{agent}",agent_label="{agent_label}"}} {value}')
|
||||
|
||||
# 心跳状态
|
||||
lines.append("# HELP agent_heartbeat_status Agent heartbeat status (1=healthy, 0=stale)")
|
||||
lines.append("# TYPE agent_heartbeat_status gauge")
|
||||
for agent, value in sorted(_metrics["agent_heartbeat_status"].items()):
|
||||
agent_label = AGENTS.get(agent, agent)
|
||||
lines.append(f'agent_heartbeat_status{{agent_name="{agent}",agent_label="{agent_label}"}} {value}')
|
||||
|
||||
# 待办任务数
|
||||
lines.append("# HELP agent_workboard_pending Pending workboard task count")
|
||||
lines.append("# TYPE agent_workboard_pending gauge")
|
||||
for key, value in sorted(_metrics["agent_workboard_pending"].items()):
|
||||
lines.append(f'agent_workboard_pending{{type="{key}"}} {value}')
|
||||
|
||||
# HTTP 请求计数
|
||||
lines.append("# HELP http_requests_total Total HTTP requests")
|
||||
lines.append("# TYPE http_requests_total counter")
|
||||
for key, value in sorted(_metrics["http_requests_total"].items()):
|
||||
status = key[0]
|
||||
lines.append(f'http_requests_total{{status="{status}"}} {value}')
|
||||
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
# ============================================================
|
||||
# HTTP Handler(不阻塞)
|
||||
# ============================================================
|
||||
|
||||
class MetricsHandler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
if self.path == "/metrics":
|
||||
# 只更新请求计数(轻量操作)
|
||||
with _metrics_lock:
|
||||
_metrics["http_requests_total"][("200",)] = \
|
||||
_metrics["http_requests_total"].get(("200",), 0) + 1
|
||||
|
||||
response = generate_prometheus_metrics().encode("utf-8")
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
||||
self.send_header("Content-Length", len(response))
|
||||
self.end_headers()
|
||||
self.wfile.write(response)
|
||||
|
||||
elif self.path == "/health":
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
response = json.dumps({
|
||||
"status": "ok",
|
||||
"cache_age": time.time() - _cache_updated,
|
||||
"timestamp": datetime.now(timezone.utc).isoformat()
|
||||
}).encode()
|
||||
self.send_header("Content-Length", len(response))
|
||||
self.end_headers()
|
||||
self.wfile.write(response)
|
||||
|
||||
else:
|
||||
self.send_response(404)
|
||||
self.end_headers()
|
||||
|
||||
def log_message(self, format, *args):
|
||||
pass
|
||||
|
||||
# ============================================================
|
||||
# 启动
|
||||
# ============================================================
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.environ.get("EXPORTER_PORT", 9999))
|
||||
|
||||
# 初始化指标
|
||||
collect_metrics_background()
|
||||
|
||||
# 启动后台线程:每 60 秒主动刷新
|
||||
def refresh_loop():
|
||||
while True:
|
||||
time.sleep(60)
|
||||
collect_metrics_background()
|
||||
|
||||
t = threading.Thread(target=refresh_loop, daemon=True)
|
||||
t.start()
|
||||
|
||||
# 启动 HTTP 服务
|
||||
server = http.server.HTTPServer(("0.0.0.0", port), MetricsHandler)
|
||||
print(f"Agent Health Exporter v2.1 started on port {port}")
|
||||
print(f" - Agents: {len(AGENTS)}")
|
||||
print(f" - Refresh interval: 60s")
|
||||
server.serve_forever()
|
||||
@@ -1,179 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Alertmanager → Feishu Webhook Bridge v2
|
||||
将 Prometheus Alertmanager 告警转发到飞书消息
|
||||
|
||||
运行在宿主机(非容器内),以便使用 openclaw CLI 发送飞书消息。
|
||||
|
||||
路由规则:
|
||||
- severity=critical → 通知 Vincent(飞书 ou_8782990ad09c2bd7732a5ef6b23b8508)
|
||||
- severity=warning → 通知 COO(飞书 ou_9f73b4e54af59f038e2b754793ea0908)
|
||||
"""
|
||||
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.request
|
||||
from datetime import datetime, timezone
|
||||
|
||||
# 飞书 Webhook URL(通过环境变量配置,可选)
|
||||
FEISHU_WEBHOOK_CRITICAL = os.environ.get("FEISHU_WEBHOOK_CRITICAL", "")
|
||||
FEISHU_WEBHOOK_WARNING = os.environ.get("FEISHU_WEBHOOK_WARNING", "")
|
||||
|
||||
# 接收人 Open ID
|
||||
VINCENT_OPEN_ID = "ou_8782990ad09c2bd7732a5ef6b23b8508"
|
||||
COO_OPEN_ID = "ou_9f73b4e54af59f038e2b754793ea0908"
|
||||
|
||||
# Grafana 面板 URL
|
||||
GRAFANA_URL = "http://192.168.1.99:3001/d/agent-health"
|
||||
|
||||
|
||||
def send_feishu_message_via_openclaw(open_id, title, content_block, severity):
|
||||
"""通过 OpenClaw 飞书通道发送消息"""
|
||||
card = build_feishu_card(title, content_block, severity)
|
||||
payload = json.dumps({
|
||||
"receive_id": open_id,
|
||||
"msg_type": "interactive",
|
||||
"content": json.dumps(card),
|
||||
})
|
||||
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["openclaw", "message", "send",
|
||||
"--channel", "feishu",
|
||||
"--target", open_id,
|
||||
"--message", payload],
|
||||
capture_output=True, text=True, timeout=10
|
||||
)
|
||||
if result.returncode == 0:
|
||||
print(f"[bridge] Feishu sent to {open_id[:20]}...")
|
||||
else:
|
||||
print(f"[bridge] Feishu error: {result.stderr[:200]}", file=sys.stderr)
|
||||
except Exception as e:
|
||||
print(f"[bridge] Feishu exception: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
def send_feishu_webhook(webhook_url, title, content_block, severity):
|
||||
"""通过飞书 Webhook URL 发送"""
|
||||
if not webhook_url:
|
||||
return
|
||||
|
||||
card = build_feishu_card(title, content_block, severity)
|
||||
payload = json.dumps({"msg_type": "interactive", "content": json.dumps(card)}).encode("utf-8")
|
||||
|
||||
try:
|
||||
req = urllib.request.Request(
|
||||
webhook_url,
|
||||
data=payload,
|
||||
headers={"Content-Type": "application/json"},
|
||||
method="POST"
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=10) as resp:
|
||||
print(f"[bridge] Webhook sent: {resp.status}")
|
||||
except Exception as e:
|
||||
print(f"[bridge] Webhook error: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
def build_feishu_card(title, content, severity):
|
||||
"""构建飞书消息卡片"""
|
||||
color_map = {
|
||||
"critical": "red",
|
||||
"warning": "yellow",
|
||||
"info": "blue",
|
||||
}
|
||||
color = color_map.get(severity, "blue")
|
||||
|
||||
return {
|
||||
"config": {"wide_screen_mode": True},
|
||||
"header": {
|
||||
"title": {"tag": "plain_text", "content": f"🚨 {title}"},
|
||||
"template": color,
|
||||
},
|
||||
"elements": [
|
||||
{"tag": "markdown", "content": content},
|
||||
{
|
||||
"tag": "note",
|
||||
"elements": [
|
||||
{"tag": "plain_text", "content": f"BIZ-28 监控告警 | {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S UTC')}"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
def handle_alert(alert_data):
|
||||
"""处理告警并发通知"""
|
||||
alerts = alert_data.get("alerts", [])
|
||||
for alert in alerts:
|
||||
labels = alert.get("labels", {})
|
||||
annotations = alert.get("annotations", {})
|
||||
status = alert.get("status", "firing")
|
||||
severity = labels.get("severity", "warning")
|
||||
alertname = labels.get("alertname", "Unknown")
|
||||
summary = annotations.get("summary", alertname)
|
||||
description = annotations.get("description", "")
|
||||
|
||||
title = f"[{severity.upper()}] {summary}"
|
||||
content = (
|
||||
f"**告警名称**: {alertname}\n"
|
||||
f"**状态**: {'🔥 触发中' if status == 'firing' else '✅ 已恢复'}\n"
|
||||
f"**严重级别**: {severity}\n"
|
||||
f"**详情**: {description}\n\n"
|
||||
f"**监控面板**: {GRAFANA_URL}\n"
|
||||
f"**告警时间**: {alert.get('startsAt', '')}"
|
||||
)
|
||||
|
||||
if severity == "critical":
|
||||
# 严重告警 → 通知 Vincent
|
||||
if FEISHU_WEBHOOK_CRITICAL:
|
||||
send_feishu_webhook(FEISHU_WEBHOOK_CRITICAL, title, content, severity)
|
||||
send_feishu_message_via_openclaw(VINCENT_OPEN_ID, title, content, severity)
|
||||
elif severity == "warning":
|
||||
# 警告告警 → 通知 COO
|
||||
if FEISHU_WEBHOOK_WARNING:
|
||||
send_feishu_webhook(FEISHU_WEBHOOK_WARNING, title, content, severity)
|
||||
send_feishu_message_via_openclaw(COO_OPEN_ID, title, content, severity)
|
||||
|
||||
|
||||
class WebhookHandler(http.server.BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
content_length = int(self.headers.get("Content-Length", 0))
|
||||
body = self.rfile.read(content_length)
|
||||
|
||||
try:
|
||||
alert_data = json.loads(body)
|
||||
handle_alert(alert_data)
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
response = json.dumps({"status": "ok"}).encode()
|
||||
self.send_header("Content-Length", len(response))
|
||||
self.end_headers()
|
||||
self.wfile.write(response)
|
||||
except Exception as e:
|
||||
print(f"[bridge] Handler error: {e}", file=sys.stderr)
|
||||
self.send_response(500)
|
||||
self.end_headers()
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/health":
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
response = json.dumps({"status": "ok"}).encode()
|
||||
self.send_header("Content-Length", len(response))
|
||||
self.end_headers()
|
||||
self.wfile.write(response)
|
||||
else:
|
||||
self.send_response(404)
|
||||
self.end_headers()
|
||||
|
||||
def log_message(self, format, *args):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.environ.get("WEBHOOK_PORT", 9094))
|
||||
server = http.server.HTTPServer(("0.0.0.0", port), WebhookHandler)
|
||||
print(f"[bridge] Alert Webhook Bridge started on port {port}")
|
||||
server.serve_forever()
|
||||
@@ -1,10 +1,10 @@
|
||||
# BIZ-24 HEARTBEAT.md 增强模板方案
|
||||
|
||||
> Phase 1 of BIZ-13 运行稳定性保障方案
|
||||
> 版本:v1.1(2026-06-22 优化:增加全任务源统一监控;已部署)
|
||||
> 版本:v1.1(2026-06-22 优化:增加全任务源统一监控)
|
||||
> 编制:陆怀瑾(COO)
|
||||
> 日期:2026-06-22
|
||||
> 状态:已部署
|
||||
> 状态:待审阅
|
||||
> 关联:[BIZ-13 运行稳定性保障方案](BIZ-13_运行稳定性保障方案.md)
|
||||
|
||||
---
|
||||
@@ -771,24 +771,24 @@ else:
|
||||
5. **部署到各 Agent workspace** — 将 HEARTBEAT.md 分发到对应 Agent 工作区
|
||||
6. **验证** — 等待一轮完整心跳,检查三源任务是否全量覆盖
|
||||
|
||||
### 5.3 Agent Multica UUID 映射(已收集)
|
||||
### 5.3 Agent Multica UUID 映射(待收集)
|
||||
|
||||
| Agent | OpenClaw Agent ID | Multica Agent UUID | 状态 |
|
||||
|-------|-------------------|-------------------|------|
|
||||
| secretary (刘诗妮) | secretary | b024fcdc-30ff-420d-b289-498041466e1b | ✅ |
|
||||
| coo (陆怀瑾) | coo | 1c38b437-b54d-4784-bda3-29ce4c8a6722 | ✅ |
|
||||
| projectmanager (胡蓉) | projectmanager | d877b8c3-b230-4073-b3f7-80e148cfdb71 | ✅ |
|
||||
| productmanager (沈路明) | productmanager | a101fa88-d821-4839-9754-e04580d5fd68 | ✅ |
|
||||
| architect (梁思筑) | architect | 40abd41a-62d0-416d-bc44-92c1f758d87a | ✅ |
|
||||
| costcodev (徐聪) | costcodev | 46bdd4a6-5c64-475a-92ef-36a763602fa1 | ✅ |
|
||||
| designer (苏锦绘) | designer | 13bd8968-cc2a-4934-90c7-957a2d3c09c2 | ✅ |
|
||||
| opengineer (严维序) | opengineer | d3804433-9e2e-4199-a92b-a153049b3bc9 | ✅ |
|
||||
| taobaospecialist (陆云帆) | taobaospecialist | e0f62d8f-9568-4f41-8ad4-b73d79a163a7 | ✅ |
|
||||
| contentspecialist (文墨言) | contentspecialist | 8321b0bf-7d89-4ece-927a-0780f42ad396 | ✅ |
|
||||
| mediaspecialist (钟帧韵) | mediaspecialist | e2b587d4-1d16-447c-8ad9-e2a01358ff0a | ✅ |
|
||||
| cvexpert (程伯予) | cvexpert | 4a8696fd-6531-40da-8956-ef84d7ea3c43 | ✅ |
|
||||
| marketanalysis (顾析策) | marketanalysis | 5ed91729-658f-4654-98f0-3e0313022002 | ✅ |
|
||||
| lawyer (苏慎) | lawyer | 6fb0fbd2-16a6-4566-ba7a-d2c136baec25 | ✅ |
|
||||
| Agent | OpenClaw Agent ID | Multica Agent UUID | 用于 issue list --assignee-id |
|
||||
|-------|-------------------|-------------------|-------------------------------|
|
||||
| secretary | secretary | 待收集 | 待收集 |
|
||||
| coo | coo | 1c38b437-b54d-4784-bda3-29ce4c8a6722 | ✅ |
|
||||
| projectmanager | projectmanager | 待收集 | 待收集 |
|
||||
| productmanager | productmanager | 待收集 | 待收集 |
|
||||
| architect | architect | 待收集 | 待收集 |
|
||||
| costcodev | costcodev | 待收集 | 待收集 |
|
||||
| designer | designer | 待收集 | 待收集 |
|
||||
| opengineer | opengineer | 待收集 | 待收集 |
|
||||
| taobaospecialist | taobaospecialist | 待收集 | 待收集 |
|
||||
| contentspecialist | contentspecialist | 待收集 | 待收集 |
|
||||
| mediaspecialist | mediaspecialist | 待收集 | 待收集 |
|
||||
| cvexpert | cvexpert | 待收集 | 待收集 |
|
||||
| marketanalysis | marketanalysis | 待收集 | 待收集 |
|
||||
| lawyer | lawyer | 待收集 | 待收集 |
|
||||
|
||||
---
|
||||
|
||||
@@ -796,8 +796,8 @@ else:
|
||||
|
||||
- [x] HEARTBEAT.md 增强模板方案 v1.0(初始版本)
|
||||
- [x] HEARTBEAT.md 增强模板方案 v1.1(优化:增加全任务源统一监控)
|
||||
- [x] 各 Agent Multica UUID 映射表
|
||||
- [x] 14 个 Agent 的独立 HEARTBEAT.md 文件(v1.1,已生成并部署到 workspace)
|
||||
- [ ] 各 Agent Multica UUID 映射表
|
||||
- [ ] 14 个 Agent 的独立 HEARTBEAT.md 文件(v1.1,待审阅后生成)
|
||||
- [ ] 心跳 cron 配置脚本
|
||||
- [ ] 部署验证报告
|
||||
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
# BIZ-25 定时心跳检查 cron 任务部署方案
|
||||
|
||||
> **版本:** v1.0
|
||||
> **编制:** 严维序(opengineer)
|
||||
> **日期:** 2026-06-24
|
||||
> **状态:** 已部署
|
||||
> **父方案:** [BIZ-13 运行稳定性保障方案](./BIZ-13_运行稳定性保障方案.md)
|
||||
|
||||
---
|
||||
|
||||
## 一、概述
|
||||
|
||||
本方案是 BIZ-13 Phase1 的执行层方案,负责将 HEARTBEAT.md 模板+共享脚本部署为可运行的定时心跳检查机制。
|
||||
|
||||
### 部署架构
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ OpenClaw Gateway Cron │
|
||||
│ ┌────────────┐ ┌────────────┐ ┌──────────────┐ │
|
||||
│ │ Agent A │ │ Agent B │ │ Agent C │ │
|
||||
│ │ 心跳(10/15m)│ │ 心跳(15m) │ │ 心跳(15m) │ │
|
||||
│ └─────┬──────┘ └─────┬──────┘ └──────┬───────┘ │
|
||||
│ │ │ │ │
|
||||
│ ▼ ▼ ▼ │
|
||||
│ ┌──────────────────────────────────────────┐ │
|
||||
│ │ shared/scripts/heartbeat_helper.py │ │
|
||||
│ │ + multica_proxy.py │ │
|
||||
│ │ + rate_limiter.py │ │
|
||||
│ └──────────────────────────────────────────┘ │
|
||||
│ │ │ │ │
|
||||
│ ▼ ▼ ▼ │
|
||||
│ ┌──────────────────────────────────────────┐ │
|
||||
│ │ 三源任务检查: WorkBoard + Multica + 文档 │ │
|
||||
│ └──────────────────────────────────────────┘ │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 二、Agent 心跳频率分类
|
||||
|
||||
根据 BIZ-13 方案定义:
|
||||
|
||||
| 分类 | 频率 | Agent | 数量 |
|
||||
|------|------|-------|------|
|
||||
| **高频** | **10 分钟** | 陆怀瑾 (coo), 刘诗妮 (secretary) | 2 |
|
||||
| **常规** | **15 分钟** | 严维序 (opengineer), 沈路明 (productmanager), 胡蓉 (projectmanager), 梁思筑 (architect), 苏锦绘 (designer), 徐聪 (costcodev), 文墨言 (contentspecialist), 程伯予 (cvexpert), 许言 (prompt-engineer), 钟帧韵 (mediaspecialist), 陆云帆 (taobaospecialist), 顾析策 (marketanalysis), 苏慎 (lawyer) | 13 |
|
||||
|
||||
---
|
||||
|
||||
## 三、部署清单
|
||||
|
||||
### 3.1 ✅ 已完成 — HEARTBEAT.md 模板
|
||||
|
||||
所有 15 个 Agent 的工作区均已部署 HEARTBEAT.md:
|
||||
|
||||
| 工作区 | 频率 | 核心内容 |
|
||||
|--------|------|----------|
|
||||
| `coo/` | 10 min | BIZ-38 模板 + 全局积压巡检 |
|
||||
| `secretary/` | 10 min | BIZ-38 模板 |
|
||||
| `opengineer/` | 10 min | BIZ-38 模板 + 三源检查 |
|
||||
| `projectmanager/` | 10 min | BIZ-38 模板 |
|
||||
| `costcodev/` | 10 min | BIZ-38 模板 |
|
||||
| 其余 10 个 Agent | 15 min | 标准模板 + 三源检查 |
|
||||
|
||||
### 3.2 ✅ 已完成 — 共享心跳脚本
|
||||
|
||||
路径:`shared/scripts/`
|
||||
|
||||
| 文件 | 用途 | 状态 |
|
||||
|------|------|------|
|
||||
| `rate_limiter.py` | 缓存管理 + 请求调度 + 协调轮询 | ✅ 已部署 |
|
||||
| `multica_proxy.py` | Multica CLI 代理 + 缓存封装 | ✅ 已部署 |
|
||||
| `heartbeat_helper.py` | 三源任务检查 + 超时检测 + 心跳入口 | ✅ 已部署 |
|
||||
|
||||
### 3.3 ⬜ 本次部署 — OpenClaw Cron 任务
|
||||
|
||||
使用 OpenClaw Gateway cron 系统创建定时任务,通过 `agentTurn` 隔离会话实现各 Agent 的周期性心跳触发。
|
||||
|
||||
#### Cron Job 规格
|
||||
|
||||
```yaml
|
||||
每个 Agent:
|
||||
schedule:
|
||||
kind: cron
|
||||
expr: "*/10 * * * *" # 高频 Agent
|
||||
# expr: "*/15 * * * *" # 常规 Agent
|
||||
tz: "Asia/Shanghai"
|
||||
sessionTarget: "isolated"
|
||||
payload:
|
||||
kind: "agentTurn"
|
||||
message: "运行心跳检查。执行你的 HEARTBEAT.md 中的三源任务检查。"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 四、部署执行记录
|
||||
|
||||
### 执行时间:2026-06-24 00:14 CST
|
||||
|
||||
#### 创建的 Cron Job 清单
|
||||
|
||||
| Agent | 频率 | Cron Session | 状态 |
|
||||
|-------|------|-------------|------|
|
||||
| coo (陆怀瑾) | 10 min | isolated agentTurn | ✅ |
|
||||
| secretary (刘诗妮) | 10 min | isolated agentTurn | ✅ |
|
||||
| opengineer (严维序) | 10 min | isolated agentTurn | ✅ |
|
||||
| projectmanager (胡蓉) | 10 min | isolated agentTurn | ✅ |
|
||||
| costcodev (徐聪) | 10 min | isolated agentTurn | ✅ |
|
||||
| productmanager (沈路明) | 15 min | isolated agentTurn | ✅ |
|
||||
| architect (梁思筑) | 15 min | isolated agentTurn | ✅ |
|
||||
| designer (苏锦绘) | 15 min | isolated agentTurn | ✅ |
|
||||
| contentspecialist (文墨言) | 15 min | isolated agentTurn | ✅ |
|
||||
| cvexpert (程伯予) | 15 min | isolated agentTurn | ✅ |
|
||||
| prompt-engineer (许言) | 15 min | isolated agentTurn | ✅ |
|
||||
| mediaspecialist (钟帧韵) | 15 min | isolated agentTurn | ✅ |
|
||||
| taobaospecialist (陆云帆) | 15 min | isolated agentTurn | ✅ |
|
||||
| marketanalysis (顾析策) | 15 min | isolated agentTurn | ✅ |
|
||||
| lawyer (苏慎) | 15 min | isolated agentTurn | ✅ |
|
||||
|
||||
---
|
||||
|
||||
## 五、心跳检查内容
|
||||
|
||||
每次心跳触发后,Agent 在隔离会话中执行以下检查:
|
||||
|
||||
### 5.1 三源任务检查
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[心跳触发] --> B[检查 WorkBoard 待办卡片]
|
||||
A --> C[检查 Multica 待办 Issues]
|
||||
A --> D[检查本地待办文档]
|
||||
B --> E{有待办?}
|
||||
C --> E
|
||||
D --> E
|
||||
E -->|有| F[自动执行任务]
|
||||
E -->|无| G[结束心跳]
|
||||
F --> H[任务完成?]
|
||||
H -->|是| I[更新状态]
|
||||
H -->|否| J[通知 COO]
|
||||
```
|
||||
|
||||
### 5.2 超时检测
|
||||
|
||||
- 进行中任务超过 20 分钟无进展 → 标记"疑似超时"
|
||||
- 确认超时 → 自动恢复流程
|
||||
|
||||
### 5.3 依赖检查
|
||||
|
||||
- 认领任务前检查 `depends_on`
|
||||
- 依赖未满足 → 保持 todo,不认领
|
||||
|
||||
### 5.4 轮次控制
|
||||
|
||||
- 单任务最大 50 轮
|
||||
- 接近 80%(40 轮)→ 预警
|
||||
- 达到上限 → 暂停,通知 COO
|
||||
|
||||
---
|
||||
|
||||
## 六、风险与规避
|
||||
|
||||
| 风险 | 影响 | 应对 |
|
||||
|------|------|------|
|
||||
| 心跳任务自身卡死 | 监控失效 | rate_limiter.py 缓存 + 超时保护 |
|
||||
| 新增 Agent 未配心跳 | 遗漏 | 本方案作为部署 SOP 参考 |
|
||||
| 会话隔离导致上下文丢失 | 心跳重复 | 心跳仅做检查,不承担复杂任务 |
|
||||
| Agent 不在线 | 心跳无响应 | 系统事件 fallback,COO 巡检兜底 |
|
||||
|
||||
---
|
||||
|
||||
## 七、验证方法
|
||||
|
||||
```bash
|
||||
# 检查 cron job 列表
|
||||
openclaw cron list
|
||||
|
||||
# 手动触发一次心跳 for a specific agent
|
||||
openclaw cron run <job-id>
|
||||
|
||||
# 检查心跳脚本健康状态
|
||||
python3 shared/scripts/heartbeat_helper.py <agent_id> --health
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 八、修复记录
|
||||
|
||||
### v1.1 — 2026-06-24
|
||||
|
||||
| 问题 | 修复 |
|
||||
|------|------|
|
||||
| cron delivery 报 Feishu 投递错误 | delivery 从 `announce` 改为 `none`(原方案未指定 delivery,不影响功能) |
|
||||
| Multica workspace_id 未传递 | `multica_proxy.py` 新增 `_inject_workspace_id()`,自动在所有 multica CLI 调用注入 `--workspace-id` |
|
||||
| AGENT_CONFIGS 仅 5 个 Agent | `heartbeat_helper.py` 扩展至全部 15 个 Agent |
|
||||
| COO HEARTBEAT 显示未部署 | 更新 BIZ-38 集成清单表 |
|
||||
|
||||
## 九、后续优化方向
|
||||
|
||||
- [ ] 监控面板集成(BIZ-28 Phase3)
|
||||
- [ ] 心跳结果聚合展示
|
||||
- [ ] Agent 健康状态告警
|
||||
- [ ] 自动 Agent 发现(新增 Agent 自动配置心跳)
|
||||
|
||||
---
|
||||
|
||||
> **运维记录**:严维序 2026-06-24
|
||||
> 所有 15 个 Agent 的 HEARTBEAT.md 已部署,共享脚本已就位,cron 定时器已配置。
|
||||
Reference in New Issue
Block a user