trailofbits/trailmark
حول
Build and query a graph database representation of source code
البيانات والتحليلاتما يمكنك فعله
- Explore code. Query callers, callees, reachability, inheritance, type use, and Solidity storage access. Generate Mermaid diagrams.
- Review attack surface. Find framework entrypoints and inspect their trust levels, source evidence, and unresolved candidates.
- Save and compare analysis. Reload complete snapshots or diff snapshots, directories, and git revisions, including calls, signatures, findings, and entrypoints.
- Attach findings. Import SARIF or weAudit results, add annotations, and run preanalysis for blast radius, privilege boundaries, and coarse taint.
النمو المقاس للنجوم
- خلال 24 ساعة
- +١
- خلال 7 أيام
- +٨
- خلال 15 يومًا
- +٦٠
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلTrailmark
Trailmark turns source code into graphs of functions, types, calls, and other relationships. It provides a foundation for agentic skills that review code, analyze security, and generate tests.
Use the CLI or Python API to find entrypoints, trace call paths, and compare revisions. Edges retain their confidence, and unresolved calls stay visible.
Built-in tree-sitter parsers remain the default. Optional parser plugins can supply language-specific backends, such as Clang for C/C++, while retaining the same graph and query APIs.
How it works
flowchart LR
A["Source files"] --> B["tree-sitter parsers"]
A --> P["Optional parser plugins"]
B --> C["CodeGraph"]
P --> C
C --> D["GraphStore (rustworkx)"]
D --> E["QueryEngine"]
E --> F["CLI / Python API"]
classDef src fill:#007bff26,stroke:#007bff,color:#007bff
classDef parse fill:#28a74526,stroke:#28a745,color:#28a745
classDef data fill:#6f42c126,stroke:#6f42c1,color:#6f42c1
classDef query fill:#ffc10726,stroke:#e6a817,color:#e6a817
class A src
class B,P parse
class C,D data
class E,F query
Install
uv tool install trailmark # CLI
uv add trailmark # Python library
Requires Python ≥ 3.12. Trailmark downloads and caches most grammars on first use; bundled grammars need a C compiler. See Installation for offline use, Nix, and building from a checkout.
These docs track main. Check the
changelog
for features available in your release.
Quick start
# Summarize a project as JSON
trailmark analyze --summary --json --language auto path/to/project
# Find its entrypoints
trailmark entrypoints --language auto --json path/to/project
From Python:
from trailmark.query.api import QueryEngine
engine = QueryEngine.from_directory("path/to/project", language="auto")
print(engine.callers_of("verify_signature"))
print(engine.entrypoint_paths_to("verify_signature"))
Features
- Explore code. Query callers, callees, reachability, inheritance, type use, and Solidity storage access. Generate Mermaid diagrams.
- Review attack surface. Find framework entrypoints and inspect their trust levels, source evidence, and unresolved candidates.
- Save and compare analysis. Reload complete snapshots or diff snapshots, directories, and git revisions, including calls, signatures, findings, and entrypoints.
- Attach findings. Import SARIF or weAudit results, add annotations, and run preanalysis for blast radius, privilege boundaries, and coarse taint.
- Review input constraints. Save portable claims and typed preconditions; summarize callers and wrappers under explicit assumptions.
- Inspect exceptions. Query throws, handlers, and cleanup with source locations.
- Connect external evidence. Declare RPC, FFI, and subprocess links or import an external call graph.
- Inspect compiled code.
Map linked ELF, Mach-O, and PE code to source and query
bounded disassembly with the optional
trailmark[binary]extra.
Example graph
graph TD
HR["app:handle_request"] -->|calls| A["app:Auth"]
HR -->|calls| PV["proxy.unresolved:auth.verify"]
HR -->|calls| P["app:process"]
HR -->|calls| D["app:deny"]
AV["app:Auth.verify"] -->|calls| CS["app:Auth._check_sig"]
A -->|contains| AV
A -->|contains| CS
classDef fn fill:#007bff26,stroke:#007bff,color:#007bff
classDef cls fill:#6f42c126,stroke:#6f42c1,color:#6f42c1
classDef proxy fill:#dc354526,stroke:#dc3545,color:#dc3545
class HR,P,D fn
class A,AV,CS cls
class PV proxy
Unresolved calls remain visible as proxy nodes. See the worked example for the source and queries behind this graph.
Supported languages
Trailmark supports application, smart contract, and formal verification languages,
including Python, JavaScript/TypeScript, C/C++, Go, Rust, Solidity, and Lean.
Use --language auto for projects with multiple languages. The
language guide
lists every frontend, file extension, and language selector.
Limitations
Source analysis uses syntax and conservative name resolution. Dynamic calls, macros, and missing dependencies can leave gaps. Check parser coverage and call resolution before relying on a missing path.
Documentation
CLI reference · Python API · Graph model
Agent skills
The Trailmark plugin provides workflows for context selection, code review, diagrams, and finding triage. See skills compatibility when integrating Trailmark into a skill.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…