Logo: Formal Methods Drift Guard

Formal Methods Drift Guard

Communautéit
mizchi
formal-methods-drift-guard

Benotzt dëst, wann et schonn e formelle Modell oder eng Verifier-Prüfung gëtt an de Benotzer dëst iwwer Zäit weiderfleegë wëllt. Hëlleft Codex, Spezifikatiounen/Dokumentatioun mat Implementéierungscode, Tester, Konfiguratiounen a Logbicher souwéi formelle Modeller oder CI-Prüfungen op Ofwäichungen ze vergläichen. Et klasséiert, ob d'Ofwäichung an der Spezifikatioun, am Code, an der Modellabstraktioun, am Harness oder bei enger nach net gekläerter Domänenentscheedung läit. Zousätzlech kann et Verifier-Prüfungen ausféieren oder plangen an Ännerunge vu SAT/UNSAT, Géigebeispill-Traces, Beweisfeeler, veralt Modeller a CI-Resultater a Froen fir d'Revisioun an der Fachsprooch an Abléck am Ledger iwwersetzen.

Add to TypingMind

Iwwersiicht

Editeurmizchi
Repositoryskills
Skill-Nummformal-methods-drift-guard
Stären
333
Forks
4
Matgeliwwert Dateien
10
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.

  • 10 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

    mizchi huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Formal Methods Drift Guard an TypingMind, fir e mat all LLM ze benotzen, oder setzt 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 „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/mizchi/skills/tree/main/formal-methods-drift-guard
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng 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 d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Formal Methods Drift Guard 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 Formal Methods Drift Guard automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Formal Methods Drift Guard 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-Schlësselen.

  • 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.

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.

Matgeliwwert Dateien

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 Formal Methods Drift Guard?

Benotzt dëst, wann et schonn e formelle Modell oder eng Verifier-Prüfung gëtt an de Benotzer dëst iwwer Zäit weiderfleegë wëllt. Hëlleft Codex, Spezifikatiounen/Dokumentatioun mat Implementéierungscode, Tester, Konfiguratiounen a Logbicher souwéi formelle Modeller oder CI-Prüfungen op Ofwäichungen ze vergläichen. Et klasséiert, ob d'Ofwäichung an der Spezifikatioun, am Code, an der Modellabstraktioun, am Harness oder bei enger nach net gekläerter Domänenentscheedung läit. Zousätzlech kann et Verifier-Prüfungen ausféieren oder plangen an Ännerunge vu SAT/UNSAT, Géigebeispill-Traces, Beweisfe...

Firwat Formal Methods Drift Guard op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Formal Methods Drift Guard 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 en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Formal Methods Drift Guard an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/mizchi/skills/tree/main/formal-methods-drift-guard 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 Formal Methods Drift Guard 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 Formal Methods Drift Guard benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Formal Methods Drift Guard domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Formal Methods Drift Guard gratis?

mizchi huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen 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 e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

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