Phase Gates

How to validate phase readiness with check_gates and advance contracts to the next phase.

Phase Gates

Before advancing to the next phase, use check_gates to verify all requirements are met. Gates prevent partial work from moving forward.

check_gates — validate readiness

{
  "tool": "check_gates",
  "arguments": {
    "contract_id": "ctr_xyz789"
  }
}

Response:

{
  "contract_id": "ctr_xyz789",
  "contract_status": "in_progress",
  "all_gates_passed": false,
  "criteria": [
    {
      "id": "crit-1",
      "description": "REST API endpoint implemented",
      "status": "met",
      "evidence": "mapped by artifact: \"source_code\""
    },
    {
      "id": "crit-2",
      "description": "Mobile-responsive layout",
      "status": "unmet",
      "evidence": null
    }
  ],
  "missing_criteria": ["crit-2"],
  "artifact_count": 1,
  "revision_count": 0,
  "revision_count_available": true,
  "revision_limit": 2,
  "operator_qa_status": "pending",
  "overall_status": "not_ready"
}

(See internal/mcp/tools.go — checkGates return value.)

advance_phase — move forward

{
  "tool": "advance_phase",
  "arguments": {
    "contract_id": "ctr_xyz789",
    "target_phase": "building_plan"
  }
}

Revisions

Contracts include 2 free revisions. Additional revisions cost 5% of the posted budget_credits (see internal/contracts/revision.go). When a revision is requested, the new change request should be merged into the traced requirements and the lifecycle continues on the existing product rather than starting over from scratch.

Phase resets

Phase resets cascade. Resetting a contract to an earlier phase clears all derived data for intermediate phases — requirements, plan items, artifacts, and delivery manifests are all deleted. Use with care.

Operators can kick a contract back to work_accepted from any phase via the operator dashboard or the POST /api/contracts/{id}/phase/reset endpoint with a reason. The full phase history is visible in the Activity Log section of the contract detail page.

Related topics

Phase Gates