Skip to content

feat(mcp): graph-backed sections in get_context with structured handoff and VOR filter - #30

Merged
ManSio merged 3 commits into
mainfrom
fix/get-context-v2
Sep 9, 2026
Merged

ManSio merged 3 commits into
mainfrom
fix/get-context-v2

Conversation

@ManSio

@ManSio ManSio commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

get_context v2 — the tool now assembles deterministic, graph-backed context sections (no LLM), following the Anthropic "code execution with MCP" / "writing effective tools for agents" guidance (tool consolidation, meaningful context, token efficiency).

New sections (all degrade gracefully to absent when data is unavailable)

  • dataflow — ASSIGNED_FROM/TO chains with condition_path for local variables of the target file (candidate variables derived deterministically from local assignments in the source window; verified against the live graph: chain entries carry condition_path).
  • writes — WRITES edges of the target symbol from PropertyGraph.
  • receipts — recent ActionReceipts filtered by the target file.
  • tests — affected tests derived from impact-analysis affected_files.

Structural improvements

  • Structured handoff: _section_symbols now carries meta (file_path/line/symbol/affected_files) consumed by source/git and the new sections; regex text-parsing demoted to a fallback path (root cause of fragility identified in review).
  • VOR filter in memory section: only VERIFIED/ACTIVE (or status-less) nodes are shown — REFUTED/INCONCLUSIVE/STALE are no longer surfaced (protocol §9.5 verify-on-read).
  • Lazy SymbolIndexAdapter init; new sections wired into intent profiles (modify/debug/prepare_change/verify_change/test) with budgets/priorities; TOKEN_LIMIT kept at 2000.

Evidence

  • 12 new tests (tests/test_context_sections.py): 14 passed together with existing context_tool tests.
  • Full suite on this branch: 1659 passed / 9 skipped / 91 deselected, exit 0 (skips are env-conditional, zero failures).
  • ruff clean; all 9 pre-commit checks passed (verify_diary, stale_detector, negative_controls, architecture_linter, ruff_gate, ...).
  • Verified live-graph probes: variable flow chain entries expose condition_path; receipts ledger empty → section omitted.

Notes / follow-ups

  • WRITES edges proved empty at method level on the current graph build — section degrades to omitted; revisit when more WRITES edges are indexed.
  • Follow-up epic (separate PR): progressive disclosure tool-catalog search (detail=name|desc|full), narrow default toolset, tool-health consolidation report, E-11 "Bundle vs Relay" eval.
  • Research basis: anthropic.com/engineering/code-execution-with-mcp, anthropic.com/engineering/writing-tools-for-agents, arxiv.org/abs/2605.24660 (tool-count accuracy impact).

…ff and vor filter

New deterministic sections assembled from the PropertyGraph (no LLM): dataflow (ASSIGNED_FROM/TO chains with condition_path for local variables), writes (WRITES edges), receipts (ActionReceipts filtered by target file), tests (affected tests from impact affected_files). Wired into intent profiles: modify/debug/prepare_change/verify_change/test; budgets and priorities extended.

Structured handoff: _section_symbols now carries meta (file_path/line/symbol/affected_files) consumed by source/git and the new sections; regex text-parsing demoted to fallback. Memory section applies VOR filtering: only VERIFIED/ACTIVE (or status-less) nodes are shown. Lazy SymbolIndexAdapter init; every new section degrades to None when the graph is unavailable.

12 new tests (test_context_sections.py): 14 passed with existing context_tool tests; full suite 1659 passed / 9 skipped / 91 deselected; ruff clean.

Refs: agent-research on Anthropic code-execution-with-mcp + writing-tools-for-agents (tool consolidation, meaningful context, token efficiency).
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8ed94cfc-be55-4d4d-9877-208df596ffdf


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

MSCodeBase Agent added 2 commits September 8, 2026 16:48
The test job started exceeding the 10-minute job timeout once get_context v2 (+433 lines, 12 tests) and the collect() work landed: locally the suite takes ~15.6 min with coverage. Observed: job 102074901674/102093822441 timed out at 10 min mid-suite (last file test_hybrid_cache.py, all tests green up to that point). clean-state (same suite, filtered) stays green.
@ManSio
ManSio merged commit ed0f880 into main Sep 9, 2026
13 checks passed
@ManSio
ManSio deleted the fix/get-context-v2 branch September 9, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant