Skip to content

Latest commit

 

History

History
22 lines (21 loc) · 4.73 KB

AGENTS.md

File metadata and controls

22 lines (21 loc) · 4.73 KB

AGENTS.md

  • Preserve consensus behavior and externally observable behavior unless the task explicitly changes it.
  • Keep one authoritative owner for each invariant and durable representation. Prefer existing boundaries and direct calls over duplicate state, forwarding wrappers, or speculative abstractions.
  • Keep changes scoped to the task. Remove superseded code with its replacement, and do not mix unrelated cleanup into the same change.
  • Follow Source and test organization when adding or reorganizing modules, tests, and fixtures; it owns placement defaults and exception criteria.
  • Minimize the project's active state. Keep code, tests, abstractions, contracts, and documentation only while they protect current behavior, a safety or correctness invariant, operator data, or an active requirement, or are the evidence for one. Historical implementation shapes, completed plans, duplicate rules, and superseded scaffolding belong in Git history, not the active tree.
  • Before changing consensus, persistence, or concurrency, inspect the owning contracts and the tests that exercise success, failure, commit, recovery, and lock-order behavior.
  • A change that can affect Node synchronization must say so in its PR: (a) whether it touches an authoritative sync, validation, or commit path; (b) which SYNC-* clauses in docs/contracts/synchronization.md it can affect; and (c) the smallest existing behavioral proof that exercises those clauses, from that contract's evidence map. "No sync impact" is a valid answer for an isolated read-only change, but justify it by the ownership and call boundary you did not cross, not by the number of crates you touched. Run the smallest relevant proof; slow process, crash, contention, and interoperability campaigns stay in their existing deep lanes. Add a narrow regression only for a genuine uncovered gap, and record any proof gap explicitly.
  • Preserve operator data. Schema changes must use the documented migration or replay path and must never reset data implicitly.
  • When a change breaks authoritative chainstate bytes covered by CURRENT_SCHEMA, increment CURRENT_SCHEMA and add the matching step to tools/storage-convert in the same change. The tool reads the old datadir without change and writes a new datadir. Record the step in docs/policies/db-migration.md. For an owner-local format break, increment that owner's format marker and follow its documented preserve, quarantine, migrate, or rebuild policy. Owner-local versions do not change CURRENT_SCHEMA or require an authoritative converter step.
  • Run the smallest meaningful verification for the changed surface. Broad integration, reference, platform, and performance campaigns belong to their owning CI or evidence workflows.
  • Describe implemented behavior as implemented and target design as target design. Do not claim correctness, compatibility, durability, or performance without the evidence owned by that claim.
  • Keep each proof beside its owner. Put Kani harnesses in src/<owner>/proofs.rs behind #[cfg(kani)], Rust reference models in src/<owner>_model.rs, and Lean proofs in docs/lean/, one file for each Rust owner module. Keep TLA+ models in docs/models/<Model>/<SubMachine>.tla for safety and liveness. Do not commit sorry or admit.
  • When you change a module that has a proofs.rs file, a *_model.rs model, or a Lean file in docs/lean/, run ./scripts/ci-pr.sh proofs. CI does not run this stage.
  • When a test, Kani harness, reference model, Lean theorem, or TLA+ module proves a contract clause, put a tag line directly above it. The tag line holds only clause IDs: // RCV-04, SYNC-05 in Rust, -- RCV-04 in Lean, and \* RCV-04 in TLA+.
  • Do not edit generated files. Run cargo run --locked -p contract-index to regenerate docs/contracts/evidence-index.md and the contract list in docs/contracts/README.md. Run scripts/extract_lean.sh to regenerate docs/lean/Extracted/.
  • Give each new test an expected value from a specification, an external vector, a reference implementation, or an invariant, never from the code under test. Make the test fail before the fix. Do not add snapshot, wording, or source-text tests.
  • Do not write source comments, except // SAFETY: comments, legal notices, contract tag lines, and rustdoc that states an invariant that no name, type, or test can carry.
  • Do not use anyhow or Box<dyn Error> for errors. Define a thiserror enum for each failure domain, in libraries, binaries, tests, and tools alike. Keep each variant's source with #[from] or #[source].
  • Use the log crate for logging. Do not use tracing for logging.
  • Write contracts, policies, and other maintainer documents in ASD-STE100. Write operator guides in plain language.