context-manager
コンテキストサイズを監視し、作業中に自動 compact が走らないよう事前にコンテキストを圧縮する。「コンテキストを圧縮して」「compact して」「メモリを整理」「会話を整理」「履歴を圧縮」「コンテキストが大きい」「動作が重い」などで起動。操作がない時やタスクの区切りでコンテキストが一定ラインを超えていたら自動的に /compact を実行。
When & Why to Use This Skill
The Context Manager skill optimizes Claude's performance by proactively monitoring and compressing conversation history. By automatically triggering the compacting process during natural task breaks or idle periods, it prevents unexpected workflow interruptions caused by automatic system compacting, reduces token consumption, and maintains high response speeds during long-running sessions.
Use Cases
- Large-scale Coding Projects: Automatically compress context after finishing a multi-file edit or a complex debugging session to keep the agent responsive for the next task.
- Preventing Workflow Interruption: Proactively manage memory during idle moments so that Claude doesn't force a 'compact' pause in the middle of generating critical code or content.
- Token Usage Optimization: Maintain a lean conversation history during long research or brainstorming sessions, ensuring that only essential information is retained and reducing overall API costs.
- Performance Maintenance: Resolve 'heavy' or slow agent behavior by cleaning up memory when the context size exceeds optimal thresholds after extensive data processing.
| name | context-manager |
|---|---|
| description | コンテキストサイズを監視し、作業中に自動 compact が走らないよう事前にコンテキストを圧縮する。「コンテキストを圧縮して」「compact して」「メモリを整理」「会話を整理」「履歴を圧縮」「コンテキストが大きい」「動作が重い」などで起動。操作がない時やタスクの区切りでコンテキストが一定ラインを超えていたら自動的に /compact を実行。 |
| allowed-tools | [Bash] |
Context Manager
コンテキストサイズを監視し、作業中に自動 compact が走らないよう事前にコンテキストを圧縮します。
目的
- 作業中に自動 compact が走って作業が中断されるのを防ぐ
- タスクの区切りや操作がない時に事前にコンテキストを圧縮
- パフォーマンスを維持しながらスムーズな作業を実現
ワークフロー
1. コンテキストサイズを監視
会話の長さやコンテキストサイズを常に監視。
2. 適切なタイミングで自動圧縮
以下のタイミングでコンテキストが一定ラインを超えていたら自動的に /compact を実行:
- タスクの完了時: 一つのタスクが完了した区切り
- 操作がない時: ユーザーの入力待ちの状態
- ファイル操作の区切り: 複数ファイルの編集が一段落した時
3. 圧縮の実行
閾値を超えている場合、ユーザーに確認せず自動的に /compact を実行。
(コンテキストを圧縮しています...)
圧縮のタイミング
| タイミング | 説明 |
|---|---|
| タスク完了後 | 「完了しました」の報告前 |
| 質問への回答後 | 回答を返す前 |
| 複数ファイル編集後 | 編集作業が一段落した時 |
| 長時間の会話 | 会話が長くなってきた時 |
閾値の目安
- コンテキストが大きくなってきたと感じたら圧縮を検討
- 多数のファイルを読み込んだ後
- 大量のコード変更を行った後
compact の効果
- 会話履歴を要約
- コンテキストサイズを削減
- レスポンス速度を改善
- トークン使用量を最適化
- 作業中の自動 compact による中断を防止
重要な注意事項
- ✅ タスクの区切りで自動的に圧縮
- ✅ 作業中断を防ぐため事前に圧縮
- ✅ 重要な情報が失われないよう注意
- ❌ 作業の途中(ファイル編集中など)では圧縮しない
- ❌ ユーザーが入力中は圧縮しない