Repository navigation
explore: encourage the graph for code — typed graph-search and graph-get — without forcing it - #1760
Merged
Merged
Conversation
…-get before any file The repository note alone did not move the explorer off grep (swarm38 explore 1791664501161: 1 fulltext_search + 2 views, 0 graph calls, the note in its prompt). Typed search came next, then the agent grepped for the path a hit named: a search result carries no file. The system prompt now orders it — graph-search with type Function,Class,Datamodel,Endpoint,Request,Page,File (narrowed per question), graph-get the hits (a code node has its file, start/ end, body, description), never grep for or open a file a hit names before its node is read — and a source for code in an ingested repository is the node. Same question with this prompt as a params override (1791664949002): search → get → search → get → neighbors, no files, high confidence, file:lines cited from the nodes, $0.10 as before.
…rve better The graph is parsed from the code and can miss or misplace things; grep and the files stay first-class. Drop the hard rule (never grep for or open a file before reading its node); keep the typed search over the code node types and why graph-get pays (a node carries its file, lines, body, description); say when the files serve better (an exact string, path or config value; lines a node lacks; a node that looks wrong) and that the file wins a disagreement. Cite the node when the code was read as one, the file otherwise.
Evanfeenstra
added a commit
that referenced
this pull request
Oct 12, 2026
* explore: begin with one graph search when the graph holds the code The softened prompt (#1760) still left the graph unused on a broad question about what the code does — the case it said the graph is for (swarm38 explore run 1791735843683: grep, file_summary and views only). One typed graph search comes first now; after it, whichever fits. * explore: a search hit carries its file and lines, and the graph counts lines from 0 strut#142 adds `file`, `start` and `end` to graph/graph-search's hits, so the prompt's "a search result has no file path; the node has it" stops being true. And stakgraph's lines are 0-based (swarm38: computeHmacSha256Hex is start 152, end 154 for lines 153-155), so citing <repo>/<path>:<start>-<end> pointed one line early: the prompt now says a node covers start+1 to end+1 and cites that.
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.
Why
Even with #1758's repository note, the explorer answered every code question by grep, and nothing in the prompt said what the graph is good for. But the graph is parsed from the code, so it isn't a perfect syntax tree. Grep and the files stay first-class; this encourages the graph without forcing it.
What
graph/graph-searchwithtypeset to code node types,Function,Class,Datamodel,Endpoint,Request,Page,File, narrowed per question;graph-getthe hits that look right. A search result has no file path; the node hasfile,start/end,body/interfaceand adescription, often enough to answer and cite<repo>/<path>:<lines>;graph-neighbors/walk.explore/repositoriesnote: the same type list andgraph-getadvice, plus "use fulltext_search and the file tool whenever they serve better".Observed (swarm38, same question each time, run with the prompt as a
params.systemoverride)The question named an exact route path.
179166450116117916649490021791665463791On this exact-path question the agent still picks grep, which is the case the prompt now says files are for. Graph use on questions by behavior ("what calls X", "where is Y handled") wasn't sampled. Files read directly are going to show in hive's Graph Trace as their
Filenodes (next PR, hive), so a grep-first exploration still shows what it read.Tests
explore/seed.test.tschecks the type list, thegraph-getadvice, "go to the files whenever they serve better", "the file is right", and that the prompt has no "Never grep".tscis clean.