agentleFS
EtanHeyEtanHey/golems/.claude/skills/verify-merge-receipts/SKILL.md

verify-merge-receipts

Skill0 starsChanged 20 days agoApache-2.0View on GitHub

Verify guarded-merge receipts when changing scripts/ratchet/ (local-run.sh, post-merge-live, live-rows.sh, live/status.sh, mac/hc-probe.py, live-freshness.mjs, check-comment.mjs, guarded-paths.sh, guarded-set.mjs), install-hooks.mjs status/selectedPin, hookDriftPaths (hooks/hook-paths.mjs), scripts/hooks/manifest.json, scripts/golems-lead-confirm, human-confirm-gate's tokens.py (lead_metadata, lead_scope), or pr-loop's merge step. Rerun MergeReceipts and check its mapping to the source.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read every result with pstack /statechart, including passes.

    line 50
  2. Distinctive:

    Before judging a change, diff these files against the sync commit and trace each changed step, guard or ordering to a model action.

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Verify merge receipts

Three promises, checked by TLC over every order of events in a small model of P merging while another lead's PR Q pushes or merges:

  • ReceiptMatchesMerge: a merge counts as receipted only if the Mac receipt's head is the merged head.
  • LiveReceiptIsolated: a live receipt says PASS exactly when hooks-live serves every hook-loaded master change, whatever another PR does.
  • NoFalseFresh: freshness PASS means hooks-live serves every hook-loaded master change, except changes still in their 120-minute grace.

Breaking them ships unmeasured code as receipted, turns healthy installs red, or keeps CI green on stale live hooks.

Run from the repository root

Needs Python 3, Node, bash, Java 11+ and a tlc executable using tla2tools 1.7.4 (TLC2 2.19).

python3 .claude/skills/verify-merge-receipts/verify.py

The command takes about 15 s. It first derives today's flags from the code: HeadBound, MatchHead, PinLease, Status, GraceBound and GuardHookPaths. Two are behavioural:

  • Status comes from running the real live/status.sh on the real status() line template.
  • GuardHookPaths builds a scratch commit for each real hookDriftPaths() dir. The commit is an unreferenced object with no ref and no working-tree change, touching one file in that dir. The real guarded-paths.sh must call that commit guarded. Freshness must also cover the dir: either live-freshness.mjs imports guarded-set.mjs, or (master's form) its inline guardedAt list does.

The other four are text probes. The three Today* runs use configs built from those flags. TodayMerge, TodayLive and TodayFresh must pass when their fix flag (MatchHead, PinLease, GuardHookPaths) reads TRUE, and are known findings otherwise. If the committed Today*.cfg snapshots disagree with the code, the command prints a NOTE. It then runs every other config in docs/tla/merge-receipts/, plus TodayWithFixes: today's flags with all three fixes switched on, so a regression in any other flag fails it. Evidence goes to docs.local/verify-merge-receipts/run-*/.

  • Exit 0: everything passes as expected.
  • Exit 1: only known findings remain. Report them; never certify. Master exits 0 since #1102: all three findings (TodayMerge, TodayLive, TodayFresh) have landed fixes.
  • Exit 2: source drift, an unexpected pass or violation, or a missing tool.

Missing tools fail; they are never skipped. See the results table.

Read every result with pstack /statechart, including passes. It turns each violation into its shortest path in plain words and draws the reachable states. Take its commands and tooling from its own instructions. The committed bug-path chart records today's paths.

Coverage and synchronization

Source sync commit: 475763a465b9e8f12d9706b0ba7efdb71522e34e (master).

Model surfaceSource coverage
MacStart, MacPostscripts/ratchet/local-run.sh (head read, table.mjs --head "$INSTALL"), lib.sh ratchet_post_mode
CIRun, HeadBoundscripts/ratchet/check-comment.mjs checkVerdict; .github/workflows/ratchet.yml Mac rows step
LeadSeesGreen, Merge, MatchHeadskills/golem-powers/pr-loop/references/merge-and-verification.md: merge command and step 1b
LivePinFetch, LivePinscripts/ratchet/post-merge-live.mjs update call; scripts/hooks/install-hooks.mjs selectedPin() (fetch, resolve origin/master), pinLive()
LiveLease, PinLeasescripts/ratchet/post-merge-live.mjs lease search (--lease-pr, --lease-repo)
LiveRereadscripts/ratchet/live-rows.sh: gh pr view of the lease head and the --lease-repo head check
LiveStatusFetch, LiveStatus, Statusscripts/ratchet/live/status.sh; scripts/hooks/install-hooks.mjs status(), hookDriftPaths(); scripts/hooks/manifest.json (which paths count as hook-loaded)
LiveTokenscripts/ratchet/mac/hc-probe.py steps B and C; scripts/golems-lead-confirm (issuer); skills/golem-powers/human-confirm-gate/hooks/tokens.py lead_metadata(), lead_scope(); row live-human-confirm in rows.json
Fresh, GraceBound, GuardHookPathsscripts/ratchet/live-freshness.mjs (checkLiveFreshness, main, guardedAt); scripts/ratchet/guarded-paths.sh; scripts/ratchet/guarded-set.mjs once it exists; scripts/hooks/manifest.json (via hookDriftPaths(), in install-hooks.mjs or scripts/hooks/hook-paths.mjs)

Before judging a change, diff these files against the sync commit and trace each changed step, guard or ordering to a model action. The flag probes catch only the six facts they test, so a plain pass does not prove that the rest of the model still matches. Move the sync commit forward only after confirming that the model describes the code at the new commit. When a fix lands, its Today* run turns into a required pass on its own. Then flip the flag in the three committed Today*.cfg snapshots, which clears the NOTE, and update the README and the chart. Use /maintain-formal-verification-skill to bring an old coverage record up to date.

Real bug or modeling error

Replay the counterexample against the code, one action at a time, with fakes for GitHub and the hooks. Never post a real receipt or issue a real token to verify. If the replay reproduces, the bug is real: report it with its path, and do not weaken the property. A step the code cannot take, a wrong atomic boundary (for example a lease read that the code repeats), or a flag probe that reads the wrong line is a modeling error. Fix the model or the probe, keep the history and rerun every config.

Scope: one P, one Q and one lease PR that the caller owns. Each PR pushes at most once, and one local-run and one post-merge-live run at a time. Hooks are assumed to work. Time is the single step "120 minutes pass". Row timeouts, parity, M1 sync, Q's own receipts and the grace covering a FAILED receipt (by design) are not modeled.

To check that the command catches a real source change, save scripts/ratchet/live/status.sh, put the FX16 end-anchored regex back (drift=([0-9]+)$) and rerun. It must exit 2 with TodayWithFixes violating LiveReceiptIsolated. Restore the exact bytes in a finally block and rerun to get exit 0 again. Never commit the scratch change.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.