Formal Methods Drift Guardのロゴ

Formal Methods Drift Guard

コミュニティ
mizchi
formal-methods-drift-guard

正式なモデルまたは検証チェックがすでにあり、継続的に保守したい場合に使います。Codexが仕様書やドキュメントと、実装コード・テスト・設定・ログ、形式モデルやCIチェックを比較して差異を検出するのに役立ちます。差異が仕様、コード、モデルの抽象化、ハーネス、または未解決のドメイン上の判断のどこにあるかを分類し、検証チェックを実行または計画します。また、SAT/UNSATの変化、反例トレース、証明の失敗、古くなったモデル、CIの結果を、ドメイン用語でのレビュー質問や記録項目に置き換えます。

Add to TypingMind

概要

公開者mizchi
リポジトリskills
スキル名formal-methods-drift-guard
スター
333
フォーク
4
同梱ファイル
10
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 10個の同梱ファイル

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

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mizchi/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/formal-methods-drift-guard .claude/skills/formal-methods-drift-guard
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Formal Methods Drift Guard

Use this skill when a team already has a model/check and now needs to keep spec -> code -> model aligned as the product changes.

This is not the first-modeling skill. If no useful model exists yet, use formal-methods-reconciler first. This skill starts after at least one of these exists: a Z3/Alloy/TLA+/P/Dafny/MoonBit/Lean/Rocq check, a CI verifier job, a model ledger, or a domain decision that was previously locked. Use formal-methods-reconciler for first extraction, tool selection, and initial model design; use this skill for ongoing drift maintenance.

Core Rule

Do not make the model green by silently changing the property.

Treat every red check, stale claim, missing source mapping, or changed witness as a drift signal. Translate it into domain language before proposing a fix.

Workflow

  1. Build the triplet inventory.

    • Spec side: docs, ADRs, API contracts, product rules, threat model, support runbooks, incident decisions.
    • Code side: implementation, tests, config, schema, migrations, logs, telemetry, traces.
    • Model side: formal files, harness scripts, expected SAT/UNSAT assertions, CI workflows, pinned tool versions, previous ledger decisions.
    • Assign stable claim IDs when missing, such as AUTHZ-SETTINGS-001.
  2. Map each claim across the three surfaces.

    • Expected domain claim: what the business rule says.
    • Implementation observation: what code/config/logs currently do.
    • Model property: predicate, invariant, reachability, liveness, theorem, or proof obligation that represents the claim.
    • Check command: exact command or CI job that decides the model result.
    • If the domain rule became more granular than the model, do not treat that as executor uncertainty. Record the abstraction choice explicitly as a model/domain question: for example, split Reachable(Settings) into settings:read and settings:write, or keep one state plus a capability relation. Classify the old coarse property as model-drift or coverage-gap until the owner accepts the new abstraction.
  3. Run the cheapest drift checks first.

    • Text/code diff: did docs, code, model, fixtures, or expected-result files change under relevant paths?
    • Harness check: do all model checks still run in CI with pinned tools?
    • Result check: did expected SAT, UNSAT, trace shape, proof success, or proof obligation count change?
    • Coverage check: is there a spec claim with no model, or a model property with no living domain claim?
    • Trace/log replay: if logs are available, check whether real event traces still refine the model.
  4. Classify drift before fixing.

    Drift classMeaningTypical next action
    spec-driftDocs/domain rule changed but model or code did notAsk whether to update model, code, or both
    code-driftCode/config behavior changed while the locked model stayed the sameTreat as likely regression until domain owner accepts it
    model-driftModel no longer represents the accepted domain rule or implementation boundaryUpdate model abstraction with review
    harness-driftTool version, CI, fixtures, expected-output parser, or path filter brokeFix harness without changing the property
    decision-driftPrevious domain decision is now ambiguous or contradictedRe-open domain question
    coverage-gapA claim exists on one surface but not the othersAdd model, docs, tests, or explicit non-goal

    Choose one primary drift class. Base it on which surface currently diverges from the accepted domain rule, not on which surface changed first. If docs and code both intentionally moved to a new accepted rule while the model still encodes the old rule, classify the primary drift as model-drift and note the spec/code change as the driver. If code moved but docs and model still encode the accepted rule, classify it as code-drift. Use secondary notes for contributing factors, but do not leave the fix target ambiguous by listing multiple primary classes.

  5. Translate machine output to domain wording.

    • Say who can do what, which order is accepted, which config is dead, which state becomes reachable, or which crash/retry sequence loses data.
    • Include the changed condition that caused drift: new doc rule, changed route guard, changed enum, changed config default, new event type, new tool version, or new trace.
    • Never show only SAT, UNSAT, proof failed, or CI red.
  6. Decide the fix target with the owner.

    • If spec is correct and code drifted: fix code and keep the model check.
    • If code is intentional and spec is stale: update spec and adjust model.
    • If model abstraction is stale: update model and preserve the domain claim.
    • If harness drifted: fix CI/scripts/pins and do not change domain text.
    • If unresolved: keep the witness and ask a domain-owner question.
  7. Lock the maintenance loop.

    • Keep model checks in CI with machine-readable exit codes.
    • Add path filters so PRs touching relevant specs/code/models run the right checks.
    • Keep a ledger entry per claim and update it when a domain decision changes.
    • Prefer explicit expected-result files for SAT/UNSAT or trace shapes so changes are reviewable.

