Make an agent that answers many questions about the same codebase more efficient over time.
Wrap an existing DSPy module so it keeps a growing summary of what it has learned.
Cap how much context an agent carries by evicting low-value information automatically.
Inspect an agent's accumulated understanding of a document collection at any point.
| 0xtotem/peek-dspy | ant-research/memdreamer | dexoryn-china/polymarket-arbitrage-bot | |
|---|---|---|---|
| Stars | 42 | 42 | 42 |
| Language | Python | Python | Python |
| Setup difficulty | moderate | hard | moderate |
| Complexity | 3/5 | 5/5 | 4/5 |
| Audience | developer | researcher | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires Poetry and an Anthropic API key since the examples use a Claude model.
peek-dspy is a Python library that ports a research technique called PEEK into the DSPy AI programming framework. PEEK stands for a self-updating context map, which is a block of text that lives inside an AI agent's prompt and gets smarter over time. Instead of starting fresh on every question, the agent carries a growing summary of structural knowledge about whatever it is working on, such as a codebase or a document collection. The core idea is that when you ask an AI agent many questions about the same external context, a lot of repeated orientation work gets redone on each call. PEEK separates that orientation work from question-specific reasoning, saves the useful parts, and trims what is no longer needed. This makes repeated interactions more efficient because the agent does not have to re-learn the structure of the thing it is looking at each time. Under the hood, three components handle the map updates after each call. A Distiller figures out which parts of the agent's reasoning were about understanding the context versus answering the specific question. A Cartographer then produces structured edits to the map, adding new facts, removing stale ones, or replacing outdated sections. An Evictor keeps the map within a token budget by dropping sections judged to be low-value. To use it, you wrap any existing DSPy module with the PEEK wrapper, set a token budget and an optional freeze point, and then run your questions through it as usual. The map accumulates automatically. You can inspect the current map at any time through a provided property on the policy object. Setup requires Python with Poetry, and an Anthropic API key since the examples use a Claude model. The library is a direct port of the upstream PEEK implementation described in an academic paper linked in the README.
A DSPy library that gives AI agents a self-updating context map so they stop re-learning the same background information on every question.
Mainly Python. The stack also includes Python, DSPy, Poetry.
No license information is provided in the explanation.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.