Files
ECC/docs/ja-JP/skills/strategic-compact/SKILL.md
T
Nidelson GimenezandGitHub 8c3a3040ae fix(skills): document plugin vs manual hook setup for strategic-compact (#2420)
The Hook Setup section told all users to wire
`node ~/.claude/scripts/hooks/suggest-compact.js` into settings.json.
That path only exists on manual `./install.sh` installs; for plugin
installs the hook is already registered by the plugin's hooks/hooks.json
(id `pre:edit-write:suggest-compact`, standard/strict profiles), so the
snippet fails silently and would double-register the hook.

- Add a plugin-install note (mirrors continuous-learning-v2 wording)
  and scope the snippet to manual installs — applied to the canonical
  skill, the .kiro mirror, and ja-JP/zh-CN/zh-TW/ko-KR translations
- ko-KR: also replace the settings.json snippet that used
  `${CLAUDE_PLUGIN_ROOT}`, which does not resolve in user settings.json
2026-07-03 20:36:59 -07:00

3.2 KiB
Raw Blame History

name, description
name description
strategic-compact 任意の自動コンパクションではなく、タスクフェーズを通じてコンテキストを保持するための論理的な間隔での手動コンパクションを提案します。

Strategic Compactスキル

任意の自動コンパクションに依存するのではなく、ワークフローの戦略的なポイントで手動の/compactを提案します。

なぜ戦略的コンパクションか?

自動コンパクションは任意のポイントでトリガーされます:

  • 多くの場合タスクの途中で、重要なコンテキストを失う
  • タスクの論理的な境界を認識しない
  • 複雑な複数ステップの操作を中断する可能性がある

論理的な境界での戦略的コンパクション:

  • 探索後、実行前 - 研究コンテキストをコンパクト、実装計画を保持
  • マイルストーン完了後 - 次のフェーズのために新しいスタート
  • 主要なコンテキストシフト前 - 異なるタスクの前に探索コンテキストをクリア

仕組み

suggest-compact.jsスクリプトはPreToolUseEdit/Write)で実行され:

  1. ツール呼び出しを追跡 - セッション内のツール呼び出しをカウント
  2. 閾値検出 - 設定可能な閾値で提案(デフォルト:50回)
  3. 定期的なリマインダー - 閾値後25回ごとにリマインド

フック設定

プラグインとしてインストール済みの場合:設定は不要です。プラグインの hooks/hooks.json が既に suggest-compact.js を登録しています(フック ID pre:edit-write:suggest-compactstandardstrict フックプロファイルで有効)。下のブロックを ~/.claude/settings.json にコピーしないでください — プラグインインストールでは ~/.claude/scripts/ は存在せず、プラグインフックを重複させると二重実行になります。

手動インストール./install.sh)の場合、~/.claude/settings.json に追加:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit",
        "hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }]
      },
      {
        "matcher": "Write",
        "hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }]
      }
    ]
  }
}

設定

環境変数:

  • COMPACT_THRESHOLD - 最初の提案前のツール呼び出し(デフォルト:50)

ベストプラクティス

  1. 計画後にコンパクト - 計画が確定したら、コンパクトして新しくスタート
  2. デバッグ後にコンパクト - 続行前にエラー解決コンテキストをクリア
  3. 実装中はコンパクトしない - 関連する変更のためにコンテキストを保持
  4. 提案を読む - フックはいつを教えてくれますが、するかどうかは自分で決める

関連

  • The Longform Guide - トークン最適化セクション
  • メモリ永続化フック - コンパクションを超えて存続する状態用