Done is a proof. Not a feeling.
45% of AI-generated code ships at least one OWASP Top 10 flaw. The same spec generates different code on different runs. "It works on my machine" is not convergence. Six binary gates must all pass — simultaneously — for the Living Blueprint to declare a version converged. Schema matches spec entities. All acceptance criteria have test coverage. Every guard rule is wired to every endpoint it covers. Zero unguarded routes. Zero protocol violations. All must be true. All must stay true.
Convergence Gates
0 / 6
Type Safety
0 type errors — compiler verifies every interface
Structural Consistency
12/12 spec nodes accounted for in generated code
Data Flow
CPG analysis — component A writes user_id, B reads user_id
Endpoint Coverage
8/8 spec endpoints have route handlers — 100%
Guard Application
3/3 guard rules applied to covered endpoints
Integration Agreement
FE and BE agree on every shared interface
Verification Report
Violation Distance
The 11-term violation distance metric scores every gap as a numbered distance from convergence. Zero means every condition is satisfied.
The 6 convergence gates
Every gate is binary. All 6 must pass simultaneously. One failing gate holds the entire graph non-converged.
Every spec node has at least one bridge edge to an impl or code node. Zero unimplemented spec nodes allowed.
Zero nodes with staleness STALE or INVALID. Code that changed since its spec was written is stale — stale means non-converged.
Every acceptance criterion node has at least one test node linked to it. Uncovered criteria hold the gate open.
Every guard rule has both positive and negative test cases. Happy-path-only coverage is treated as no coverage.
Zero unguarded endpoints. Every API route must have at least one auth, rate-limit, or validation guard applied and wired.
Zero unresolved gap_protocol_violation nodes — Inngest functions mutating state outside a step, routes missing middleware, and similar structural failures.
Violation distance and the CEGIS retry loop
When a gate fails, the system tells you exactly how far from passing — and drives the fix loop automatically.
Each failed gate produces a structured w′(G) distance score. Not "build failed" — "3 unimplemented spec nodes, 1 unguarded endpoint, criterion coverage at 87%." The distance must strictly decrease each retry iteration.
Given the open gap list and each gap's estimated resolution effort, the system projects when convergence will be achieved — updated in real time as gaps close.
Counter-example guided inductive synthesis. When codegen fails a gate, the system generates counter-examples from the violation distance and drives the Code Engine to retry. The loop runs until all 6 gates pass or the distance stops decreasing.