agentleFS
hegeldevhegeldev/hegel-rust/AGENTS.md

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.

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
  1. Very specific:

    Import generators as use hegel::generators as gs.

    line 37
  2. Very specific:

    Don't bind unused results to _.

    line 39
  3. Very specific:

    No comments other than // nocov and ones with a specific function.

    line 40
  4. Very specific:

    Never add // nocov without explicit human permission.

    line 44
  5. Very specific:

    Never increase the numbers in .github/coverage-ratchet.json without explicit human permission.

    line 45

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 test

Gotchas

  • hegel-c/include/hegel.h and src/ffi/sys/fns.rs are generated from hegel-c/src/lib.rs; never edit them by hand, run just c-header after changing an exported hegel_* function.
  • MSRV is 1.86. Bumping it means bumping Cargo.toml, hegel-macros/Cargo.toml, hegel-c/Cargo.toml, and ci.yml together.
  • The engine must never panic across the FFI boundary: use the hegel_internal_assert! family instead of assert! in src/ and hegel-c/src/, invalid_argument! / EngineError::InvalidArgument for argument validation (scripts/check-internal-asserts.py enforces this).
  • Generators never open a span around their own body (TestCase does), and composites draw components through tc.draw_silent / tc.draw_and_print, never a component's do_draw. Span labels are opaque u64s; there is no enumeration of them anywhere and you must not add one. Details in the new-generator skill.
  • 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 the new-setting skill.
  • Nondeterministic-test handling in the engine is documented in hegel-c/docs/nondeterminism.md; read it before touching counterexample.rs, graph*.rs, nd/, or core/replay.rs.
  • Grammar strings (gs::from_lark, hegel-c/src/native/lark/) are mapped in hegel-c/docs/grammar-strings.md: a string is one grammar-constrained choice, checked on replay by the Earley parser in lark/parse.rs and shrunk through its derivation in shrinker/grammar.rs; the module docs of lark/generate.rs describe 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 in tests/embedded/, mirroring src/, 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 as gs::booleans(), including inside string-literal code snippets. gs::booleans() is the default throwaway generator.
  • In tests prefer .unwrap() over .expect("static message"); use .expect only with a formatted value.
  • Don't bind unused results to _; let _ = only to silence #[must_use].
  • No comments other than // nocov and ones with a specific function. Before committing, delete any comments you wrote.

Boundaries

  • Never add // nocov without explicit human permission. New code needs 100% line coverage; see the coverage skill.
  • Never increase the numbers in .github/coverage-ratchet.json without 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.