Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
\* Coarser ticks (20 s) than DrainLease.cfg: safety does not depend on timing, and the state space stays small.
\* Safety under every adverse assumption: fenced transactions longer than the renewal timeout,
\* fenced transactions that overtake a waiting renewal, and pid probes (or --force-break-lock) that steal live leases.
\* Leases may lapse here; two drainers may never both have fenced work open, and the cursor never moves backward.
SPECIFICATION Spec
CHECK_DEADLOCK TRUE
CONSTANTS
Procs = {p1, p2}
Lanes = 1
TickMs = 20000
TtlMs = 120000
RefreshMs = 20000
RenewTimeoutMs = 30000
StealGraceMs = 60000
TakeoverGraceMs = 60000
MaxTxMs = 60000
CancelMs = 120000
RenewalWinsGap = FALSE
UnsafeSteals = TRUE
Stamps = FALSE
MaxTime = 10
MaxTokens = 3
MaxCursor = 2
MaxSleeps = 1
MaxCrashes = 1
SYMMETRY Symm
INVARIANT TypeOK
INVARIANT FencedTxnsMatchRow
INVARIANT OneDrainer
PROPERTY CursorMonotone