Graphify C# 0.1 Release – Compiler‑Accurate Find Usages for C# Coding Agents
TL;DR – What Graphify C# does and why it matters
Graphify C# is a free, headless Roslyn/MSBuild indexer that emits a deterministic JSON graph of compiler‑resolved symbols, calls, references, inheritance and overrides for any C# solution. By supplying this semantic evidence, coding agents (e.g., Claude Code, Codex, or custom LLM bots) can answer "Find Usages"‑style questions with compiler accuracy instead of unreliable text‑search heuristics.
Immediate value for coding agents
- Exact overload resolution – The graph stores bound signatures, so an agent can distinguish between
Foo(int)andFoo(string). - Project‑aware relationships – Each edge records the originating project and target‑framework, enabling queries such as “methods used only in test projects”.
- Full language coverage – Supports C# 14 (Roslyn 5.9) and C# 15 preview (via .NET 11 SDK), including generics, pattern matching, async, and collection expressions.
- Zero‑runtime dependencies – No IDE, no compiled DLL, and no external database; the output is a single JSON file that any consumer can read.
How the tool works
- Installation – Install the .NET global tool:
dotnet tool install --global Graphify.CSharp --framework net10.0 - Indexing – Run the CLI against a solution, project, or SDK‑style source folder:
The command produces a JSON document with three top‑level arrays:graphify-csharp \ --input ./src/MyProduct.sln \ --root . \ --configuration Release \ --output ./graphify-out/csharp.jsonnodes,edges, andhyperedges. - Consumption – Agents can read the JSON directly, query with
jq, or feed it into the broader Graphify workflow for path‑finding, clustering, and explanations. - Incremental updates – Adding
--watchkeeps the Roslyn workspace warm and updates the JSON on file changes;--rebuildforces a full refresh.
Semantic evidence vs. plain text search
| Without Graphify | With Graphify C# |
|---|---|
| Text‑match finds only name strings. | Roslyn resolves the exact declaration for each usage. |
| Overloads and generics are ambiguous. | Bound signatures and project/TFM identity are retained. |
| Test‑only usage requires manual inspection. | Every caller carries project, namespace, and source location. |
| Type relationships must be inferred from text. | inherits, implements, and overrides appear as explicit edges. |
Example: The method DeclarationCatalogBuilder.ForTesting appears in the graph with a single incoming call edge from the test project, giving agents a reliable “test‑only” signal.
Quick integration with LLM agents
The repository ships a ready‑made skill for Codex‑compatible agents and Claude Code. Installing the skill is a one‑liner:
mkdir -p .agents/skills/graphify-csharp
curl -fsSL https://raw.githubusercontent.com/zachsaw/graphify-csharp/main/.agents/skills/graphify-csharp/SKILL.md \
-o .agents/skills/graphify-csharp/SKILL.md
The skill instructs the agent to refresh the JSON before answering C#‑related queries and to use symbol_key identifiers when traversing calls and references edges.
If you prefer not to use a skill, simply add the following instruction to your prompt template:
For C# structure and usage questions, refresh
graphify-out/csharp.jsonwithgraphify-csharpbefore answering. Identify declarations bysymbol_keyand inspect incomingcallsandreferencesedges. Treat zero inbound edges as observed static evidence, not proof of runtime unreachability.
With this context, agents can answer questions such as:
- Which overload of a constructor is invoked?
- Which classes implement a given interface?
- Which members override a virtual method?
- Which declarations have zero observed inbound references?
Where Graphify C# fits in the ecosystem
| Tool | Primary purpose | Overlap with Graphify C# |
|---|---|---|
| Rider / ReSharper | Interactive IDE navigation, refactorings, inspections. | Provides the same semantic edges, but only inside the IDE UI. |
| NDepend | Architecture analysis, metrics, baselines, visualizations. | Offers similar caller/dependency data, but as a commercial, heavyweight suite. |
| Graphify C# | Headless, language‑level semantic index for agents. | Supplies raw, compiler‑accurate edges in an open JSON format; no UI, no licensing constraints. |
Graphify C# is deliberately narrow: it does not attempt to replace NDepend’s reporting or Rider’s UI, but it fills the missing gap for automated agents that need reliable static evidence.
Performance and scalability considerations
- JSON size – The output can grow large for multi‑million‑LOC solutions. Users have asked whether a SQLite store would be more scalable. At present the tool emits JSON; downstream consumers can import it into a database if needed.
- Runtime overhead – Roslyn is loaded only during indexing. The
--watchmode keeps the workspace warm, but indexing is still an on‑demand operation, not a continuous background service. - Static‑analysis limits – The graph reflects only what Roslyn can see statically. Reflection, DI containers, native interop, and dynamic calls are not represented as edges. Consequently, a node with zero inbound edges means zero observed static references, not guaranteed runtime dead code.
Community feedback from Hacker News
bob1029: "My VS Copilot already writes one‑off Roslyn scripts; Graphify C# shows that the community still under‑utilises Roslyn for LLM agents."
spicyusername: "Excited about upcoming C# 15 unions; Graphify C# already supports the preview compiler."
JFuzz: "Adapted the skill for Unity package development; the CLI + JSON workflow makes semantic data accessible outside the IDE."
Merad: "Concerned about JSON scalability on millions of LOC; suggests a SQLite backend."\n coverband: "Asked whether the output format aligns with the broader Graphify‑Labs ecosystem."
quietraster: "Wanted to know if indexing happens on save or on demand; the tool indexes on demand (or via
--watch)."
These comments highlight both enthusiasm for the approach and practical questions about scalability and integration.
Getting started checklist
- Install the appropriate runtime – Choose
net10.0for Roslyn 5.9 (C# 14) ornet11.0for the .NET 11 SDK (C# 15 preview). - Run the indexer – Point
graphify-csharpat your solution; verify the generatedcsharp.jsoncontainsnodesandedges. - Integrate with your agent – Add the provided skill or embed the refresh‑and‑query instructions in your prompt.
- Iterate – Use
--watchduring active development or schedule periodic refreshes in CI pipelines.
License and contribution
Graphify C# is released under the MIT license. The repository includes build scripts (dotnet restore, dotnet build, dotnet test, dotnet pack) and extensive documentation in the docs/ folder for usage, compatibility, incremental indexing, and release procedures.
Sources
Related
- Project