Skip to content

v0.47.0

Choose a tag to compare

@github-actions github-actions released this 09 Oct 22:15
· 377 commits to master since this release

This minor release replaces the tag-age reasoning setting with a token budget, keep_reasoning_tokens, and stops Anthropic subagent tool loops being rejected after ctx_reduce. Pi and Oh My Pi (OMP) subagents survive a busy database, OMP's 30-second extension deadline can no longer send unmanaged history, and several Pi/OMP pressure readings that stopped the historian are fixed. Auto-search no longer holds up a turn. There is no database change.

Upgrading

  • No migration. The database stays at schema v95, so restarting OpenCode, OpenCode 2, Pi or OMP on 0.47.0 is enough.
  • clear_reasoning_age is replaced by keep_reasoning_tokens. The old key is ignored with a warning. Run magic-context doctor to remove it; ages can't be converted to tokens, so doctor doesn't guess a value. Without a setting, every model now keeps a fixed 10,000 tokens of older reasoning.
  • OpenCode 2 still needs 2.0.22 or newer. OpenCode 2 does not install plugin updates on its own: open /plugins, select Magic Context and press ctrl+u, or run opencode plugin update.
  • Rust transform mode (experimental): use the ck-mc from this release to get the reasoning budget, the attachment fix and the Claude Haiku 5.5 thinking rules below.

