Files
ewoooc/docs/guides/ai_automation_session_sop.md
OoO 6bce46bbc7
All checks were successful
CD Pipeline / deploy (push) Successful in 2m29s
fix(runtime): 強化健康檢查監控韌性
2026-05-01 14:46:49 +08:00

50 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AI 自動化 Session SOP
> 本文件是「可重複流程 guide」用來取代本地 Skills / 私有 agent 腳本作為正式規範來源。若使用者要求更新 Skills優先更新本 guide、相關 ADR、memory 與測試。
## 入口讀取
1.`AGENTS.md`
2.`CONSTITUTION.md` 第十三章與第十四章。
3.`docs/adr/README.md`,命中後只開必要 ADR。
4. AI 自動化任務預設命中ADR-012、ADR-013、ADR-018。
5.`docs/memory/README.md`,命中後讀 `ai_automation_closure_20260429.md`
6. 需要當前架構事實時讀 `docs/AI_INTELLIGENCE_MODULE_SOT.md`
## 四 Agent 分工
| Agent | 任務 | 安全邊界 |
|---|---|---|
| Hermes | L1 摘要、規則降級、embedding、品質分數 | 不做外部副作用 |
| NemoTron | L2 tool calling、低風險 action、DB/KM 派發 | 不動 prod 容器、不做不可逆操作 |
| OpenClaw | L3 策略、報告、長期洞察、HITL 後建議 | 無人工核准不執行高風險動作 |
| ElephantAlpha | Orchestration、HITL、AutoHeal bridge、受控 log scan | 不繞過 EventRouter / AutoHeal / ADR-011 |
## 實作檢查
- EventRouter 失敗時必須降級到 Hermes rule / L0 template不可中斷通知。
- Telegram 失敗必須可暫存與 replay。
- EventRouter / AutoHeal 變更必須更新 `services/ai_automation_metrics.py` 指標或確認既有指標已覆蓋。
- AI 自動化閉環變更必須確認 `/api/ai-automation/smoke``/ai_automation_smoke` 仍能反映新狀態。
- AI 自動化 Prometheus 指標變更必須同步檢查 `docker/grafana/provisioning/dashboards/json/ai-automation-overview.json` 是否需要新增 panel 或查詢。
- 188 線上 active monitoring stack 以 `monitoring/prometheus.yml` 為準110 gateway 另有 `/home/wooo/monitoring/prometheus.yml`。若 dashboard 無資料,先確認 Prometheus `momo-app` target 與 `momo-network` 連線;所有 Blackbox HTTP target 必須打 `/health`,不可打 Dashboard 首頁 `/`
- Smoke dashboard 會保存 JSONL 趨勢;若新增檢查項目,要確保 history compact record 仍保持小而可讀。
- Smoke history 管理只能操作 `MOMO_AI_AUTOMATION_SMOKE_HISTORY` 指向的 JSONL不得清理 DB 或 EventRouter queue。
- Smoke 每日摘要推播只讀 history不得重新執行 smoke也不得把完整 details 寫進 Telegram。
- L2 action 必須在 `SAFE_ACTIONS` 且可審計、可回放、低副作用。
- AutoHeal 不得 restart / stop / recreate `momo-db``momo-postgres`
- raw `ai_insights` 寫入後必須 enqueue embedding若 enqueue 失敗,必須可 backfill。
- ElephantAlpha 的 code/resource action 必須橋接 AutoHeal不直接執行危險副作用。
- Code review auto-fix 預設關閉critical/high 走 HITL。
## 收尾 checklist
- 相關測試至少覆蓋 EventRouter、AutoHeal、NemoTron fallback、OpenClaw embedding bridge、ElephantAlpha engine、agent_actions、AI automation metrics、AI automation smoke。
- 若有架構決策,新增 ADR 並更新 `docs/adr/README.md`
- 若有長期實況,更新 `docs/memory/*.md``docs/memory/README.md`
- 若 AI 架構事實改變,更新 `docs/AI_INTELLIGENCE_MODULE_SOT.md`
- 若 AI 自動化可觀測性改變,更新 Grafana provisioning JSON 與對應測試。
- 若 Codex 工作規則改變,更新 `AGENTS.md`;若紅線改變,更新 `CONSTITUTION.md`
- 提交前跑 `git diff --check` 與相關 pytest。
- 使用者要求推版時commit 後 push 到遠端。