Discusses answer choices in a fork and returns the selected answer.
Install / load
This extension is loaded through the root pi-ext package.
See ../../README.md.
Commands / tools / settings
Commands:
/q — open a UI wizard for questions found in the latest assistant message.
Alt+Q — same as /q.
/b — return an answer from a /q discussion fork.
/b <answer> — 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 <q-answer> return
format to the system prompt while inside a discussion fork.
Settings:
none.
Bench:
mise run bench-q — benchmark the local heuristic extractor.
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, bullet/numbered/lettered options, inline choices, binary approval questions, preceding option blocks, and Options: blocks.
It ignores fenced code, URLs, Markdown tables, box-drawing tables, path-like slash text, and Next steps: action lists.
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.
After an assistant message ends, local extraction runs in the background and notifies when /q / Alt+Q can render questions.
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:
<q-answer>concise answer here</q-answer>
/b returns from the discussion fork to the original session.
Without args, it uses the latest assistant <q-answer>...</q-answer> 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.
# qFollow-up question fork helper for Pi.
Discusses answer choices in a fork and returns the selected answer.
## Install / loadThis extension is loaded through the root pi-ext package.
See [../../README.md](../../README.md).
## Commands / tools / settingsCommands:
- `/q` — open a UI wizard for questions found in the latest assistant message.
- `Alt+Q` — same as `/q`.
- `/b` — return an answer from a `/q` discussion fork.
- `/b <answer>` — 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 `<q-answer>` return
format to the system prompt while inside a discussion fork.
Settings:
none.
Bench:
- `mise run bench-q` — benchmark the local heuristic extractor.
## 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, bullet/numbered/lettered options, inline choices, binary approval questions, preceding option blocks, and `Options:` blocks.
It ignores fenced code, URLs, Markdown tables, box-drawing tables, path-like slash text, and `Next steps:` action lists.
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.
After an assistant message ends, local extraction runs in the background and notifies when `/q` / `Alt+Q` can render questions.
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<q-answer>concise answer here</q-answer>
```
`/b` returns from the discussion fork to the original session.
Without args, it uses the latest assistant `<q-answer>...</q-answer>` 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.