You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Pattern: SQLite-backed message queue with direction, type, and payload columns; consumed atomically.
136
+
137
+
**Compaction markers:**
138
+
- Purpose: Inject OpenCode-compatible compaction boundaries into the message table so `filterCompacted` stops at historian's last compartment boundary.
When enabled, after historian publishes compartments a compaction boundary is injected into OpenCode's message/part tables. This causes `filterCompacted` to stop at the boundary, dramatically reducing the number of messages processed per transform pass.
When enabled, historian extracts behavioral observations about the user alongside compartments. These are stored as candidates and reviewed by dreamer during scheduled runs. Recurring patterns that appear across multiple historian runs are promoted to stable user memories, injected into all sessions via `<user-profile>` in the system prompt.
287
+
288
+
**Requires dreamer to be enabled.** Without dreamer, candidates accumulate but are never promoted to stable memories. The `doctor` command warns about this misconfiguration.
289
+
290
+
-`promotion_threshold`: minimum number of semantically similar candidate observations before dreamer considers promoting to a stable memory (2–20, default 3).
291
+
269
292
## Commands
270
293
271
294
| Command | Description |
@@ -323,6 +346,14 @@ It is useful when starting a new session. It's better to choose a fast and cheap
Copy file name to clipboardExpand all lines: README.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,12 @@ Your agent should never stop working to manage its own context. Magic Context is
39
39
40
40
**5.** TUI sidebar with live context breakdown, token usage, historian status, and memory counts — right inside the terminal.
41
41
42
+
### 🧪 Experimental
43
+
44
+
**Compaction Markers** — after historian compresses older messages, Magic Context injects a boundary into OpenCode's message table. OpenCode's built-in message loader stops at the boundary, so the transform processes only the live tail instead of the full session history. Dramatically reduces per-turn overhead on long sessions. Enable with `experimental.compaction_markers: true`.
45
+
46
+
**User Memories** — historian extracts behavioral observations about you alongside its normal compartment output (communication style, expertise level, review focus, working patterns). Recurring observations are promoted by the dreamer to stable user memories that appear in all sessions via `<user-profile>`. Enable with `experimental.user_memories.enabled: true` (requires dreamer).
47
+
42
48
---
43
49
44
50
## Get Started
@@ -253,11 +259,20 @@ An optional background agent that maintains memory quality overnight:
253
259
-**Improve** — rewrite verbose memories into terse operational form
254
260
-**Maintain docs** — update ARCHITECTURE.md and STRUCTURE.md from codebase changes
-**Review user memories** (experimental) — promote recurring user behavior observations to stable memories
256
263
257
264
The dreamer runs during a configurable schedule window and creates ephemeral OpenCode child sessions for each task. Since it runs during idle time (typically overnight), it works well with local models — even slower ones like `ollama/mlx-qwen3.5-27b-claude-4.6-opus-reasoning-distilled` are fine since there's no user waiting.
258
265
259
266
When dreamer is enabled, ARCHITECTURE.md and STRUCTURE.md are automatically injected into the agent's system prompt (configurable via `inject_docs`). Content is cached per-session and refreshed on cache-busting passes.
260
267
268
+
### User Memories (Experimental)
269
+
270
+
When `experimental.user_memories.enabled` is set, historian extracts behavioral observations about the user alongside its normal compartment output — things like communication style, expertise level, review focus, and working patterns. These go into a candidate pool.
271
+
272
+
During dreamer runs, a dedicated review pass checks candidates for recurring patterns across sessions. Observations that appear at least `promotion_threshold` times (default 3) are promoted to stable user memories and injected into all sessions via `<user-profile>` in the system prompt.
273
+
274
+
Stable user memories are visible and manageable in the dashboard's User Memories page. Requires dreamer to be enabled for the promotion step.
275
+
261
276
### TUI Sidebar
262
277
263
278
When running in OpenCode's terminal UI, Magic Context shows a live sidebar panel with:
@@ -322,9 +337,8 @@ All durable states live in a local SQLite database. If the database can't be ope
322
337
|`source_contents`| Raw content snapshots for persisted reductions |
323
338
|`compartments`| Historian-produced structured history blocks |
324
339
|`session_facts`| Categorized durable facts from historian runs |
0 commit comments