/goal Stop hook fails with "Prompt is too long" in long sessions

Resolved 💬 3 comments Opened May 20, 2026 by chaosconst Closed May 24, 2026

Summary

In a long-running session, the /goal Stop hook (the session-scoped condition evaluator) fails hard with:

Stop hook error: Hook evaluator API error: Prompt is too long

Once this happens, the hook can no longer evaluate the goal condition, so it neither blocks-with-reason nor auto-clears — it just errors every time the agent tries to stop.

Repro

  1. Start a session and let it grow large (long multi-hour conversation with lots of tool output).
  2. Set a goal: /goal <some condition>.
  3. Continue working until the transcript is large.
  4. When the agent attempts to stop, the Stop hook evaluator errors with Prompt is too long.

Expected

The goal evaluator should degrade gracefully instead of hard-erroring:

  • Truncate / summarize the transcript before sending to the evaluator, or use a larger-context model for the evaluation call, and/or
  • On evaluator failure, allow the stop to proceed (fail-open) rather than blocking with an error, and/or
  • Surface a clear, actionable message (e.g. "goal evaluation skipped: context too large; goal still active") and let the user /goal clear.

Impact

  • The goal feature becomes unusable in exactly the sessions where it's most useful (long, sustained work toward a condition).
  • The condition may already be satisfied, but because the evaluator can't run, the goal won't auto-clear and the user keeps hitting the error until they manually /goal clear.

Environment

  • Claude Code CLI
  • Long session (several hours, large transcript)

View original on GitHub ↗

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