>
trailmark skill)genotoxic skill)uv run trailmark fails, run:uv pip install trailmark
uv run {baseDir}/scripts/diagram.py \
--target {targetDir} --language auto --type call-graph \
--focus main --depth 2
```mermaid
flowchart TB
...
```
├─ "Who calls what?" → --type call-graph
├─ "Class inheritance?" → --type class-hierarchy
├─ "Module dependencies?" → --type module-deps
├─ "Class members and structure?" → --type containment
├─ "Where is complexity highest?" → --type complexity
└─ "Path from input to function?" → --type data-flow
Diagram Progress:
- [ ] Step 1: Verify trailmark is installed
- [ ] Step 2: Identify diagram type from user request
- [ ] Step 3: Determine focus node and parameters
- [ ] Step 4: Run diagram.py script
- [ ] Step 5: Verify output is non-empty and well-formed
- [ ] Step 6: Embed diagram in response
uv run trailmark analyze --language auto --summary {targetDir}. Install
if it fails. Then run pre-analysis via the programmatic API:from trailmark.query.api import QueryEngine
engine = QueryEngine.from_directory("{targetDir}", language="auto")
engine.preanalysis()
data-flow diagrams.python,rust.--type using the decision tree
above.call-graph and data-flow, identify the focus function.
Default --depth 2. Use --direction LR for dependency flows.flowchart or classDiagram,
contains at least one node. If empty or malformed, consult
references/mermaid-syntax.md [blocked].```mermaid ``` code fence.uv run {baseDir}/scripts/diagram.py [OPTIONS]
| Argument | Short | Default | Description |
|---|---|---|---|
--target | -t | required | Directory to analyze |
--language | -l | python | Source language |
--type | -T | required | Diagram type (see above) |
--focus | -f | none | Center diagram on this node |
--depth | -d | 2 | BFS traversal depth |
--direction | TB | Layout: TB (top-bottom) or LR (left-right) | |
--threshold | 10 | Min complexity for complexity type |
# Call graph centered on a function
uv run {baseDir}/scripts/diagram.py -t src/ -T call-graph -f parse_file
# Class hierarchy for a Rust project
uv run {baseDir}/scripts/diagram.py -t src/ -l rust -T class-hierarchy
# Module dependency map, left-to-right
uv run {baseDir}/scripts/diagram.py -t src/ -T module-deps --direction LR
# Class members
uv run {baseDir}/scripts/diagram.py -t src/ -T containment
# Complexity heatmap (threshold 5)
uv run {baseDir}/scripts/diagram.py -t src/ -T complexity --threshold 5
# Data flow from entrypoints to a specific function
uv run {baseDir}/scripts/diagram.py -t src/ -T data-flow -f execute_query
TB (default) for hierarchical views, LR for
left-to-right flows like dependency chains.--depth to see more of the call graph. Decrease to
reduce clutter. The script warns if the diagram exceeds 100 nodes.--focus for call-graph on non-trivial codebases.
For data-flow, omitting focus auto-targets the top 10 complexity hotspots.--language auto for polyglot or unfamiliar repos.
Use an explicit language only when you know the target is single-language or
you need to exclude unrelated components.