Files
awoooi/docs/ARCHITECTURE_MEMORY.md
OG T 7478dc0254 feat(phase6-9): Complete modular architecture and Agent Teams
Phase 6.4 - Modular Architecture:
- Add lewooogo-brain adapters for LLM providers
- Add lewooogo-data dual memory (Redis + PostgreSQL)
- Implement consensus engine for multi-agent decisions
- Add incident memory service for historical context

Phase 9 - Agent Teams (Claude Agent SDK):
- Add base agent class with Claude Sonnet 4 integration
- Implement action planner, blast radius, and security agents
- Add agent API endpoints and proposal workflow
- Integrate ADR-009 OpenClaw Agent Teams architecture

DevOps & CI/CD:
- Add GitHub Actions CI/CD workflows (ci.yaml, cd.yaml)
- Add pre-commit hooks and secrets baseline
- Add docker-compose for local development
- Update Kubernetes network policies

Frontend Improvements:
- Add auto-healing error boundary component
- Update i18n messages for agent features
- Enhance dual-state incident card with execution feedback

Documentation:
- Add 7 ADRs covering MCP, design system, architecture decisions
- Update ARCHITECTURE_MEMORY.md with modular design
- Add GLOBAL_RULES.md and SOUL.md for project identity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-23 18:40:36 +08:00

4.7 KiB
Raw Blame History

AWOOOI 架構記憶地圖 (Architecture Memory)

AI 模組地圖索引 - 每次新增積木後必須登記

最後更新: 2026-03-23 (Phase 9 Agent Teams) 維護者: Claude Code + C-Suite


📦 Python 積木 (packages/)

積木名稱 職責 對外介面 狀態 ADR
lewooogo-brain Brain 積木 - AI 決策與提案引擎 IProposalEngine, IIncidentProcessor, Guardrails 已完成 ADR-008
lewooogo-data Data 積木 - 雙層記憶體 (Working + Episodic) IMemoryProvider, IDualMemoryProvider 已完成 ADR-008

lewooogo-brain 模組結構

packages/lewooogo-brain/
├── src/lewooogo_brain/
│   ├── interfaces/           # ABC 定義
│   │   ├── proposal_engine.py    → IProposalEngine
│   │   └── incident_processor.py → IIncidentProcessor
│   ├── engines/              # 推論引擎實作
│   │   ├── proposal_engine.py    # ✅ ProposalEngine 已完成
│   │   └── incident_engine.py    # ✅ IncidentEngine 已完成
│   ├── guardrails/           # 安全護欄
│   │   └── guardrails.py         # ✅ Guardrails 已完成
│   └── skills/               # Skill 動態載入
│       └── loader.py             # ✅ SkillLoader 已完成

lewooogo-data 模組結構

packages/lewooogo-data/
├── src/lewooogo_data/
│   ├── interfaces/           # ABC 定義
│   │   └── memory_provider.py    → IMemoryProvider, IDualMemoryProvider
│   └── providers/            # 具體實作
│       ├── redis_memory.py       # ✅ RedisMemoryProvider 已完成
│       ├── pg_memory.py          # ✅ PgMemoryProvider 已完成
│       └── dual_memory.py        # ✅ DualMemoryProvider 已完成

📦 TypeScript 積木 (packages/)

積木名稱 職責 對外介面 ADR
lewooogo-core 前端 Plugin 系統 LeWOOOgoPlugin, AgentProvider, DataAdapter ADR-003

🤖 Agent Teams (apps/api/src/agents/)

Phase 9 新增 - 專家 Agent 群組

Agent 名稱 職責 狀態 ADR
SecurityAgent 資安風險評估與威脅分析 已完成 ADR-009
BlastRadiusAgent 爆炸半徑影響範圍分析 已完成 ADR-009
ActionPlannerAgent 行動計畫制定與步驟規劃 已完成 ADR-009
ConsensusEngine 多 Agent 共識引擎 已完成 ADR-009

Agent Teams 模組結構

apps/api/src/agents/
├── __init__.py
├── base_agent.py             # Agent 基底類別
├── security_agent.py         # ✅ SecurityAgent 資安專家
├── blast_radius_agent.py     # ✅ BlastRadiusAgent 影響分析
├── action_planner_agent.py   # ✅ ActionPlannerAgent 行動規劃
└── consensus_engine.py       # ✅ ConsensusEngine 共識引擎

🔗 模組依賴關係

apps/api (FastAPI BFF)
    ├── agents/ (Agent Teams) ✅ Phase 9 專家群組
    │   └── lewooogo-brain (AI 積木)
    ├── lewooogo-brain (AI 積木) ✅ Phase 6.4 已完成
    │   └── lewooogo-data (資料積木)
    └── lewooogo-data (直接引用) ✅ Phase 6.4 已完成

apps/web (Next.js)
    └── lewooogo-core (TS 積木)

Docker Build 指令 (Phase 6.4i)

# 必須從 monorepo 根目錄執行
cd /path/to/awoooi
docker build -f apps/api/Dockerfile -t awoooi-api:latest .

📋 介面契約索引

Python 介面

介面 位置 職責
IProposalEngine lewooogo_brain.interfaces 決策提案生成
IIncidentProcessor lewooogo_brain.interfaces 事件聚合處理
Guardrails lewooogo_brain.guardrails 安全護欄與風險檢查
IMemoryProvider lewooogo_data.interfaces 單層記憶體存取
IDualMemoryProvider lewooogo_data.interfaces 雙層記憶體 (Working + Episodic)
BaseAgent apps.api.src.agents Agent 基底類別
ConsensusEngine apps.api.src.agents 多 Agent 共識協調

HTTP API 契約

端點 位置 職責
POST /api/v1/incidents/{id}/propose apps/api/src/api/v1/incidents.py 生成決策提案
GET /api/v1/incidents/{id} apps/api/src/api/v1/incidents.py 取得事件詳情

🚨 AI 開發者注意事項

  1. 新增積木前: 先讀取此檔案確認命名不衝突
  2. 新增積木後: 必須在此檔案登記職責與對外介面
  3. 修改介面前: 先讀取 docs/adr/ 確認架構決策
  4. 跨模組引用: 禁止直接 import必須透過介面抽象