engineering / skill

Magic Compact

A Claude Code and OpenCode plugin for session compaction, assistant-turn summaries and tool input/output pruning.

At a glance

Purpose
A Claude Code and OpenCode plugin for session compaction, assistant-turn summaries and tool input/output pruning.
Runs in
Local agent with shell
Operating systems
Not stated
Needs
Runtime: Not stated; Needs internet: Not stated; Needs accounts or API keys beyond your agent: Not stated
Files and data
Reads files: Not stated; Writes files: Not stated; Sends data to other services: Not stated
Tool type
Skill
Delivery
From GitHub
Version
Latest on the main branch
Access
Code on GitHub
Compatibility
According to the README, it works with Claude Code, installed from the repository's first-party plugin marketplace, and with OpenCode, installed with opencode plugin magic-compact --global.
External costs
The repository is BSD-3-Clause licensed and the README states no pricing. The README says the conversation is summarized with one request and /magic-trim does not call an LLM. Your coding agent or model provider may charge for usage.
Permissions
The README describes the plugin processing conversation content in Claude Code or OpenCode. The README's OpenCode installation first deletes matching magic-compact packages from ~/.cache/opencode/packages, then installs the package and adds it to global OpenCode configuration. The README gives a plugin marketplace route for Claude Code. The README says compaction summarizes old assistant turns, prunes eligible tool input and output and creates a backup session. The README describes cached content retrieval through read_omitted_content, while its tool-specific rules discard some outputs without caching. The README says Claude Code compaction creates a new session instead of modifying the current transcript. The top-level entries include scripts/, whose access the README does not detail.
Usage terms
BSD 3-Clause "New" or "Revised" License, as stated in the repository. See its LICENSE.md file for the exact terms.

Code on GitHub

aerovato/magic-compact

BSD-3-Clause

TypeScript174 stars18 forksLast pushed 17 Sept 2026 UTC

Lossless context compression plugin for Claude Code & OpenCode.

Topics: anthropic chatgpt claude claude-code claude-code-plugin claude-skills codex gemini

Public GitHub data fetched · 0 days old

Skill folders in this repository (1)

Folders that contain a SKILL.md file, from GitHub's file list on .

View on GitHub ↗

What it does

Magic Compact is a plugin for Claude Code and OpenCode. The README says it replaces old assistant turns with per-turn summaries while retaining user messages and tool-call structure. The README says bulky completed tool input and output can be replaced with omission notices and cached for read_omitted_content, but its tool-specific rules discard some outputs without caching.

The README gives /magic-compact with an optional number of recent assistant turns to preserve and says a backup session is created first. The README marks /magic-trim as experimental and OpenCode-exclusive and describes it as tool input/output pruning without summarization. The README also lists /magic-stats for OpenCode. For Claude Code, the README says compaction creates a new session and prints a /resume command.

The README says development is paused in favor of Operator Memory and describes Magic Compact as remaining functional.

Who it is for

Claude Code and OpenCode users who want to reduce a long session's context on demand.

Example tasks

Run /magic-compact to summarize all old assistant turns.
Run /magic-compact 3 to keep the 3 most recent assistant turns and summarize the rest.
In OpenCode, run /magic-trim to prune eligible tool input and output without summarizing.
In OpenCode, run /magic-stats to see token savings for the conversation.
In Claude Code, run the /resume command the plugin prints to enter the compacted session.

Getting started

For Claude Code, the README gives /plugin marketplace add aerovato/magic-compact and /plugin install claude-magic-compact@magic-compact, then /reload-plugins if Claude Code is already open. For OpenCode, it first removes the cached magic-compact packages under the OpenCode cache folder, then runs opencode plugin magic-compact --global. If you see "No versions available", it gives the same command prefixed with NPM_CONFIG_MIN_RELEASE_AGE=0. The README has the exact commands.

Limitations

The README says development is paused in favor of Operator Memory, and that Magic Compact remains fully functional. The README says Claude Code exposes less capability to plugins than OpenCode. For Claude Code, it says the plugin creates a new compacted session instead of compacting in place, you run the /resume command it prints, and /magic-stats is not implemented. It marks /magic-trim and /magic-stats as OpenCode exclusive, and /magic-trim as experimental. It says summaries replace old assistant reasoning and text, and that completed tool outputs over 128 words or 1024 characters are omitted by default, with tool-specific rules for each agent. The repository can change at any time; check its README before you install.

Data practices

The README says pruned tool content can be cached for retrieval, but its tool-specific rules discard some outputs without caching. The README says a backup session is created before compaction or trimming. It does not say where the cached content or backups are stored. What is sent where depends on your coding agent and model provider.

Community experience

Not rated yet

Sign in to share your experience.

Comments 0

No comments yet.

Sign in to comment

Report a listing concern