You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(codebase_analyze): default to no file cap, treat max_files<=0 as unbounded (#25)
The previous default of max_files=500 — and the cortex-setup-project skill's
explicit max_files=5000 — silently truncated real codebases at exactly the
cap. Two of the user's repos (~ai-architect-prd-builder, ai-prd) hit 5000
exactly during a full-scale bootstrap, meaning files were dropped from the
knowledge graph.
Change the contract so max_files<=0 means "no limit". Split the helper
into _collect_bounded (preserves ADR-0045 §R2 streaming for callers who
opt into a cap) and _collect_unbounded (walks the whole tree but only
materialises post-filter survivors — memory is O(filtered_files), not
O(tree_size)). Default now 0 across handler, schema, and tool registry.
Add 4 regression tests: 7500-file unbounded walk, negative-as-unbounded,
language/IGNORE_DIRS filtering still applied in unbounded mode, plus the
existing 7 bounded-mode tests unchanged.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: mcp_server/handlers/codebase_analyze.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -93,11 +93,10 @@
93
93
},
94
94
"max_files": {
95
95
"type": "integer",
96
-
"description": "Maximum number of files to process per call. Cap to avoid runaway analysis on monorepos.",
97
-
"default": 500,
98
-
"minimum": 1,
99
-
"maximum": 50000,
100
-
"examples": [100, 500, 5000],
96
+
"description": "Maximum number of files to process per call. Set to 0 (default) for no limit — process every matching file. Use a positive cap only to bound runaway analysis on extremely large monorepos.",
97
+
"default": 0,
98
+
"minimum": 0,
99
+
"examples": [0, 500, 5000],
101
100
},
102
101
"max_file_size_kb": {
103
102
"type": "integer",
@@ -129,7 +128,8 @@
129
128
CODEBASE_SOURCE="codebase_analyze"
130
129
CODEBASE_TAG="codebase"
131
130
LANG_TAG_PREFIX="lang:"
132
-
DEFAULT_MAX_FILES=500
131
+
# 0 = no limit. Positive values cap the walk; see helpers.collect_source_files.
0 commit comments