feat: surface per-neighbor edge counts in graph_neighbors#1460
Merged
Conversation
Each neighbor returned by graph_neighbors now carries an "edges" map
({EDGE_TYPE: count}) showing how connected that neighbor is and which
relationship types can be traversed next — so an agent can pick which hop
target to expand without a follow-up call.
Sends include_edge_counts=true on the expand=edges request so Jarvis
attaches each neighbor's counts inline (one call, no per-node round trips),
and adds an optional namespace param to scope the counts. Depends on the
matching jarvis-backend change to the expand=edges path.
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.
What
Follow-up to #1459. Each neighbor returned by
graph_neighborsnow carries anedgesmap ({EDGE_TYPE: count}):[ { "ref_id": "def-456", "node_type": "Function", "name": "handle_request", "edge_type": "CALLS", "direction": "forward", "edges": { "CALLS": 8, "CONTAINS": 1 } } ]Why
#1459 added edge counts to
graph_searchandgraph_get, but notgraph_neighbors— it hits a different backend path (expand=edges→prediction_service.get_node_edges). This closes that gap so an agent can see how connected each hop target is and which edge types it can follow next, and choose where to traverse without a follow-up call per neighbor.How
include_edge_counts=trueon theexpand=edgesrequest so Jarvis attaches each neighbor's counts inline — one call, no per-node round trips.edgesmap from the neighbor nodes and surfaces it on each returned neighbor.namespaceparam to scope the counts correctly.Dependency
Requires the matching backend change in stakwork/jarvis-backend#2976 (now extends
include_edge_countsto theexpand=edgespath). Until it deploys, neighbors carryedges: {}.Tests
tsc --noEmitclean; all 25 tests intoolsJarvis.test.tspass.