tla-model
Skill2 starsChanged 2 months agoMITView on GitHub
Models concurrent and distributed designs in TLA+ or PlusCal and checks them with the TLC model checker. Use when asked to write, review, or debug a TLA+ spec, .tla/.cfg files, or TLC output, or to model-check or formally verify a protocol, lock, lease, consensus, replication, WAL, retry, or race condition. Do NOT use for unit or property-based tests (use test-writing) or for Lean, Coq, Dafny, or Verus proofs.
In this repository27 other files it gives its agents.
- agent-guardrailsSkill
- benchmark-checklistSkill
- blast-radiusSkill
- blog-reviewSkill
- code-reviewSkill
- create-verification-skillSkill
- datavizSkill
- grill-meSkill
- grok-repoSkill
- hammerspoonSkill
- html-lessonSkill
- karpathy-planningSkill
- mechanism-vizSkill
- obsidian-captureSkill
- obsidian-searchSkill
- paper-searchSkill
- readbackSkill
- repo-evalSkill
- route-skillSkill
- sherlockSkill
- show-meSkill
- sketch-conceptSkill
- skill-curatorSkill
- test-writingSkill
- web-recapSkill
- write-docsSkill
- write-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Counterexample loop: Write each violation to spec/cex/NNN.md from CEX-TEMPLATE.md:
- Very specific: line 40
Never weaken a property, add fairness, or add a CONSTRAINT to turn a run green without the user's approval.
- Distinctive: line 50
Not verified: behaviors outside the bounds or exclusions, and any claim that needs a parametric proof (TLAPS or an inductive invariant).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
tla-model
The deliverable is a checked argument, not a .tla file: every property traces to a requirement, every action to an implementation event, and every green result survives mutation. TLC finding nothing means no counterexample in this model at these bounds; never call it a proof.
Setup
scripts/tlc.py check examples/MiniLock.tla -c examples/MiniLock.cfg # expect "result: clean", exit 0
scripts/tlc.py fetch # if tla2tools.jar is missing; or set TLA2TOOLS_JARMissing Java: ask the user to install a JRE 11+; do not download one. scripts/test_tlc.sh self-tests the helper. PlusCal: run scripts/tlc.py translate Spec.tla before every check.
tlc.py check prints result, state counts, per-action coverage, the full trace, and VACUITY: flags. Exit 0 clean, 1 violation, 2 vacuous, 3 setup/parse error. tlc.py mutant applies one exact-match edit to a copy and exits 0 only when the named property catches it (KILLED).
A question about an existing spec or TLC output needs only check and the matching step below. Create files only when asked to model or verify a system. Keep that work in spec/ beside the code: modeling-brief.md, <Name>.tla, one cfg per concern, cex/, report.md.
Loop
- Brief before spec. Fill BRIEF-TEMPLATE.md into
spec/modeling-brief.md. Aim the question where bugs have lived: searchgit logand the issue tracker for fix, race, crash, deadlock, corrupt, and stale on the core files, group the hits by mechanism, and note where the code departs from the reference algorithm. Build the event→action table from the code you read, citingfile:line, not from the paper the design resembles; a textbook Raft is not the user's Raft. List every open question and stop until the user answers. Done: every REQUIRED slot filled; the user has confirmed the fault model, atomicity, and exclusions. - Grow the spec one layer at a time: variables →
TypeOK→Init→ one named action →Next, then the next action. Runcheckafter each layer. Give each action a comment naming its implementation event. Done: clean, noVACUITYflags, every action fired. - Safety. Add the invariants from the brief to a safety cfg with
CHECK_DEADLOCK TRUE; turn deadlock checking off only when termination is the intended end state, and say so. Bound fault injections (crashes, drops, timeouts) with counters; leave normal operations unbounded. Run the bounds matrix from the brief, smallest first, plus one tight cfg per bug-history mechanism. A violation goes to step 6. Done: every brief property is enabled in at least one cfg, checked by reading the cfgs. - Liveness, only after safety is clean. Use one cfg per temporal property: TLC does not name which temporal property failed. Never use
SYMMETRYin a liveness cfg. EachWF/SFterm carries a comment naming the real mechanism behind it (FIFO queue, retransmit, lease expiry). If no mechanism exists, delete the term and report the starvation trace as a finding. - Prove the properties bite. For each invariant, delete the guard it depends on; for each liveness property, drop its fairness term:
scripts/tlc.py mutant spec/Lock.tla -c spec/Safety.cfg --replace '/\ lock = None' '/\ TRUE' --expect MutexOLDmust match exactly once, so include the neighbouring text if it doesn't. A mutant that no longer parses exits 3 and proves nothing. ASURVIVEDresult means the property is too weak, redundant, or guards an unreachable action. Fix it and ask the user before changing any property's meaning. Done: every property has at least oneKILLEDmutant, recorded in the report. - Counterexample loop. Write each violation to
spec/cex/NNN.mdfrom CEX-TEMPLATE.md:- Find the first state where things go wrong.
- Map each step to a code event and a fault the brief allows.
- Classify it: design, spec, property, config/bounds, mapping, or fairness/assumption.
- REQUIRED: change exactly one of model, property, or cfg per round. Replay the trace, then rerun the whole matrix.
- Never weaken a property, add fairness, or add a
CONSTRAINTto turn a run green without the user's approval.
- Back to code. A design-class counterexample is confirmed only when a test or fault-injection run against the implementation reproduces it and has actually been run. Otherwise report it as unconfirmed with the missing step. For high-stakes specs, add refinement or trace validation (REFERENCE.md).
- Independent review. Hand only the brief, spec, cfgs, and report to a reviewer with fresh context, such as a new session or another person. Ask them to attack it with the review checklist in REFERENCE.md. Fold the findings into step 6.
Report (spec/report.md)
- Per cfg: TLC version, constants and bounds, generated/distinct states, depth, and result.
- Mutants: each property, its mutation, and KILLED/SURVIVED.
- Counterexamples: id, class, confirmed or unconfirmed, fix, and linked test or issue.
- Assumptions in force: fault model, atomicity choices, every fairness term and its mechanism, every
CONSTRAINT. - Not verified: behaviors outside the bounds or exclusions, and any claim that needs a parametric proof (TLAPS or an inductive invariant).
Claim only what the report shows. "No counterexample with 3 nodes, 2 values, queue ≤ 2" is the strongest sentence a green run supports.
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
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.

