Skip to content

The 36 Machine-Enforced Definition of Done (DoD) Quality Gates

In Nomos OS, Definition of Done (DoD) is not a human checklist or an LLM self-attestation prompt. It is a compiled Go verification harness that enforces 36 deterministic pass/fail gates across AST structure, phase discipline, security boundaries, and test coverage.


🛡️ The 36 Quality Gate Registry


🔍 Detailed Gate Specifications

1. Phase Discipline & Cryptographic Locks

  • Phase Discipline Gate: Verifies that workspace source code cannot be mutated outside the EDIT phase.
  • Task ID Validation Gate: Ensures the active git branch maps 1-to-1 with an open task registered in SQLite (~/.nomos/data/db/nomos_global.db).
  • Data Integrity Gate: Validates that workspace JSON state signatures match compiled Go schema hashes.

2. AST Complexity & Code Quality

  • Cyclomatic Complexity Gate: Parses the AST of all modified Go functions. Any function with cyclomatic complexity $\ge 15$ causes an immediate gate failure requiring structural refactoring.
  • Comment Density Gate: Checks that all modified source files maintain genuine descriptive docstrings covering $\ge 10%$ of lines. Boilerplate or copied comments are flagged and blocked.
  • AST Magic String Detector: Flags untyped string literals embedded directly inside business logic functions, requiring extraction into typed constants.

3. Open-Core & Proprietary Boundaries

  • Open-Core Boundary Guard: Scans staged diffs in open-source repositories (nomos) to ensure proprietary sovereign code (e.g. Swarm delegation, Nomos Code orchestrators) never leaks into open-source distributions.

4. Wire Integrity & Dead Code

  • Dead Code Detector: Flags unused functions, orphaned types, and unreferenced endpoints across the repository graph.
  • Broken Wire Detector: Ensures that any newly added CLI commands, handlers, or RPC interfaces are explicitly wired in the root command registry.

⚡ Running Verification

To execute the entire 36-gate suite across modified files in your worktree:

bash
nomos verify

All 36 gates must evaluate to PASSED before nomos task sync will permit release execution.