Communitygithub.com

ComeOnOliver/skillshub

OpenClaw Control UI 用メモリ圧縮システム — バックグラウンド実行、トースト通知、設定可能なトークン閾値による自動トリガー、会話サマリ段落、専用設定タブ(モデルセレクター付き)、結果履歴を提供します。

skillshub とは?

これは、OpenClaw Control UI 用の高度なメモリ圧縮システムです。チャットツールバーにSVGのコンテキストゲージボタンを追加し、現在のトークン使用量を視覚的に表示します。このシステムは、手動または設定可能な閾値を超えた際に自動でバックグラウンド圧縮を実行し、**ブロッキングモーダルを一切使用せず**、すべてのステータスをトースト通知で伝えます。圧縮出力には、構造化されたセクションの前に自然言語による「## Conversation Summary」段落が含まれ、会話の流れを理解しやすくします。専用の設定タブでは、自動圧縮の有効/無効、閾値の調整、圧縮に使用するモデルの選択、結果の保存を管理できます。認証はOAuth、APIキー、フォールバックの階層に従い、他のプラグインと統合されています。結果は`compaction-config.json`に保存され、トークン節約量、トリガータイプ、タイムスタンプなどの詳細なメトリクスを確認できます。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/LeoYeAI/openclaw-master-skills/compaction-ui-enhancements

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Compaction UI v2.1.0

OpenClaw Control UI 用メモリ圧縮システム — バックグラウンド実行、トースト通知、設定可能なトークン閾値による自動トリガー、会話サマリ段落、専用設定タブ(モデルセレクター付き)、結果履歴。

ステータス: ✅ アクティブ

コンポーネントステータス
コンテキストゲージボタン✅ 動作中
バックグラウンド圧縮(トースト)✅ 動作中
自動圧縮トリガー✅ 動作中
会話サマリ段落✅ 動作中
設定タブ(プラグイン登録済み)✅ 動作中
モデルセレクター✅ 動作中
最終結果保存+ビューアー✅ 動作中
設定の永続化と再読み込み✅ 動作中
認証階層(OAuth > API > フォールバック)✅ 動作中
チャット履歴フィルター✅ 動作中
完全なバックグラウンド分離(チャットへの干渉なし)✅ 動作中

機能

1. コンテキストゲージボタン (app-render.helpers.ts)

チャットツールバー内に配置される円形SVG進行リング。手動圧縮トリガーとしても機能します。

  • 配置: renderChatControls() 内のセッションセレクタードロップダウンの後
  • データソース: sessionsResult.sessions[].totalTokens およびセッション行の contextTokens
  • 色: 緑(<60%)、黄(60-85%)、赤(≥85%)
  • 無効化: 使用率が20%未満、または圧縮実行中
  • ツールチップ: 「コンテキスト: XK / YK トークン (Z%)」を表示

2. バックグラウンド圧縮(トースト)

クリック時(または自動トリガー時)、圧縮は標準の右下トーストシステムを使用してバックグラウンドで実行されます — ブロッキングモーダルはありません。UIは完全に操作可能なままです。

  • 実行中トースト: 「メモリ圧縮」とスピナーを表示
  • 完了トースト: 「圧縮完了: XK → YK」とチェックマークを表示(5秒後に自動消去)
  • エラートースト: 失敗メッセージを表示(5秒後に自動消去)
  • すべてのバックグラウンドプロセス(cron、ナレッジ抽出など)と一貫性のある backgroundJobToasts システムを使用

3. 自動圧縮

各チャット応答後(final イベント)、UIはトークン使用量を設定済み閾値と比較します。超過した場合:

  • バックグラウンド圧縮が自動的にトリガーされます
  • 現在の使用率とともに「自動圧縮中 (X%)」というトーストが表示されます
  • 5分間のデバウンスにより、繰り返しのトリガーを防止します
  • 圧縮成功後、チャットは自動的に更新されます
  • 圧縮が行われなかった場合、トーストは表示されません(サイレント削除)

4. 会話サマリ段落

圧縮出力の先頭には、構造化された ## Goal セクションの前に ## Conversation Summary セクションが挿入されるようになりました。これは3~6文の自然言語段落で、以下の内容を含みます:

  • 会話の全体的なトピックを説明
  • 議論の流れと重要な遷移を説明
  • 会話がどのように進行したかを要約
  • 過去形で書かれたナラティブな概要

