feat: add compound query tools (explore, understand, prepare_change)#149
Open
maplenk wants to merge 8 commits intoDeusData:mainfrom
Open
feat: add compound query tools (explore, understand, prepare_change)#149maplenk wants to merge 8 commits intoDeusData:mainfrom
maplenk wants to merge 8 commits intoDeusData:mainfrom
Conversation
Account for optional signatures in the search_graph and trace_call_path size estimators, and improve compact trace chains to report omitted-node counts. This also documents the normal-path output enrichment introduced with Task 4: search_graph results now include file_path, start_line, end_line, and signature, and trace_call_path hop items now include file_path, start_line, and signature.
Prefer non-test symbol matches before pagerank for ambiguous short names. Batch-load visited node metadata and pagerank scores to remove per-node query loops during impact analysis. Hide test counts from the public summary when include_tests=false, and add max_tokens truncation support to get_impact_analysis with MCP coverage.
Add the impact-analysis store API declaration, expose get_impact_analysis in CLI help text, and cover the tool with the existing integration fixture.
Phase 5: Three new compound MCP tools (explore, understand, prepare_change) that bundle multiple graph queries into single-call responses: - explore: area search with matches, dependencies, hotspots, entry points - understand: symbol deep-dive with 3-tier resolution (exact QN, exact name with auto-pick, QN suffix with suggestions), callers, callees, source, connected symbols, is_key_symbol flag - prepare_change: wraps impact analysis with review_scope (must_review, should_review, tests) and include_tests=false support - All three support max_tokens budget with progressive truncation - Wire qn_pattern in store search (completing pre-existing API contract) Bug fixes across all committed phases: - Fix REQUIRE_STORE leaking heap args in 5 handlers (get_key_symbols, get_impact_analysis, explore, understand, prepare_change) - Fix markdown_builder_reserve infinite loop on OOM (NULL check after safe_realloc) - Fix SQLite bind parameter limit in impact_fetch_nodes_with_scores (chunk into batches of 900) - Fix cbm_mcp_text_result(NULL) crash on OOM (guard with empty string) - Fix POSIX regex: remove invalid PCRE (?i) prefix from contains pattern - Fix search degree filter: set min_degree/max_degree to -1 (disabled) in compound search helpers - Fix summary_count_nodes returning -1 on SQL error (return 0 instead) - Fix explore total_results overcounting unfiltered hotspots - Fix qsort(NULL, 0) undefined behavior in explore - Fix handle_understand early return leaking search outputs (use goto) - Refactor handle_prepare_change to use goto cleanup pattern Output enrichment (non-breaking): - search_graph results now include start_line, end_line, signature - trace_call_path hops now include file_path, start_line, signature Tests: 2639 passed (+44 new), 0 failures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Thanks @maplenk — compound query tools that combine multiple graph operations into higher-level actions is a nice abstraction. Will review. |
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
Three new tools that bundle multiple graph queries into single-call responses, reducing agent round-trips from 4–5 tool calls to 1.
New tools
explore— Area exploration. Takes a keyword, runs 3 searches (name/QN/path), merges and dedupes, adds dependency summaries for top matches, hotspots from PageRank, entry points from architecture. Token-budgeted.understand— Symbol deep-dive. 3-tier resolution: exact QN → short name (auto-pick by PageRank) → suffix match (returns suggestions if ambiguous). Returns source code, 1-hop callers/callees sorted by PageRank, connected symbols with relation labels, key symbol status.prepare_change— Pre-change analysis. Wraps impact analysis withreview_scope:must_review(target + direct callers),should_review(indirect),tests. Token budget priority: root → direct → review scope → tests.Bug fixes included
12 fixes across all phases — highlights:
markdown_builder_reserveimpact_fetch_nodes_with_scores(?:...)→(...))REQUIRE_STOREearly-return paths)qsort(NULL, 0)undefined behaviorcbm_mcp_text_result(NULL)crash guardsummary_count_nodesreturning -1 on SQL errormin/max_degree = -1handlingexploretotal_results overcountingTests
15 new tests + 3 integration tests. Total: 2639 passing.
Part 3 of a 4-PR series. Depends on #148 → #147.
Built with OpenAI Codex and Claude Code.