@cortexkit/opencode-magic-context 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/cli/config-paths.d.ts +2 -0
- package/dist/cli/config-paths.d.ts.map +1 -1
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli.js +8549 -125
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +2 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8653 -238
- package/dist/plugin/conflict-warning-hook.d.ts +24 -0
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -0
- package/dist/shared/conflict-detector.d.ts +29 -0
- package/dist/shared/conflict-detector.d.ts.map +1 -0
- package/dist/shared/conflict-fixer.d.ts +3 -0
- package/dist/shared/conflict-fixer.d.ts.map +1 -0
- package/dist/shared/tui-config.d.ts +10 -0
- package/dist/shared/tui-config.d.ts.map +1 -0
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tui/data/context-db.d.ts +54 -0
- package/dist/tui/data/context-db.d.ts.map +1 -0
- package/package.json +20 -1
- package/src/tui/data/context-db.ts +584 -0
- package/src/tui/index.tsx +461 -0
- package/src/tui/slots/sidebar-content.tsx +422 -0
- package/src/tui/types/opencode-plugin-tui.d.ts +232 -0
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@ Your agent should never stop working to manage its own context. Magic Context is
|
|
|
37
37
|
|
|
38
38
|
**4.** On-demand sidekick that augments prompts with relevant project context.
|
|
39
39
|
|
|
40
|
+
**5.** TUI sidebar with live context breakdown, token usage, historian status, and memory counts — right inside the terminal.
|
|
41
|
+
|
|
40
42
|
---
|
|
41
43
|
|
|
42
44
|
## Get Started
|
|
@@ -86,6 +88,7 @@ Create `magic-context.jsonc` in your project root, `.opencode/`, or `~/.config/o
|
|
|
86
88
|
|
|
87
89
|
```jsonc
|
|
88
90
|
{
|
|
91
|
+
"$schema": "https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/assets/magic-context.schema.json",
|
|
89
92
|
"enabled": true,
|
|
90
93
|
|
|
91
94
|
// Which model the historian uses for background compression,
|
|
@@ -97,6 +100,8 @@ Create `magic-context.jsonc` in your project root, `.opencode/`, or `~/.config/o
|
|
|
97
100
|
}
|
|
98
101
|
```
|
|
99
102
|
|
|
103
|
+
> **Tip:** The `$schema` key enables autocomplete and validation in VS Code and other editors.
|
|
104
|
+
|
|
100
105
|
That's it. Everything else has sensible defaults. Project config merges on top of user-wide settings.
|
|
101
106
|
|
|
102
107
|
### Oh-My-OpenCode / Oh-My-OpenAgent Users
|
|
@@ -115,6 +120,16 @@ If you use [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) (f
|
|
|
115
120
|
|
|
116
121
|
The setup wizard handles this automatically if it detects an oh-my-openagent or oh-my-opencode config.
|
|
117
122
|
|
|
123
|
+
### Doctor (Troubleshooting)
|
|
124
|
+
|
|
125
|
+
Already installed but something isn't working? Run the doctor to check and auto-fix configuration issues:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
bunx @cortexkit/opencode-magic-context doctor
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Doctor checks for conflicts (compaction, DCP, OMO hooks), ensures the TUI sidebar is configured, and verifies the plugin is registered — fixing what it can automatically.
|
|
132
|
+
|
|
118
133
|
---
|
|
119
134
|
|
|
120
135
|
## What Your Agent Gets
|
|
@@ -243,6 +258,30 @@ The dreamer runs during a configurable schedule window and creates ephemeral Ope
|
|
|
243
258
|
|
|
244
259
|
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.
|
|
245
260
|
|
|
261
|
+
### TUI Sidebar
|
|
262
|
+
|
|
263
|
+
When running in OpenCode's terminal UI, Magic Context shows a live sidebar panel with:
|
|
264
|
+
|
|
265
|
+
- **Context breakdown bar** — visual token split across System Prompt, Compartments, Facts, Memories, and Conversation
|
|
266
|
+
- **Historian status** — idle, running, or compartment/fact counts
|
|
267
|
+
- **Memory counts** — total project memories and how many are injected
|
|
268
|
+
- **Dreamer status** — last run time
|
|
269
|
+
- **Queue status** — pending operations count
|
|
270
|
+
|
|
271
|
+
The sidebar updates after every message. Commands (`/ctx-status`, `/ctx-flush`, `/ctx-aug`) also work directly in TUI mode via dialogs and toasts.
|
|
272
|
+
|
|
273
|
+
The TUI plugin is configured automatically by the setup wizard and the `doctor` command. If you installed manually, add to your `tui.json` or `tui.jsonc`:
|
|
274
|
+
|
|
275
|
+
```jsonc
|
|
276
|
+
{
|
|
277
|
+
"plugin": ["@cortexkit/opencode-magic-context"]
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Startup conflict detection
|
|
282
|
+
|
|
283
|
+
On startup, Magic Context checks for common configuration problems — OpenCode's built-in compaction being enabled, DCP plugin being active alongside Magic Context, or conflicting oh-my-openagent hooks. When conflicts are detected, it warns the active session with a fix suggestion pointing to `bunx @cortexkit/opencode-magic-context doctor`.
|
|
284
|
+
|
|
246
285
|
---
|
|
247
286
|
|
|
248
287
|
## Commands
|
|
@@ -290,6 +329,8 @@ All durable states live in a local SQLite database. If the database can't be ope
|
|
|
290
329
|
| `memory_embeddings` | Embedding vectors for semantic search |
|
|
291
330
|
| `dream_state` | Dreamer lease locking and task progress |
|
|
292
331
|
| `dream_queue` | Queued projects awaiting dream processing |
|
|
332
|
+
| `dream_runs` | Per-project dream run history — task names, durations, memory changes |
|
|
333
|
+
| `compression_depth` | Per-message compression depth for weighted compressor selection |
|
|
293
334
|
| `message_history_fts` | FTS5 index of user/assistant message text for `ctx_search` |
|
|
294
335
|
| `message_history_index` | Tracks last indexed ordinal per session for incremental FTS population |
|
|
295
336
|
| `recomp_compartments` | Staging for `/ctx-recomp` partial progress |
|
|
@@ -4,6 +4,8 @@ export interface ConfigPaths {
|
|
|
4
4
|
opencodeConfigFormat: "json" | "jsonc" | "none";
|
|
5
5
|
magicContextConfig: string;
|
|
6
6
|
omoConfig: string | null;
|
|
7
|
+
tuiConfig: string;
|
|
8
|
+
tuiConfigFormat: "json" | "jsonc" | "none";
|
|
7
9
|
}
|
|
8
10
|
export declare function detectConfigPaths(): ConfigPaths;
|
|
9
11
|
//# sourceMappingURL=config-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-paths.d.ts","sourceRoot":"","sources":["../../src/cli/config-paths.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAChD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"config-paths.d.ts","sourceRoot":"","sources":["../../src/cli/config-paths.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAChD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CAC9C;AA8BD,wBAAgB,iBAAiB,IAAI,WAAW,CA6C/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAWA,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAwHjD"}
|
package/dist/cli/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AA4JA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAyPhD"}
|