Skip to content

Herlihy Doctrine

Fires the wait-free/lock-free doctrine exactly when you touch concurrency code — a PreToolUse hook injects the Herlihy checklist on any lock/atomic/CAS/fetch-add/CUDA-sync edit.

plugin-validate License: FSL-1.1-ALv2 Docs Claude Code plugin DeepWiki

Herlihy Doctrine is a Claude Code plugin for concurrency, lock-free, and wait-free work. A SessionStart hook primes the doctrine posture once. A non-blocking PreToolUse hook inspects what Write/Edit is about to put on disk and, when it sees a lock, atomic, CAS, fetch-add, thread spawn, channel, or CUDA sync, injects the Herlihy checklist next to the edit. The edit still proceeds — you just get the reminder to pick the sound primitive and prove the progress guarantee.

Named for Maurice Herlihy, who founded wait-free synchronization.

Install

Claude Code

/plugin marketplace add 88plug/claude-code-plugins
/plugin install herlihy@88plug

Grok Build

grok plugin marketplace add 88plug/claude-code-plugins
grok plugin install herlihy@88plug --trust

Tip

Hooks and the bundled skill wire automatically from the plugin manifest. There is no status-line or settings step — install.sh is a no-op.

What it fires

The PreToolUse gate runs only when the edited content is concurrency code:

  1. Consensus need → CAS (∞) if multi-party agreement, fetch-add (2) if a monotonic counter. Never fetch-add where agreement is needed.
  2. Linearization point → one atomic step (CAS / release-store) where the effect becomes visible; linearizability composes per-object.
  3. Progress guarantee → claim only what you can prove. Single-CAS with bounded retry is wait-free; a livelock-able CAS-loop is only lock-free; any Mutex/RwLock/blocking is not non-blocking — that is the thing to rewrite.
  4. Reclamation → by reader lifetime (bounded GPU readers → epoch-based).

Hooks

Hook Event What it does
prime.sh SessionStart Sets the doctrine posture once per session
gate.sh PreToolUse (Write/Edit/MultiEdit) Fires the checklist only when the edited content is concurrency code — non-blocking

Composes with

Pair with read-the-damn-docs for the exact atomic API and memory ordering before writing it — a wrong ordering is a Heisenbug a parity gate catches only sometimes. The bundled herlihy skill carries the verified corpus (consensus hierarchy, linearizability, universal construction, Pass-the-Buck reclamation, the progress lattice) and the NOT-Herlihy attributions (hazard pointers = Michael, MS-queue, Fraser's EBR, Treiber, Kogan-Petrank).

Test

bash tests/smoke.sh

Prime injects; the PreToolUse gate fires on concurrency content, is silent on plain edits, and is always non-blocking.