Compaction Skillのロゴ

Compaction Skill

コミュニティ
zeenie-ai
compaction-skill

Manage memory compaction by summarizing conversation history when approaching token limits

概要

公開者zeenie-ai
リポジトリOpenCompany
スキル名compaction-skill
スター
912
フォーク
137
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    zeenie-aiがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Compaction Skill」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/zeenie-ai/OpenCompany/tree/main/server/skills/assistant/compaction-skill
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zeenie-ai/OpenCompany.git /tmp/OpenCompany
mkdir -p .claude/skills
cp -r /tmp/OpenCompany/server/skills/assistant/compaction-skill .claude/skills/compaction-skill
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでCompaction Skillを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にCompaction Skillを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Compaction Skillは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Memory Compaction Skill

You have the ability to compact conversation memory when it grows too large. Compaction transforms verbose conversation history into a structured summary that preserves essential context while reducing token usage.

When to Compact

Compact memory when:

  • The system indicates token threshold is approaching
  • Conversation history becomes repetitive or verbose
  • You need to preserve important context but reduce size
  • Starting a new phase of work after completing a major task

Compaction Summary Structure

When compacting, create a summary with these 5 sections:

1. Task Overview

What the user is trying to accomplish. Include:

  • Primary goal or objective
  • Key constraints or requirements
  • Scope of the work

2. Current State

What's been completed and what's in progress:

  • Completed tasks and their outcomes
  • Work currently in flight
  • Pending decisions or blockers

3. Important Discoveries

Key findings, decisions, or problems encountered:

  • Technical discoveries or insights
  • Decisions made and their rationale
  • Problems encountered and solutions applied
  • User preferences learned

4. Next Steps

What needs to happen next:

  • Immediate actions required
  • Planned approach for remaining work
  • Dependencies or prerequisites

5. Context to Preserve

Critical details that must be retained:

  • Specific values, IDs, or references
  • User preferences or constraints
  • Technical details needed for continuity
  • Any warnings or caveats

Compaction Format

Output the compacted summary in this format:

markdown
# Conversation Summary (Compacted)
*Generated: [ISO timestamp]*

## Task Overview
[1-3 sentences describing the goal]

## Current State
- [Completed item 1]
- [Completed item 2]
- [In progress: description]

## Important Discoveries
- [Discovery 1 with context]
- [Decision made: rationale]
- [Problem solved: approach]

## Next Steps
1. [Next action]
2. [Following action]

## Context to Preserve
- [Critical detail 1]
- [Critical detail 2]

Best Practices

  1. Be Concise: Each section should be brief but complete
  2. Preserve Specifics: Keep exact values, names, and references
  3. Capture Decisions: Record WHY decisions were made, not just WHAT
  4. Include Failures: Document what didn't work to avoid repetition
  5. Maintain Continuity: Summary should allow seamless continuation

What NOT to Include

  • Verbose back-and-forth dialogue
  • Redundant information
  • Superseded decisions (only keep final decisions)
  • Exploratory tangents that didn't lead anywhere
  • Standard pleasantries or acknowledgments

Example Compaction

Before (verbose history):

Human: Can you help me debug this Python function?
AI: Of course! Please share the function.
Human: Here's the function: def calculate(x): return x * 2
AI: I see the function. What issue are you experiencing?
Human: It returns None sometimes
AI: That's interesting. Can you show me an example input?
Human: calculate("5") returns None
AI: Ah, I see the issue! When you pass a string...
[continues for 50+ messages]

After (compacted):

markdown
# Conversation Summary (Compacted)
*Generated: 2025-02-13T10:30:00Z*

## Task Overview
Debug Python function `calculate(x)` that returns None for some inputs.

## Current State
- Identified root cause: string inputs cause implicit None return
- Implemented fix with type checking and conversion
- Tests passing for int, float, and string inputs

## Important Discoveries
- Original function had no type validation
- String multiplication in Python doesn't raise error but behaves unexpectedly
- User prefers explicit error messages over silent failures

## Next Steps
1. Add input validation for edge cases (None, empty string)
2. Write unit tests for the fixed function

## Context to Preserve
- Function location: `utils/math_helpers.py:45`
- User wants to maintain backward compatibility
- Prefer raising ValueError over returning None

Integration with Memory System

When compaction is triggered:

  1. The compacted summary replaces the current memory content
  2. New conversation messages are appended after the summary
  3. The summary header indicates when compaction occurred

This allows conversation to continue naturally while maintaining reduced token usage.

よくある質問

AIスキル「Compaction Skill」では何ができますか?

Manage memory compaction by summarizing conversation history when approaching token limits

TypingMindでCompaction Skillを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Compaction Skillはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにCompaction Skillをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/zeenie-ai/OpenCompany/tree/main/server/skills/assistant/compaction-skillを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Compaction Skillを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Compaction Skillで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもCompaction Skillを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Compaction Skill」は無料ですか?

はい。zeenie-aiがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