Back to Skills

graph-evolution

Compares Trailmark code graphs at two source code snapshots (git commits, tags, or directories) to surface security-relevant structural changes. Detects new attack paths, complexity shifts, blast radius growth, taint propagation changes, and privilege boundary modifications that text diffs miss. Use when comparing code between commits or tags, analyzing structural evolution, detecting attack surface growth, reviewing what changed between audit snapshots, or finding security-relevant changes that

5,841stars513forksUpdated 6/24/2026

Security Assessment

Safe(100/100)
Security Score100/100

About graph-evolution

Structural comparison of Trailmark code graphs at two source snapshots (git commits, tags, or directories) to surface security-relevant changes that text-level diffs miss. The skill builds a code graph at each snapshot and computes a structural diff that detects new attack paths, complexity shifts, blast radius growth, taint propagation changes, and privilege boundary modifications. It is used for comparing two git refs, auditing a range of commits, detecting attack surface growth, or pre-release tag-to-tag and branch-to-branch comparison, and it is not for line-level code review, single-snapshot analysis, diagram generation, or mutation testing triage, each of which has a dedicated skill.

The workflow runs in five phases. Phase 1 creates snapshots using git worktrees so each ref is a clean copy without disturbing the working tree, or skips this step when comparing two directories directly. Phase 2 builds Trailmark graphs for both snapshots and runs pre-analysis on each via the QueryEngine API, computing blast radius, taint propagation, privilege boundaries, and entrypoint enumeration, then exports each graph to JSON. Phase 3 computes the structural diff by running both Trailmark's native `trailmark diff` (which yields summary deltas, added, removed, and modified nodes and edges, and entrypoint changes) and the plugin's `graph_diff.py` helper (which yields per-subgraph membership changes such as tainted and high_blast_radius). Phase 4 reads both diff files and generates a security-focused markdown report, and Phase 5 cleans up the worktrees.

Trailmark must be installed (via `uv pip install trailmark` if `uv run trailmark` fails), and the skill stresses using the tool programmatically rather than falling back to manual comparison or reading source files. Interpretation priorities run from highest to lowest: new tainted paths, privilege boundary changes, attack surface growth (new entrypoints, especially untrusted_external), blast radius increases, complexity spikes above a cyclomatic threshold on tainted or entrypoint-reachable nodes, structural additions, and structural removals (where removed security functions must be verified as replaced). Findings are cross-referenced with `git diff` between the refs to add source-level context.

FAQ

What kinds of changes does this surface that text diffs miss?

New attack paths, complexity shifts, blast radius growth, taint propagation changes, and privilege boundary modifications. The structural diff is meant to complement, not replace, text-diff analysis.

What can I compare between?

Two source snapshots: git commits, tags, branches, or directories. Git refs are checked out into git worktrees, while directory comparisons can skip the worktree step and use the paths directly.

Why run pre-analysis on both snapshots?

Without pre-analysis you miss taint changes, blast radius growth, and privilege boundary shifts. Pre-analysis (`engine.preanalysis()`) computes blast radius, taint propagation, privilege boundaries, and entrypoint enumeration on each snapshot.

Which two diff tools are run in Phase 3?

Trailmark's native `trailmark diff` for nodes, edges, and entrypoints, and the plugin's `graph_diff.py` helper for per-subgraph membership changes such as tainted and high_blast_radius. Both must be run.

What is the highest interpretation priority?

New tainted paths: nodes entering the tainted subgraph, especially when they also appear in added edges targeting sensitive functions. Privilege boundary changes and attack surface growth follow.

All Files

6 files
references/report-format.md4.2 KB
View
SKILL.md10.9 KB
View
assets/trail-of-bits-mark.svg3.0 KB
View
scripts/graph_diff.py7.7 KB
View
agents/openai.yaml0.1 KB
View
references/evolution-metrics.md5.1 KB
View

Install graph-evolution

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill