ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 MichaelP17

compact-shaper

Claude Code のコンパクションを調整します。通常のコンパクションは引き継ぎとして要約し、`/compact prune` は再読込できるツール出力を削りながら、すべてのメッセージを一語ずつ保ちます。

MichaelP17@MichaelP17

MichaelP17/claude-mods/tree/main/compact-shaper

翻訳済み

この mod について

compact-shaper は Claude Code に 2 つのコンパクション経路を提供します。ネイティブの /compact による引き継ぎ形式の要約と、長いツール出力を先頭まで短くして取得方法の注記を付ける /compact prune です。後者はすべてのメッセージを完全なまま保持します。サブエージェントの結果、失敗したツール呼び出し、git status や CI ログなどの状態スナップショットを保護し、節約量が 10% 未満になる削減は行いません。preserveRecentMessages と keepHeadChars は /config または settings.json から設定できます。/prune-preview コマンドではセッションを変更せずに削減内容をプレビューできます。

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add MichaelP17/claude-mods
claude plugin install compact-shaper
原文 / README

compact-shaper

Shapes Claude Code's compaction. A normal compaction is summarized as a handoff; /compact prune cuts tool output that can be read again instead, and keeps every message word for word.

Two ways to compact

| Command | What happens | When it fits | | --- | --- | --- | | /compact | Claude Code's own summary, written along the structure of a handoff: goal, state, decisions and their reasons, rejected approaches, open points, next step, files to read first. Text after /compact is added to that structure | Several topics in, or the context is large; the summary is far smaller than anything a cut leaves | | /compact prune | Long tool outputs are cut to their head and a note on how to get them back; messages stay exactly as written | In the middle of a task, when the exact thread of the conversation matters more than the size |

The automatic compaction takes the first path. Subagents keep the native compaction unchanged.

/prune-preview shows what /compact prune would cut, without changing anything.

The handoff-shaped summary stays inside the session; it writes no HANDOFF.md. For a break between tasks, or to continue on another device, a written handoff and /clear beat both: cache-watch offers that at the right moments.

What /compact prune cuts

Every tool output longer than keepHeadChars + 200 characters, outside the first and the newest preserveRecentMessages messages, keeps its first keepHeadChars characters. Read results of a file that was later edited or read again in full count as superseded and are cut the same way. Edit and Write inputs shrink to their head, since the file on disk holds the current content.

Protected, because they cannot simply be produced again:

  • results of subagents (Agent, Task)
  • failed tool calls
  • git status, git stash list, gh run view and gh pr checks: snapshots of a state that has moved on, and CI logs that expire

A cut that saves less than 10% is skipped and leaves the conversation unchanged.

Configuration

| Option | Default | Meaning | | --- | --- | --- | | preserveRecentMessages | 6 | Newest messages that are never cut | | keepHeadChars | 300 | How much of a cut output stays |

Change them in /config, or in ~/.claude/settings.json under pluginConfigs["compact-shaper"].options.

関連作品