Scoping Internals
The shared context plan, graph centrality priors, and packing logic used by MCP review and offline fusion scoping.
Scoping selects which files belong in a context payload and at what render tier. The shared module Fuse.Scoping holds the public ContextPlan type, the centrality helpers, and the greedy token packer. MCP review and context (SemanticRetrievalEngine) and offline fusion focus scoping (ContextPlanBuilder in Fuse.Fusion) both build the same Fuse.Retrieval.ContextPlan record defined in that assembly.
This page is for maintainers working on scoping behavior and for engineers who need to know why a query includes or omits a given file.
Shared context plan
A ContextPlan is an ordered list of ContextPlanItem entries. Each item carries:
Path: normalized relative pathRole: for exampleexact-seed,changed,di-implementation,dependencyTier:RenderTiervalue (FullSource,Reduced,Skeleton,PublicApi,Sketch, orOmitted)Score: relevance from seeds or expansionEstimatedTokens: pre-render token estimate used by budget packingMustKeep: seeds and changed files are never droppedProvenanceChain: the edge chain that admitted the file
MCP review seeds from git-changed files and expands through the semantic graph. Fusion focus scoping seeds from a symbol or path and expands through the regex dependency graph. Both write the same plan shape; fusion maps roles back to PlannedFileInfo labels (Seed, Dependency, Changed) only on the emission result projection.
Centrality (one implementation)
Fuse.Scoping.GraphCentrality is the single centrality module:
- PageRank (
NormalizedPageRank): file-level dependency graphs during offline fusion focus expansion.DependencyGraphCentralityinFuse.Fusionbuilds out-edges fromDependencyGraphand calls this helper. - Normalized degree (
NormalizedDegree): semantic node graphs during MCP localization ranking.GraphCentralityPriorinFuse.Retrievalreads edges fromIWorkspaceIndexStoreand applies the cappedApplyRetrievalPriormultiplier (at most plus ten percent). - Rank blending (
BlendRankScore): additive prior during fusion graph expansion (FocusSeedResolver).
The duplicate PageRank implementation formerly in Fuse.Fusion.Scoping.GraphCentrality and the inline degree math in GraphCentralityPrior are removed.
Token packing
ContextPlanPacker.Pack greedily orders items by must-keep, score, and path, then drops optional files past a token budget. MCP context and review use it after graph expansion; fusion emission applies tiered reduction from the plan without re-inferring roles from provenance length.
What this does not cover
This page documents the shared scoping module. Command syntax lives in Scoping. Retrieval candidate generation and graph expansion details remain in the retrieval pipeline pages.
Next
See Scoping for task-oriented use of localize, resolve, and review.