strategic-compact

Suggest manual context compaction at logical task boundaries via PreToolUse hooks.

Updated Jul 10, 2025
One-click install
npx skills add https://github.com/nubiv/my-nome --skill strategic-compact-nubiv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/nubiv/my-nome/tree/main/nix-darwin/config/claude/skills/strategic-compact
Command: npx skills add https://github.com/nubiv/my-nome --skill strategic-compact-nubiv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps manage Claude's context window by suggesting manual compaction at logical points in a workflow, preventing arbitrary auto-compaction that can lose valuable information.

Core Features & Use Cases

  • Strategic Compaction Suggestions: Proactively prompts the user to manually compact context when logical task boundaries are reached or when token usage is high.
  • Phase-Aware Compaction: Differentiates between phases of a task (e.g., research vs. implementation) to optimize what context is preserved.
  • Use Case: After completing a lengthy research phase and before starting to write code, the skill will suggest compacting the research notes to free up context for the implementation details.

Quick Start

Use the strategic-compact skill to suggest manual context compaction when you are about to switch from a planning phase to an implementation phase.

Frequently Asked Questions about strategic-compact

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

FAQPage Schema
How do I prevent losing context when Claude's auto-compaction triggers in long sessions?

Manual context compaction at logical task boundaries prevents losing context by prompting you to compact proactively before arbitrary auto-compaction triggers. This preserves valuable information by ensuring compaction occurs at optimal workflow phases.

What is strategic context compaction for multi-phase tasks?

Strategic context compaction differentiates between task phases like research and implementation to optimize preserved context. It prompts you to compact research notes before writing code, freeing token limits for implementation details.

How do I configure token thresholds for context compaction prompts?

You configure token thresholds using environment variables and a JavaScript script executed via PreToolUse hooks. The script tracks tool calls and prompts you for compaction when configurable thresholds or periodic intervals are met.

Can I use PreToolUse hooks to track tool calls for session management?

Yes, PreToolUse hooks execute a JavaScript script that tracks tool calls and prompts you for manual compaction at configurable thresholds. This session management approach requires environment variables for configuration.

When should I manually compact context instead of relying on auto-compaction?

You should manually compact context when transitioning between logical task phases, such as completing research before starting implementation. The skill suggests compaction at periodic intervals after configurable token thresholds are met.

Does this context management approach work for long-running Claude sessions?

Yes, this approach explicitly applies to long-running sessions approaching context limits or multi-phase tasks. It suggests manual compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.