feat: token-efficiency improvements#460
Open
jaissebastian wants to merge 2 commits into
Open
Conversation
…ow summaries Extends `detail_level` param to all analysis, community, registry, refactor, and query tools so agents can request compact responses from every tool, not just the core review tools. All tools now accept `detail_level="minimal"` to cap output to the most actionable fields. Adds `get_review_bundle` — a single-round-trip tool that combines risk-scored change analysis, one-hop caller/callee subgraph, affected flow summaries, and a structured review checklist. Replaces the typical 2-4 tool call review workflow with a single response. Reformats `get_affected_flows` to return a narrative summary paragraph and compact bullet IDs in `detail_level="minimal"` mode. Raw step data is moved to a `detail` key agents can ignore. Adds `summarize_flow()` helper to `flows.py` for reuse across tools. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ection tools Use actual dict keys from analysis results: total_degree/in_degree/out_degree for hubs, betweenness for bridges, and include reasons for surprising connections. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 is this feature?
When an AI agent uses code-review-graph MCP tools, some tools returned large dumps of data even when the agent only needed a quick answer. This caused:
This feature fixes all three problems: it adds a compact output mode to every tool, introduces a single-call review tool, and makes flow output readable.
What changed
1.
detail_level="minimal"extended to all 29 toolsPreviously, only 7 tools (like
detect_changes,get_impact_radius) supporteddetail_level. Now every tool does.When an agent passes
detail_level="minimal", the tool strips verbose fields and returns only what's needed to make a decision. The agent can then call again withdetail_level="standard"only for the specific item it wants to drill into.Tools that gained
detail_levelsupport:minimalreturnsget_hub_nodes_toolname,kind,in_degree,out_degree,total_degreeget_bridge_nodes_toolname,kind,betweennessget_knowledge_gaps_toolget_surprising_connections_toolsource,target,surprise_score,reasonsget_suggested_questions_toolget_architecture_overview_toolget_community_toolname,size,cohesion,dominant_languagelist_graph_stats_tooltotal_nodes,total_edges,files_count,last_updatedfind_large_functions_toolname,kind,line_count,relative_pathrefactor_tool(dead_code/suggest modes)name/kindonlycross_repo_search_toolname,kind,repo,file_pathlist_repos_toolalias,pathget_affected_flows_tool2. New tool:
get_review_bundle_toolA single tool call that replaces the typical 3–4 call review workflow.
Before (old way):
After (new way):
What it returns in one response:
risk_score+risk— high / medium / lowchanged_functions— list of changed functions, with optional source snippetssubgraph— one-hop callers and callees for each changed symbol (capped atmax_nodes=20)affected_flows— compact summaries of impacted execution flowstest_gaps— changed functions that have no test coveragereview_checklist— structured[ ]action items generated from the analysisreview_priorities— top 5 items to review firstParameters:
3.
get_affected_flows_tool— readable summariesPreviously returned raw node dumps per flow. Now
detail_level="minimal"returns:flow_id,name,entry_point,criticality,depth,node_count,file_count,summarydetailkey if neededA new helper
summarize_flow()was added toflows.py— it is reused byget_review_bundleto generate the same compact format.