Traditional long-horizon LLM agents often hand off context through full-history prompting, retaining all previous action--observation interactions. As execution proceeds, this history keeps growing, increasing inference cost and potentially degrading accuracy. Existing methods control this growth by preserving compact conclusions while removing earlier observations, but doing so can discard evidence that later becomes relevant. We introduce Semantic Context Handoff (SCH), whose central abstraction is state--evidence separation: a compact semantic state carries the agent's current interpretation, while supporting action--observation evidence remains separately addressable and can re-enter context when later execution makes it relevant, without separate summarization or retrieval-model calls. Empirically, SCH improves long-horizon agent performance while substantially reducing context cost. In a controlled 150-task SWE-bench study, SCH's evidence recovery improves Pass@1 from 80.0% to 86.9% at essentially unchanged token use and execution time. In the complete-system comparison, SCH achieves 86.9% Pass@1 while using 43% fewer tokens and 41% less wall-clock time than the strongest baseline by task performance. Across models and benchmarks, SCH consistently reduces token use relative to full-history prompting while remaining competitive with or improving upon the evaluated baselines. Trajectory analysis confirms that SCH recovers evidence from substantially earlier parts of the interaction history rather than merely preserving a recent context window.
Figures & tables
Figure 1: SCH workflow. The LLM receives the current semantic state together with relevant evidence and returns a sparse state delta and environment action. The controller updates the state, executes the action, stores the resulting action–observation evidence, and selects evidence for subsequent handoffs.
Selection rule
Pass@1 mean ± SD
Tok./task mean ± SD
Time/task mean ± SD
Recent-window recovery
80.89±2.04%
169.2±4.4 k
278.7±8.0 s
Lexical/BM25 recovery
83.33±1.34%
182.7±4.4 k
265.2±6.2 s
Active-state provenance
80.00±1.33%
209.8±6.2 k
233.8±7.3 s
Revision-aware SCH
86.89±1.39%
208.6±5.8 k
237.1±7.4 s
Table 1: Controlled mechanism study on frozen 150-task DeepSeek SWE-bench. State/lifecycle machinery, action interface, controller limits, and evidence budget are fixed; only historical evidence selection changes. Mean ± sample SD over three runs.
Method
Solved/Eval.
Pass@1 ↑
Tok./task ↓
Time/task ↓
Full History
306/(3×150)
68.00±2.00%
1713.3±73.3 k
633.6±23.8 s
PACT
377/(3×150)
83.78±1.68%
367.9±11.0 k
400.2±13.8 s
ACON
364/(3×150)
80.89±1.02%
520.6±15.7 k
569.6±20.7 s
MAGE matched
230/(3×150)
51.11±2.34%
389.2±23.8 k
392.8±21.3 s
Proactive Memory
348/(3×150)
77.33±2.00%
854.4±38.3 k
361.8±16.8 s
SCH
391/(3×150)
86.89±1.39%
208.6±5.8 k
237.1±7.4 s
Table 2: Primary complete-system comparison on frozen 150-task DeepSeek SWE-bench. Solved/Eval. aggregates three runs on the same tasks; Pass@1 is mean ± sample SD across runs. MAGE is paper-guided; Proactive Memory is adapted from its official implementation.
Benchmark
Model
Method
Solved/Eval.
Pass@1 ↑
Tok./task ↓
Time/task ↓
AppWorld (417)
MiniMax
Full History
352/417
84.41%
341.5k
182.5 s
PACT
296/417
70.98%
183.7k
98.6 s
ACON
261/417
62.59%
300.0k
175.0 s
SCH
360/417
86.33%
223.4k
114.2 s
AppWorld (200)
DeepSeek
Full History
172/200
86.00%
522.2k
374.6 s
PACT
174/200
87.00%
344.2k
131.7 s
Table 3: Breadth beyond the primary setting. All rows are single-run. DeepSeek SWE-bench appears in Table 2 . AppWorld uses 417 MiniMax tasks and a separate frozen 200-task DeepSeek sample, so its blocks are not a controlled cross-model comparison.
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Parameter
Value
YAML default model adapter
openai/MiniMax-M3
Temperature / top- p
0.0 / 1.0
Max output tokens
16,384
Per-instance model-call limit
100
Command / total execution timeout
120 s / 1,800 s
Max action requeries
3
Appendix
Table 4: Selected SWE-bench v6.3.1 implementation parameters from the released configuration.
Method
Pass@1
Tokens/task
Calls/task
Time/task
Active-state provenance (rerun)
80.00±1.33%
209.8±6.2 k
24.72±0.63
233.8±7.3 s
MAGE matched
51.11±2.34%
389.2±23.8 k
73.60±4.25
392.8±21.3 s
Proactive Memory
77.33±2.00%
854.4±38.3 k
49.88±2.30
361.8±16.8 s
Appendix
Table 5: Primary-setting architectural-baseline and active-state rerun results. Values are estimated mean ± sample SD from the repeated-run aggregates supplied by the evaluation pipeline. Calls/task is included here because it was recorded for these newly run conditions; SCH’s headline Pass@1/token/time metrics remain in Table 2 .
Method
State
Recent hist.
Recovery
Pass@1 ↑
Tok./task ↓
Time/task ↓
Full History
–
✓
–
68.00%
1709.3k
633.4 s
Semantic State Only †
✓
–
–
76.00%
403.8k
≈ 460 s
Recent History Only
–
✓
–
84.00%
366.2k
400.1 s
Semantic State + Recent History
✓
✓
–
81.33%
169.2k
279.3 s
SCH
✓
–
Revision-aware
87.33%
208.0k
237.0 s
Appendix
Table 6: Diagnostic component analysis. † Semantic State Only is from the earlier 50-task development cohort and has approximate runtime; the remaining rows are primary-run results on the frozen 150-task SWE-bench cohort. Repeated matched selector results appear in Table 1 .
Step
Age
Replay path
Evidence relevant to revision
7
64
orphan
Multiplying block contents yields scalar Zero objects in off-diagonal entries, exposing a matrix/scalar-zero conversion problem.
9
62
support/lineage/revision
Inspection of ImmutableDenseMatrix establishes the explicit-matrix / MatrixExpr relationship used later in the diagnosis.
14
57
support/lineage/revision
MatAdd canonicalization includes an identity-removal rule for scalar zero or ZeroMatrix , making zero handling central to the failure.
40
31
orphan
A focused trace shows Add(z,z) collapsing to core scalar Zero , rather than remaining a matrix-zero expression.
43–46
28–25
support/lineage/revision
Inspection and focused probes of MatAdd , GenericZeroMatrix , and canonicalization reproduce the collapse and rule out a simple constructor-only explanation.
Appendix
Table 7: Selected historical evidence re-exposed around the focal revision in sympy__sympy-17630 . Ages are measured relative to revision step 71. The table abbreviates observations to their role in the repair; the released trajectory contains the canonical action–observation records.
Statistic
Aggregation / interpretation
Value
Tasks audited
Number of trajectories included in the mechanism audit.
150
Tasks with ≥1 explicit revision event
Tasks with at least one turn in which the controller records an explicit revision event.
83 / 150 (55.3%)
Mean explicit revision events per task
Mean number of explicit revision events across the 150 audited tasks.
4.60
Tasks with direct-support replay
Tasks with at least one nonempty direct_support_replay_steps field.
134 / 150 (89.3%)
Tasks with lineage replay (metadata only)
Tasks with at least one nonempty direct_lineage_replay_steps field.
136 / 150 (90.7%)
Tasks with orphan-evidence retrieval
Tasks with at least one nonempty orphan_retrieved_evidence_steps field.
70 / 150 (46.7%)
Appendix
Table 8: Primary-run SCH mechanism statistics for 150 audited SWE-bench trajectories. Percentages with task counts use 150 as the denominator. These mechanism diagnostics refer to Run 1; the repeated effectiveness and efficiency results are reported separately in Tables 2 and 1 . “Metadata only” denotes quantities aggregated from controller-emitted task/turn metadata rather than reconstructed from rendered prompt text.
Full-History statistic
Value
Tasks audited
150
Total model calls
8,076
Mean model calls per task
53.84
Mean cumulative input tokens/task
1,700.7k
Mean cumulative output tokens/task
8.6k
Mean cumulative total tokens/task
1,709.3k
Appendix
Table 9: Primary-run token accounting and context-window diagnostics for the 150-task DeepSeek SWE-bench Full-History arm. Values marked ≈ are estimated from the Run 1 aggregate.
Long-horizon LLM agents can coordinate tools and applications to complete complex, multi-step tasks. As their interaction histories grow, effective context management becomes essential for reliable and efficient execution. Existing methods reduce context through summarization, pruning, or history selection. However, shorter contexts do not necessarily support better decisions: summaries can omit exact details needed for later actions, while retaining entire interactions can carry substantial irrelevant information. We propose CarryOn, a lightweight context manager that pairs compact execution state with fine-grained, source-linked evidence. A learned selector and adaptive retention policy keep relevant evidence available without additional LLM calls for context management. We introduce two complementary evaluation metrics: Sα prioritizes task success while accounting for resource use, and normalized cost per success (NCS) measures the resources spent per successful task. Across AppWorld, OfficeBench, and Tau2 Telecom with three LLM Actors, CarryOn achieves 75.7% macro-averaged task success, exceeding the strongest baseline by 6.7 percentage points. It also achieves the best average scores on both metrics.
Lihuan Li, Ruiyi Yang, Jiru Wang +5
University of New South Wales, Sydney, Australia · The Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China
Long-horizon tasks require LLM agents to continually draw on information from earlier interactions. However, retaining the full history increases context costs, while compressing it risks losing details needed later, and the relevance of historical information often becomes apparent as the task progresses. To address these challenges, we propose FlowState, which treats execution state as memory that can be retained and revisited across requests, unifying current decision-making with the reuse of historical information. FlowState preserves semantically typed state nodes, their relations, and references to raw tool observations, separating persistent retention from on-demand access. Within a single execution loop, Incremental State Update (ISU) maintains the current state based on new inputs and feedback, while Progressive State Access (PSA) progressively reveals historical states and supporting evidence as needed during reasoning. Together, these mechanisms enable agents to reassess prior decisions in light of new information and guide subsequent actions. Compared with a full-context baseline using the same DeepSeek-V4-Flash model, FlowState improves the average success rate on MemoryArena and the average pass rate on τ3-Bench by 4.55 and 13.95 percentage points, respectively, while reducing total token consumption by 43.2% and 40.6%. These results demonstrate the performance and efficiency advantages of FlowState on long-horizon tasks.
LLM agents increasingly take on long-running tasks whose history grows far beyond a single model context window. Existing approaches compress earlier interactions or extract selected information into fixed memory representations, committing to what to preserve before future needs are known. We present Scroll, a context manager that treats each agent session as an executable Session Environment. The environment is backed by an append-only Event Log and a sandboxed, persistent Python kernel. The kernel maintains a typed namespace across model calls, allowing tool outputs, retrieved history, and derived state to be bound to variables rather than serialized into the prompt at each call. Model-written code searches, materializes, and transforms session state through exec; only explicitly printed projections enter the model's working view for the next call. Context management thus becomes a programming task that inherits the improving coding abilities of LLMs, while the Event Log preserves lossless historical ground truth. As the working view approaches its budget, stale spans are evicted but remain recoverable: an eviction index keeps compact landmarks tied to exact Event Log addresses, so that the agent navigates directly to evicted regions instead of searching the full log. With Qwen3.8-Max as the backbone, Scroll achieves 94.8% on LongMemEval_S; 73.1% on BEAM_10M, surpassing the best published memory system by 5.1 points; and 86.7% on LOCA_256K, exceeding the best published long-horizon agent by 37.4 points.