-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add a get_relevant_context MCP tool that takes a task description + token budget and returns the optimal subgraph of files to read. Agents waste 60-70% of context on irrelevant files — our graph knows which files matter.
Motivation
- vexp proved 65-74% token reduction using AST-level subgraphs instead of grep
- codebase-memory-mcp reports 99.2% fewer tokens (3,400 vs 412,000) for structural queries
- Context engineering = "finding the smallest possible set of high-signal tokens" (Martin Fowler)
- Our graph already has PageRank — we can rank files by importance and serve the optimal subset within a token budget
Proposed API
tool: get_relevant_context
input: {
task: string, // "refactor auth module" or "fix login bug"
tokenBudget?: number, // max tokens to return (default: 8000)
scope?: string // module or directory to focus on
}
output: {
files: Array<{ path, relevanceScore, pageRank, summary }>,
totalTokens: number,
coverage: string // "covers 85% of related dependency graph"
}
Approach
- Use BM25 search to find task-relevant files
- Expand via dependency graph (dependents + dependencies)
- Rank by PageRank + relevance score
- Truncate to fit token budget (highest-value files first)
- Return file summaries (exports, imports, metrics) not full contents
Priority
Immediate — Token efficiency is the #1 competitive differentiator for AI agent tooling.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request