Skip to content

feat(hook): user-prompt-submit /rename nudge — 0.14.0 - #16

Merged
roypadina merged 2 commits into
mainfrom
feat/rename-nudge-hook
Nov 5, 2026
Merged

roypadina merged 2 commits into
mainfrom
feat/rename-nudge-hook

Conversation

@roypadina

Copy link
Copy Markdown
Owner

Peers can only @-address a Claude Code session whose name a human chose with /rename; derived names are withheld. This adds a deterministic nudge.

agentctl hook user-prompt-submit (registered by the agentctl-sessions plugin 0.3.0 as a UserPromptSubmit hook)

  • Reads Claude Code's own <profile>/sessions/<pid>.json record (nameSource, name, kind); no network, no model call, ~30 ms.
  • nameSource: derived, 2nd prompt or later (per-session counter in $TMPDIR/agentctl-prompts/) → one line of context: propose a kebab name, run agentctl name "<name>", end the reply with Rename: **/rename <name>**.
  • Renamed (anything but derived) → prints nothing; syncs the Agentctl name to the /rename name when they differ.
  • No record / not interactive / no nameSource / junk input → silent, exit 0.

agentctl hook session-start drops its "no Agentctl name" nudge when the registry tracks /rename (the prompt hook covers naming); older Claude Code keeps it.

registryEntry() is a separate reader from readLiveSessions() because the latter keeps only busy/idle and a session running a ! command reports shell.

Tests: 229 pass (new: named / derived 1st / derived 2nd / missing entry / non-interactive / junk / name sync; registry reader newest-wins + status-agnostic; counter). Typecheck + build clean.
Live check: real interactive Claude Code 2.1.318 scratch session: prompt 1 silent, prompt 2 nudge injected (hook_success UserPromptSubmit), after /rename silent + agentctl name synced; SessionStart no longer printed the old nudge.

Also bumps to 0.14.0 (package.json, lock, CHANGELOG) and adds the hook to the README plugin section.

🤖 Generated with Claude Code

Peers can only @-address a session whose name a human chose with /rename.
New `agentctl hook user-prompt-submit` reads Claude Code's own
sessions/<pid>.json record: while nameSource is `derived` it asks the model,
from the 2nd prompt on, to propose a kebab name, run `agentctl name` and end
the reply with `Rename: **/rename <name>**`. Once renamed it prints nothing
and syncs the Agentctl name to the /rename name. No network, no model call.

session-start drops its "no Agentctl name" nudge when the registry tracks
/rename for the session; older Claude Code keeps it.
@roypadina
roypadina merged commit 5a665c6 into main Nov 5, 2026
2 checks passed
@roypadina
roypadina deleted the feat/rename-nudge-hook branch November 5, 2026 21:02
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