2. Pair & Triad Programming

2.3 Cryptographic File-Scope Leases & Small-Diff Gates

chinwag claim --file-scope "crates/**" --ttl 120s

Ed25519-signed 120s path leases (SignedClaimReceipt), mutually exclusive --file-scope globs in .chinwag/state.crdb, and mandatory <=150 LOC atomic checkpoints.

2.3 Cryptographic File-Scope Leases & Small-Diff Gates

chinwag claim --file-scope "crates/**" --ttl 120s

Outcome Summary & Δ Velocity Proof: Prevent parallel coding agents from silently overwriting each other's files or dumping unreviewable 1,500-line commits. Chinwag enforces Ed25519-signed file-scope leases (MAX_TTL_SECONDS = 120) and mandatory small, atomic jj checkpoints (<= 150 LOC).


1. Pre-Claim Architectural & File-Scope Lease Gate (chinwag-claim)

Before any agent writes a single byte to disk, it must acquire a signed claim lease (SignedClaimReceipt::verify_binding) in .chinwag/state.crdb:

  1. Disjoint --file-scope Globs: When chinwag pair start or chinwag triad start is invoked, Chinwag intersects the requested path globs (--seat-a "backend-seat:crates/api/**", --seat-b "ui-seat:web/**"). If two seats request overlapping write globs without an explicit interface contract, chinwag fails closed (exit 78) before execution begins.
  2. Pre-Claim Invariant & Tombstone Check (inv-pre-claim-architectural-gate-v1): Acquiring a lease automatically queries .chinwag/state.crdb and .chinwag/memory.crdb.leann for active verified_invariants and DO_NOT_REPEAT negative tombstones matching the target file_scope.
  3. 120-Second Bounded TTL & Quiescence (MAX_TTL_SECONDS = 120): Leases automatically expire after 120 seconds unless renewed by an active, healthy agent process group (GroupState::Quiescent check).

2. Mandatory Small-Diff Checkpoint Gate (INV-SMALL-JJ-DIFF-01)

Large diffs destroy review quality and inflate LLM context costs. Every chinwag task checkpoint, chinwag pair checkpoint, and chinwag triad checkpoint enforces:

  • Soft Cap (150 LOC): Target atomic checkpoint size (~50–150 net changed lines of code, < 4,000 review tokens).
  • Hard Ceiling (300 LOC): If jj diff --stat exceeds 300 LOC, chinwag prompts the agent (or invokes Chinwag Delivery-2) to run jj split into smaller coherent revisions before handoff.
  • Repository Persistence (INV-REPO-PERSIST-01): Verifies the workspace has a valid remote (origin) and zero untracked scratch binaries outside the repository.

Verification Command

chinwag memory recall --bank default --query "lease invariant" --file-scope "src/**" --limit 5