strategic-compact

Prompt manual context compaction at configurable tool-call thresholds.

40|8|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/ysyecust/everything-claude-code --skill strategic-compact-ysyecust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/ysyecust/everything-claude-code/tree/main/docs/zh-TW/skills/strategic-compact
Command: npx skills add https://github.com/ysyecust/everything-claude-code --skill strategic-compact-ysyecust

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Suggests manual context compaction at logical milestones to preserve context through task phases rather than relying on arbitrary auto-compaction.

Core Features & Use Cases

  • Strategic prompts: Recommend compaction at key workflow moments (post-research, pre-execution, after milestones) to retain planning context while trimming exploratory details.
  • Automated guidance: Tracks tool usage during a session, detects when a threshold is reached (default 50 calls), and reminds periodically every 25 calls after the threshold.
  • Configurable hooks: Provides configuration via ~/.claude/settings.json to run a suggest-compact.sh hook at PreToolUse for Edit/Write actions.
  • Best practices: Encourages planning before compaction, clearing context after debugging, avoiding mid-action compression, and following hook prompts for decisions.

Quick Start

Configure the PreToolUse hook to execute suggest-compact.sh, enabling prompts at strategic workflow moments.

Frequently Asked Questions about strategic-compact

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

FAQPage Schema
How do I preserve AI context during long workflows without relying on auto-compaction?

Manual compaction at logical milestones preserves AI context by prompting compaction after research or planning phases, retaining crucial context while trimming exploratory details. This ensures context carries through task transitions without relying on arbitrary auto-compaction.

How do I configure workflow hooks to suggest manual compaction in Claude?

Configure PreToolUse hooks in ~/.claude/settings.json to execute suggest-compact.sh, enabling automated guidance that tracks tool usage during a session and triggers periodic compaction prompts at strategic workflow moments.

When should I trigger manual context compaction during development?

Trigger manual context compaction at logical milestones like post-research, pre-execution, or after completing major workflow phases. Avoid mid-action compression and clear context after debugging to maintain optimal context preservation across task transitions.

Can I adjust the tool usage tracking threshold for compaction reminders?

Adjust the tool usage tracking threshold using the configurable COMPACT_THRESHOLD environment variable. The default threshold is 50 tool calls, after which the system sends periodic compaction reminders every 25 subsequent calls.

What are the limitations of using threshold-based compaction reminders?

Threshold-based compaction reminders depend on tool usage counting and may not align perfectly with complex task transitions. Users must follow hook prompts for decisions and plan before compaction to ensure effective context preservation.

Does manual compaction work with Edit and Write tool actions?

Manual compaction integrates with PreToolUse hooks specifically for Edit and Write actions. This ensures compaction suggestions trigger during active development phases when file modifications occur at logical workflow milestones.