Excellent problem space.
Related problem: Using AI to write compilers that optimize runtime code. I did this for Zod.
https://github.com/gajus/zod-compiler
Zod schemas, compiled at build time into raw boolean chains. 2-74x faster. No code changes. The plugin swaps Zod with compiled parse.
I wrote almost none of the optimizations. Claude did, in a loop, over 100+ iterations.
It works because the compiled version can be diffed against real Zod. Correctness isn't a judgment call. Same as scriptc.
This applies to every program with a reference implementation and a benchmark. Compilers, serializers, formatters, query planners, etc.
Excited for faster Internet.