For Claude Code, Codex, Cursor and other agents

What should your coding agent write in?

When an agent writes most of the code, the best language is the one it can get right without you: mistakes caught before anything runs, errors that say what to write, and a result that’s cheap to deploy. That’s what Tern is built for.

curl -fsSL https://ternlang.dev/install.sh | sh
tern new myapp --template web     # AGENTS.md and CLAUDE.md included

What makes a language good for agents

A human picks a language for its ecosystem and what the team knows. An agent has different weak spots: it writes fast, guesses names it half remembers, and only finds out it was wrong when something checks. So the language should:

Here’s what an agent sees when it writes Python habits into Tern. tern check --json gives the same thing as data:

tern check main.tn
main.tn:3: error: unknown function `range`
main.tn:3: hint: there is no range(): write `for i in 0..n:` (or `for i in a..b:`; the end is exclusive)
main.tn:4: error: unknown function `append`
main.tn:4: hint: arrays grow with `xs.push(value)`

Same spec, same agent, three languages

We gave a coding agent a spec for a link shortener (a database, click counts, a JSON API) and an empty directory, once each in Tern, Go and TypeScript. All three apps pass the same 32 black-box acceptance checks.

Agent-built appTernGoTypeScript
Lines of code excluding tests273805502
Redirects per second146k154k47k
CPU per redirect23 µs32 µs21 µs one thread
Deployed size408 KB13.6 MB25.8 MB
Memory at idle4.4 MB18.6 MB89.6 MB

Less code means less for you to review. A 408 KB binary that idles in 4 MB means the cheapest server you can rent will run it. Go served slightly more redirects per second, and we show that too. More numbers, losses included, are on the benchmarks.

How it compares with what agents usually write

Set up your agent

Every project from tern new includes AGENTS.md, the file Codex, Cursor and most other agents read, and CLAUDE.md for Claude Code. They tell the agent to read tern guide before writing, to run tern check --json after every change, and to finish with tern test.

The honest caveats

Claude Code is a product of Anthropic, Codex of OpenAI, Cursor of Anysphere. Tern isn’t affiliated with any of them. Benchmark: macOS on Apple silicon, 128 keep-alive connections for 5 s, medians of three alternating rounds.