Engineering articles

Engineering notes,
with the receipts attached.

Four notes from building a code generator: a constructor-flow technique you can run, a fluent-API pattern you can type-check, a reproducibility contract for sampled generator options, and a measured look at what generation costs inside an agent loop.

What a receipt isRun it, don't take my word.Where a note has a public artifact, it ends with the repository, command, or compile pair that produces what the page shows.
API design · compile safety

Make illegal calls unrepresentable

A fluent API is a vocabulary. When every builder shares it, the editor offers WithCheckedBag on a ticket that cannot take hold luggage. You can throw at runtime — or compose the callback type so the method does not exist.

Read
Testing · generated output

Generator-option reliability

Generated output is only trustworthy if a failure can be replayed from a stated identity: schema, language, seed, applied options, engine build, gate. The contract, and one failure that went through it.

Read
MCP · measured

Generating for the agent loop

One tool call can produce many files. Whether that saves model round trips depends on batching. A recorded benchmark separates tool calls, assistant messages and output tokens.

Read