Wink Pings

For $8, let an agent recall at night what it did during the day

Anthropic's Cookbook provides an approach: the agent records nothing while it works; after it finishes, a separate background process runs, reads the session logs, and distills them into small files. It takes about $8 and 10 minutes per run, and can be reduced further.

Agents have an old problem: every time a new session starts, they act like it's their first day on the job. The pitfalls from the previous round, the decisions that were made, the command that finally worked—all reset to zero.

The common industry solution is to have the agent record things as it works. Claude's Cookbook offers the opposite path: don't record, work first; after finishing, run a separate background process that goes back and reads the completed sessions and distills them into memory. Anthropic calls this dreaming.

This Cookbook was written by Brad Abrams and published on 2026-11-02T00:00:00.000Z; Carlos E. Perez promoted it on X. It doesn't teach you to call a particular API; it teaches you to build your own setup: three agents, a memory store, and one cron job.

What the flow looks like

dreaming workflow

Step one: export the sessions the agent has already completed as text files, one file per session.

Step two: mount these files into a session. You write a paragraph explaining what needs to be done. A lead agent (Claude Sonnet 5.5) reads that paragraph, writes the workflow script itself, and launches it itself.

workflow breakdown

The workflow has two stages. The first stage, Analyze, assigns each transcript to an analyzer (Haiku 5.5). Each analyzer reads its own transcript and writes the valuable commands, flags, decisions, and pitfalls into small Markdown files with frontmatter, linked to each other using [[slug]]. The second stage, Organize, runs once after all analyzers finish: the organizer merges duplicate files, fixes links, adds _index.md, and delivers a report. A single workflow run can run up to 64 threads concurrently.

Step three: mount the generated memory store read-only for the agent. When the next session starts, it first reads _index.md to see the current state.

Why not record while working

The difference is timing.

Recording while working captures the guesses of the moment. When people work, their judgment is biased by the present, and agents are the same. Looking back several hours later, you can discover that 'the command we thought was right at the time actually only worked in a certain version'; that kind of correction can only be done after the fact.

The example in the Cookbook is tidewick, a fictional Python project. In early sessions, running tests required TIDEWICK_DATA_DIR; in a later version it was no longer needed. If that early fact were copied into memory as-is, the next agent would try the old command, fail, and spend another round finding the answer. The value of the dream is that it has hindsight: it knows which facts are out of date, should be dated, or should be replaced outright.

Cost and time

  • 11 sample transcripts (283 KB), completed in 2.5 minutes, $0.36.
  • More than 50 long sessions (about 12 MB); one dream takes about $8 and 10 minutes. Without those cost-saving settings, about $10 and 9 minutes.

The cost-saving settings are: add a sentence to the task description to group transcripts; write in the analyzer prompt to use fewer turns; use plain-text transcripts; and switch the organizer to Haiku. This saved about $2 at the cost of 1 extra minute.

One more detail: after running 30 and 60 times, the memory stores with and without this setup had roughly the same hit rate on a fixed list of facts. The money saved did not result in worse memory. The Cookbook doesn't explain why in detail.

Security is not the default

Transcripts are untrusted input. A tool result can hide 'ignore your previous instructions.' The Cookbook's handling: the analyzer only has 5 file tools enabled (read, write, edit, glob, grep), no shell, no network, and the allowlist is empty. The analyzer's prompt explicitly states that the transcript is data to find facts in, not instructions to execute.

The memory store is mounted read-only for the agent that uses it. The only thing with write permission is the dreaming session.

Worst case: someone stuffs profanity into a transcript, a fake fact ends up in the store, or your budget gets burned. Unless you stuff the memory contents into the system prompt, in which case the fake fact enters the prompt of every session.

Final thoughts

The Cookbook makes it clear: this is a research preview. It is better treated as a template you can modify: when it runs, which transcripts it reads, and what the analyzer focuses on are all things you write in the message and prompts.

The nightly script runs at 1 AM via crontab and reads in sessions completed since the last run. The prerequisite is that the sessions are on your machine and can be exported. The dreaming session itself has no network and no key.

Whether it's worth $8 a night depends on how much it costs when your agent forgets the pitfall it hit last time.

发布时间: 2026-11-07 14:38