frzxw
Resume
Blog

Why strict languages and AI agents get along

AI tools fix mistakes fastest when the mistake is pointed out precisely. That is why strict languages like Rust, and strict TypeScript, make agent-written code easier to trust and debug.

An AI assistant is only as good as the feedback it gets. When it writes something wrong, the question is how quickly and how precisely the mistake gets pointed out. Strict languages answer that question before the code ever runs.

A compiler is a very patient reviewer

In a loose language, a mistake often shows up much later: a value that was sometimes missing, a function called with the wrong kind of data, a case nobody handled. By then the trail is cold for a person and for an AI.

Rust's compiler refuses to build code with a whole class of those mistakes, and its error messages say exactly where the problem is and often how to fix it. For an agent that is the ideal loop: write, compile, read a precise error, fix, repeat. The feedback is fast, specific and never tired.

Strict TypeScript gives a lighter version of the same thing, which is why every TypeScript project I run uses the strictest settings.

What I saw in practice

My personal research engine, Heuristic (opens in a new tab), is written in Rust, with a lot of help from AI tools. A few choices made that collaboration work well:

  • A pure core. The domain logic lives in a crate with no input or output at all: no network, no database. Code like that is easy for an agent to reason about and easy to test.
  • One command for every check. A single recipe runs formatting, a spell check, Clippy (Rust's linter), the tests and a dependency audit. An agent can run it and get one clear answer.
  • A pinned toolchain. Everyone, human or AI, builds with the same compiler version, so "it works on my machine" goes away.

The result is code I can accept from an assistant with more confidence, because the compiler has already argued with it.

The honest trade-offs

Rust is slower to write and has a learning curve, for people and models. It is not the right choice for every project; most web products I build are TypeScript. But for logic where correctness matters more than speed of typing, data pipelines, money, anything long-running, the strictness pays for itself.

Further reading