New

  • keep_reasoning_tokens: keep older reasoning by token count (#620, requested by @tenshiak). Set a number, or a per-model map such as { "default": 10000, "openai/*": 6000 }; 0 removes all older reasoning that can be removed. The newest reasoning is kept in whole steps until the budget runs out, and the newest step always stays. Removal only happens on passes that already rebuild the prompt cache. /ctx-status and the Pi status dialog show how much is kept. This applies on OpenCode 1 and 2, Pi, OMP and the Rust module. See the configuration reference and context reduction.
  • Host stall profiler (OpenCode 1, off by default). When OpenCode's main thread stalls for several seconds, it writes a report naming the plugin whose code was running. Create host-profiler/enable in the Magic Context storage directory (~/.local/share/cortexkit/magic-context by default) to turn it on and delete it to turn it off, without a restart; reports appear in the same folder. Details: docs/reports/host-stall-profiler.md.

Changes

  • Status shows historian runs. The Pi status dialog, Pi's /ctx-status details and the dashboard's session view now count recorded historian runs, in place of a threshold counter that always stayed at 0 (#634).
  • /ctx-status shows the context window it measures against: the exact token count and where it came from, such as the provider's measurement or the model catalog (#634). This applies on OpenCode and Pi.
  • The historian sees room posts and private messages whole. Historian input no longer cuts tool text at hidden limits, such as 400 characters for room posts. A .truncate(N) in historian.expand_tools now ends at a full sentence and says how much it left out.
  • Claude Haiku 5.5 gets the same signed-thinking handling as Fable 5.1, Opus 5.5 and Sonnet 5.5, so edits Anthropic would reject are held back. This applies on OpenCode, Pi and the Rust module.
  • Pi/OMP: the log records project binding changes and failed binding writes (#646). When a session's project changes, for example after /move, the Magic Context log names the old and new project. A binding write that keeps failing is logged at most every 10 minutes, followed by one line when it recovers. Before, a failed write was retried silently.
  • OpenCode 2: a dreamer task stopped before its setup now says which one (#647). The error names the task, the background session, its folder and the step that was missed, and notes that switching models won't help.
  • Rust transform mode: old images are cleared on the same schedule as in TypeScript mode, no longer tied to reasoning age. An affected session makes this one-time change on its next cache rebuild.

Fixes

  • Anthropic: a turn's thinking is no longer changed while the turn is still running (#630, reported by @tppawelgrzesik). After ctx_reduce, a subagent's next request in the same tool loop could lose thinking blocks, and Anthropic rejected it ("thinking or redacted_thinking blocks in the latest assistant message cannot be modified"). Drops that would touch that thinking now wait until the next real user message. If a provider rejects a turn's thinking anyway and the host retries that turn, the retry sends the original blocks. This applies on OpenCode 1 and 2, Pi and the Rust module.
  • Pi/OMP: the historian is no longer blocked by an inflated window size (#634, reported by @Zireael). A failed reply's usage could be saved as the model's measured capacity, so 834,000 input tokens read as 9.5% and the historian never started. Only successful provider readings count now, and inflated saved values are corrected from the session's history, on OpenCode too.
  • Pi: a pending compaction marker left behind after a history summary is expected (#635, reported by @Zireael). It is cleared on the next pass that rebuilds the cache; the delay came from the deferrals fixed in #634, so no separate fix was needed.
  • OMP: per-turn billing usage is no longer read as context size (#636, reported by @Zireael). Some OMP providers, such as Cursor, report a whole turn's usage on one message, which produced a phantom "2913%" emergency at real 94% usage. Readings larger than the model's window are now ignored and the request is measured instead.
  • Pi/OMP: a historian or subagent run keeps its finished reply (#637, reported by @red-projects). An "aborted" event after the reply had finished could replace it, and the run failed with no result.
  • Dreamer: the retrospective task runs in SDK and bridge setups (#638, reported by @salacoste). After its first run, sessions without host activity records counted as inactive, so scheduled runs were skipped forever. It now falls back to the session's message index.
  • Pi/OMP: a busy database no longer kills a subagent (#640, reported by @TheOrdinaryWow). When another process held the database, the subagent's turn was refused and nothing resent it, so OMP cancelled the task. The turn now resends the last good request when it still fits, and otherwise waits up to about 16.5 seconds for the database. Two OMP-only mismatches that made a valid last good request look unusable are fixed, and a turn that is still refused says what it was waiting for. OpenCode 1 and 2 also try the last good request before waiting, and OpenCode 2 checks it against the current tools and system prompt.
  • OMP: the 30-second extension deadline can no longer send unmanaged history (#641, reported by @Zireael). When Magic Context took longer than 30 seconds, OMP sent the raw conversation, and Magic Context then saved results the provider never saw. Context work now finishes within 25 seconds, and a request whose context work did not finish in time is stopped with a notice instead of being sent. On Pi and OMP, emergency cleanup no longer waits for a running historian. OMP side turns can't be told apart from main turns, so once a session has run a side turn, this dispatch check stays off for that session.
  • The historian no longer fails on a chunk that splits a tool call from its result (#642, reported by @chpock). Under high pressure, the historian could be handed a single message that ended between a tool call and its result. No valid summary can end there, so every attempt failed with MC-H01 on every turn. Chunk selection now never cuts a tool call off from its result, and when no complete chunk exists the historian waits for one instead of failing. This applies on OpenCode and Pi.
  • OMP: pi historian and dreamer models are used (#645, reported by @sisttri). Reloading config created an empty omp block that took priority over pi, so the historian and dreamer ran on OMP's default model.
  • Rust transform mode keeps tool-result attachments. On OpenCode 1, images and PDFs from read, computer_use and other tools were dropped from tagged results. They are now sent, and results already sent without them get them back on the next cache rebuild. An attachment OpenCode can't represent shows an [attachment not shown: …] line instead of disappearing.

Performance

  • Auto-search no longer holds up a turn. The search runs in a separate read-only worker, and a turn waits at most 3 seconds for it; before, a 3-second limit could stretch to 5–7 seconds. A slow search, or one before the search index is ready after a start, skips the hint for that turn, and retries of that turn stay without it. This applies on OpenCode 1 and 2, Pi and OMP.
  • Less work when the historian's budget is spent. When the historian has used its budget for the current 10-minute window, passes skip reading history and preparing its prompt, and the log says when it can run next. A historian run's startup work no longer runs inside the pass that schedules it. This applies on OpenCode and Pi.

Internal

  • ARCHITECTURE.md now states that an explicit /ctx-flush may apply queued drops while the historian runs; this was already the behavior.
  • Investigation and review reports, design notes, profiling scripts and tests. CI builds the Pi package before plugin tests.