Magic Compact is a plugin for OpenCode and Claude Code that compresses conversation history by replacing old assistant turns with summaries while preserving user messages and tool structure, enabling lossless context compression.

Stars

123

7-day growth

No data

Forks

7

Open issues

0

License

BSD-3-Clause

Last updated

2026-07-24

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It offers a novel approach to context compression that preserves the conversation skeleton and retrievability, unlike built-in compaction that flattens everything. It is lightweight, zero-overhead, and designed to maintain agent memory without amnesia.

Who it is for

  • Developers using OpenCode or Claude Code for extended coding sessions
  • AI agent users who need to manage long conversations efficiently
  • Users frustrated with built-in compaction losing context details
  • Plugin developers interested in context management techniques

Use cases

  • Compressing long agent sessions without losing critical details
  • Preserving user commands and tool calls while reducing token usage
  • Recompacting after adding new turns to maintain manageable context length
  • Retrieving pruned tool outputs on demand via read_omitted_content tool

Strengths

  • Lossless compression: maintains turn-by-turn flow and retrievability of pruned data
  • Zero compaction overhead: compaction triggered manually, not during agent loop
  • Preserves user messages verbatim, keeping requirements visible
  • Recompactable: can apply compression again on new turns

Considerations

  • Claude Code version does not compact in place and requires manual session resume
  • Magic-stats feature is exclusive to OpenCode
  • Relies on optional tool (read_omitted_content) for retrieving pruned content, which agent may need to call

README quick start

Installation

Description

Lossless context compression plugin for OpenCode.

Related repositories

Similar projects matched by category, topics, and programming language.

TanStack
Featured
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web DevelopmentFrontend Frameworks
14,861
vercel-labs
Featured
vercel-labs GitHub avatar

scriptc

scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.

Developer ToolsCode Quality & Build
1,985
Jakubantalik
Featured
Jakubantalik GitHub avatar

thinking-orbs

A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.

AI & Machine LearningAI Agents
1,191