strategic-compact

Triggers manual context compaction prompts via PreToolUse hooks for Edit and Write.

1|Updated Oct 14, 2023
One-click install
npx skills add https://github.com/walterfan/lazy-ai-primer --skill strategic-compact-walterfan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: strategic-compact
Source: https://github.com/walterfan/lazy-ai-primer/tree/main/assets/skills/strategic-compact
Command: npx skills add https://github.com/walterfan/lazy-ai-primer --skill strategic-compact-walterfan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps manage the AI's context window by suggesting manual compaction at strategic, logical points in a workflow, rather than relying on arbitrary automatic compaction that can interrupt tasks.

Core Features & Use Cases

  • Strategic Compaction Suggestions: Prompts the user to manually compact context at opportune moments (e.g., after research, before implementation).
  • Configurable Thresholds: Allows setting thresholds for tool calls before suggestions are made.
  • Periodic Reminders: Provides reminders at regular intervals after the initial threshold is met.
  • Use Case: When working on a complex coding task, after you've finished researching different approaches and are about to start writing code, the skill might suggest compacting the context to keep the implementation plan fresh while discarding the research details.

Quick Start

Configure the hook in your ~/.claude/settings.json to enable the strategic compact suggestion.

Frequently Asked Questions about strategic-compact

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

FAQPage Schema
How do I manage AI context window compaction during complex coding tasks?

Manage AI context window compaction by tracking tool calls and prompting for manual compaction at logical workflow intervals, preserving task context through phases rather than relying on arbitrary auto-compaction.

When should I manually compact context instead of using automatic compaction?

Manually compact context at strategic logical points, such as after finishing research and before starting implementation, to keep plans fresh while discarding outdated details instead of using automatic compaction.

How do I configure manual context compaction suggestions in settings?

Configure manual context compaction suggestions by adding PreToolUse hooks for Edit and Write tools in your settings file, setting a configurable threshold for tool calls before periodic reminders are triggered.

Can I set a custom threshold for context compaction reminders?

Yes, you can set a custom threshold for context compaction reminders. The skill tracks tool calls and provides periodic reminders at regular intervals after your configured threshold is met.

Why does automatic context compaction interrupt my AI workflow tasks?

Automatic context compaction interrupts AI workflow tasks because it triggers at arbitrary limits rather than logical task boundaries. Strategic manual compaction prevents this by suggesting compaction at natural workflow phase transitions.

Does context compaction work with PreToolUse hooks for Edit and Write tools?

Yes, context compaction integrates via PreToolUse hooks for Edit and Write tools. It monitors these tool calls to track workflow progress and prompts the user for manual compaction when thresholds are reached.