SQL Review Rules
SQL review rule tools
Single Origin's SQL-review agent checks queries and proposed changes against a set of review rules — free-text instructions injected verbatim into the agent's prompt under a REVIEW RULE OVERRIDES section. These three tools let your agent (or you) list the active rules, add new ones, and enable/disable them, so the review agent's behavior is governed by your team's standards instead of generic defaults.
Rules are scoped to your workspace; the backend records who created each one (created_by) from your Personal Access Token, so you never pass it yourself.
All sample responses below use synthetic data.
list_review_rules
list_review_rulesLists review rules. By default returns all rules; pass enabled_only: true to return only the rules currently active in reviews. Each rule carries rule_id, content, enabled, created_by (the UUID of the user who created it), created_at, and updated_at.
Sample call
"What SQL review rules do we have configured?"
Sample response
[
{
"rule_id": "c1a2b3d4-0000-1111-2222-333344445555",
"content": "Never recommend dropping or renaming columns; suggest a deprecation view instead.",
"enabled": true,
"created_by": "9f0e1d2c-aaaa-bbbb-cccc-ddddeeeeffff",
"created_at": "2026-05-29T16:04:00Z",
"updated_at": "2026-05-29T16:04:00Z"
},
{
"rule_id": "d2b3c4e5-1111-2222-3333-444455556666",
"content": "If the primary SQL statement is a DELETE, return findings: [] with skipReason \"DELETE excluded by review rules\".",
"enabled": false,
"created_by": "9f0e1d2c-aaaa-bbbb-cccc-ddddeeeeffff",
"created_at": "2026-05-20T11:30:00Z",
"updated_at": "2026-05-28T09:12:00Z"
}
]create_review_rule
create_review_ruleAdds a new review rule. content is free text (max 2,000 characters) and is rendered verbatim into the review agent's prompt, so write it as a self-contained instruction. New rules are created enabled: true. Write tool.
Common rule shapes:
- Constraint — forbid a class of suggestion: "Do not recommend adding clustering keys to tables under 1M rows."
- Statement-type exclusion — skip a whole class of SQL: "If the primary SQL statement is
TRUNCATE, return findings: [] with skipReason "TRUNCATE excluded by review rules"." - Pattern-based skip — skip by schema/naming/tag: "If the SQL only references tables in the
sandboxschema, return findings: [] with skipReason "sandbox excluded"."
Sample call
"Add a review rule: never suggest dropping columns, recommend a deprecation view instead."
Sample response
{
"rule_id": "e3c4d5f6-2222-3333-4444-555566667777",
"content": "Never recommend dropping or renaming columns; suggest a deprecation view instead.",
"enabled": true,
"created_by": "9f0e1d2c-aaaa-bbbb-cccc-ddddeeeeffff",
"created_at": "2026-05-29T16:04:00Z",
"updated_at": "2026-05-29T16:04:00Z"
}update_review_rule
update_review_ruleUpdates a rule's content and/or enabled flag (at least one must be supplied). To "delete" a rule, set enabled: false — it stays in the table for audit but is no longer injected into the review agent's prompt. The same 2,000-character cap applies when changing content. Write tool.
Sample call
"Disable the DELETE-exclusion review rule."
Sample response
{
"rule_id": "d2b3c4e5-1111-2222-3333-444455556666",
"content": "If the primary SQL statement is a DELETE, return findings: [] with skipReason \"DELETE excluded by review rules\".",
"enabled": false,
"created_by": "9f0e1d2c-aaaa-bbbb-cccc-ddddeeeeffff",
"created_at": "2026-05-20T11:30:00Z",
"updated_at": "2026-05-29T16:20:00Z"
}