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

---
name: ai-agent-system-bootstrap

description: Initialize or completely rebuild a repository-specific AI Agent Team, including root AGENTS.md routing, project-local Agents and Skills, workflow DAGs, and selective SubAgent orchestration. Use for explicit Agent Team bootstrap or regeneration; treat generated .ai content as replaceable output rather than incrementally optimizing the previous team.

AI Agent System Bootstrap

Run the plugin suite as the sole orchestrator. Produce a new Agent Team from current repository evidence, write it directly into the repository, then validate the managed output in place.

Required suite material

Read these files before dispatching a phase:

Use only the four companion Skills declared in bundle.yaml. Keep dispatch centralized here; a phase Skill returns its result to this orchestrator and does not call a sibling.

Resolve <suite-root> from this SKILL.md location before running a suite script. Invoke the resolved absolute script path; do not resolve script paths from the target repository working directory.

The global-Skill restriction generated into a target repository governs that repository's future Agent Team. It does not constrain this explicitly invoked suite from dispatching its declared companion Skills.

Pipeline

Skill selection and thread selection are separate decisions. Execute the phases strictly in pipeline order:

  • For an inline phase, load and follow the named companion Skill in the current thread.
  • For an isolated phase, start a SubAgent with the stable phase input and explicitly require the named companion Skill in its task brief.
  • Run Inspect inline for small repositories or in a read-only SubAgent for broad discovery.
  • Run Design inline by default; isolate it read-only only when context separation materially improves the design pass.
  • Run Render as the single repository writer; never run it concurrently with another writer.
  • Run Validate in an independent read-only SubAgent when the runtime supports it; otherwise run it inline after Render completes.

Using a companion Skill alone does not create a SubAgent. No phase may begin before its declared input artifact is complete.

1. Open the run

Create a BootstrapRun with an absolute repository root, mode: pending, suite version, unique run ID, explicit user constraints, and explicit exclusions. Inspect resolves ownership before the orchestrator sets the final mode.

Completion criterion: the run identifies one repository, the pending mode state, the exact user request, and no unresolved target-path ambiguity.

2. Inspect

Dispatch ai-agent-system-inspect with the run. Require a complete ProjectSnapshot; keep the user's scope immutable while allowing Design to expand or confirm repository evidence with explicit traceability.

Completion criterion: the snapshot covers every source category required by its contract and classifies existing AGENTS.md and .ai ownership. Resolve BootstrapRun.mode exactly once from that classification.

3. Design

Dispatch ai-agent-system-design with the immutable snapshot, whose request block carries the verbatim user request and constraints. Require one SystemBlueprint that is the sole design input for rendering and semantic validation.

Completion criterion: every responsibility domain, generated Agent, local Skill, workflow, adaptive orchestration rule/policy, managed path, and root routing rule appears in the blueprint with no unresolved writer overlap or overloaded general Agent.

4. Render in the repository

Dispatch ai-agent-system-render with the BootstrapRun and blueprint. Rendering writes the generated .ai tree and the managed block in root AGENTS.md directly under BootstrapRun.repository_root.

Completion criterion: RenderResult accounts for every generated file and reports no write outside the managed repository paths.

5. Validate

Dispatch ai-agent-system-validate with the BootstrapRun, immutable ProjectSnapshot, blueprint, and render result. Validate BootstrapRun.repository_root. Before accepting the report, require its run ID, input snapshot-derived blueprint ID, input render result ID, validated run ID, validated blueprint ID, and candidate digest to match the current run artifacts. Accept passed. Accept passed-with-warnings only when every warning code appears in BootstrapRun.allowed_warning_codes.

Completion criterion: structural and semantic validation both finish and the report contains a final decision.

Failure handling

  • Stop when a phase returns blocked or failed.
  • Treat an existing unrelated .ai directory or malformed ownership marker as blocking evidence before Render starts.
  • If Render or Validate fails after writes begin, report the exact files already changed and the failed gate. Do not claim initialization or rebuild succeeded.
  • Report partial phase results and the exact failed gate. Do not claim initialization or rebuild succeeded.

Final output

Return:

  • run ID and mode
  • generated Agent, Skill, workflow, and policy counts
  • validation status and accepted warning codes
  • generated managed paths
  • preserved human-owned AGENTS.md status
  • unresolved risks or blocking evidence