Files
rippled/AGENTS.md
Mayukha Vadari 6dc958c136 docs: Fix std::unexpected wording, split UNREACHABLE out of amendment section
- ledger/helpers/AGENTS.md: std::expected<..., TER>/std::unexpected(tec*)
  is already the established idiom here (confirmed in AMMHelpers.cpp,
  CredentialHelpers.cpp), not something to avoid; reword so the rule
  doesn't read as discouraging it.
- transactors/AGENTS.md: the UNREACHABLE/LCOV_EXCL coverage rule isn't
  amendment-specific, so give it its own heading instead of nesting it
  under "Gating amendment-dependent code".
- Root AGENTS.md: comments should explain why, not what/how, since the
  code already shows that.
- Drop the pseudo-account exemption rule from transactors/AGENTS.md —
  needs refining before it's codified.

Addresses PR review comments:
https://github.com/XRPLF/rippled/pull/8198#discussion_r3962352164
https://github.com/XRPLF/rippled/pull/8198#discussion_r3967566278
2026-09-09 13:58:12 -04:00

3.0 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

Recommended on Linux/macOS: the Nix devshell sets up the compiler, Conan, ccache, and (optionally) Rust automatically.

nix develop

Not required — contributors can use their own toolchain/build flow instead. For alternate devshell variants (specific compiler, no-compiler, coverage), see docs/build/nix.md. For manual (non-Nix) build steps, CMake options, and protocol codegen commands, see BUILD.md (## Steps, ## Options, ## Code generation).

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 --unittest name is built from the arguments to its BEAST_DEFINE_TESTSUITE/BEAST_DEFINE_TESTSUITE_PRIO macro (usually at the bottom of the test file), in reverse order and joined with .: BEAST_DEFINE_TESTSUITE(Credentials, app, xrpl) → xrpl.app.Credentials.
  • --unittest-arg does nothing — don't use it.
  • Tests that run offline in under a minute should be automatic --unittest suites; anything else is a manual/integration test.
  • New tests should be written using gtest under src/tests/ unless that isn't possible, in which case fall back to the legacy Beast framework under src/test/ (see src/test/AGENTS.md for conventions specific to that directory). tests/ (top-level) holds integration tests exercised against libxrpl/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.