Skip to content

Guardrails YAML

Guardrails are quality gates that every agent must pass before creating a PR. They are defined as YAML files in .cate/guardrails/. To set up or modify your project’s guardrails, see Set guardrails. This page is the YAML schema reference.

Every agent that produces code — work tasks, bug fixes — reads all .yml files in .cate/guardrails/ and executes each gate’s command before creating a PR. Gates run twice: once during implementation (for fast feedback) and once fresh before PR creation (to catch regressions from upstream sync). If a required gate fails, the agent fixes the issue and re-runs until it passes.

Pair agents do not run guardrails automatically, but you can ask them to at any point during the session.

  • Testing (mandatory) — Unit tests, integration tests, coverage thresholds. At least one testing gate must exist. Agents will not start working until a testing gate is defined.
  • Formatting and linting — Code style enforcement (Prettier, ESLint, Black, rustfmt, etc.)
  • Static analysis and security — Dependency audits, vulnerability scanning, static analyzers
  • Build verification — Full production build must succeed
name: testing
required: true
description: 'All tests must pass before creating a PR'
gates:
- name: 'unit-tests'
command: 'npm test'
pass-condition: 'exit-code-zero'
description: 'Run unit and integration tests'
run: 'before-pr'
- name: 'coverage'
command: 'npm test -- --coverage --coverageThreshold="{\"global\":{\"lines\":80}}"'
pass-condition: 'exit-code-zero'
description: 'Enforce 80% line coverage'
run: 'before-pr'
testing.yml
name: testing
required: true
description: "Gradle tests must pass"
gates:
- name: "test"
command: "./gradlew test"
pass-condition: "exit-code-zero"
description: "Run JUnit tests via Gradle"
run: "before-pr"
- name: "spotless"
command: "./gradlew spotlessCheck"
pass-condition: "exit-code-zero"
description: "Check code formatting with Spotless"
run: "before-pr"
testing.yml
name: testing
required: true
description: "pytest must pass with 80% coverage"
gates:
- name: "pytest"
command: "pytest --cov=src --cov-fail-under=80"
pass-condition: "exit-code-zero"
description: "Run tests with coverage threshold"
run: "before-pr"
- name: "black"
command: "black --check ."
pass-condition: "exit-code-zero"
description: "Check formatting with Black"
run: "before-pr"
testing.yml
name: testing
required: true
description: "Cargo tests and clippy must pass"
gates:
- name: "test"
command: "cargo test"
pass-condition: "exit-code-zero"
description: "Run all tests"
run: "before-pr"
- name: "clippy"
command: "cargo clippy -- -D warnings"
pass-condition: "exit-code-zero"
description: "Run clippy with warnings as errors"
run: "before-pr"
- name: "fmt"
command: "cargo fmt --check"
pass-condition: "exit-code-zero"
description: "Check formatting with rustfmt"
run: "before-pr"

Each guardrail category gets its own YAML file at .cate/guardrails/<category>.yml:

name: testing
required: true
description: "Unit and integration tests must pass"
gates:
- name: "unit-tests"
command: "npm test"
pass-condition: "exit-code-zero"
description: "Run the full test suite"
run: "before-pr"
FieldTypeDescription
namestringCategory name
requiredbooleanIf true, all gates in this category must pass before a PR is created. If false, failures are reported but don’t block the PR.
descriptionstringWhat this category checks
FieldTypeDescription
namestringGate name, used in reporting and error messages
commandstringShell command to run
pass-conditionstringHow to determine success. Currently only "exit-code-zero".
descriptionstringWhat this specific gate checks
runstringWhen to run: "before-pr", "before-commit", or "in-review"