Source-linked AI summary

GenericAgent: A Token-Efficient Self-Evolving LLM Agent via Contextual Information Density Maximization (V1.0)

Jiaqing Liang, Jinyi Han, Weijia Li, Xinyi Wang, Zhoujia Zhang, Zishang Jiang, Ying Liao, Tingyun Li, Ying Huang, Hao Shen, Hanyu Wu, Fang Guo, Keyi Wang, Zhonghua Hong, Zhiyu Lu, Lipeng Ma, Sihang Jiang, Yanghua Xiao

arXiv:2604.17091v1cs.CL

TL;DR

Long-horizon agents must manage expanding context and preserve useful experience without assuming that larger context windows improve reasoning. GenericAgent addresses this with information-density maximization through minimal tools, hierarchical memory, self-evolution, and compression, and reports higher completion with substantially lower token use across benchmarks.

  • Problem

    Long-horizon agents accumulate tool descriptions, memories, observations, and feedback while useful experience is often lost across episodes, making decision-relevant context difficult to maintain.

  • Method

    GenericAgent maximizes contextual information density through minimal atomic tools, hierarchical memory, self-evolution, and context truncation and compression.

  • Results

    On Lifelong AgentBench, GA uses 27.7% of Claude Code’s input tokens and 15.5% of OpenClaw’s while achieving 100% task completion; across five dimensions, it matches or outperforms existing systems with fewer tokens and interactions.

  • Takeaways & Limitations

    The reported results support controlling how information is represented and maintained, rather than primarily adding tools, memory, or longer context, for long-horizon agent capability.

  • Takeaways & Limitations

    The character-to-token context heuristic can delay eviction and risk overflow for CJK content, and reflection-based weight adjustment lacks enough long-term data for definitive effectiveness across diverse workflows.

Abstract

from arXiv · show

Long-horizon large language model (LLM) agents are fundamentally limited by context. As interactions become longer, tool descriptions, retrieved memories, and raw environmental feedback accumulate and push out the information needed for decision-making. At the same time, useful experience gained from tasks is often lost across episodes. We argue that long-horizon performance is determined not by context length, but by how much decision-relevant information is maintained within a finite context budget. We present GenericAgent (GA), a general-purpose, self-evolving LLM agent system built around a single principle: context information density maximization. GA implements this through four closely connected components: a minimal atomic tool set that keeps the interface simple, a hierarchical on-demand memory that only shows a small high-level view by default, a self-evolution mechanism that turns verified past trajectories into reusable SOPs and executable code, and a context truncation and compression layer that maintains information density during long executions. Across task completion, tool use efficiency, memory effectiveness, self-evolution, and web browsing, GA consistently outperforms leading agent systems while using significantly fewer tokens and interactions, and it continues to evolve over time. Project: https://github.com/lsdefine/GenericAgent

1 Introduction

Long-horizon agents face context explosion and difficulty retaining reusable experience across episodes. GenericAgent addresses both through information-density maximization, structured memory, self-evolution, and context management, achieving higher completion at lower token cost.

  • Challenges: Context explosion lets tool definitions, memories, observations, and feedback displace decision-relevant information as interactions lengthen.Finite effective attention can cause overlooked constraints, confused intermediate states, and compounding hallucinations.
  • Challenges: Experience accumulation is difficult because useful preferences, tool behaviors, and action patterns emerge during execution rather than being available initially.Without retention and reuse, agents repeat failures across sessions.
  • Challenges: Existing frameworks often lack persistent memory, store raw logs instead of reusable knowledge, and provide no feedback-driven refinement.Stale or incorrect memories can therefore remain uncorrected.
  • Approach: GenericAgent maximizes decision-relevant information maintained and updated within a limited context budget rather than maximizing context length.Its mechanisms include minimal tools, hierarchical memory, self-evolution, and context truncation or compression.
  • Results: GA achieves higher task completion at substantially lower token cost, with the efficiency–performance advantage remaining stable across repeated runs.The evaluation covers multiple benchmarks against representative agent systems.

2 GenericAgent

GA treats context quality as an information-density problem centered on completeness and conciseness, with naturalness as a secondary representational constraint. Its minimal tools and retained operational knowledge support efficient reuse across repeated tasks.

  • Design Principles: Adding context can eventually reduce performance because positional bias, irrelevant-content interference, and effective-window contraction waste attention.Thus, longer context is not inherently better reasoning support.
  • Design Principles: Context quality depends primarily on balancing completeness, which preserves required information, and conciseness, which removes distracting or redundant content.Naturalness remains a supporting constraint on semantic legibility.
  • Design Principles: GA keeps richer memory available on demand while maintaining a lightweight orientation layer, and represents web pages through semantically structured observations rather than raw HTML.These choices preserve access to deeper knowledge without exposing all content by default.
  • Minimal Tools: Tool minimality reduces both prompt overhead and decision complexity by constraining interfaces to atomic, composable primitives.Complex behaviors emerge through sequencing general-purpose tools rather than enumerating task-specific interfaces.
  • Self-Evolution: GA progressively improves reuse by retaining validated experience as reusable operational knowledge instead of replaying exploration or using underspecified prompts.The mechanism does not modify the base model directly.
  • Context Management: GA targets a compact budget of under 30k tokens and favors compression over larger windows because higher-density information can outperform diluted content.The paper contrasts this approach with frameworks using windows of up to 1M tokens.

