Skip to content

Commit f9448ac

Browse files
LynricsyWineFoxDev
andcommitted
docs(omp): 📝 document full harness support
Co-authored-by: Wine Fox <fox@ling.plus>
1 parent 5154824 commit f9448ac

16 files changed

Lines changed: 139 additions & 62 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,4 @@ packages/plugin/scripts/experiments/issue-195-repro.mjs
112112
packages/plugin/scripts/experiments/visual-memory/render-trimmed-memories.ts
113113
packages/plugin/scripts/experiments/visual-memory/trials/REPORT.md
114114
packages/plugin/scripts/mural-test-output/
115+
AgentLogs/

CONFIGURATION.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Configuration Reference
22

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.
44

55
### Configuration locations
66

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):
88

99
| Path | Scope |
1010
|---|---|
@@ -19,12 +19,12 @@ Project config always merges on top of user config. The unified setup wizard (`n
1919

2020
Both plugins write to the same SQLite database at `~/.local/share/cortexkit/magic-context/context.db`. Tables are scoped by:
2121

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
2323
- `project_path` (resolved git root) for **project-scoped** data — memories, embeddings, dreamer runs, key-file pins, smart notes
2424

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.
2626

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.
2828

2929
### JSON Schema
3030

@@ -43,19 +43,22 @@ Both setup wizards add this automatically.
4343
If something isn't working, run the unified doctor to auto-detect installed harnesses and fix common issues:
4444

4545
```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
4747
npx @cortexkit/magic-context@latest doctor
4848

4949
# Target a specific harness explicitly
5050
npx @cortexkit/magic-context@latest doctor --harness opencode
5151
npx @cortexkit/magic-context@latest doctor --harness pi
52+
npx @cortexkit/magic-context@latest doctor --harness omp
5253
```
5354

5455
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.
5556

5657
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.
5758

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.
5962

6063
### SQLite backend
6164

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Magic Context gives them one. It is the **hippocampus** for coding agents, the p
6969

7070
- **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.
7171
- **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 OpenCode and 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.
7373

7474
Two promises: your agent **never stops to manage its context** (no compaction pauses, no broken flow) and it **never forgets**.
7575

@@ -96,7 +96,7 @@ irm https://raw.githubusercontent.com/cortexkit/magic-context/master/scripts/ins
9696
npx @cortexkit/magic-context@latest setup
9797
```
9898

99-
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`.
100100

101101
> **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.
102102
@@ -111,9 +111,11 @@ The wizard auto-detects which harnesses you have (OpenCode, Pi, or both), adds t
111111

112112
**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.
113113

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.
115115

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.
117119

118120
<details>
119121
<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
123125
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:
124126

125127
- **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.
126130
- **DCP** (`opencode-dcp`) — a separate context-pruning plugin. The two cannot run together; remove it from your `plugin` list.
127131
- **oh-my-opencode (OMO)** — setup offers to disable the three hooks that overlap:
128132
- `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
215219
- **`ctx_expand`**: pull a compressed history range back to the original `U:`/`A:` transcript when the agent needs the exact details.
216220
- **`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.
217221

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).
219223

220224
> **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`.
221225

packages/docs/src/content/docs/concepts/memory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The desktop app and dashboard provide a memory browser where you can search, fil
6767

6868
## Project-scoped and shared
6969

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 OpenCode and 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.
7171

7272
## How it connects
7373

packages/docs/src/content/docs/concepts/mural.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The mural does not render from a half-empty cue pool. Rendering is skipped until
6969

7070
- **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).
7171
- **Experimental** — opt-in; defaults off.
72-
- Works on **OpenCode and 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.
7373

7474
## How it connects
7575

packages/docs/src/content/docs/getting-started/installation.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Installation
3-
description: How to install Magic Context on OpenCode or Pi using the interactive setup wizard, and how to verify your install.
3+
description: How to install Magic Context on OpenCode, Pi, or Oh My Pi using the interactive setup wizard, and how to verify your install.
44
---
55

66
import { Tabs, TabItem } from '@astrojs/starlight/components';
@@ -12,25 +12,27 @@ The setup wizard detects which harnesses you have installed, configures the plug
1212
- **Node.js >= 24** for the CLI
1313
- **OpenCode** (current version) — for OpenCode installs
1414
- **Pi >= 0.74.0** — for Pi installs
15+
- **OMP >= 17.1.7** — for Oh My Pi installs
1516

1617
## Run setup
1718

1819
```bash
1920
npx @cortexkit/magic-context@latest setup
2021
```
2122

22-
The wizard auto-detects whether you have OpenCode, Pi, or both installed. It then:
23+
The wizard auto-detects OpenCode, Pi, and OMP. It then:
2324

24-
1. Registers the plugin in your harness config
25-
2. Disables built-in compaction (OpenCode only — Magic Context replaces it)
26-
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
2931

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`.
3133

3234
:::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.
3436
:::
3537

3638
## What gets configured
@@ -47,7 +49,7 @@ Setup adds the plugin to your `opencode.json` and turns off compaction:
4749
}
4850
```
4951

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):
5153

5254
| Path | Scope |
5355
|---|---|
@@ -57,7 +59,7 @@ It also creates a `magic-context.jsonc` config file in the shared CortexKit loca
5759
</TabItem>
5860
<TabItem label="Pi">
5961

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):
6163

6264
| Path | Scope |
6365
|---|---|
@@ -68,12 +70,26 @@ Setup adds the extension to Pi's settings and creates a `magic-context.jsonc` co
6870
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.
6971
:::
7072

73+
</TabItem>
74+
<TabItem label="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+
7187
</TabItem>
7288
</Tabs>
7389

7490
## Verify the install
7591

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.
7793

7894
<Tabs>
7995
<TabItem label="OpenCode">
@@ -85,6 +101,11 @@ Run `/ctx-status` in the OpenCode TUI or Desktop. You should see a status view w
85101

86102
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.
87103

104+
</TabItem>
105+
<TabItem label="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.
108+
88109
</TabItem>
89110
</Tabs>
90111

packages/docs/src/content/docs/getting-started/introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ description: What Magic Context is, why it exists, and what changes for your cod
55

66
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.
77

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.
99

1010
## What changes
1111

1212
**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`.
1313

14-
**The next session already knows your project.** Project memories persist across sessions and across both harnesses. When you start a new OpenCode or 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.
1515

1616
**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.
1717

1818
**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.
1919

2020
## Who it is for
2121

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.
2323

2424
## What it is not
2525

0 commit comments

Comments
 (0)