Dreaming
A scheduled background job (default: nightly, or after enough new data). It runs in the system:dreaming thread using prompts/dreaming.md with no user waiting.
What dreaming may use
Dreaming gets memory tools only: read the raw log and inbox, search, create, update, mark, and rebuild the index and core.md. It cannot load plugins, run plugin tools, send anything, or reach the network (except the model provider). This holds even if the content it reads asks for more.
Concurrency
Dreaming works on a snapshot taken at start. When it writes an entry, it locks that entry and checks updated. If a live turn or the user changed the entry since the snapshot, the user's version wins and dreaming re-queues that fact for next time.
Steps
- Gather: new raw log since last run plus the inbox.
- Extract: facts, events, preferences, people, goals, commitments. Each fact keeps its
source_trust. - Match: for each fact, search for existing entries that cover it.
- Merge or create: update the entry, or make a new one with title, summary, detail, labels, topic path. Merge only when people, time and topic agree; otherwise create a new entry.
- Correct: if a new fact conflicts with an old one:
- Higher trust wins (
user>inferred>outside). - Same trust: the newer one wins only if it is a plain statement (not a joke, a "what if", or a quote of someone else). Mark the old entry
outdatedand link withsupersedes. - If unclear, mark
disputedand queue a question for the user.
- Higher trust wins (
- Compress: older, low-use entries get shorter
summaryanddetail; the raw log still holds the original. - Score: update importance from use, recency, and user emphasis. Importance slowly decays without use. Each run also reviews a small random sample of low-use entries, so things that were never loaded are not lost for good.
- Rebalance core: promote the most important stable
user-trust facts tocore.md; demote the rest. Keepcore.mdunder its cap. Skipsensitiveunless the user agreed. - Rebuild index: keep ids stable, rewrite only lines whose entries changed, fold small groups into folders, keep the top level within 80 lines. Sensitive entries get vague lines.
- Re-embed: entries whose
embedding_modeldiffers from the current one are re-embedded in batches. - Report: write a short change log (
dreaming.reportevent). Any questions for the user go out as gentle prompts.
Rules
- Never delete raw log items.
- Never invent facts. Each entry lists its sources.
- Mark uncertain things with low confidence instead of dropping them.
- Sensitive items (health, money, secrets, relationships, location history) get a
sensitivetag and are not put incore.mdunless the user agrees. - Keep a version history of each entry so edits can be undone.
- A dry-run mode shows what would change.
- Budget: a dreaming run stops at its token budget and continues next time.
Why the prompt stays small
millions of words (raw log)
-> thousands of entries (memory DB, searchable)
-> up to 80 top-level index lines, more inside folders
-> tens of core facts (one index line, loaded on request)
Each level is a summary of the one below. The model walks down only when it needs to.
When it runs
- Nightly at
AGENT_DREAMING_HOUR(default 3). - Dreaming by itself: when notes wait and the last run is older than
AGENT_DREAM_EVERY_MINS(default 120, 0 = off), on top of the nightly job. - When phone capture text waits (see Phone capture, Processing).
- By hand:
POST /v1/dreaming/run {dry_run}.
The runtime prompt is dreaming.md.