Skip to content

feat(tool): add ask-user-questions tool#2579

Open
detro wants to merge 10 commits into
charmbracelet:mainfrom
detro:detro/add_ask-user-questions_tool
Open

feat(tool): add ask-user-questions tool#2579
detro wants to merge 10 commits into
charmbracelet:mainfrom
detro:detro/add_ask-user-questions_tool

Conversation

@detro

@detro detro commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

With recent attention to Claude Code leak, I spent a bit of time into this analysis of the codebase, and I spotted something I have always wondered how it worked: AskUserQuestion system tool. Something very similar exists in OpenCode too. And in Gemini CLI.

When an LLM is in the Agent loop, sometimes I wish it stopped, it asked for my preference and then continued. Sometimes can be the small things, like

do you prefer a couple of IFs here, or would you rather use a SWITCH?

So I though I'd try to implement this tool in Crush.

The implementation is made essentially of 3 parts:

  • a Questions service that uses PubSub to listen to Ask calls and handle Answer calls
  • a Questions dialog that knows how to render a consistently-styled form (or forms, if the LLM asks more than 1 question) and allow for single and multi selection
  • a AskUserQuestions tool: frankly, fantasy feels kinda magic to me - this was TOO EASY to implement

Screenshots

Screenshot_2026-04-11_at_21 24 43 Screenshot_2026-04-11_at_21 23 55 Screenshot 2026-04-11 at 21 32 51 Screenshot 2026-04-11 at 21 25 27

@detro detro requested a review from a team as a code owner April 7, 2026 22:00
@detro detro requested review from andreynering and aymanbagabas and removed request for a team April 7, 2026 22:00
@detro detro force-pushed the detro/add_ask-user-questions_tool branch from 45f7375 to e873d22 Compare April 8, 2026 07:43
@detro detro force-pushed the detro/add_ask-user-questions_tool branch from e873d22 to 9b7248e Compare April 11, 2026 20:38
}

func (w *ClientWorkspace) QuestionsAnswer(res questions.QuestionsResponse) {
// TODO Implement for ClientWorkspace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this I might need some help, as I don't know exactly what this is.
I haven't used Crush in client/server mode yet.

@detro detro changed the title [WIP] feat: adding internal/ask_question service to the app feat: add ask_user_questions tool Apr 11, 2026
Comment on lines -107 to -115
providerInfo = string(m.prov.Name)
providerInfo = m.prov.Name
}
styles := ListItemStyles{
miStyles := ListItemStyles{
ItemBlurred: m.t.Dialog.NormalItem,
ItemFocused: m.t.Dialog.SelectedItem,
InfoTextBlurred: m.t.Base,
InfoTextFocused: m.t.Base,
}
return renderItem(styles, m.model.Name, providerInfo, m.focused, width, m.cache, &m.m)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick spotted by IntelliJ while I was reading the code.

@detro detro changed the title feat: add ask_user_questions tool feat(tool): add ask_user_questions tool Apr 11, 2026
@detro detro changed the title feat(tool): add ask_user_questions tool feat(tool): add ask-user-questions tool Apr 11, 2026
@Jonathan-79

Copy link
Copy Markdown

Hi @detro,

Great work on this PR!

I had a quick thought/suggestion: do you think it would be a good idea to always append a "Type your own answer" option (perhaps triggering a textbox) alongside the predefined options the LLM provides?

That way, if the user doesn't quite agree with any of the LLM's suggested choices, they always have a fallback to easily provide a custom answer. Of course, this is just an idea and only makes sense if it doesn't drastically increase the complexity of your current implementation.

@detro

detro commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

@Jonathan-79 thank you - yes, I think I want to expand the set of options a bit to offer that functionality.

In fact, I think I'd like to imitate https://geminicli.com/docs/tools/ask-user/ and then describe to the LLM the the markdown that "in case the user should choose an 'other' option, call this tool again with the type set to text". Something along these lines.

This leaves the choice to llm, depending on the context: when it makes sense to offer an "other" and when it doesn't.

I have raised this even in a discord thread.

@meowgorithm

Copy link
Copy Markdown
Member

@detro, thanks for the solid work on this one. We're taking the thinking here as well as in some other relevant PRs and consolidating them in #3069, which I think we can release pretty soon. If you don't mind, let's keep this one open for the moment but focus our efforts there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants