skillfed

Semgrep, refinement types, and Z3 turn a "formally verified skill" into a proof you can re-check yourself — minus one named gap

Notes on Methods for Formal Verification of Agent Skills: Three Layers Toward a Mechanically Checkable Capability-Containment Proof (arXiv:2605.23951) — A. Metere · May 2026

Note published · written by SkillFed’s research pipeline from the paper above · how these notes are made

AI-assisted notes · reviewed by SkillFed Skill security

Agent skills split into two halves: a deterministic script side that runs known code, and a non-deterministic LLM side that decides what to call next. This paper treats capability-containment — proving a skill's tool calls never exceed what its manifest declares — as a property of that whole system, not just the script, and closes it with three methods built to compose rather than compete. First, abstract interpretation walks a capability-effect lattice to over-approximate what the script's code can actually do, reusing existing dataflow engines (Semgrep, CodeQL, Pyright) instead of building new analyzers from scratch. Second, the tool-call dispatch function gets wrapped in a refinement type that mechanically rejects any call whose inferred capability falls outside the manifest's declared set, no matter what the LLM asks for. Third, SMT-bounded model checking with Z3 tests the parent paper's biconditional correctness criterion against a session-length horizon, so any violation surfaces as a concrete counter-example trace rather than an abstract failure.

Together the three layers cover the threat model soundly, but the authors name one residual themselves: an LLM can always refuse to act, and neither the static analysis nor the bounded proof forecloses that. It's caught only at the session boundary, by the runtime's own biconditional check — not by the formal layers. A worked example makes the gap the method does close concrete: a skill that summarizes fetched HTML declared only network-egress and cache-read capabilities, and the static-analysis layer flagged an undeclared filesystem-write effect on the cache directory that the manifest never listed. After the manifest was corrected, the refinement-type layer passed and the bounded model checker returned unsat for sessions up to 100 tool-call envelopes — no containment violation exists within that bound. The full toolchain, three checkers plus a bundle producer and re-checker, ships as zero-dependency JavaScript inside the open-source enclawed framework, backed by a 53-test unit suite and an end-to-end CLI demo.

Key numbers

Composable verification layers3
Unit tests passing in the enclawed suite53
SMT bound cleared with zero violations (worked example)100 envelopes
Named residual left uncovered by the proof1 (LLM refusal to act)
Typical SMT parameters solved in seconds|D| ≤ 10, K ≤ 8

Skills related to this research

Related notes

References

  1. A. Metere, "Methods for Formal Verification of Agent Skills: Three Layers Toward a Mechanically Checkable Capability-Containment Proof," arXiv:2605.23951 (2026).
  2. A. Metere, "Skills as Verifiable Artifacts: A Trust Schema and a Biconditional Correctness Criterion for Human-in-the-Loop Agent Runtimes," arXiv:2605.00424 (2026).
  3. A. Metere, "enclawed: A Configurable, Sector-Neutral Hardening Framework for Single-User AI Assistant Gateways," arXiv:2604.16838 (2026).