[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-79886":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":12,"stars90d":14,"forks30d":14,"starsTrendScore":15,"compositeScore":16,"rankGlobal":8,"rankLanguage":8,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":8,"pushedAt":8,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":25,"discoverSource":26},79886,"peek","zhuohangu\u002Fpeek","zhuohangu",null,"Python",106,10,5,2,0,1,3.12,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:03:55","# PEEK: Context Map as an Orientation Cache for Long-Context LLM Agents\n\n\u003Cdiv align=\"center\">\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2605.19932\" target=\"_blank\">\n    \u003Cimg alt=\"arXiv\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2605.19932-b31b1b.svg?style=for-the-badge\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fzhuohangu.github.io\u002Fblog-post-peek\u002F\" target=\"_blank\">\n    \u003Cimg alt=\"Blog\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBlog-Read%20More-FF5722?logo=blogger&logoColor=white&style=for-the-badge\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fforms.gle\u002F73cGdSqQN3mfFRdu8\" target=\"_blank\">\n    \u003Cimg alt=\"Interest & Feedback Form\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FInterest%20%26%20Feedback%20Form-4285F4?logo=googleforms&logoColor=white&style=for-the-badge\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.04618\">\n    \u003Cimg src=\"media\u002Fpeek-paper-preview.png\" alt=\"Paper Preview\" width=\"300\"\u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n---\n\n## Overview\n\nPEEK caches reusable *orientation knowledge* about long and recurring external contexts (e.g., document corpora and code repositories) that LLM agents operate on, representing this knowledge as a *context map*. Inspired by computer-system caches and database indexes, PEEK treats the context map as a small, prompt-resident cache of a much larger external context. This helps the agent understand, navigate, and act on that context more efficiently and reliably.\n\nPEEK manages the map through a modular cache policy. It is **agent- and model-agnostic, as well as unsupervised**: it makes no assumptions about the agent’s architecture or scaffolding, and works with both open- and closed-source LMs, including most frontier models. PEEK uses inference-time signals (without requiring ground-truth labels) and returns an updated map that can be prepended to the next call.\n\n> [!NOTE]\n> This repository is for the PEEK system itself.\n\n## 🚀 Quick Setup\n\n```bash\npip install peek-ai            # core (tiktoken only)\npip install peek-ai[openai]    # + OpenAI \u002F OpenAI-compatible endpoints\npip install peek-ai[anthropic] # + Anthropic\npip install peek-ai[gemini]    # + Google Gemini\npip install peek-ai[all]       # all of the above\n```\n\nA minimal loop around your own agent looks like this:\n\n```python\nfrom peek import CachePolicy\nfrom peek.llm.openai_client import OpenAIClient\n\nclient = OpenAIClient(model=\"gpt-5-mini-2025-08-07\")\npolicy = CachePolicy(client=client, token_budget=1024, evolve_steps=10)\n\nfor question in stream_of_questions:\n    system_prompt = f\"{base_instructions}\\n\\nContext Map:\\n{policy.current_map_text}\"\n    trajectory = my_agent.run(system_prompt, question, long_external_context)\n    policy.update(trajectory=trajectory, question=question)\n\npolicy.save(\"maps\u002Fmy-corpus.peek.json\")\n```\n\n### Model Providers\n\nAny object satisfying [`peek.LMClient`](src\u002Fpeek\u002Fllm\u002Fbase.py) works as the Distiller\u002FCartographer backbone — implement `completion(messages)` and `last_usage()` and you can plug in vLLM, Together, Ollama, or a local stub. Three reference clients ship with the package:\n\n| Provider  | Class                                | Extra                |\n|-----------|--------------------------------------|----------------------|\n| OpenAI    | `peek.llm.OpenAIClient`              | `peek-ai[openai]`    |\n| Anthropic | `peek.llm.AnthropicClient`           | `peek-ai[anthropic]` |\n| Gemini    | `peek.llm.GeminiClient`              | `peek-ai[gemini]`    |\n\n\n## 📖 Relevant Reading\n\n- **PEEK paper** — [arXiv:2605.19932](https:\u002F\u002Farxiv.org\u002Fabs\u002F2605.19932)\n- **Blog post** — [Give Your Agent an Orientation Cache](https:\u002F\u002Fzhuohangu.github.io\u002Fblog-post-peek\u002F)\n\n## 🤝 Contributing\n\nWe welcome contributions! A simple path to contribute:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature\u002Famazing-feature`)\n3. Commit your changes (`git commit -m \"Add amazing feature\"`)\n4. Push to the branch (`git push origin feature\u002Famazing-feature`)\n5. Open a Pull Request\n\n> [!NOTE]\n> For larger changes, we’re happy to start with a discussion to align on scope before implementation.\n\n### 📧 Contact\n- **Paper Authors**: See the [arXiv paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2605.19932) for author contact information.\n- **Interest and Feedback**: Please fill out the [form](https:\u002F\u002Fforms.gle\u002F73cGdSqQN3mfFRdu8).\n- **Issues**: Please open an issue on GitHub.\n\n\n---\n\n\n## 📝 Citation\n\nIf you use PEEK in your research, please cite:\n\n```bibtex\n@misc{gu2026peekcontextmaporientation,\n      title={PEEK: Context Map as an Orientation Cache for Long-Context LLM Agents}, \n      author={Zhuohan Gu and Qizheng Zhang and Omar Khattab and Samuel Madden},\n      year={2026},\n      eprint={2605.19932},\n      archivePrefix={arXiv},\n      primaryClass={cs.AI},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2605.19932}, \n}\n```\n\n\u003Cdiv align=\"center\">\n\n**⭐ Star us on GitHub if PEEK helps your research!**\n\n\u003C\u002Fdiv>\n","PEEK是一个用于长上下文大型语言模型代理的上下文地图缓存系统。它通过将可重用的方向知识以上下文地图的形式存储，帮助模型更高效、可靠地理解和操作长期和重复出现的外部上下文（如文档库和代码仓库）。PEEK采用模块化缓存策略管理这些地图，并且是与代理和模型无关的，同时支持无监督学习，适用于开放源码和闭源的语言模型。该工具特别适合需要处理大量文本数据或代码库的应用场景，比如文档检索、代码理解等任务，能够显著提高基于LLM应用的工作效率。","2026-06-11 03:58:24","CREATED_QUERY"]