Clandestine Hours

← All notes

GuideTechnical teams

What agents do while they sleep

Some agents now have a second mode that runs between sessions: they read back their own work, fix their notes and save what worked as skills. The technique, the research behind it, and its caveats.

At a glance

What it is
A mode that runs between sessions: the agent reviews its transcripts, corrects its notes and saves procedures as skills
Where it ships
Claude Managed Agents (dreaming), Letta (sleep-time agents), Hermes Agent (background review)
Main risk
A wrong note or an unsafe skill is reused in every later session
Sources
Papers, vendor posts and documentation, linked in the text and at the end

An agent does its work in sessions. When a session ends, most agents forget what happened in it. Some keep notes that the next session reads. Those notes are written in the middle of the work, and some of them are wrong.

A second mode is now showing up in products and papers. It runs when nobody is waiting for an answer. The agent reads back what it did, corrects its notes and saves the procedures that worked so it can use them again. Anthropic calls this dreaming. Letta calls it sleep-time compute. Nous Research’s Hermes Agent runs a background review after a session.

This note covers two things that come out of that mode. The first is self-healing, where the agent repairs its own memory and instructions. The second we call skillification, where work the agent keeps repeating becomes a skill it can load next time. Both can make an agent better at its work, and both have caveats, which the last part of this note covers.

One wake and sleep cycle of an agent Session does the task saves transcript Review reads transcripts proposes edits Approve automatic or a person Memory, skills notes fixed steps saved read at the start of the next session wake sleep blue border: the agent edits its own memory
The agent works in a session and keeps the transcript. Between sessions it reads the transcripts back and proposes changes to its notes and skills. The changes are applied automatically or after a person approves them, and the next session starts from the new version.

Where the names come from

The names come from older research. In 1995, Geoffrey Hinton, Peter Dayan, Brendan Frey and Radford Neal published the wake-sleep algorithm for neural networks. It trains a network in two alternating phases. In the wake phase, real data adjusts one set of connections. In the sleep phase, the network generates its own data and uses it to adjust the other set.

DreamCoder, presented at PLDI in 2021 by Kevin Ellis and colleagues, used the same rhythm for writing programs. While awake, it solves tasks with the library of functions it has so far. While asleep, it looks across its solutions for parts that repeat, adds them to the library as new functions, and trains its search on problems it makes up, which the authors call dreams. The authors report that learning the library and the search together solved more problems, and solved them faster, across eight domains.

Thinking ahead while idle

In April 2025, researchers from Letta and UC Berkeley published Sleep-time Compute. Their agent reads the context it already has before any question arrives and works out what it is likely to be asked. On two maths benchmarks built for this, they report that the same accuracy needed about five times less compute at question time. When several questions shared one context, the cost per question fell by 2.5 times. The method helped most when the questions were predictable.

Letta ships this as a second agent that runs next to the main one and works on its memory in the background. The two can use different models: a fast one to reply, and a slower, stronger one to work between turns.

Dreaming in Claude agents

Anthropic launched dreaming in Claude Managed Agents on 19 May 2026, as a research preview. It is a scheduled process that reviews past sessions and the agent’s memory, looks for recurring mistakes and workflows, and rewrites the memory. It can apply the changes itself or hold them for a person to review. Anthropic reports that Harvey, a legal AI company, saw completion rates rise about six times in its own tests.

On 6 November 2026, Anthropic’s engineering team published The components of agent memory, with several experiments. In one, Claude was playing Pokémon with a note that put a Pokémon Center on the wrong side of a mountain. Dreaming checked the note against the original transcript and fixed it, and that run reached the next city. In another, Claude built a wiki from about 350,000 internal files of a software company, Stainless. As dreaming ran over more sessions, from 2 to 128, the wiki’s score on 25 questions rose from 13% to 48% of the graded criteria.

The post treats the transcript as the ground truth. A note can be wrong from the start or drift as things change, and the transcript is what the agent checks it against.

Self-healing

