$ cat ~/map/pi-ask-user-question.md
pi-ask-user-question
Adds a Claude Code-compatible ask_user_question tool that lets the LLM pop structured multiple-choice dialogs.
extensions✓ Oct 16
Facts
- GitHub Stars
- ★ 0
- Forks
- 0
- license
- MIT
- npm / mo
- —
- last push
- Aug 27, 2026
install
pi install git:github.com/96tommykim/pi-ask-user-question## TL;DR
pi extension adding a Claude Code-compatible ask_user_question tool — structured multiple-choice prompts with an automatic Other free-text entry — plus a fail-closed runtime gate that asks before external or destructive bash commands.
## Key points
- $The ask_user_question schema is compatible with Claude Code's AskUserQuestion tool: 1-4 questions, 2-4 labeled and described options each, optional multiSelect, and an automatic Other free-text entry on every question.
- $In the TUI, all questions for a call render in one tabbed dialog — arrow keys switch questions, each keeps its own cursor and selection, answered questions get a filled marker — while non-TUI dialog-capable (RPC) sessions fall back to pi's built-in ctx.ui.select / ctx.ui.input dialogs, asked one question at a time.
- $External-action gate: a tool_call handler asks before bash runs anything external or destructive — git push, gh pr/issue create-edit-merge-close, gh api writes, rm -r, sudo — and blocks the call unless the user picks Approve once. Approval is per call; nothing is remembered across calls.
- $Fail-closed: sessions without a dialog-capable UI (-p, JSON mode) and any subagent child (PI_SUBAGENT_CHILD=1) block with guidance to escalate the exact command; an Escape, abort, dialog error, or free-text answer all count as not approved.
- $Input validation runs before any UI opens: questions need non-empty text and headers with 2-4 options carrying non-empty labels, and terminal control characters (including ANSI/APC escapes) are rejected in every rendered field.
## FAQ
Q Does answering a question approve a later command?
No — the tool asks, the gate blocks. executionMode with sequential only orders that message's tool-call batch; it never cancels or suppresses later sibling calls. Approval is enforced by the separate runtime gate, which the model cannot sequence away.
Q What happens in headless sessions?
The tool requires dialog-capable UI: a subagent child always fails first and must escalate to its parent to ask the user, and a headless non-subagent session fails with guidance to ask in plain text instead of hanging on a dialog that can never be shown.
## References
## Related entries
$ big-pi
Model-driven compression that summarizes completed phases into tiered blocks while Pi's JSONL transcript stays authoritative and untouched.
$ Pi Taste
Local preference-learning extension that distills accepted and rejected turns into one readable taste.md.
$ pi-agent-substrate
Suspendable remote workspaces for pi and Oh My Pi, on a self-hosted Agent Substrate cluster.
Last updated: Aug 31, 2026