[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CHFXNETZ5XSN5BT5ATHV01":3,"skill-same:01M7CHFXNETZ5XSN5BT5ATHV01":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7CHFXNETZ5XSN5BT5ATHV01","graph-evolution",null,"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 text diffs miss.","bongkage\u002Ftrailofbits-skills","bongkage","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F101378796?v=4","01M7CH419QTJ16DNJ33P0WCWBE","01M7CH41A9NWK8D2JBRK9F0M2C",1,"CC-BY-SA-4.0","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: graph-evolution\ndescription: >\n  Compares Trailmark code graphs at two source code snapshots (git commits,\n  tags, or directories) to surface security-relevant structural changes.\n  Detects new attack paths, complexity shifts, blast radius growth, taint\n  propagation changes, and privilege boundary modifications that text diffs\n  miss. Use when comparing code between commits or tags, analyzing structural\n  evolution, detecting attack surface growth, reviewing what changed between\n  audit snapshots, or finding security-relevant changes that text diffs miss.\n---\n\n# Graph Evolution\n\nBuilds Trailmark code graphs at two source snapshots and computes a\nstructural diff. Surfaces security-relevant changes that text-level\ndiffs miss: new attack paths, complexity shifts, blast radius growth,\ntaint propagation changes, and privilege boundary modifications.\n\n## When to Use\n\n- Comparing two git refs to understand what structurally changed\n- Auditing a range of commits for security-relevant evolution\n- Detecting new attack paths created by code changes\n- Finding functions whose blast radius or complexity grew silently\n- Identifying taint propagation changes across refactors\n- Pre-release structural comparison (tag-to-tag or branch-to-branch)\n\n## When NOT to Use\n\n- Line-level code review (use `differential-review` for text-diff analysis)\n- Single-snapshot analysis (use the `trailmark` skill directly)\n- Diagram generation from a single snapshot (use the `diagramming-code` skill)\n- Mutation testing triage (use the `genotoxic` skill)\n\n## Rationalizations to Reject\n\n| Rationalization | Why It's Wrong | Required Action |\n|-----------------|----------------|-----------------|\n| \"We just need the structural diff, skip pre-analysis\" | Without pre-analysis, you miss taint changes, blast radius growth, and privilege boundary shifts | Run `engine.preanalysis()` on both snapshots |\n| \"Text diff covers what changed\" | Text diffs miss new attack paths, transitive complexity shifts, and subgraph membership changes | Use structural diff to complement text diff |\n| \"Only added nodes matter\" | Removed security functions and shifted privilege boundaries are equally dangerous | Review removals and modifications, not just additions |\n| \"Low-severity structural changes can be ignored\" | INFO-level changes (dead code removal) can mask removed security checks | Classify every change, review removals for replaced functionality |\n| \"One snapshot's graph is enough for comparison\" | Single-snapshot analysis can't detect evolution — you need both before and after | Always build and export both graphs |\n| \"Tool isn't installed, I'll compare manually\" | Manual comparison misses what graph analysis catches | Install trailmark first |\n| \"The diff came back empty, so nothing changed structurally\" | `trailmark diff` defaults `--language` to `python` and exits 0 with empty arrays on any other target, so an empty diff reads identically whether the code is unchanged or the language was wrong | Pass `--language` explicitly and re-run before concluding no change |\n\n---\n\n## Prerequisites\n\n**trailmark** must be installed. If `uv run trailmark` fails, run:\n\n```bash\nuv tool install trailmark\n# Python snippets: uv run --with trailmark python -   (a tool env is not importable)\n```\n\n**DO NOT** fall back to \"manual comparison\" or reading source files as a\nsubstitute for running trailmark. The tool must be installed and used\nprogrammatically. If installation fails, report the error.\n\n---\n\n## Quick Start\n\n```bash\n# Compare two git refs (e.g., tags, branches, commits)\n# 1. Build graphs at each snapshot\n# 2. Run pre-analysis on both\n# 3. Compute structural diff\n# 4. Generate report\n\n# Step-by-step: see Workflow below\n```\n\n---\n\n## Decision Tree\n\n```\n├─ Need to understand what each metric means?\n│  └─ Read: references\u002Fevolution-metrics.md\n│\n├─ Need the report output format?\n│  └─ Read: references\u002Freport-format.md\n│\n├─ Already have two graph JSON exports?\n│  └─ Jump to Phase 3 (run native diff + graph_diff.py)\n│\n└─ Starting from two git refs?\n   └─ Start at Phase 1\n```\n\n---\n\n## Workflow\n\n```\nGraph Evolution Progress:\n- [ ] Phase 1: Create snapshots (git worktrees)\n- [ ] Phase 2: Build graphs + pre-analysis on both snapshots\n- [ ] Phase 3: Compute structural diff\n- [ ] Phase 4: Interpret diff and generate report\n- [ ] Phase 5: Clean up worktrees\n```\n\n### Phase 1: Create Snapshots\n\nUse git worktrees to get clean copies of each ref without disturbing\nthe working tree.\n\n```bash\n# Create temp directories for worktrees\nBEFORE_DIR=$(mktemp -d)\nAFTER_DIR=$(mktemp -d)\n\n# Create worktrees (run from repo root)\ngit worktree add \"$BEFORE_DIR\" {before_ref}\ngit worktree add \"$AFTER_DIR\" {after_ref}\n```\n\nIf comparing two directories instead of git refs, skip this phase and\nuse the directory paths directly in Phase 2.\n\n### Phase 2: Build Graphs and Run Pre-Analysis\n\nBuild Trailmark graphs for both snapshots and run pre-analysis on each.\nPre-analysis computes blast radius, taint propagation, privilege\nboundaries, and entrypoint enumeration.\n\n```python\nfrom trailmark.query.api import QueryEngine\n\ndef build_and_export(target_dir, output_path, language=\"auto\"):\n    \"\"\"Build graph, run pre-analysis, export JSON.\"\"\"\n    engine = QueryEngine.from_directory(target_dir, language=language)\n    engine.preanalysis()\n    json_str = engine.to_json()\n    with open(output_path, \"w\") as f:\n        f.write(json_str)\n    return engine.summary()\n\nimport tempfile, os\nwork_dir = tempfile.mkdtemp(prefix=\"trailmark_evolution_\")\nbefore_json = os.path.join(work_dir, \"before_graph.json\")\nafter_json = os.path.join(work_dir, \"after_graph.json\")\n\nbefore_summary = build_and_export(\n    \"{before_dir}\", before_json\n)\nafter_summary = build_and_export(\n    \"{after_dir}\", after_json\n)\n```\n\nVerify both graphs built successfully by checking the summary output.\nIf either fails, rerun with an explicit language or comma-separated list\ninstead of `auto`.\n\n### Phase 3: Compute Structural Diff\n\nRun **both**:\n\n1. Trailmark's native structural diff for nodes, edges, and entrypoints\n2. The plugin's `graph_diff.py` helper for subgraph membership changes\n\nUse the same `work_dir` from Phase 2, and pass the same `--language` value Phase 2\nbuilt with. `trailmark diff` defaults that flag to `python`, so on any other\ntarget the default exits 0 and writes empty arrays rather than reporting a\nmismatch.\n\n```bash\ntrailmark diff --json --language auto \"{before_dir}\" \"{after_dir}\" > \"{work_dir}\u002Ftrailmark_diff.json\" || \\\n  uv run trailmark diff --json --language auto \"{before_dir}\" \"{after_dir}\" > \"{work_dir}\u002Ftrailmark_diff.json\"\n\nuv run {baseDir}\u002Fscripts\u002Fgraph_diff.py \\\n    --before \"{before_json}\" \\\n    --after \"{after_json}\" > \"{work_dir}\u002Fsubgraph_diff.json\"\n```\n\nIf Phase 2 needed an explicit language or a comma-separated list instead of\n`auto`, use that same value here.\n\nIf either diff command fails or writes an empty JSON file, stop and report the\nerror instead of continuing to Phase 4.\n\nA `trailmark_diff.json` whose `nodes`, `edges`, and `entrypoints` arrays are all\nempty means either nothing changed structurally or both snapshots parsed to\n(near-)empty graphs. Decide which using Phase 2's graph summaries: if either\nsnapshot's node count is zero or implausibly small for the target, the parse\nmissed the code — name the language set explicitly (`rust`, `solidity`,\n`python,rust`) and re-run. Healthy node counts on both snapshots plus an empty\ndiff is genuine structural stability.\n\nThe native Trailmark diff contains:\n\n| Key | Contents |\n|-----|----------|\n| `summary_delta` | Changes in node\u002Fedge\u002Fentrypoint counts |\n| `nodes.added` | New functions, classes, methods |\n| `nodes.removed` | Deleted functions, classes, methods |\n| `nodes.modified` | Functions with changed CC, params, line span |\n| `edges.added` | New call\u002Finheritance\u002Fimport relationships |\n| `edges.removed` | Deleted relationships |\n| `entrypoints` | Added, removed, and modified entrypoints |\n\nThe subgraph diff contains:\n\n| Key | Contents |\n|-----|----------|\n| `subgraphs` | Per-subgraph membership changes (tainted, high_blast_radius, etc.) |\n\n### Phase 4: Interpret Diff and Generate Report\n\nRead **both** diff JSON files and generate a security-focused markdown\nreport.\nSee [references\u002Freport-format.md](references\u002Freport-format.md) for\nthe full template.\n\n**Interpretation priorities (highest to lowest):**\n\n1. **New tainted paths** — nodes entering the `tainted` subgraph,\n   especially if they also appear in added edges targeting sensitive\n   functions\n2. **Privilege boundary changes** — new or removed trust transitions\n   from the native entrypoint\u002Fedge diff plus the subgraph diff\n3. **Attack surface growth** — new entrypoints, especially\n   `untrusted_external`, from `trailmark_diff.json`\n4. **Blast radius increases** — nodes entering `high_blast_radius`\n5. **Complexity spikes** — CC increases > 3 on tainted or\n   entrypoint-reachable nodes\n6. **Structural additions** — new nodes and edges (review needed)\n7. **Structural removals** — verify removed security functions were\n   replaced\n\nCross-reference structural changes with `git diff {before_ref}..{after_ref}`\nto add source-level context to findings.\n\n**Severity classification:**\n\n| Severity | Structural Signal |\n|----------|------------------|\n| CRITICAL | New tainted path to sensitive function, removed auth boundary |\n| HIGH | New entrypoint + high blast radius, large CC increase on tainted node |\n| MEDIUM | New trust-boundary-crossing edges, moderate CC increase |\n| LOW | Added nodes without entrypoint reachability |\n| INFO | Dead code removal, complexity reductions |\n\nFor detailed metric definitions, see\n[references\u002Fevolution-metrics.md](references\u002Fevolution-metrics.md).\n\n### Phase 5: Clean Up\n\nRemove git worktrees after the report is written:\n\n```bash\ngit worktree remove \"{before_dir}\"\ngit worktree remove \"{after_dir}\"\n```\n\n---\n\n## Diff Reference\n\n```\ntrailmark diff --json --language auto BEFORE AFTER\nuv run {baseDir}\u002Fscripts\u002Fgraph_diff.py [OPTIONS]\n```\n\n`trailmark diff --language` defaults to `python`. On a target in any other\nlanguage that default still exits 0, emitting well-formed JSON with empty\n`nodes`, `edges`, and `entrypoints` arrays, so always pass the flag: `auto`\ndetects and merges every supported language found under the target, and a single\nname (`rust`, `solidity`) or comma-separated list (`python,rust`) pins an\nexplicit set. `auto` fails loudly with `No supported languages detected under\n\u003Cpath>` when a snapshot holds nothing it can parse, which is the outcome you\nwant. Confirm the language first; only then can an empty diff count as evidence\nthat nothing changed.\n\nUse `trailmark diff` for:\n- Node\u002Fedge changes\n- Added\u002Fremoved\u002Fmodified entrypoints\n- Human-readable structural diff reports\n\nUse `graph_diff.py` for:\n- Subgraph membership changes derived from `engine.preanalysis()`\n- `tainted`, `high_blast_radius`, `privilege_boundary`, and related sets\n\n| Argument | Default | Description |\n|----------|---------|-------------|\n| `--before` | required | Path to the \"before\" graph JSON |\n| `--after` | required | Path to the \"after\" graph JSON |\n| `--indent` | `2` | JSON output indentation |\n\n`graph_diff.py` input format: Trailmark JSON exports from `engine.to_json()`.\n`graph_diff.py` output: JSON structural diff for nodes, edges, and subgraphs.\n\n---\n\n## Quality Checklist\n\nBefore delivering the report:\n\n- [ ] Both graphs built successfully (check summaries)\n- [ ] Pre-analysis ran on both snapshots\n- [ ] Native Trailmark diff computed (`trailmark_diff.json`); if it is empty,\n      both snapshots' Phase 2 node counts were non-zero, so empty means stable\n- [ ] Subgraph diff computed and non-empty (`subgraph_diff.json`)\n- [ ] All subgraph changes interpreted (tainted, blast radius, etc.)\n- [ ] Critical findings include evidence (node IDs, edge diffs)\n- [ ] Severity levels assigned to all findings\n- [ ] Source-level context added via git diff cross-reference\n- [ ] Worktrees cleaned up (or temp dirs removed)\n- [ ] Report written to `GRAPH_EVOLUTION_*.md`\n\n---\n\n## Integration\n\n**trailmark skill:**\nPhase 2 uses the trailmark API for graph building and pre-analysis.\nAll trailmark query patterns work on either snapshot's engine.\n\n**differential-review skill:**\nUse graph-evolution for structural analysis, differential-review for\nline-level code review. The two are complementary — graph-evolution\nfinds attack paths that text diffs miss, while differential-review\nprovides git blame context and micro-adversarial analysis.\n\n**trailmark-review-gate skill:**\nUse trailmark-review-gate after graph-evolution when a branch, pull request,\nfix commit, or release diff needs a PASS\u002FWARN\u002FFAIL\u002FUNKNOWN structural review\npacket. The gate applies deterministic review rules to graph-evolution output;\nit does not replace human review.\n\n**genotoxic skill:**\nIf graph-evolution reveals new high-CC tainted nodes, feed them to\ngenotoxic for mutation testing triage.\n\n**diagramming-code skill:**\nGenerate before\u002Fafter diagrams to visualize structural changes.\nUse `call-graph` or `data-flow` diagrams focused on changed nodes.\n\n---\n\n## Supporting Documentation\n\n- **[references\u002Fevolution-metrics.md](references\u002Fevolution-metrics.md)** —\n  What each structural metric means and why it matters for security\n- **[references\u002Freport-format.md](references\u002Freport-format.md)** —\n  Report template, severity classification, and example findings\n","# Graph Evolution\n\nBuilds Trailmark code graphs at two source snapshots and computes a\nstructural diff. Surfaces security-relevant changes that text-level\ndiffs miss: new attack paths, complexity shifts, blast radius growth,\ntaint propagation changes, and privilege boundary modifications.\n\n## When to Use\n\n- Comparing two git refs to understand what structurally changed\n- Auditing a range of commits for security-relevant evolution\n- Detecting new attack paths created by code changes\n- Finding functions whose blast radius or complexity grew silently\n- Identifying taint propagation changes across refactors\n- Pre-release structural comparison (tag-to-tag or branch-to-branch)\n\n## When NOT to Use\n\n- Line-level code review (use `differential-review` for text-diff analysis)\n- Single-snapshot analysis (use the `trailmark` skill directly)\n- Diagram generation from a single snapshot (use the `diagramming-code` skill)\n- Mutation testing triage (use the `genotoxic` skill)\n\n## Rationalizations to Reject\n\n| Rationalization | Why It's Wrong | Required Action |\n|-----------------|----------------|-----------------|\n| \"We just need the structural diff, skip pre-analysis\" | Without pre-analysis, you miss taint changes, blast radius growth, and privilege boundary shifts | Run `engine.preanalysis()` on both snapshots |\n| \"Text diff covers what changed\" | Text diffs miss new attack paths, transitive complexity shifts, and subgraph membership changes | Use structural diff to complement text diff |\n| \"Only added nodes matter\" | Removed security functions and shifted privilege boundaries are equally dangerous | Review removals and modifications, not just additions |\n| \"Low-severity structural changes can be ignored\" | INFO-level changes (dead code removal) can mask removed security checks | Classify every change, review removals for replaced functionality |\n| \"One snapshot's graph is enough for comparison\" | Single-snapshot analysis can't detect evolution — you need both before and after | Always build and export both graphs |\n| \"Tool isn't installed, I'll compare manually\" | Manual comparison misses what graph analysis catches | Install trailmark first |\n| \"The diff came back empty, so nothing changed structurally\" | `trailmark diff` defaults `--language` to `python` and exits 0 with empty arrays on any other target, so an empty diff reads identically whether the code is unchanged or the language was wrong | Pass `--language` explicitly and re-run before concluding no change |\n\n---\n\n## Prerequisites\n\n**trailmark** must be installed. If `uv run trailmark` fails, run:\n\n```bash\nuv tool install trailmark\n# Python snippets: uv run --with trailmark python -   (a tool env is not importable)\n```\n\n**DO NOT** fall back to \"manual comparison\" or reading source files as a\nsubstitute for running trailmark. The tool must be installed and used\nprogrammatically. If installation fails, report the error.\n\n---\n\n## Quick Start\n\n```bash\n# Compare two git refs (e.g., tags, branches, commits)\n# 1. Build graphs at each snapshot\n# 2. Run pre-analysis on both\n# 3. Compute structural diff\n# 4. Generate report\n\n# Step-by-step: see Workflow below\n```\n\n---\n\n## Decision Tree\n\n```\n├─ Need to understand what each metric means?\n│  └─ Read: references\u002Fevolution-metrics.md\n│\n├─ Need the report output format?\n│  └─ Read: references\u002Freport-format.md\n│\n├─ Already have two graph JSON exports?\n│  └─ Jump to Phase 3 (run native diff + graph_diff.py)\n│\n└─ Starting from two git refs?\n   └─ Start at Phase 1\n```\n\n---\n\n## Workflow\n\n```\nGraph Evolution Progress:\n- [ ] Phase 1: Create snapshots (git worktrees)\n- [ ] Phase 2: Build graphs + pre-analysis on both snapshots\n- [ ] Phase 3: Compute structural diff\n- [ ] Phase 4: Interpret diff and generate report\n- [ ] Phase 5: Clean up worktrees\n```\n\n### Phase 1: Create Snapshots\n\nUse git worktrees to get clean copies of each ref without disturbing\nthe working tree.\n\n```bash\n# Create temp directories for worktrees\nBEFORE_DIR=$(mktemp -d)\nAFTER_DIR=$(mktemp -d)\n\n# Create worktrees (run from repo root)\ngit worktree add \"$BEFORE_DIR\" {before_ref}\ngit worktree add \"$AFTER_DIR\" {after_ref}\n```\n\nIf comparing two directories instead of git refs, skip this phase and\nuse the directory paths directly in Phase 2.\n\n### Phase 2: Build Graphs and Run Pre-Analysis\n\nBuild Trailmark graphs for both snapshots and run pre-analysis on each.\nPre-analysis computes blast radius, taint propagation, privilege\nboundaries, and entrypoint enumeration.\n\n```python\nfrom trailmark.query.api import QueryEngine\n\ndef build_and_export(target_dir, output_path, language=\"auto\"):\n    \"\"\"Build graph, run pre-analysis, export JSON.\"\"\"\n    engine = QueryEngine.from_directory(target_dir, language=language)\n    engine.preanalysis()\n    json_str = engine.to_json()\n    with open(output_path, \"w\") as f:\n        f.write(json_str)\n    return engine.summary()\n\nimport tempfile, os\nwork_dir = tempfile.mkdtemp(prefix=\"trailmark_evolution_\")\nbefore_json = os.path.join(work_dir, \"before_graph.json\")\nafter_json = os.path.join(work_dir, \"after_graph.json\")\n\nbefore_summary = build_and_export(\n    \"{before_dir}\", before_json\n)\nafter_summary = build_and_export(\n    \"{after_dir}\", after_json\n)\n```\n\nVerify both graphs built successfully by checking the summary output.\nIf either fails, rerun with an explicit language or comma-separated list\ninstead of `auto`.\n\n### Phase 3: Compute Structural Diff\n\nRun **both**:\n\n1. Trailmark's native structural diff for nodes, edges, and entrypoints\n2. The plugin's `graph_diff.py` helper for subgraph membership changes\n\nUse the same `work_dir` from Phase 2, and pass the same `--language` value Phase 2\nbuilt with. `trailmark diff` defaults that flag to `python`, so on any other\ntarget the default exits 0 and writes empty arrays rather than reporting a\nmismatch.\n\n```bash\ntrailmark diff --json --language auto \"{before_dir}\" \"{after_dir}\" > \"{work_dir}\u002Ftrailmark_diff.json\" || \\\n  uv run trailmark diff --json --language auto \"{before_dir}\" \"{after_dir}\" > \"{work_dir}\u002Ftrailmark_diff.json\"\n\nuv run {baseDir}\u002Fscripts\u002Fgraph_diff.py \\\n    --before \"{before_json}\" \\\n    --after \"{after_json}\" > \"{work_dir}\u002Fsubgraph_diff.json\"\n```\n\nIf Phase 2 needed an explicit language or a comma-separated list instead of\n`auto`, use that same value here.\n\nIf either diff command fails or writes an empty JSON file, stop and report the\nerror instead of continuing to Phase 4.\n\nA `trailmark_diff.json` whose `nodes`, `edges`, and `entrypoints` arrays are all\nempty means either nothing changed structurally or both snapshots parsed to\n(near-)empty graphs. Decide which using Phase 2's graph summaries: if either\nsnapshot's node count is zero or implausibly small for the target, the parse\nmissed the code — name the language set explicitly (`rust`, `solidity`,\n`python,rust`) and re-run. Healthy node counts on both snapshots plus an empty\ndiff is genuine structural stability.\n\nThe native Trailmark diff contains:\n\n| Key | Contents |\n|-----|----------|\n| `summary_delta` | Changes in node\u002Fedge\u002Fentrypoint counts |\n| `nodes.added` | New functions, classes, methods |\n| `nodes.removed` | Deleted functions, classes, methods |\n| `nodes.modified` | Functions with changed CC, params, line span |\n| `edges.added` | New call\u002Finheritance\u002Fimport relationships |\n| `edges.removed` | Deleted relationships |\n| `entrypoints` | Added, removed, and modified entrypoints |\n\nThe subgraph diff contains:\n\n| Key | Contents |\n|-----|----------|\n| `subgraphs` | Per-subgraph membership changes (tainted, high_blast_radius, etc.) |\n\n### Phase 4: Interpret Diff and Generate Report\n\nRead **both** diff JSON files and generate a security-focused markdown\nreport.\nSee [references\u002Freport-format.md](references\u002Freport-format.md) for\nthe full template.\n\n**Interpretation priorities (highest to lowest):**\n\n1. **New tainted paths** — nodes entering the `tainted` subgraph,\n   especially if they also appear in added edges targeting sensitive\n   functions\n2. **Privilege boundary changes** — new or removed trust transitions\n   from the native entrypoint\u002Fedge diff plus the subgraph diff\n3. **Attack surface growth** — new entrypoints, especially\n   `untrusted_external`, from `trailmark_diff.json`\n4. **Blast radius increases** — nodes entering `high_blast_radius`\n5. **Complexity spikes** — CC increases > 3 on tainted or\n   entrypoint-reachable nodes\n6. **Structural additions** — new nodes and edges (review needed)\n7. **Structural removals** — verify removed security functions were\n   replaced\n\nCross-reference structural changes with `git diff {before_ref}..{after_ref}`\nto add source-level context to findings.\n\n**Severity classification:**\n\n| Severity | Structural Signal |\n|----------|------------------|\n| CRITICAL | New tainted path to sensitive function, removed auth boundary |\n| HIGH | New entrypoint + high blast radius, large CC increase on tainted node |\n| MEDIUM | New trust-boundary-crossing edges, moderate CC increase |\n| LOW | Added nodes without entrypoint reachability |\n| INFO | Dead code removal, complexity reductions |\n\nFor detailed metric definitions, see\n[references\u002Fevolution-metrics.md](references\u002Fevolution-metrics.md).\n\n### Phase 5: Clean Up\n\nRemove git worktrees after the report is written:\n\n```bash\ngit worktree remove \"{before_dir}\"\ngit worktree remove \"{after_dir}\"\n```\n\n---\n\n## Diff Reference\n\n```\ntrailmark diff --json --language auto BEFORE AFTER\nuv run {baseDir}\u002Fscripts\u002Fgraph_diff.py [OPTIONS]\n```\n\n`trailmark diff --language` defaults to `python`. On a target in any other\nlanguage that default still exits 0, emitting well-formed JSON with empty\n`nodes`, `edges`, and `entrypoints` arrays, so always pass the flag: `auto`\ndetects and merges every supported language found under the target, and a single\nname (`rust`, `solidity`) or comma-separated list (`python,rust`) pins an\nexplicit set. `auto` fails loudly with `No supported languages detected under\n\u003Cpath>` when a snapshot holds nothing it can parse, which is the outcome you\nwant. Confirm the language first; only then can an empty diff count as evidence\nthat nothing changed.\n\nUse `trailmark diff` for:\n- Node\u002Fedge changes\n- Added\u002Fremoved\u002Fmodified entrypoints\n- Human-readable structural diff reports\n\nUse `graph_diff.py` for:\n- Subgraph membership changes derived from `engine.preanalysis()`\n- `tainted`, `high_blast_radius`, `privilege_boundary`, and related sets\n\n| Argument | Default | Description |\n|----------|---------|-------------|\n| `--before` | required | Path to the \"before\" graph JSON |\n| `--after` | required | Path to the \"after\" graph JSON |\n| `--indent` | `2` | JSON output indentation |\n\n`graph_diff.py` input format: Trailmark JSON exports from `engine.to_json()`.\n`graph_diff.py` output: JSON structural diff for nodes, edges, and subgraphs.\n\n---\n\n## Quality Checklist\n\nBefore delivering the report:\n\n- [ ] Both graphs built successfully (check summaries)\n- [ ] Pre-analysis ran on both snapshots\n- [ ] Native Trailmark diff computed (`trailmark_diff.json`); if it is empty,\n      both snapshots' Phase 2 node counts were non-zero, so empty means stable\n- [ ] Subgraph diff computed and non-empty (`subgraph_diff.json`)\n- [ ] All subgraph changes interpreted (tainted, blast radius, etc.)\n- [ ] Critical findings include evidence (node IDs, edge diffs)\n- [ ] Severity levels assigned to all findings\n- [ ] Source-level context added via git diff cross-reference\n- [ ] Worktrees cleaned up (or temp dirs removed)\n- [ ] Report written to `GRAPH_EVOLUTION_*.md`\n\n---\n\n## Integration\n\n**trailmark skill:**\nPhase 2 uses the trailmark API for graph building and pre-analysis.\nAll trailmark query patterns work on either snapshot's engine.\n\n**differential-review skill:**\nUse graph-evolution for structural analysis, differential-review for\nline-level code review. The two are complementary — graph-evolution\nfinds attack paths that text diffs miss, while differential-review\nprovides git blame context and micro-adversarial analysis.\n\n**trailmark-review-gate skill:**\nUse trailmark-review-gate after graph-evolution when a branch, pull request,\nfix commit, or release diff needs a PASS\u002FWARN\u002FFAIL\u002FUNKNOWN structural review\npacket. The gate applies deterministic review rules to graph-evolution output;\nit does not replace human review.\n\n**genotoxic skill:**\nIf graph-evolution reveals new high-CC tainted nodes, feed them to\ngenotoxic for mutation testing triage.\n\n**diagramming-code skill:**\nGenerate before\u002Fafter diagrams to visualize structural changes.\nUse `call-graph` or `data-flow` diagrams focused on changed nodes.\n\n---\n\n## Supporting Documentation\n\n- **[references\u002Fevolution-metrics.md](references\u002Fevolution-metrics.md)** —\n  What each structural metric means and why it matters for security\n- **[references\u002Freport-format.md](references\u002Freport-format.md)** —\n  Report template, severity classification, and example findings\n",{"name":5,"description":7},"main","321ccfe628eca0d314b0ee4eaffcdd8a05639aaf","plugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution",0,"https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills","https:\u002F\u002Fgithub.com\u002Fbongkage","2026-11-06 12:15:06",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add bongkage\u002Ftrailofbits-skills --skill graph-evolution",{"tool":36,"command":37},"bunx","bunx skills add bongkage\u002Ftrailofbits-skills --skill graph-evolution",{"tool":39,"command":40},"pnpm","pnpm dlx skills add bongkage\u002Ftrailofbits-skills --skill graph-evolution","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002FSKILL.md",true,[44,50,56,60,64],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"agents\u002Fopenai.yaml","REFERENCE","参考文档",128,"https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002Fagents\u002Fopenai.yaml",{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"assets\u002Ftrail-of-bits-mark.svg","ASSET","资产文件",3084,"https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002Fassets\u002Ftrail-of-bits-mark.svg",{"path":57,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Fevolution-metrics.md",5205,"https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002Freferences\u002Fevolution-metrics.md",{"path":61,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Freport-format.md",4340,"https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002Freferences\u002Freport-format.md",{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"scripts\u002Fgraph_diff.py","SCRIPT","脚本",7845,"https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fgraph-evolution\u002Fscripts\u002Fgraph_diff.py",[71,78,85,92,99,106],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7CHJAESZRWKJXFQG55BMNAA","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fzeroize-audit\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M7CHJ543G42A9GQC3PJE4F4V","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fyara-authoring\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M7CHHYVFS1AKDTH3YDS1Y4K4","writing-lean-proofs","Writes and reviews structured Lean 4 proofs and designs Lean libraries following Mathlib conventions. Use when proving theorems in Lean, formalizing mathematics or specifications in Lean 4, defining new types or definitions in a Lean library, reviewing Lean proofs for readability and maintainability, refactoring long tactic proofs into lemmas, filling in sorry placeholders in a Lean development, setting up CI or linters for a Lean project, diagnosing slow proofs or maxHeartbeats timeouts, or writing custom tactics, macros, or linters.","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwriting-lean-proofs\u002Fskills\u002Fwriting-lean-proofs\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":18},"01M7CHHQXA39M4965MV2RMM5YS","vulnerability-triage-brocards","This skill should be used when the user asks to \"triage a vulnerability report\", \"assess a CVE\", \"evaluate a bug bounty submission\", \"decide if a finding is valid\", \"review a security finding\", \"dismiss a vulnerability\", \"should we fix this CVE\", \"prioritize a vulnerability report\", or needs to determine whether an incoming vulnerability report warrants investigation. Applies 7 brocards (rules of thumb) to systematically accept, dismiss, or request more information on vulnerability reports, or needs to filter raw findings from agentic vulnerability discovery pipelines before human review.","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fvulnerability-triage-brocards\u002Fskills\u002Fvulnerability-triage-brocards\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":18},"01M7CHHJVQC2ZG2M310GXT0T42","variant-analysis","Hunts for the other instances of a bug already found — the variants of one root cause across a codebase. Use immediately after a vulnerability, logic bug, or bad pattern turns up in a specific file and the question becomes where else it occurs, including the bare conversational form (\"are there others like this?\", \"is this the same bug?\"). Also for generalizing one known instance into a CodeQL or Semgrep query for its whole pattern family, and for triaging a set of look-alike candidates against a known root cause. Not for initial discovery with no bug in hand.","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fvariant-analysis\u002Fskills\u002Fvariant-analysis\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":18},"01M7CHHC1GM5GH585ZWGP7D03P","vector-forge","Mutation-driven test vector generation. Finds implementations of a cryptographic algorithm or protocol, runs mutation testing to identify escaped mutants, then generates new test vectors that deliberately exercise the uncovered code paths. Compares before\u002Fafter mutation kill rates to prove vector effectiveness. Use when generating cryptographic test vectors, measuring Wycheproof coverage gaps, finding escaped mutants via mutation testing, creating cross-implementation test suites, or improving test vector coverage for crypto primitives.","https:\u002F\u002Fgithub.com\u002Fbongkage\u002Ftrailofbits-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftrailmark\u002Fskills\u002Fvector-forge\u002FSKILL.md",[],[]]