Logo vun Tlaplus Model

Tlaplus Model

Organisatioun
opum-ai
tlaplus-model

TLA+/TLC model-checking skill. Use it whenever TLA+, PlusCal, Quint, Apalache, TLC, a .tla/.cfg file, or model-checker output appears. That includes a pasted TLC error, "Invariant X is violated", or a State 1/State 2… counterexample trace the user wants explained or triaged (real bug, model artifact, or too-strong property), even if it looks answerable by reading alone. Also use it to write, run, scale, or fix specs; debug slow or exploding TLC runs; check invariants, liveness, and fairness; replay production logs against a spec; or "model"/"exhaustively check" concurrent code, protocols, queues, caches, schedulers, leases, retries, and state machines for races, lost updates, double-spends, deadlocks, and ordering bugs, even for a design with no code yet. Not for runtime race detectors, Jepsen, Alloy, Lean/Coq proofs, or UI state-machine libraries. Pair with formal-verify for the full bug-hunt loop.

Iwwersiicht

Editeuropum-ai
Repositoryproof-skills
Skill-Nummtlaplus-model
Stären
27
Forks
6
Matgeliwwert Fichieren
40
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 40 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum opum-ai op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Tlaplus Model an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/opum-ai/proof-skills/tree/main/skills/tlaplus-model
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/opum-ai/proof-skills.git /tmp/proof-skills
mkdir -p .claude/skills
cp -r /tmp/proof-skills/skills/tlaplus-model .claude/skills/tlaplus-model
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Tlaplus Model an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Tlaplus Model automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Tlaplus Model net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

tlaplus-model

TLA+ describes a system as state plus actions (atomic steps). TLC explores every interleaving of those actions from every initial state, within the bounds you give it, and returns the shortest trace that breaks a property. That exhaustive search is what finds races no test would hit. The skill's job is to make the model faithful, small, and able to fail.

When the task is a full bug hunt, follow formal-verify for the outer loop: scope, properties, correspondence map, reproduction, fix, and report. This skill covers the modeling and checking inside it.

Setup

bash
S=${CLAUDE_SKILL_DIR}/scripts
$S/setup_tla.sh --with-jre        # tla2tools.jar + CommunityModules (+ portable JRE if no Java)
$S/tlc.sh Spec.tla --sany-only    # parse/level-check: the fast inner loop
$S/tlc.sh Spec.tla --config MC.cfg        # model check; writes .tlc-out/MC/{tlc.log,cex.json,trace.md}
$S/tlc.sh Spec.tla --config MC.cfg -- -simulate num=200000 -depth 60   # random walks for big models

tlc.sh runs SANY, then TLC with -workers auto, and saves the JSON counterexample. It also prints a step table (action, code pointer, changed variables) produced by parse_tlc_trace.py. It exits with TLC's code: 0 ok, 11 deadlock, 12 invariant, 13 temporal/action property, 10 ASSUME/POSTCONDITION false, 150 parse error. Full CLI notes: references/tlc-cli.md.

