← Prompts
Everything Claude Code
Suggest Compact
#!/usr/bin/env node /** * Strategic Compact Suggester * * Cross-platform (Windows, macOS, Linux) * * Runs on PreToolUse or periodically to suggest manual compaction at logical intervals * * Why
#!/usr/bin/env node /** * Strategic Compact Suggester * * Cross-platform (Windows, macOS, Linux) * * Runs on PreToolUse or periodically to suggest manual compaction at logical intervals * * Why manual over auto-compact: * - Auto-compact happens at arbitrary points, often mid-task * - Strategic compacting preserves context through logical phases * - Compact after exploration, before execution * - Compact after completing a milestone, before starting next * * Two signals (#2155): * - Tool-call count: first at COMPACT_THRESHOLD (default 50), then every 25. * - Context size (primary): the latest assistant `usage` record from the * session transcript, compared against a window-scaled token threshold * (COMPACT_CONTEXT_THRESHOLD; default 160k on a 200k window, 250k on 1M), * re-reminding after every COMPACT_CONTEXT_INTERVAL tokens of growth * (default 60k). Tool count is a weak proxy for window pressure — a few * large reads can fill the window in very few calls, and many tiny calls * can cross 50 while the window is barely used. */
Sign in to view the full prompt.
Sign In