Validate Loop
The Validate Loop is the quality gate before a PR is opened. It runs a more thorough check than the Dev Loop validators: a three-part review covering ticket completeness, code quality, and security.
What it does
The validate skill runs a structured quality gate:
- Ticket completeness: checks the spec, acceptance criteria, and tasks are complete
- Code quality: reviews the diff against codebase patterns, style, and naming conventions
- Security: scans for vulnerabilities introduced by the change
The output is a structured report with a clear READY FOR PR or NEEDS WORK verdict.
How to start it
The Validate Loop fires automatically when the Dev Loop completes. You can also run it manually:
/dmx/run-loop validateThe human gate
After validate runs, the loop pauses. Review the validation report. If it says NEEDS WORK, address the findings before continuing.
When you're satisfied:
/dmx/loop-continueThe Validate Loop validators run (tests and spec adherence again as a final confirmation), then the loop chains to the Release Loop.
When a check fails
The bundled Validate Loop turns on rework. When a required check fails, dmx adds a phase to tasks.md with one task per failed check, such as:
## Phase 4: Rework — validate, round 1
From the failed `validate` run `3f9c2a1b`. dmx wrote these tasks from the failed checks; edit them before the rework starts.
- [ ] Fix `tests_pass` (run_tests): Tests failed — ran `uv run pytest -q` (exit 1)
- `uv run pytest -q` (exit 1)
- FAILED tests/test_refunds.py::test_partial_refund - AssertionError
- [ ] Fix `scope_matches_spec` (spec_adherence): Scope item(s) with no evidence in the diff: Refund endpoint
- Missing scope item: Refund endpointThe loop pauses so you can review and edit the tasks. /dmx/loop-continue starts the Dev Loop on that phase. When it finishes, the Validate Loop runs again from the validate skill, so the report is regenerated at the new HEAD before it's graded. After two rounds that still fail, the loop pauses with each round's findings.
A failure that isn't a code task, such as a missing toolchain or a stale report, pauses as before. A dmx setup change you asked for during the ticket, such as a component's test command, is recorded in the spec's Scope when it's made, so the review counts it as scope rather than scope creep. To turn rework off, copy validate.yaml into .dmx/loops/ and remove its rework block.
Validators
The Validate Loop runs the tests again, then checks the change against the spec, as a final check before the PR opens.
run_tests
| Check | Required |
|---|---|
tests_pass | Yes |
spec_adherence
| Check | Required |
|---|---|
scope_matches_spec | Yes |
no_regressions | Yes |
spec_adherence runs only in this loop, because it grades the report the validate skill writes. The no_regressions check reads the regressions list in the validation-report.json that the validate skill writes to .dmx/jobs/{job_id}/, and fails if that list is non-empty.
Loop config
name: validate
skills:
- validate
trigger:
type: on_complete
goal_state: "All required checks pass, code reviewed, ready for PR"
validators:
- tool: run_tests
timeout_seconds: 630
checks:
- name: tests_pass
required: true
- tool: spec_adherence
checks:
- name: scope_matches_spec
required: true
- name: no_regressions
required: true
on_optional_failure: warn
failure_handling: pause
human_gate: true
on_complete:
on_success:
trigger_loop: release
on_failure:
rework:
loop: dev
max_rounds: 2
approve: trueExtending the Validate Loop
The validate skill covers ticket completeness, code quality, and basic security. For production teams, you'll want additional validators:
- A real security scanner (Bandit, Semgrep, Snyk)
- A coverage threshold check
- A lint or format check
- An LLM-backed spec adherence check
Override these by replacing validators/spec_adherence.py or adding new validators to your loop config. See Writing Validators.
Tips
Read the NEEDS WORK report. When validate returns NEEDS WORK, it's a structured report with specific findings. These are the things a human reviewer would catch. Don't skip them.
The Validate Loop is not the only gate. The Dev Loop should catch test failures. The Validate Loop is where you catch what the Dev Loop misses: security issues, scope creep, code quality problems.