anthropics / anthropics/claude-cookbooks
[PROPOSAL] Cookbook: Agent memory that survives a context reset without drifting
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 52.7k
- Forks
- 6.3k
- Ø Merge
- 25 Min.
- Gemergte PRs (30 T.)
- 6
Beschreibung
When a long-running agent rotates its context or restarts, whatever it wrote to its own memory has to mean the same thing on the way back in. In practice free prose drifts: the agent paraphrases its earlier note, softens a hard rule, or quietly drops a constraint. The failure is silent, which is the worst kind.
This is a reliability problem, separate from the token-cost work in #705. The technique I would write up is to store memory in a compact, structured notation with one fact per entry and an explicit shape, rather than as paragraphs. The structure does two things: it resists accidental rewriting (a malformed entry is visible), and it forces the agent to commit to a single unambiguous meaning when it writes, which is what makes the read deterministic later.
What the notebook would cover:
- A baseline: an agent that keeps prose memory, rotated across a simulated session boundary, and a measurement of how often a stored rule comes back changed.
- The same agent with structured one-fact-per-entry memory, and the drift rate after the same rotation.
- The two properties doing the work: a fixed entry schema (so a corrupted write is detectable) and a write discipline that rejects ambiguous phrasing.
- A short note on the cost side, since structured memory is usually also smaller, with a pointer to #705 for the cost-focused treatment so the two do not overlap.
It runs on the messages API with a small simulated session loop. Happy to scope it tighter if the reliability framing is more useful than the persistence one.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.