Files
trailofbits__skills/plugins/trailmark/README.md
Scott Arciszewski 841bffed0d trailmark: add v0.4/v0.5 support and graph-assisted security workflows (#183)
* trailmark: update skills to use v0.4.0 features

* fix: resolve code review findings for PR #183

Redraws the version boundary to match the actual Trailmark release
history, verified against the v0.2.0/v0.2.1/v0.2.2/v0.3.1/v0.4.0 tags
of trailofbits/trailmark:

P1 (misclassified APIs, fixed):
- ancestors_of(), reachable_from(), entrypoint_paths_to(),
  nodes_with_annotation(), clear_annotations() and the diff/entrypoints
  CLI exist since v0.2.0 — moved from the v0.4+ list to the v0.2-safe
  baseline; removed needless hasattr() gates and degraded fallbacks
- supported_languages()/detect_languages() (trailmark.parse) are 0.3+
  modules, not v0.2-safe — annotated as such
- CLI --version/version were added in 0.2.2, not 0.4 — documented as
  0.2.2+ and version-probe failure semantics clarified
- graph-evolution/SKILL.md reverted to main: native diff has existed
  since v0.2.0 with identical args, so the 0.2.x-fallback rewrite was
  built on a false premise (also resolves the quality-checklist
  contradiction flagged in review)

P3 (fixed): lexical version comparison hazard noted; stale
diagramming-code checklist label; README baseline list now defers to
the SKILL.md Version Gate instead of keeping a second divergent copy

Dismissed: 'diff CLI signatures contradict' (both forms valid — before/
after positionals accept paths or git refs, --repo/--json exist since
0.2.0); 'subgraph_edges has no edge_kinds param' (v0.4.0 signature has
edge_kinds keyword); 'diagram.py fallback broken on 0.2.x'
(trailmark.diagram module exists in 0.2.x; only the CLI subcommand is
new); 'phantom diff_against()' (real, v0.2-safe, now in baseline)

Verified: check_claude_loadability.py, check_codex_loadability.py,
pre-commit hooks pass; all SKILL.md files under 500 lines

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* trailmark: add assurance workflow skills (#187)

* trailmark: add assurance workflow skills

* fix: drop hasattr gates on v0.2-baseline query APIs

entrypoint_paths_to() and reachable_from() are in the v0.2-safe
baseline, so the hasattr fallbacks were dead code — and the
entrypoint_paths_to fallback indexed attack_surface() entries with
entry["name"] instead of node_id, which would raise KeyError.
Addresses PR #187 review feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix(trailmark): make detect_languages import v0.2-safe in operational skills

The trailmark-summary and trailmark-structural skills claimed v0.2-safe
workflows but unconditionally imported trailmark.parse, a 0.3+ module.
detect_languages() has existed in trailmark.query.api since v0.2.0 (kept
as a deprecated alias in 0.3+), so gate the import with a fallback
instead of relabeling the skills as 0.3+. Version Gate docs updated to
document the v0.2-safe import path; supported_languages() remains 0.3+
with no 0.2.x equivalent.

Verified against trailmark v0.2.0 source (fallback branch) and the
current 0.4 line (canonical branch).

Addresses review feedback on PR #183.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* trailmark: document and enable v0.5.0 features

Trailmark 0.5.0 adds a PostgreSQL-oriented sql parser (node kinds
schema/table/view/procedure), the stable .trailmark/links.toml
configuration for cross-language/FFI/RPC/external links, repository
links/proxies/type_uses edges on single-language parses, Solidity
entrypoints from parser metadata (visibility/mutability/overridden-by
attributes), node attributes in attack_surface() entries, TypeScript
constructed-receiver resolution, and C# file-scoped namespaces.

Updates the Version Gate with a v0.5+ section and a structural probe
('SCHEMA' in NodeKind.__members__ — 0.5.0 adds no new QueryEngine
methods, so hasattr() cannot detect it), adds a Repository Links
section and cross-boundary query recipe, extends the parser list and
graph model docs, notes the reachability-vs-taint limitation, and
threads the 0.5 output additions through trailmark-structural and
audit-augmentation. Plugin version 0.9.0 -> 0.10.0.

All version claims verified against trailofbits/trailmark v0.2.0 and
v0.5.0 builds, including a live links.toml materialization test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* trailmark: add slicing-code-context skill (#203)

Adds a skill for delegating focused code tasks to constrained or locally
hosted models using bounded, graph-informed Trailmark source packets:

- scripts/build_slice_packet.py: deterministic PEP 723 packet builder
  (Trailmark 0.5.x) with five selection modes, whole-unit budget admission,
  explicit omission accounting, path-traversal rejection, an embedded
  untrusted-source notice, and structured JSON errors (26 tests, including
  a real Trailmark integration test)
- agents/code-slice-worker.md: repository-tool-free Haiku worker returning
  a source-cited JSON contract
- SKILL.md + references/slice-packet.md: coordinator workflow, packet and
  worker response contracts, and validation rules

Reviewed with a multi-agent Claude pass and two Codex passes; fixes from
those reviews are included (doc/selection-order reconciliation, relationship
deduplication, line-range anchors no longer expand to full nodes in
path/entrypoint modes, background-safe worker toolset, structured io_error
handling, replacement-packet expansion semantics).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Dan Guido <dan@trailofbits.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 16:51:40 -04:00

6.4 KiB

trailmark

Source code graph analysis for security auditing. Parses code into queryable graphs of functions, classes, and calls, then uses that structure for diagram generation, mutation testing triage, protocol verification, and differential review.

These skills support Trailmark 0.2.x through the 0.5.0 release line. Prefer --language auto, trailmark.parse.detect_languages() (0.3+), and QueryEngine.preanalysis() for the core workflow. Before using features added in v0.4.0 or v0.5.0, check the installed Trailmark version or probe for the method/CLI command first.

Compatibility

Use this guard before relying on version-gated features:

trailmark --version 2>/dev/null || uv run trailmark --version 2>/dev/null

Compare the reported version numerically. If it is 0.4.0 or newer, the expanded v0.4 feature set is available; 0.5.0 or newer adds the v0.5 set. If the command is missing or reports an older version, stay on the v0.2-safe baseline — the trailmark skill's Version Gate section has the authoritative list. (The version CLI itself was added in 0.2.2, so a missing command can also mean trailmark is not installed at all.)

v0.4.0 adds expanded parser coverage, explicit proxy nodes for unresolved calls, node origins (source, proxy, binary, synthetic), new edge kinds (resolves_to, type_uses, specializes, corresponds_to), subgraph edge and connection queries, generic/type-reference queries, the native trailmark diagram CLI, and binary graph augmentation via augment_binary().

v0.5.0 adds a PostgreSQL-oriented sql parser (with node kinds schema, table, view, procedure), the stable .trailmark/links.toml configuration for declaring cross-language/FFI/RPC/external links (external endpoints become proxy.external:<symbol> nodes), repository links/proxies/type_uses edges for single-language parses, Solidity entrypoints from parser metadata (visibility/mutability/overridden-by attributes, interfaces excluded), node attributes in attack_surface() entries, TypeScript constructed-receiver resolution, and C# file-scoped namespace support. It adds no new QueryEngine methods or CLI commands, so gate v0.5 features on the version number, not hasattr().

Prerequisites

Trailmark (source) must be installed:

uv pip install trailmark

Skills

Skill Description
trailmark Build and query multi-language source/binary code graphs with pre-analysis passes, version feature gates, proxy nodes, type/reference queries, cross-language link configuration, and structural traversal helpers
slicing-code-context Build bounded graph-informed source packets and delegate focused work to constrained subagents
diagramming-code Generate Mermaid diagrams from code graphs (call graphs, class hierarchies, complexity heatmaps, data flow); v0.4 native diagram support is feature-gated
crypto-protocol-diagram Extract protocol message flow from source code or specs (RFC, ProVerif, Tamarin) into sequence diagrams
genotoxic Triage mutation testing results using graph analysis — classify survived mutants as false positives, missing tests, or fuzzing targets
vector-forge Mutation-driven test vector generation — find coverage gaps via mutation testing, then generate Wycheproof-style vectors that close them
graph-evolution Compare code graphs at two snapshots to surface security-relevant structural changes text diffs miss
trailmark-review-gate Apply PASS/WARN/FAIL/UNKNOWN structural gate rules to branch, PR, fix, or release diffs
mermaid-to-proverif Convert Mermaid sequence diagrams into ProVerif formal verification models
audit-augmentation Project SARIF, weAudit, and v0.4 binary-analysis graph findings onto code graphs as annotations and subgraphs
trailmark-finding-triage Triage one finding, SARIF result, weAudit annotation, suspicious function, or report excerpt with reachability, taint, privilege-boundary, and blast-radius evidence
trailmark-variant-neighborhood Expand one seed issue into graph-derived variant candidates for variant-analysis, Semgrep, CodeQL, or manual review
trailmark-summary Quick structural overview (auto-detected languages, entry points, dependencies) for vivisect/galvanize
trailmark-structural Full structural analysis with all pre-analysis passes (blast radius, taint, privilege boundaries, complexity)

Directory Structure

trailmark/
├── .claude-plugin/
│   └── plugin.json
├── agents/
│   └── code-slice-worker.md          # Repository-tool-free bounded worker
├── README.md
└── skills/
    ├── trailmark/                    # Core graph querying
    ├── slicing-code-context/         # Bounded source slicing and worker delegation
    ├── diagramming-code/             # Mermaid diagram generation
    │   └── scripts/diagram.py
    ├── crypto-protocol-diagram/      # Protocol flow extraction
    │   └── examples/
    ├── genotoxic/                    # Mutation testing triage
    ├── vector-forge/                 # Mutation-driven test vector generation
    │   └── references/
    ├── graph-evolution/              # Structural diff
    │   └── scripts/graph_diff.py
    ├── trailmark-review-gate/         # Structural review gates
    ├── mermaid-to-proverif/          # Sequence diagram → ProVerif
    │   └── examples/
    ├── audit-augmentation/           # SARIF/weAudit integration
    ├── trailmark-finding-triage/      # Single-finding evidence packets
    ├── trailmark-variant-neighborhood/ # Variant candidate neighborhoods
    ├── trailmark-summary/            # Quick overview for vivisect/galvanize
    └── trailmark-structural/         # Full structural analysis
Skill Use For
mutation-testing Guidance for running mutation frameworks (mewt, muton) — use before genotoxic for triage
differential-review Text-level security diff review — complements graph-evolution's structural analysis
audit-context-building Deep architectural context before vulnerability hunting
variant-analysis Search for related candidates after trailmark-finding-triage identifies a repeatable root cause