[FEATURE] Slash commands: interactive review loops with per-item action dispatch
Preflight Checklist
- [X] I have searched existing requests and this feature hasn't been requested yet
- [X] This is a single feature request (not multiple features)
Problem Statement
Slash commands that produce a list of findings — code review results, documentation issues, security audit items, lint failures — have no way to walk the user through those findings interactively. The only workflow after a command finishes is to context-switch: open the output file in a separate editor, read through it manually, switch back to the terminal, and type a single undifferentiated message like "fix F1, F3, mark F7 acceptable, ignore F2."
Claude then processes everything at once with no per-item interaction, no ability to add context to individual items, and no way to dispatch targeted follow-up work automatically.
This forces a fragmented, low-fidelity loop between human triage and automated action. The slash command ecosystem is mature enough to produce structured output; it has no way to consume that output interactively.
The gap is compounded by two existing limitations:
- The Bash tool runs without a controlling terminal, so interactive TUI tools like
gumfail withopen /dev/tty: device not configured(tracked in #9881, where I left a comment specifically about this workflow). - There is no mechanism for a slash command to declare a loop-based review workflow — each
AskUserQuestionprompt requires a full Claude round-trip (~2–3 seconds), making a 30-item review loop prohibitively slow and awkward to author.
Proposed Solution
Allow slash commands to declare an interactive review loop over their structured output. When the command produces a list of items (findings, results, etc.), Claude Code enters a guided triage mode: it presents each item one at a time, shows a configured action menu, and — based on the user's choice — either dispatches a background agent, collects additional context first, or marks the item and moves on.
Example frontmatter:
---
review:
output_file: $ARGUMENTS-DOC-REVIEW.md
item_pattern: "^(F\\d+)"
actions:
- label: Fix
value: fix
dispatch: agent
prompt: "Fix this finding using the suggestion in the review document. Finding: {{item}}"
- label: Fix with guidance
value: fix_guided
dispatch: agent
collect_input: "Additional context for the agent:"
prompt: "Fix this finding: {{item}}. Additional context: {{input}}"
- label: Mark acceptable
value: acceptable
update_file: true
marker: "✅ Accepted"
- label: Defer
value: defer
update_file: true
marker: "⏸️ Deferred"
- label: Ignore
value: ignore
---
Interaction flow:
Claude Code reads the output file, identifies items matching item_pattern, and enters review mode:
── Finding 1 of 31 ──────────────────────────────────────────
F29 🔴 Critical — Stub date algorithm is underspecified
Location: RULE 6 (Lines 212–233)
Issue: The algorithm for computing stub dates is described only
in prose. No formula or worked example is provided.
Suggestion: State the precise rule and add a second example.
─────────────────────────────────────────────────────────────
[1] Fix [2] Fix with guidance [3] Mark acceptable [4] Defer [5] Ignore
> _
- Fix → dispatches a background agent scoped to that finding
- Fix with guidance → collects a line of context, passes it to the agent
- Mark acceptable / Defer / Ignore → updates the review file with the status marker and moves to the next item
The loop tracks progress and can be resumed if interrupted.
Alternative Solutions
Text-based triage (current workaround): After the command finishes, open the output file in a separate editor, read through it, switch back to the terminal, and type "fix F1, F3, mark F5 acceptable" as free text. This works but requires manual file navigation, offers no per-item interaction, and provides no way to give item-specific context to follow-up agents. For a 30+ item review, this workflow is tedious and error-prone.
AskUserQuestion in a loop: Could approximate this, but each prompt requires a full Claude round-trip (~2–3 seconds), making a 30-item loop take minutes. There is also no way to automatically dispatch an agent based on the user's response — that dispatch logic must be re-reasoned by Claude each iteration.
PTY + gum (#9881): PTY support would allow gum choose inside Bash, which is a meaningful improvement for lightweight prompts. But it does not address the higher-level orchestration: iterating over structured output, presenting context per item, dispatching agents, and updating the output file. PTY is a low-level enabler; this request is about a higher-level workflow primitive.
Prior closed issues: #25723 (structured prompts in frontmatter) addressed collecting input before a command runs. #17462 (custom TUI components) is about reducing AskUserQuestion latency. This request covers what happens after a command produces output — a fundamentally different phase of the command lifecycle.
Priority
High - Significant impact on productivity
Feature Category
Interactive mode (TUI)
Use Case Example
I maintain a /doc-review slash command that audits documentation quality and writes a structured findings file. A recent run on a 600-line loan data extraction prompt produced 31 findings:
F29 🔴 Critical - Stub date algorithm is underspecified
F30 🔴 Critical - `commitment` confused with schedule `amount`
F31 🔴 Critical - All-in floor vs. index floor confusion
F8 🟠 High - RULE 6 example lacks decision rule
F32 🟠 High - No guidance for relative payment dates
...21 more medium/low findings...
Today's workflow (5+ minutes of friction):
/doc-review extract-loan-datafinishes and writesextract-loan-data-DOC-REVIEW.md- I open the findings file in my markdown reader to review each finding
- I switch back to the terminal
- I type: "Fix F29, F30, F31. Mark F3 as acceptable. Ignore F1, F14."
- Claude processes them — I can add per-finding context, but it requires constant switching between the review doc and the terminal to reference each finding's details, and the message becomes unwieldy when multiple findings need specific guidance
With this feature (streamlined, per-item triage):
/doc-reviewfinishes → Claude Code enters review mode automatically- I see F29 with its location, issue, and suggestion — all the context I need
- I press
2for "Fix with guidance" and type: "Use the same closing-date example format from RULE 5" - Claude Code dispatches a background agent for F29 with that context, marks the file, shows me F30
- I press
1for "Fix" on F30 — agent dispatched immediately - I press
3for "Mark acceptable" on F14 — I've read the detail and it's fine - I continue through the list at my own pace
The findings are handled with appropriate granularity, agents receive targeted instructions, and the review file becomes a live audit trail updated as I triage.
This pattern generalizes to any command producing items requiring human judgment: security audit findings, migration checklists, dependency updates, failing test triage, code review comments.
Additional Context
Related issues (not duplicates):
- #9881 (Open) — PTY support for the Bash tool. I commented there (comment) with a
gum-based use case for slash command workflows. PTY support would help with lightweight interactive prompts, but it doesn't provide the higher-level primitive requested here: structured iteration over command output with per-item action dispatch. - #25723 (Closed) — Structured prompts in slash command frontmatter, for collecting input before a command runs. This request covers what happens after the command produces output.
- #17462 (Open) — Custom TUI components to reduce
AskUserQuestionlatency. This request is about a different interaction model: iterative item-by-item review with conditional branching and agent dispatch, not single-prompt acceleration.
Prior art: This pattern exists in tools like git add -p (per-hunk interactive staging with a fixed action menu), npm audit fix --interactive, and review UIs in static analysis platforms (Semgrep, CodeClimate). Claude Code's slash command system is well-positioned to make this pattern available for any structured-output workflow.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