strategic-compact

Prompt context compaction at logical boundaries via configurable thresholds and hooks.

5|2|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/T-rav/hydraflow --skill strategic-compact-t-rav
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/T-rav/hydraflow/tree/main/.codex/skills/strategic-compact
Command: npx skills add https://github.com/T-rav/hydraflow --skill strategic-compact-t-rav

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Long AI sessions can lose important context due to frequent auto-compaction. This skill prompts manual context trimming at logical boundaries to maintain coherence across phase transitions.

Core Features & Use Cases

  • Reminds users to compact after exploration, milestones, or phase transitions to preserve relevant context.
  • Uses configurable thresholds and periodic reminders to time prompts effectively.
  • Integrates with Claude workflows via PreToolUse hooks to trigger the suggest-compact.sh script.

Quick Start

Enable the PreToolUse hook to run suggest-compact.sh during tool use.

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 Claude AI sessions?

Context loss during long Claude sessions is prevented by prompting strategic compaction at logical phase boundaries. This approach ensures relevant context is preserved before auto-compaction discards critical information.

What is strategic compaction and when should I use it in a workflow?

Strategic compaction is the manual triggering of context trimming at logical boundaries like phase transitions or milestones. Use it during long-running, multi-phase tasks to prevent context bleed and maintain session coherence.

How do I automate context preservation prompts using PreToolUse hooks?

Automate context preservation by enabling a PreToolUse hook to run a shell script during tool use. The script tracks tool invocations and issues periodic compact reminders when a configurable threshold is met.

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

Thresholds for compaction reminders are fully configurable. You can adjust the COMPACT_THRESHOLD variable to set the exact number of tool invocations required before the system issues a prompt to compact.

Why does my AI lose track of earlier instructions after auto-compaction?

Auto-compaction loses earlier instructions because it trims context automatically without considering task boundaries. Strategic compaction solves this by prompting manual trimming at milestones to retain relevant context.

Does this context management approach work for multi-phase coding tasks?

This context management approach is specifically designed for long-running, multi-phase tasks. It tracks tool invocations and prompts compaction at logical boundaries to prevent context bleed across different phases.