Skip to content

Add a graphify knowledge graph of ICSharpCode.Decompiler - #3957

Draft
christophwille wants to merge 1 commit into
masterfrom
graphify-icsd
Draft

Add a graphify knowledge graph of ICSharpCode.Decompiler#3957
christophwille wants to merge 1 commit into
masterfrom
graphify-icsd

Conversation

@christophwille

Copy link
Copy Markdown
Member

Adds a graphify knowledge graph of ICSharpCode.Decompiler/, committed under graphify-out/.

  graph.html            - interactive graph, open in browser
  GRAPH_REPORT.md       - audit report
  graph.json            - raw graph data

Built on ICSharpCode.Decompiler/ (583 files), narrowed from the 2,145-file repo. 9,519 nodes / 27,828 edges / 283 communities. Extraction was 9,615 AST nodes (free, deterministic) plus 39 semantic nodes from 2 docs and 1 image.

Two caveats worth stating plainly:

  • Graph health warning: 1,051 dangling-endpoint edges (references to types outside the scanned directory - expected when scoping to one project), and 4,324 edges collapsed into 27,828 unique undirected pairs. The collapse is mostly benign multiplicity - e.g. DecompilerSettings has 121 separate bool field references that fold into one edge - but it means edge counts understate raw reference density.
  • Token accounting: the harness reported combined subagent totals (68,911) without an input/output split, so cost.json records it all as input.

Benchmark: 7.1x fewer tokens per query vs. naive corpus reads (~634,600 -> ~89,918).

God Nodes

# Node Edges
1 IType 631
2 ILInstruction 600
3 System 315
4 ICSharpCode.Decompiler.TypeSystem 252
5 AstNode 213
6 ILVisitor 207
7 IMethod 193
8 CSharpOutputVisitor 183
9 ExpressionBuilder 180
10 ICSharpCode.Decompiler.CSharp.Syntax 171

Surprising Connections

  • ForeachAnnotation --references--> ILInstruction - CSharp/Annotations.cs -> IL/Instructions.cs
  • ImplicitReturnAnnotation --references--> Leave - CSharp/Annotations.cs -> IL/Instructions.cs
  • QueryGroupClauseAnnotation --references--> ILFunction - CSharp/Annotations.cs -> IL/Instructions.cs
  • QueryJoinClauseAnnotation --references--> ILFunction - CSharp/Annotations.cs -> IL/Instructions.cs
  • ILVariableResolveResult --references--> ILVariable - CSharp/Annotations.cs -> IL/ILVariable.cs

Suggested Questions

  • Why does IType connect 80+ communities spanning the IL layer, the C# syntax layer, and the type system?
  • What is the relationship between the NuGet icon's visual metaphor and its package-branding role? (AMBIGUOUS edge, low confidence)

The Annotations.cs cluster is the standout: it is the single file where the C# AST layer holds direct references back into IL instructions - the bridge that lets decompiled syntax nodes carry their originating IL. Every surprising connection the graph found lands there.

Notes on what is and is not committed

graph.json is 18 MB and is committed in full, so the graph is queryable from a clean clone without re-running extraction. The AST/semantic caches are excluded via .gitignore - they key off absolute paths on the machine that produced them and are not portable.

🤖 Generated with Claude Code

The decompiler library is large enough that its architecture is hard to hold
in one head, and the coupling that matters most is the part no directory
listing shows: which of the 283 clusters actually talk to each other. Building
the graph surfaced that CSharp/Annotations.cs is the single bridge where the
C# AST layer holds direct references back into IL instructions - every
cross-layer connection the analysis flagged as surprising lands in that one
file.

Scoped to ICSharpCode.Decompiler/ rather than the whole repo: at 2,145 files
the full tree exceeds what the clustering step handles usefully, and the test
fixtures and UI would dominate the communities without explaining the engine.

Extraction is deterministic AST parsing for the 580 code files; only the two
markdown files and the package icon needed a model. graph.json is committed in
full so the graph is queryable from a clean clone without re-running
extraction. The AST caches are deliberately left out - they key off absolute
paths on the machine that produced them.

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
@christophwille
christophwille marked this pull request as draft August 6, 2026 12:47
@christophwille

Copy link
Copy Markdown
Member Author

Claude added one Q: ▎ The most interesting question this graph can answer: How does CSharp/Annotations.cs bridge the IL layer and the C# syntax layer, and what does that coupling let the decompiler do? Want me to trace it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant