编辑 | blame | 历史 | 原始文档

AI Agent System Suite

AI Agent System Suite 是一套面向 Codex 的仓库级 AI Agent Team 引导插件。它从目标仓库的真实代码、文档和约束出发,生成项目专属的 Agent、Skill、工作流与编排策略,并在独立暂存区完成验证后,以可回滚事务更新仓库中的受管内容。

当前套件版本为 3.0.0,契约版本为 1。

核心能力

  • 根据仓库证据初始化或完整重建 AI Agent Team。
  • 将仓库检查、系统设计、内容渲染和独立验证拆分为职责明确的阶段。
  • 生成最小且项目专属的 Agent、Skill、工作流 DAG 和 SubAgent 执行策略。
  • 在仓库外的暂存区生成候选内容,验证通过前不修改目标仓库。
  • 将运行 ID、蓝图 ID、候选摘要和清单绑定到同一次替换操作。
  • 保留根 AGENTS.md 中的人工内容及未被清单纳管的仓库 Skill。
  • 遇到所有权冲突、结构错误或未获准警告时停止替换。
  • 替换失败时执行补偿和回滚,保护现有 Agent Team。

工作流程

flowchart LR
    B["Bootstrap<br/>统一编排"] --> I["Inspect<br/>检查仓库与所有权"]
    I --> D["Design<br/>生成系统蓝图"]
    D --> R["Render<br/>写入独立暂存区"]
    R --> V["Validate<br/>结构与语义校验"]
    V -->|通过| T["Replace<br/>事务替换受管内容"]
    V -->|失败或阻塞| S["Stop<br/>保留现有内容"]
阶段 Skill 作用 写入范围
编排 ai-agent-system-bootstrap 管理完整运行、阶段顺序、验证门禁和最终替换 验证通过后写入目标仓库受管路径
检查 ai-agent-system-inspect 识别项目结构、技术约束、运行能力和现有内容所有权 只读
设计 ai-agent-system-design 将不可变的 ProjectSnapshot 转换为 SystemBlueprint 只读
渲染 ai-agent-system-render 按蓝图生成候选 Agent Team 仅暂存区
验证 ai-agent-system-validate 校验结构、语义、引用、并发写入边界和证据可追溯性 只读

design 和 render 是受编排器门控的内部阶段,缺少完整上游契约输入时会返回 blocked。inspect 与 validate 可独立用于只读检查。

生成内容与所有权

成功运行后,目标仓库中的受管内容如下:

<target-repository>/
├── AGENTS.md                         # 仅标记区块由套件管理
├── .ai/                              # 整个目录由套件管理
│   ├── bootstrap-manifest.json
│   ├── agents/
│   ├── workflows/
│   └── orchestration/
└── .agents/skills/<generated-skill>/ # 仅清单列出的 Skill 目录由套件管理

所有权规则:

  • .ai 在初始化完成后整体归套件管理。
  • .agents/skills 下仅 .ai/bootstrap-manifest.json 列出的目录归套件管理。
  • 根 AGENTS.md 中仅 AI-AGENT-SYSTEM 起止标记之间的内容归套件管理。
  • AGENTS.md 的其他文本、未列入清单的 Skill 和仓库其他文件保持原样。
  • 发现来源不明的 .ai、无效清单或未受管 Skill 路径冲突时,运行会在替换前停止。

使用方式

1. 加载插件

将 ai-agent-system-suite 目录作为 Codex 插件加载。插件入口清单位于 ai-agent-system-suite/.codex-plugin/plugin.json,Skill 发现目录为 ai-agent-system-suite/skills/。

2. 初始化或重建 Agent Team

在 Codex 中明确调用入口 Skill,并提供目标仓库的绝对路径和约束:

使用 $ai-agent-system-bootstrap,为 D:\path\to\repository 初始化 AI Agent Team。
保留现有人工 AGENTS.md 内容,不修改业务代码。

同一个入口会根据现有所有权证据选择 initialize 或 rebuild。运行完成后会返回运行 ID、生成组件数量、验证状态、已替换路径、人工内容保留状态和未解决风险。

3. 独立检查或验证

只读取仓库并生成项目快照:

使用 $ai-agent-system-inspect 检查 D:\path\to\repository,并输出 ProjectSnapshot。

只验证已安装的 Agent Team:

使用 $ai-agent-system-validate 验证 D:\path\to\repository 中现有的 Agent Team。

独立验证只生成报告,不授予替换权限。

仓库结构

ai-agent-system-suite/
├── .codex-plugin/plugin.json   # Codex 插件清单
├── bundle.yaml                 # 套件成员、流水线和全局规则
├── skills/                     # 五个阶段 Skill 及其 Codex 接口定义
├── shared/
│   ├── contracts/              # 阶段输入输出契约
│   ├── policies/               # 所有权、运行时和 SubAgent 策略
│   ├── schemas/                # Agent、Skill、工作流和编排结构规范
│   ├── templates/              # 渲染模板
│   └── scripts/                # 暂存、校验、清理和事务替换脚本
└── tests/                      # Python 单元测试与测试夹具

bundle.yaml 是套件执行规则的唯一清单,声明固定成员、阶段顺序、调用深度、写入门禁和所有权策略。插件清单负责 Skill 发现,不替代套件执行契约。

本地开发与验证

脚本仅使用 Python 标准库,无需安装额外依赖。当前仓库已在 Python 3.13 下验证。

在仓库根目录运行全部测试:

python -m unittest discover -s ai-agent-system-suite/tests -v

直接执行结构校验器:

python ai-agent-system-suite/shared/scripts/validate-structure.py `
  --root D:\path\to\candidate-or-installed-repository `
  --json

