Problem
Hooks that emit more than 10,000 characters of additionalContext (internal persistHookOutput threshold, since v2.1.89) are persisted to a temp file and never injected into the model context. The hook receives no error, no warning, and no way to know its output was discarded.
Why this is worse than just a size cap
For long-term-memory plugins this is silent data loss on every session start:
- Hook writes ~38KB of context → process exits 0 → nothing in context → the model starts with no memory.
- No stderr warning, no marker in the hook JSON output, no log line — a plugin author cannot detect this from the hook side.
- The user sees a normal-looking session and has no idea the injected context was dropped.
Requested
When output exceeds the threshold, give the hook (and the user) an explicit signal:
- A warning line on stderr and/or in the hook result, and/or
- A structured field in the hook JSON (e.g.
additionalContextFile + truncated: true), and/or
- A persistent log entry.
That at least turns invisible loss into an observable condition that plugins can handle (chunk their own output, fail loudly, or surface it to the user).
Related
Environment: Claude Code 2.1.216, VS Code extension, macOS.
Problem
Hooks that emit more than 10,000 characters of
additionalContext(internalpersistHookOutputthreshold, since v2.1.89) are persisted to a temp file and never injected into the model context. The hook receives no error, no warning, and no way to know its output was discarded.Why this is worse than just a size cap
For long-term-memory plugins this is silent data loss on every session start:
Requested
When output exceeds the threshold, give the hook (and the user) an explicit signal:
additionalContextFile+truncated: true), and/orThat at least turns invisible loss into an observable condition that plugins can handle (chunk their own output, fail loudly, or surface it to the user).
Related
Environment: Claude Code 2.1.216, VS Code extension, macOS.