Agent skill · product strategy · affaan-m

strategic-compact

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

Why this skill is useful

Adds a script for strategic context compaction that optimizes workflow management during long sessions.

What it needs

Requires node installed locally. About 4k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.

What this skill does

Strategic Compact Skill Suggests manual /compact at strategic points in your workflow rather than relying on arbitrary auto-compaction. When to Activate Running long sessions that approach context limits (200K+ tokens) Working on multi-phase tasks (research → plan → implement → test) Switching between unrelated tasks within the same session After completing a major milestone and starting new work When responses slow down or become less coherent (context pressure) Why Strategic Compaction? Auto-compaction triggers at arbitrary points: Often mid-task, losing important context No awareness of logical task boundaries Can interrupt complex multi-step operations Strategic compaction at logical boundaries: After exploration, before execution — Compact research context, keep implementation plan After completing a milestone — Fresh start for next phase Before major context shifts — Clear exploration context before different task How It Works The suggest-compact.js script runs on PreToolUse (Edit/Write) and: 1. Tracks tool calls — Counts tool invocations in session 2. Threshold detection — Suggests at configurable threshold (default: 50 calls) 3. Periodic reminders — Reminds every 25 calls after threshold Hook Setup Installed as a plugin? No setup is needed. The plugin's hooks/hooks.json already registers suggest-compact.js (hook id pre:edit-write:suggest-compact, active in the standard and strict hook profiles). Do not copy the block below into ~/.claude/settings.json — ~/.claude/scripts/ does not exist on plugin installs, and duplicating a plugin hook causes double execution. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/strategic-compact--72df66

View the source on GitHub

Browse the @skills marketplace