2.2 Overview of GenericAgent

GA is a model-agnostic agent system organized around a unified loop connecting tasks, memory, model outputs, tool execution, and structured feedback. It supports both user-initiated interaction and event-triggered reflection.

  • System Overview: GA operates across browsers, terminals, file systems, input devices, screen perception, and mobile devices through configurable tool adapters.Its execution logic, interfaces, and memory architecture remain independent of the replaceable LLM backend.
  • Unified Agent Loop: At each step, GA combines global memory with the current task, produces an output or tool call, and feeds structured execution results back into system state.This creates tool-grounded iterative execution.
  • Execution Modes: Interact mode handles user-initiated tasks, whereas Reflect mode monitors environmental changes and triggers tasks automatically when conditions or events occur.Both modes share the same agent loop and memory system.

2.3 Core Components of GenericAgent

GA implements information-density maximization through atomic tools, hierarchical memory, explicit self-evolution, and context-budget management. These components reduce interface overhead, selectively retain knowledge, convert experience into skills, and compress history when needed.

  • Core Components: GA realizes its design principles through four components: atomic tools, hierarchical memory, self-evolution, and context truncation or compression.Together they manage contextual information across execution and subsequent tasks.
  • Atomic Tool Set: The tool system uses a small set of atomic primitives with bounded capabilities and execution-specific optimizations for efficient inspection, editing, and browser interaction.Specialized tools act as shortcuts that reduce decision-making and operational overhead rather than expanding fundamental capability.
  • Hierarchical Memory: Hierarchical memory keeps minimal task state and compressed orientation information visible while exposing richer facts and procedures when explicitly needed.Its layers include an index, facts and procedures, and durable storage, with a meta-memory map guiding organization.
  • Hierarchical Memory: GA validates potentially valuable information before incrementally committing it to long-term memory, keeping the always-on index bounded as knowledge grows.The index records categories rather than substantive content, enabling extreme compression while the model serves as decoder.
  • Self-Evolution: Self-evolution separates fixed tools from evolving task-specific knowledge stored in SOPs and reusable scripts, which feedback can refine across sessions.Common subtasks can progress from plain-text instructions to executable code.
  • Context Truncation and Compression: GA triggers compression or eviction when character-based context length exceeds a budget converted from the configured token window.The system uses a character heuristic because precise token counts are unavailable.
  • Context Truncation and Compression: For CJK content, the α=3 heuristic can delay eviction and risk context overflow, whereas for ASCII-dominated content it causes mildly early eviction.The paper characterizes the ASCII behavior as conservative but safe and the CJK behavior as a potential overflow risk.

3 From Minimal Architecture to Emergent Capabilities

GA’s minimal architecture turns a unified CLI and persistent skill tree into composable capabilities such as subagent dispatch, reflective triggering, and autonomous exploration, without extending the core loop.

  • Architectural minimality: GA’s architecture is minimal in both code and interface, with about 3,300 lines of code and a 92-line Agent Loop.The system exposes a self-hosted CLI as its native execution surface.
  • Subagent Dispatch: A standard CLI primitive lets parent agents launch independent GA processes as subagents for parallel, context-isolated map-reduce workflows.Each instance maintains its own memory space and conversation history.
  • Reflect Mode: Reflect Mode uses lightweight external scripts to monitor conditions and dispatch standard GA tasks when triggers fire, without user instruction.Watchdog and scheduled execution differ only in how their external trigger scripts are written.
  • Scope and limitations: User interaction alone is insufficient for systematic skill accumulation, motivating autonomous learning for continuous agent evolution.The system’s stated limitations include a 30-round execution cap, unverified adaptation, and manual skill-tree maintenance.
  • Autonomous exploration: Subagent dispatch and Reflect Mode together provide the execution and trigger substrates for autonomous exploration without new architectural machinery.The remaining design task is deciding what to explore and how to evaluate results.
  • Autonomous exploration: GA’s persistent two-level skill tree indexes capabilities and drives autonomous exploration decisions using categories, named skills, tool scripts, and usage counters.The curriculum planner scores candidate tasks by breadth, depth, utility, and innovation using a weighted sum.

4 Evaluation

Across task completion, token efficiency, tool use, memory, and repeated execution, GA combines competitive or superior performance with lower operational cost and continued efficiency gains from experience.

  • Task completion: GA reaches state-of-the-art or highly competitive task completion across all three main benchmarks.It achieves 100% accuracy on SOP-Bench and Lifelong AgentBench and the highest RealFin-Benchmark accuracy at 65%.
  • Token efficiency: GA reduces input-token consumption while maintaining 100% accuracy on Lifelong AgentBench.It uses 222k input tokens versus 800k for Claude Code and 1.43M for OpenClaw.
  • Token efficiency: GA achieves the strongest combined task-completion and token-efficiency results within each benchmark.Its efficiency ratio is 4.15 at 100% accuracy on Lifelong AgentBench and 5.70 at 65% accuracy on RealFin-Benchmark.
  • Tool composition: GA solves five long-horizon tasks with 100% success using 188,829 accounted tokens.This matches Claude Code’s success while using 35.1% of its 537,413 tokens, with fewer requests and tool calls.
  • Tool composition: Tool usage in baseline systems concentrates in a few high-frequency tools, while GA uses a compact atomic-tool loop.GA centers execution on code_run, file_read, web_execute_js, and web_scan.
  • Self-evolution: Repeated use converts task experience into reusable memory that lowers GA’s runtime and token consumption.Across five runs, operation time decreases from 102 seconds to approximately 66 seconds, while token consumption drops from 200,439 to 100,000.
  • Memory effectiveness: Condensed memory provides the same highest TSR as Redundant-Memory and outperforms Full-Memory with fewer tokens.Redundant-Memory adds tokens without improving over Condensed Memory.
  • Memory effectiveness: GA’s memory mechanism achieves the best F1 and BLEU-1 scores across four factual-retention task categories.The advantage is especially clear on Multi-Hop and Temporal tasks.

5 Discussion

The discussion presents context information density as a structural constraint and argues for a minimal capability set centered on tool interfacing, context management, and memory formation. GA’s reported results associate lower token use with successful long-horizon execution, while leaving architectural self-update as future work.

  • Context information density constrains LLM-based agent systems because limited effective attention makes irrelevant or middle-positioned content harder to use.The paper treats this as an architectural constraint rather than an optional optimization target.
  • A minimal complete agent capability set comprises tool interfacing, context management, and memory formation.These capabilities address interface overhead, active-context filtering, and cross-task knowledge accumulation.
  • 100% task completion on Lifelong AgentBench accompanied GA’s use of 27.7% of Claude Code’s input tokens and 15.5% of OpenClaw’s.The authors interpret token consumption in long-horizon execution as reflecting context-management quality rather than reasoning thoroughness.
  • Permissions determine the complexity of reasoning chains and tasks an agent can solve by defining its exploration and capability-development boundary.The paper warns that overly narrow action boundaries can produce systems that are safe but unusable.
  • GA’s minimal architecture may enable architectural self-update, but validation of the full evolutionary path remains an open problem.The proposed progression is from skill consolidation to autonomous exploration and then architectural self-update.

6 Related Work

Related work has advanced action interfaces, memory, context construction, and self-evolving agents. GA differs by co-designing these ingredients around contextual information density and by transforming verified experience into executable operational assets.

  • Prior autonomous-agent research spans action interfaces, memory, self-improvement, and web interaction.GA positions itself within this broader systems literature rather than as a single isolated module.
  • ReAct and Reflexion established interleaved reasoning, acting, and feedback, while AutoGPT and MetaGPT expanded decomposition and multi-role workflow design.These systems helped establish that agent performance depends on more than the base model.
  • CodeAct, Devin, SWE-agent, and OpenHands show how action interfaces and environment integration shape software-engineering and computer-use agents.CodeAct represents actions as executable code, supporting compositionality, testing, and reuse.
  • GA differs from systems that expand behaviors through richer workflows or specialized tools by deliberately minimizing the action space and prompt overhead.Its minimal atomic toolset is presented as part of the central systems claim.
  • Memory-centric approaches emphasize storage and retrieval, whereas GA treats memory quality as verification and selection across the path from observation to retention.The design promotes only behavior-changing and validated information into longer-term representations.
  • Self-evolving systems commonly retain textual principles or reflections, while GA aims to convert verified trajectories into SOPs, code, and reusable skills.The paper links this representation shift to lower inference-time cost and evaluates efficiency convergence.

7 Conclusion

The conclusion presents GenericAgent as a self-evolving general-purpose agent organized around contextual information density maximization. Its four components target concise, decision-relevant context, and evaluations report comparable or better task completion with fewer resources.

  • GenericAgent is a self-evolving general-purpose LLM agent built around context information density maximization.The system treats context as information to be actively optimized rather than a passive interaction byproduct.
  • GA combines a minimal atomic tool set, hierarchical on-demand memory, reflection-driven self-evolution, and context truncation and compression.Verified trajectories are distilled into reusable SOPs and executable code.
  • Across five evaluation dimensions, GA matches or outperforms existing agent systems on task completion while using fewer tokens and interactions.Repeated-run self-evolution reduces token usage by up to 89.6% while maintaining or improving performance.

