Show HN: Graphify C# – Compiler-accurate Find Usages for coding agents
This "Show HN" introduces graphify-csharp, a Roslyn-based tool that provides compiler-accurate semantic analysis for C# code. It enables LLM coding agents to perform sophisticated queries like "Find Usages" with precision, moving beyond simple text matching. The project appeals to the Hacker News crowd by open-sourcing a powerful developer tool that enhances the capabilities of AI assistants in a technically rigorous manner.
The Lowdown
Zach Saw's graphify-csharp is a new open-source tool designed to elevate the analytical capabilities of Large Language Model (LLM) coding agents for C# projects. Acting as a headless Roslyn/MSBuild indexer, it generates a detailed, queryable graph of semantic evidence directly from C# source code, far surpassing the limitations of basic text search.
- Compiler-Accurate Insights: Unlike text-based analysis,
graphify-csharpleverages Roslyn to provide deterministic information on callers, references, implementations, inheritance, and overrides, even handling complex scenarios like overloads and generics across multiple projects. - Empowering AI Agents: It allows coding agents to answer nuanced questions such as "Which methods are used only by tests?" by providing explicit, compiler-resolved relationships rather than ambiguous name matches. This bridges the gap between syntactic and semantic code understanding for AI.
- Lightweight and Open: The tool is MIT licensed, requires no installed IDE or compiled project DLLs, and doesn't rely on a dedicated database. It outputs its rich semantic data as a single JSON document, making it easily consumable.
- Focused Utility:
graphify-csharpcarves out a specific niche, distinct from full-fledged IDEs (like Rider) or broad architectural analysis suites (like NDepend). Its primary purpose is to supply source-level C# semantic evidence directly to other tools and, crucially, to coding agents. - Flexible Integration: The tool can be used independently, with users querying the output JSON directly, or integrated into the broader
Graphifyecosystem for advanced graph-based workflows. - Comprehensive Data: It indexes a wide array of C# constructs, from namespaces and classes to methods, properties, and even compiler-selected operators, along with their precise, compiler-resolved relationships.
- Incremental Indexing: For continuous development,
graphify-csharpoffers a--watchmode that keeps the Roslyn workspace warm, enabling efficient incremental indexing and faster updates. - Transparent Limitations: The project clearly states its static analysis boundary, acknowledging that it reports "observed static references" and that runtime behaviors (e.g., via reflection) might not be captured, emphasizing the need for human judgment in critical decisions.
In essence, graphify-csharp provides a critical missing link for AI agents, allowing them to interpret C# code with the same depth and precision as a compiler, thereby enabling more sophisticated and reliable automated code analysis and manipulation.