| name | agent-fold-context-management |
| title | AgentFold: Long-Horizon Web Agents with Proactive Context Management |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2510.24699 |
| keywords | ["Web Agent","Context Management","Long-horizon Tasks","Memory","Consolidation"] |
| description | Enables web agents to handle long-horizon tasks by actively managing context workspace. Implements granular condensations of recent steps and deep consolidations of multi-step sub-tasks, preventing context saturation. Achieves 36.2% on BrowseComp with 30B model, matching larger proprietary agents. |
AgentFold: Cognitive Context Management for Web Agents
Long-horizon web tasks accumulate verbose interaction histories, causing context saturation and degraded agent reasoning. AgentFold treats context as a dynamic workspace to be actively sculpted, not passively filled.
By implementing retrospective consolidation inspired by human cognition, agents maintain rich but manageable context across complex multi-step tasks.
Core Concept
Key insight: actively compress and consolidate context at multiple scales:
- Granular condensations: preserve fine-grained details from recent steps
- Deep consolidations: abstract multi-step sub-tasks into summaries
- Dynamic folding: apply consolidation strategically to prevent saturation
- Retrospective processing: summarize after task completion
Architecture Overview
- Multi-scale context compression (recent details + old abstractions)
- Step-level granular summaries
- Task-level deep consolidations
- Context relevance scoring for selective retention
Implementation Steps
Implement granular condensation that summarizes recent interactions concisely:
class GranularCondenser:
def __init__(self, llm):
self.llm = llm
def condense_recent_steps(self, recent_interactions, max_steps=5):
"""Create concise summary of recent N steps."""
if len(recent_interactions) <= max_steps:
return recent_interactions
condensed = []
for interaction in recent_interactions[-max_steps:]:
action = interaction['action']
observation = interaction['observation']
summary = self.llm.summarize(
,
max_tokens=
)
condensed.append({
: interaction[],
: ._classify_action(action),
: summary,
: ._extract_facts(observation)
})
condensed
():
keywords = {
: [, , ],
: [, , ],
: [, ],
: [, ]
}
action_type, keywords_list keywords.items():
(kw action.lower() kw keywords_list):
action_type
():
facts = []
lines = observation.split()
line lines:
(line) > (char.isupper() char line):
facts.append(line)
facts[:]