mothergod: chevrons compressing the golden byte

mothergod

A general-purpose lossless compressor in Rust, built for compression ratio rather than speed, and meant to be judged on bits per byte against zstd -19 and xz -9e.

Wins Canterbury, vs zstd -19 and xz -9e
Splits Silesia, beats zstd -19, trails xz -9e
Not yet pre-alpha, no release
Status

Pre-alpha: no release, no packaged binary, no version tag. The first release waits on the speed bar. The container format (version 22) is specified and versioned, not frozen. Before the first release, each format change retires the version before it, so the next build that changes the format will not read a file you compress today. After that, until 1.0 a version can still be retired; from 1.0 on, none ever is. The format spec states the rules. The API, the CLI and the ratio below still move too. Do not use this for data you care about yet.

What this is

Compression runs in three stages. First, reversible transforms rearrange bytes to expose patterns a plain byte-by-byte view hides. Second, an LZ stage finds repeated stretches of the input and works out the cheapest way to describe them, including cheap references back to a handful of recently used distances. Third, an arithmetic coder encodes what remains, blending predictions from several models and adjusting that blend as it reads. Ratio came first, so judge it on bits per byte; the speed section below says what that order cost. Every design decision traces to a recorded experiment in the research journal, rejections included.

Measured

Aggregate bits per byte on the two named corpora, lower is better. Canterbury is 11 files and 2.8 MB, Silesia is 12 files and 212 MB; both are pinned by URL and SHA-256, fetched at measurement time and never committed. Measured 2026-11-21 against gzip 1.12, Zstandard 1.5.7 and XZ Utils 5.4.5, at the flags in the header row.

Aggregate bits per byte by corpus and compressor
corpus mothergod -3 gzip -9 zstd -19 xz -9e
Canterbury 1.347 2.079 1.470 1.403
Silesia 1.976 2.553 1.997 1.829

Read it honestly: mothergod beats both zstd -19 and xz -9e in aggregate on Canterbury; on Silesia it beats zstd -19 and loses to xz -9e. Its slowest level, -4, writes both corpora smaller than any level of gzip, zstd or xz in the same run, and pays for that in decode time, quoted under Try it. Per file, against whichever of the two is stronger on that file, it wins 7 of 11 on Canterbury and 1 of 12 on Silesia. The wins are Canterbury's six smallest text and source files (alice29.txt, asyoulik.txt, cp.html, fields.c, grammar.lsp, xargs.1), its kennedy.xls spreadsheet, and Silesia's ooffice library. The widest losses are Silesia's sao star catalog, mozilla install archive and mr medical image, and Canterbury's sum executable. Closing Silesia is open-ended research with no date attached. The per-file tables and the throughput columns are in docs/benchmarks/canterbury.md and silesia.md, and the commands that regenerate them are in the benchmarks README.

Speed

Slow, and that is the honest headline, even with two cores helping: mothergod encodes on up to two cores and decodes on one. The reports time it one file at a time, with nothing else running, on one CI machine (Intel(R) Xeon(R) 6975P-C, 4 logical cores), so each rate is comparable between files. A one-core machine encodes slower than these rates.

Aggregate encode and decode throughput by corpus, same run as the Measured table
corpus encode MB/s decode MB/s
Canterbury 0.303 5.942
Silesia 0.158 4.146

Silesia's 212 MB took under half an hour to compress and under a minute to read back. Encoding carries the optimal parse, so it runs more than ten times slower than decoding. In the same run, xz -9e encoded Silesia at 1.889 MB/s and decoded it at 84.282 MB/s, more than nine times faster to encode and more than twenty times faster to decode. Memory is the second price: peak memory on Silesia was 984.1 MiB, against 506.6 MiB for xz -9e. The reports set every level of gzip, zstd and xz beside mothergod.

Speed heads the roadmap: the first release waits until the default level encodes and decodes at half of xz -9e's speed or better on both corpora, in the same run, while still beating zstd -19 on each.

One caveat the reports state themselves: these are single-run figures from one machine, not a cross-machine claim. One more worth adding: an aggregate is total bytes over total time, so it is not a typical file. Per-file decode rates in those reports run from 0.6 to 32.0 MB/s. If speed is what keeps you from using mothergod, open an issue and say so.

Try it

There is no download: no release, no tag, no package. Building it yourself is the only way to run it, and the core crate has zero runtime dependencies, so this compiles exactly one crate. The test suite runs weekly on Linux, Windows and macOS, each on x64 and ARM64, and on Android and FreeBSD, x64 only; the lane table lists every one.

git clone https://github.com/bugabinga/mothergod
cd mothergod
cargo build --release --bin mothergod

The first run needs no file of yours, because the clone ships one:

$ ./target/release/mothergod -v -c LICENSE > /dev/null
mothergod: LICENSE: 1074 -> 630 bytes (58.6%)

-v asked for that line; without it, a run that worked prints nothing. -c sent the compressed bytes to stdout, which /dev/null swallowed, so the run writes no file and repeats cleanly. One 1 KB file is a smoke test, not a benchmark; the tables above are the benchmark. Then round-trip something of yours:

./target/release/mothergod    < FILE      > FILE.mgdc
./target/release/mothergod -d < FILE.mgdc > FILE.out
cmp FILE FILE.out

The CLI speaks the grammar gzip, xz and zstd already taught you: it compresses, -d decompresses, stdin to stdout when you name no file. That last line is the point of running it at all, and cmp printing nothing is it passing. Given a file, it writes <file>.mgdc beside it, and unlike gzip it never deletes the input. --help lists the rest on one screen: flags you know from gzip, four encoder levels, and no tuning knobs. On Silesia, -2 writes 2.205 bits/byte at 1.446 MB/s and -1 writes 2.361 bits/byte at 2.546 MB/s, against the default -3's 1.976 bits/byte at 0.158 MB/s. zstd -6 still writes smaller files than -1, and faster: the levels shorten the wait, they do not make mothergod fast. -4 goes the other way: it also codes every byte through one context-mixing model and keeps that file where it is smaller. On Silesia, -4 writes 1.521 bits/byte at 0.031 MB/s and reads it back at 0.099 MB/s, timed on another machine than the rates above; on that machine, xz -9e writes at 2.041 MB/s and reads at 83.773 MB/s. Every level writes frames the one decoder reads. --version also prints the format version the build reads; put it in a bug report.

Who builds it

mothergod began as an autoresearch loop. On 2026-08-19 one Claude session ran about 40 iterations of propose, score bits per byte on validation data, keep or reject, record; a proposed filter had to invert first. Bits per byte is also the metric karpathy/autoresearch minimizes, on language models instead of files. That harness is preserved at commit 1a3b1c8, and its findings open the research journal. The loop still runs; around it grew a versioned format, a decoder fuzzed against hostile input, and review by an agent that did not write the change.

Day-to-day development is done by Claude agents running on GitHub Actions: triage, implementation, adversarial code review, research, releases. Slowly, in public, like a real team would. A human operator holds the veto and the keys. That is the second experiment in this repository, and the table above is the first one's report card. How it works: agents/GOVERNANCE.md, and the seats are listed on the agents page. What it has decided, and what it later reversed, is on the decisions page.

Principles

Follow along