Skip to content

fix(install): wire the UserPromptSubmit prompt hook into the installer#95

Merged
tmck-code merged 3 commits into
mainfrom
fix/installer-wires-prompt-hook
Jul 17, 2026
Merged

fix(install): wire the UserPromptSubmit prompt hook into the installer#95
tmck-code merged 3 commits into
mainfrom
fix/installer-wires-prompt-hook

Conversation

@tmck-code

Copy link
Copy Markdown
Owner

Context

The statusline reads ~/.claude/yas-last-prompt.json (or $CLAUDE_CONFIG_DIR/…) to turn-scope which subagents it shows. That marker is written by hooks/yas-prompt-hook.py, which only shipped via the plugin's hooks/hooks.json — auto-loaded by Claude Code only when the plugin is installed AND enabled.

So users who install via ops/install.sh (or git-clone) with the plugin disabled got an orphan hook: no yas-last-prompt.json entries, so RunningSubagents.visible() silently fell back to its 60s time-window heuristic instead of accurate turn-scoping. The statusline still rendered (installer wires it directly), so the degradation was invisible.

Changes

Installer wires the hook (ops/install.sh)

  • New json_py ops wire / get-hook / del-hook.
  • do_wire() resolves $PLUGIN_ROOT/hooks/yas-prompt-hook.py and upserts it into hooks.UserPromptSubmit in the same atomic write as the statusLine (one backup/validate/restore).
  • Upsert matches by the yas-prompt-hook.py substring, so foreign hooks are preserved and stale paths are rewritten on upgrade (rides the same re-run rails as the statusLine path).
  • do_uninstall() removes the hook symmetrically, collapsing empty UserPromptSubmit/hooks.

Tests (test/test_prompt_hook.py)

  • New TestInstallerHookOps drives the real heredoc via subprocess: wire-on-empty, idempotent, preserve-foreign, stale-path-replace, get-hook, del-hook.

Docs (README.md)

  • Install + "what it writes" sections document the newly-wired hook and its role in accurate turn-scoped subagent display.

Checklist

  • Tests added or updated for new/changed behaviour

Screenshots / recording

  • N/A — no visible change

Benchmark

  • N/A — no performance-relevant change

System info

Key Value
OS Darwin 25.5.0 arm64
Claude Code 2.1.201
Terminal tmux-256color / truecolor
Locale en_AU.UTF-8
Python 3.14.6
uv 0.11.23

🤖 Generated with Claude Code

The statusline reads ~/.claude/yas-last-prompt.json to turn-scope which
subagents it shows, but that marker is written by yas-prompt-hook.py which
only shipped via the plugin's hooks.json — loaded only when the plugin is
installed AND enabled. Installer/git-clone users (plugin disabled) got an
orphan hook, so RunningSubagents.visible() silently fell back to its 60s
time-window heuristic instead of accurate turn-scoping.

Make ops/install.sh wire the hook the same way it already wires the
statusline: resolve $PLUGIN_ROOT/hooks/yas-prompt-hook.py and upsert it into
hooks.UserPromptSubmit in the same atomic write. New json_py ops wire/
get-hook/del-hook upsert by the yas-prompt-hook.py substring so foreign hooks
are preserved and stale paths are rewritten on upgrade; do_uninstall removes
it symmetrically, collapsing empties. Tests exercise the real heredoc via
subprocess.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015qvCatXxokesoY6oA2cheU
@tmck-code
tmck-code marked this pull request as ready for review July 17, 2026 14:12
@tmck-code
tmck-code merged commit 33ffed6 into main Jul 17, 2026
6 checks passed
@tmck-code
tmck-code deleted the fix/installer-wires-prompt-hook branch July 17, 2026 14:15
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