@astrogu_: Recent agentic systems (Claude Code, Codex, RLM, etc.) push context out of the prompt and into the environment (e.g., a…
Summary
PEEK introduces a context map as an orientation cache for LLM agents, enabling them to maintain persistent knowledge about external environments like code repositories. The system achieves 6.3-34.0% quality improvements at lower cost compared to baselines like RAG and ACE.
View Cached Full Text
Cached at: 05/21/26, 03:48 PM
Recent agentic systems (Claude Code, Codex, RLM, etc.) push context out of the prompt and into the environment (e.g., as files). This helps them maintain long-term knowledge about their goals and functionality.
While this is a good idea, we show a surprising result: systems that use external environments like this perform much better when given a small, fixed-size, in-context, agent-managed cache that “𝘱𝘦𝘦𝘬𝘴 𝘪𝘯𝘵𝘰” these environments.
Our paper, 𝗣𝗘𝗘𝗞: 𝙖 𝙨𝙮𝙨𝙩𝙚𝙢 𝙛𝙤𝙧 𝙗𝙪𝙞𝙡𝙙𝙞𝙣𝙜 𝙖𝙣𝙙 𝙢𝙖𝙞𝙣𝙩𝙖𝙞𝙣𝙞𝙣𝙜 𝗮𝗻 𝗼𝗿𝗶𝗲𝗻𝘁𝗮𝘁𝗶𝗼𝗻 𝗰𝗮𝗰𝗵𝗲 𝙛𝙤𝙧 𝙇𝙇𝙈 𝙖𝙜𝙚𝙣𝙩𝙨, introduces this idea.
Compared with strong baselines, including RAG, Compaction Agents, and SOTA prompt-learning frameworks, PEEK dominates the cost–quality Pareto frontier: achieving +6.3–34.0% in quality, with fewer iterations and lower cost.
Paper: https://arxiv.org/abs/2605.19932 GitHub: https://github.com/zhuohangu/peek
More in the thread below! (1/N)
PEEK: Context Map as an Orientation Cache for Long-Context LLM Agents
Source: https://arxiv.org/abs/2605.19932 View PDF
Abstract:Large language model (LLM) agents increasingly operate over long and recurring external contexts, like document corpora and code repositories. Across invocations, existing approaches preserve either the agent’s trajectory, passive access to raw material, or task-level strategies. None of them preserves what we argue is most needed for repeated same-context workloads: reusable orientation knowledge (e.g., what the context contains, how it is organized, and which entities, constants, and schemas have historically been useful) about the recurring context itself. We introduce PEEK, a system that caches and maintains this orientation knowledge as a context map: a small, constant-sized artifact in the agent’s prompt that gives it a persistent peek into the external context. The map is maintained by a programmable cache policy with three modules: a Distiller that extracts transferable knowledge from inference-time signals, a Cartographer that translates it into structured edits, and a priority-based Evictor that enforces a fixed token budget. On long-context reasoning and information aggregation, PEEK improves over strong baselines by 6.3-34.0% while using 93-145 fewer iterations and incurring 1.7-5.8x lower cost than the state-of-the-art prompt-learning framework, ACE. On context learning, PEEK improves solving rate and rubric accuracy by 6.0-14.0% and 7.8-12.1%, respectively, at 1.4x lower cost than ACE. These gains generalize across LMs and agent architectures, including OpenAI Codex, a production-grade coding agent. Together, these results show that a context map helps long-context LLM agents interact with recurring external contexts more accurately and efficiently.
Submission history
From: Zhuohan Gu [view email] **[v1]**Tue, 19 May 2026 14:51:32 UTC (2,028 KB)
Similar Articles
@lateinteraction: Agents often externalize some context: a repository in coding agents, a corpus in RAG, and the user prompt in an RLM. N…
New research by Joshua Gu shows that AI agents perform better when they manage a small buffer in their context window as a cache for external context, challenging the common practice of pushing context entirely out of the prompt.
PEEK: Context Map as an Orientation Cache for Long-Context LLM Agents
This paper introduces PEEK, a system that caches orientation knowledge about recurring external contexts as a context map, enabling LLM agents to reuse context knowledge across invocations and significantly improving efficiency and accuracy on long-context reasoning and information aggregation tasks.
I built an open-source coding agent that makes context visible and editable — you curate exactly what the LLM sees
The author built Nice Coding Agent, an open-source coding workbench with a visible and editable context stack, allowing users to curate exactly what the LLM sees. It features local-first retrieval, sandboxed execution, and hybrid code search, aiming to give developers control and visibility over context assembly.
@IntuitMachine: PEEK: The 1k-Token Map That Just Killed the Long-Context Tax Your LLM agent is reading the same 50k-token codebase for …
Microsoft introduces PEEK, a 1,024-token 'context map' that caches orientation knowledge for LLM agents, cutting redundant reasoning and achieving up to 34% accuracy gains with 93–145 fewer retries and 5.8× cost reduction.
What I'm learning trying to ensure context continuity for different agents across different sessions
The author introduces AICTX, an open-source tool that preserves structured operational state across coding agent sessions, reducing the need for agents to rediscover repository context each time.