Visualizes TLA+ state machines as Mermaid diagrams and generates Lean 4 proof trees with plain-English explanations. Reports shortest bug paths for TLA+ models and lemma graphs, gaps, and failing steps for Lean proofs.
Ships in pstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Draw how a TLA+ system moves between states or how a Lean 4 proof works, in the operator's words.
scripts/statechart runs scripts/statechart.ts with Node 22.18 to 22.x, Node 23.6 or later, Bun 1.1.5 or later, or Deno 2.0 or later. On native Windows, run node --disable-warning=ExperimentalWarning <skill dir>/scripts/statechart.ts with Node 22.18 to 22.x, or Node 23.6 or later. The first positional argument picks TLA+ or Lean 4 mode. --out DIR must be new or empty in both modes.
Work in a scratch folder outside the repo, write a TLA+ spec and its config, and run:
<skill dir>/scripts/statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR]
The first TLA+ run installs TLC and Java with mise and needs network access. --tactics applies only to .lean files and exits 2 on .tla inputs.
Run against a .lean file pinned to Lean v4.34.1, or a standalone .lean file with no lean-toolchain:
<skill dir>/scripts/statechart FILE.lean THEOREM [--view FILE] [--tactics] [--out DIR]
THEOREM takes a full declaration name or a unique dotted suffix in FILE.lean. Unsafe declarations and non-theorem definitions exit 2.--out at a scratch folder outside the repo so charts stay out of your checkout. Without --out, output goes to <short-theorem>-proof beside FILE.lean.--view FILE applies a plain-English view module to lemmas.mmd and proof.mmd.--tactics shows raw Lean tactic lines inside proof.mmd boxes.--config applies only to TLA+ specs and exits 2 on .lean inputs.LEAN_SYSROOT, then lean and lake on PATH from the package root, then a pinned mise http:lean install for v4.34.1. Every resolved binary must report v4.34.1. Any other pin or version exits 2.lake setup-file in place. lake setup-file writes the gitignored .lake/ folder and may create lake-manifest.json when the package has none. Copy the Lake package into a temporary folder first so .lake/ stays out of your checkout.INVARIANT. A rule can check a screen, a result, a stored value, or a message. Add any variable a rule needs, and never weaken a rule to make it hold.Next as a disjunction of actions, such as YouPressPlay \/ YouPressStop. Otherwise TLC names every step Next.NoDeadlock, even when it is a valid end state. If an INVARIANT or PROPERTY already uses NoDeadlock, the rule name is CHECK_DEADLOCK. Add a no-op end-state action to Next, such as Done == phase \in {"paid", "failed"} /\ UNCHANGED vars, and label it in step().Put the operator's state labels, arrow labels, phases, colors, and title in a --view FILE module. Its state(vars) export picks the chart shape:
export const state = (v) => (v.paid ? "Paid" : "Paying");export const state = (v) => v.main.split(".");export const state = (v) => ({ Playback: v.playback, Volume: v.volume });Label states with what the operator sees or cares about, such as "Paying" or "Lease held, write pending", without variable names. In vars, a TLA+ sequence is an object keyed from 1, so v.pc[1] is pc[1]. A set is an array.
Export step(action, from, to) to label arrows from the TLC action name and the before and after vars. Write what the operator sees happen, such as "you press play" or "the connect fails", without code or TLA+ action names. Give two actions the same label when they produce the same chart transition so they share one arrow.
When a step requires a condition, append it in brackets in the operator's words, such as you press play [while the file loads]. In a regions chart, omit brackets for other regions. The command adds other-region conditions automatically, such as [when Offline], and custom brackets overwrite them. When an unlabeled value decides the target state, name the outcome in the label, such as "the roster read fails".
The view can also export three optional properties:
group(vars) returns a phase name. A chart state gets no color when its model states belong to different groups.colors maps each group name to blue, orange, purple, yellow, teal, tan, or pink.title sets the chart heading.Make state(), group(), and step() depend only on their arguments. The command calls state() and group() at most once per model state, calls step() at most once per step, and reuses those answers for both the chart and report.md.
The chart omits steps that stay inside one state label. Split a label when the operator must see such a step.
Aim for 20 arrows or fewer. First coarsen state() labels. Merge values that behave alike, and drop details the operator does not need, such as an in-flight call whose return changes nothing. Keep every bug-path state and every mark. Never turn a breaks state into mayBreak or merge states that break different rules. If the chart is still too busy, return null from step() for unneeded steps, such as a universal reset or a duplicate arrow. When you hide steps, follow four rules:
breaks when every model state behind it breaks a rule, and mayBreak when only some do. The Legend lists broken rules per mark and merges multiple rules onto one mark, so state in the hand-off which state breaks which rule. In a regions chart, a state gets a mark when every combination of region states that includes it can break a rule. When a combination can break a rule and none of its states has a mark, every state in that combination gets a mark.CONSTRAINT.VIEW or SYMMETRY, TLC collapses equivalent states into one representative. An arrow can point to that representative instead of the state the step reached, and report.md notes when it does.CONSTRAINT or ACTION_CONSTRAINT, but does not explore them or check them for deadlock. The chart draws a past-bound state only when a shortest bug path ends there, and report.md gives that path. TLC also checks rules after steps excluded by ACTION_CONSTRAINT, even when another path reaches the next state. The chart draws an excluded step only when a shortest bug path ends with it.report.md lists skipped rules under "Rules not checked" and the chart leaves them unmarked. Those rules may hold or break. Remove broken rules from the config or shrink the model to check them. Because the cap module changes TLC's variable order, a PROPERTY rerun can return a different counterexample.tlc.out holds TLC's output on the config as written. When the chart omits a broken rule's bug path, tlc-RULE.out holds the output of the run that found it. When Java runs with -XX:+UseParallelGC and TLC repeats its first warning, tlc.out records that warning once because TLC omits the duplicate from -tool output.One run elaborates FILE.lean once and writes up to four files into --out:
lemmas.mmd draws the theorem dependency flowchart TD, capped at 60 nodes. Each lemma leads with its docstring summary, clipped on word or clause boundaries, above its short name, and the legend notes Arrows mean uses. Solid edges cross compiler auxiliaries only. Dotted via def edges cross user definitions, opaques, or inductives. Thick edges trace shortest unproven paths.proof.mmd draws the proof tree flowchart TD when the theorem has tactic steps, capped at 40 blocks. Boxes omit type and binder preambles and strip repeated parent prefixes like mp. from nested splits. They translate the standard Lean case tags mp, mpr, inl, inr, zero, succ, nil, cons, true, and false into plain English. Without --tactics, boxes omit raw tactic scripts and show claims, new local assumptions, invoked lemmas, and outcomes: Proven, Unproven gap (sorry), Failing step, Open goal, or Depends on unproven gap.report.md lists the audit verdict, shortest unproven paths, full axiom list, untruncated hypotheses, goals, and tactic scripts per block, lemma statements, and Lean diagnostics scoped to the target theorem.facts.json stores format: 1 JSON from scripts/lean/Extract.lean.Put plain-English titles, claim summaries, group names, and branch descriptions in a --view FILE module:
title is a string or { lemmas?: string, proof?: string }.lemma(info) returns a plain-English string, { label, group?, hide? }, null to hide a clean supporting lemma, or undefined.group(info) returns a plain-English subgraph title to replace raw module names, null, or undefined.branch(info) returns a plain-English string or { label, detail? } for a proof-tree node. info carries stable id values like "root" and "root.0", plus goal, newHyps, tactics, lemmas, status, caseTag, rawCaseTag, depth, isRoot, isLeaf, and times. When times > 1 folds branches with different goals, info.goal is "" and info.newHyps is empty.caseLabel(tag, info) returns a plain-English edge label for a split branch, or undefined.The compiler enforces three soundness rules:
sorry or a failing step, any custom axiom, any native computation node, or any lemma that depends on an unproven gap or axiom. If a view tries to hide one, the command exits 2.checkAxioms still agrees with Lean.collectAxioms, and records the hidden count in the chart legend and report.md.0 means a closed proof that uses at most propext, Classical.choice, and Quot.sound.1 means an audit finding: sorry, a failing step in the target theorem, an open goal, unchecked native code such as native_decide or Lean.ofReduceBool, or a custom axiom.2 means invalid arguments, a bad --view export or soundness violation, an unsupported Lean pin, a module-header file, a missing or ambiguous theorem, or a checkAxioms or checkTree invariant failure.130 or 143 means SIGINT or SIGTERM stopped the run, killed the worker process group, and wrote nothing.Tactic extraction elaborates package code, so Lean charts explain proofs and do not replace a standalone build or axiom verification gate.
Show chart.mmd for TLA+, or lemmas.mmd first with proof.mmd as an optional drill-down for Lean 4, as mermaid code blocks.
For TLA+, the chart budget is 500 states counted by TLC on the config as written. Above 500 states, the command draws only bug paths and writes no chart.mmd when no rule breaks. It still checks each rule, and report.md gives the state count and each bug path. Shrink the model to draw the whole graph.
Render charts with Pele per references/render.md when the operator asks for an image or a chart is too large to read as text. Do not use another renderer unless the operator asks for it.
Give the operator each chart, its Mermaid text, and the command to regenerate the files into a new --out folder.
report.md. State what the model leaves out and any steps hidden by --view.lemmas.mmd and include proof.mmd as an optional drill-down. List each unproven path and the exit verdict from report.md, and note any supporting lemmas hidden by --view.When a TLA+ model describes code, replay each bug path against the real code as a test or live repro, one step per action. If a bug does not occur, treat the model as wrong until you prove otherwise.
references/render.md (opens in a new tab)scripts/backends/cfg.ts (opens in a new tab)scripts/backends/mermaid.ts (opens in a new tab)scripts/backends/plain-text.ts (opens in a new tab)scripts/backends/report.ts (opens in a new tab)scripts/frontends/config.ts (opens in a new tab)scripts/frontends/dot.ts (opens in a new tab)scripts/frontends/marks.ts (opens in a new tab)scripts/frontends/messages.ts (opens in a new tab)scripts/frontends/spec.ts (opens in a new tab)scripts/frontends/trace.ts (opens in a new tab)scripts/frontends/value.ts (opens in a new tab)scripts/frontends/verdict.ts (opens in a new tab)scripts/frontends/view.ts (opens in a new tab)scripts/ir.ts (opens in a new tab)scripts/janitor.ts (opens in a new tab)scripts/kill.ts (opens in a new tab)scripts/lean/Extract.lean (opens in a new tab)scripts/lean/backends/lemma-chart.ts (opens in a new tab)scripts/lean/backends/mermaid.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
tla+, lean4, formal-verification, state-machine, proof-visualization, mermaid
/cursor-pstack-upstream-pstack:statechartfrom pstack
Generated from the plugin's indexed repository (cursor/plugins) — no native marketplace selected
npx claudepluginhub p/cursor-pstack-upstream-pstack60 skills in this plugin
/architectSketch types, signatures, and module structure before code, then stay in the loop while implementation fills in. Use for /architect, 'architect this', 'design this', or non-trivial work where jumping to code would lock in the wrong shape./arenaSpawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it. Use for /arena, 'arena this', 'throw it in the arena', or when one attempt at a non-trivial artifact would lock in the wrong shape./automate-meUse for "automate me", "create/update/refresh my -mode skill", "turn/capture my preferences or working style into a skill", or wanting agents to follow how the user works. Drafts or revises a personal -mode skill via create-skill + unslop, optionally pulling fresh evidence from recent transcripts./benchmark-checklistVet a perf measurement (limiter, tuning, limits, errors, repeatability, relevance, and whether the work happened) before you report or act on it. Use when you run a benchmark or report a speedup or regression you measured./blast-radiusFind what a change could break somewhere else before it ships, beyond the diff, and prove the one fact it's safe because of by running real code instead of writing it up. Use for 'blast radius of X', 'what could this break', or reviewing a small diff you don't trust./broRestate the last message in plain human language, with no jargon.9 plugins in 8 repositories ship this exact skill · first indexed Dec 1, 2026
Other plugins' skills for the same job