🎾 A button that has Claude ask you what it needs, one question at a time, in its own question picker.

A button that has Claude ask you what it needs, one question at a time, so nothing gets lost at the bottom of a long answer.
/plugin install your-serve@claude-desk-neighbours
Click 🎾 your serve in the status row under the prompt, or run /your-serve. Claude looks back over its last reply and asks you each open question in its own question picker, one at a time, with the options it would suggest. If nothing is waiting on you, it says so in one line.
Press it whenever you like: after a long answer, when you've lost track of what Claude asked, or when you'd rather pick from options than type. If Claude is still working, the request waits until the turn is over.
Claude sees the request as a message from Your Serve, not as something you typed.
Each press starts a normal turn on your session's model. Your Serve makes no calls of its own and keeps nothing between sessions.
hooks/register.tsx 60 lines1import type { EngineInterface, Register, RenderElement, RenderNode } from 'claude-code'
2
3const COMMAND = 'your-serve'
4const LABEL = '🎾 your serve'
5
6// Sent framed, so Claude reads it as the plugin's message rather than words the person typed. Claude has the whole
7// conversation, so it decides what is still open and writes the options itself.
8export const ASK = [
9 'Look back over your last reply and this conversation. For each thing that still needs my answer or decision',
10 'before you can go on, ask me with AskUserQuestion: one question per call, in the order they come up, with the',
11 'options you would suggest and your recommendation first. Do not repeat the reply.',
12 'If nothing is waiting on me, say so in one line.',
13].join(' ')
14
15async function serve($: EngineInterface): Promise<void> {
16 await $.prompt.submit({ text: ASK })
17}
18
19// The hint line under the prompt can be shared with other mods. Your Serve adds its item to a row
20// keyed `desk-hint` after the engine's own hint; items on it are kept in order by their keys, so
21// the row reads the same in any load order.
22const DESK = 'desk-hint'
23
24function keyOf(node: RenderNode | undefined): string {
25 if (typeof node !== 'object' || node === null || !('props' in node)) return ''
26 const key = (node.props as Record<string, unknown> | undefined)?.key
27 return typeof key === 'string' ? key : ''
28}
29
30export function joinDesk(below: RenderElement, mine: RenderElement, wrap: (children: RenderNode[]) => RenderElement): RenderElement {
31 if (below.type !== 'Box' || keyOf(below) !== DESK) return wrap([below, mine])
32 const [line, ...items] = below.children ?? []
33 const sorted = [...items.filter(n => keyOf(n) !== keyOf(mine)), mine].sort((a, b) => keyOf(a).localeCompare(keyOf(b)))
34 return { ...below, children: line === undefined ? sorted : [line, ...sorted] }
35}
36
37export const register: Register = on => {
38 on('session.start', async ($, e, next) => {
39 await $.command.register({ name: COMMAND, description: '🎾 Have Claude ask you what it needs, one question at a time' })
40 return next(e)
41 })
42
43 on('command.run', { command: COMMAND }, async $ => {
44 // A prompt submitted from this hook would wait on the turn the command holds, so it goes once the command is done.
45 $.clock.after(1, () => void serve($).catch(() => undefined))
46 return { text: '🎾 Over to Claude for its questions' }
47 })
48
49 on('ui.render', { component: 'PromptHint' }, async ($, e, next) => {
50 const below = await next(e)
51 const { Box, Button } = $.ui.resolve(e)
52 const mine = <Button key="desk-2-your-serve" plain dimColor label={LABEL} onPress={() => void serve($)} />
53 return joinDesk(below, mine, children => (
54 <Box key={DESK} flexDirection="row" columnGap={2}>
55 {children}
56 </Box>
57 ))
58 })
59}
60