---
title: "idle-compact"
url: "https://claudemods.dev/en/builds/idle-compact-f5ec11"
source: "https://github.com/ukwhatn/.claude/tree/main/skills/idle-compact"
source_type: "github"
repo: "https://github.com/ukwhatn/.claude/tree/main/skills/idle-compact"
author: "ukwhatn"
author_handle: "ukwhatn"
stars: 4
category: "Memory & context"
categories: ["memory"]
tags: ["agents-md", "claude-code", "compaction", "context-management", "hooks", "idle", "plugin", "prompt-cache"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add ukwhatn/.claude\nclaude plugin install idle-compact"
added: "2026-10-05T20:40:08.020Z"
updated: "2026-11-25T06:25:13Z"
locale: "en"
content_locale: "en"
---

# idle-compact

A Claude Code function-hooks plugin. When the main conversation has been idle for idleMinutes (default 50 minutes), it compacts before the prompt cache expires and passes AGENTS.md's Compact Instructions to every compact. It skips running turns, conversations below minMessageTokens, and cases beyond cutoffMinutes, leaving the reason in the transcript.

## Description

`skills/idle-compact/` is a Claude Code plugin written with function hooks and loaded automatically as `idle-compact@skills-dir`. It has 2 jobs. When the main conversation has been idle for `idleMinutes` (default 50 minutes) since the last response, it runs compact before the prompt cache expires. It also passes the “Compact Instructions” section from `AGENTS.md` to every compact, whether manual, automatic, plugin-triggered, or precompute. Enable it by setting `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1` in the `env` section of `settings.json`. Options can be changed through `pluginConfigs["idle-compact@skills-dir"].options`. It skips conversations below `minMessageTokens` and cases beyond `cutoffMinutes` (such as returning from sleep, when the cache is likely to have expired), and writes the reason to the transcript. Reloading the plugin keeps a pending idle interval intact. Test with `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin test skills/idle-compact`. Run `/plugin-types skills/idle-compact/types` in the session, then run `tsc -p skills/idle-compact/tsconfig.json` for the type check (`types/` is not tracked by git).

## Install

```
claude plugin marketplace add ukwhatn/.claude
claude plugin install idle-compact
```

## Original README

# Agent User Settings（Claude Code / Codex 共用）

user-level 設定ファイル集。プロジェクト横断で使うワークフロー・スキル・グローバル指示を定義し、**Claude Code と OpenAI Codex CLI の両方から利用する**。

## 使い方

```bash
git clone <this-repo> ~/.claude
```

## 構成

```
~/.claude/
├── AGENTS.md              # グローバル指示の実体（両ツール共通）
├── CLAUDE.md              # AGENTS.md への互換 symlink
├── CLAUDE.local.md        # マシン固有設定（git管理外）
├── output-styles/         # 応答形式の真実源（Claude Code: system prompt 末尾に追記される）
├── context/               # エージェント向け詳細ガイド
├── skills/                # 自動トリガースキル（Agent Skills 形式・両ツール共用）
├── hooks/                 # SessionStart 等のフックスクリプト
├── templates/project/     # プロジェクト初期化テンプレート
└── settings.json          # 権限・環境変数・hooks・モデル
```

### context/ の役割

`@import` で常駐するもの（AGENTS.md から自動ロード）:

| ファイル | 内容 |
|---|---|
| `tool-claude-code.md` | Claude Code 固有指示（委譲判断・委譲後の実務） |
| `workflow-rules.md` | Phase 0-5 の詳細 |
| `memory-file-formats.md` | メモリファイルの形式 |
| `figma-verification.md` | Figma を一次ソースとする UI 検証 |
| `cloudflare-development.md` | wrangler / Workers / D1 の実測知見 |

必要時に Read するもの（常駐させない）:

| ファイル | Read するタイミング |
|---|---|
| `herdr-delegation.md` | 作業の委譲を検討した時点（経路・モデル・指示書・結果の回収） |
| `code-review-checklist.md` | PR 提出前・レビュー実行前 |
| `agent-cli-guide.md` | 外部 CLI（codex / cursor）でレビューする前 |
| `worktree-guide.md` | worktree の作成・片付け前 |
| `claude-customization-guide.md` | 指示ファイル・skills・hooks の設計・監査時 |
| `tool-codex.md` | Codex として動作している場合（最初の作業前） |

### skills/

28 スキル。一覧と発動条件は各 `SKILL.md` の frontmatter を参照（Claude Code では `/help` で確認できる）。

主要なもの: `commit` / `create-draft-pr`（コミット・PR）、`writing-code`（実装原則）、`systematic-debugging`（根本原因調査）、`self-review` / `pr-review` / `codebase-review`（レビュー）、`design-feature`（要件定義）、`update-inst` / `instructions-audit`（本リポジトリ自体の保守）。

`skills/idle-compact/` はスキルではなく、function hooks で書いた Claude Code のプラグインで、`idle-compact@skills-dir` として自動で読み込まれる。役割は 2 つある。メイン会話を最後の応答から `idleMinutes`（既定 50 分）放置すると、プロンプトキャッシュが切れる前に compact する。また、どの compact にも `AGENTS.md` の「Compact Instructions」節を渡す。有効化には `settings.json` の `env` にある `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1` が要る。オプションは `pluginConfigs["idle-compact@skills-dir"].options` で変える。テストは `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin test skills/idle-compact`、型チェックはセッションで `/plugin-types skills/idle-compact/types` を実行してから `tsc -p skills/idle-compact/tsconfig.json` で行う（`types/` は git 管理外）。

## ワークフロー

Phase 0-5（準備 → 調査 → 計画 → 実装 → 品質確認 → 完了報告）。適用条件と各 Phase の内容は `AGENTS.md`「作業フロー」および `context/workflow-rules.md` を参照。

## Codex CLI との共有

- **グローバル指示**: `~/.codex/AGENTS.md` → `~/.claude/AGENTS.md` の symlink。Codex 固有の読み替え（`@`参照の解決・ツール対応表）は `context/tool-codex.md` に集約
- **skills**: `~/.codex/skills/<name>` → `~/.claude/skills/<name>` のスキル単位 symlink。Claude Code 固有機構に依存するスキルは本文の「環境要件」節に代替手順を記載
- **PJ CLAUDE.md の直読み**: `~/.codex/config.toml` に `project_doc_fallback_filenames = ["CLAUDE.md"]` を設定
- 記述規約: スキル・context 本文はツール中立の語彙で書き、ツール固有機能は「（Claude Code: X、Codex: Y）」の括弧書きで併記する

## メモリディレクトリ

各タスクの作業ログを `.local/memory/YYMMDD_<context_name>/` に保存する（global gitignore で除外済み）。形式は `context/memory-file-formats.md` を参照。

```
.local/
├── memory/YYMMDD_<context_name>/   # 05_log.md（必須）、30_plan.md 等
└── issues/                          # codebase-review が生成
```

## プロジェクト設定

新規プロジェクトでは 組み込みの `/init` を実行するか、`templates/project/CLAUDE.md` をコピーする。

## ライセンス

MIT
