Script Review Agent

Risk-scores a SQL change script and returns a structured JSON verdict: severity, per-finding category, line numbers, remediation, and a suggested rollback. Designed to sit in front of the approval workflow, not as a chat toy.

Inputs

Output shape

{
  riskScore: 'low' | 'medium' | 'high' | 'critical',
  findings: [
    { type, severity, message, line, suggestion, refs }
  ],
  summary: 'one-paragraph review',
  suggestedRollback: 'SQL to undo this script' | null
}

Detection surface

Scoring rubric

An irreversible destructive op with no accompanying rollback forces riskScore = critical. Otherwise the model scores against cumulative findings.

Wire it into approval

Set ai_script_review_mode = auto (Settings → AI) to auto-review every submitted script and attach the verdict before it enters the approval queue, a review gate rather than an on-demand action.