# Ovid

Ovid is a small compiled language whose toolchain is built for agents. Every command answers in JSON lines, every error says where it is and what was expected, and every edit is checked before it is written.

It is new: the first commit is from 2026-10-03. What it has today is below; what it does not have yet is on the [roadmap](/roadmap).

## Every error has a place

```console
$ ovid check
{"fact":"error","code":"arity","message":"Twice takes 1 arguments, got 2","id":"ex:hello.Use:3","file":"hello/extra.ov","line":8,"col":10,"end_line":8,"end_col":21,"expected":"1","got":"2","hint":"hello: func Twice(n i64) i64","source":"  return Twice(1, 2)"}
{"errors":1,"fact":"summary","funcs":47,"ms":2,"ok":false,"packages":3,"revision":"b3cdb13e021da9c8"}
exit 1
```

A diagnostic carries the file, line, column, and source line, the id of the expression, and what was expected and found. The last line always has `"ok"`, and the exit code says the same: 0 ok, 1 errors, 2 a stale edit.

## Edits are checked before they are written

Two agents read `Greeting`, and one of them changes it. The other's edit was made from text that is no longer there, so ovid refuses it with exit 2 and sends back the current text and hash:

```console
$ ovid show Greeting
// func fn:hello.Greeting hello/main.ov:5-7 hash=4e5e8b1a8171
func Greeting() i64 {  // @fn:hello.Greeting
  return strptr("hello, world\n")  // @st:hello.Greeting:1
}
# agent b
$ ovid replace st:hello.Greeting:1 --expect 4e5e8b1a8171 <<'EOF'
  return strptr("hello, agents\n")
EOF
{"check_ok":true,"errors":0,"errors_before":0,"files":["hello/main.ov"],"ok":true,"ops":[{"decls":[{"hash":"aebb3dcdacd0","id":"fn:hello.Greeting"}],"ids":["st:hello.Greeting:1"]}],"revision":"e8df8db6cb5aff3f","written":true}
# agent a, from what it read before
$ ovid replace st:hello.Greeting:1 --expect 4e5e8b1a8171 <<'EOF'
  return strptr("hi\n")
EOF
{"decl":"fn:hello.Greeting","decl_hash":"aebb3dcdacd0","error":"stale","hash":"f6419685b5b3","hint":"re-read with `ovid show fn:hello.Greeting` and use the ids and hashes it prints now; text and hash here are st:hello.Greeting:1's current ones","id":"st:hello.Greeting:1","message":"fn:hello.Greeting changed since you read st:hello.Greeting:1; a statement's hash covers its whole decl, and st:/ex: ids are renumbered by edits above them","ok":false,"op":0,"text":"return strptr(\"hello, agents\\n\")"}
exit 2
```

An edit names what it changes by id and carries the hash it read. It is all or nothing: the module is reparsed and checked in memory first, and an edit that adds errors is refused. Writers to one module take a lock and replace files atomically. See [Edits](/edits).

## It says what it can ask of the kernel

```console
$ ovid run
hello, world
$ ovid build
{"bytes":745,"ok":true,"output":"hello/bin/hello","syscalls":[1,9,60]}
```

Programs are static Linux x86-64 binaries with no libc. Only the shipped `ovid/io` package may make a system call, and `ovid build` lists the ones a program can reach: for this one write, mmap, and exit. That list is enough to run it under a seccomp filter that allows nothing else.

## It compiles itself

The compiler is written twice: in Go, the toolchain agents use today, and in Ovid. The Ovid one, about 6,200 lines, builds itself into a binary byte-identical to the one the Go compiler builds from the same source, and ovid's tests check that on every change.

```sh
bin/ovid build -C prog -o /tmp/s1          # Go compiles the Ovid compiler
/tmp/s1 build prog -o /tmp/s2 --std std    # which compiles itself
cmp /tmp/s1 /tmp/s2                        # byte-identical
```

## Measured with agents

The repository has tasks for agents, from writing a small program to recovering from a lost edit, each checked by a program. On 2026-10-05, claude-opus-5-5 and claude-sonnet-5-5 passed all 20 runs of the four hardest and claude-haiku-4-5 passed 9. The same runs show what does not work yet: given a 7,600-line module, no agent used `ovid outline`, `refs`, or `grep` to find its way; they used grep and sed. Every run, failures included, is in [AGENT_FEEDBACK.md](https://github.com/ovid-sh/ovid/blob/main/docs/AGENT_FEEDBACK.md).

## This site

The site is generated by gen, a program written in Ovid and compiled by the Ovid compiler written in Ovid. The ovid output on it is recorded when the site is built, not typed. Every page is also Markdown: add `.md` to its URL, or start at [llms.txt](/llms.txt).