8 Author Contributions

The author-contribution section assigns responsibilities spanning system development, evaluation, manuscript writing, figure design, supervision, and project leadership. Contributions are distributed across named authors and specific sections or benchmarks.

  • Jiaqing Liang led core system design, implemented the main codebase, and managed the project, while Yanghua Xiao provided supervision and strategic guidance.
  • Jinyi Han led manuscript design and writing, coordinating contributions and integrating the manuscript across revisions.

1 Atomic Tool Alignment

GA retains core capabilities through a minimal atomic-tool environment, while representative task-level examples show that specialized capabilities can be reconstructed through short tool compositions.

  • Atomic Tool Alignment: GA’s core atomic tools each have corresponding capability prototypes in Claude Code and OpenClaw.The alignment is capability-level rather than a complete inventory comparison.
  • Atomic Tool Alignment: Representative substitutions map specialized baseline tools to GA compositions that complete the same class of task.The examples focus on task-level replacements rather than one-to-one reproduction of every specialized tool.

2 Web Browsing Visualization

Figure 6 compares token consumption with normalized performance across three web-browsing benchmarks, showing GA’s competitive or superior scores with substantially lower token use than OpenClaw.

  • Web Browsing Visualization: Figure 6 places total token consumption and normalized score on separate axes for the three benchmark comparisons.The left axis reports tokens in millions, while the right axis reports normalized scores on a 0–1 scale.
  • Web Browsing Visualization: GA achieves competitive or superior normalized performance while consuming significantly fewer tokens than OpenClaw across all three web-browsing benchmarks.The figure uses total token consumption in millions on the left axis and normalized scores from 0 to 1 on the right axis.

3 Case Studies

The case studies illustrate GA’s operation across tool use, memory, self-evolution, and web browsing, with worked traces linking task setup, artifacts, and outcomes.

  • Self-Evolution: The self-evolution case turns a GitHub pull-request research trajectory into a reusable SOP, Python script, and transferability guidance.The reusable assets support issue research, contributor analysis, release tracking, workflow inspection, and code search.
  • Web Browsing: The web-browsing case uses iterative search refinement to identify Wang Anshi as the exact answer to a BrowseComp-ZH multi-hop question.The case reports score 1.0, seven turns, six tool calls, and 95% confidence.
  • Tool Use: The tool-use case completes a laboratory API procurement workflow requiring browsing, structured extraction, numerical reasoning, and file generation.GA produced a cost comparison and decision file, recommending Gemini 2.5 Pro as a single-model plan at $300/month.
  • Tool Use: 21 requests and 364,385 total tokens yielded a correct procurement recommendation, with all grading criteria passed.The recommendation was Gemini 2.5 Pro as a single-model plan; no dual-model fallback was needed.
  • Memory: The memory case compares condensed, full, and redundant representations while holding the dangerous-goods decision rule fixed.Its focus is whether information density, rather than raw information volume, determines memory quality.

4 General Capability Showcase

Additional demonstrations show GA composing atomic tools across devices, platforms, autonomous sessions, remote infrastructure, and multi-session academic workflows.

  • Cross-Device Control: GA completed a mobile ordering and media-processing pipeline across an Android device and host PC without a task-specific automation framework.The workflow included ADB connection, seven GUI interactions, recording retrieval, trimming, masking, and GIF generation.
  • Cross-Platform Orchestration: GA bridged an encrypted local WeChat database and browser-based Weibo through decryption, contact resolution, extraction, publication, and verification.The workflow used code execution, file access, and browser interaction under explicit user intent.
  • Autonomous Operation: Over approximately 15+ autonomous rounds, GA performed security auditing, created three reusable scripts, conducted web patrol, and self-corrected file-management errors.The case frames self-evolution, checkpoints, and patrol routines as support for bounded autonomous operation.
  • Remote Infrastructure: GA completed an SSH-based DevOps workflow including dependency installation, 19 MB file upload, HTTP deployment, bug fixing, requirement changes, and verification.The workflow used remote shell and file-transfer operations with checkpoint tracking.
  • Long-Horizon Academic Workflow: The academic workflow discovered and corrected a significant number of erroneous arXiv metadata entries.This finding appears within the citation-verification phase of the multi-session proposal task.
  • Long-Horizon Academic Workflow: Across several days, GA supported academic work spanning document analysis, figure generation, citation verification, LaTeX integration, and PDF regeneration.The case attributes continuity across these phases to layered persistent memory and reusable procedures accumulated through self-evolution.
Loading 2604.17091v1…