strategic-compact

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill reduces context loss by requiring deliberate compaction at logical task boundaries, ensuring critical information remains available across phases rather than relying on automatic, disruptive context truncation.

Core Features & Use Cases

  • Manual context compaction at key milestones to maintain continuity between exploration, planning, and execution.
  • PreToolUse hook integration that prompts for a compact checkpoint when context risk rises.
  • Easy configuration via environment variable COMPACT_THRESHOLD to tailor prompts to your workflow.
  • Use Case: When drafting an implementation plan after exploration, run a compact to preserve research while starting fresh on the next phase.

Quick Start

Use the strategic-compact skill to remind you to compact after you finalize a plan, before implementation begins.

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 development workflows?

Manual context compaction at logical task boundaries prevents context loss by preserving critical information across development phases. Prompting users to compact at exploration-to-implementation transitions and milestone completions maintains continuity without relying on automatic truncation.

When should I manually compact context in my development process?

You should manually compact context when transitioning from exploration to implementation, finalizing a plan, or reaching major milestones. Triggering compaction during planning, debugging, and major context shifts ensures critical research is preserved before starting fresh on the next phase.

How does a PreToolUse hook help with context management?

A PreToolUse hook integrates with your workflow to prompt for a context compaction checkpoint when context risk rises. This lightweight shell-based script tracks tool usage and triggers prompts based on a configurable threshold, ensuring deliberate compaction at logical task boundaries.

Can I configure the threshold for manual compaction prompts?

Yes, you can configure the threshold for manual compaction prompts using the COMPACT_THRESHOLD environment variable. This allows you to tailor the prompt frequency to your specific workflow and context management needs.

What is the best way to preserve research context before starting implementation?

The best way to preserve research context before implementation is to run a manual compaction checkpoint after finalizing your plan. This deliberate compaction at the exploration-to-implementation transition ensures research findings are retained while starting fresh on the execution phase.

Are there limitations to using shell-based scripts for context compaction?

Shell-based scripts for context compaction provide a lightweight implementation but rely on manual execution at logical task boundaries. They require user discipline to trigger compaction at exploration-to-implementation transitions and milestone completions, as automatic context truncation is intentionally avoided.