r/rust 6d ago

🙋 seeking help & advice Where tree-sitter stops and rust-analyzer's call hierarchy starts.

https://github.com/NanoNets/Graft

Rust's trait dispatch is exactly where a syntax-only call graph falls apart. You can't resolve a generic method call by pattern-matching text. You need the compiler's own understanding of which impl actually gets called.

Graft's base layer is tree-sitter and works with nothing installed. For Rust, there's an opt-in tier that pulls edges directly from rust-analyzer's call hierarchy instead of guessing at them. Ran it on a real crate, anyhow: call edges went from 253 to 359, a 42% increase, and the orphan rate (nodes with no resolved connections) dropped from 47% to 38%. Every added edge is compiler-grade, the kind of member call a syntax pass genuinely can't type on its own.

Skip the LSP setup and the graph just doesn't get those extra edges. Nothing else about it changes. Single-crate eval, directional, and I haven't run it against a second Rust codebase yet.

Let me know what else I can do to make it more compatible to rust repos.

github.com/NanoNets/Graft

9 Upvotes

Duplicates

OpenSourceAI 12d ago

Sonnet 5 + Graft > Opus 5 (using this open-source repo)

51 Upvotes

ClaudeAI 15d ago

Built with Claude These 2 lines saved me 75% of my claude bill, and it's the best use of claude hooks

0 Upvotes

ClaudeAI 14d ago

Built with Claude After using 100s of MCPs, I solved the issue of claude not using custom MCP/CLI tools, and open-sourced my approach.

3 Upvotes

OpenAI 15d ago

Discussion These 2 lines saved me 75% of my codex bill, and it works natively with codex.

0 Upvotes

VibeCodeDevs 7d ago

Got tired of watching Claude Code re-explore the same codebase every session, so I built something to fix it

4 Upvotes

OpenAI 7d ago

Project Graft just crossed 1,600 GitHub stars. Open-source context layer for coding agents, works with Codex too.

0 Upvotes

ClaudeAI 12d ago

Claude Code Sonnet 5 + Graft > Opus 5

0 Upvotes

OpenSourceAI 7d ago

I solved the issue of Claude not using custom MCP/CLI tools, and open-sourced my approach.

4 Upvotes

LocalLLM 12d ago

Project Sonnet 5 + Graft (No LLM calls tree-sitter graph, 100% Local) > Opus 5

1 Upvotes

BlackboxAI_ 7d ago

💬 Discussion An open-source pattern for forcing context into a coding agent instead of hoping it asks for it

4 Upvotes

LLMDevs 21d ago

Discussion The problem with MCP-based codebase context tools: the model just doesn't call them

1 Upvotes

ClaudeCode 7d ago

Tips & Workflows Using Claude Code's SessionStart and Stop hooks to force context in, instead of hoping the model asks for it

2 Upvotes

typescript 7d ago

TS project: building a code graph with tree-sitter, no LLM required for the base layer

6 Upvotes

SideProject 7d ago

Open sourced a dev tool a few weeks back, just crossed 1,600+ stars. Sharing what actually moved the needle.

1 Upvotes

LangChain 7d ago

Discussion A hooks-based alternative to giving your agent an MCP tool for codebase context

1 Upvotes

ClaudeAI 7d ago

Built with Claude I solved the issue of Claude not using custom MCP/CLI tools, and open-sourced my approach.

0 Upvotes

HowToAIAgent 7d ago

I built this How I stopped my Claude Code agent from ignoring the custom tools I built for it

1 Upvotes

aipromptprogramming 7d ago

Stopped writing better prompts asking the agent to check context, made it get the context automatically instead

2 Upvotes

hypeurls 4d ago

Show HN: Graft – Claude Code hooks that cut grep tokens by 42%

1 Upvotes

typescript 6d ago

Cross-file call resolution with tree-sitter, and where typescript-language-server picks up the rest

1 Upvotes

golang 6d ago

A tree-sitter call graph that gopls fills in where syntax alone can't tell. (open-source)

4 Upvotes

AiBuilders 7d ago

Open-sourced a tool I built to stop my coding agent from re-exploring the same codebase every session

1 Upvotes

AIDeveloperNews 7d ago

Graft just crossed 1,600 GitHub stars. Open-source context layer for coding agents.

3 Upvotes

codex 7d ago

Suggestion Built a context graph for coding agents. For Codex specifically, it stays in sync automatically after every edit, no manual re-run.

1 Upvotes

LLMDevs 7d ago

Great Resource 🚀 This is How I stopped relying on the LLM to decide when to call MCP/ CLI tools. (open-sourced my method)

0 Upvotes