Bundle the advisory prompt hook; nudge adopt in the preflight#11
Merged
Conversation
Two proactive-surfacing gaps closed. The CLI's advisory UserPromptSubmit hook (surfaces decisions related to each prompt as non-blocking context) was opt-in on the CLI and absent from the plugin; it is now bundled by default behind a guard wrapper that exits silently when the nauro binary is off PATH, so a missing binary never fails a turn. The SessionStart preflight additionally nudges nauro adopt when the binary is present but the session's git repo has no registered project (silent in non-git dirs, adopted repos, and linked worktrees of adopted repos). Verified: strict manifest validation passes; the hook emits on a high-signal prompt against a real decision store and stays silent on unrelated prompts, unadopted directories, and missing binary; all preflight paths behave as documented.
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.
Why
The plugin shipped its plumbing hook (the missing-binary preflight) while leaving its most valuable one on the shelf. The CLI's advisory UserPromptSubmit hook surfaces decisions related to each prompt as non-blocking context, and exists precisely because bare sessions edit code without ever calling
check_decision— but it was opt-in on the CLI and absent from the plugin, so plugin users never got it. Separately, the first-run funnel had a second silent gap: a user with the binary installed but no adopted repo gets MCP tool errors with nothing pointing atnauro adopt.Approach
Bundle the prompt hook as a plugin default, matching the posture the plugin already takes for agents (flag-gated on the CLI, included in the plugin). The recorded alternatives: keeping parity with the CLI's opt-in (rejected — plugins have no per-component opt-in surface, so parity means plugin users never get the hook), and wiring the raw command without a guard (rejected — a missing binary would fail the hook on every prompt, the loud version of the silent failure the preflight prevents).
The hook's noise properties make the default safe: it exits silently when the repo has no Nauro project, when nothing clears the BM25 relevance floor, and on any internal error. The wrapper script adds the one guard the CLI cannot provide for itself (binary off PATH).
What changed
scripts/prompt-hook-nauro.sh(new): guard wrapper; exits 0 silently whennaurois off PATH, otherwise execsnauro hook user-prompt-submit.hooks/hooks.json: UserPromptSubmit entry with the same 10s timeout the CLI's own setup writes.scripts/preflight-nauro.sh: when the binary is present but the session's git repo has no registered project, emits a one-linenauro adoptnudge. Silent in non-git directories, adopted repos, and linked worktrees of adopted repos (checks.nauro/config.json, the registry, and the main-worktree path).--with-hooks(running both surfaces each decision twice, because setup's idempotency marker doesn't match the wrapped command).What to review
--show-topleveldiffers from the registered main-worktree path, so the script also resolves--git-common-dir's parent before concluding the repo is unadopted.git rev-parsereturns would produce a spurious nudge; the failure mode is one extra advisory line in context, not an error.What's deferred
nauro setup --with-hooksis documented, not detected. Teaching setup's marker to recognize the plugin's wrapper is a CLI-side change, worth doing only if real users hit it.Test plan
claude plugin validate . --strictpasses. Eight manual paths verified: prompt hook silent on missing binary, silent on unadopted cwd, silent below the relevance floor, emits the advisory payload on a matching prompt against a real store; preflight retains the missing-binary message and stays silent in non-git dirs, adopted repos, and linked worktrees, while nudging in an unadopted git repo.