Ask UI
Use Ask UI as a presentation and persistence adapter. Keep question generation and reasoning in the calling workflow.
Decide whether to use the UI
Use the UI when the current round contains at least two independent questions that the user can answer now. Keep dependent questions for a later round. Ask a single question directly in the conversation.
If the local server or browser cannot start, fall back to the calling workflow's normal text format.
Ask and wait for the answer
-
Resolve the directory containing this
as
.
-
Read references/schema.md before creating JSON.
-
Create a QuestionSet JSON file. For a new task, omit
; for follow-up rounds, reuse the active
and set
.
-
Run the foreground command and keep the tool call active until it exits:
text
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs ask --input <questions.json>
-
The command writes readiness details and the local URL to stderr, opens the form, and waits. Do not end the Agent turn or ask the user to reply “已提交”.
-
After the user submits, parse the single JSON result written to stdout and continue the originating workflow immediately.
-
If more independent questions are needed, call
again with the same
and
set to the returned round. When no further questions remain, complete the session.
Use
only when browser opening is managed separately. Use
only when a fixed localhost port is required.
Manual fallback and recovery
Use the detached workflow when the foreground tool call cannot remain active, the local browser cannot reach the temporary server, or an interrupted direct round must be recovered:
text
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs create --input <questions.json>
Parse the returned JSON. Include its URL and a visible marker in the conversation:
text
ask-ui-session: <sessionId>
Tell the user to submit the form and reply only with “已提交”. The
command starts or reuses a detached localhost server and returns immediately.
When the user says “已提交”, “提交好了”, or “答完了”:
-
Recover
from the latest
marker in this conversation.
-
Run:
text
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs resume --session <sessionId>
-
If the result is
, use its questions and answers to continue the original workflow.
-
If more independent questions are needed, prefer returning to the foreground
command with the same
and
set to the processed round. Use
again only when direct waiting remains unavailable.
-
If no further questions remain, run:
text
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs complete --session <sessionId>
If the conversation marker is unavailable, run
without
. When multiple candidates are returned, infer the best match from the current topic, workspace, title, and submission time. Ask the user only when the match is genuinely ambiguous.
Repeated “已提交” messages must not create duplicate rounds. A new round should only be created after successfully reading a
round.
Preserve session continuity
- One task is one Session.
- Each batch of questions is one Round.
- Reuse across all rounds of the same task.
- Never overwrite submitted questions or answers.
- Put corrections and additional confirmation in a new Round.
- Start a new Session only for a new task, a completed task, or an explicit restart.
Optional active wake-up
Ask UI supports optional wake metadata for Claude Code and Codex App Server. Treat it as an enhancement, not a requirement.
- Enable automatic wake only with the user's consent.
- Claude Code requires a recorded session id.
- Codex requires a host-provided thread id. Never guess a Codex thread id.
- On adapter failure, preserve the answer and return to the manual “已提交” workflow.
- Direct mode never triggers wake adapters because the waiting process is already the return channel.
Useful commands
text
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs ask --input <questions.json>
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs create --input <questions.json>
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs status --session <sessionId>
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs serve
node <ASK_UI_SKILL_DIR>/scripts/ask-ui.mjs complete --session <sessionId>
node <ASK_UI_SKILL_DIR>/scripts/self-test.mjs