插件中风险未认领
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
说明
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
- 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.
- 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.
- 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.
- 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 orchestrationagents/spec-compliance-checker.md— the per-requirement worker; dispatch it directly for a single requirementresources/ANALYSIS_FORMAT.md— the on-disk format for a per-requirement analysisresources/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 standardresources/WORKED_EXAMPLE.md— three requirements chased to a verdict, for calibrationresources/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 unfamiliarissue-writer— turn surviving divergences into client-facing findings
宿主
成员1 个技能 · 1 个助手
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-checker助手Checks 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.
权限
- 完整安装
- 2.0.2
nodegithub.com检查
中风险 · 有些地方值得在安装前看一看,见下方。
未经人工审核 · 已做规则检查;模型审核尚未开启。
- 中风险不可见字符
skills/spec-to-code-compliance/resources/ANALYSIS_FORMAT.md:23
文件27 个文件 · 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
版本
- #12.0.2最新2026年11月12日