Skip to content

feat: add pregen background hook to UserPromptSubmit#98

Merged
claude[bot] merged 1 commit intomainfrom
claude/issue-95-20260227-1332
Feb 27, 2026
Merged

feat: add pregen background hook to UserPromptSubmit#98
claude[bot] merged 1 commit intomainfrom
claude/issue-95-20260227-1332

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Feb 27, 2026

Summary

  • Adds uncompact pregen & as a new UserPromptSubmit hook so the cache warms automatically in the background on every user prompt
  • Since pregen exits immediately when the cache is still fresh, the per-prompt overhead is minimal — it only makes an API call when the cache has expired
  • Fixes a latent bug in mergeHooks: the previous UserPromptSubmit switch 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 to uncompactHooks["UserPromptSubmit"], updates isAlreadyInstalled to require the pregen hook, and fixes mergeHooks dedup logic for UserPromptSubmit

Closes #95

Generated with Claude Code

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>
@claude claude bot merged commit 3f1de58 into main Feb 27, 2026
1 check passed
@claude claude bot deleted the claude/issue-95-20260227-1332 branch February 27, 2026 13:51
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.

Wire pregen into installed hooks so cache warms automatically

0 participants