fix(prompt-hook): cap the injection under Claude Code's 10k inline hook-output limit - #1695
Open
bompus wants to merge 1 commit into
Open
Conversation
Contributor
|
Confirmed the symptom and the fix on a live setup. The installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1694.
codegraph prompt-hookcapped its<codegraph_context>injection at 16,000 characters. Claude Code shows hook stdout inline only up to 10,000 characters; above that it persists the output totool-results/hook-<id>-stdout.txtand the model sees a 2 KB preview plus the path. So on any repo where explore filled the cap, the hook delivered a file reference instead of the context (measured in #1694: 9,871 characters inline, 10,031 persisted, on Claude Code 2.1.261).Change
MAX16000 → 9000 insrc/bin/codegraph.ts, with a comment naming the host limit. 9,000 leaves ~1,000 characters for the<codegraph_context>wrapper and theprojectPathnudge lines that are appended after the cap is applied.The existing "…(truncated; call codegraph_explore for the rest)" notice is unchanged, so a capped payload still tells the model where the rest is. The blast-radius list leads the explore output, so the part that survives the cap is the part the model acts on.
Not in this PR
An env var to set the cap per host. Happy to add one if you want other hosts to be able to raise it.