wado / wado-compiler
AGENTS.md120 starsChanged 14 days agoMITView on GitHub
The Wado compiler crate. The standard library under lib/ has its own AGENTS.md. - The compiler is deterministic: one input emits the same bytes on every run, whatever the thread count or host. A lapse shows as drift in the WIR golden fixtures (mise run update-golden-fixtures), and nondeterminism is a P0 bug. - Nothing in this crate writes to a stream: println!, eprintln! and dbg! are denied at the crate root. A user-facing message goes through Logger and a developer…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository37 other files it gives its agents.
- AGENTS.mdAGENTS.md
- benchmark/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- package-gale/AGENTS.mdAGENTS.md
- package-grog/AGENTS.mdAGENTS.md
- package-jade/AGENTS.mdAGENTS.md
- package-loam/AGENTS.mdAGENTS.md
- package-re/AGENTS.mdAGENTS.md
- package-wadopoet/AGENTS.mdAGENTS.md
- wado-cli/AGENTS.mdAGENTS.md
- wado-from-idl/AGENTS.mdAGENTS.md
- wado-host/AGENTS.mdAGENTS.md
- wado-lsp/AGENTS.mdAGENTS.md
- wado-manifest/AGENTS.mdAGENTS.md
- wado-run-pjrt/AGENTS.mdAGENTS.md
- wado-run-webgpu/AGENTS.mdAGENTS.md
- wado-vscode/AGENTS.mdAGENTS.md
- benchmarkSkill
- ci-timingSkill
- code-review-responseSkill
- coverage-investigationSkill
- crSkill
- debuggerSkill
- distillSkill
- git-upstream-syncSkill
- jcoSkill
- markdownSkill
- on-task-doneSkill
- optimizer-debugSkill
- profiling-wado-compilerSkill
- pull-requestSkill
- rust-renameSkill
- rustSkill
- vendor-submodulesSkill
- wado-cliSkill
- wado-performanceSkill
- wasm-optSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Only src/name.rs knows a name format.
- Very specific: line 26
Every name the compiler mints for itself starts with one $ (name::INTERNAL_PREFIX), which no Wado identifier can spell.
- Very specific: line 66
Run touch tests/e2e.rs after adding or removing a fixture, or after changing WADO_FULL_TEST.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
wado-compiler
The Wado compiler crate. The standard library under lib/ has its own
AGENTS.md.
Rules
- The compiler is deterministic: one input emits the same bytes on every run,
whatever the thread count or host. A lapse shows as drift in the WIR golden
fixtures (
mise run update-golden-fixtures), and nondeterminism is a P0 bug. - Nothing in this crate writes to a stream:
println!,eprintln!anddbg!are denied at the crate root. A user-facing message goes throughLoggerand a developer trace throughcompiler_trace!. - An
assert!states an invariant the compiler establishes for itself. What a source file can violate is aDiagnostic: a panic on user input is a crash, whatever it asserts. - A phase error words itself once, in its
Diagnostic. It carries noDisplay: nothing in the crate can print one, and a second wording drifts from the one the user reads.Displayis for an error the CLI prints itself (CompileError,WitEmitError), or one whose text aDiagnosticbuilder reads (LexError,LoadError). src/codegen.rsemits theNirPackageandWirPackageas they are; it knows nothing of the earlier phases.- Only
src/name.rsknows a name format. Mangling and monomorphization go through it. - Every name the compiler mints for itself starts with one
$(name::INTERNAL_PREFIX), which no Wado identifier can spell. - What makes such a name unique is a serial that advances on read
(
FunctionContext::fresh_serial), never a local index the site has yet to allocate. A step that reads one before recursing hands its own names to whatever nests inside it (issue #1987). - A declaration is identified by its
DefId, never by its name. See WEP: Declaration Identity. - Walk IR through the visitor utilities, and answer a question with one resolver over the IR rather than partial walkers, which each miss a different shape.
- Optimize to the limit correctness allows, and nothing short of it. Wrong code is never a trade for speed. A conservatism is not caution but a defect: measure what it buys, and delete it when that is nothing.
- This crate must compile for
wasm32-unknown-unknown(checked in CI). Keep OS-dependentstdmodules out of production code. cargo check --all-targetswhile iterating, or a type the crate changes breaks the uncompiled unit tests where nothing looks.mise run test-e2ecovers O2 and leaves the other levels to CI, whoseignoredlines are that split and not a gap. Run one of them withmise run test-e2e-level <LEVEL>only when asked, and never setWADO_FULL_TESTunless asked by name.
E2E Tests
A fixture is a .wado file in tests/fixtures/, its expectations in a
trailing __DATA__ JSON section whose fields are the serde structs in
tests/e2e.rs. A path in __DATA__ is relative to the fixture's own
directory. tests/ is a package of its own, wado-compiler-tests; its
Cargo.toml says why.
{"compile_error": "…"}states a rejection: the report must contain it, so writing":4:13: parse error: …"pins the position as well as the message.{"compile_error_codes": ["INVALID_SYNTAX"]}adds theCodean error was raised under; withoutcompile_error, a failed compile still fails the fixture.- A fixture may name a Kiln generator by a
./path, or by a[build-dependencies]nickname itsbuild_dependencieskey maps to a generator file. The harness runs it, and the clauses in the generator's own source, and writes their outputs underbuild/kiln/in the fixture's directory. Fixtures share that directory, so a clause naming its ownoutput_diris refused. - Run
touch tests/e2e.rsafter adding or removing a fixture, or after changingWADO_FULL_TEST.datatest_miniresolves fixtures at macro-expansion time and an incrementalcargo testwill not re-expand on its own. - A fixture's
-O2run rewrites its WIR golden intests/generated/fixtures/, andprune_orphan_wir_goldensremoves the goldens no fixture writes.mise run update-golden-fixturesregenerates them all without running the tests; CI'stidyjob runs it. wado dump -Ox file.wadois how you findwir_expect:Oxpatterns.wado dump --assert-plan file.wadoshows which operands anassertcaptures and which of them a short-circuit can skip.builtin::black_box(value)returnsvalueopaquely, keeping a fixture's input off the constant-folding path.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

