Gate AI-written code
validate_ai_outputGate AI-written code with a binary verdict: reject unsafe, mocked, or invented-API code, and score performance, scalability, reliability, and tech debt via a frontier-model review.
Instructions
The merge gate for AI-written CODE: returns a binary approve/reject verdict with veto power — e.g. it rejects code calling the nonexistent stripe.Inventory API, or an N+1 loop with the latency arithmetic to prove it. Deterministic reality gates (mock/placeholder veto, gaming and bypass detection, invented-API checks) run first and cannot be overridden; a frontier-model review (ISO/IEC 25010) then scores performance, scalability, reliability and tech debt. Read-only: the code is analyzed, never executed. Call it on every AI-generated diff before accepting it; use validate_plan for plans, analyze_code for an advisory report without a verdict.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Optional review context, e.g. {"language": "cpp", "scale": "10k req/s"}. 'language' sharpens SDK-reality checks. | |
| ai_output | Yes | The AI-generated code to gate — a diff, function or whole file. Plain source text, any mainstream language. | |
| validation_type | No | 'code_generation' (default) for source code; 'text' for prose output such as documentation or commit messages. | code_generation |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| score | Yes | Combined score 0-100 (gates fused with the model review) | |
| valid | Yes | The binary verdict: true = approved, false = rejected | |
| issues | Yes | Severity-ranked findings, each 'severity|category|detail' with the reasoning | |
| provider | No | Model that ran the deep review, or 'protection-gates-only' | |
| confidence | No | score / 100 | |
| protection | No | Deterministic gate result. A veto here is final — the model review cannot override it. | |
| suggestions | No | Concrete fixes to reach approval |