hegel-rust
AGENTS.md400 starsChanged 31 days agoMITView on GitHub
Hegel for Rust: the hegeltest frontend (root crate) drives the hegel-c engine (built as the libhegel C-ABI library) in-process through the same C ABI as every other language binding. hegel-macros/ is the proc-macro crate.
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,700 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 repository8 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- add-library-supportSkill
- changelogSkill
- coverageSkill
- new-default-generatorSkill
- new-generatorSkill
- new-settingSkill
- self-reviewSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 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.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Import generators as use hegel::generators as gs.
- Very specific: line 39
Don't bind unused results to _.
- Very specific: line 40
No comments other than // nocov and ones with a specific function.
- Very specific: line 44
Never add // nocov without explicit human permission.
- Very specific: line 45
Never increase the numbers in .github/coverage-ratchet.json without explicit human permission.
≈ “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
AGENTS.md
Hegel for Rust: the hegeltest frontend (root crate) drives the hegel-c engine (built as the libhegel C-ABI library) in-process through the same C ABI as every other language binding. hegel-macros/ is the proc-macro crate.
Commands
just check # definition of done: lint + tests + all-features tests
just test # cargo test
just lint # clippy, rustfmt --check, and the scripts/check-*.py lints
just format
just check-coverage # needs cargo-llvm-cov + llvm-tools-preview
just c-test # hegel-c smoke tests + example C programs
just miri # fast core of the suite under Miri (nightly + miri component)
just c-header # regenerate hegel-c/include/hegel.h and src/ffi/sys/fns.rs
just check-lark # parse engine-generated strings from the Lark fixture grammars with Lark itself (needs uv)
just check-parse # compare the engine's grammar parser with Lark's on generated strings and their mutants (needs uv)
just lark-fixtures # regenerate the Lark fixtures' .expected files from Lark (needs uv)
just unicodedata # regenerate the Unicode tables and their Python reference from the vendored UCD files (needs uv)
cargo test test_name # one testGotchas
hegel-c/include/hegel.handsrc/ffi/sys/fns.rsare generated fromhegel-c/src/lib.rs; never edit them by hand, runjust c-headerafter changing an exportedhegel_*function.- MSRV is 1.86. Bumping it means bumping
Cargo.toml,hegel-macros/Cargo.toml,hegel-c/Cargo.toml, andci.ymltogether. - The engine must never panic across the FFI boundary: use the
hegel_internal_assert!family instead ofassert!insrc/andhegel-c/src/,invalid_argument!/EngineError::InvalidArgumentfor argument validation (scripts/check-internal-asserts.pyenforces this). - Generators never open a span around their own body (
TestCasedoes), and composites draw components throughtc.draw_silent/tc.draw_and_print, never a component'sdo_draw. Span labels are opaqueu64s; there is no enumeration of them anywhere and you must not add one. Details in thenew-generatorskill. - A new setting is not done until it is reachable every way the others are (builder,
hegel.toml, C ABI,HEGEL_*env var, docs); follow thenew-settingskill. - Nondeterministic-test handling in the engine is documented in
hegel-c/docs/nondeterminism.md; read it before touchingcounterexample.rs,graph*.rs,nd/, orcore/replay.rs. - Grammar strings (
gs::from_lark,hegel-c/src/native/lark/) are mapped inhegel-c/docs/grammar-strings.md: a string is one grammar-constrained choice, checked on replay by the Earley parser inlark/parse.rsand shrunk through its derivation inshrinker/grammar.rs; the module docs oflark/generate.rsdescribe the generator's sizing and lexability design. A grammar or pattern is user input that can make the engine build without bound, so probe such code under a memory cap. - The
__feature prefix marks a feature as internal; coverage enables every other root-crate feature automatically.
Conventions
- Tests live in
tests/, never inline in source. Tests needing private items go intests/embedded/, mirroringsrc/, wired in with#[cfg(test)] #[path = "..."] mod tests;from the source file (both crates, e.g.src/ffi.rs→tests/embedded/ffi_tests.rs). - Import generators as
use hegel::generators as gs;and call them asgs::booleans(), including inside string-literal code snippets.gs::booleans()is the default throwaway generator. - In tests prefer
.unwrap()over.expect("static message"); use.expectonly with a formatted value. - Don't bind unused results to
_;let _ =only to silence#[must_use]. - No comments other than
// nocovand ones with a specific function. Before committing, delete any comments you wrote.
Boundaries
- Never add
// nocovwithout explicit human permission. New code needs 100% line coverage; see thecoverageskill. - Never increase the numbers in
.github/coverage-ratchet.jsonwithout explicit human permission.
Skills
new-generator, new-default-generator, add-library-support, new-setting, coverage, changelog (for RELEASE.md), self-review. Use them when the task matches.
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.

