strategic-compact

Guide manual context compaction at logical task boundaries via a PreToolUse hook.

Updated Apr 25, 2026
One-click install
npx skills add https://github.com/ldk-hub/broke-shopping --skill strategic-compact-ldk-hub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/ldk-hub/broke-shopping/tree/main/.agent/.agents/skills/strategic-compact
Command: npx skills add https://github.com/ldk-hub/broke-shopping --skill strategic-compact-ldk-hub

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manual context management during long AI-assisted sessions is error-prone and leads to lost or muddled context; strategic compaction preserves essential context by marking logical boundaries instead of relying on auto-compaction.

Core Features & Use Cases

  • Context-tracking: Monitors tool usage and marks natural handoff points to compact context at safe boundaries.
  • Configurable prompts: Supports a configurable threshold (COMPACT_THRESHOLD) to trigger compact reminders.
  • Workflow cohesion: Aligns compaction with task phases (research → plan → implement → test) to sustain coherence across steps.

Quick Start

Install the suggest-compact.js hook and configure it in your Claude setup, then start a long-running session to receive compaction prompts.

Frequently Asked Questions about strategic-compact

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

FAQPage Schema
How do I preserve essential context during long AI-assisted sessions?

Context preservation during long AI-assisted sessions requires strategic compaction at logical task boundaries. By installing a PreToolUse hook, the system tracks tool usage and prompts manual compaction at safe handoff points instead of relying on error-prone auto-compaction.

What is strategic context compaction and when should I use it?

Strategic context compaction is the process of manually condensing conversation history at natural task phase transitions. It is needed during multi-phase projects, long-running sessions, and frequent task-switching to sustain workflow coherence across research, planning, and implementation steps.

How do I set up compaction reminders for multi-phase projects?

Setting up compaction reminders involves installing the suggest-compact.js hook in your Claude configuration and defining a COMPACT_THRESHOLD. Once configured, the hook monitors your session and triggers prompts to compact context when the threshold is reached.

Does manual context compaction work better than auto-compaction for task-switching?

Manual context compaction works better than auto-compaction because it aligns with logical task boundaries. By marking natural handoff points between phases like research and implementation, it prevents the lost or muddled context that auto-compaction often causes.

Can I configure the threshold for when context compaction prompts trigger?

You can configure the compaction prompt threshold by adjusting the COMPACT_THRESHOLD variable. This setting controls how frequently the suggest-compact.js hook evaluates tool usage before triggering a reminder to compact your session context.

Why does my AI session lose context after multiple task switches?

AI sessions lose context after multiple task switches because auto-compaction drops crucial information at arbitrary limits. Strategic compaction solves this by identifying logical task boundaries and preserving essential context through a guided manual compaction process.