# q Follow-up question fork helper for Pi. Discusses answer choices in a fork and returns selected answer. ## Install / load This extension is loaded through the root pi-ext package. See [../../README.md](../../README.md). ## Commands / tools / settings Commands: - `/q` — open a UI wizard for questions found in the latest assistant message. - `/b` — return an answer from a `/q` discussion fork. - `/b ` — return given answer. - `/b edit` — edit the marked answer before returning it. Tools: none. Hooks: - `session_start` — restores the discussion widget when the session is a `/q` discussion fork. - `session_shutdown` — clears the discussion widget. - `before_agent_start` — adds active discussion question and `` return format to the system prompt while inside a discussion fork. Settings: none. ## Behavior `/q` requires interactive mode. It waits for the agent to go idle, reads latest assistant text, then extracts questions and explicit answer suggestions. Extraction starts with local heuristics. It detects question lines and bullet/numbered/lettered options. Suggestions are deduplicated case-insensitively and capped at 8. If questions exist but suggestions are missing, it asks the selected model to extract suggestions. If no questions are found, it only shows a notification. The wizard shows one question at a time. Choices are extracted suggestions, `custom answer`, or `discuss answer in fork`. Completed answers are sent as a user message. One answer is sent raw. Multiple answers are sent as a numbered list. Fork discussion requires a persisted session. The fork stores `/q` state in custom session entries and shows a small widget with current question. The fork prompt asks the model to finish with: ```xml concise answer here ``` `/b` returns from the discussion fork to the original session. Without args, it uses the latest assistant `...` block. With text after `/b`, it uses that text directly. With `/b edit`, it opens `VISUAL`, then `EDITOR`, then `vi`, using a temp file. Editor command parsing splits quotes but does not invoke a shell. Return validation checks original session file, session id, leaf id, entry count, pending wizard, wizard status, and question index. If validation fails, the answer can be put into the editor or discarded.