strategic-compact

Suggest manual context compaction via a PreToolUse hook with a configurable threshold.

Updated Jan 1, 2026
One-click install
npx skills add https://github.com/ChanningHe/dotfiles --skill strategic-compact-channinghe
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/ChanningHe/dotfiles/tree/main/claude/skills/strategic-compact
Command: npx skills add https://github.com/ChanningHe/dotfiles --skill strategic-compact-channinghe

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Strategic compaction addresses the problem of losing important context due to automatic, mid-task compaction by enabling deliberate, boundary-aware context trimming.

Core Features & Use Cases

  • Tracks tool calls within a session to measure activity
  • Threshold detection with a configurable default (50 calls)
  • Periodic reminders to perform compaction after threshold is crossed
  • Hook setup guidance to integrate with Claude's PreToolUse workflow
  • Practical use: compact after exploration to preserve the plan for execution, or after milestones to start fresh

Quick Start

Configure Claude to run the suggest-compact.sh hook by placing the script at ~/.claude/skills/strategic-compact/suggest-compact.sh and updating ~/.claude/settings.json to enable the PreToolUse hook.

Frequently Asked Questions about strategic-compact

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent automatic context compaction from losing important session context in Claude?▼

Manual context compaction prevents losing important context by enabling deliberate, boundary-aware context trimming during interactive Claude sessions. You configure a PreToolUse hook to trigger reminders after a set tool-call threshold.

When should I perform manual context compaction during an interactive Claude session?▼

Manual context compaction is best applied after exploration phases to preserve execution plans, or after completing milestones before major context shifts. This boundary-aware approach prevents mid-task context loss.

How do I configure a PreToolUse hook to suggest context compaction?▼

You configure context compaction by placing the suggest-compact.sh script in ~/.claude/skills/strategic-compact/ and updating ~/.claude/settings.json to enable the PreToolUse hook for session monitoring.

What is the default tool call threshold to trigger compaction reminders?▼

The default tool call threshold to trigger compaction reminders is 50 calls. The script tracks tool calls within a session and sends periodic reminders once this configurable threshold is crossed.

Can I adjust the compaction threshold for my Claude session workflow?▼

Yes, the threshold for compaction reminders is configurable. You can adjust the default 50-call limit within the suggest-compact.sh script to match your specific workflow and context management needs.

Why does my Claude session lose context during automatic mid-task compaction?▼

Automatic mid-task compaction loses context because it trims without boundary awareness. Strategic compaction solves this by tracking tool calls and suggesting manual compaction at logical milestones to preserve execution plans.