実装: compact.ts を介して、アップストリームの圧縮LLM呼び出しにカスタム指示が注入されます。この指示は、ユーザー提供のカスタム指示(/compact [指示] から)の前に追加されるため、両方が共存します。

出力例:

## Conversation Summary
会話は、ユーザーが圧縮システムの改善を要求し、具体的にはブロッキングモーダルからバックグラウンドトーストへの移行を依頼したことから始まりました。その後、自動圧縮コントロールを備えた設定タブの追加について議論が移りました。これらの機能を実装してテストした後、ユーザーは設定がタブ間の移動で永続化されていないことに気づき、モジュールレベルの状態キャッシュの修正に至りました。最後に、ユーザーはより良いコンテキストのために、圧縮出力にナラティブなサマリ段落を追加するよう要求しました。

## Goal
...

5. 設定タブ(プラグイン登録)

エージェント ナビゲーショングループ下にある専用の圧縮タブ。プラグインUIアーキテクチャを介して登録されます。

登録: plugins-ui.ts → BUILTIN_UI_VIEWS、id: "compaction"、group: "agent"、position: 7、icon: "archive"

カード:

自動圧縮カード

  • トグル: 自動圧縮の有効/無効
  • 閾値スライダー: 10% ~ 95%(デフォルト: 60%)
  • 色分け: 緑(<60%)、黄(60-85%)、赤(≥85%)

モデルカード

  • ドロップダウン: 圧縮に使用する特定のモデルを選択、またはセッションデフォルトを使用
  • プロバイダーごとにグループ化、コンテキストウィンドウサイズを表示
  • カスタムモデル選択時の警告(APIキー確認)
  • フォールバック: カスタムモデルが失敗した場合、自動的にセッションデフォルトにフォールバック

結果保存カード

  • トグル: 圧縮されたサマリテキストを確認用に保存するオプトイン

最終圧縮カード

  • Before/After: 2カラムグリッドに大きなスタイル付きトークン数を表示
  • 統計: 節約トークン数、削減率、トリガータイプ、タイムスタンプ、セッションキー
  • 結果を表示: 展開可能なサマリビューアー(保存が有効な場合)
  • クリア: 保存された結果をリセット
  • ヒント: 保存がオフの場合、「結果の保存を有効にする」メッセージを表示

状態管理:

  • モジュールレベルの状態は、セッション内の再レンダリング間で永続化されます
  • タブにアクセスするたびに設定がバックエンドから再読み込みされます(2秒の古さ閾値)
  • resetCompactionSettingsState() はテストとタブ切り替え用にエクスポートされています

6. 認証階層

圧縮は getApiKeyForModel を介して resolveApiKeyForProvider を使用します — チャットと同じ認証チェーンです:

OAuth → APIキー → フォールバック

個別の設定は必要ありません。OAuth(Claude Max)がプライマリ認証プロファイルとして設定されている場合、圧縮は自動的にそれを使用します。カスタムモデル選択は、同じ認証チェーンを独立して使用します。

7. 結果保存

有効にすると、最新の圧縮結果が {agentDir}/compaction-config.json に永続化されます:

{
  "settings": {
    "autoEnabled": true,
    "autoThresholdPercent": 60,
    "storeLastResult": true,
    "compactionModel": "anthropic/claude-sonnet-4-6"
  },
  "lastResult": {
    "timestamp": 1709283600000,
    "trigger": "manual",
    "tokensBefore": 50614,
    "tokensAfter": 4766,
    "tokensSaved": 45848,
    "percentReduction": 91,
    "sessionKey": "agent:main:main",
    "summary": "## Conversation Summary\n会話は...に焦点を当てていました。\n\n## Goal\n..."
  }
}

保存が無効な場合、メタデータ(タイムスタンプ、トークン数)は引き続き保存されますが、サマリテキストは省略されます。

8. チャット履歴フィルター

  • NO_REPLY/HEARTBEAT_OK フィルタリング: これらのテキストと完全に一致するアシスタントメッセージをスキップします
  • 圧縮区切り: __openclaw.kind === "compaction" メッセージに対してラベル付き区切り線をレンダリングします

アーキテクチャ

バックエンド RPC

メソッド説明
sessions.compact圧縮を実行(完了後に結果を記録)
compaction.getSettings設定ファイルから設定を読み取り
compaction.saveSettings設定を更新(閾値は自動的に10-95%にクランプ)
compaction.getLastResult保存された最終圧縮結果を取得
compaction.clearLastResult保存された結果をクリア

変更されたファイル

ファイル目的
src/gateway/server-methods/compaction.ts設定RPC、設定I/O、結果記録
src/gateway/server-methods/sessions.tssessions.compact RPC(圧縮後に結果を記録)
src/gateway/server-methods/plugins-ui.tsプラグインビュー登録
src/gateway/server-methods.tsハンドラーの配線
src/gateway/server-methods-list.tsメソッド登録
src/gateway/method-scopes.tsスコープ登録
src/agents/pi-embedded-runner/compact.tsチャットサマリ指示の注入
ui/src/ui/app-render.helpers.tsコンテキストゲージ+バックグラウンドトーストトリガー
ui/src/ui/app-gateway.tsfinalイベント後の自動圧縮チェック
ui/src/ui/views/compaction-settings.ts設定タブビュー
ui/src/ui/app-render.tsビューの配線+インポート
ui/src/ui/views/chat.tsチャット履歴フィルター

設定ファイル

{agentDir}/compaction-config.json — エージェントごと、初回設定保存時に作成されます。

プラグイン登録

圧縮タブは、plugins-ui.ts で組み込みプラグインビューとして登録されます:

{
  id: "compaction",
  label: "Compaction",
  subtitle: "メモリ管理",
  icon: "archive",
  group: "agent",
  position: 7,
  pluginId: "compaction-ui",
}

既知の注意点

  • 設定がタブ移動間で永続化されない: v2.1.0で修正済み。モジュールレベルの _state.loaded フラグが再読み込みを妨げていました。現在はタブに再入場するたびに2秒ごとに再読み込みされます。
  • モデルセレクターにはAPIキーが必要: カスタムモデルを選択する場合、そのプロバイダーのAPIキーが設定されていることを確認してください。UIに警告が表示されます。
  • 圧縮モデルの形式: "provider/model" 形式である必要があります(例: "anthropic/claude-sonnet-4-6")。無効な形式は黙って無視され、セッションデフォルトにフォールバックします。
  • parentIdスキップセットの伝搬はメッセージのみ: readSessionMessages からメモリフラッシュメッセージをフィルタリングする際、スキップセットはmessage フィールドを持つエントリを介してのみ伝搬しなければなりません。非メッセージプロトコルエントリ(type:"custom")は論理的なターンを橋渡しします — それらのIDがスキップセットに入ると、残りの会話全体が非表示になります。修正: parsed?.message エントリのみをスキップセットに対してチェックし、それらのIDのみをスキップセットに追加します。
  • ブロッキングモーダルは絶対に使用しない: app-render.helpers.ts のゲージボタンは、決して全画面オーバーレイモーダルをレンダリングしてはいけません。圧縮はバックグラウンドプロセスであり、すべてのステータスは右下のトーストシステムを介して伝達されます。compactState.phase に依存した position:fixed; inset:0 のオーバーレイは削除してください。ボタンは実行中にスピナーアイコンを表示してもかまいませんが、UIをブロックしてはいけません。

変更履歴

v2.1.0

  • 会話サマリ段落: 圧縮出力が、構造化セクションの前に ## Conversation Summary のナラティブ段落で始まるようになりました
  • モデルセレクター: 圧縮に使用する特定のモデルを選択、またはセッションデフォルトを使用。プロバイダーグループ化されたドロップダウン
  • 設定再読み込みの修正: タブが設定を永久にキャッシュする代わりに、バックエンドから2秒ごとに再読み込みするようになりました
  • 参照ファイルの更新: references/ を現在のソースと同期

v2.0.0

  • バックグラウンド圧縮: ブロッキング全画面モーダルをバックグラウンドジョブトーストに置き換え
  • 自動圧縮: トークン使用量が閾値(設定可能、デフォルト60%、5分間デバウンス)を超えた場合、チャット応答後にトリガー
  • 設定タブ: エージェントナビゲーショングループ下にプラグイン登録された圧縮タブ
  • 結果記録: sessions.compact が圧縮前後のトークン数とオプションのサマリを記録
  • 認証階層: チャットと同じOAuth → API → フォールバックチェーン
  • 設定RPC: compaction.getSettings、compaction.saveSettings、compaction.getLastResult、compaction.clearLastResult

v1.0.0

  • 初回リリース: コンテキストゲージボタン、アニメーションフェーズ付きブロッキングモーダル、LLM要約機能付き sessions.compact RPC、チャット履歴のNO_REPLY/HEARTBEAT_OKフィルタリング、圧縮区切り線

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

関連スキル