Tlaplus Modelのロゴ

Tlaplus Model

組織
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.

概要

公開者opum-ai
リポジトリproof-skills
スキル名tlaplus-model
スター
27
フォーク
6
同梱ファイル
40
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 40個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    opum-aiがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Tlaplus Model」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/opum-ai/proof-skills/tree/main/skills/tlaplus-model
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでTlaplus Modelを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にTlaplus Modelを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Tlaplus Modelは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

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, q...

TypingMindでTlaplus Modelを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Tlaplus Modelはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにTlaplus Modelをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/opum-ai/proof-skills/tree/main/skills/tlaplus-modelを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Tlaplus Modelを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Tlaplus Modelで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもTlaplus Modelを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Tlaplus Model」は無料ですか?

はい。opum-aiがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