@@ -24,6 +24,8 @@ Claude Code writes memory → OpenCode reads it. OpenCode writes memory → Clau
2424 Install + enable plugin, then keep using ` opencode ` as usual.
2525- ** Local-first, no migration**
2626 Memory stays as local Markdown files in the same directory Claude Code already uses.
27+ - ** Auto-dream consolidation**
28+ Periodically runs a background memory consolidation pass (Claude-style auto-dream gating).
2729
2830## 🚀 Quick Start
2931
@@ -36,7 +38,7 @@ opencode-memory install # one-time: installs shell hook
3638
3739This installs:
3840- The ** plugin** — memory tools + system prompt injection
39- - The ` opencode-memory ` ** CLI** — wraps opencode with post-session memory extraction
41+ - The ` opencode-memory ` ** CLI** — wraps opencode with automatic memory extraction + auto-dream consolidation
4042- A ** shell hook** — defines an ` opencode() ` function in your ` .zshrc ` /` .bashrc ` that delegates to ` opencode-memory `
4143
4244### 2. Configure
@@ -54,7 +56,7 @@ This installs:
5456opencode
5557```
5658
57- That’s it. Memory extraction runs in the background after each session.
59+ That’s it. Memory extraction runs in the background after each session, and auto-dream consolidation is checked with time/session gates .
5860
5961To uninstall:
6062
@@ -92,17 +94,22 @@ graph LR
9294 B --> C[opencode-memory finds real binary]
9395 C --> D[Runs opencode normally]
9496 D --> E[You exit]
95- E --> F[Fork session + extract memories]
96- F --> G[Memories saved to ~/.claude/projects/]
97+ E --> F[Extract memories if needed]
98+ F --> G[Evaluate auto-dream gate]
99+ G --> H[Consolidate memories if gate passes]
100+ H --> I[Memories saved to ~/.claude/projects/]
97101```
98102
99103The shell hook defines an ` opencode() ` function that delegates to ` opencode-memory ` :
100104
1011051 . Shell function intercepts ` opencode ` command (higher priority than PATH)
1021062 . ` opencode-memory ` finds the real ` opencode ` binary in PATH
1031073 . Runs it with all your arguments
104- 4 . After you exit, forks the session with a memory extraction prompt
105- 5 . Extraction runs ** in the background** — you're never blocked
108+ 4 . After you exit, it checks whether the session already wrote memory files
109+ 5 . If needed, it forks the session with a memory extraction prompt
110+ 6 . It evaluates the auto-dream gate (default: at least 24h since last consolidation and 5 touched sessions)
111+ 7 . If the gate passes, it runs a background consolidation pass to merge/prune memories
112+ 8 . Maintenance runs ** in the background** unless ` OPENCODE_MEMORY_FOREGROUND=1 `
106113
107114### Compatibility details
108115
@@ -137,22 +144,35 @@ File-based memory is transparent, local-first, easy to inspect/diff/back up, and
137144
138145Yes. Set ` OPENCODE_MEMORY_EXTRACT=0 ` .
139146
147+ ### Can I disable auto-dream?
148+
149+ Yes. Set ` OPENCODE_MEMORY_AUTODREAM=0 ` . You can also tune gates with:
150+ - ` OPENCODE_MEMORY_AUTODREAM_MIN_HOURS `
151+ - ` OPENCODE_MEMORY_AUTODREAM_MIN_SESSIONS `
152+
140153## 🔧 Configuration
141154
142155### Environment variables
143156
144- - ` OPENCODE_MEMORY_EXTRACT ` (default ` 1 ` ): set ` 0 ` to disable auto- extraction
145- - ` OPENCODE_MEMORY_FOREGROUND ` (default ` 0 ` ): set ` 1 ` to run extraction in foreground
157+ - ` OPENCODE_MEMORY_EXTRACT ` (default ` 1 ` ): set ` 0 ` to disable automatic memory extraction
158+ - ` OPENCODE_MEMORY_FOREGROUND ` (default ` 0 ` ): set ` 1 ` to run maintenance in foreground
146159- ` OPENCODE_MEMORY_MODEL ` : override model used for extraction
147160- ` OPENCODE_MEMORY_AGENT ` : override agent used for extraction
161+ - ` OPENCODE_MEMORY_AUTODREAM ` (default ` 1 ` ): set ` 0 ` to disable auto-dream consolidation
162+ - ` OPENCODE_MEMORY_AUTODREAM_MIN_HOURS ` (default ` 24 ` ): min hours between consolidation runs
163+ - ` OPENCODE_MEMORY_AUTODREAM_MIN_SESSIONS ` (default ` 5 ` ): min touched sessions since last consolidation
164+ - ` OPENCODE_MEMORY_AUTODREAM_MODEL ` : override model used for auto-dream
165+ - ` OPENCODE_MEMORY_AUTODREAM_AGENT ` : override agent used for auto-dream
148166
149167### Logs
150168
151- Extraction logs are written to ` $TMPDIR/opencode-memory-logs/extract-*.log ` .
169+ Logs are written to ` $TMPDIR/opencode-memory-logs/ ` :
170+ - ` extract-*.log ` : automatic memory extraction
171+ - ` dream-*.log ` : auto-dream consolidation
152172
153173### Concurrency safety
154174
155- A file lock prevents multiple extractions from running simultaneously on the same project. Stale locks are cleaned up automatically.
175+ Lock files prevent concurrent extraction/consolidation runs per project root . Stale locks are cleaned up automatically.
156176
157177## 📝 Memory format
158178
0 commit comments