Skip to content

feat(chat): add AskQuestions mode for contextual clarification - #776

Open
SeleiXi wants to merge 4 commits into
HKUDS:devfrom
SeleiXi:feat/ask-questions-capability
Open

feat(chat): add AskQuestions mode for contextual clarification#776
SeleiXi wants to merge 4 commits into
HKUDS:devfrom
SeleiXi:feat/ask-questions-capability

Conversation

@SeleiXi

@SeleiXi SeleiXi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Description

This PR introduces an explicit Ask Questions mode. When enabled, it requires the model to first inspect the current request and conversation context, identify the most important missing information, and ask the user a focused set of clarification questions before completing the task.

Motivation

Users do not always know how to formulate a complete request. In many cases, they may know the outcome they want, but may not know:

  • which details are important to provide;
  • what assumptions the model is currently making;
  • what context is still missing for a high-quality answer; or
  • which constraints would materially affect the result.

Key changes

  • Register the ask_questions mode across the runtime, CLI, and web capability picker.
  • Add the ask CLI alias.
  • Force ask_user on the first internal loop round while suppressing any pre-tool narration.
  • Resume the same agent turn after single- or multi-question replies.
  • Add localized English and Chinese questioning policies.
  • Preserve resolved ask_user questions and answers in later-turn context.
  • Support both SQLite and PocketBase session stores without introducing a new persistence schema.
  • Add tests for capability registration, prompt localization, forced first-round tool selection, pause/resume behavior, CLI aliases, and context persistence.

Use Case & Screenshot

image

Related Issues

Closes #775

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

SeleiXi added 4 commits August 3, 2026 21:03
get_messages_for_context only loaded role/content, so extract_ask_user_clarifications always saw empty events and the model forgot prior card Q&A.
Resolved ask_user exchanges happened before the assistant produced the
row's answer, so they must precede the row's content in both
_build_history() and format_messages_as_transcript(). The previous order
(assistant content first, clarification second) made later turns see the
answer before the user supplied the missing context, confusing the model
and polluting rolling summaries.

Update the test that had locked in the wrong order.
@SeleiXi
SeleiXi changed the base branch from main to dev August 17, 2026 13:19
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.

[Feature Request]: Add an Ask Questions mode for proactive clarification before answering

1 participant