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
👋 Hi everyone! Sharing the official bilingual (English / 简体中文) resources and 15s benchmark performance showcase for Self-Context:
- 🌐 Interactive Project Page: self-context.github.io · 简体中文直达
- 🎬 15s Performance Video (HD MP4): English MP4 · 简体中文 MP4
- 💻 GitHub Code & Benchmarks: XMUDeepLIT/Self-Context · 中文文档 README_zh.md
- 🧭 Interactive HF Space: vintces/Self-Context
- 📚 HF Collection: Self-Context Collection
核心亮点 / Key Highlights
- Plug-and-Play Inference Gateway ($c_t = F_t \oplus G_t$) — Combines reversible whole-turn history
fold/unfold($\mathcal{T}$) with an editable working graph ($\mathcal{G}$) between a frozen LLM and its unchanged native harness. - 即插即用推理期网关 — 无需重训模型权重、无需改动原生工具框架,由行动模型通过
<graph>自主执行整轮可逆折叠/展开与工作图增删改连(255,208 次操作中删增比达0.88×)。 - #1 Across All 9 Methods (6/6 Wins) — On Qwen3.8-27B, reaches 69.8% macro average (+5.7 pp over Vanilla Harness, −23.7% turns) and 82.0% on Terminal-Bench 2.1 (+7.8 pp, −31.8% turns, matching 100-turn Vanilla by Turn 61).
@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


