Self-Context: Graph-Based Context Self-Management for Long-Horizon Agents

Ziheng Wang, Chengyi Yang, Renxu Bao, Zhishang Xiang, Chengsong Huang, Wenhao Li, Junnan Zhu, Delai Qiu, Yining Wang, Shengping Liu, Jinsong Su

arXiv:2612.01681 · 2026-12-02 공개 · arXiv · PDF

long-horizon-agents context-management task-performance llm-harness graph-based exploration-coherence history-management fold-unfold

Abstract

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.

한국어 요약

한 줄 요약

Self-Context는 장기적 에이전트의 컨텍스트 관리를 개선하기 위해 그래프 기반의 편집 가능한 작업 그래프와 히스토리 폴딩을 결합한 프레임워크이다.

핵심 기여도

핵심 아이디어

Self-Context는 기존 에이전트가 장기적 태스크에서 컨텍스트 관리의 두 주요 문제, 즉 **누적 컨텍스트 노이즈**와 **불가역적 컨텍스트 컴팩션**을 해결하기 위한 새로운 접근법이다. 기존 방법은 히스토리 내의 중요한 정보만 유지하면 충분하다고 가정하지만, 이는 실패한 접근법이나 실험 결과가 향후 결정에 영향을 줄 수 있는 장기적 태스크에서는 부적절하다. Self-Context는 두 주요 구성요소로 작동한다:
1. **그래프 관리**(Graph Management, 𝒢)는 탐색 시도와 그 결과를 편집 가능한 작업 그래프에 기록하여, 모델이 실패 원인을 추적하고 결론을 수정할 수 있도록 한다.
2. **히스토리 관리**(History Management, 𝒯)는 `fold`와 `unfold`를 사용해 상호작용 히스토리를 요약 노트로 대체하고, 필요 시 원본을 복원한다.

이 두 구성요소는 **구조화된 탐색**과 **중요한 상호작용 세부 정보의 보존**을 동시에 달성하며, 기존 허네스의 도구 인터페이스를 유지하면서도 컨텍스트 편집 기능을 추가한다.

기술적 접근법

주요 결과

의의 및 한계

Self-Context는 장기적 에이전트가 **구조화된 탐색**과 **중요한 상호작용 세부 정보의 보존**을 동시에 달성할 수 있도록 지원하며, 기존 허네스의 도구 인터페이스를 유지하면서도 컨텍스트 편집 기능을 추가하는 **플러그 앤 플레이 방식**이라는 점에서 학술적·실용적 가치가 있다. 특히, 실험 결과는 히스토리 관리와 그래프 관리가 모두 필요하다는 것을 입증하며, 이는 기존 연구에서 간과되었던 문제를 해결한다.

하지만 Self-Context는 **강력한 인스트럭션 팔로잉 능력**이 필요하다는 한계가 있다. XML 포맷을 사용할 경우 성능이 감소하는 것으로 보아, 모델이 복잡한 편집 명령을 정확히 해석해야 한다는 점에서 추가적인 연구가 필요하다.

실용적 활용

Self-Context는 코드 작성, 웹 탐색, 터미널 기반 작업 등 장기적 태스크를 수행하는 에이전트에 적용 가능하다. 특히, Terminal-Bench 2.1과 QwenClawBench에서의 성능 향상은 실제 작업 환경에서의 효율성을 입증하며, 구조화된 탐색과 중요한 정보의 보존