Self-healing here means the agent finds and fixes errors in its own notes and instructions. The Pokémon note is the simplest case. The same post describes a larger one. On a task about contract terms, Claude reflected on its failures, proposed a change to its own instructions for building the wiki, and rebuilt it. The new layout, one page per contract with the terms quoted word for word, kept all 57 facts. The shared table it replaced had kept 41.

In both cases the change was made to the memory and instructions that the next session reads.

Skillification

A skill is a saved procedure. Anthropic introduced Agent Skills on 16 October 2025 as folders of instructions, scripts and resources that Claude loads when a task needs them. People usually write them, and Claude can help through a skill that builds skills.

Agents writing their own skills goes back at least to Voyager in 2023. Voyager played Minecraft and stored each behaviour that worked as code in a growing skill library, which it reused in new worlds. Its authors report 3.3 times more unique items than the previous best method, and key milestones reached up to 15.3 times faster.

Hermes Agent writes skills as it works. Its documentation asks the agent to save a skill after a multi-step workflow worth repeating, after it hit errors and found the path that worked, and after a user corrected its approach. It prefers small patches to full rewrites, and an approval setting holds new skills until someone accepts them.

Caveats

Most of the figures above come from the people who built each method, on tasks they chose. Sleep-time compute was tested on benchmarks built for it, and helped most when the questions were predictable. The Harvey figure is Anthropic’s report of a customer’s own tests. Dreaming in Claude Managed Agents is a research preview.

A wrong note is read in every later session, and an unsafe skill is reused the same way. In Practice Makes Unsafe (August 2026), Xutao Mao and colleagues tested 21 combinations of agents and skill-learning methods. All 21 wrote unsafe skills. In 15, the harm carried into a new session, where a harmless request reused the unsafe step. Their fix checks each skill twice, when it is written and when it is retrieved. In their tests, that cut harm in new sessions from 21.3% to 4.0%.

Anthropic’s post lists other failures. One wiki grew to 1.77 times the size of the files it summarised. Agents writing to one shared page erased each other’s work. A rule to record only failures reduced the gain from memory. Dreaming also costs compute, and the post notes that checking every memory all the time may not be practical.

What we do

We use coding agents in our own work and keep a small, manual version of this. The agent proposes changes to its notes and skills, and we read each one before it is kept.

Try this

  1. Keep the transcripts. Without them the agent has nothing to check its notes against.
  2. Pick one workflow the agent repeats. After a session, ask it to propose changes to its notes and to one skill.
  3. Read the proposed changes as a diff before they are applied.
  4. Check each new skill when it is written, and again the first time it runs on a new task.
  5. Delete notes that no longer match how things are.

Sources

  1. Hinton, Dayan, Frey and Neal, “The wake-sleep algorithm for unsupervised neural networks”, Science, 1995. cs.toronto.edu
  2. Ellis et al., “DreamCoder: Bootstrapping Inductive Program Synthesis with Wake-Sleep Library Learning”, PLDI 2021. dspace.mit.edu
  3. Lin, Snell, Wang, Packer, Wooders, Stoica and Gonzalez, “Sleep-time Compute: Beyond Inference Scaling at Test-time”, April 2025. arxiv.org
  4. Letta, Sleep-time Compute, 2025. letta.com
  5. Claude, New in Claude Managed Agents: dreaming, outcomes, and multiagent orchestration, 19 May 2026. claude.com
  6. Anthropic, The components of agent memory, 6 November 2026. anthropic.com
  7. Claude, Introducing Agent Skills, 16 October 2025. claude.com
  8. Wang et al., “Voyager: An Open-Ended Embodied Agent with Large Language Models”, 2023. arxiv.org
  9. Nous Research, Hermes Agent documentation, Skills (accessed November 2026). hermes-agent.nousresearch.com
  10. Mao, Zhao, Zheng and Wang, “Practice Makes Unsafe: Skill Misevolution in Self-Improving LLM Agents”, August 2026. arxiv.org