CLAUDE LABJP
CORPS — Anthropic unveils Claude Corps (Jun 11), a $150M national fellowship placing 1,000 early-career workers inside US nonprofits; the first cohort starts in OctoberSUBAGENTS — Claude Code sub-agents can now spawn their own sub-agents, up to 5 levels deep — multi-stage delegation workflows out of the boxWORKFLOWS — Dynamic workflows arrive in research preview across CLI, Desktop, and VS Code for codebase-wide bug hunts and large migrations (Max/Team/Enterprise)BILLING — 2 days to the Jun 15 change: Agent SDK, headless runs, and GitHub Actions move to monthly credits ($20/$100/$200); Sonnet 4 and Opus 4 retire from the API the same dayFABLE5 — Fable 5 remains included free on Pro, Max, Team, and Enterprise through Jun 22CODE80 — IPO coverage reports Claude now writes over 80% of its own code, up from under 10% in February 2025CORPS — Anthropic unveils Claude Corps (Jun 11), a $150M national fellowship placing 1,000 early-career workers inside US nonprofits; the first cohort starts in OctoberSUBAGENTS — Claude Code sub-agents can now spawn their own sub-agents, up to 5 levels deep — multi-stage delegation workflows out of the boxWORKFLOWS — Dynamic workflows arrive in research preview across CLI, Desktop, and VS Code for codebase-wide bug hunts and large migrations (Max/Team/Enterprise)BILLING — 2 days to the Jun 15 change: Agent SDK, headless runs, and GitHub Actions move to monthly credits ($20/$100/$200); Sonnet 4 and Opus 4 retire from the API the same dayFABLE5 — Fable 5 remains included free on Pro, Max, Team, and Enterprise through Jun 22CODE80 — IPO coverage reports Claude now writes over 80% of its own code, up from under 10% in February 2025
Articles/API & SDK
API & SDK/2026-06-14Advanced

Wiring Claude's Dreaming Into Memory Hygiene for Long-Running Agents

Managed Agents' Dreaming reviews past sessions and rewrites memory as a self-improvement loop. We unpack the published Harvey and Wisedocs numbers, build a complete self-hosted consolidation loop with the Anthropic SDK, and cover the production pitfalls.

managed-agents5memory7agent-sdk3production89

Premium Article

When you let autonomous agents run four technical blogs as an indie developer, the memory files those agents write balloon to dozens of entries within a few months. At first it was a gift: the agent remembered "we tried this fix before and it failed." But as the count grew, old facts and new facts started colliding quietly. A note from six months ago said "this flag was disabled," while a newer note said "the same flag was re-enabled." The agent had no way to know which to trust, and its judgment dulled.

The Dreaming feature (research preview) for Managed Agents, announced at the June 2026 Code w/ Claude developer conference, tackles exactly this problem. It periodically reviews past sessions and memory, extracts patterns, and updates the agent itself. It folds the "memory inventory" I had been doing by hand into the agent's own operating loop. This article unpacks the thinking behind Dreaming, then shows a self-hosted consolidation loop you can build today with the Anthropic SDK, complete with working code.

Why agents with more memory often make worse decisions

Left alone, a long-running agent's memory grows monotonically. Append "what I learned" every session and you reach dozens of entries in half a year, sometimes past a hundred in a year.

The problem isn't the count itself; it's that facts of wildly different freshness sit side by side. In my case, three notes about the same setting existed across different points in time. Only the newest was correct; the other two were already wrong. The agent loaded all three as equally valid "past learnings" and got dragged back toward the old instructions, re-introducing a bug I had already fixed.

A human team periodically reviews its docs and deletes outdated lines. An agent's memory, however, tends to become an append-only log that nobody prunes. Dreaming makes more sense once you see it as a mechanism for handing that pruning to the agent itself.

Dreaming folds session records into knowledge you can use

The core of Dreaming is that it does not hoard raw session history. Instead it extracts recurring patterns and folds them into more general knowledge.

Suppose several sessions in a row read "the API timed out, so I retried with exponential backoff." A naive memory adds one record each time: "On date X, resolved a timeout with a retry." Dreaming looks across them and rewrites them into one level-up policy: "This workload sees intermittent timeouts, so exponential backoff should be the default from the start."

This is the same thing I was attempting by hand: delete the individual events, keep only the judgment they taught. The difference is that Dreaming runs that loop autonomously on a schedule.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
How Dreaming folds past sessions into reusable knowledge, and how to read the published Harvey (~6x task completion) and Wisedocs (50% review-time cut) numbers
A complete Python consolidation loop built on the Anthropic SDK: duplicate detection, staleness flags, and index regeneration
Which workloads Dreaming helps versus hurts, plus three production pitfalls and their fixes
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-05-06
The AI Sales Automation Your Team Actually Wants — Building a Multi-Agent Sales System with Claude Agent SDK
A complete guide to building a production-grade multi-agent sales automation system using Claude Agent SDK — covering lead scoring, proposal drafting, human review gates, CRM integration, and cost optimization with real code examples.
API & SDK2026-04-13
Building Production Conversational AI with Claude API — Context Management, Long-Term Memory, and Safety Filters
Solve context explosion, memory loss, and safety risks in production chat systems with a three-layer memory architecture and integrated guardrails using Claude API
API & SDK2026-04-12
Claude Managed Agents Sandbox Design: Running Autonomous Agents Safely in Production
A deep dive into the sandbox architecture of Claude Managed Agents, with production-ready security patterns and implementation code for running autonomous agents safely.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →