Skip to content

[fix] Inbox hook stays under Claude Code's 10,000-character context cap - #44

Open
malickyeu wants to merge 1 commit into
mainfrom
fix/inbox-hook-budget
Open

malickyeu wants to merge 1 commit into
mainfrom
fix/inbox-hook-budget

Conversation

@malickyeu

Copy link
Copy Markdown
Contributor

Follow-up to #43, after checking the current Claude Code hooks docs:

  • additionalContext (and plain stdout) are capped at 10,000 characters; past that Claude Code stores the text in a file and passes only a preview + path, without asking the model to read it. The hook printed up to 20 × 8 KiB and acked them all. Now it prints what fits whole under 9,000 characters, acks only those, and says how many still wait (next poll or inbox.next).
  • The docs warn that text framed as out-of-band system commands can trigger prompt-injection defenses, so the intro is now a factual statement of what arrived; headers carry the message id.
  • The JSON shape (hookSpecificOutput.hookEventName + additionalContext) for PostToolUse and UserPromptSubmit is confirmed by the docs.

Test: the real-hook test sends three ~7 KB messages and checks each poll prints exactly one, under 10,000 characters, and a fourth poll prints nothing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RaEdVh9BoHFvqNF52ap71M

Claude Code saves additionalContext longer than 10,000 characters to a file
and shows the model a preview, without asking it to read the file. The hook
printed up to twenty 8 KiB messages and acknowledged all of them, so most
would have been marked read and never seen. It now prints what fits whole
under 9,000 characters, acknowledges only that, and leaves the rest for the
next poll. The introduction is reworded as a statement of what arrived:
the hooks documentation warns that text framed as an out-of-band command
can trigger the model's prompt-injection defenses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RaEdVh9BoHFvqNF52ap71M
Copilot AI balanced review requested due to automatic review settings November 13, 2026 16:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants