Gate-as-Code
Since v0.8.6, Gate-as-Code describes “when is this task green?” in a portable TOML file — the same predicate library used by the night queue, skill stage gates, and LHT verify.
What it is
- One TOML:
[[verify]]rows plus optionalverify_budget/rollback. - Each row is a predicate:
exit_code,tests_pass,file_exists,file_count,command_output_matches, … - Skill-side
harness.toml(stage gate) and flat gate files share the same schema.
Maintainer spec: docs/harness/gates/ in the product repo.
CLI
zagens gate validate --preset rust-cargo-smoke
zagens gate validate --file path/to/my-gate.toml --json
zagens gate list
Attach a gate when enqueueing:
zagens queue add "fix tests" --gate-preset rust-cargo-smoke
zagens queue add "check" --gate-file ./gates/my.toml
See Night queue.
Flat gate example
schema_version = 1
[harness]
id = "my-team-rust-gate"
description = "Compile and test before merge."
[verify_budget]
max_retries = 2
timeout_ms = 600000
[rollback]
strategy = "snapshot"
[[verify]]
id = "compile"
predicate = "tests_pass"
args = { toolchain = "cargo", cmd = "cargo check" }
[[verify]]
id = "tests"
predicate = "tests_pass"
args = { toolchain = "cargo", cmd = "cargo test" }
Relation to LHT / skills
| Surface | How gates attach |
|---|---|
| Night queue | --gate-preset / --gate-file / inline --gate |
| Skill stage gate | harness.toml next to the skill, or [long_horizon.stage_gate].manifest |
| LHT completion gate | Panel / presets still configure verify; presets like long-refactor / long-fix write product gates in enforce mode |
Desktop Agent health and zagens doctor --tools aggregate gate/verify telemetry.
Tips
- Keep shared gates in-repo under
gates/for CI and night queue. - Start from a bundled preset, then customize.
- On failure, inspect
.zagens/queue_events.jsonland handoff before relaxing predicates.
Related: Night queue · LHT · LHT settings · Agent health · CLI