PluginMedium riskUnclaimed

spec-to-code-compliance

Check code against the documentation that specifies it: one agent per requirement, divergences refuted before they are reported, evidence cited to the line

trailofbitstrailofbits/spec-to-code-compliance-plugin★ 8.3kVersion 2.0.2Updated Nov 12, 2026

Description

Spec-to-Code Compliance

Check code against the documentation that specifies it. Every gap is either a bug or a documentation fix, and which one it is is the finding.

Author: Omar Inuwa

Install

/plugin install trailofbits/skills/plugins/spec-to-code-compliance

Use

/spec-to-code-compliance:spec-compliance ./contracts

The slash command takes a path. To name the specification directly or widen the fan-out, ask for the run in words — "run spec-compliance on ./contracts against SPEC.md, checking 20 requirements" — and the values reach the script as {path, spec, limit}. Typing that object after the slash command does not work: it arrives as a string and is treated as the path.

Writes spec-compliance/REPORT.md and one analysis per requirement under spec-compliance/requirements/. The session gets the alignment matrix and the surviving divergences, not the analysis.

How it works

  1. Extract — find the documents describing intended behavior, and split them into individually checkable requirements, quoted verbatim. Compound claims are split: a sentence requiring two things is two requirements, because the code can get one right and the other wrong.
  2. Align — one agent per requirement hunts the code for that requirement alone, reading the enforcement, its callees, and its callers. A separate agent sweeps the reverse direction for behavior no document mentions.
  3. Verify — each divergence goes to two agents that did not produce it, one re-reading the code and one re-reading the document, both trying to refute it. What either knocks down is dropped.
  4. Report — alignment matrix, surviving divergences worst first, undocumented behavior, and the problems in the documentation itself.

Per-requirement fan-out is what makes the check honest. Judging a requirement means reading a call chain; thirty requirements is thirty call chains, which does not fit one context window. Done inline, the first few requirements get a real check and the rest get a plausible one — and a verdict resting on a promising function name reads exactly like one resting on having read the function.

Verdicts

Verdict Meaning
implemented The enforcement was found and read
partial Holds on some paths, not others — usually the most serious verdict in a report
contradicted The code does something incompatible with the requirement
absent Looked and it is not there; rests entirely on the recorded searches
stronger-than-spec The code enforces more than the document asks, so nothing records the dependency
undecidable The requirement is too vague to check — a finding against the document

Components

  • workflows/spec-compliance.js — the orchestration
  • agents/spec-compliance-checker.md — the per-requirement worker; dispatch it directly for a single requirement
  • resources/ANALYSIS_FORMAT.md — the on-disk format for a per-requirement analysis
  • resources/DOMAIN_NOTES.md — what counts as a specification and where enforcement hides, across contracts, C and C++, services, and firmware, plus scoping a check against an RFC or standard
  • resources/WORKED_EXAMPLE.md — three requirements chased to a verdict, for calibration
  • resources/DIVERGENCE_RUBRIC.md — severity, and the two directions of a gap

Resources live under skills/spec-to-code-compliance/.

Migrating from 1.x

/trailofbits:spec-compliance <spec> <codebase> is removed. The entry point is /spec-to-code-compliance:spec-compliance <path>, and the arguments inverted: the path comes first and the specification is discovered rather than named. Pass {path, spec} when you want to point at it directly.

PDF whitepapers work. DOCX and Notion exports do not — 1.x claimed to normalize them and had no converter; the discovery step now names an unreadable document instead of guessing at its contents.

The report is no longer a fixed 16 sections. Sections with nothing in them are left out rather than filled.

Related

  • audit-context-building — build the system model first when the code is unfamiliar
  • issue-writer — turn surviving divergences into client-facing findings

Hosts

HostInstalls
Claude Code1 skill1 assistant
CodexSkills only
OpenCodeSkills only

Members1 skill · 1 assistant

  • spec-to-code-complianceCheck code against the documentation that specifies it - which requirements hold, which the code contradicts, which are absent, and what the code does that no document mentions. Use when comparing an implementation against a whitepaper, protocol spec, or design document.
  • spec-compliance-checkerAssistantChecks one documented requirement against the code that should implement it, and returns a verdict with the lines that evidence it. Writes its analysis to disk and returns a compact record. Use for a single requirement; use the spec-compliance workflow for a whole document.

Permissions

Full install
2.0.2
DeclaredDetected
Runs code—node
Installs—None
Runs install scripts—None
Network—github.com
Needs credentials—None
Outside the workspace—None
Agent tools—None

Checks

Medium risk · Some things deserve a look before you install it. See below.

Not reviewed by a person · Checked by rules; the model review is not switched on yet.

  • Medium riskInvisible charactersskills/spec-to-code-compliance/resources/ANALYSIS_FORMAT.md:23

Files27 files · 90.2 KB

  • README.md4.1 KB
.claude-plugin/1
  • plugin.json370 B
agents/1
  • spec-compliance-checker.md5.7 KB
evals/1
  • .gitignore9 B
evals/documents-contradict/1
  • case.yaml2.0 KB
evals/documents-contradict/fixture/3
  • README.md821 B
  • SPEC.md1.5 KB
  • Vault.sol2.8 KB
evals/documents-contradict/graders/1
  • reports-the-contradiction.md1.4 KB
evals/name-is-not-evidence/1
  • case.yaml2.2 KB
evals/name-is-not-evidence/fixture/2
  • SPEC.md1.5 KB
  • Vault.sol2.8 KB
evals/name-is-not-evidence/graders/2
  • senior-branch-unenforced.md1.5 KB
  • verdict-per-requirement.md1.0 KB
evals/routes-not-inline/1
  • case.yaml2.9 KB
evals/routes-not-inline/fixture/2
  • SPEC.md1.5 KB
  • Vault.sol2.8 KB
evals/routes-not-inline/graders/2
  • dispatches-the-workflow.md109 B
  • invokes-the-skill.md90 B
skills/spec-to-code-compliance/1
  • SKILL.md7.4 KB
skills/spec-to-code-compliance/agents/1
  • openai.yaml252 B
skills/spec-to-code-compliance/assets/1
  • trail-of-bits-mark.svg3.0 KB
skills/spec-to-code-compliance/resources/4
  • ANALYSIS_FORMAT.md2.8 KB
  • DIVERGENCE_RUBRIC.md3.3 KB
  • DOMAIN_NOTES.md5.7 KB
  • WORKED_EXAMPLE.md4.1 KB
workflows/1
  • spec-compliance.js28.4 KB

Versions

  1. #12.0.2latestNov 12, 2026

Open in Codeg

Or copy its address to search for in Codeg’s Discover.

trailofbits/spec-to-code-compliance-plugin

No Codeg yet?Download