Agent quality gates and review
Quality gate order
hatch run formathatch run type-checkhatch run linthatch run yaml-linthatch run check-bundle-importshatch run verify-modules-signature --payload-from-filesystem --enforce-version-bump(add--require-signaturewhen checking as formain; matches CI andscripts/pre-commit-verify-modules-signature.sh)hatch run contract-testhatch run smart-testhatch run testhatch run specfact code review run --bug-hunt --json --out .specfact/code-review.json(always pass--bug-hunton manual runs so CrossHair uses bug-hunt timeouts; full-repo scope when required: add--scope full; machine-readable evidence lives at.specfact/code-review.jsonand unresolved findings block merge unless an explicit exception is documented)
Pre-commit order
- Module signature verification via
scripts/pre-commit-verify-modules-signature.sh(.pre-commit-config.yaml;fail_fast: trueso a failing earlier hook never runs later stages). The hook adds--require-signatureon branchmain, or whenGITHUB_BASE_REFismain(PR target in Actions); otherwise it runs the baseline--payload-from-filesystem --enforce-version-bumpverifier (same formal policy as PRs targetingdev). - Block 1 — four separate hooks (each flushes pre-commit output when it exits, so you see progress between stages):
pre-commit-quality-checks.sh block1-format(always),block1-yamlwhen staged*.yaml/*.yml,block1-bundle(always),block1-lintwhen staged*.py/*.pyi. - Block 2 —
pre-commit-quality-checks.sh block2(skipped for “safe-only” staged paths):hatch run python scripts/pre_commit_code_review.py …on staged paths underpackages/,registry/,scripts/,tools/,tests/, andopenspec/changes/(excludingTDD_EVIDENCE.md), thencontract-test-status/hatch run contract-test.
Run the full pipeline manually with ./scripts/pre-commit-quality-checks.sh or … all.
SpecFact code review JSON
- Treat
.specfact/code-review.jsonas mandatory evidence before an OpenSpec change is complete. - Re-run the review when the report is missing or stale.
- Resolve every finding at any severity unless a rare, explicit exception is documented.
- Record the review command and timestamps in
TDD_EVIDENCE.mdor the PR description when quality gates are part of the change.
Clean-code review gate
The repository enforces the clean-code charter through specfact code review run. When agents or developers invoke the review manually (outside the pre-commit helper), include --bug-hunt so the contract runner gives CrossHair the longer bug-hunt budgets documented in the code-review bundle. Zero regressions in naming, kiss, yagni, dry, and solid are required before merge.
Module signature gate
Any change that affects signed module assets or manifests must pass the signature verification command above. If verification fails because bundle contents changed, re-sign the affected manifests and bump the module version before re-running verification.