strategic-compact

Prompt manual context compaction via PreToolUse hook after tool-call thresholds.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Strategic compact saves context by prompting manual compaction rather than auto-compact.

Core Features & Use Cases

  • Tracks tool calls within a session to quantify progression.
  • Threshold detection to trigger compaction prompts (default: 50 calls).
  • Periodic reminders to perform context-clearing at logical milestones (every 25 calls after threshold).
  • Use Case: After exploration, before execution; after milestone completion; or before major task shifts to maintain clarity.

Quick Start

Configure and run the suggest-compact.sh script to begin monitoring tool usage and prompt /compact at defined thresholds.

Frequently Asked Questions about strategic-compact

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

FAQPage Schema
How do I prevent context loss during long automation workflows?

Strategic compact preserves context by tracking tool calls and prompting manual compaction at defined thresholds rather than auto-compacting. It monitors progression through exploration, planning, and execution phases, issuing reminders every 25 calls after reaching your threshold (default 50) to clear context at logical milestones.

When should I compact context during complex tool-call sequences?

Compact context after exploration completes, before major execution shifts, or after milestone completion. Strategic compact tracks your tool-call count and suggests compaction at regular intervals—after 50 calls initially, then every 25 calls thereafter—ensuring clarity without losing track of progress.

Can I customize when compaction prompts appear?

Yes. Strategic compact uses a configurable COMPACT_THRESHOLD (default 50 calls) to trigger initial prompts, then issues reminders every 25 calls after that threshold. Adjust the threshold in the suggest-compact.sh script to match your workflow's complexity and context budget.

How does strategic compact track tool usage across a session?

Strategic compact implements a PreToolUse hook that counts each tool call within your session. It evaluates the count against your threshold and invokes the suggest-compact.sh script to prompt manual compaction at regular intervals, preserving visibility into your progression.

What's the difference between manual and automatic context compaction?

Automatic compaction clears context without notice, risking loss of relevant details. Manual compaction via strategic compact gives you control—you decide when to compress, preserving task continuity and retaining context you choose to keep at defined milestones.

Does strategic compact work with existing workflows and hooks?

Strategic compact integrates via PreToolUse hooks, a standard workflow mechanism. It runs alongside existing automation without dependencies, making it compatible with any workflow that supports hook-based tool-call monitoring during exploration, planning, and execution phases.