Skip to content

Releases: cortexkit/magic-context

v0.31.4

Choose a tag to compare

@github-actions github-actions released this 08 Jul 00:11

v0.31.4

Maintenance release: 14 fix batches from two internal audit waves plus one user-reported bug.

Fixed

Compaction not triggering after threshold (#218)

A session whose previous turn ended with an interrupted or partially-aborted tool call could get stuck: every subsequent pass was classified as mid-turn, so the compaction threshold never fired and queued context reductions never applied. A newer real user message now ends the stale turn on both OpenCode and Pi. Additionally, doctor --issue reports no longer redact plain numeric settings like execute_threshold_tokens (redaction now applies only to string values under secret-like keys).

Workspace memory sharing

Two security fixes: malformed workspace share_categories now fails closed to sharing nothing (instead of sharing everything), and primary agents can no longer update, archive, or merge another project's memories through shared categories — shared visibility is read-only; mutations require ownership.

Project config trust boundaries

Project-level (.cortexkit/magic-context.jsonc) configs can no longer override historian.model / historian.fallback_models (a cloned repository could otherwise route background LLM work to a repo-chosen model on your credentials), and project-level execute thresholds now only apply when they delay compaction relative to your user config, never advance it. Dreamer task tuning and memory.enabled remain project-configurable.

Dreamer reliability

Dreamer task manifests (verify / map-memories / classify) are now fail-closed: a truncated or malformed model response is rejected and retried instead of partially applied. Lease-guarded writes use immediate transactions so concurrent OpenCode and Pi processes cannot double-commit. Retrospective scanning no longer permanently skips older sessions on large backlogs, and file-change verification catches same-second commits.

Historian and wrapup coordination

/ctx-recomp can no longer race a live /ctx-wrapup into concurrent compartment mutation. The boundary staleness fingerprint now hashes content (same-length edits are detected). Wrapup correctly treats a final chunk followed only by filtered noise as final, and waits at most 10 minutes for a busy compartment lease instead of indefinitely.

Cache stability

Two-pass tool reclaim and smart-drops now ride a hard m[0] fold on defer passes (previously spilled to a second cache bust). Image stripping replays its frozen set on every pass, including sessions that never had a compaction watermark. Channel-2 nudge delivery uses per-claim tokens so concurrent processes cannot double-deliver, and synthetic todo state never anchors to an errored/aborted assistant message (which some providers drop from the wire, orphaning the tool pair).

Storage integrity

Memory embeddings are skipped when content changed while the embedding request was in flight (stale-vector guard). The message search index recovers failed incremental writes even after later successes advanced its watermark. Cross-process duplicate memory writes are now idempotent.

Other fixes

  • TUI/RPC: WebSocket re-hello no longer leaks notification sinks (lost TUI actions), reconnects detect a restarted server, upgrades require token auth before accepting the socket, and per-session cursors stop cross-session notification pruning.
  • Pi todowrite: foreign-extension tool outputs are validated fail-closed before capture; overlay output capped.
  • Smart notes: network check lifecycle hardened (tarpit responses can no longer hold the sandbox lock past budget; terminal rejections no longer retry).
  • CLI doctor: honors PI_CODING_AGENT_DIR everywhere, atomic JSONL migration writes, issue-report body-limit postcondition.
  • Pi E2E parity: 8 cache-invariant scenarios and a Pi-native subagent isolation test ported from the OpenCode suite.

v0.31.3

Choose a tag to compare

@github-actions github-actions released this 07 Jul 17:20

v0.31.3

Patch release: completes the TUI fix started in v0.31.2 and ships a batch of Pi parity fixes.

TUI sidebar now updates when installed from npm

v0.31.2 restored the OpenTUI runtime dependencies so the sidebar loads again, but a second issue remained: on OpenCode 1.17.14, plugins installed from npm are excluded from OpenTUI's Solid compile step, so the sidebar rendered once and never updated (token counts, compartments, and memories stuck at zero). Development checkouts were unaffected, which is why the problem only appeared in published installs.

The TUI is now precompiled at publish time and binds directly to the host's OpenTUI runtime, so the sidebar is fully live from npm installs. Older OpenCode versions and development checkouts keep working through an automatic fallback. The release pipeline now installs the packed artifact and verifies the compiled output before publishing, so this failure class is gated structurally.

Pi: todowrite gets real UX and a disable switch

Magic Context registers a todowrite tool on Pi (Pi has no built-in task list). It previously rendered raw JSON and could not be turned off, which clashed with community todo extensions. Now:

  • A persistent todo overlay above the editor shows active tasks with status glyphs and counts while work is in flight, and hides itself when the list empties. It survives restarts.
  • Tool calls render as compact status lines instead of JSON dumps, and a /todos command lists tasks grouped by status.
  • New todowrite.enabled config (default true): set to false if you use your own todo extension, and Magic Context registers neither the tool, the command, nor the overlay. todowrite.overlay controls just the widget.

Pi fixes

  • Commands and tools now follow /cd: /ctx-status, /ctx-dream, /ctx-wrapup, /ctx-embed, smart notes, and the rest resolve the active project's configuration at invocation time instead of using the project Pi was launched in.
  • Historian resilience now matches OpenCode: transient provider errors (rate limits, timeouts, 5xx) retry on the same model before moving down the fallback chain, and the live session model serves as a last-resort fallback after configured fallback_models.
  • Historian failures now surface a notice in the session (previously they were only recorded internally), with the same wording and throttling as OpenCode.
  • /ctx-embed start reports progress during long embedding runs instead of appearing hung.
  • Fixed several cache-stability gaps: pending drops no longer land mid-historian-run, session switch-back no longer forces an immediate rebuild, and a stuck emergency-recovery flag now clears only after context usage genuinely drops.
  • /ctx-recomp --upgrade now points to /ctx-session-upgrade instead of failing as invalid usage.
  • /ctx-status shows the work metrics (new work tokens / total input) that OpenCode's sidebar already displays.

Other

  • ctx_search note anchors and smart-note attribution fixes on Pi.

v0.31.2

Choose a tag to compare

@github-actions github-actions released this 07 Jul 11:25

v0.31.2

Urgent fix: v0.31.1 broke the TUI sidebar for standard installs. Update immediately if you are on 0.31.1.

Fixes

TUI sidebar failed to load on v0.31.1

v0.31.1 stopped shipping OpenTUI and Solid as runtime dependencies, on the expectation that OpenCode supplies its own copies to TUI plugins. That holds for plugins loaded from a plain directory, but not for npm-installed plugins: OpenCode's import rewriting skips sources inside node_modules, so the standard install could not resolve @opentui/solid and the sidebar silently failed to load. The dependencies are restored.

The underlying goal — surviving OpenCode's OpenTUI version changes without a plugin release — needs a host-side change and will be revisited with the OpenCode team.

v0.31.1

Choose a tag to compare

@github-actions github-actions released this 07 Jul 10:06

v0.31.1

Patch release: the TUI sidebar no longer breaks when OpenCode changes its embedded OpenTUI version.

Fixes

TUI sidebar survives OpenCode's OpenTUI version changes

The plugin previously shipped its own copies of @opentui/core, @opentui/solid, and solid-js, pinned to match a specific OpenCode release. Every time OpenCode upgraded or reverted its embedded OpenTUI, that pin went stale and the sidebar could fail to load until we shipped a matching release.

OpenCode's TUI loader actually supplies its own OpenTUI and Solid instances to raw-TSX plugins, so the local copies were unnecessary. They are no longer installed as runtime dependencies; the host's versions are used directly. The sidebar now works across OpenCode's OpenTUI upgrades (0.3.x through 0.4.x) without a plugin update, and installs get slightly smaller.

Smart-note background checks no longer spill errors to stderr

A smart-note network check that hit the response size limit (or timed out) printed an uncaught SmartNoteNetworkError stack trace to OpenCode's stderr on every occurrence. The error is now handled on the response stream and reported through the normal check-failure path.

Smart-note state writes no longer fail with "database is locked"

Smart-note scheduling updates used a transaction shape that could not wait for a concurrent writer, producing spurious database is locked errors when several OpenCode instances shared the database. They now take the write lock up front and wait like every other writer.

v0.31.0

Choose a tag to compare

@github-actions github-actions released this 06 Jul 20:41

v0.31.0

Feature release: a new /ctx-wrapup command for compacting history on demand, notes in ctx_search, sturdier project identity on flaky git setups, and a simplified reduction configuration.

New

/ctx-wrapup: compact older history on demand

/ctx-wrapup [messages_to_keep] runs the historian forward over your live history right away, keeping only the newest N raw messages (default 20, counting every message: yours, the assistant's, and tool results). Everything older is summarized into compartments. The cut never splits an in-flight tool exchange and prefers to land on one of your messages.

Use it before switching from a large-context model to a smaller one: the compacted history is queued and materializes on your next message, and a model switch applies it at no extra cost. If you want it applied immediately instead, run /ctx-flush first.

While it runs, OpenCode's TUI shows a live Wrapup progress bar in the sidebar; OpenCode Desktop posts a start notice and the result in the chat; Pi reports per-chunk status messages. /ctx-recomp and /ctx-session-upgrade wait their turn while a wrapup is active (and the other way around), including across multiple processes sharing the same database.

ctx_search now covers your notes

Notes taken with ctx_note (including smart notes) are now a search source alongside memories, message history, git commits, and compartments. Results show the note's status and age; notes from the current session carry a @msg N anchor the agent can expand for surrounding context.

Improved

Project identity survives flaky git

Project-scoped memory is keyed by a git-derived project identity. Several failure modes could previously split or flip that identity:

  • A git timeout on a slow disk, or a dubious ownership refusal, disabled Magic Context for the session or split memory under a directory-based fallback identity. Both now fall back gracefully, and once a session has resolved its real git identity, transient git failures keep using it instead of flipping.
  • Working in a subdirectory during a transient failure now reuses the repository's identity rather than minting a separate one.
  • Symlinked checkouts are now detected as git repositories.
  • dubious ownership produces a one-time warning with the exact git config --global --add safe.directory fix.

Doctor checks the local embedding runtime more safely

The CLI doctor now probes whether onnxruntime-node actually loads (not just whether its files exist), and runs that probe in a separate process so a broken native binding cannot crash the doctor itself.

Changed

ctx_reduce_enabled removed

Agent-controlled reduction is now always on; the ctx_reduce_enabled setting is gone. If your config still contains it, the key is ignored harmlessly. Caveman text compression, which was previously tied to that flag, is now controlled solely by caveman_text_compression.enabled (still off by default, and never applied to subagents).

Fixes

  • The TUI sidebar no longer shows a Facts row (facts were folded into project memories in v2; the row was always 0).
  • Pi: disabling caveman_text_compression now also stops replaying compression persisted by earlier passes.
  • Pi: a transient search timeout no longer suppresses automatic search hints for the rest of the turn.
  • A number of internal hardening fixes around the new wrapup command's concurrency (durable run marker with self-expiry, crash recovery on restart, and safe interleaving with the automatic historian), prompt-cache stability under multi-process contention, and the compaction-marker advance on Pi.

Dashboard dashboard-v0.9.3

Choose a tag to compare

@github-actions github-actions released this 06 Jul 21:05

Dashboard v0.9.3

Config editor alignment with plugin v0.31.0.

Changed

  • Removed the retired ctx_reduce_enabled toggle from the General section. Agent-controlled reduction is always on as of plugin v0.31.0.
  • Caveman Text Compression no longer shows the "has no effect while Agent Controlled Reduction is enabled" warning; the setting is independent now and the description reflects that (active for primary sessions when enabled, never for subagents).
  • The bundled configuration schema matches plugin v0.31.0.

v0.30.7

Choose a tag to compare

@github-actions github-actions released this 04 Jul 15:20

v0.30.7

Patch release fixing a false recomp failure on Pi-only installs and laying the plugin-side groundwork for a much faster dashboard Projects page.

Fixes

Pi: /ctx-recomp reported failure after succeeding on installs without OpenCode

On machines where Pi runs without OpenCode installed (for example Pi inside a Linux container), /ctx-recomp and /ctx-session-upgrade completed their rebuild and then reported Recomp failed unexpectedly: unable to open database file. The rebuild had actually published; the error came from a post-publish step that tried to open OpenCode's database, which does not exist on Pi-only installs. That step is now skipped on Pi, and a missing OpenCode database can no longer be created as an empty stray file. If you saw this failure, your recomp results were saved — no re-run needed.

Pi: boot log printed executeThreshold=[object Object]% for per-model thresholds

When execute_threshold_percentage is configured as a per-model map, the startup log now prints the resolved values (for example 65% (provider/model=50%)) instead of [object Object]%.

Improvements

Session-to-project index for the dashboard

Reported dashboard Projects page load times of two minutes or more came from the dashboard re-deriving each session's project by running git across every session directory on every load, including directories that no longer exist or live on slow network paths. The plugin now records a durable session-to-project index (a one-time background backfill on first start after upgrading, then kept current automatically), and the upcoming dashboard release reads that index directly instead of running git at all. Sessions whose directories have been deleted are left unindexed rather than guessed. Update both the plugin and the dashboard to get the fast path end to end.

Dashboard dashboard-v0.9.2

Choose a tag to compare

@github-actions github-actions released this 04 Jul 15:22

Dashboard v0.9.2

Performance release: the Projects page no longer runs git at all.

Fixed

Projects page could take minutes to load

The dashboard used to determine each session's project by running git rev-list across every distinct session directory on every page load. On machines with many worktrees, deleted directories, or directories on slow network paths, this made the Projects page take minutes to appear (reported at over two minutes).

The dashboard now reads the session-to-project index that the Magic Context plugin records (plugin v0.30.7 adds a one-time backfill for existing sessions), turning the page into a couple of indexed database reads. Git is never spawned by the dashboard anymore, and a regression test keeps it that way.

One behavior note: sessions that predate the index appear in session lists but are not grouped into project cards until the plugin (v0.30.7+) has started once and completed its background backfill. Update both the plugin and the dashboard for the full effect.

v0.30.6

Choose a tag to compare

@github-actions github-actions released this 03 Jul 12:19

v0.30.6

Patch release with three Pi fixes and quieter background indexing.

Fixes

Pi: sessions could wedge on a synthetic todo pair anchored to an aborted turn

If Magic Context's synthetic todo state was anchored to an assistant turn that had been aborted (for example by pressing Esc mid-response), Pi's provider serializers dropped the tool call half of the pair while still sending its output half. OpenAI-family providers reject that shape, so every subsequent prompt failed with No tool call found for function call output with call_id mc_synthetic_todo_... and the session was stuck. The anchor now always targets a completed assistant turn, and existing sessions recover on their next prompt.

Pi: historian and dreamer runs failed when another extension printed to stdout (#211)

Since v0.30.4, Pi subagents load your full extension set. An extension that writes plain text to stdout (such as a worker announcing [Worker] Ready) interleaved with the JSON event stream Magic Context reads from its subagents, and the whole run was treated as a parse failure. On busy setups this could block compaction entirely, leaving sessions slow and uncompacted. Non-JSON output lines are now skipped.

/ctx-dream: manual runs no longer give up when a scheduled task is finishing

Running /ctx-dream <task> while a scheduled dreamer task held the same work domain reported Busy (already running) even though the requested task was not running. Manual runs now wait up to a minute for the domain to free, and when it stays busy the message explains that another dream task holds it.

Quieter background git indexing

Directories that are not git repositories (or repositories with no commits yet) were retried and logged in full every 15 minutes, flooding the log section of doctor --issue reports. They are now re-checked once a day with a single quiet log line, and start indexing normally as soon as they become real repositories.

v0.30.5

Choose a tag to compare

@github-actions github-actions released this 02 Jul 16:18

v0.30.5

Patch release fixing a Windows-only bug that prevented the Pi historian from ever running, and restoring the dreamer.inject_docs setting.

Pi on Windows: historian and dreamer spawns no longer fail with ENAMETOOLONG

On Windows, every Pi historian, dreamer, and sidekick run failed at spawn with spawn ENAMETOOLONG (#209). The plugin passed the subagent's system prompt — about 60 KB for the historian — as a single command-line argument, and Windows caps the entire process command line at 32,767 characters. The child process never started, so history was never compacted, and long sessions eventually grew past the model's context limit. macOS and Linux were unaffected because their per-argument limits are far higher.

Subagent system prompts are now written to a temporary file and passed to Pi by path, on every platform, so the whole class of command-line size failures is gone rather than patched around. On Windows the user message is also always delivered through stdin, keeping the child's command line small no matter how large the prompts get. Temp files are cleaned up when the run settles, including on spawn failure.

If you are affected: after updating, the historian will start compacting your backlog on its next trigger. Sessions that already overflowed recover once compaction catches up.

Pi: subagents no longer inherit project AGENTS.md / CLAUDE.md

While fixing the spawn path we found that Pi appends project context files (AGENTS.md, CLAUDE.md) to a custom system prompt unless told not to. Magic Context's hidden subagents are focused one-shot workers with purpose-built prompts; your project's agent instructions were being silently appended to all of them. Subagent spawns now pass --no-context-files, so the historian, dreamer, and sidekick receive exactly the prompt they were designed with. You may notice slightly different historian output on Pi as a result — that is the prompt getting cleaner, not a regression.

dreamer.inject_docs: false works again

Setting dreamer.inject_docs to false no longer silently does nothing (#210). When the <project-docs> block moved from the system prompt into the cached history baseline a few releases ago, the setting was left gating the old, retired path — so ARCHITECTURE.md and STRUCTURE.md kept being injected regardless of the config. The flag now gates the real injection site on both OpenCode and Pi. It is independent of whether the dreamer itself is enabled: if you maintain those files by hand but don't want them in context, inject_docs: false now honors that. Changing the setting mid-session takes effect on the next natural context rebuild rather than forcing an immediate one.