brv dream. All changes are flagged for review before they can be pushed to your team.
Operations
Each dream runs three operations in sequence. Any operation can produce changes independently — a partial run still logs and surfaces its completed work.When a dream rewrites a context file, the order of frontmatter fields (
title, summary, tags, keywords, related, createdAt, updatedAt) is preserved, and array fields like tags and related are emitted flow-style (tags: [a, b, c]) to match brv curate. brv vc diff only surfaces real content changes — not field reorderings or bracket reflows.Consolidate
Consolidate groups files that changed since the last dream by domain, then uses BM25 search and sibling-file analysis to find related content. A single LLM call per domain classifies relationships and decides on an action:
Merged files receive
consolidated_at and consolidated_from metadata in their frontmatter, preserving lineage. Source files are deleted after the merge.
Synthesize
Synthesize reads_index.md domain summaries to identify patterns that span multiple domains. It skips if fewer than two domains exist. Candidates are deduplicated against existing synthesis files using BM25 (threshold: 0.5) to avoid repeating insights already captured.
Novel syntheses are written as draft knowledge files with type: synthesis in the frontmatter:
confidence, sources, synthesized_at, type) come first — they match the on-disk shape of pre-existing synthesized files so re-generating an old file does not produce a mechanical reorder diff. The seven semantic fields below mirror the order regular brv save files use, so the dashboard’s context cards render full title, summary, and tags. related is left empty because synthesized files use sources for provenance.
Synthesis files with confidence below 0.7 are flagged for review.
Prune
Prune identifies files that have become stale or low-value using two signals:
Candidates are capped at 20 per dream (stalest first). The LLM reviews each candidate with a content preview and decides:
When Dreaming Triggers
Before a dream can run, it must pass four sequential eligibility gates:
The daemon checks gates 1–3 before dispatching. The agent process acquires the lock (gate 4) at execution time. Stale locks older than 30 minutes are automatically reclaimed.
When a gate fails,
brv dream reports the reason:
Commands
In the foreground, press
Ctrl+C once to gracefully cancel a running dream (stderr shows Cancelling task... (Ctrl-C again to force exit)); a second press hard-exits with code 130. Inside the REPL, Ctrl+Q cancels the active curate, query, or dream task.Dream State
ByteRover tracks dream metadata indream-state.json:
All writes to this file are serialized by a per-file mutex to prevent concurrent curate tasks from losing counter increments.
Dream Logs
Each dream is logged to.brv/dream-log/drm-{timestamp}.json with a status, the full list of operations, and a summary:
The summary section provides quick counts:
partial.
Cross-Cycle Behavior
Prune may suggest merging file A into file B, but consolidate has already run in the current cycle. These suggestions are stored aspendingMerges entries in dream-state.json and consumed by consolidate in the next dream:
- Consolidate reads
pendingMergesas non-binding hints - Adds suggested source files to its changed-file set (if they still exist on disk)
- Passes the hints to the LLM alongside its own analysis
- Clears
pendingMergesregardless of whether the LLM acted on them
Undo
brv dream --undo reverts the most recent dream. It restores all modified, merged, or deleted files from backups and dream log data:
After undo, the dream log is marked
undone, the dream counter is decremented, and any associated review entries are marked as rejected.
Review Integration
All dream operations that modify the context tree are dual-written as review entries, making them visible inbrv review pending alongside regular curation changes. Each entry includes the operation type and reasoning: