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) and Foo(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

  1. Installation – Install the .NET global tool:
    dotnet tool install --global Graphify.CSharp --framework net10.0
    
  2. Indexing – Run the CLI against a solution, project, or SDK‑style source folder:
    graphify-csharp \
      --input ./src/MyProduct.sln \
      --root . \
      --configuration Release \
      --output ./graphify-out/csharp.json
    
    The command produces a JSON document with three top‑level arrays: nodes, edges, and hyperedges.
  3. Consumption – Agents can read the JSON directly, query with jq, or feed it into the broader Graphify workflow for path‑finding, clustering, and explanations.
  4. Incremental updates – Adding --watch keeps the Roslyn workspace warm and updates the JSON on file changes; --rebuild forces 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.json with graphify-csharp before answering. Identify declarations by symbol_key and inspect incoming calls and references edges. 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 --watch mode 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

  1. Install the appropriate runtime – Choose net10.0 for Roslyn 5.9 (C# 14) or net11.0 for the .NET 11 SDK (C# 15 preview).
  2. Run the indexer – Point graphify-csharp at your solution; verify the generated csharp.json contains nodes and edges.
  3. Integrate with your agent – Add the provided skill or embed the refresh‑and‑query instructions in your prompt.
  4. Iterate – Use --watch during 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