formal-claim-protocol
TLA+ model of the work-item tracker's GitHub claim protocol: one issue claimed at once by a local session's default claim, the issue lane's lease-only claim…
от melodic-software★ 34 звезды на GitHub
Установить formal-claim-protocol в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Formal check: the claim protocol
Property
Each rule is an INVARIANT in model/ClaimProtocol.tla; the quoted line is the source it encodes.
Paths are under plugins/work-items/tools/work-item-tracker/.
| Rule | Plain sentence | Source |
|---|---|---|
OneHolder |
At most one claimant works the item while its own lease is live. | CONTRACT.md "Lease protocol" step 4: "If an earlier live lease exists that is not our own comment, the foreign lease wins → supersede own comment, exit 7."; adapters/github/claim.sh: "# Earliest LIVE lease wins." |
LaneAssignsNoOne |
The issue lane's lease-only claim never assigns anyone. | CONTRACT.md: "Lease-only (--lease-only): the claim posts the lease comment and assigns no one." |
HolderAssigned |
A default claimant that holds the item is assigned to it. | CONTRACT.md: "Claim = assignee (authenticated human user) + lease record." |
NoStrandedAssignee |
Every assigned login belongs to a claim still in flight. | adapters/github/claim.sh: "any failure before a successful lease-comment write (step 3) would otherwise strand the issue assigned with no lease record" |
LoserSupersedesOwn |
A claimant that lost arbitration has superseded its own lease. | CONTRACT.md step 4: "the foreign lease wins → supersede own comment, exit 7." |
CompletedRunHoldsNothing |
No claimant backs off from a lease whose run had completed. | CONTRACT.md step 4: "A run whose status is completed, whatever its conclusion, holds nothing, so its lease is superseded in place" |
ReleaseFreesItem |
A claimant that released no longer holds a live lease. | CONTRACT.md, Release: "a session that has finished with an item hands it back at once instead of blocking every later claim" |
How each rule reads the model's states:
- "Works the item" (
Holding): the claim returned success, no release returned success, no renew told the session it lost or is still re-checking after a late renew, and its own lease is live. HolderAssignedis checked in quiescent states only (every claimant holds, has finished, or has not started): the hand-back removes and restores a same-login holder's assignee two calls apart.- "In flight" (
NoStrandedAssignee): a default claimant of that login has started and not returned: it is claiming, holds the item, or is renewing, releasing or handing back. LoserSupersedesOwncovers a claimant that lost, failed or died; it assumes writes succeed, since the supersede is best-effort.CompletedRunHoldsNothingrecords the moment a claimant's decision goes against the lane's lease while the lane's run has completed.
TypeOK checks the variables' types. EndStateReclaimable is an extra rule, outside the seven the owner approved
(adapters/github/claim.sh: "reclaim ignores items with no lease"): once every claimant
has finished and no lease is live, any assignee left is the holder of the active lease, which
reclaim unassigns.
Harm
Two sessions work the same issue at once and push conflicting changes, or an issue stays assigned with nobody working it and drops off the frontier.
Tool and why
TLA+ with TLC, read through /formal-verification:chart. The question is whether the GitHub calls
of three sessions can interleave into a bad order; a model checker tries every order of a small
model, and the races live between comment, assignee and clock reads that no unit test sequences.
Bounds and assumptions
- One issue; three claimants:
local(loginhuman), the lane (holderbot,--lease-only,session_idrun-<id>) andtriage(loginhumanorother; both are explored). The cfg'sStartersnames the claimants that start a claim. - Each claimant claims once, renews at most once (
WithRenew) and releases at most once; at most three lease comments; one renewal generation per lease. - Every GitHub read and write is its own step. A lease list retried once is one step.
- One clock for every claimant: entering the 300 s margin and expiring are global events per lease.
With
BoundedStall, a body read more than 300 s before its expiry is judged before it expires, and a renew that judged its lease outside the margin PATCHes before it expires. - Lease comment ids grow in posting order.
- The lane's run can end at any point after its lease is posted, without releasing.
- Failures are off unless a cfg turns them on:
WritesMayFail(each best-effort write may fail),ReadsMayFail(the reads whose failure does not exit may fail),MayDie(a claimant may die between any two steps; a checked call's failure exits the same way).RenewDeathKeepsHoldingisFALSE: a renew that dies after its PATCH ends the session. - The cfg uses
VIEW View, which drops script-local values a claimant never reads again. Under it TLC's distinct-state count depends on exploration order; the chart command runs one worker, so its count is stable. The view does not decide the verdicts: withoutVIEWboth cfgs hold
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- model/ClaimProtocol.tla
- model/LocalLane.cfg
- model/LocalTriage.cfg
- model/view.mjs
- sync.yaml
FAQ
Что делает скилл formal-claim-protocol?
TLA+ model of the work-item tracker's GitHub claim protocol: one issue claimed at once by a local session's default claim, the issue lane's lease-only claim and a triage claim, each able to renew once and release, with lease expiry, the 300 s skew margin, the completed-run rule and the assignee hand-back. Use when a change touches the GitHub adapter's claim.sh, renew-lease.sh, release.sh, common.sh, lib/lease.sh or the tracker contract's Lease protocol, or to ask whether two claimants can both work one item.
Как установить скилл formal-claim-protocol?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл formal-claim-protocol запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…