feat: add pregen background hook to UserPromptSubmit#98
Merged
claude[bot] merged 1 commit intomainfrom Feb 27, 2026
Merged
Conversation
Wire `uncompact pregen &` into the installed hooks so the cache warms automatically in the background on every user prompt. Since pregen exits immediately when the cache is still fresh, the overhead is minimal. Also fix the mergeHooks deduplication logic for UserPromptSubmit: the previous switch branch added "uncompact show-cache" as an extra match for all UserPromptSubmit hooks, which would have caused the new pregen hook to be incorrectly skipped if show-cache was already installed. Now each command's alias matches are derived from its own content. Closes #95 Co-Authored-By: Grey Newell <greyshipscode@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
uncompact pregen &as a newUserPromptSubmithook so the cache warms automatically in the background on every user promptpregenexits immediately when the cache is still fresh, the per-prompt overhead is minimal — it only makes an API call when the cache has expiredmergeHooks: the previousUserPromptSubmitswitch branch added"uncompact show-cache"as an alias match for all UserPromptSubmit commands. This would have caused the new pregen hook to be incorrectly skipped if show-cache was already installed. Now each command's alias matches are derived from the command's own content.Changes
internal/hooks/hooks.go: adds the pregen hook entry touncompactHooks["UserPromptSubmit"], updatesisAlreadyInstalledto require the pregen hook, and fixesmergeHooksdedup logic forUserPromptSubmitCloses #95
Generated with Claude Code