Skip to content

Bundle the advisory prompt hook; nudge adopt in the preflight#11

Merged
sronix merged 1 commit into
mainfrom
feat/proactive-doctrine
Jun 11, 2026
Merged

Bundle the advisory prompt hook; nudge adopt in the preflight#11
sronix merged 1 commit into
mainfrom
feat/proactive-doctrine

Conversation

@sronix

@sronix sronix commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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 at nauro 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 when nauro is off PATH, otherwise execs nauro 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-line nauro adopt nudge. Silent in non-git directories, adopted repos, and linked worktrees of adopted repos (checks .nauro/config.json, the registry, and the main-worktree path).
  • README: the new hook under "What it bundles"; the plugin-OR-setup coexistence note now covers --with-hooks (running both surfaces each decision twice, because setup's idempotency marker doesn't match the wrapped command).
  • CHANGELOG: Added section under 0.12.7.

What to review

  • The preflight's worktree branch is the least obvious logic: a linked worktree's --show-toplevel differs from the registered main-worktree path, so the script also resolves --git-common-dir's parent before concluding the repo is unadopted.
  • The registry check is a fixed-string grep for the quoted repo path. A path registered with a different symlink resolution than git rev-parse returns would produce a spurious nudge; the failure mode is one extra advisory line in context, not an error.

What's deferred

  • The duplicate-surfacing case when a user has both the plugin and nauro setup --with-hooks is 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 . --strict passes. 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.

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.
@sronix
sronix merged commit ed09697 into main Jun 11, 2026
3 checks passed
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