Skip to content

Releases: cortexkit/opencode-magic-context

v0.4.2

01 Apr 22:28

Choose a tag to compare

Bug Fixes

  • enabled now defaults to true — installing the plugin activates it without requiring "enabled": true in magic-context.jsonc. Previously defaulted to false, which meant users who installed the plugin without a config file got no functionality. The config-parse failure fallback correctly stays enabled: false.

SORRY!

v0.4.1

01 Apr 21:27

Choose a tag to compare

What's New

Proactive Memory Embedding

Memories are now embedded immediately after ctx_memory write (fire-and-forget) and swept periodically on the dream timer. The first ctx_search after dreamer runs no longer pays bulk embedding latency. The lazy search-time fallback remains as a safety net.

Smarter Compressor Selection

The compressor no longer always picks the oldest compartments for compression. A new weighted scoring system (0.7 × age + 0.3 × inverse compression depth) prevents the earliest compartments from being re-compressed indefinitely while untouched middle history exists. Per-message compression depth is tracked in a new compression_depth table and incremented after each successful pass.

Depth-Aware U: Line Handling

The compressor prompt now adapts based on how many times the selected compartments have been compressed:

  • Avg depth < 2: Preserve all U: lines exactly as-is — compression targets prose only
  • Avg depth 2–3: Condense each U: line to its core intent in one sentence
  • Avg depth 3+: Fold U: intent into narrative prose — no separate U: lines

This preserves user voice in recent history while allowing graceful degradation in ultra-long sessions.

Bug Fixes

  • History budget formula: Was contextLimit × historyBudgetPercentage, now correctly contextLimit × executeThreshold × historyBudgetPercentage as originally designed. With execute_threshold=40% and history_budget=15%, the budget was 150k (wrong) instead of the correct 60k.

v0.4.0

01 Apr 17:19

Choose a tag to compare

What's New

Configurable Commit Cluster Trigger

Historian can now fire based on commit clusters — distinct work phases where the agent made git commits, separated by meaningful user turns. This captures natural work-unit boundaries even when context pressure is low.

{
  "commit_cluster_trigger": {
    "enabled": true,
    "min_clusters": 3
  }
}

Default changed from 2 to 3 minimum clusters. Can be disabled entirely to rely only on pressure-based triggers.

Dream Run History

Dreamer now persists structured run history. The dashboard Dreamer page shows per-project run cards with:

  • Task breakdown (name, duration, output size, success/failure)
  • Smart note evaluation results
  • Memory change diffs (written, deleted, archived, merged)
  • Expandable detail view with relative timestamps

Bug Fixes

  • Heuristics blocked with ctx_reduce_enabled: false: When ctx_reduce was disabled, pending ops were always 0, so heuristic cleanup (tool drops, reasoning clearing) never ran on execute passes. Fixed by removing the pending-ops requirement from the heuristic gate — the scheduler already gates execute decisions properly.
  • Tagger UNIQUE constraint crash: Recovered gracefully from SQLITE_CONSTRAINT_UNIQUE violations during tag insertion, which could occur when two plugin instances shared the same DB or after partial batch failures lost in-memory state.
  • Dashboard "First message" mislabeling: Cache diagnostics no longer labels the oldest event in the 200-event window as "First message (new session)" — it now checks whether earlier assistant messages exist in the DB.

Dashboard Improvements

  • Commit cluster trigger toggle + min clusters input in the Historian config section
  • Corrected heuristic log message from pending_ops_execute to scheduler_execute

v0.3.4

01 Apr 11:55

Choose a tag to compare

Bug Fixes (Council Audit)

8 fixes from a 13-member council audit of the plugin codebase:

Critical

  • Smart note infinite re-evaluation loop: JSON.parse in smart note evaluation had no try-catch — malformed LLM output caused notes to be re-evaluated on every dream run, silently consuming budget. Now catches parse errors, marks notes as checked, and uses greedy regex for bracket handling.

High

  • Dedup drop() return ignored: Heuristic deduplication called drop() but didn't check the return value. In-flight tool calls returning "incomplete" were incorrectly marked as dropped in DB. Now skips status update when drop is incomplete.
  • Corrupt JSON crashes transforms: JSON.parse in read-session-raw.ts had no error handling — a single corrupt message row crashed all transforms for that session. Now returns null and skips corrupt entries.
  • Smart notes not triggering dreams: findProjectsNeedingDream() only queried the memories table. Projects with pending smart notes but no memory changes were never scheduled for dreaming. Now includes smart_notes via UNION query.
  • Ready smart notes never surfaced: peekNoteNudgeText was called without projectIdentity, so readySmartCount was always 0. Ready smart notes evaluated by the dreamer were invisible to users. Now threads projectPath through the transform pipeline.

