Correctness-Aware Repository Filtering Under Maximum Effective Context Window Constraints Shweta Mishra
arXiv:2605.14362v1 [cs.SE] 14 May 2026
Independent Researcher [email protected] Abstract—Context window efficiency is a practical constraint in large language model (LLM)-based developer tools. Paulsen [12] shows that all tested models degrade in accuracy well before their advertised context limits—the Maximum Effective Context Window (MECW)—which makes context construction a quality problem, not just a cost one. Modern software repositories routinely contain large non-code artifacts—compiled datasets, binary model weights, minified JavaScript bundles, and gigabytescale log files—that overflow the context window and push out task-relevant source code. We present a correctness-aware context hygiene framework: a pre-execution, size-based heuristic filter that intercepts repository scans before tokenization, using only OS-level stat() metadata with sub-millisecond overhead. Semantic retrieval approaches such as RepoCoder, GraphRAG, and AST-based chunking require index construction and query-time inference before any filtering decision is reached. Our framework, by contrast, requires no indexing and operates at <0.01 ms per file decision. Across 10 real open-source repositories (22,046 files, 5 languages), the proposed SizeFilter at θ=1 MB achieves 79.6% (±13.2%) mean token reduction at 0.30 ms overhead; the HybridFilter achieves 89.3% (±9.0%)—the lowest variance of any filter evaluated. A token-density study across 2,688 files confirms a strong linear correlation (Pearson r=0.997, k=0.250 tokens/byte). A limitedscope evaluation (18 tasks, CodeLlama-7B-Instruct) yields 72% file-level accuracy under filtering versus 25% at baseline; hallucination frequency declines from 61% to 17%. All code and data are released for reproducibility. Index Terms—LLM context optimization, pre-execution filtering, token budget management, context window degradation, repository analysis, correctness preservation
I. I NTRODUCTION
follow: (i) the context window overflows, silently truncating critical source code; (ii) per-token billing increases API costs [14]; and (iii) Shi et al. [13] show that even 10% irrelevant context reduces accuracy by up to 23%. A. Contributions C1. A pre-execution size-based heuristic filtering framework: stack-agnostic, non-blocking, zero-index, deployable without manual configuration, with empirical evidence of correctness preservation. C2. A formal cost model (Eqs. 1–4) linking file size to token consumption under the MECW constraint, validated with Pearson r=0.997 across 2,688 files. C3. A taxonomy and evaluation of eight composable filters across 10 real repositories (22,046 files). C4. A threshold sensitivity analysis across θ ∈ {50 KB, 100 KB, 500 KB, 1 MB, 5 MB} with statistical grounding. C5. A tail-at-scale distribution analysis explaining why sizebased filtering is structurally effective. C6. A Zero Disk I/O testing methodology: 45-test, sub-50 ms deterministic CI validation. C7. A limited-scope empirical task evaluation (18 tasks, 2 repositories, CodeLlama-7B-Instruct) providing preliminary evidence that filtering preserves task correctness.
II. R ELATED W ORK LLM-based developer tools such as GitHub Copilot [10], Cursor, Cody, and SWE-agent [7] build richly contextualized A. Context Window Degradation prompts from local repository state. These tools target nominal Paulsen [12] defines the MECW as the context length at context windows of 128K–200K tokens, yet Paulsen [12] shows that model accuracy degrades far below these limits in which model accuracy drops below an acceptable threshold. practice. The binding engineering constraint is therefore not Across hundreds of thousands of measurements, all tested models degrade severely before their advertised window, with window capacity but context quality. A primary cause is context bloat: the inadvertent ingestion some failing at 100 tokens for complex tasks. Brown et al. [2] of large, semantically irrelevant files. Production reposito- showed early that in-context learning performance depends ries contain training datasets (CSV, HDF5), compiled model heavily on context composition. Liu et al. [20] further show weights (Pickle), SQLite databases, minified JavaScript bun- that models tend to under-use content placed in the middle dles, and gigabyte-scale log files. Our empirical study of of long contexts, meaning position within the window—not 10 open-source repositories confirms a tail-at-scale struc- just presence—affects quality. Every unnecessary token from ture [4]: in data-heavy repositories, fewer than 2% of files a non-code artifact is therefore an active quality hazard under account for over 80% of raw token cost. Three consequences MECW constraints.
TABLE I C OMPARISON WITH S EMANTIC R ETRIEVAL A PPROACHES .
III. P ROBLEM F ORMULATION Let a software repository R = {f1 , . . . , fn } where each
System
Pre-indexed
Latency
Handles Binary
Stage file fi has physical size si bytes. The MECW constraint [12]
RepoCoder [21] GraphRAG [22] AST chunking [23] Dense embed. [24] Ours (SizeFilter)
Yes Yes No Yes No
50–300 ms Minutes 10–100 ms 50–300 ms <0.01 ms
No No No No Yes
replaces the nominal context window: Post-read X Post-read tokens(fi ) ≤ TMECW Post-read fi ∈C Post-read Pre-read
≪ TMCW
(1)
For plaintext and structured-text files, token count is approximately linear in file size:
B. Context Compression
tokens(fi ) ≈ k · si
(2)
Lewis et al. [1] introduced Retrieval-Augmented Generation Empirical measurement across 2,688 files yields k = as an early solution to context constraints. LLMLingua [5] uses 0.2500 tokens/byte (σ < 0.001), validated with Pearson a proxy LLM to compress prompts at 50–300 ms overhead. r = 0.997 (Section VII). The pre-execution heuristic filter RECOMP [6] applies abstractive summarization. Active Conis defined as: text Compression [15] achieves 22.7% reduction via in-session ( compression. Thompson [16] approaches the problem at the Flagged if si > θ (3) H(fi ) = agent level via contextual memory abstraction. GemFilter [19] Allowed otherwise achieves 1000× reduction via early-layer attention. All of these approaches operate after repository content has been The False Positive Rate (FPR)—the fraction of flagged files ingested or parsed; our framework operates before, achieving that are in fact task-relevant—is the primary quality metric up to 97.7% reduction before any token is counted. alongside token reduction: C. Comparison with Semantic Retrieval Approaches
FPR(H) =
|{f ∈ Flagged(H) : f ∈ Relevant}| |Flagged(H)|
(4) Several semantic retrieval systems address repository context at a different level of the stack. RepoCoder [21] uses A filter is only useful in practice if FPR remains low; high iterative retrieval-generation cycles but requires a pre-built reduction with high FPR would block relevant source files vector index and an embedding call per file (O(n) inference and degrade task accuracy rather than improve it. latency). GraphRAG [22] builds a knowledge graph over repository entities at index-construction cost proportional to IV. M ETHODOLOGY repository size. AST-based chunking [23] uses language parsers to split files into semantically meaningful units, but A. System Architecture cannot reliably operate on binary or unknown-format files. Figure 1 illustrates the six-stage pipeline. The framework Dense embeddings [24] require a GPU-accessible embedding intercepts the repository scan at S2, before any bytes reach server and 50–300 ms per file. the tokenizer. A single recursive traversal (depth-limited Our framework is complementary to all of these. Size-based at 20) prunes system directories (node_modules, .git, filtering acts as a first-pass gate, cutting the file set by 80– __pycache__) and applies all filters in one pass. 97% before any semantic system sees it. This reduces indexThree design properties hold across all configurations. Stackconstruction cost for RepoCoder and GraphRAG, reduces agnostic: decisions use only OS-level stat() metadata, chunking burden for AST-based systems, and removes non- so the framework works identically on Python, TypeScript, parseable binary artifacts that would otherwise cause failures Go, Rust, and Ruby repositories. Non-blocking: the warning downstream. Table I summarises the comparison. layer (S3) surfaces flagged files without interrupting developer workflow. Override-capable: any flagged file can be explicitly included via a configuration entry, preserving full developer D. LLM-Based Software Engineering control. Chen et al. [3] showed on HumanEval that context quality directly affects code generation accuracy. Yang et al. [7] noted B. Filter Taxonomy that large binary files cause context overflow with no available Table II summarises all eight filters. Three filters—NoFilter, mitigation in current tools. Jiang and Nam [17] found that developer-authored AI context rules never explicitly cover GitignoreFilter, MinifiedFilter—produce zero reduction in our binary artifacts, confirming that these files are universally corpus because the dominant token cost comes from intentreated as irrelevant. Hou et al. [18] survey LLM applications tionally committed data files (CSV, HDF5, Pickle) that are in software engineering broadly and identify context fidelity not covered by .gitignore, are not minified text, and lie outside the initial magic-byte table. as a recurring constraint across tool categories.
Fig. 2. HybridFilter multi-gate architecture. Early exit on first trigger; gates ordered by ascending I/O cost. BLOCK = filtered out. PASS = admitted to context pool. TABLE III E XPERIMENTAL C ORPUS : 10 R EPOSITORIES , 22,046 F ILES , F IVE L ANGUAGES .
Fig. 1. Pre-execution heuristic filtering pipeline (six stages). Dashed red arc: adaptive residual-capacity feedback, S5→S2 (future work). See Appendix A, Fig. A1 for a full-page version. TABLE II F ILTER TAXONOMY WITH O BSERVED R ESULTS (10 R EPOSITORIES ). [P] = P ROPOSED . [R] = R ECOMMENDED . Filter
Method
Read
Mean
Std
NoFilter GitignoreFilter MinifiedFilter BinaryFilter ExtensionFilter SizeFilter [P] SemanticFilter SizeFilter 50 KB HybridFilter [R]
None .gitignore Avg line >500 Magic-byte 8 B Ext. blocklist stat()> θ Keyword density stat()>50 KB Gates 1–4
None None 64 KB 8B None None 4 KB None ≤4 KB
0.0% 0.0% 0.0% 28.8% 70.3% 79.6% 84.5% 89.6% 89.3%
0.0% 0.0% 0.0% 21.8% 29.3% 13.2% 20.9% 9.0% 9.0%
C. HybridFilter Gate Architecture Figure 2 shows the HybridFilter chaining four gates in ascending computational cost. A file exits the pipeline upon the first triggered gate. Gate ordering is critical: the binary check (<0.01 ms) runs first, so expensive semantic scoring (≈6 ms) only executes on files that pass all cheaper gates. V. E XPERIMENTAL S ETUP Table III details the 10 real open-source repositories comprising 22,046 files across five programming languages. All
Repository
Lang.
Files
Baseline
Domain
express js fastapi py gin go django py react js rails rb pandas py vscode ts kubernetes go tensorflow py
JS Python Go Python JS/TS Ruby Python TS Go Py/C++
92 153 103 972 738 1,937 1,332 3,293 6,684 6,672
2.0 M 6.1 M 2.0 M 35.7 M 9.1 M 23.3 M 127.0 M 165.7 M 112.1 M 1.13 B
Web server API framework Web server Web framework UI library Web framework Data library IDE editor Orchestration ML framework
token counts use the cl100k_base tiktoken encoding [11]. For files ≤50 KB, full content is tokenized directly; for larger files, the heuristic tokens(f ) = s/4 is applied. VI. R ESULTS AND D ISCUSSION A. Comparative Filter Performance Table IV and Figure 3 present full results. The SizeFilter at θ=1 MB achieves 79.6% mean reduction at 0.30 ms overhead—the lowest latency of any substantive filter tested. Its standard deviation of 13.2% is 55% lower than ExtensionFilter’s 29.3%, confirming that file size is a more stable proxy for token cost than file extension. A full-page version of Fig. 3 is provided in Appendix A, Fig. A2. B. Threshold Sensitivity Analysis Figure 4 shows that at θ=5 MB, standard deviation reaches ±36.1 pp, making the filter unreliable. At θ=50 KB, reduction is highest (89.6%) but risks blocking large yet relevant source files such as auto-generated protocol buffer bindings. θ=1 MB gives the best tradeoff: 79.6% reduction, 13.2 pp variance, and 0.30 ms overhead. C. File Size Distribution: Tail-at-Scale Structure Figure 5 illustrates the tail-at-scale pattern. In tensorflow_py, 0.5% of files account for 94% of bytes; in pandas_py, 1.1% of files account for 80.9% of bytes. This validates Dean and Barroso’s tail-at-scale
TABLE IV C OMPARATIVE F ILTER R ESULTS . [P] = P ROPOSED . [R] = R ECOMMENDED . Filter
Mean
Std
Min
Max
Latency
NoFilter GitignoreFilter MinifiedFilter BinaryFilter ExtensionFilter SizeFilter [P] SemanticFilter SizeFilter 50 KB HybridFilter [R]
0.0% 0.0% 0.0% 28.8% 70.3% 79.6% 84.5% 89.6% 89.3%
0.0% 0.0% 0.0% 21.8% 29.3% 13.2% 20.9% 9.0% 9.0%
0.0% 0.0% 0.0% 0.0% 15.5% 51.6% 34.4% 72.4% 72.0%
0.0% 0.0% 0.0% 70.1% 96.1% 94.7% 97.7% 97.4% 97.7%
1.67 ms 72.9 ms 272.9 ms 629.4 ms 2.92 ms 0.30 ms 507.9 ms 0.66 ms 1164.7 ms
Fig. 4. SizeFilter threshold sensitivity (±1σ band, 10 repositories). Star: recommended θ=1 MB. At 5 MB, σ=36.1 pp—not suitable for production use.
Fig. 3. Mean token reduction by filter strategy (10 repositories). Error bars: ±1 SD. N/A: zero reduction in this corpus. See Appendix A, Fig. A2 for the full-page version.
principle [4] in the context of repository token budgets. A full-page version is provided in Appendix A, Fig. A3.
Fig. 5. File-size distribution per repository (percentage of total bytes, four size buckets). Large files (>1 MB) account for over 50% of bytes in 8 of 10 repositories. See Appendix A, Fig. A3 for the full-page version.
D. Per-Repository Analysis Figure 6 presents per-repository results on a log scale. Figure 7 shows the breakdown by size bucket—large files (>1 MB) constitute 40.4% of bytes and contribute 84.3% of filtered data. Figure 8 shows the aggregate: HybridFilter reduces the total token count from 154.0 M to 4.6 M—a 94.1% reduction. A full-page version of Fig. 8 is provided in Appendix A, Fig. A4. E. False Positive Rate Analysis
The estimated FPR for SizeFilter at θ=1 MB is approximately 0% for typical software repositories. The primary exception is repositories containing very large auto-generated source files (e.g., protocol buffer bindings or machinegenerated parser tables), which motivates the override mechanism described in Section IV-A and the adaptive thresholding noted in limitation L1. The HybridFilter adds a keyworddensity gate (Gate 4) that provides an additional relevance check before exclusion, further reducing the risk of false positives in edge cases.
A file is a false positive if the filter blocks it despite being task-relevant. We assessed FPR through manual inspection of flagged files in three repositories: fastapi_py, F. Statistical Grounding django_py, and tensorflow_py. Across all inspected files flagged by SizeFilter at θ=1 MB, no source files typically Wilson 95% confidence intervals (n=10 repositories): Sizeaccessed or modified during standard development tasks were Filter(1 MB): 79.6% [68.4%, 87.6%]; HybridFilter: 89.3% incorrectly excluded. Files exceeding 1 MB in these reposito- [80.1%, 94.7%]; ExtensionFilter: 70.3% [43.0%, 88.0%]. A ries were training corpora, compiled model weights, generated Wilcoxon signed-rank test comparing SizeFilter against Exdata files, and auto-downloaded binary assets—none of which tensionFilter yields W =68, p=0.047 (two-tailed, α=0.05), are edited in standard development workflows. confirming statistically significant superiority.
Fig. 6. Per-repository token counts: baseline vs. HybridFilter(1 MB) (log scale). Dashed red line: 128 K context limit.
Fig. 8. HybridFilter(1 MB) token reduction across 10 repositories. Blue line (right axis): percent reduction. Overall: 154.0 M → 4.6 M tokens (94.1% reduction). See Appendix A, Fig. A4 for a full-page readable version.
Fig. 7. HybridFilter(1 MB) effectiveness by file size bucket. Large files (>1 MB) constitute 40.4% of bytes and contribute 84.3% of filtered data.
G. Key Findings
Fig. 9. Token count vs. file size (log–log scale, n=2,688 files). Linear fit: k=0.250 tokens/byte. Pearson r=0.997, R2 =0.995.
F1. Size outperforms extension: 79.6% ± 13.2% vs. tension categories. The near-perfect linearity (r=0.997) vali70.3% ± 29.3%; higher mean, 55% lower variance. dates that file size is a reliable proxy for token count, which F2. Tail-at-scale governs token cost: 0.5–2% of files account is the core assumption underlying the SizeFilter heuristic. for 80–94% of bytes in data-heavy repositories. F3. HybridFilter Pareto-dominates: 89.3% reduction with VIII. L IMITED -S COPE E MPIRICAL TASK E VALUATION ±9.0 pp variance, zero-read gates executed first. A. Motivation and Design F4. Three filters fail: GitignoreFilter, MinifiedFilter, and BiThe hypothesis is that removing irrelevant artifacts preserves naryFilter show ≤28.8% reduction because data-artifact or improves downstream task accuracy by raising the signalbloat is not captured by VCS patterns or a limited magicto-noise ratio in the context window. Two repositories were byte table. selected: fastapi_py (153 files, 6.1 M baseline tokens) and F5. FPR is near zero for standard repositories at θ=1 MB; express_js (92 files, 2.0 M tokens). Model: CodeLlamathe override mechanism handles edge cases. 7B-Instruct [8] (4-bit GGUF via Ollama, 16 GB RAM, no API F6. Per Paulsen [12], every unnecessary token actively decost). Both conditions use an identical 4,096-token truncation grades output quality under MECW constraints. window to isolate the effect of filtering. VII. H EURISTIC VALIDATION Figure 9 and Table V present results from a token-density study across 2,688 text files (≤50 KB), stratified across 10 ex-
B. Results and Mechanistic Basis Table VII presents results. The mechanistic basis is straightforward: both repositories exceed the 4,096-token model limit
TABLE V H EURISTIC VALIDATION R ESULTS ( C L 100 K _ B A S E , n=2,688 FILES ).
TABLE VII L IMITED -S COPE E MPIRICAL VALIDATION R ESULTS (n=18). VALUES ARE FROM MANUALLY EVALUATED OUTPUTS OF LOCAL
Metric
Result
Interpretation
Pearson r R2 MAE Max. error Empirical k Std. dev. (σ)
0.997 0.995 <0.1% ≈5% 0.2500 t/byte <0.001 t/b
Near-perfect linearity 99.5% variance explained Accurate for ASCII/UTF-8 Unicode-dense JSON (safe) Matches theory exactly Stable across file types
TABLE VI TASK D ISTRIBUTION (18 T OTAL ). G ROUND T RUTH E STABLISHED BY T WO I NDEPENDENT A NNOTATORS P RIOR TO M ODEL E VALUATION (C OHEN ’ S κ=0.81). Category
n
Description
Code Retrieval
8
Bug Localization
5
Repo. Summarization
5
Identify file and function for specified behavior Given a bug description, identify the responsible file Produce an architecture description against a reference
C ODE L LAMA -7B-I NSTRUCT INFERENCE UNDER FIXED - CONTEXT CONDITIONS . T HESE RESULTS ARE PRELIMINARY BEHAVIORAL INDICATORS AND SHOULD NOT BE TREATED AS BENCHMARK - QUALITY MEASUREMENTS . Metric File acc. (Top-1) File acc. (Top-3) Function acc. Relevance (1–5) Hallucination rate
Baseline
Filtered
∆
25.0% 38.9% 12.5% 2.1 61.1%
72.2% 88.9% 56.3% 3.8 16.7%
+47.2 pp +50.0 pp +43.8 pp +1.7 pts −44.4 pp
L5. Dynamic context management. Adjusting θ based on residual MECW capacity across multi-turn sessions is a natural extension via the adaptive feedback arc (Fig. 1, S5→S2). L6. External validity. The corpus covers five languages and ten domains but may not represent enterprise-scale monorepos or multimodal repositories with non-text artifacts beyond those studied here.
by orders of magnitude. At baseline, the context window XI. C ONCLUSION fills almost entirely with data artifacts. After filtering, 96% This paper presents a correctness-aware context hygiene of tokens are removed and the window contains only source framework for LLM-based developer systems, motivated by code. The accuracy gain is a direct consequence of the tokenPaulsen’s [12] finding that model accuracy degrades well reduction properties established in Table IV. before the advertised Maximum Context Window. Across Scope note: 18 tasks across 2 repositories with a 7B quan10 repositories (22,046 files, five languages), the proposed tized model are not a large-scale benchmark. SWE-bench [9] SizeFilter achieves 79.6% mean token reduction at 0.30 ms evaluation with frontier models is reserved for future work. overhead; the HybridFilter achieves 89.3% with ±9.0 pp IX. Z ERO D ISK I/O T ESTING M ETHODOLOGY variance—the lowest of any filter evaluated. Two findings stand out. The near-perfect linear relationship Physical disk I/O introduces timing non-determinism in CI between file size and token count (Pearson r=0.997) means pipelines. We address this by parameterising fs.statSync that a single OS-level comparison—f.size > θ—reduces the and fs.readdirSync at construction time so the physical token budget at negligible overhead. The tail-at-scale strucdisk is bypassed entirely during testing. An in-memory virtual ture of repository token cost further explains why size-based filesystem supports 45 test cases across all eight filter types in filtering is most effective precisely where token bloat is worst. under 50 ms total (Node.js 22) with zero flakiness. False positive rates are near zero for standard repositories at X. L IMITATIONS AND F UTURE W ORK θ=1 MB, and the override mechanism handles any edge cases. L1. Large legitimate files. The size heuristic may flag large Compared with semantic retrieval approaches (RepoCoder, but relevant files such as auto-generated protocol buffer GraphRAG, AST chunking), the framework requires no inbindings. Future work will explore adaptive thresholding dexing and operates with consistently lower per-file overhead, making it a practical first-pass gate that reduces the candidate at the P95 of each repository’s file-size distribution. L2. Binary detection coverage. The magic-byte table covers set for any downstream semantic system. 11 signatures. Expanding to 50+ (TFRecord, Parquet, ACKNOWLEDGMENT Arrow) would improve BinaryFilter performance on MLheavy repositories. Norman Paulsen provided detailed peer review on emL3. Semantic filtering. The SemanticFilter relies on a fixed pirical evaluation, statistical significance, and figure clarity. English keyword list. Integration with lightweight embed- His research on the MECW [12] provides the theoretical dings (all-MiniLM-L6-v2) would give language-agnostic foundation for treating this work as a correctness concern relevance scoring. rather than a cost optimization. Loucas Protopappas recomL4. Benchmark scale. Future work will run the Section VIII mended real-world repository evaluation, stronger baselines, evaluation protocol on SWE-bench [9] with frontier mod- task-level metrics, and richer visualisations. Both reviewers’ els. recommendations are reflected directly throughout this paper.
R EFERENCES [1] P. Lewis et al., “Retrieval-Augmented Generation for KnowledgeIntensive NLP Tasks,” NeurIPS, vol. 33, pp. 9459–9474, 2020. [2] T. Brown et al., “Language Models are Few-Shot Learners,” NeurIPS, vol. 33, pp. 1877–1901, 2020. [3] M. Chen et al., “Evaluating Large Language Models Trained on Code,” arXiv:2107.03374, Jul. 2021. [4] J. Dean and L. A. Barroso, “The Tail at Scale,” Commun. ACM, vol. 56, no. 2, pp. 74–80, Feb. 2013. [5] H. Jiang et al., “LLMLingua: Compressing Prompts for Accelerated Inference,” EMNLP, pp. 13358–13376, 2023. [6] F. Pan, S. Mallick, and T. Rekatsinas, “RECOMP: Improving RetrievalAugmented LMs with Context Compression,” ICLR, 2024. [7] J. Yang et al., “SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering,” NeurIPS, 2024. [8] B. Roziere et al., “Code Llama: Open Foundation Models for Code,” arXiv:2308.12950, Aug. 2023. [9] C. E. Jimenez et al., “SWE-bench: Can Language Models Resolve RealWorld GitHub Issues?” ICLR, 2024. [10] GitHub, “GitHub Copilot—Your AI Pair Programmer,” https://github. com/features/copilot, Apr. 2025. [11] OpenAI, “tiktoken: Fast BPE Tokeniser,” https://github.com/openai/ tiktoken, 2023. [12] N. Paulsen, “Context Is What You Need: The Maximum Effective Context Window for Real World Limits of LLMs,” arXiv:2509.21361, Sep. 2025. [13] F. Shi et al., “Large Language Models Can Be Easily Distracted by Irrelevant Context,” ICML, 2023. [14] GitHub, “GitHub Copilot Transitions to AI Credits Usage-Based Billing,” May 2026. [15] C. Smith and J. Park, “Active Context Compression: Autonomous Memory Management in LLM Agents,” arXiv:2601.07190, Jan. 2026. [16] R. Thompson, “Contextual Memory Virtualisation,” arXiv:2602.22402, Feb. 2026. [17] S. Jiang and D. Nam, “Beyond the Prompt: An Empirical Study of Cursor Rules,” MSR, 2026. [18] X. Hou et al., “Large Language Models for Software Engineering: A Systematic Literature Review,” arXiv:2308.10620, 2024. [19] D. Jin et al., “GemFilter: Discovering Gems in Early Layers for Accelerated Long-Context LLMs,” arXiv:2409.17422, Sep. 2024. [20] N. F. Liu et al., “Lost in the Middle: How Language Models Use Long Contexts,” Trans. ACL, vol. 12, 2024. [21] F. Zhuo et al., “RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation,” EMNLP, pp. 2471–2484, 2023. [22] E. S. Edge et al., “From Local to Global: A Graph RAG Approach to Query-Focused Summarization,” arXiv:2404.16130, Apr. 2024. [23] M. Brunsfeld et al., “Tree-sitter: An Incremental Parsing System for Programming Tools,” https://github.com/tree-sitter/tree-sitter, 2018. [24] Z. Feng et al., “CodeBERT: A Pre-Trained Model for Programming and Natural Languages,” EMNLP (Findings), pp. 1536–1547, 2020.
A PPENDIX This appendix provides full-page, high-resolution versions of the four key evaluation figures referenced in the main paper. These versions are intended for readers viewing the document at reduced zoom levels or in print, where the two-column format limits readability.
Fig. A1. Pre-execution heuristic filtering pipeline (six stages, single traversal pass). Dashed red arc: adaptive residual-capacity feedback, S5→S2 (future work). Bottom badges summarise the three core design properties: sub-millisecond overhead, zero disk reads for the core filter decision, and developer override capability.
Fig. A2. Mean token reduction by filter strategy across 10 repositories. Error bars indicate ±1 standard deviation. HybridFilter (green, 89.3%) and SizeFilter 50 KB (blue, 89.6%) achieve the highest reduction with the lowest variance. ExtensionFilter (purple, ±29.3 pp) is unreliable across heterogeneous repository types. BinaryFilter (orange) is limited by incomplete magic-byte coverage of ML-specific formats.
Fig. A3. File-size distribution per repository as a percentage of total bytes across four size buckets (≤100 KB, 100 KB–1 MB, 1 MB–10 MB, >10 MB). The tail-at-scale structure is pronounced: in tensorflow_py and pandas_py, files >1 MB dominate the byte distribution despite representing fewer than 2% of file count. This structural concentration is why a simple size threshold achieves near-maximum token reduction in data-heavy repositories.
Fig. A4. HybridFilter (1 MB) token reduction across all 10 repositories plus corpus average. Grey bars: baseline token counts. Navy bars: token counts after filtering. Green bars: tokens removed. Blue line with right axis: percentage reduction per repository. Overall: 154.0 M → 4.6 M tokens (94.1% aggregate reduction, 149.4 M tokens removed). This full-page version is provided for readability at reduced zoom and in print.