Hi team :wave: Any best practices for handling la...
# questions
t
Hi team 👋 Any best practices for handling large/legacy repos (1.5GB–2GB) in OpenHands SDK to control context & token usage? Repo can be Muti repo or Mono repo . We are building an autonomous coding agent using OpenHands SDK (~1.26.x) with our own agent harness/runtime with tools for github , filesystem, Jira, to resolve brownfield issues and bug fixes on GitHub repositories. While this works reliably on standard/small repositories, we run into major bottlenecks on large legacy codebases (~1.2 GB to 2.0 GB). On these repos, the agent struggles with: Context window bloat & high token consumption: Commands like recursive file listings, wide grepping, or tool outputs quickly consume the context window. Session degradation: As conversations lengthen, token costs spike and models (tested across Claude Sonnet 3.x/4.x , GPT-4o, 4.1, and reasoning models) start losing focus on the original task. What we’re looking to understand from the community & maintainers.. Context Management: What is the recommended setup for LLMSummarizingCondenser / RollingCondenser for deep multi-turn sessions on large codebases? Codebase Navigation & Indexing: Rather than letting the agent run raw find/grep across 2GB of legacy files, what is the recommended way to integrate targeted tools (e.g., AST/cscope, ctags, embeddings, or MCP-based code indexing)? Skills & Context Scoping: How are others using AgentSkills / progressive disclosure (SKILL.md, path-triggered rules) to prevent injecting massive repo-level knowledge into the system prompt at start? Git Worktrees & Shallow Clones: Are there recommended patterns for cloning or isolating only the active submodule/directory to avoid loading multi-gigabyte git histories into the runtime sandbox? Any pointers, sample repo configs, or recommended AgentContext settings for large-scale enterprise repos would be greatly appreciated!
👀 1
c
Hey! I think there are a lot of things here. Just one detail first: “tested across Claude 3.5/3.7 Sonnet, GPT-4o” - sorry, is this accurate? I think 3.7 has been retired a few months ago, and also the older one. 😅 Reason why it matters is that while context matters for all LLMs, I would not advise to use results with past LLMs as criteria. LLMs are much better at keeping track of context in the new generations, I wouldn’t even compare, even though it’s still real. That said, maybe it’s worth noting one tiny detail: the SDK has actually a maximum number of characters that it trims long observations to. It never includes in context everything from grep etc. I wonder if maybe you could tell your agent to find that, and see if you can customize it, and if not, I think we would welcome a PR to make it customizable if you wish
t
Sorry i corrected the models and versions in the actual message Claude Sonnet 3.x/4.x , GPT-4o, 4.1 and reasoning models , (we did try with 4.x models as well same issue)
c
Session degradation: As conversations lengthen, token costs spike and models (tested across Claude Sonnet 3.x/4.x , GPT-4o, 4.1, and reasoning models) start losing focus on the original task.
The default setup in OpenHands has a summarizing condenser that kicks in at ~240 events, which is about 120 steps. This is not a lengthy conversation, I would say, generally. Did this happen with the default? Personally, I find that SOTA LLMs need actually the opposite or do better with more context than 120 steps. There’s no rule. I would need to understand better what are you using and what are you seeing. Also, please let me note again, the SDK doesn’t actually include in context huge observations, it trims them. Do you need them trimmed more?
How are others using AgentSkills / progressive disclosure (SKILL.md, path-triggered rules) to prevent injecting massive repo-level knowledge into the system prompt at start?
A way to deal with this is: • AGENTS.md becomes small: only the essentials + an index of other, path-specific, AGENTS.md • progressive disclosure for most others, AgentSkill format
None of these notes is specific to large repos, of course. I’m sure there are other things that are specific to large repos, these are just thoughts from the original description of the problem