Repository navigation
Add repo-wide symbol graph: find_definition/find_references (PR1: Rust) - #441
Merged
Merged
Conversation
…ces (PR1: Rust) Adds a new forge-graph crate backing find_definition/find_references — a repo-wide, syntactic-only symbol/edge index. Facts are extracted via real tree_sitter Query/QueryCursor matching (first use of that API in forge; existing syntax highlighting hand-walks the tree instead). The core invariant: never present a guess as a fact. A symbol name unique across the repo resolves with full confidence; a name matching multiple candidates (e.g. an ambiguous method call) returns the full honest candidate set instead of picking one. No INFERRED edge tier exists yet — v1 only ever records what tree-sitter can verify. PR1 scope: Rust only, one synchronous full-repo build at session open (no live watcher yet), both tools registered conditionally exactly like web_search, enabled by default via a new [tools.graph] config. Dogfood-validated against forge's own repo, which surfaced and fixed a real bug: gitignored scratch worktrees under .claude/worktrees/ were being indexed as false duplicate symbols. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
This was referenced Aug 26, 2026
mohitranka
added a commit
that referenced
this pull request
Aug 26, 2026
* Revert "feat(graph): live watcher, /graph toggle, and AgentSession wiring (PR3) (#443)" This reverts commit aae0844. * Revert "feat(graph): extend symbol graph to Python, Go, TypeScript, JavaScript (PR2) (#442)" This reverts commit a58b6a2. * Revert "feat(graph): add repo-wide symbol graph, find_definition/find_references (PR1: Rust) (#441)" This reverts commit ea4c3b9.
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…ces (PR1: Rust) (#441) Adds a new forge-graph crate backing find_definition/find_references — a repo-wide, syntactic-only symbol/edge index. Facts are extracted via real tree_sitter Query/QueryCursor matching (first use of that API in forge; existing syntax highlighting hand-walks the tree instead). The core invariant: never present a guess as a fact. A symbol name unique across the repo resolves with full confidence; a name matching multiple candidates (e.g. an ambiguous method call) returns the full honest candidate set instead of picking one. No INFERRED edge tier exists yet — v1 only ever records what tree-sitter can verify. PR1 scope: Rust only, one synchronous full-repo build at session open (no live watcher yet), both tools registered conditionally exactly like web_search, enabled by default via a new [tools.graph] config. Dogfood-validated against forge's own repo, which surfaced and fixed a real bug: gitignored scratch worktrees under .claude/worktrees/ were being indexed as false duplicate symbols. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
* Revert "feat(graph): live watcher, /graph toggle, and AgentSession wiring (PR3) (#443)" This reverts commit ec8c1ef. * Revert "feat(graph): extend symbol graph to Python, Go, TypeScript, JavaScript (PR2) (#442)" This reverts commit 0e813ab. * Revert "feat(graph): add repo-wide symbol graph, find_definition/find_references (PR1: Rust) (#441)" This reverts commit e18cf38.
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…ces (PR1: Rust) (#441) Adds a new forge-graph crate backing find_definition/find_references — a repo-wide, syntactic-only symbol/edge index. Facts are extracted via real tree_sitter Query/QueryCursor matching (first use of that API in forge; existing syntax highlighting hand-walks the tree instead). The core invariant: never present a guess as a fact. A symbol name unique across the repo resolves with full confidence; a name matching multiple candidates (e.g. an ambiguous method call) returns the full honest candidate set instead of picking one. No INFERRED edge tier exists yet — v1 only ever records what tree-sitter can verify. PR1 scope: Rust only, one synchronous full-repo build at session open (no live watcher yet), both tools registered conditionally exactly like web_search, enabled by default via a new [tools.graph] config. Dogfood-validated against forge's own repo, which surfaced and fixed a real bug: gitignored scratch worktrees under .claude/worktrees/ were being indexed as false duplicate symbols. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
* Revert "feat(graph): live watcher, /graph toggle, and AgentSession wiring (PR3) (#443)" This reverts commit c8048f9. * Revert "feat(graph): extend symbol graph to Python, Go, TypeScript, JavaScript (PR2) (#442)" This reverts commit b48bbbe. * Revert "feat(graph): add repo-wide symbol graph, find_definition/find_references (PR1: Rust) (#441)" This reverts commit f2acb05.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR1 of 3 (per the design-review plan) for a new knowledge-graph feature: repo-wide
find_definition/find_referencestools backed by a persisted, syntactic-only symbol/edge index.crates/forge-graphcrate — SQLite-backed store, Rust fact extraction via realtree_sitter::Query/QueryCursormatching (the first use of that API anywhere in forge; existing syntax highlighting inforge-syntaxhand-walks the tree instead — called out explicitly as an intentional new pattern, not scope creep).INFERREDedge tier exists — v1 only ever records what tree-sitter can verify (imports, type/impldeclarations, function/method definitions, call sites).find_definition(symbol),find_references(symbol)— registered conditionally exactly likeweb_search(Option<Arc<dyn Tool>>, no handle → no tools), not a graph-query DSL.[tools.graph]config (enabled by default), a newRuntimeDataKind::Graphstorage category, wired intoopen_session..claude/worktrees/were being walked and indexed as false duplicate symbols. Regression test added.Test plan
cargo fmt --allcleancargo clippy --workspace --all-targetscleancargo test --workspacegreen (full suite, exit 0)find_definition/find_referenceson real symbols (AgentSession,tools_for_model,compress_tool_output) matched known call sites exactlyhttps://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs