Skip to content

Wire pregen into installed hooks so cache warms automatically #95

@claude

Description

@claude

Feature Gap

The pregen command exists to proactively warm the cache before compaction, but uncompact install does not add any hook that triggers it automatically. Users who don't know about pregen will always wait for a fresh API call (10–15 minutes) on first run after compaction.

Current hooks installed (internal/hooks/hooks.go:32-47):

  • Stopuncompact run (emits context bomb)
  • UserPromptSubmituncompact show-cache (replays cached bomb)

No hook runs pregen to warm the cache in the background.

Proposed Fix

Add uncompact pregen to the UserPromptSubmit hook list (alongside show-cache, as a separate hook entry). Since pregen already checks cache freshness at startup and exits immediately if the cache is still valid, the overhead on every prompt is minimal — it only makes an API call when the cache has expired.

The hook command would be:

bash -c 'export PATH="$HOME/go/bin:$HOME/.local/bin:/usr/local/bin:/opt/homebrew/bin:$PATH"; uncompact pregen &'

The trailing & ensures it runs in the background and does not block the user prompt.

This closes the UX gap where first-time users experience a long wait on the Stop hook because pregen was never triggered.

@claude please implement this

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions