04.21Memory
Dream: Claude Code skill for agent memory consolidation
Claude Code skill for agent memory consolidation, adapted at AR Labs from OpenClaw's Dreaming: a weekly pass over session transcripts writes a dated record.
Dream is a Claude Code skill AR Labs uses for memory consolidation across agent sessions, adapted from the Dreaming feature in OpenClaw, an open-source agent runtime that consolidates short-term memory the same way. Each session starts fresh, so what one session learned, decided or left unfinished is lost to the next unless something carries it forward. Once a week, the skill reads that week's session transcripts, picks out the threads that recurred and mattered, and writes a dated weekly record: what happened, what was decided, what is unfinished, and what is worth remembering. It then hands a short synthesis to our strategy agent as input to its weekly review.
We built the skill, but the shape is borrowed: its three phases named after stages of sleep, and its six weighted scoring signals, come from OpenClaw's Dreaming. We applied that design to a different input: a week of raw Claude Code transcripts rather than a running agent's recall history.
How it works
The cycle has three phases, followed by a hand-off. A person starts it by hand; it does not run on a schedule.
flowchart LR T["A week of transcripts"] --> L["Light sleep: survey"] L --> R["REM: extract key threads"] R --> D["Deep sleep: score and gate"] D --> W["Weekly dream record"] W --> C["Feed the strategy agent"]
Choose the range. A week number or date span can be given. By default the skill covers the weeks from the last record up to the last complete calendar week. A gap of several weeks produces one record per week rather than one blurred account.
Light sleep: survey. A Python script compresses the week's raw event logs, around 30 MB of JSON lines, into a markdown outline of roughly 100 KB: the sessions, every prompt, the files touched, the subagents launched, and each session's closing summary. We call this outline the survey. The raw logs are never read into the main conversation.
REM: extract. One subagent per week reads the survey and pulls deeper detail on only the five to eight most significant threads, from the transcripts or with a topic-extraction script. Reading is capped at about eight deep extractions, so the agent reads, condenses and lets go. Several weeks run in parallel, one subagent each.
Deep sleep: score and gate. Each candidate thread is scored on six weighted signals:
| Signal | Weight | What it measures |
|---|---|---|
| Relevance | 0.30 | How central it is to active goals and projects |
| Frequency | 0.24 | How many sessions it appeared in |
| Recency | 0.15 | Later sessions count for more |
| Query diversity | 0.15 | How many different contexts it surfaced in |
| Conceptual richness | 0.10 | How many topics it connects |
| Novelty | 0.06 | Whether existing memory already holds it |
A candidate is promoted only if all three gates pass: a score of at least 0.7, an appearance in two or more sessions, and nothing equivalent already recorded. Retries, ticks from unattended loops and one-off chatter are filtered out.
Write and hand off. The weekly record has fixed sections: a narrative of the week, recurring themes, key decisions, unfinished threads, insights worth remembering, project activity, and risks. A dated entry then goes into the strategy agent's memory with the pattern across weeks, the decisions already made (so the weekly review does not reopen them), and a numbered list of flags for review. An optional HTML dashboard shows the same material for multi-week catch-ups.
The judgement it encodes
Recurrence is the signal. Something that came up once is noise until it comes up again. The two-session gate keeps the record from filling with passing remarks.
Compress the input, not the output. The survey is close enough to the transcripts to cite, and the record names real decisions, files and tasks. The skill lists five ways agent memory fails: summaries drift from what happened, memory goes stale without anyone noticing, wrong content poisons later context, a pipeline step fails silently, and archives bloat. Its counters are to keep the survey verbatim, cite where each claim came from, and prefer a specific statement to a compressed one.
Decisions are banked. Recording what was decided stops the next review from relitigating it.
One exemplar record sets the format. New records match one chosen earlier record in structure, voice and density, so weeks can be compared.
What exists today
The skill is in use. It has produced about a dozen weekly records from our own sessions, which sit in our history beside the transcripts they summarise. It is started by hand. Loading the latest record automatically at the start of each session, and moving to a dedicated memory store, are planned and not built. The transcript-search scripts it uses are also available to ordinary sessions for questions such as "what did we decide about this last month?".
Example
Illustrative example, written in the format of a real record but not taken from one. Part of a weekly record:
---
week: 2026-W30
period: 2026-07-20 to 2026-07-26
sessions_analysed: 31
type: dreaming-cycle
---
## Key Decisions Made This Week
- Tuesday: the export feature ships as one pull request; tracking
stays split into three tasks.
- Thursday: diagrams in public pages use the shared theme file, not
hand-copied colours.
## Unfinished Threads
- Transcript export: the empty-transcript state was discussed in two
sessions and never specified. Carry-over cost: the review stage
will stop on it.
## Flags for review
1. Three sessions this week rebuilt the same diagram styling by hand.Referenced by 04
- ProjectsAI strategy agent: planning reviews from the year down to the daylinks here in its text
- SkillsStrategy agent skills: planning cadences and escalationlinks here in its text
- SkillsStrategic alignment: Claude Code skill for prioritisationlists this as related
- OperationsSession history and memory for AI coding agentslinks here in its text