Logo di Formal Methods Drift Guard

Formal Methods Drift Guard

Community
mizchi
formal-methods-drift-guard

Usalo quando esiste già un modello formale o un controllo del verificatore e l’utente vuole mantenerlo nel tempo. Aiuta Codex a confrontare specifiche e documentazione con codice di implementazione, test, configurazioni e log, oltre che con modelli formali o controlli CI, per individuare eventuali divergenze; a stabilire se riguardano la specifica, il codice, l’astrazione del modello, l’ambiente di test o una decisione di dominio ancora da prendere; a eseguire o pianificare controlli del verificatore; e a tradurre variazioni SAT/UNSAT, tracce di controesempio, errori di dimostrazione, modelli obsoleti e risultati CI in domande di revisione e voci di registro espresse nel linguaggio del dominio.

Add to TypingMind

Panoramica

Pubblicato damizchi
Repositoryskills
Nome della skillformal-methods-drift-guard
Stelle
333
Fork
4
File inclusi
10
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 10

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da mizchi su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Formal Methods Drift Guard in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/mizchi/skills/tree/main/formal-methods-drift-guard
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Formal Methods Drift Guard in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Formal Methods Drift Guard non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Formal Methods Drift Guard non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Formal Methods Drift Guard?

Usalo quando esiste già un modello formale o un controllo del verificatore e l’utente vuole mantenerlo nel tempo. Aiuta Codex a confrontare specifiche e documentazione con codice di implementazione, test, configurazioni e log, oltre che con modelli formali o controlli CI, per individuare eventuali divergenze; a stabilire se riguardano la specifica, il codice, l’astrazione del modello, l’ambiente di test o una decisione di dominio ancora da prendere; a eseguire o pianificare controlli del verificatore; e a tradurre variazioni SAT/UNSAT, tracce di controesempio, errori di dimostrazione, model...

Perché usare Formal Methods Drift Guard su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Formal Methods Drift Guard è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Formal Methods Drift Guard in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/mizchi/skills/tree/main/formal-methods-drift-guard. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Formal Methods Drift Guard?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Formal Methods Drift Guard?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Formal Methods Drift Guard: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Formal Methods Drift Guard è gratuita?

È pubblicata su GitHub da mizchi. Consulta il repository per i termini di licenza. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