# 07 — AI Agent / MCP Completion ## Agent architecture ```text Intent → Context Discovery → Plan → Risk → Approval → Execute → Verify → Report ``` ## Tool registry 每个 tool 必须包含: - name - description - input schema - output schema - required permissions - risk level - idempotency behavior - audit event ## V1 必须支持的 AI 场景 1. “列出所有服务器和当前状态。” 2. “查看 blog 项目最近一次部署。” 3. “分析为什么网站不可用。” 4. “部署 blog 到指定服务器。” 5. “重启异常容器。” 6. “创建任务记录这个问题。” 7. “把这个事件配置成自动化。” ## Approval LOW read-only 可直接执行。 MEDIUM 根据 policy。 HIGH/CRITICAL 必须二次确认。 审批内容必须显示: - 操作 - 资源 - 影响 - 参数摘要 - 风险 ## Verification 任何 mutation tool 都应该定义 verify handler。 例如 deployment.run → deployment.status + health.check。 ## Memory V1 先做短期运行上下文 + resource references,不要过早建设复杂向量数据库。 ## MCP MCP 是 DevOS Tool Registry 的 adapter。 REST、Web UI、Agent、MCP 必须共享 application service。 禁止 MCP 直接访问 Prisma。