Feature Request: read-mode — interactive pacing with blocking PreCompact and context % indicator

Resolved 💬 3 comments Opened Feb 18, 2026 by 0xebjc Closed Feb 22, 2026

Problem

When Claude generates long output (research results, multi-agent summaries, detailed analyses), auto-compaction can trigger while the user is still reading. The compressed summary loses details the user hasn't finished reviewing. There is no way to pause or block compression for user confirmation.

Current Behavior

  • PreCompact hooks fire but cannot block the compaction event (unlike PreToolUse which supports blocking)
  • CLAUDE_AUTOCOMPACT_PCT_OVERRIDE can delay the threshold but cannot prevent it
  • No confirmation dialog or grace period exists before auto-compression
  • A PreCompact hook that prints a warning is useless — by the time it fires, compression is already happening and unstoppable

Proposed Solution

Two features, in priority order:

1. Blocking PreCompact Hook (Primary Request)

Allow PreCompact hooks to be blocking — the same way PreToolUse hooks can block tool execution pending user approval. This would enable:

  • Hook returns non-zero exit code → compaction pauses → user prompted to confirm
  • A setting like "autoCompactConfirm": true that shows a confirmation prompt before auto-compaction
  • Mode toggle: users switch between "attended" (confirm before compact) and "unattended" (compact freely) modes
{
  "hooks": {
    "PreCompact": [{
      "matcher": "auto",
      "hooks": [{
        "type": "command",
        "command": "bash -c 'read -p \"Compress conversation? (y/n) \" yn; [ \"$yn\" = \"y\" ]'"
      }]
    }]
  }
}

If the hook exits non-zero, compaction is deferred until the next natural trigger point.

2. Context Usage % Indicator (Secondary Request)

Expose the current context window usage percentage as an environment variable available to hooks (e.g., $CLAUDE_CONTEXT_PCT). This would allow:

  • Status line integration: Show Context: 47% in the status bar so users know when to manually /compact
  • Proactive warning hooks: Fire a warning at a user-defined threshold (e.g., 60%) BEFORE auto-compaction kicks in, giving the user time to read remaining output and trigger /compact themselves
  • Informed decisions: Users can see context filling up and choose to compact at a natural break point rather than being surprised

Example status line usage:

{
  "statusLine": {
    "type": "command",
    "command": "echo \"Context: ${CLAUDE_CONTEXT_PCT:-?}%\""
  }
}

Use Case

Power users running long research sessions with parallel agents generating thousands of lines of output. The user needs to read and digest results before they're compressed away. Currently the only workaround is behavioral (instructing Claude to chunk output in CLAUDE.md), which is fragile since the instructions themselves can be compressed out of context.

Environment

  • Claude Code CLI
  • Linux / macOS
  • Long-running research sessions with heavy agent delegation

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