LASCon: Loop-Aware Scratchpad Condensation for Terminal Agents
Abstract
LLM-based terminal agents face significant context management challenges in long-horizon tasks, where growing interaction histories can exceed context windows and lead to timeout failures. Existing approaches rely on LLM-based summarization, which may lose critical CLI-specific information such as exact error messages and file paths. We present LASCon (Loop-Aware Scratchpad Condensation), a training-free scaffold that combines a Deterministic CLI Condenser (DCC) for rule-based observation compression with a Progress-Conditioned Loop Controller (PLC) for preventing unproductive action repetition. On Terminal-Bench 2.0 with Qwen3-32B, LASCon achieves 68.8% completion rate, a +21.2 percentage point improvement over the OpenHands default baseline (47.5%), while eliminating all timeout failures (0 vs 36). Ablation studies reveal that DCC alone achieves 70.0% completion, demonstrating that structured context management is the primary driver of improvement. PLC maintains a conservative 0.12% block rate with zero deadlock events, serving as a safety net rather than an aggressive intervention.