The pipeline
Every request from every agent travels the same path:- Deduplicate before the gate. A retry of something a human already approved replays rather than asking them again.
- Rewrite before the gate. The human approves the statement that will actually run — scope conjunct, column list, masks, limits and all. Approving the agent’s original draft would be approving something else.
The Operation IR
Warden does not work on SQL strings. Each request is parsed into an engine-neutral Operation: its class, verb, the resources it targets and how it touches each, its predicate, its mutation, its blast radius, and any hazards. That is what makes one policy language work across relational, document, and graph stores, and one audit schema describe all of them. It is also what makes classification honest: class comes from structure, never from the leading keyword.WITH and reads like a query. It is a delete, and Warden classifies it as one.
For PostgreSQL, parsing uses PostgreSQL’s own grammar — the server’s real parser, linked in — so Warden’s idea of what a statement does cannot drift from the server’s. A protobuf reflection walk then finds every table reference, including those in CTEs, subqueries, and USING clauses; nothing hides in a corner of the tree.