PreCompact prompt hooks fail on manual /compact

Resolved 💬 3 comments Opened Apr 6, 2026 by JacobRSchwartz-AI Closed Apr 9, 2026

Problem

PreCompact hooks with type: "prompt" fail when triggered by manual /compact with:

PreCompact [Run /remember] failed: Prompt stop hooks are not yet supported outside REPL

The same hook configuration should work identically whether compaction is triggered manually (/compact) or automatically (context limit reached in REPL).

Config

{
  "hooks": {
    "PreCompact": [
      {
        "hooks": [
          {
            "type": "prompt",
            "prompt": "Run /remember"
          }
        ]
      }
    ]
  }
}

Expected behavior

Prompt-type PreCompact hooks fire on both manual and automatic compaction.

Actual behavior

Only works during automatic compaction in REPL. Manual /compact invocations skip prompt hooks with the error above.

Impact

Users with large context windows (1M) rarely hit automatic compaction, making PreCompact prompt hooks effectively useless since they'll almost always compact manually.

Environment

  • Claude Code CLI (latest)
  • macOS
  • Model: claude-opus-4-6 (1M context)

View original on GitHub ↗

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