codebase-memory-mcp icon indicating copy to clipboard operation
codebase-memory-mcp copied to clipboard

Builtins dominate every degree ranking

Open avigdorsky opened this issue 2 months ago • 3 comments

Severity: medium.

Nodes under the synthetic <python-builtins> path take 12 of the top 20 by degree (str 4 721, len 4 338, append 3 407). Any hub, centrality or refactor-candidate view is meaningless by default.

Ask: flag such nodes (is_builtin) and exclude them from degree/centrality and layout by default, with an opt-in flag to include them.


Observed on v0.10.8 (build 996bad5fe6fb), macOS arm64, Python monorepo (~36k nodes / ~179k edges). Happy to provide a minimal reproduction repo if useful.

avigdorsky avatar Sep 09 '26 07:09 avigdorsky

Written with Claude Code (Claude Opus 5.5).

The same stubs show up at the other end of the degree range. On 0.11.0 (release binary, darwin-arm64), a repo with one Python file that defines helper, used (calls helper), unused and class Foo (its method calls used) gets 12 <python-builtins> nodes after a full index: len, print, str, int, list, dict, range, str.upper, str.lower, list.append, list.pop and dict.get. The code calls none of them.

A dead-code search, search_graph {"label": "Function", "max_degree": 0, "exclude_entry_points": true}, returns three rows: builtins.len, builtins.print and traps.app.unused. Only the last one is unreferenced code. Without the label filter, 12 of the 18 nodes it returns are builtins.

So an is_builtin flag, or excluding <python-builtins> by default, would need to cover the zero-degree side as well as the rankings.

nefayran avatar Oct 01 '26 10:10 nefayran

Thank you for the ranking example and the follow-up showing builtins in zero-degree results too. Both ends of the degree range matter for the proposed filtering contract. The default visibility and builtin flag still need a maintainer decision.

DeusData avatar Oct 19 '26 22:10 DeusData

Thank you for the high-degree and zero-degree builtin examples. Their default visibility and filtering contract still need a maintainer decision. Sorry for the delay; I’ll follow up soon.

DeusData avatar Oct 25 '26 17:10 DeusData