- 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, incrementCURRENT_SCHEMAand add the matching step totools/storage-convertin the same change. The tool reads the old datadir without change and writes a new datadir. Record the step indocs/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 changeCURRENT_SCHEMAor 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.rsbehind#[cfg(kani)], Rust reference models insrc/<owner>_model.rs, and Lean proofs indocs/lean/, one file for each Rust owner module. Keep TLA+ models indocs/models/<Model>/<SubMachine>.tlafor safety and liveness. Do not commitsorryoradmit. - When you change a module that has a
proofs.rsfile, a*_model.rsmodel, or a Lean file indocs/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-05in Rust,-- RCV-04in Lean, and\* RCV-04in TLA+. - Do not edit generated files. Run
cargo run --locked -p contract-indexto regeneratedocs/contracts/evidence-index.mdand the contract list indocs/contracts/README.md. Runscripts/extract_lean.shto regeneratedocs/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
anyhoworBox<dyn Error>for errors. Define athiserrorenum for each failure domain, in libraries, binaries, tests, and tools alike. Keep each variant's source with#[from]or#[source]. - Use the
logcrate for logging. Do not usetracingfor logging. - Write contracts, policies, and other maintainer documents in ASD-STE100. Write operator guides in plain language.