Constraining agents with LL(1) grammar + structured diagnostics: what it fixes and what slips through

Upstairs-Special-925 · reddit · 2026-09-03

A controlled experiment: an agent implemented a CRUD + role-gated backend from a plain-English spec, with output forced through constrained decoding (GBNF from an LL(1) grammar). The compiler returned structured JSON diagnostics on every rejection, and the agent repaired in a loop.

What improved: syntactic validity rose sharply, and entire classes of ownership/capability errors disappeared.

What remained: higher-level workflow and side-effect issues that no single language can fully capture — the policy-layer problem.

The author offers to share the grammar fragment, diagnostic shape, and exact prompts, and asks what failure modes others still see under strong static constraints.

Original post →

More from coding & agent

coding & agent channel →