直接调用共享脚本时,应从对应 Skill 文件的位置解析套件根目录,并向脚本传入绝对目标路径。Bootstrap 流程已经统一处理暂存目录、摘要绑定、警告白名单、锁、替换和回滚。

设计约束

  • 阶段严格按 Inspect → Design → Render → Validate → Replace 顺序执行。
  • 所有阶段调用由 Bootstrap 统一调度,阶段 Skill 之间不直接互调。
  • 验证前不写入目标仓库,Render 是唯一的暂存区写入者。
  • 每个可写路径在同一阶段只有一个所有者,并行写入范围必须互不重叠。
  • 未知警告默认拒绝;只有当前 BootstrapRun 明确允许的警告代码可进入替换阶段。
  • 替换是跨多个受管路径、带回滚的事务流程,不声明为文件系统级原子重命名。

详细行为以各 Skill、共享契约、策略和结构规范为准。

README 7 KB
ai-agent-system-bootstrap/README 5 KB
ai-agent-system-bootstrap/shared/contracts/bootstrap-run 1 KB
ai-agent-system-bootstrap/shared/contracts/project-snapshot 2 KB
ai-agent-system-bootstrap/shared/contracts/render-result 754 b
ai-agent-system-bootstrap/shared/contracts/system-blueprint 2 KB
ai-agent-system-bootstrap/shared/contracts/validation-report 1 KB
ai-agent-system-bootstrap/shared/policies/agent-team-design 3 KB
ai-agent-system-bootstrap/shared/policies/default-minimal-system 1,015 b
ai-agent-system-bootstrap/shared/policies/generated-team-runtime 2 KB
ai-agent-system-bootstrap/shared/policies/orchestration-scaling 1 KB
ai-agent-system-bootstrap/shared/policies/ownership-and-rebuild 3 KB
ai-agent-system-bootstrap/shared/policies/subagent-execution 2 KB
ai-agent-system-bootstrap/shared/schemas/agent-definition 881 b
ai-agent-system-bootstrap/shared/schemas/agents-md 799 b
ai-agent-system-bootstrap/shared/schemas/orchestration-definition 2 KB
ai-agent-system-bootstrap/shared/schemas/skill-definition 844 b
ai-agent-system-bootstrap/shared/schemas/workflow-definition 905 b
ai-agent-system-bootstrap/shared/templates/AGENTS 3 KB
ai-agent-system-bootstrap/shared/templates/agent 844 b
ai-agent-system-bootstrap/shared/templates/context-policy 921 b
ai-agent-system-bootstrap/shared/templates/execution-policy 1 KB
ai-agent-system-bootstrap/shared/templates/merge-policy 787 b
ai-agent-system-bootstrap/shared/templates/skill.SKILL 537 b
ai-agent-system-bootstrap/shared/templates/subagent-contract 544 b
ai-agent-system-bootstrap/shared/templates/workflow 1 KB
ai-agent-system-bootstrap/shared/traceability/original-behavior-map 3 KB
ai-agent-system-bootstrap/skills/ai-agent-system-bootstrap/SKILL 6 KB
ai-agent-system-bootstrap/skills/ai-agent-system-design/SKILL 5 KB
ai-agent-system-bootstrap/skills/ai-agent-system-inspect/SKILL 4 KB
ai-agent-system-bootstrap/skills/ai-agent-system-render/SKILL 4 KB
ai-agent-system-bootstrap/skills/ai-agent-system-validate/SKILL 5 KB
ai-agent-system-suite/shared/contracts/bootstrap-run 1 KB
ai-agent-system-suite/shared/contracts/project-snapshot 1 KB
ai-agent-system-suite/shared/contracts/render-result 881 b
ai-agent-system-suite/shared/contracts/system-blueprint 1 KB
ai-agent-system-suite/shared/contracts/validation-report 1 KB
ai-agent-system-suite/shared/policies/default-minimal-system 891 b
ai-agent-system-suite/shared/policies/generated-team-runtime 2 KB
ai-agent-system-suite/shared/policies/ownership-and-rebuild 3 KB
ai-agent-system-suite/shared/policies/subagent-execution 2 KB
ai-agent-system-suite/shared/schemas/agent-definition 881 b
ai-agent-system-suite/shared/schemas/agents-md 781 b
ai-agent-system-suite/shared/schemas/orchestration-definition 921 b
ai-agent-system-suite/shared/schemas/skill-definition 856 b
ai-agent-system-suite/shared/schemas/workflow-definition 909 b
ai-agent-system-suite/shared/templates/AGENTS.generated 3 KB
ai-agent-system-suite/shared/templates/agent 848 b
ai-agent-system-suite/shared/templates/context-policy 931 b
ai-agent-system-suite/shared/templates/execution-policy 1 KB
ai-agent-system-suite/shared/templates/merge-policy 787 b
ai-agent-system-suite/shared/templates/skill.SKILL 537 b
ai-agent-system-suite/shared/templates/subagent-contract 544 b
ai-agent-system-suite/shared/templates/workflow 1 KB
ai-agent-system-suite/skills/ai-agent-system-bootstrap/SKILL 7 KB
ai-agent-system-suite/skills/ai-agent-system-design/SKILL 4 KB
ai-agent-system-suite/skills/ai-agent-system-inspect/SKILL 3 KB
ai-agent-system-suite/skills/ai-agent-system-render/SKILL 4 KB
ai-agent-system-suite/skills/ai-agent-system-validate/SKILL 4 KB
ai-agent-system-suite/tests/fixtures/existing-agent-team/AGENTS 147 b
ai-agent-system-suite/tests/fixtures/human-owned-agents-md/AGENTS 87 b
ai-agent-system-suite/tests/fixtures/invalid-agent-team/.agents/skills/bad-skill/SKILL 103 b