AI coding agents
Lyth is built to be written by AI coding agents as well as by people. A model has seen little Lyth, and what it has seen may describe an older version, so Lyth does not rely on what the model remembers. The installed compiler teaches the language, every project tells its agent where to look, and the compiler corrects what the model gets wrong:
lyth guideteaches the installed version. It prints the guide to writing Lyth that is built into thelythbinary: how to work with the compiler, the language at a glance, what Lyth spells differently from Go and from Kotlin, and the syntax that changed between versions. It always matches the compiler that runs the code, because it is part of it.- Every project points its agent at the guide.
lyth initwrites anAGENTS.md(and aCLAUDE.mdthat imports it, for Claude Code) telling agents to readlyth guideand check their work withlyth check. There is also a Claude Code plugin that does the same for any Lyth work. - The compiler corrects mistakes with exact edits. Diagnostics point at
.lythlines, speak Lyth, and end with the edit to make.lyth fixapplies every edit that only respells code: older Lyth syntax, and the Go and Kotlin habits models bring with them. - What an agent writes is easy to review. Using a value that may be nil without a check,
or leaving an error unhandled, is a compile error, and
lyth gen -stdoutshows the plain Go any change compiles to.
Set up
Section titled “Set up”Install Lyth (brew install lyth-lang/tap/lyth, or other ways), then give
your agent a project it can learn from.
A new project. lyth init makes the current directory a Lyth module with everything an
agent needs:
mkdir hello && cd hellolyth init example.com/helloIt writes go.mod, a main.lyth to start from, AGENTS.md, CLAUDE.md (one line,
@AGENTS.md), and .lyth/ in .gitignore. Then ask your agent for what you want built.
An existing project. Run lyth init in the module’s root directory. In a module that
already exists it adds only what is missing, such as AGENTS.md and CLAUDE.md, and changes
nothing else.
Claude Code. Install the Lyth plugin once, and Claude Code loads its skill for any work on
.lyth files, in every project:
claude plugin install lyth --marketplace lyth-lang/lythInside Claude Code, the same is /plugin marketplace add lyth-lang/lyth followed by
/plugin install lyth@lyth.
Other agents. AGENTS.md is the convention that Codex, Cursor, GitHub Copilot, and many
other coding agents read from the project’s root; the measurements below use Claude Code. For an agent that reads another file, add the
same instruction to it: run lyth guide before writing Lyth, and lyth check after each
change.
The commands agents use
Section titled “The commands agents use”| Command | What it gives the agent |
|---|---|
lyth guide |
The guide to writing the installed version of Lyth, with the version that printed it. |
lyth guide topics |
The documentation pages built into lyth: the tour, Lyth for Go programmers, the cheat sheet, Go interop, testing, tooling, the language reference, types, errors, collections. |
lyth guide <topic> |
One of those pages, such as lyth guide interop or lyth guide errors. |
lyth check |
Type-checks the module, test files included, without building. Fast enough to run after every change. |
lyth check -diagnostics=json |
The same diagnostics as JSON lines, each edit with "fix": true when lyth fix would apply it. |
lyth fix |
Applies every fix across the module, compiling again until none is left, then reports the errors that remain. |
lyth run / lyth test ./... |
Runs the program or the tests; failures and panics point at .lyth lines. |
lyth gen -stdout file.lyth |
The Go a file compiles to, for when the agent (or its reviewer) is unsure what a construct does. |
lyth lsp |
The language server, for agents that work through an editor. |
What the compiler tells an agent
Section titled “What the compiler tells an agent”A model that half-remembers Lyth tends to write Kotlin and older Lyth into it:
fun greet(name: String): String { val msg = "hello, $name" return msg}lyth check reports each mistake at its line, with the edit:
main.lyth:1:1: error[E0008]: functions are declared with func |1 | fun greet(name: String): String { | ^^^ | = hint: write func
main.lyth:2:23: error[E0006]: "$name" prints literally; templates are written ${name} |2 | val msg = "hello, $name" | ^^^^^ ::: main.lyth:1:11 |1 | fun greet(name: String): String { | ---- name is declared here | = hint: write ${name} to interpolate it, or \$name to keep the dollar sign
5 errorslyth fix rewrites 4 of them: they are older Lyth syntax, or Kotlin or Go spellingslyth fix applies the four respellings. The $name is left for the agent: it could mean the
variable or a literal dollar sign, so the error names both edits and the agent picks ${name}.
Then the program builds:
func greet(name: string): string { msg := "hello, ${name}" return msg}
func main() { println(greet("agent"))}import "fmt"
func greet(name string) string { msg := "hello, " + name return msg}
func main() { fmt.Println(greet("agent"))}hello, agentFixes only respell code. Edits that would change what a program does, such as adding ? to
propagate an error or converting a number, stay hints for the agent to decide on.
When Lyth changes
Section titled “When Lyth changes”Lyth’s syntax changed often before the freeze that leads to 1.0, so code and models may still carry older forms (compatibility). Three things keep agents current (ADR 0033):
AGENTS.md,CLAUDE.md, and the Claude Code skill hold no language rules, only commands, so they never go stale. Updatinglythupdates what every agent learns.- When a release changes syntax, the older form keeps a diagnostic with a fix, and the guide’s
changes between versions gains a row. An agent
that writes the old form is corrected by
lyth check, whether or not it read the guide. - After an upgrade,
lyth fixrewrites a module’s older syntax, so agents don’t copy it from the code around them.
Measured
Section titled “Measured”evals/ gives programming tasks to Claude Code and grades the programs: 12 tasks
covering errors, nullable types, generics, enums, packages, tests, goroutines, porting Go, and
upgrading code in older syntax. On 2026-10-25, with Claude Code 2.1.301 and its sonnet model,
three runs of each task in each condition (36 runs per column):
AGENTS.md |
Claude Code skill | lyth help only |
no help | |
|---|---|---|---|---|
| tasks passed | 36/36 | 36/36 | 36/36 | 36/36 |
| first build succeeded | 27/36 | 26/36 | 8/36 | 0/36 |
| builds per run | 1.5 | 1.5 | 2.8 | 4.2 |
| turns per run | 6.5 | 8.6 | 11.3 | 14.2 |
| time per run | 18 s | 19 s | 26 s | 31 s |
Every condition gets there in the end, because the compiler’s diagnostics guide even an agent
with no help. With lyth guide (through the AGENTS.md that lyth init writes, or the skill),
three first builds in four succeed instead of none, with about a third of the builds and fewer
turns (less than half with AGENTS.md). To run the evals yourself:
python3 evals/run.py --reps 3 --conditions skill,agents-md,cli,bareThey make real model calls; the evals README explains the tasks, the grading, and the cost.
See also
Section titled “See also”- Writing Lyth: the page
lyth guideprints. - Tooling: every command and flag, and
lyth fixin detail. - Diagnostics: how errors are reported and fixed.