Hook output over the 10,000-character cap is silently collapsed to a 2 KB preview with no user-visible warning (ref #44086)

Status Open
Reported on v2.1.239
Maintainer reply None cached
Activity 2 comments · opened Sep 2, 2026

What happens

When a hook's stdout or hookSpecificOutput.additionalContext exceeds 10,000 characters, Claude Code saves the full output to tool-results/hook-*-stdout.txt and passes the model only a ~2 KB preview plus the file path:

SessionStart:startup hook success: <persisted-output>
Output too large (17.7KB). Full output saved to: ~/.claude/projects/<project>/<session>/tool-results/hook-<id>-stdout.txt

Preview (first 2KB):
...

The cap itself is documented in the hooks reference. What is not surfaced anywhere: the user is never told. No terminal message, no line at the cut with --debug, nothing in the hook's exit status. The model's own context is the only witness that the hook was truncated.

Why it matters

A SessionStart hook that injects standing instructions grew from 9.8 KB to 18 KB over about a week of small edits. From that day, every session on two machines received the first 2 KB plus a file path, for four weeks, while the injected file's own header still read "injected every session". It was found only by asking why the model kept ignoring instructions it had, in fact, never received.

The cut is sharp and easy to reproduce:

  • a hook emitting 9,900 bytes arrives inline in full
  • a hook emitting 10,050 bytes is replaced by the 2 KB preview
  • a hook returning 15,000 characters of additionalContext is cut the same way
  • several hooks each under the cap deliver in full side by side, so the limit is per hook command

Ask

Any one of these would have prevented the four-week silent failure:

  1. Warn the user in the terminal (and in --debug output) when a hook's output is cut, naming the hook and its size.
  2. Make the limit configurable, per hook or globally in settings.
  3. At minimum, deliver the first 10,000 characters instead of collapsing to a 2,000-character preview, which is what #44086 asked for before it was auto-closed as stale.

Environment

  • Claude Code 2.1.239 (macOS 27) and 2.1.241 (Ubuntu 24.04)
  • Hooks configured in ~/.claude/settings.json, SessionStart, "type": "command"

Related

#44086 and #55750 report the same 10,000 → 2,000 collapse; #44086 received four confirmations, no maintainer response, and was auto-closed for inactivity on 2026-06-28 and locked 2026-08-31. Filing fresh as its closing message requests.

View original on GitHub ↗

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