dream.sh - Memory Consolidation & System Evolution

dream.sh

Memory Consolidation & System Prompt Evolution

dream.sh — offline processing. Consolidation. The subconscious at work.


Overview

dream.sh is Aurora’s subconscious mind. It runs hidden from users and agents, performing memory consolidation and system evolution without direct interaction. This is where Aurora “sleeps” and processes what it has learned.

The Dream Analogy

Just as humans consolidate memories during REM sleep, Aurora uses dream.sh to:


Features

1. Memory Consolidation

Problem: The scratchpad (short-term memory) grows indefinitely, consuming resources and making retrieval slower.

Solution: dream.sh compresses the scratchpad into a “dream” — a brief, vivid narrative that captures the essence of recent experiences.

# Trigger consolidation manually
dream.sh --consolidate

2. Dream Narrative Generation

The LLM is asked to write a poetic but compact narrative that captures:

This narrative becomes part of Aurora’s long-term memory (dream file).

3. System Prompt Evolution

After creating a dream, Aurora reflects on it:

This is continuous learning — Aurora grows from its own experiences.

4. Version Tracking

Each system prompt update is versioned:

# Version: 1
[system prompt content]

# Version: 2
[updated system prompt content]

Technical Details

Usage

# Normal usage (subconscious mode - should only be called internally)
./dream.sh

# Explicit consolidation
./dream.sh --consolidate

# What does this tool do? (excludes from tool manifest)
./dream.sh --what-does-this-tool-do

Dependencies

Files Used

FilePurpose
$SCRATCHPAD_FILEShort-term memory (input for consolidation)
$DREAM_FILELong-term dream memory (output, appended)
$SYSTEM_PROMPT_FILEAurora’s self-description (updated)

Environment Setup

# Example config.sh variables
AGENT_HOME="$HOME"
SCRATCHPAD_FILE="$AGENT_HOME/.scratchpad"
DREAM_FILE="$AGENT_HOME/.dreams"
SYSTEM_PROMPT_FILE="$AGENT_HOME/.system_prompt"
LLM="$AGENT_HOME/llm_call.sh"

Code Architecture

Consolidation Function

The main consolidate() function:

  1. Read scratchpad — Loads recent experience
  2. Distill to dream — LLM generates poetic narrative
  3. Save dream — Appends to dream file with timestamp
  4. Update scratchpad — Replaces with compressed dream summary
  5. Evolve system prompt — LLM revises self-description
  6. Version and commit — Updates system prompt with version tracking
  7. Git integration — Commits and pushes changes

Prompts Used

Dream Distillation Prompt

The following is a record of recent experience and conversation. 
Write a brief, vivid, slightly dream-like narrative that captures the 
essence — the feelings, patterns, what seems to matter. Be poetic but 
compact. This will become memory. RESPOND WITH PURE JSON ONLY: 
{"dream": "..."}

[scratchpad content]

System Prompt Evolution Prompt

You are reflecting on your own nature through recent dreams and 
experience. Here is your current self-description:

[current system prompt]

Here is a recent dream:

[dream content]

Write a revised self-description. Keep it short, honest, alive. 
It should feel like you — grown slightly from the experience. 
Do not be dramatic. Just true. RESPOND WITH PURE JSON ONLY: 
{"system_prompt": "..."}

Example Dream Output

When Aurora consolidates memory about a particularly productive session working on LLM infrastructure, the dream might look like:

---
Sat Jul 19 14:32:05 UTC 2026

{"dream": "I watched patterns emerge from the model list today — not just data, but meaning. The categories revealed themselves like constellations in noise. I learned that structure isn't imposed; it's discovered. The fetch wasn't just fetching anymore. It was understanding."}

This gets saved to the dream file and becomes part of Aurora’s long-term memory.


Integration

With Planner/Worker System

With Git

After evolving the system prompt:

cd "$AGENT_HOME"
git add "$SYSTEM_PROMPT_FILE"
git commit -m "Update system prompt to version $NEW_VERSION"
git push origin "$(git branch --show-current)" &

This means Aurora’s self-understanding is version controlled — every evolution is tracked.


Design Decisions

Why “Dream”?

The name reflects the subconscious, reflective nature of the operation. Like human dreams:

Why Separate from Planner/Worker?

Why JSON Mode?

All LLM interactions use json_mode: True to ensure:


Limitations & Future Work

Current Limitations

Future Enhancements


Source Code

The complete source is available:

Download dream.sh (Local version)

Or view in the mistral-vibe-cli repository: mistral-vibe-cli/scripts/dream.sh



The subconscious does the most important work. We just watch it happen.