Output Contract

For each changed or suspicious claim, produce a ledger entry:

text
claim_id:
source_of_truth:
spec_delta:
code_delta:
model_delta:
check_command:
previous_machine_result:
current_machine_result:
drift_class:
witness:
domain_wording:
domain_question:
recommended_fix_target:
lock_update:
epistemic_status:

Use references/drift-ledger.md for templates and examples.

Reporting Discipline

  • Separate confirmed machine results from inferred drift. Label them machine-confirmed, log-confirmed, diff-inferred, or not-run.
  • Preserve the exact failing command or CI URL when available.
  • Do not collapse domain uncertainty into self-report uncertainty. A missing domain decision is an output, not a failure to use the skill.
  • Do not put model-granularity choices in self-report unclear points when the deliverable can express them as domain questions. Use self-report only when the skill cannot be applied; use the ledger when the model needs a reviewed abstraction change.
  • Do not put an explicitly unrun verifier/check in self-report unclear points when the task is to produce a drift ledger. Record it as current_machine_result: not-run, add diff-inferred or log-confirmed evidence where available, and propose the exact check as lock_update. Only use self-report when the user explicitly asked you to run the verifier and the run failed or was impossible.
  • Do not mark a model obsolete only because it is red. First ask what behavior changed and whether that change is intended.
  • Do not claim the implementation refines the model unless the verifier, trace-checker, tests, or explicit replay actually checked that relation.

Common Cases

  • Authz docs changed: A role gains an exception in docs. Check whether Alloy/Z3/P route model and code guards agree; translate any witness as "role X can/cannot reach screen Y under flag Z."
  • Config default changed: Empty allowlist was clarified from "all users" to "no users." Check Z3 config validator and live config; translate dead or newly-open config in campaign language.
  • Protocol event added: A new retry or timeout event is added. Check TLA+/P model for stale state transitions; translate traces as user-visible duplicate charge, lost ack, stuck job, or stale read.
  • CI pin changed: A new solver/prover version changes output formatting or proof obligations. Classify as harness drift unless the semantic result changed.
  • Incident found a real trace: Replay the incident trace against the model. If accepted, the model permits the incident and needs a stronger contract. If rejected, the model/code gap needs investigation.

同梱ファイル

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

よくある質問

AIスキル「Formal Methods Drift Guard」では何ができますか?

正式なモデルまたは検証チェックがすでにあり、継続的に保守したい場合に使います。Codexが仕様書やドキュメントと、実装コード・テスト・設定・ログ、形式モデルやCIチェックを比較して差異を検出するのに役立ちます。差異が仕様、コード、モデルの抽象化、ハーネス、または未解決のドメイン上の判断のどこにあるかを分類し、検証チェックを実行または計画します。また、SAT/UNSATの変化、反例トレース、証明の失敗、古くなったモデル、CIの結果を、ドメイン用語でのレビュー質問や記録項目に置き換えます。

TypingMindでFormal Methods Drift Guardを使うメリットは何ですか?

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

TypingMindにFormal Methods Drift Guardをインストールするにはどうすればよいですか?

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

Formal Methods Drift Guardを使えるAIモデルはどれですか?

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

Formal Methods Drift Guardで使えるAIモデルの数に制限はありますか?

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

AIスキル「Formal Methods Drift Guard」は無料ですか?

mizchiがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

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

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

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

すべて見る

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

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