[BUG] SessionStart hook output silently truncated at 10KB — model never sees the missing content
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When a SessionStart hook produces more than ~10,000 characters of stdout, Claude Code saves
the full output to a file and injects only a 2KB preview into the model's context window.
The remaining content is silently dropped — the model receives no indication that anything
is missing, and there is no way to work around this for dynamically-discovered instruction files.
The system-reminder shows:
Output too large (9.8KB). Full output saved to: <path>
Preview (first 2KB):
[first ~2000 characters of output]
Actual behavior
The system-reminder shows:
Output too large (9.8KB). Full output saved to: <path>
Preview (first 2KB):
[first ~2000 characters of output]
The model receives only the first ~2KB. The remaining instruction files are completely
invisible to the model. The model does not know anything was truncated, so it cannot
compensate by reading the files itself.
What Should Happen?
All hook output is injected into the model's context, or the user is clearly warned that
instructions are being dropped and asked to take action.
Error Messages/Logs
Steps to Reproduce
- Set up a
SessionStarthook that reads and concatenates multiple instruction files
from the project directory, e.g.:
``bash``
for f in "${CLAUDE_PROJECT_DIR:-.}"/.github/instructions/**/*.instructions.md; do
echo "<<< INSTRUCTION FILE: $f >>>"
cat "$f"
echo
done
- Have a project whose instruction files total more than ~10,000 characters combined
(e.g. three modest files totalling ~9.8KB).
- Start a Claude Code session in that project.
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.181 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Why existing workarounds do not solve the problem
Splitting into separate hook commands does not work for dynamically-discovered files.
A for loop over a glob cannot be split into N separate stdout streams from a single
command invocation. To load each file independently, the file paths would have to be
hardcoded individually into settings.json — which breaks the entire point of a
project-agnostic, glob-based instruction loading system.
Using @import in CLAUDE.md requires manually adding imports to every project
individually. This is not a workaround — it dismantles the cross-project hook mechanism
entirely and puts the burden back on the developer for every project.
Using additionalContext JSON output does not help — the documentation explicitly states
the same 10,000-character cap applies to additionalContext, systemMessage, and plain stdout.