Quality Gate Contract

This contract defines the default quality gate for mutation and shipping skills. It exists to make implementation quality diff-aware, evidence-based, and hard to satisfy with task bookkeeping alone.

Scope

Apply this contract to every non-trivial mutation before commit, push, deploy, or handoff as "done".

A mutation is non-trivial when it meets any of these conditions:

A mutation can be treated as trivial only when it is limited to a narrow text fix, task checkbox, typo, formatting-only edit, or documentation-only clarification that does not alter executable behavior or workflow policy. When in doubt, treat the work as non-trivial.

Required Flow

Non-trivial mutations must pass this sequence:

  1. Plan: State scope, non-goals, risks, files expected to change, and verification commands before editing.
  2. Implement: Keep the diff to the smallest coherent change. Avoid opportunistic refactors and unrelated cleanup.
  3. Self-review: Walk through each changed file and ask what could be wrong, including missed edge cases, stale assumptions, and accidental scope growth.
  4. Quality sweep: Run a targeted quality-sweep audit, $expert-review, reviewer/subagent lane, or explicitly justified equivalent adversarial review before commit or push.
  5. Verification: Run executable checks that match the risk. Use manual or visual checks where they are the meaningful proof. Documentation-only or task-only checks are not enough for source changes.
  6. Ship manifest: Record the commit boundary, changed files, evidence, residual risk, and next command before shipping.

Ship Manifest

Every non-trivial mutation needs a manifest with these fields:

For unrelated pre-existing worktree changes, the manifest must separate ownership. It must state which changes are included in the ship boundary, which are left untouched, and why committing or pushing is still safe. If that boundary cannot be proven, stop instead of shipping.

Skipped-Test Standard

Skipped tests are acceptable only when the manifest explains why the check was not useful, unavailable, redundant with stronger evidence, or blocked by an external dependency. "Not run" by itself is not a rationale.

Examples of acceptable skipped-test rationales:

Residual-Risk Standard

Residual risk must be specific enough for the next operator to act on. Avoid generic statements such as "low risk" without evidence.

Good residual-risk entries identify:

If no meaningful residual risk remains, state why based on the checks run.

Adversarial Review

The review must be failure-oriented. It should look for ways the diff could satisfy the checklist while still missing the user goal or harming existing behavior.

Use the smallest review method that matches the risk:

The review is not complete until findings are either fixed or explicitly accepted in the manifest as residual risk.

Platform executors may impose a stricter independent-review and disposition contract. Codex workflows apply the platform-specific convention in docs/codex-accountable-agent-workflow.md; this shared contract remains platform-neutral.

User Corrections

When the user corrects the agent, update tasks/lessons.md with the repeatable pattern before shipping any related work. The lesson must name the behavior to avoid, the preferred replacement behavior, and the trigger that should make future agents apply it.

User corrections are presumed repeatable until the ship manifest proves otherwise. A correction follow-up must not be committed or pushed unless the exact shipping boundary includes:

Treat repeated mistakes in planning, blocker routing, verification, commit/push behavior, deployment handling, or next-step routing as workflow failures unless the manifest proves otherwise. If an enforcement update would apply but cannot be shipped in the same boundary, stop unless the manifest includes Correction enforcement: with the blocker, why it cannot be encoded now, and the concrete follow-up file or command that will close it.

If claiming the correction is already covered by an existing rule, cite the exact file and rule, script, fixture, or test, and explain why it would have prevented the corrected behavior. A final-response rationale is acceptable only for non-shipping review or advice work where no commit or push occurs; mutation shipping requires the rationale in the pre-commit ship manifest.

Corrections should not stop at memory. The quality gate should turn repeated mistakes into enforceable workflow changes whenever practical.

Issue-Backed Delivery Compatibility

This contract supplies the proof required by docs/github-delivery-contract.md; it does not replace that lifecycle. Tracked mutations use an issue-backed non-primary branch and stop at a ready pull request unless the user separately invokes the confirmed merge action.

For issue-backed delivery: