Putting It All into Context: Simplifying Agents with LCLMs

Mingjian Jiang, Yangjun Ruan, Luis A. Lastras, Pavan Kapanipathi, Tatsunori Hashimoto · Submission to ICLR 2026 · Rejected

TL;DR

Current software engineering agents rely on complex, fragile scaffoldings—specialized tools, multi-step search loops, and bespoke execution pipelines—under the assumption that code repositories must be explored interactively. This paper demonstrates that simply packing the entire codebase into the prompt of a long-context language model (LCLM) matches or outperforms heavily engineered agent frameworks on SWE-bench Verified, achieving up to 50.8% pass@1 with zero scaffolding.

What Problem Does This Paper Address?

Autonomous coding agents (such as SWE-Agent, Agentless, and CodeAct) are typically designed for partially observable environments. They rely on iterative exploration loops: running shell commands, executing searches, and reading files incrementally. However, these multi-step pipelines introduce compounding errors and are notoriously brittle—scaffolding tuned for one foundation model often breaks when transferred to another.

The authors ask a fundamental question: Is this architectural complexity necessary when an environment is actually fully observable? In tasks like repository bug-fixing, the entire codebase is known in advance, and over 98% of real-world GitHub repositories can fit within a modern 2-million-token context window.

Methods

Instead of using interactive tools, the paper treats software engineering as an in-context prompting problem, introducing two primary approaches:

  • Repository Compression & Ordering: If a repository exceeds the context limit, files are stripped of comments, docstrings, and non-essential code. An LCLM then ranks folders/files by relevance based solely on the directory tree and issue description, ensuring the most relevant files are placed at the very front of the context.
  • DirectSolve: The LCLM ingests the entire (compressed) repository and outputs a patch in a single inference call. The authors introduce two crucial prompting strategies:
  • Chain-of-Thought (CoT) for explicit localization and reasoning.
  • Code Restatement, which instructs the model to copy and restate the exact relevant snippets before generating edits, counteracting the "lost in the middle" retrieval degradation.
  • Patches are produced in standard SEARCH/REPLACE diff blocks.
  • SelectSolve (Two-Stage Hybrid): To overcome the gap between LCLM coding abilities and state-of-the-art short-context models, an LCLM first performs zero-shot file localization (selecting the top $K=6$ files). A specialized short-context model then writes the patch using only those files.

Datasets

The evaluation is conducted on SWE-bench Verified, a curated benchmark of 500 real-world GitHub issue-resolution tasks verified by human annotators. No new benchmarks are introduced.

Key Insights and Ideas

  • Scaffoldings are fragile across model shifts: Agentless, designed around GPT-4o and Claude-3.5, collapsed from 36.2% to 11.0% when directly transferred to Gemini-1.5-Pro due to parsing and workflow mismatches. In contrast, prompting an LCLM directly requires no model-specific tooling adaptions.
  • Single-call localization beats multi-stage retrieval: Using Gemini-1.5-Pro to select relevant files in a single pass reduced file localization error by over 15% compared to Agentless's combination of BM25/embedding retrieval and multi-step prompting.
  • Context degradation is still real: Even when the needle (target file) is positioned at the very front of the prompt, expanding the background context from 100K tokens to 1M tokens caused pass@1 accuracy to decline from 39% to 31%. Stripping docstrings and comments boosted accuracy by 5% simply by keeping the total context tighter.
  • Prompt design details make or break direct solving: Removing Chain-of-Thought reasoning plummeted performance from 32% to 9% pass@1. Adding code restatement stabilized generation, improving pass@1 by 4%.

Key Results

  • Gemini-1.5-Pro (DirectSolve vs. Baselines): Without any external tools, DirectSolve achieved 38.0% pass@1 on SWE-bench Verified, outperforming both an adapted Agentless baseline (32.0%) and OpenHands CodeAct (18.8%) using the same model.
  • Gemini-2.5-Pro: A single-step DirectSolve call with Gemini-2.5-Pro achieved 50.8% pass@1 (and 60.2% pass@8), outperforming adapted Agentless (47.8%) and reported CodeAct (46.4%).
  • Hybrid SelectSolve: Pairing Gemini-1.5-Pro for localization with Claude-3.7-Sonnet for code repair achieved 48.6% pass@1 (59.2% pass@8), surpassing Agentless running on Claude-3.7 (45.2%).

Limitations and Future Work

  • Inference Cost: Processing millions of tokens per query is currently more expensive than tool-based iterations ($2.60 per instance for DirectSolve vs. $0.25 for Agentless and $0.87 for CodeAct). While KV caching for repeated queries across the same repository drops costs to ~$0.725, it remains a factor.
  • Very Large Repositories: Repositories exceeding 2M tokens still require coarse hierarchical filtering.
  • Long-Context Attention Bottlenecks: Models still exhibit degraded reasoning over extreme context lengths, showing that better context-scaling architectures are needed before massive codebases can be ingested entirely without compression.

Summary updated

BibTeX
@misc{jiang2025putting,
  author = {Mingjian Jiang and Yangjun Ruan and Luis A. Lastras and Pavan Kapanipathi and Tatsunori Hashimoto},
  title = {{Putting It All into Context: Simplifying Agents with LCLMs}},
  year = {2025},
  eprint = {2505.08120},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.08120},
}
Figure