The modeling loop

  1. Start from a pattern. assets/patterns/ has seven small, runnable, checked specs. Each has a fix toggle and three configs (MC.cfg passes, MC_bug.cfg fails, and MC_sanity.cfg fails on purpose). Copy the closest one, then read references/patterns.md.

    Code shapePattern
    read-modify-write, counters, check-then-act, locksLostUpdate
    async/await, cache-aside, fill vs. invalidateCacheAside (+ trace validation harness)
    retries, webhooks, at-least-once delivery, dedup tablesIdempotentRetry
    leases, job claiming, leader leases, GC pauses, fencing tokensJobLease
    streams, queues, batching, backpressure, end-of-streamBatchPipeline
    DAG executors, build systems, workflow engines, graph invariantsDagScheduler
    persisted status fields, order/payment/ticket lifecyclesOrderStateMachine
  2. Pick the atomicity. One action is one atomic region of the real code:

    • the code between two awaits,
    • a locked section,
    • a single shared read or write,
    • a single SQL statement, or
    • one message handler.

    Merging regions the code runs separately hides exactly the race you want. Put \* src: path:lines above each action. formal-verify uses these tags for its correspondence map, drift checks, and trace tables.

  3. Model only what the properties need. Collections become sets or functions, and payloads become small ranges. Keep 2 actors and 2–3 values at first. Time becomes an Expire/Timeout action rather than a clock. The environment (network drop, crash, pause) becomes explicit actions, so their interleavings are explored too.

  4. Write properties before running.

    • Invariants hold in every state.
    • Action properties constrain every step, e.g. [][status' # status => <<status, status'>> \in Allowed]_vars.
    • Liveness (<>, ~>) needs fairness (see step 6).

    Guard "coherence" invariants with a quiescence predicate when mid-flight staleness is legitimate.

  5. Prove the model can fail. Before trusting a green run:

    • (a) a sanity invariant that must be violated (for example, "the done state is never reached"), which shows the interesting states are reachable;
    • (b) the bug toggle: turn the fix off and confirm the target property fails;
    • (c) -coverage 1 shows no action that is never enabled.

    A spec that has never failed is not evidence.

  6. Add fairness honestly. Liveness needs WF_vars(A) or SF_vars(A) on the actions the real system guarantees will eventually run (a scheduler runs ready work, a consumer keeps polling). Never put fairness on environment faults, and never add it only to make a property pass. Keep liveness and symmetry in separate configs: symmetry reduction is unsound for liveness.

  7. Read the counterexample. Use trace.md, then tell the story in domain terms. Decide between a real bug, a model artifact (a missing guard, or steps merged or split wrongly), and a property that is too strong. Hand real bugs back to formal-verify for reproduction.

  8. Scale carefully. Grow one bound at a time. If the state space explodes:

    • add a SYMMETRY set (safety only),
    • add a VIEW to drop auxiliary variables,
    • add a CONSTRAINT (and report it),
    • switch to -simulate,
    • use Apalache for bounded symbolic checks (references/apalache-quint.md).

Hard-won rules

  • None == -1 needs EXTENDS Integers; Naturals has no unary minus. Mixing strings, model values, and integers in comparisons is legal only for model values; otherwise use one type per variable.
  • IF … THEN … ELSE … swallows every conjunct after it. Parenthesize: x' = (IF c THEN a ELSE b).
  • Every action must mention every variable (primed, or in UNCHANGED). A missing one means "any value", which gives states that make no sense. TypeOK catches it.
  • A terminating system deadlocks by design. Add an explicit Terminated == Done /\ UNCHANGED vars disjunct rather than disabling deadlock checking; -deadlock hides real stuck states.
  • Only the agent's own modeling choices may change freely. Frozen properties (Properties.tla), CONSTRAINTs, and fairness changes are reported in the findings, never quietly edited.

Beyond checking a model

  • Trace validation (strongest drift defense): log events from the real system as ndjson and replay them through the spec. assets/patterns/CacheAside/TraceCacheAside.tla is a working harness (trace-ok.ndjson is accepted; trace-drift.ndjson is rejected with exit 10). See references/trace-validation.md.
  • Model-based testing: generate traces from the model and drive the real code with them (quint run --mbt, or TLC -simulate with -dumpTrace json).
  • Refinement: show a detailed spec implements a simple one (INSTANCE … WITH, checked as a PROPERTY). proof-simplify uses refinement to show a simpler design keeps the guarantees.

Reference files

  • references/patterns.md — the seven patterns: the bug each one finds, the fix, and how to adapt it.
  • references/tlc-cli.md — TLC/SANY/PlusCal flags, .cfg keywords, exit codes, performance.
  • references/pitfalls.md — vacuity, over- and under-modeling, liveness traps, agent reward hacking.
  • references/trace-validation.md — logging events from code and replaying them in TLC.
  • references/apalache-quint.md — when and how to use Apalache and Quint instead of TLC.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Tlaplus Model?

TLA+/TLC model-checking skill. Use it whenever TLA+, PlusCal, Quint, Apalache, TLC, a .tla/.cfg file, or model-checker output appears. That includes a pasted TLC error, "Invariant X is violated", or a State 1/State 2… counterexample trace the user wants explained or triaged (real bug, model artifact, or too-strong property), even if it looks answerable by reading alone. Also use it to write, run, scale, or fix specs; debug slow or exploding TLC runs; check invariants, liveness, and fairness; replay production logs against a spec; or "model"/"exhaustively check" concurrent code, protocols, q...

Firwat Tlaplus Model op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Tlaplus Model besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Tlaplus Model an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/opum-ai/proof-skills/tree/main/skills/tlaplus-model an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Tlaplus Model benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Tlaplus Model benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Tlaplus Model domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Tlaplus Model gratis?

Jo. De Skill gëtt vum opum-ai ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