AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

spec-to-code-compliance

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

Original source
trailofbits
License
CC-BY-SA-4.0
Pinned revision
2be6433b39e009cd2b6fd3be1895f6b1faa5af9a

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read trailofbits--spec-to-code-compliance at revision 2be6433b39e009cd2b6fd3be1895f6b1faa5af9a, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 5

resources/ANALYSIS_FORMAT.md

Analysis Format

The output format for a per-requirement analysis. The agent defines what to check; this defines how to write it down. One document per requirement.

Structure

Sections in this order, separated by ---:

## REQ-04 — <the requirement in a few words>

> "<the requirement quoted verbatim>"
> — SPEC.md §3.2

**Verdict:** partial · confidence: high

**What this demands of an implementation:** the property that has to hold, restated concretely enough to look
for. Name the quantities and where they come from.

**Where enforcement lives:**

​```solidity
// Vault.sol:L80-L85
<the code>
​```
- What it checks, and against what.
- Which paths reach it, and which do not.

**Paths walked:**
- `redeem` → `_collateralPreserved`: Standard tier reaches the comparison at L84. ✓
- `redeem` → `_collateralPreserved`: Senior tier returns `true` at L82 without comparing. ✗ — the gap.

**Searched:**
- `locked` → 4 hits: L24 declaration, L57 write, L84 comparison, L98 transfer in `reassign`
- `tier` → 3 hits, none in a bounds check other than L81
- modifiers on `redeem` → `notPaused` only; no collateral check
- callers of `redeem` → none in scope; it is an entrypoint

**How the verdict was reached:** why this verdict and not the adjacent one. For `partial`, why it is not
`contradicted`; for `absent`, why the searches above are exhaustive rather than merely unsuccessful.

**Open questions:**
- unclear; need to inspect X

Conventions

Cite code as File.ext:L45 or L89-L135. Quote the document verbatim and cite its section — a paraphrase silently substitutes your reading for the requirement.

The Searched section is what makes an absent verdict worth anything. Record the pattern and its result, including the searches that found something irrelevant. 0 hits and 6 hits, all in tests are both evidence; "I looked and found nothing" is not.

Spend words where the code earns them. A requirement enforced in one line takes one line to confirm. Branches, call chains, and the paths where enforcement goes missing are where the depth belongs. There is no minimum number of anything, and padding a section to fill this template produces text that looks like analysis and isn't.

Leave a section out only when it is genuinely empty, and say so: "No enforcement found anywhere." A missing section could mean "none" or "never checked", and the reader cannot tell which.

Before you finish

Every claim either cites a line or sits in Open Questions. Every path through each function called was walked, not only the one that returns successfully.

Cut the hedges. "Probably", "seems to", and "should be" each become a claim with a line number or an open question.

Finishing with open questions is a complete analysis. Finishing with open questions you never wrote down is not.