[FEATURE] Setting to raise the 10,000-character hook output cap
Preflight Checklist
- [x] I have searched existing requests. This has been asked before (#50571, #51537, #64626, #84022), but every one of those was closed by automation without a maintainer reply, and none is open now.
- [x] This is a single feature request (not multiple features)
Problem Statement
Hook additionalContext, systemMessage and plain stdout are capped at 10,000 characters. Over that, Claude Code saves the output to a file and the model gets the path plus a 2,000-character preview. The hooks reference documents this, and says "this cap has no setting or environment variable to raise it."
For hooks whose whole job is to put context in front of the model (SessionStart memory, session-state rehydration, standing instructions), 10,000 is tight, and the overflow path loses the content in practice. The same reference says "Claude can read the file, but Claude Code doesn't ask it to", and #91614 reports the model reading the persisted file in 0 of 72 truncated deliveries.
Bash output has BASH_MAX_OUTPUT_LENGTH and MCP output has MAX_MCP_OUTPUT_TOKENS. Hook output has no equivalent, so a user who deliberately installs a context-injecting hook can't opt in to more.
Proposed Solution
A setting to raise the threshold, either a settings.json key or an env var (for example CLAUDE_CODE_HOOK_OUTPUT_LIMIT=50000). The default stays at 10,000, so nothing changes for anyone who doesn't set it.
Alternative Solutions
- If a setting is off the table: when hook output is persisted, have Claude Code tell the model to read the file, instead of leaving it to notice the path in the preview. That would at least make the overflow path recoverable.
- What hook authors do today instead: degrade the payload to fit, split it across several hooks that each stay under the cap (#84021 has a 5-slice example), or put a line at the top of the payload asking the model to read the file if it got a preview. These all work around a number the user can't change.
Priority
Medium - Would be very helpful
Feature Category
Configuration and settings
Use Case Example
A SessionStart hook injects a project's coordination state: open items, the latest handoff, and active decisions. Sized to fit the cap, the injection for one real repo today carries 14 open items and the latest handoff, and has to drop all 192 active decisions down to a one-line count with a pointer. The full state is about 50,000 characters. With a setting, that repo would raise the limit to 50,000 and everything else would stay at the default.
For anyone sizing payloads: the cap counts UTF-16 code units (JS string length), inclusive. 10,000 units arrive inline and 10,001 are persisted (probe in #84021).
Additional Context
- Still reproduces on v2.1.299 (macOS).
- Not a duplicate of the open bugs #84021 and #91614. Those ask for the truncation to be visible; this asks for a way to avoid it.
- #51537 collected 7 👍 before the stale bot closed it.