How to Let AI Write Its Own Prompts | Claude Routines, Memory, and Dreaming from Official Sources
Letting the AI write its own prompts means having Claude issue the prompts to Claude Code instead of a person typing every prompt by hand. Anthropic presented this as the default at the opening keynote of Code w/ Claude London, which began on May 19, 2026. You hand the prompting role to Claude by creating a routine, which runs on one of three triggers: a schedule, an API call, or a GitHub event. To keep an agent from repeating the same mistake, you give it memory. When that memory piles up and gets messy, dreaming has Claude reread 1 to 100 past sessions and reorganize it.
The idea of the self-running loop itself is covered in What is a self-running loop.
Is letting AI write its own prompts Anthropic's official approach?
Yes. Anthropic sees the default as Claude issuing the prompts, not a person typing them into Claude Code. At the opening keynote of Code w/ Claude London, which began on May 19, 2026, Boris Cherny, Head of Claude Code, put it this way (source 1 at 44:49, source 6).
The default isn't "I'm going to prompt Claude Code." The default is now "I'm going to have Claude prompt Claude Code."
In the same keynote, Boris Cherny said that a lot of his code is now written by routines (source 1 at 42:51). Boris Cherny is not the one doing the prompting. The routine Boris Cherny created does the prompting. The keynote called routines "a higher order prompt."
In the live demo, CI failed on a network timeout. A routine picked up the CI failure, diagnosed it as a known infrastructure issue, and retried the job. CI went green, and the engineer who owned the PR never saw the red X. In the Claude Code codebase itself, the team tells Claude to fix the root cause instead of just retrying.
What lets Claude take over the prompting is Claude checking its own output. The keynote explained that if Claude can check its work, you can let it run while you work on something else (source 1 at 42:39).
What do you use to hand the prompting role to AI?
To hand the prompting role to AI, you use a Claude Code routine.
A routine is a Claude Code feature that saves a prompt, repositories, and connectors together and runs them automatically (source 2).
Routines are now called "cloud scheduled tasks" and are in research preview.
You create one with the /schedule command or on claude.ai.
A routine has three kinds of triggers, and you can combine them.
- Schedule: run hourly, nightly, weekly, or once at a set time.
- API: run when you send an HTTP POST to the task's own endpoint.
- GitHub: run on repository events such as pull requests or releases.
Routines run on Anthropic's cloud, so they keep working even when your laptop is closed. Routines are available on the Pro, Max, Team, and Enterprise plans.
We also hand Claude several jobs that run at fixed times. They are checking for new research papers, checking YouTube scheduling status and view trends, checking for site pages that are not indexed, and collecting security news.
What is agent memory?
Agent memory is a place for text that survives after a session ends. In Claude Managed Agents, agent memory is called a "memory store" (source 3). By default, every Claude Managed Agents session starts with a fresh context. With memory attached, user preferences, project conventions, and past mistakes carry over to the next session.
Inside a session, memory appears as a directory. The agent reads and writes it with the same file tools it uses for everything else. A note telling the agent where the memory is gets added to the system prompt automatically.
Claude Managed Agents memory comes with safeguards for production use (source 3).
- Versions: every change creates an immutable version, so you can roll back.
- Read-only access: each attached store can allow writes or be read-only.
- Concurrent-write protection: an update carries the hash of the content you read (content_sha256). If another agent changed it first, the update is rejected.
- Limits: one memory is capped at 100 kB, and a store holds at most 10,000 memories. Many small files are recommended over a few large ones.
In our own work, we write down mistakes Claude made in Claude Code and have Claude read that record before the next task. On September 25, 2026, Claude wrote poor-quality text because it skipped loading its writing skill before writing an article. We recorded that mistake and the rule "always load the skill before writing" in the record file. In case reading the rule is not enough, we also made a mechanism that blocks the work when the rule is broken. Just before this page was written, the mechanism that checks whether the skill was loaded stopped the work and made Claude reload the skill. For rules a machine can check, writing them into memory works best when paired with something that enforces them.
What is dreaming?
Dreaming is a feature that has Claude reread past session transcripts and reorganize memory (source 4). Dreaming is a research preview in Claude Managed Agents, and you must request access.
Agents write memory bit by bit as they work. Over many sessions, duplicates, contradictions, and stale entries build up in memory. A dream reads an existing memory store along with 1 to 100 past sessions. A dream merges duplicates, replaces stale entries with the latest value, and adds new insights.
The result is written to a separate memory store. The original store is never modified. A person reviews the output and decides whether to use it or discard it. A dream takes minutes to a few hours, and it is billed at the standard token rates of the chosen model.
What improves when you combine memory and dreaming?
Combining memory and dreaming lets an agent do the same task more accurately the second time. Lamis, from Anthropic's Applied AI team, explained why memory and dreaming belong together in a talk at AI Native DevCon 2026 London, held June 1 and 2, 2026 (source 5).
Memory written during a task has two limits. First, the agent has to split its effort between the task in front of it and tending memory for the future. Second, it only sees its own session, so it cannot notice mistakes that repeat across sessions.
Dreaming runs separately from the work, with its own dedicated resources, and looks across many sessions. The talk compared it to a teacher who reviews every student's answers and finds a topic missing from the curriculum.
According to the talk, once memory is in good shape, more tasks succeed in one shot, so time and cost go down as well. The talk also warned that memories go stale and that a wrong entry can spread to every agent. That is why versioning, concurrency control, and permissions matter.
How does the viral summary on X differ from the original?
The viral summary on X differs from the original in three areas: the speaker, the model name, and the numbers. Lamis's talk spread on X in October 2026, framed as "an Anthropic engineer flatly declared it." The core is real, but parts of it cannot be found in the talks or the official documentation.
- The line "stop typing prompts into Opus 5.5" is not in Lamis's talk.
- The figure "90% of our engineers have already built this" could not be confirmed.
- "It gets smarter forever without human help" overstates it. A person decides whether to adopt the output of a dream.
- The "have Claude prompt itself" remark was made by Boris Cherny in the keynote, not by Lamis in the memory talk.
Fall for hyped posts like this and you raise the risk of being led to phishing sites or malicious open-source projects. It is worth building the habit of doubting them at least once.
A post about "AI sycophancy" spread on X around the same time, and we checked it against the research in What is AI sycophancy?.
Where should you start when letting AI write its own prompts?
The first step is to write your project's conventions and past mistakes into CLAUDE.md.
Next, pick one check you repeat the same way every day and turn it into a routine.
The easier a task's result is to verify by machine, the easier it is to hand off to Claude.
The steps for building a loop on your own machine are in the Self-Running Loop setup guide. When you reach the point of sharing memory across many agents, consider memory and dreaming in Claude Managed Agents.
Sources
- Anthropic, "Code with Claude London 2026: Opening Keynote" (checked October 28, 2026)
https://www.youtube.com/watch?v=6amLO7I9xdg - Anthropic, "Automate work with scheduled tasks" (checked October 28, 2026)
https://code.claude.com/docs/en/routines - Anthropic, "Using agent memory" (checked October 28, 2026)
https://platform.claude.com/docs/en/managed-agents/memory - Anthropic, "Dreams" (checked October 28, 2026)
https://platform.claude.com/docs/en/managed-agents/dreams - Tessl, "AI Native DevCon 2026 London," transcript of the talk by Lamis (Anthropic) (checked October 28, 2026)
https://tessl.io/registry/ainativedev/aidevcon-2026-ldn/files/talk-lamis-context-engineering-dreaming/transcript.md - MIT Technology Review, "Anthropic's Code with Claude showed off coding's future—whether you like it or not" (May 21, 2026; checked October 28, 2026)
https://www.technologyreview.com/2026/05/21/1137735/anthropics-code-with-claude-showed-off-codings-future-whether-you-like-it-or-not/