- The harness auto-loads every ancestor AGENTS.md (including root), so a nested file telling an agent to "see the repo-level AGENTS.md" is pure overhead — it can trigger a re-load/duplication-check/discard cycle, and some models just retain the duplicate content in context. Drop that pointer from every nested AGENTS.md; keep pointers to things that are NOT auto-loaded (README.md, docs/consensus.md, non-ancestor AGENTS.md like tx/ -> rpc/). - Root AGENTS.md's Build section is now a short index pointer to BUILD.md and docs/build/nix.md instead of restating Nix setup steps, per review feedback that AGENTS.md should mostly index other docs rather than duplicate them. Addresses PR review comments: https://github.com/XRPLF/rippled/pull/8198#discussion_r3979325914 https://github.com/XRPLF/rippled/pull/8198#discussion_r3979424992
2.8 KiB
AGENTS.md
This file provides guidance to AI coding agents (Claude Code, and other AGENTS.md-compatible tools) when working with code in this repository.
Build
For the build steps, CMake options, and protocol codegen commands, see BUILD.md (## Steps, ## Options, ## Code generation). Nix development shells are available in the repo (not required) — see docs/build/nix.md for setup and variants.
Rust crate tests (independent of the CMake build): cargo test --manifest-path crates/Cargo.toml --workspace (CI uses cargo nextest).
Testing
Unit tests are a custom framework built into the xrpld binary itself (not Boost.Test/GTest/Catch); see CONTRIBUTING.md for the basic invocation. Notes not covered there:
- A suite's
--unittestname is built from the arguments to itsBEAST_DEFINE_TESTSUITE/BEAST_DEFINE_TESTSUITE_PRIOmacro (usually at the bottom of the test file), in reverse order and joined with.:BEAST_DEFINE_TESTSUITE(Credentials, app, xrpl)→xrpl.app.Credentials. --unittest-argdoes nothing — don't use it.- Tests that run offline in under a minute should be automatic
--unittestsuites; anything else is a manual/integration test. - New tests should be written using
gtestundersrc/tests/unless that isn't possible, in which case fall back to the legacy Beast framework undersrc/test/(see src/test/AGENTS.md for conventions specific to that directory).tests/(top-level) holds integration tests exercised againstlibxrpl/xrpld.
Lint/Format
See CONTRIBUTING.md for pre-commit setup and CONTRIBUTING.md for clang-tidy (opt-in, needs local clang-tidy and generated headers).
Code Style
New file placement and header levelization: see CONTRIBUTING.md. Braces, whitespace, member order, and other conventions: see docs/CodingStyle.md. XRPL_ASSERT/UNREACHABLE contracts: see CONTRIBUTING.md. Commit messages: see CONTRIBUTING.md. New public functions/methods need a Doxygen-style comment.
Comments should explain why, not what/how — the code already shows that. Only describe what/how when the code itself would otherwise be confusing (a non-obvious workaround, a subtle invariant, a surprising constraint).
Architecture
See ARCHITECTURE.md for the directory-by-directory map of the codebase.
Keeping docs current
When you add or change a convention, or touch a subsystem that has its own AGENTS.md, README.md, or ARCHITECTURE.md, update that documentation in the same change rather than leaving it stale.