4.4 KiB
4.4 KiB
Project notes for agents
AGENT RULES
- you MUST NOT change
AGENTS.mdorCLAUDE.mdunless explicitly asked - you MUST never do
git push, unless you're explicitly told to - you MUST always run
cargo fmt --allafter changing file contents. Never pass formatting options on the command line (--config,--edition, ...) or invokerustfmtdirectly on files; when present, formatting settings come fromrustfmt.tomlandCargo.toml - you MUST use conventional commits when committing (
feat,fix,perf,refactor,chore,docs,test,dev), with!and aBREAKING CHANGE:footer for API breaksdevis used for tooling, debugging aids and test-flakiness work that doesn't change shipped behaviourbump(dependency version bumps) andreleaseare used by maintainers; don't create release commits unless asked
- you MUST end commit messages with a
Co-Authored-By:trailer naming yourself as the agent (product name only, no model or version), e.g.Co-Authored-By: Claude <noreply@anthropic.com> - you MUST inform the user about commits or any other changes to git, including the commit message
- you SHOULD commit your changes after every step, unless the user tells you to not commit or a file with the name
.NOCOMMITexists in the project root. This applies to all changes, including docs,AGENTS.md, CI and config files, not just Rust code- changes that affect compilation or tests (Rust code,
Cargo.toml/Cargo.lock, build scripts, test data) may only be committed aftercargo clippyandjust testpass - other changes (Markdown, CI, editor or deployment config) don't need those checks; commit them right away
- check the current branch (
git branch --show-current) before every commit, not just at the start of the session
- changes that affect compilation or tests (Rust code,
- you SHOULD commit formatting-only changes separately from functional changes: if
cargo fmt --allreformats code you didn't change, commit that first aschore: cargo fmt; do not stage unrelated user changes - you SHOULD add user-visible changes to the
Unreleasedsection of CHANGELOG.md (Keep a Changelog format), creating that section if needed
Commands
cargo build --workspace --all-targets
just test
cargo clippy --all -- -D warnings # must stay clean
cargo fmt --all
Lint conventions:
- Configure workspace lints in
[workspace.lints]in the root Cargo.toml; new crates should opt in with[lints] workspace = true. - Change lint levels there, not on the command line or in CI.
Project Context
src/main.rshosts the Axum API and simulation thread;src/world.rsowns world behavior and snapshots;src/storage.rspersists snapshots.config.rndefines the Rune simulation defaults and agent behavior. Runtime script edits are not written back to this file; see the README before changing reset or persistence behavior.ui/is the Leptos/Wasm frontend. Keep its API/model changes aligned with the server payloads insrc/main.rs.
Conventions
- Use descriptive variable and function names so the code explains itself.
- Comment only code that needs clarification, and keep comments short.
- Add dependencies to
[workspace.dependencies]in the root Cargo.toml and usedep.workspace = truein crates. - Use
thiserrorin libraries andanyhowonly in binaries/tools. - Use
tracingfor logging. Only add tracy spans in performance-critical code.
Code reviews
Whenever asked for a code review (of commits, a branch, a diff, or specific files), report every finding as an entry in a list, in this exact shape:
- Location:
file:line(use a range likefile:120-146when the finding spans several lines) - Category: one of
Blocking,FYI,Nit(add categories such asQuestiononly when none fit) - Comment: what could be improved and the concrete problem or risk, including the failure scenario when claiming a defect—not just an abstract concern
Order findings by severity (Blocking first). Use Blocking for things that must change before merge (defects, unbounded resource use, or violations of these rules), FYI for design consequences and risks worth a conscious decision, and Nit for style/cleanliness. Verify claims against the code and run the Clippy and test commands from Commands before reporting; say when a finding is a possibility rather than a confirmed defect.