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
Copy file name to clipboardExpand all lines: CONFIGURATION.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Configuration Reference
2
2
3
-
All settings are flat top-level keys in `magic-context.jsonc`. The schema is **shared between the OpenCode plugin and the Pi extension** — every setting documented here applies to both unless explicitly marked **Pi only** or **OpenCode only**.
3
+
All settings are flat top-level keys in `magic-context.jsonc`. The schema is shared by the OpenCode plugin and the Pi-compatible extension used on both Pi and OMP.
4
4
5
5
### Configuration locations
6
6
7
-
Magic Context reads config from **one shared CortexKit location**, the same for both harnesses (project overrides user):
7
+
Magic Context reads config from one shared CortexKit location across OpenCode, Pi, and OMP (project overrides user):
8
8
9
9
| Path | Scope |
10
10
|---|---|
@@ -19,12 +19,12 @@ Project config always merges on top of user config. The unified setup wizard (`n
19
19
20
20
Both plugins write to the same SQLite database at `~/.local/share/cortexkit/magic-context/context.db`. Tables are scoped by:
21
21
22
-
-`harness` column (`'opencode'` or `'pi'`) for **session-scoped** data — tags, compartments, session facts, notes
22
+
-`harness` column (`'opencode'` or `'pi'`) for **session-scoped** data — OMP intentionally uses the Pi-compatible `'pi'` discriminator
23
23
-`project_path` (resolved git root) for **project-scoped** data — memories, embeddings, dreamer runs, key-file pins, smart notes
24
24
25
-
So memories you write in OpenCode appear in Pi sessions for the same project (and vice versa), while per-session compartments and tags stay correctly attributed to their originating harness.
25
+
Project memories therefore flow across OpenCode, Pi, and OMP, while per-session state remains scoped to the OpenCode or Pi-compatible runtime.
26
26
27
-
For semantic search to work cross-harness, both plugins resolve embedding config per project identity on every retrieval path. OpenCode and Pi can run in the same process against different projects without sharing one process-global embedding provider. For one project, keep the effective `embedding` block consistent across the OpenCode and Pi config stack; Magic Context tags stored vectors with the resolved model identity and clears stale vectors for that project when the provider/model changes.
27
+
For semantic search to work cross-harness, every host resolves embedding config per project identity on each retrieval path. Keep the effective `embedding` block consistent across OpenCode, Pi, and OMP for the same project.
28
28
29
29
### JSON Schema
30
30
@@ -43,19 +43,22 @@ Both setup wizards add this automatically.
43
43
If something isn't working, run the unified doctor to auto-detect installed harnesses and fix common issues:
44
44
45
45
```bash
46
-
# Auto-detect installed harnesses; if both, picks the first or asks
46
+
# Auto-detect installed harnesses; if multiple are present, pick or prompt
47
47
npx @cortexkit/magic-context@latest doctor
48
48
49
49
# Target a specific harness explicitly
50
50
npx @cortexkit/magic-context@latest doctor --harness opencode
51
51
npx @cortexkit/magic-context@latest doctor --harness pi
52
+
npx @cortexkit/magic-context@latest doctor --harness omp
52
53
```
53
54
54
55
The OpenCode doctor checks: installation, CLI version vs npm latest, plugin registration (preserves local dev paths), `magic-context.jsonc` parses + loads through the schema, conflicts (compaction, DCP, OMO hooks), TUI sidebar configuration, embedding endpoint, shared-DB existence + `PRAGMA integrity_check` + row counts, plugin npm cache, and historian debug dumps.
55
56
56
57
The Pi doctor checks: Pi binary + version (requires `>= 0.71.0`), CLI version vs npm latest, settings registration, config validity, embedding endpoint reachability, shared-DB integrity, stale Pi extension caches, and historian debug dumps.
57
58
58
-
Both report `PASS X / WARN Y / FAIL Z` summary counts. Use `--force` to auto-fix what doctor can (clears stale plugin cache, repairs config) and `--issue` to produce a sanitized issue report.
59
+
The OMP doctor checks the OMP version, effective plugin enable state, `PI_CODING_AGENT_DIR`/profile/XDG path agreement, native compaction and automatic-memory conflicts, config validity, and shared DB integrity. `--force` installs/enables the plugin and repairs conflicting OMP settings.
60
+
61
+
All doctors report `PASS X / WARN Y / FAIL Z` summary counts. Use `--force` for safe repairs and `--issue` to produce a sanitized issue report.
Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ Magic Context gives them one. It is the **hippocampus** for coding agents, the p
69
69
70
70
-**Capture.** As the historian compresses your history, it lifts the durable knowledge (decisions, constraints, conventions) into project memory. You get a memory system for free, from work you are already doing.
71
71
-**Consolidate.** Overnight, dreamer agents do what sleep does for you: verify memories against the codebase, curate duplicates and stale entries, and promote what recurs.
72
-
-**Recall.** The right memories surface automatically every turn, and the agent can search across memories, past conversations, and git history on demand. Across sessions, and across OpenCodeand Pi.
72
+
-**Recall.** The right memories surface automatically every turn, and the agent can search across memories, past conversations, and git history on demand. Across sessions, and across OpenCode, Pi, and OMP.
73
73
74
74
Two promises: your agent **never stops to manage its context** (no compaction pauses, no broken flow) and it **never forgets**.
The wizard auto-detects which harnesses you have (OpenCode, Pi, or both), adds the plugin, disables built-in compaction, helps you pick models for the historian, dreamer, and sidekick, and resolves conflicts with other context-management plugins. Target a specific harness with`--harness opencode` or `--harness pi`.
99
+
The wizard auto-detects which harnesses you have (OpenCode, Pi, OMP, or any combination), adds the plugin, disables built-in compaction, helps you pick models for the historian, dreamer, and sidekick, and resolves conflicts with other context-management plugins. Target one with `--harness opencode`,`--harness pi`, or `--harness omp`.
100
100
101
101
> **Why disable built-in compaction?** Magic Context manages context itself. The host's compaction would interfere with its cache-aware deferred operations and double-compress.
102
102
@@ -111,9 +111,11 @@ The wizard auto-detects which harnesses you have (OpenCode, Pi, or both), adds t
111
111
112
112
**Pi:**`npx @cortexkit/magic-context@latest setup --harness pi` (requires Pi `>= 0.74.0`). The Pi extension shares the same database as OpenCode; project memories and embeddings pool across both.
113
113
114
-
**Troubleshooting:**`npx @cortexkit/magic-context@latest doctor` auto-detects your harnesses, checks for conflicts (compaction, OMO hooks, DCP), verifies the plugin and TUI sidebar, runs an integrity check on the database, and fixes what it can. Add `--issue` to file a ready-to-submit bug report.
114
+
**Oh My Pi (OMP):**`npx @cortexkit/magic-context@latest setup --harness omp` (requires OMP `>= 17.1.7`). Setup installs the Pi-compatible extension through `omp plugin`, disables OMP native compaction and automatic memory, and honors OMP profiles, `PI_CODING_AGENT_DIR`, and initialized XDG layouts.
115
115
116
-
Works the same on a brand-new or a long-running project: install, restart the harness, and Magic Context captures context from that point forward. It does not backfill OpenCode or Pi sessions from before it was installed.
116
+
**Troubleshooting:**`npx @cortexkit/magic-context@latest doctor` auto-detects your harnesses, checks host-specific conflicts, verifies plugin registration and database integrity, and fixes what it can. Add `--issue` to file a ready-to-submit bug report.
117
+
118
+
Works the same on a brand-new or a long-running project: install, restart the harness, and Magic Context captures context from that point forward. It does not backfill OpenCode, Pi, or OMP sessions from before it was installed.
117
119
118
120
<details>
119
121
<summary><strong>Compatibility with other context-management plugins</strong></summary>
@@ -123,6 +125,8 @@ Works the same on a brand-new or a long-running project: install, restart the ha
123
125
Magic Context owns context management end to end, so it **disables itself** if another plugin is already doing that job. Running two context managers at once would double-compress your history and thrash the prompt cache. On startup it checks for the following; setup and `doctor` help you resolve each, and until they're resolved Magic Context stays off (fail-safe) and tells you why:
124
126
125
127
-**OpenCode built-in compaction** (`compaction.auto` / `compaction.prune`) — Magic Context replaces it. Setup turns it off.
128
+
-**OMP native compaction** (`compaction.enabled`) — Magic Context replaces it. OMP setup turns it off transactionally.
129
+
-**OMP automatic memory** (`memory.backend`) — a second memory injector duplicates recall and retention. OMP setup sets it to `off`; existing data is not deleted.
126
130
-**DCP** (`opencode-dcp`) — a separate context-pruning plugin. The two cannot run together; remove it from your `plugin` list.
127
131
-**oh-my-opencode (OMO)** — setup offers to disable the three hooks that overlap:
128
132
-`preemptive-compaction` — triggers compaction that conflicts with the historian.
@@ -215,7 +219,7 @@ Because it runs during idle time, the dreamer pairs well with local models, even
215
219
-**`ctx_expand`**: pull a compressed history range back to the original `U:`/`A:` transcript when the agent needs the exact details.
216
220
-**`ctx_note`**: a scratchpad for deferred intentions. Notes resurface at natural boundaries (after commits, after historian runs, when todos finish). **Smart notes** carry an open-ended condition the dreamer watches for.
217
221
218
-
Recall works **across sessions** (a new session inherits everything) and **across harnesses** (write a memory in OpenCode, retrieve it in Pi).
222
+
Recall works **across sessions** (a new session inherits everything) and **across harnesses** (write a memory in OpenCode, retrieve it in Pi or OMP).
219
223
220
224
> **Auto search hints***(on by default)* run a background `ctx_search` each turn and whisper a "vague recall" when something relevant exists — like almost remembering a note you took. It appends only compact fragments, never full content; set `memory.auto_search.enabled: false` to turn it off. **Git commit indexing***(opt-in)* makes your project history semantically searchable as an additional `ctx_search` source — enable with `memory.git_commit_indexing.enabled: true`.
Copy file name to clipboardExpand all lines: packages/docs/src/content/docs/concepts/memory.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ The desktop app and dashboard provide a memory browser where you can search, fil
67
67
68
68
## Project-scoped and shared
69
69
70
-
Memories are scoped to a **project identity** derived from the repository, not a filesystem path. This means memories follow a project across worktrees, clones, and forks. The same SQLite database is shared between OpenCodeand Pi — write a memory in one harness, retrieve it in the other.
70
+
Memories are scoped to a **project identity** derived from the repository, not a filesystem path. This means memories follow a project across worktrees, clones, and forks. The same SQLite database is shared by OpenCode, Pi, and OMP — write a memory in one harness, retrieve it in another.
Copy file name to clipboardExpand all lines: packages/docs/src/content/docs/concepts/mural.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ The mural does not render from a half-empty cue pool. Rendering is skipped until
69
69
70
70
-**Vision model required** for the image part. Non-vision models get the same text baseline as with the feature off (no mural marker, no image).
71
71
-**Experimental** — opt-in; defaults off.
72
-
- Works on **OpenCodeand Pi** with the same config and shared store. The image envelope differs by harness (file part vs native image content); the PNG and the fold/replay rules match.
72
+
- Works on **OpenCode, Pi, and OMP** with the same config and shared store. The image envelope differs between OpenCode and the Pi-compatible hosts (file part vs native image content); the PNG and fold/replay rules match.
3. Prompts you to pick models for the historian and dreamer agents
27
-
4. Resolves any conflicts with other context-management plugins
28
-
5. Writes a `magic-context.jsonc` config file with sensible defaults
25
+
1. Registers the plugin using the harness's native package manager
26
+
2. Disables built-in compaction where Magic Context takes ownership
27
+
3. Disables OMP automatic memory to prevent duplicate recall/retention
28
+
4. Prompts you to pick models for the historian and dreamer agents
29
+
5. Resolves conflicts with other context-management plugins
30
+
6. Writes a shared `magic-context.jsonc` with sensible defaults
29
31
30
-
To target one harness explicitly, pass`--harness opencode`or `--harness pi`.
32
+
Target one harness explicitly with`--harness opencode`, `--harness pi`, or `--harness omp`.
31
33
32
34
:::note
33
-
**Why is compaction disabled?** Magic Context manages context itself. OpenCode's built-in compaction would interfere with the historian and double-compress your history. Setup turns it off automatically. See [compatibility](/help/compatibility/) for details on other plugins that conflict.
35
+
**Why is compaction disabled?** Magic Context manages context itself. Host compaction would interfere with the historian and double-compress history. Setup turns it off automatically. OMP's automatic memory backend is also disabled because two memory injectors would duplicate context and writes. Existing OMP memory data is not deleted.
34
36
:::
35
37
36
38
## What gets configured
@@ -47,7 +49,7 @@ Setup adds the plugin to your `opencode.json` and turns off compaction:
47
49
}
48
50
```
49
51
50
-
It also creates a `magic-context.jsonc` config file in the shared CortexKit location (the same for both harnesses; project overrides user):
52
+
It also creates a `magic-context.jsonc` config file in the shared CortexKit location (the same across all harnesses; project overrides user):
51
53
52
54
| Path | Scope |
53
55
|---|---|
@@ -57,7 +59,7 @@ It also creates a `magic-context.jsonc` config file in the shared CortexKit loca
57
59
</TabItem>
58
60
<TabItemlabel="Pi">
59
61
60
-
Setup adds the extension to Pi's settings and creates a `magic-context.jsonc` config file in the shared CortexKit location (the same for both harnesses; project overrides user):
62
+
Setup adds the extension to Pi's settings and creates a `magic-context.jsonc` config file in the shared CortexKit location (the same across all harnesses; project overrides user):
61
63
62
64
| Path | Scope |
63
65
|---|---|
@@ -68,12 +70,26 @@ Setup adds the extension to Pi's settings and creates a `magic-context.jsonc` co
68
70
Pi setup prompts for `thinking_level` if you pick a `github-copilot/*` reasoning model — Copilot requires it and rejects the default value Pi would send otherwise. The wizard handles this for you.
69
71
:::
70
72
73
+
</TabItem>
74
+
<TabItemlabel="Oh My Pi (OMP)">
75
+
76
+
Setup installs `@cortexkit/pi-magic-context` through `omp plugin`, verifies it is effectively enabled for the current project, and writes the same shared CortexKit config used by OpenCode and Pi. It honors named OMP profiles, `PI_CODING_AGENT_DIR`, `PI_CONFIG_DIR`, and initialized XDG layouts.
77
+
78
+
OMP setup transactionally applies:
79
+
80
+
```bash
81
+
omp config set compaction.enabled false
82
+
omp config set memory.backend off
83
+
```
84
+
85
+
If plugin registration or config writing fails, the prior OMP settings are restored.
86
+
71
87
</TabItem>
72
88
</Tabs>
73
89
74
90
## Verify the install
75
91
76
-
After setup, restart your harness (reload OpenCode or restart Pi) so the plugin loads.
92
+
After setup, restart your harness (or run `/reload-plugins` in OMP) so the plugin loads.
77
93
78
94
<Tabs>
79
95
<TabItemlabel="OpenCode">
@@ -85,6 +101,11 @@ Run `/ctx-status` in the OpenCode TUI or Desktop. You should see a status view w
85
101
86
102
Run `/ctx-status` in Pi. You should see a status line with context usage and Magic Context state. Pi also shows a status line in the footer when the plugin is active.
87
103
104
+
</TabItem>
105
+
<TabItemlabel="Oh My Pi (OMP)">
106
+
107
+
Run `/ctx-status` in OMP. The Magic Context footer/status should be active, and `doctor --harness omp` should report native compaction and automatic memory as disabled.
Copy file name to clipboardExpand all lines: packages/docs/src/content/docs/getting-started/introduction.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,21 @@ description: What Magic Context is, why it exists, and what changes for your cod
5
5
6
6
Every coding agent session starts from zero. No memory of last week's decisions, no recall of why you chose a particular architecture, no awareness of what happened before the current context window. When the window fills up, the agent pauses for compaction — a lossy operation that discards detail and breaks your flow. Then you start another session and it starts from zero again.
7
7
8
-
Magic Context is a plugin for [OpenCode](https://opencode.ai) and [Pi](https://github.com/earendil-works/pi-mono) that ends this cycle. It gives your agent persistent memory and a context window that manages itself — silently, in the background, without ever stopping the session.
8
+
Magic Context supports [OpenCode](https://opencode.ai), [Pi](https://github.com/earendil-works/pi-mono), and [Oh My Pi](https://github.com/can1357/oh-my-pi). It gives your agent persistent memory and a context window that manages itself — silently, in the background, without ever stopping the session.
9
9
10
10
## What changes
11
11
12
12
**Sessions can run for weeks.** A background historian agent reads the older part of your conversation, compresses it into tiered compartments, and promotes durable knowledge (decisions, constraints, conventions) into project memory — all while you keep working. The raw history is never thrown away; the agent can expand any compartment back to the original transcript on demand via `ctx_expand`.
13
13
14
-
**The next session already knows your project.** Project memories persist across sessions and across both harnesses. When you start a new OpenCodeor Pi session on the same project, those memories are injected automatically. Your agent remembers what was decided, and why.
14
+
**The next session already knows your project.** Project memories persist across sessions and all three harnesses. Start a new OpenCode, Pi, or OMP session on the same project and those memories are injected automatically. Your agent remembers what was decided, and why.
15
15
16
16
**Full recall is always available.** The agent can search across memories, compressed session history, and indexed git commits in one call with `ctx_search`. Nothing is lost — it is compressed and indexed, not discarded.
17
17
18
18
**Context management runs on its own schedule.** Drops are queued and applied only when it is safe to do so without invalidating the provider's prompt cache. There are no compaction pauses, no manual intervention, and no broken flow.
19
19
20
20
## Who it is for
21
21
22
-
Magic Context is designed for developers using **OpenCode** (CLI, TUI, or Desktop) or **Pi** (>= 0.74.0). If you run long or recurring sessions on a project — debugging a codebase for weeks, building a feature over many sessions — it is especially useful.
22
+
Magic Context is designed for developers using **OpenCode** (CLI, TUI, or Desktop), **Pi** (>= 0.74.0), or **OMP** (>= 17.1.7). If you run long or recurring sessions on a project — debugging a codebase for weeks, building a feature over many sessions — it is especially useful.
0 commit comments