Skip to content

capture-hooks install: add --components opt-out (SessionStart re-registration) (#26)#29

Open
danielhertz1999-bit wants to merge 1 commit into
CodeAbra:mainfrom
danielhertz1999-bit:feature/capture-hooks-components
Open

capture-hooks install: add --components opt-out (SessionStart re-registration) (#26)#29
danielhertz1999-bit wants to merge 1 commit into
CodeAbra:mainfrom
danielhertz1999-bit:feature/capture-hooks-components

Conversation

@danielhertz1999-bit

Copy link
Copy Markdown
Contributor

Addresses the second half of #26.

The problem

capture-hooks install always (re)registers all three capture hooks — Stop, UserPromptSubmit, and the SessionStart recall/prefix hook — and there's no way to opt out. A user who had deliberately removed the SessionStart prefix injection (too noisy at every startup/resume/clear/compact) but kept Stop + UserPromptSubmit capture got the SessionStart entry silently put back on the next install, with no --force to gate it and no flag to skip it.

The change

Add a --components flag to capture-hooks install:

  • Default stop,turn,recall — identical to today's behavior, so existing installs are unaffected.
  • --components=stop,turn — installs ambient capture without wiring the SessionStart recall hook. An excluded component's template copy and its settings.json registration are both skipped.
  • Unknown component names are rejected with a clear message and exit 2.
capture components to install (default: all). Choices:
  stop   — end-of-session capture (Stop hook)
  turn   — per-prompt capture (UserPromptSubmit hook)
  recall — SessionStart prefix injection

status and uninstall already report/remove each hook independently, so no change was needed there. Refactored the repeated template-copy / command-string construction into small local helpers so the three component blocks read in parallel.

Verification

Ran the installer against a redirected temp $HOME:

  • --components=stop,turnsettings.json has Stop + UserPromptSubmit, no SessionStart.
  • default → all three present (unchanged).
  • --components=stop,bogus → exits 2 with unknown capture component(s): bogus.

Note

This doesn't try to auto-detect "deliberately removed" (which isn't reliably distinguishable from "never installed" without a stamped marker) — it gives the explicit opt-out you suggested instead. Pairs with #28 (the in-wheel-wrapper resolution fix) to close out #26.

🤖 Generated with Claude Code

capture-hooks install always (re)registered all three capture hooks —
Stop, UserPromptSubmit, and the SessionStart prefix/recall hook — with no
way to opt out. Users who had deliberately removed the noisy SessionStart
prefix injection got it silently put back on every run.

Add `--components` (default `stop,turn,recall`, i.e. unchanged behavior).
`--components=stop,turn` installs ambient capture without wiring the
SessionStart recall hook; an excluded component's template copy and
settings.json registration are both skipped. Unknown names are rejected
with a clear error (exit 2).

Factored the per-hook template-copy / command-string into local helpers to
keep the three component blocks parallel. status/uninstall already report
and remove each hook independently, so no change needed there.

Addresses the second half of CodeAbra#26 (reported by @Marsu6996).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant