schema: agent-buildprint/phases.v3
canonical_start: BUILDPRINT.md
phases:
  - id: 00-safety-boundaries
    title: Safety and Boundaries
    inputs: [BUILDPRINT.md, policies/safety.md, plans/00-safety-boundaries.md]
    must_produce:
      - source read boundary
      - output write boundary
      - secret handling rule
    must_pass:
      - source project is not modified
      - no secret values are copied

  - id: 01-repo-census
    title: Safe Census
    inputs: [plans/01-repo-census.md, policies/quality.md]
    must_produce:
      - file tree and manifest hints
      - dependency/framework/script/deploy/test/env-name hints
      - CENSUS_HINT or PENDING_AGENT_DISCOVERY states only
    must_pass:
      - no product behavior, absence, parity, provider, or persistence claims

  - id: 02-behavior-discovery
    title: Behavior Discovery
    inputs: [plans/02-system-map.md, CONTRACTS.md]
    must_produce:
      - behavior inventory
      - promoted claim register
      - source evidence paths and lines or sections
    must_pass:
      - every OBSERVED claim has evidence
      - unresolved behavior remains QUESTION or BLOCKED

  - id: 03-candidate-selection
    title: Candidate Selection
    inputs: [plans/03-candidate-buildprints.md, plans/04-scope-decision.md, questions.md]
    must_produce:
      - selected candidate, explicit scope, full-suite target, or discovery-only blocker
      - readiness classification across the requested/selected surface
    must_pass:
      - no silent scope shrinkage
      - no placeholder replacement for explicit scope cuts

  - id: 04-source-distillation
    title: Source Distillation
    inputs: [prompts/extract-selected.md, templates/]
    must_produce:
      - source-independent selected-buildprint executable Buildprint
      - product obligations
      - proof-gated phase packets
      - stable-vs-free boundaries
      - BUILDPRINT-first read order with BUILDPRINT.md, 01-questions.md, 02-project-setup.md, blueprint.yaml, and 03-phases/phase-index.yaml before active phase loading
    must_pass:
      - selected output stays under selected-buildprint/
      - medium/large/full-suite output is hierarchical
      - medium/large/full-suite output includes 03-phases/phase-index.yaml
      - medium/large/full-suite output includes at least one phase markdown file
      - medium/large/full-suite output includes 05-evidence/evidence-ledger.jsonl and 05-evidence/evidence-ledger.schema.json
      - phase packets include proof gates, stop rules, implementation loop, repair routing, and unlock policy
      - obsolete selected-output spine files are absent
      - fragmented per-capability mini-files are absent
      - typo alias files such as VERFICATION.md are absent

  - id: 05-execution-planning
    title: Downstream Execution Planning
    inputs: [prompts/extract-selected.md, templates/executable-packet/]
    must_produce:
      - first active phase without hiding later work
      - first verification gate per included phase
      - implementation-team signals for downstream harness selection
      - repair-loop and stop/escalation rules
    must_pass:
      - implementing agent does not need to infer critical order, builder passes, or gates
      - implementing agent can start from BUILDPRINT.md and 03-phases/phase-index.yaml without reading all Markdown files, all phase packets upfront, or unrelated phases

  - id: 06-qualification
    title: Qualification
    inputs: [VERIFICATION.md, plans/07-validation-submission.md]
    must_produce:
      - gate results or blockers
      - no-fake scan result
      - hardening evidence when required
      - reversal or QA evidence when required
    must_pass:
      - qualification label is honest
      - public wording is not misleading
      - selected output shape validation passes or blockers are recorded
