Self-Context: Graph-Based Context Self-Management for Long-Horizon Agents
Abstract
Self-Context is a graph-based framework that enables an LLM to manage its own context through editable working graphs and fold/unfold history summaries, improving long-horizon agent performance and interaction efficiency.
Effective context management is essential for long-horizon agents because context is a finite resource, and context windows of any size remain subject to context pollution and information relevance concerns. However, existing approaches assume that keeping critical findings in the interaction history is sufficient for later decisions and struggle with accumulating context noise and irreversible context compaction. To address these challenges, we propose Self-Context, a graph-based plug-and-play framework between the LLM and its native harness. It allows the LLM to take over context management through two components: graph management for structured exploration and history management for preserving critical interaction details. Graph management records exploration attempts and their findings in an editable working graph. History management uses fold and unfold to replace interaction history with summary notes and restore the original history when needed. Extensive experiments on three agent tasks show that Self-Context improves both task performance and interaction efficiency by keeping critical findings available for later decisions and maintaining exploration coherence.
Community
Official Resources / 官方开源资源 (English & 简体中文)
- 🌐 Project Page / 项目主页 (EN & 中文): self-context.github.io · 简体中文直达
- 💻 Code & Benchmarks / 开源代码与基准 (EN & 中文文档): XMUDeepLIT/Self-Context (README_zh.md)
- 🧭 Interactive Space / 在线交互演示 (EN & 中文): vintces/Self-Context
- 📚 HF Collection / 资源合集: Self-Context Collection
Overview: Self-Context sits transparently between a frozen LLM and its native agent harness (c_t = F_t ⊕ G_t), combining reversible whole-turn history management (fold / unfold) and structured graph management (add / edit / link / remove). Across BrowseComp-Plus, Terminal-Bench 2.1, and QwenClawBench v1.1, it reaches 69.8% macro average (+5.7 pp over Vanilla Harness) with 23.7% fewer turns on Qwen3.8-27B.
中文简介: Self-Context 是位于冻结大模型与其原生智能体框架之间的即插即用上下文自管理网关(c_t = F_t ⊕ G_t),结合可逆整轮历史管理(fold / unfold)与可编辑工作图管理(add / edit / link / remove)。在三大长程评测基准上,基于 Qwen3.8-27B 取得 69.8% 宏平均分(较原生基线 +5.7 pp),并减少 23.7% 交互轮次。
@misc{wang2026self-context,
title = {Self-Context: Graph-Based Context Self-Management for Long-Horizon Agents},
author = {Ziheng Wang and Chengyi Yang and Renxu Bao and Zhishang Xiang and Chengsong Huang and Wenhao Li and Junnan Zhu and Delai Qiu and Yining Wang and Shengping Liu and Jinsong Su},
year = {2026},
eprint = {2612.01681},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
url = {https://arxiv.org/abs/2612.01681}
}
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper

