AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Nov 28, 2026, 10:01 JST

Claude Code hook's 10,000-character cap left 16 sessions with only a sample

Send on LINE
Claude Code hook's 10,000-character cap left 16 sessions with only a sample

3 Key Points

  1. What happened

    The author's setup injects a memory file via the SessionStart hook, but Claude Code's official Hooks reference caps hook output at 10,000 characters and passes only 2,000 characters plus a file path beyond that. From the evening of Nov 5 to the morning of Nov 15, all 16 newly started sessions received only the sample and path; 8 read the full file themselves, while 8 did not.

  2. Why it matters

    Because the cap applies silently with no error, teams relying on hook-injected context may not realize sessions are starting with only a truncated sample; in this case, half the sessions began work without the full memory file.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

By signing up you agree to the Terms of Service and Privacy Policy.

Context & Analysis

The author built a memory system for Claude Code on Nov 2, using hooks to inject a state file (NOW.md) at session start, check for memory updates at session end, and back up the memory folder to local git. The problem emerged because hook output is officially limited to 10,000 characters; beyond that, only a 2,000-character sample and a file path are passed to the model, with no error raised. The state file had grown to about 50,000 characters, so sessions starting between Nov 5 and Nov 15 received only the sample. Reviewing conversation logs, the author found that 8 of the 16 new sessions read the full file themselves, while the other 8 did not, with some reading only their own lines or starting work from the truncated head. The author initially thought all sessions were carrying the full 50,000 characters and slimmed the file, but the logs showed a split between sessions that carried the full text and those that never saw it. Scripts are provided for the three hooks, a character-count warning that can be added to the SessionStart script, and notes on remaining issues such as shared memory folders and the lack of measurement of effectiveness.

FAQ
How can I check if my Claude Code sessions are receiving only the truncated sample?
In the conversation log under ~/.claude/projects/, look for SessionStart lines beginning with <persisted-output>. If present, only the sample was injected, and the log will show 'Output too large (…KB). Full output saved to: …'.
What hooks does the author use for memory management?
Three hooks: SessionStart injects the state file, Stop checks whether memory was updated after long conversations, and Stop also auto-commits the memory folder to local git.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

By signing up you agree to the Terms of Service and Privacy Policy.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleAI voices spur false police reports in US, NPR says