strategic-compact

Track tool usage and prompt manual context compaction at configurable thresholds.

6|Updated Mar 25, 2023
One-click install
npx skills add https://github.com/songkg7/dotfiles --skill strategic-compact-songkg7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/songkg7/dotfiles/tree/main/dot_claude/skills/strategic-compact
Command: npx skills add https://github.com/songkg7/dotfiles --skill strategic-compact-songkg7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps you preserve important task context by prompting for manual compaction at logical milestones instead of relying on automated, arbitrary truncation.

Core Features & Use Cases

  • Tracks tool usage during a Claude session to identify when context should be compacted.
  • Recommends compacting after exploration, after milestones, and before major context shifts.
  • Provides a ready-to-use PreToolUse hook and configurable thresholds to guide when to compact.

Quick Start

Configure Claude to load the strategic-compact script as a PreToolUse hook, set COMPACT_THRESHOLD to your preferred value (default 50), and rely on the hook's prompts to guide when to compact.

Frequently Asked Questions about strategic-compact

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

FAQPage Schema
How do I prevent AI context loss during long Claude sessions?

To prevent AI context loss during long Claude sessions, use milestone-based compaction to prompt manual context preservation at logical phase transitions instead of relying on automated truncation. This preserves essential information before context risk increases.

When should I run /compact for AI context management?

You should run /compact for AI context management after exploration phases, after reaching milestones, and before major context shifts. A PreToolUse hook tracks tool usage and emits timely prompts when a configurable threshold is exceeded.

How do I configure a PreToolUse hook to trigger manual compaction in Claude?

To configure a PreToolUse hook for manual compaction, load the strategic-compact script into Claude, set the COMPACT_THRESHOLD to your preferred value (default is 50), and rely on the hook's prompts to guide your /compact execution.

What is the best way to manage context during exploration-to-implementation work?

The best way to manage context during exploration-to-implementation work is tracking tool usage to identify when context should be compacted, prompting for manual compaction at logical milestones to avoid arbitrary truncation of essential task information.

Can I adjust the threshold for when context compaction prompts are emitted?

Yes, you can adjust the threshold for context compaction prompts. The skill provides a configurable COMPACT_THRESHOLD variable with a default value of 50, allowing you to control when the hook triggers guidance to run /compact.

Why does automated context truncation cause problems during milestone reviews?

Automated context truncation causes problems during milestone reviews because it arbitrarily removes information without recognizing logical phase transitions. Manual compaction at milestones ensures essential exploration and implementation context is preserved intentionally.