Medium

  • Dream queue stale threshold: enqueueDream deleted started entries after 10 minutes, but dreams can run for up to 120 minutes. Active dreams had their queue entries incorrectly deleted. Threshold raised to 2 hours.
  • ctx-memory schema leak: Tool schema always exposed all 6 actions (write/delete/list/update/merge/archive) regardless of allowedActions. Regular agents saw options they couldn't use, wasting turns on disallowed actions. Schema now derives enum from actual allowed actions.
  • Dream schedule debounce on failure: lastScheduleCheckMs was set before checkScheduleAndEnqueue(). If the check threw, the debounce blocked retries for 1 hour. Timestamp now set after successful execution.

v0.3.3

01 Apr 00:10

Choose a tag to compare

What's New

Tool-Call Summaries in Historian Chunks

Previously, 61% of assistant messages (tool-only turns with no text) were completely invisible to historian — it had no idea what the agent was doing between text blocks. Historian chunks now include compact TC: summaries extracted from tool call descriptions and key arguments:

  • Bash tools: TC: Fix lint errors, TC: Run tests
  • File tools: TC: read(src/index.ts), TC: edit(src/hooks/transform.ts)
  • Search tools: TC: grep(ctx_memory), TC: glob(**/*.test.ts)
  • Other tools: TC: ctx_memory(write), TC: lsp_diagnostics

TC summaries merge into assistant blocks and only appear when the message has no text content (text-bearing messages already provide sufficient context). The historian prompt now understands TC lines and incorporates their meaning into compartment narratives rather than copying them verbatim.

Proactive Memory Guidance

Agent prompts now include "save to memory proactively" guidance with concrete examples, encouraging agents to write ctx_memory entries after spending multiple turns finding paths, commands, or constraints — reducing repetitive searches across sessions.

Bug Fixes

  • Tool-tag reasoning projection: Tool tags now track reasoningByteSize from preceding thinking-only assistant messages, fixing an undercount where 31.7% of assistant messages had untracked reasoning bytes
  • Pending drop projection: ctx_reduce pending drops now include reasoning bytes in their projection count
  • Projection denominator: Fixed ratio math alignment so reasoning bytes in the numerator are reflected in the denominator

v0.3.2

31 Mar 23:49

Choose a tag to compare

What's New

Smarter Compartment Trigger Projection

The compartment trigger now projects all three sources of freeable context before deciding whether historian needs to fire:

  • Heuristic tool drops — Old tool outputs outside the protected tail, based on auto_drop_tool_age and protected_tags
  • Reasoning clearing — Thinking/reasoning bytes that will be cleared on the next cache-busting pass, based on the reasoning watermark and clear_reasoning_age
  • Pending ctx_reduce drops — User-queued drops now include both text and reasoning bytes

This is especially impactful with ctx_reduce_enabled: false, where the system previously fired historian at every threshold crossing because it couldn't project any freeable space. Now it correctly accounts for automatic cleanup and delays historian until it's actually needed.

Message Revert Support

When users revert messages in OpenCode, magic-context now properly invalidates tags, reasoning watermarks, nudge anchors, note nudge state, stripped placeholder IDs, and FTS index entries.

ctx_search Prompt Guidance

Agent prompts now include "search before asking" guidance with concrete examples, so agents proactively search project memory instead of repeatedly asking for information that's already stored.

Bug Fixes

  • Stale dream queue — Crashed dream runs no longer permanently block /ctx-dream
  • Dream timestamplast_dream_at no longer advances on smart-note-only success
  • Note nudge cooldown — 15-minute cooldown applies even when fresh triggers arrive
  • Search error reporting — FTS/query failures are now logged instead of silently returning empty results
  • Projection denominator — Fixed ratio math that could overstate projected savings when reasoning bytes were large relative to text
  • Drop ratio clamping — Projected drop ratio is now clamped to [0, 1] as a safety bound

v0.3.1

31 Mar 15:00

Choose a tag to compare

What's New

Message Revert Support

When users revert messages in OpenCode, magic-context now properly invalidates affected internal state — tags, reasoning watermarks, nudge anchors, note nudge state, stripped placeholder IDs, and FTS index entries. Compartments and facts are preserved since they represent compressed history that should survive reverts.

ctx_search Prompt Guidance

Agent prompts now include "search before asking" guidance with concrete examples. Agents will proactively use ctx_search to look up project paths, architectural decisions, config details, and prior conversations instead of asking the user for information that's already stored in project memory.

Bug Fixes

  • Stale dream queue — Crashed dream runs no longer permanently block /ctx-dream; stale started entries older than 10 minutes are cleaned before duplicate rejection.
  • Dream timestamplast_dream_at no longer advances when only smart-note evaluation succeeded but actual dream tasks failed.
  • Note nudge cooldown — The 15-minute cooldown now applies even when a fresh trigger arrives, preventing rapid-fire nudges at commit/todo/historian boundaries.
  • Search error reporting — FTS and query failures are now logged instead of silently returning indistinguishable empty results.

v0.3.0

30 Mar 17:37

Choose a tag to compare

What's New

Smart Notes

  • ctx_note now supports smart notes with surface_condition — project-scoped conditional reminders that the dreamer evaluates nightly and surfaces when conditions are met
  • ctx_note read shows session notes plus ready smart notes; pending smart notes stay hidden until dreamer promotes them
  • Smart note guidance appears in agent prompts only when dreamer is enabled

Dreamer-Maintained Project Docs

  • When dreamer.inject_docs is enabled (default), magic-context injects root ARCHITECTURE.md and STRUCTURE.md into the system prompt
  • Per-session doc cache refreshes only on cache-busting passes to avoid mid-session churn

Monorepo Restructure

  • Repository reorganized into Bun workspaces: plugin at packages/plugin, dashboard at packages/dashboard
  • Single bun install at root installs both packages

Dashboard App (v0.1.0)

First release of the Magic Context Desktop Dashboard — a Tauri companion app for browsing and managing magic-context state:

  • Memory Browser — search, filter, edit, and manage project memories with hybrid FTS/LIKE search
  • Session Viewer — browse sessions, compartments, facts, notes with timeline navigation
  • Cache Diagnostics — live cache hit rates, provider-side eviction detection, per-session stats
  • Dreamer Management — view queue, state, timestamps; trigger dream runs
  • Configuration Editor — form-based editing with searchable model selects, per-model overrides for cache TTL and thresholds, conditional embedding config, and agent model/fallback chain UI
  • Log Viewer — live-tailing logs with session/component filters
  • System Tray — quick access, dreamer trigger, background operation
  • Auto-Update — background polling with install & restart toast (via Tauri updater plugin)

Plugin Improvements

  • protected_tags max increased from 20 to 100
  • Stripped placeholder message IDs now persisted across defer passes — fixes a class of defer-pass cache busts
  • todowrite note nudge only fires when all todo items are completed, not on every call
  • 15-minute in-memory cooldown on note nudge delivery to reduce noise
  • Improved cache-bust cause detection in dashboard log parser
  • DCP conflict detection added to setup wizard

Fixes

  • Persisted stripped_placeholder_ids in session_meta so empty-shell removal survives OpenCode message rebuilds
  • Fixed note nudge triggering on intermediate todowrite calls during active work
  • Sanitized FTS5 search queries (quoting tokens) — / and other special chars no longer crash memory search
  • Category filter dropdown now loads correctly on page mount
  • FilterSelect dropdowns auto-size to content and align properly near edges

Breaking Changes

None — fully backward compatible with v0.2.x configs and databases.

v0.2.10

30 Mar 00:02

Choose a tag to compare

Cache Safety Fixes

  • Persisted reasoning clearing watermarkclearOldReasoning and stripInlineThinking were ephemeral in-memory mutations that reverted on the next defer pass when OpenCode rebuilt messages fresh from its DB. This caused a double cache bust: one from the cleanup, another when the next defer pass sent messages with reasoning blocks restored. A monotonic cleared_reasoning_through_tag watermark is now persisted in session_meta and replayed on every pass.

  • Sticky system prompt date — Midnight local date changes in OpenCode's <env> block no longer trigger a system-prompt-hash flush. The date string is frozen on first sight and only updated on cache-busting passes, eliminating one unnecessary full-prefix cache rebuild per day.

  • ctx_reduce_enabled config wiringctx_reduce_enabled: false was never passed from plugin config to the hook, so the nudger remained active regardless of the setting. Rolling nudges injected into assistant messages caused cache busts even with ctx_reduce disabled.

Dashboard master

01 Apr 13:26

Choose a tag to compare

Dashboard master Pre-release
Pre-release
fix(dashboard): fix md5 crate API and enable tokio process feature

md5 0.7 uses md5::compute() not md5::Md5, and tokio::process
requires the 'process' feature flag in Cargo.toml.