Skip to content

ui-sdk: an ask_user_form tool — nested, conditional questions answered in one card #585

Closed

Description

@schlessera

Context

The conditional-form implementation is on main through PR #749, squash 0c0c9dfb32f3167f773c2ae2603a4657443c004a. Required physical-phone/live-agent verification below remains open. Standalone ranking previously landed through PR #721; #584 has its own remaining verification.

Some questions have a shape: what to ask next depends on the previous answer. Some examples:

  • "What kind of evening?" If the answer is film, ask which genres (multi-select). If it is board game, rank the candidate games. If it is walk, pick a distance (single choice).
  • "Which conference are we planning for?" The answer switches in that conference's session types (multi-select) and travel options (single choice).
  • A triage flow: "keep / archive / merge", where merge reveals a picker for the merge target.

Before this change, the agent asked these as a chain of separate ask_user calls. Each call cost a full model round-trip. The user saw each level as a separate card and could not change an earlier answer without the agent starting over.

What exists and what is proposed:

Proposal

A composable form tool, ask_user_form (working name). Its input is a flat list of nodes, and nesting is expressed through conditions rather than a recursive schema:

  • Each node has an id, a kind and a prompt, plus the fields its kind needs:
  • showIf: { node: <id>, anyOf: [<option label>...] } makes a node appear only when an earlier node's answer matches. Nodes with no showIf are always shown. Conditions only point to nodes earlier in the list, so there are no cycles. Maximum depth, total node count and options per node are configurable through settings, config or environment variables as appropriate, with sane defaults assessed during implementation. Three levels is a required layout example, not a fixed maximum.
  • When an answer changes, nodes whose condition no longer holds are hidden, and their answers are dropped from the result. The agent never receives answers to questions the user can no longer see.
  • The response is answers: { [nodeId]: value }, with the value typed per kind, only for nodes that were visible at Submit. It also lists which nodes were visible, so the agent can tell "not shown" from "skipped".
  • One card: one dialog header and one action row. Revealed nodes nest visually under the answer that revealed them, and every level stays editable until Submit.

Decision (maintainer, 2026-09-29)

Maintainer ruling:

  1. This does not subsume ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583 or ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584. ask_user_list and ask_user_rank remain standalone tools usable individually. The form can compose their scale and rank controls; it does not replace their tool contracts.
  2. ask_user does not become a one-node form. It remains an independent tool, unchanged by this issue.
  3. Limits are configurable. Maximum depth, node count and options per node are provided through settings, config or environment variables as appropriate. Choose and document sane defaults during implementation, supported by measurements. The configuration mechanism and numeric defaults are not prescribed by this decision.

Design

The full design spec incorporates this ruling: shared scale/rank row controls inside one form, one outer header and action row, and nesting that does not consume horizontal space. Its contract findings remain proposals to reconcile during implementation; the ruling above does not automatically approve additional settings or contract changes.

Out of scope

  • Replacing or folding in ask_user, ask_user_list or ask_user_rank.
  • Conditions on anything other than the equality of a single earlier answer (no expressions, no AND/OR across nodes, no numeric comparisons).
  • Validation rules beyond required/optional per node.
  • Multi-page wizards with Back/Next. Everything is one card with progressive reveal.
  • Saving a partially filled form across a reload before Submit.
  • Any domain logic that acts on the answers.

Acceptance criteria

  • The film/game/walk example above is expressible in one tool call, and a ui-sdk contract test round-trips it.
  • Validation rejects a showIf that points to a later or unknown node, or exceeds the configured depth cap. Tests cover the configured depth, node-count and options-per-node limits with defaults and overrides; invalid configuration is rejected explicitly.
  • Changing a parent answer hides the child nodes it no longer satisfies. Submit then returns no answers for them, and lists them as not visible. A test covers this.
  • Exactly one dialog header and one action row render, however many nodes are visible. Embedded scale/rank controls share their standalone row behavior but have no separate dialog header or Submit. Their completion state feeds the form validation and progress. Submit is never a silent no-op, and a required visible node left empty is marked (ui-react: an ask_user exchange with several questions reads as several dialogs to fill and submit #541).
  • Revealed nodes are announced to screen readers, and focus does not jump when a node appears.
  • At 320px, a 3-level form with a rank node under a single node is usable without horizontal scroll (visual baseline). Layout also covers a configured depth above 3, with no accumulating indentation; document the tested configuration and defaults.
  • The PR reports schema token cost per tool and the combined always-loaded bridge schema cost with ask_user, ask_user_list, ask_user_rank and ask_user_form retained. State which measurements use implemented schemas and which, if any, are estimates; do not claim savings from removing standalone tools.
  • Both backends expose the tool, and an answered form replays as a compact summary after reload.

Verification

  • ui-sdk contract, schema and configured-limit tests; ui-kit stories for each node kind nested under single; ui-react interaction tests for reveal, hide, answer-dropping and replay.
  • Manual on a phone: "help me pick tonight's activity". Answer film, pick genres, switch to board game, and check the genres disappear, then rank the games, submit, and check the agent's reply uses only the game ranking.

Contract impact

Additive: a new bridge tool, protocol frames, schemas and a kit component alongside the independent ask_user, ask_user_list (#583) and ask_user_rank (#584) tools. Shared scale/rank controls do not replace their standalone contracts. Document the new tool and frames in the integration contract when implementing.

Related: #583, #584, #541, #155.

Updated 2026-09-29: folded in the maintainer ruling on standalone tools and configurable limits; aligned composition, verification and schema-budget criteria, and linked the full design spec.

Dependency reconciliation (2026-10-01)

The standalone scale tool from #583 and the grouped question card from #541 have shipped. Standalone ranking is now on main through PR #721, squash 35fb78d4: the standalone ranking contract and React card were available before form implementation began. #584 remains open for required physical-device/live-agent verification. This issue’s dependency was the absent implementation on main; that prerequisite is now present, so the canonical blocker line and blocked label are removed.

PR #749 factors the shared controls as ScaleList (packages/ui-kit/src/decisions/AskUserListCard.tsx:230) and RankList (packages/ui-kit/src/decisions/AskUserRankCard.tsx:50), used by both the form and standalone cards. AskUserFormCard (packages/ui-kit/src/decisions/AskUserFormCard.tsx:253) owns one outer shell; AskUserFormExchangeCard (packages/ui-react/src/components/chat/ask-user-form-card.tsx:13) connects submission and replay. The configurable limits default to depth 3, 12 nodes and 8 options; environment keys are declared at packages/ui-server/src/config/env.ts:89-91.

The existing ask_user input schema is at packages/ui-sdk/src/tool-contracts/bridge.ts:77-78; the 2–4 option constraint remains at bridge.ts:63-67. The design’s historical React pointer at ask-user-card.tsx:284 predates the grouped-card implementation; the current binding is AskUserCard (packages/ui-react/src/components/chat/ask-user-card.tsx:99). The form now has its own single outer card, while the existing independent tool remains unchanged.

Required human verification (2026-10-01)

The implementation, automated browser coverage and keyless schema-cost report are complete in PR #749. The PR records failing mutation assertions and their restored passing checks. Browser emulation does not satisfy this issue's physical-phone/live-agent check; no paid live experiment was run.

On a physical phone, ask for help choosing tonight's activity; select Film, choose non-empty genres, switch to Board game, confirm the genres disappear, reorder the games, Submit, and confirm the agent's reply acts only on the game ranking. Verify taps, reordering, branch Undo/reselection and Submit remain usable on that device.

Completion evidence: a sanitized receipt naming device/browser, backend and package version; observed interaction results; the submitted visible-node/result shape showing no genres; and how the agent's reply used only the game ranking. Exclude credentials, personal content and deployment details. Once this receipt satisfies the required check, record it, remove needs: human and close the issue. Restore agent-ready only if a scoped agent correction remains.

Updated 2026-10-01: PR #749 supplies the independent implementation and automated proof; source pointers now name the shared controls. The issue stays open solely for the required physical-phone/live-agent receipt.

2026-10-01 triage: repaired all current form-limit environment references at 5df68f65a70236c9371565c2f3414cc53d2ad49e after the budget descriptors moved them. PR #749 remains delivered; the physical-phone/live-agent receipts are still missing, so needs: human remains.

2026-10-01 citation check at main 0a6389cf3f30341db7093e195637cf08a0f27e6a: refreshed the three named form-limit environment descriptors to lines 89–91. The delivered form implementation and required physical-phone/live-agent verification remain unchanged; needs: human stays.

Activity

  1. schlessera commented on Sep 29, 2026

    @schlessera
    OwnerAuthor

    Design needed: how a conditional, multi-level form reads and behaves inside one chat card on a phone.

    The contract uses flat nodes plus showIf, with hidden answers excluded from submission. The maintainer decided on 2026-09-29 that #583 and #584 stay standalone tools, ask_user is not folded in, and depth, node count and options per node are configurable with defaults assessed during implementation. What design must settle is the reveal: where a child node appears, how deep nesting stays readable at 320px, and what the user sees when changing a parent answer throws away child answers. The code cannot decide it.

    Read first
    - This issue (ask_user_form), plus #583 (scale node), #584 (rank node) and #541 (the "one exchange, one submit" lesson from multi-question ask_user).
    - packages/ui-sdk/src/tool-contracts/bridge.ts:55-77: today's ask_user question shape, which the single and multi nodes reuse.
    - packages/ui-kit/src/decisions/AskUserCard.tsx: the decision card's header, options, action row and answered state.
    - packages/ui-react/src/components/chat/ask-user-card.tsx:284: how ask_user is bound today (one card per question, the thing not to repeat).
    - docs/decisions/design-kit.md: D34 (hit targets), D36 (focus-scoped shortcuts, focus hand-off), D38 (decision-card rulings).
    
    The problem
    "What kind of evening?" Film shows a genre multi-select. Board game shows a ranking of candidate games. Walk shows a single choice of distance. The user answers film, picks two genres, then changes their mind to board game. The genres must vanish, the ranking must appear, and nothing about it may feel like a new dialog.
    
    Design (answer each)
    1. Placement of revealed nodes: inline under the selected option, indented as a section below the parent, or replacing the area below the parent?
    2. Nesting at 320px: how levels 2 and 3, and configured depths beyond 3, are distinguished without indentation eating the width. Three levels is an example, not a fixed cap. Defaults and configuration mechanism are assessed during implementation.
    3. Discarding answers: when a parent change hides answered children, is it silent, animated, undoable ("Genres cleared – undo"), or confirmed?
    4. Mixed kinds: how a single-select, a rank list and a scale list sit together in one card with a consistent rhythm. Reuse the standalone scale/rank row controls while removing their individual card headers and action rows; specify how node completion, progress and validation feed the outer form.
    5. Progress and required state: how "2 of 3 answered" works when the number of questions changes with every answer.
    6. Answered state: a compact summary of only the visible path (e.g. "Board game → 1. Azul 2. Patchwork").
    7. Focus and announcement: where focus goes when a node appears, and what a screen reader hears.
    
    Requirements to hold
    - One dialog header and one action row per exchange (#541). Submit is never a silent no-op.
    - D34 touch targets, 320px with no horizontal scroll, light and dark themes.
    - Revealed content never moves the control the user just tapped.
    - Hidden nodes' answers are never shown as submitted.
    - Keep `ask_user`, `ask_user_list` and `ask_user_rank` independently usable. Shared controls do not mean replacing their tools.
    - Measure per-tool and combined always-loaded schema cost; do not assume savings from removing standalone tools.
    - Do not change the flat-node contract. If the design needs a change, state it as a finding.
    
    Deliverable
    ASCII mocks at 320px and desktop for: the evening example in each of its three branches, the moment of switching from film to board game with genres already picked, a 3-level-deep path, a path beyond 3 levels under an increased configured cap, and the answered summary. Give a one-paragraph rationale per question.
    

    Updated 2026-09-29: brief aligned with the maintainer decision. The full design spec already incorporates the standalone-tool and configurable-limit decisions.

  2. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.
    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.
    area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.
    area: backendsAgentBackend implementations and the seam they share.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    needs: designBlocked on a design drop or a visual answer.
    on Sep 29, 2026
  3. schlessera commented on Sep 29, 2026

    @schlessera
    OwnerAuthor

    Decisions:

    Limits: maximum depth, node count and options per node, chosen against a measured schema cost (scripts/measure-show-block.ts --tokens): Provided as settings/config/env-variables (depending on what makes sense) and set to sane defaults that are assessed during implementation.

  4. removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Sep 29, 2026
  5. schlessera commented on Sep 29, 2026

    @schlessera
    OwnerAuthor

    Branching ask_user — one form, questions that follow answers (ask_user_form)

    "What kind of evening?" Each answer brings its own follow-up:

    • Film shows a genre multi-select.
    • Board game shows a ranking of candidate games.
    • Walk shows a single choice of distance.

    The user picks film and two genres, then changes their mind to board game.
    The genres must go, the ranking must appear, and none of it can feel like a
    new dialog.

    This card is the container for the other nodes: ask_user's single and
    multi questions, #583's scale list and #584's rank list, all in one card.
    It has one header, one action row and one Submit, and Submit never silently
    does nothing (#541).

    Sources read: ui-sdk/src/tool-contracts/bridge.ts:55-77 (question shape:
    question, header ≤12, options 2–4 {label, description, preview?},
    multiSelect, the automatic "Other"); AskUserCard.tsx (head, ChoiceOption
    rows, action row, answered wells); ask-user-card.tsx:284 (one card per
    question, which is exactly what not to repeat); design-kit.md D34, D35,
    D36 + addendum, D37 §6, D38 §1, §4, §10; docs/bulk-ask-user.md (#583);
    docs/rank-ask-user.md (#584).

    Contract (issue body, checked 2026-09-29): a flat nodes[] list.
    Each node has an id, a kind (single · multi · scale · rank ·
    text), a prompt, and its kind's fields. single and multi reuse
    bridge.ts:55-77. An optional showIf: {node, anyOf: [label…]} points
    only to earlier nodes. Required/optional is set per node, and depth and
    node count are capped. answers holds only the nodes visible at Submit,
    plus the list of visible nodes.

    Maintainer decisions (2026-09-29):

    In the text below, when means showIf and "option" means an anyOf
    label. §9 has the reconciliation.

    The rule behind it all: a branch is content below its parent's options,
    never inside them. The only thing that changes when you tap an option is
    what's below the whole option group. So the option you just tapped, and
    every option beside it, stays exactly where it was.


    1. Placement: one branch slot under the parent's whole option group

    Ruling: each node that has children owns one branch slot, directly
    after its last option (including "Other"). Whatever the current answer
    reveals is drawn there. Changing the answer replaces the slot's contents
    in place
    . The slot is not indented.

    Rationale. Inline under the selected option looks the most direct,
    but it breaks the rule the brief sets. Picking Film puts the genres between
    Film and Board game, which pushes Board game and Walk down under the thumb.
    Worse, switching from Film to Board game removes the genres, so Board game
    jumps up mid-tap, and the tap has to land on a moving target. An
    indented section
    is the same slot plus indentation, and §2 explains why
    indentation doesn't work at 320px. Replacing the area below the parent is
    the only one where every option in the group stays still: content only ever
    changes below the group. It also keeps the order of the form matching the
    order of the answers, which is what the answered summary reads back (§6).

    The slot animates its height over 180ms, instantly under
    prefers-reduced-motion. Content below the slot moves, and that content is
    always below the tap.

    Against the issue's wording. The issue says revealed nodes "nest
    visually under the answer that revealed them". Here they nest under the
    node that holds the answer, and the kicker names the answer
    (EVENING › BOARD GAME). Putting them directly under the option row is the
    layout that moves the tapped control, as described above. This is a reading
    of the wording, not a contract change.

    Slot order from a flat list. A node renders in the slot of the node its
    showIf points to, whatever its position in nodes[]. Within a slot,
    nodes keep their nodes[] order. anyOf with several labels just means one
    node can fill the slot for more than one answer. On a multi parent, a
    node shows while any picked label is in its anyOf. Two picks can
    open two nodes in the same slot, each with its own kicker naming the label
    that opened it.

    2. Nesting at 320px: a path kicker, not indentation

    Ruling: every revealed node starts with a kicker that names the
    path that brought it there, in mono 10.5px ink-mute, uppercase like the
    card's own head:

    EVENING › BOARD GAME                  ← level 2
    Rank the games you'd play
    
    EVENING › WALK › LONG                 ← level 3
    Which route?
    
    • The level is the length of the path. There's no indentation, and no
      coloured left bar (that's a slop trope, and a border breaks D34). Nodes
      are separated by a line hairline and 20px above.
    • At 320px the kicker wraps rather than truncating when it's too long. It
      names the record of how you got there. The depth cap is configurable, so
      past level 3 the kicker shows … › WALK › LONG, keeping the last two
      steps. The first crumb is always the … button, which lists the whole
      path. Because nothing is indented, the width budget is the same at any
      depth. The configured cap limits how long the kicker gets, not how
      narrow the controls get.
    • The kicker's crumbs are buttons. Tapping WALK moves focus to that
      node's options without scrolling the page. That's for a long form where
      the parent has scrolled away.

    Rationale. Indentation costs 16–24px per level. At level 3, #583's
    6-option grid would drop from 262px to about 214px, which is under D34's
    60px chip width. The kicker says why the node is there in words, which
    indentation never does, and it survives a monochrome screenshot.

    3. Discarding answers: set aside, undoable, never sent

    Ruling: when a parent change hides children that have answers, those
    answers are set aside, not deleted.

    1. The old branch collapses (180ms) and the new one opens in the same
      slot.
    2. An InlineToast sits at the top of the new branch, not above the
      action row, so it's next to the change: 2 genres set aside · Undo.
      Undo puts the parent back to Film, which brings the genres back.
    3. If the user switches back later by tapping Film, the set-aside answers
      come back on their own. The toast was a reminder, not the only way
      back.
    4. Set-aside answers are never shown as answered and never sent. They
      don't count in progress (§5), they aren't in the answered summary (§6),
      and the tool result drops them. Once the card is submitted they're gone.
    5. If the hidden branch had no answers, the switch is silent: no toast.

    Rationale. Silent loses work the user may want back. Confirmed is
    a second dialog inside the first, which is exactly the "new dialog" feeling
    the brief rules out, and it adds a tap to every change of mind. Animated
    only
    shows that something went but gives no way back. D38 §4 says no
    receipt without undo, so the toast carries Undo. Setting answers aside
    costs nothing to design, and it makes the mind-change the brief describes
    free to undo.

    4. Mixed kinds: one section rhythm, each kind keeps its own rows

    Every node is a section with the same parts, in the same order:

    KICKER (path, level ≥ 2)              mono 10.5 · ink-mute
    Question                              13/600 · wraps
    hint line (kind-specific, optional)   11 · ink-dim
    rows …                                min 44px each
    [branch slot]
    ──────── hairline, 20px ────────
    
    kind rows its hint line from
    single ChoiceOption rows (+ Other) none AskUserCard
    multi ChoiceOption rows with checks (+ Other) pick any AskUserCard
    scale #583 rows: label + chip grid 2 of 6 · Set the other 4 to … #583
    rank #584 rows: position · label · ⠿ drag ⠿ or tap, then tap where it goes #584
    text one kit composer-style input, 44px, grows to 3 lines the cap as 40 characters, counter in the last 10 kit input

    A text node can't be a showIf parent, and neither can scale or rank
    (F6).

    What each kind gives up inside a form:

    • scale: no sticky header of its own, since the card's header is the
      sticky one. Its counter and bulk-fill move into its hint line. Its own
      Submit and action row are gone.
    • rank: its own action row is gone. ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584's "Tap where Azul should go ·
      Cancel" hint moves into its hint line for the time a row is picked up. The
      card's Submit is aria-disabled during a move and reads Finish moving Azul, so a stray tap can't submit half a move.
    • single and multi keep the automatic "Other" (bridge.ts behaviour).
      Choosing Other reveals nothing, because a free-text answer has no branch.

    Rationale. The card's rhythm comes from the section frame, not from
    making the kinds look alike. A rank row that looked like a choice row would
    lie about what it does. Each kind keeps the anatomy it has on its own, so a
    rank list looks the same in a form as it does alone (#584's shared-anatomy
    goal). The frame gives every kind the same 20px break, the same question
    type and the same place for its hint.

    5. Progress: count what's left on the visible path, never a fraction

    Ruling: no N of M. The header shows 2 left (mono, right-aligned
    on the question line), and the action row's Submit uses the same number:

    state Submit
    every visible required node answered Submit
    gaps 2 left to answer, aria-disabled, tappable
    a rank row picked up Finish moving Azul, aria-disabled
    • What counts: nodes that are visible and required (per node, as in
      the issue) and have no answer. An optional node never counts, and its
      question carries optional in its hint line. A text node counts as
      answered once it has non-space text. For a scale node, one with an unanswered row counts as one
      node, not one per row. A rank node counts as answered from the start,
      since untouched means "Keep this order", as in ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584.
    • Tapping Submit while it's disabled flags every unanswered visible
      node, as in ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583 §4. Each one's question gets ! and needs an answer
      in red ink. Focus moves to the first one, and the live region says "2
      questions still need an answer. Moved to Genres." It never sends.
    • Why not a fraction: "2 of 3" becomes "2 of 4" when an answer opens a
      branch, so the denominator jumps and progress seems to go backwards on a
      correct answer. "Left" only ever counts down, except when a branch opens,
      and then the number goes up right next to the new question that caused
      it. Nothing appears to be lost.
    • The live region announces the count only when a branch changes it (§7)
      and on Submit.

    6. Answered state: only the visible path, read as a sentence

    ✓  ANSWERED
    What kind of evening?
    Board game → 1. Azul  2. Patchwork  3. Carcassonne
    
    • The answered well holds one line per answered node on the visible
      path
      , in form order. The path is joined with →, and each node's
      answer is drawn in its own kind's summary form:
    • A chain of single answers reads as one line:
      Walk → Long (8 km+) → Coast path.
    • Longer answers break to their own line under a mono kicker of the
      node's header, so a rank list or scale groups don't end up on a
      700-character line.
    • text: the text in quotes, wrapping.
    • A visible optional node left empty shows as Diet — skipped in
      ink-dim. It's the same distinction the contract's visible-nodes list
      gives the agent: "skipped" is shown, and "not shown" isn't.
    • Long forms (the node count is configurable): above 6 summary lines,
      the first 4 are shown, then ▸ 5 more answers. That's allowed under
      D38 §10 because the row opens the record.
    • Set-aside answers never appear here. Neither do nodes that were hidden
      at Submit.
    • Reload rebuilds this summary from answers alone. The hidden branches
      were never sent, so there's nothing hidden to leak.
    • typed / dismissed use the kit's existing states, with one "Ask again" per
      exchange.

    7. Focus and announcement

    • Pointer tap on a parent option: focus stays on that option, and
      nothing scrolls. The new branch opens below it, and its first rows are
      usually already on screen at 320px (the slot sits right after the group).
    • Keyboard pick (Space / Enter, or digits on a single node): focus
      also stays on the option. The issue requires that "focus does not
      jump when a node appears", and that wins over D36's hand-on, which is
      about resolved cards and not about nodes inside one. The branch is
      next in DOM order, so a single Tab reaches its first control. The
      announcement says so: "…Added: Rank the games you'd play. Tab to
      continue."
    • The live region (polite, one message per change):
      • opening: "Board game. Added: Rank the games you'd play. 1 left."
      • switching with answers set aside: "Board game. Genres removed, 2
        answers set aside, undo available. Added: Rank the games you'd play."
      • an Undo: "Back to Film. Genres restored, 2 picked."
      • a branch that adds nothing: silent apart from the option's own checked
        state.
    • Names: each section is a group labelled by its question and
      described by its kicker ("Evening, Board game"). Option, chip and rank
      names follow their own kinds (AskUserCard, ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583 §7, ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584 §8). Kicker
      crumbs are named "Go to Evening".
    • Keys are focus-scoped per node (D36). Digits pick an option in a
      single node, set a chip in a scale row, or place a row in a rank node.
      j / k move between rows inside a node. Moving between nodes is
      Tab / Shift+Tab. Hints print only under (any-pointer: fine), in the
      footer, for the focused node's kind.
    • After Submit, focus goes to the composer (D37 §6).

    8. Tokens and themes

    Everything comes from the kit (D39). The card, head, answered well and
    lapsed row are AskUserCard's. Section breaks use a line hairline, and
    kickers are ink-mute. Kicker crumbs use .bk-control:hover, underline on
    hover, and have reach to 44px tall, which is ≤ half the gap to the question
    below (D34). Flags use accent.red.ink. Set-aside answers leave nothing on
    screen, so there's nothing to fade (D35). Each kind brings its own tokens
    from #583 and #584. The same tokens cover light and dark.

    9. Contract: reconciliation and findings

    The design reads the flat nodes[] (id, kind, prompt, kind fields,
    showIf?, required/optional). It writes answers for visible nodes plus
    the visible-node list.

    Settled by the issue or the maintainer's decisions:

    Findings:

    10. Mocks

    320px mocks are 42 columns (about 288px of card). Desktop mocks are 86
    columns (a 640px card in the 720px transcript column). ◉ / ○ mark a
    single choice, ☑ / ☐ a multi choice. ┈ marks the branch slot's
    edges (not drawn in the UI).

    10.1 Branch: Film (genres, multi)

    320px

    ╭────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT       1 left │
    │ What kind of evening?                  │
    │ ┌────────────────────────────────────┐ │
    │ │ ◉ Film                             │ │ ← tapped; never moves
    │ │   something on the big screen      │ │
    │ ├────────────────────────────────────┤ │
    │ │ ○ Board game                       │ │
    │ │   at home, 2–4 players             │ │
    │ ├────────────────────────────────────┤ │
    │ │ ○ Walk                             │ │
    │ ├────────────────────────────────────┤ │
    │ │ ○ Other…                           │ │
    │ └────────────────────────────────────┘ │
    │┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈│ branch slot
    │ EVENING › FILM                         │
    │ Which genres?                          │
    │ pick any                               │
    │ ┌────────────────────────────────────┐ │
    │ │ ☐ Thriller                         │ │
    │ │ ☐ Comedy                           │ │
    │ │ ☐ Documentary                      │ │
    │ │ ☐ Other…                           │ │
    │ └────────────────────────────────────┘ │
    │┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈│
    │           Dismiss   1 left to answer   │
    ╰────────────────────────────────────────╯
    

    Desktop. The same column, as wide as the card allows. Descriptions sit
    on the same line.

    ╭────────────────────────────────────────────────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT                                                   1 left │
    │ What kind of evening?                                                              │
    │  ◉ Film          something on the big screen                                       │
    │  ○ Board game    at home, 2–4 players                                              │
    │  ○ Walk          out, before dark                                                  │
    │  ○ Other…                                                                          │
    │ ────────────────────────────────────────────────────────────────────────────────── │
    │ EVENING › FILM                                                                     │
    │ Which genres?                                                            pick any  │
    │  ☐ Thriller     ☐ Comedy     ☐ Documentary     ☐ Other…                            │ ← wraps as a grid ≥ 560px
    │                                                                                    │
    │ 1–4 pick · space toggle                        Dismiss    1 left to answer        │
    ╰────────────────────────────────────────────────────────────────────────────────────╯
    

    10.2 Branch: Board game (rank)

    320px

    ╭────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT              │
    │ What kind of evening?                  │
    │   ○ Film                               │
    │   ◉ Board game                         │
    │   ○ Walk                               │
    │   ○ Other…                             │
    │ ────────────────────────────────────── │
    │ EVENING › BOARD GAME                   │
    │ Rank the games you'd play              │
    │ drag ⠿ or tap, then tap where it goes  │
    │ 1  Azul                            ⠿   │
    │    30–45 min · 2–4 players             │
    │ 2  Patchwork                       ⠿   │
    │    30 min · 2 players                  │
    │ 3  Carcassonne                     ⠿   │
    │    35 min · 2–5 players                │
    │ 4  Codenames                       ⠿   │
    │                                        │
    │              Dismiss   Submit          │ ← rank counts as answered untouched
    ╰────────────────────────────────────────╯
    

    (Options are drawn compact here; they're the same rows as in 10.1.)

    Desktop

    │ What kind of evening?                                                              │
    │  ○ Film          something on the big screen                                       │
    │  ◉ Board game    at home, 2–4 players                                              │
    │  ○ Walk          out, before dark                                                  │
    │  ○ Other…                                                                          │
    │ ────────────────────────────────────────────────────────────────────────────────── │
    │ EVENING › BOARD GAME                                                               │
    │ Rank the games you'd play                  drag ⠿ or tap, then tap where it goes   │
    │ 1  Azul                        30–45 min · 2–4 players                          ⠿  │
    │ 2  Patchwork                   30 min · 2 players                               ⠿  │
    │ 3  Carcassonne                 35 min · 2–5 players                             ⠿  │
    │ 4  Codenames                   15 min · 4+ players                              ⠿  │
    │                                                                                    │
    │ space pick up · ↑↓ move · 1–4 place                    Dismiss    Submit          │
    

    10.3 Branch: Walk (distance, single)

    320px

    │   ○ Film                               │
    │   ○ Board game                         │
    │   ◉ Walk                               │
    │   ○ Other…                             │
    │ ────────────────────────────────────── │
    │ EVENING › WALK                         │
    │ How far?                               │
    │ ┌────────────────────────────────────┐ │
    │ │ ○ Short · under 3 km               │ │
    │ │ ○ Medium · 3–8 km                  │ │
    │ │ ○ Long · 8 km+                     │ │
    │ │ ○ Other…                           │ │
    │ └────────────────────────────────────┘ │
    │           Dismiss   1 left to answer   │
    

    Desktop

    │ EVENING › WALK                                                                     │
    │ How far?                                                                           │
    │  ○ Short         under 3 km, back in an hour                                       │
    │  ○ Medium        3–8 km                                                            │
    │  ○ Long          8 km+, needs daylight                                             │
    │  ○ Other…                                                                          │
    │ 1–4 pick                                               Dismiss   1 left to answer  │
    

    10.4 The switch: Film (2 genres picked) → Board game

    320px, before: Film with Thriller and Documentary checked.

    │   ◉ Film                               │
    │   ○ Board game                         │ ← thumb about to tap
    │   ○ Walk                               │
    │ ────────────────────────────────────── │
    │ EVENING › FILM                         │
    │ Which genres?                          │
    │   ☑ Thriller                           │
    │   ☐ Comedy                             │
    │   ☑ Documentary                        │
    │              Dismiss   Submit          │
    

    320px, 180ms later. Board game stayed put, and only the slot changed.

    │   ○ Film                               │
    │   ◉ Board game                         │ ← same y as before the tap
    │   ○ Walk                               │
    │ ────────────────────────────────────── │
    │ ┌────────────────────────────────────┐ │
    │ │ 2 genres set aside          Undo   │ │ ← InlineToast, top of the new branch
    │ └────────────────────────────────────┘ │
    │ EVENING › BOARD GAME                   │
    │ Rank the games you'd play              │
    │ drag ⠿ or tap, then tap where it goes  │
    │ 1  Azul                            ⠿   │
    │ 2  Patchwork                       ⠿   │
    │ …                                      │
    │              Dismiss   Submit          │
    ╰────────────────────────────────────────╯
     live: "Board game. Genres removed, 2 answers set aside, undo available.
            Added: Rank the games you'd play."
     Undo → Film re-selected, Thriller + Documentary checked again.
     Tapping Film later → same result, no toast needed.
     Submit now → answers = { evening: "Board game", games: [azul, patchwork, …] }; no genres.
    

    Desktop: the same moment.

    │  ○ Film          something on the big screen                                       │
    │  ◉ Board game    at home, 2–4 players                                              │
    │  ○ Walk          out, before dark                                                  │
    │ ────────────────────────────────────────────────────────────────────────────────── │
    │ ┌──────────────────────────────────────────────────────────────────────────────┐   │
    │ │ 2 genres set aside                                                     Undo  │   │
    │ └──────────────────────────────────────────────────────────────────────────────┘   │
    │ EVENING › BOARD GAME                                                               │
    │ Rank the games you'd play                  drag ⠿ or tap, then tap where it goes   │
    │ 1  Azul                        30–45 min · 2–4 players                          ⠿  │
    

    10.5 Three levels: Walk → Long → which route (a scale node)

    320px

    ╭────────────────────────────────────────╮
    │ ?  BRAIN NEEDS YOUR INPUT       1 left │
    │ What kind of evening?                  │
    │   ○ Film   ○ Board game   ◉ Walk   …   │ ← (compact; really one row each)
    │ ────────────────────────────────────── │
    │ EVENING › WALK                         │ ← level 2
    │ How far?                               │
    │   ○ Short · under 3 km                 │
    │   ○ Medium · 3–8 km                    │
    │   ◉ Long · 8 km+                       │
    │   ○ Other…                             │
    │ ────────────────────────────────────── │
    │ EVENING › WALK › LONG                  │ ← level 3: path, not indent
    │ How do these routes sound?             │
    │ 0 of 3 · Set all 3 to …                │ ← #583 hint line
    │ 01 Coast path to Cascais               │
    │    11 km · flat · komoot.com           │
    │  ┌──────────┐ ┌──────────┐ ┌──────────┐│
    │  │   keen   │ │  maybe   │ │   no     ││ ← full 262px track, no indent cost
    │  └──────────┘ └──────────┘ └──────────┘│
    │ 02 Sintra ridge loop                   │
    │    9 km · 420 m up                     │
    │  ┌──────────┐ ┌──────────┐ ┌──────────┐│
    │  │   keen   │ │  maybe   │ │   no     ││
    │  └──────────┘ └──────────┘ └──────────┘│
    │ 03 Tagus riverside                     │
    │    …                                   │
    │           Dismiss   1 left to answer   │
    ╰────────────────────────────────────────╯
    

    Desktop

    │ EVENING › WALK                                                                     │
    │ How far?                                                                           │
    │  ○ Short         under 3 km, back in an hour                                       │
    │  ○ Medium        3–8 km                                                            │
    │  ◉ Long          8 km+, needs daylight                                             │
    │ ────────────────────────────────────────────────────────────────────────────────── │
    │ EVENING › WALK › LONG                                                              │
    │ How do these routes sound?                           0 of 3 · Set all 3 to …       │
    │ 01 Coast path to Cascais     11 km · flat  komoot.com  [¹ keen ][² maybe ][³  no  ] │
    │ 02 Sintra ridge loop         9 km · 420 m up           [¹ keen ][² maybe ][³  no  ] │
    │ 03 Tagus riverside           10 km · flat              [¹ keen ][² maybe ][³  no  ] │
    │                                                                                    │
    │ 1–3 rate · j k move                                    Dismiss   1 left to answer  │
    

    10.6 Answered summaries

    Board game (320px)

    ╭────────────────────────────────────────╮
    │ ✓  ANSWERED                            │
    │ What kind of evening?                  │
    │ ┌────────────────────────────────────┐ │
    │ │ Board game → 1. Azul  2. Patchwork │ │
    │ │ 3. Carcassonne  4. Codenames       │ │ ← wraps; the order is the record
    │ │ you answered · 1m ago              │ │
    │ └────────────────────────────────────┘ │
    ╰────────────────────────────────────────╯
    

    Walk → Long → routes (320px): the chain on one line, then the scale
    groups under a kicker.

    │ ┌────────────────────────────────────┐ │
    │ │ Walk → Long · 8 km+                │ │
    │ │ ROUTES                             │ │
    │ │ keen (2)    Coast path to Cascais ·│ │
    │ │             Tagus riverside        │ │
    │ │ no (1)      Sintra ridge loop      │ │
    │ │ you answered · 1m ago              │ │
    │ └────────────────────────────────────┘ │
    

    Film (desktop)

    │ ┌────────────────────────────────────────────────────────────────────────────────┐ │
    │ │ Film → Thriller · Documentary                                                  │ │
    │ │ you answered · 1m ago                                                          │ │
    │ └────────────────────────────────────────────────────────────────────────────────┘ │
    

    After the §10.4 switch and Submit, the summary is the Board game one:
    no genres, anywhere.

    11. Acceptance criteria

    1. One header and one action row per exchange at any depth and any mix of kinds.
    2. Tapping any option leaves every option of that node at the same position, measured before and after (a test compares getBoundingClientRect().top).
    3. A node's branch renders in one slot after its whole option group, and a parent change replaces the slot's contents.
    4. Revealed nodes aren't indented, and each carries a path kicker. 320px shows no horizontal scroll at 3 levels with a 6-option scale.
    5. Hiding answered children sets their answers aside, shows N … set aside · Undo at the top of the new branch, and Undo restores the parent and children.
    6. Re-selecting the old parent option brings its set-aside answers back without a toast.
    7. Set-aside and hidden answers never count in progress, never appear in the answered summary, and are never in answers.
    8. The header shows N left for visible required unanswered nodes, and Submit reads N left to answer (aria-disabled) until N = 0.
    9. Tapping a disabled Submit flags, focuses and announces the first gap, and sends nothing.
    10. A rank node counts as answered untouched. While a rank row is picked up, Submit reads Finish moving {label}.
    11. Choosing Other on a node reveals no branch.
    12. A pick by pointer or keyboard keeps focus on the picked option. A revealed node never takes focus, and one Tab reaches its first control.
    13. Every branch change makes exactly one polite announcement naming what was added, removed and set aside.
    14. The answered summary shows only the visible path, chains single answers with →, and uses each kind's own summary form.
    15. Reload rebuilds the summary from answers alone.
    16. Every kind keeps its own row anatomy and accessible names from AskUserCard, ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583 and ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584.
    17. After Submit, focus goes to the composer.
    18. A text node renders as one input, counts as answered once it has non-space text, and can't be a parent.
    19. A visible optional node left empty shows as "skipped" in the summary, and a hidden node shows nowhere.
    20. Layout holds at the configured max depth and node count: no indentation, and the kicker shortens past level 3.

    12. Kit and story work

    • ui-kit/src/decisions/AskUserFormCard.tsx: the container. It owns the
      head, action row, answered well, left count, flags and branch slots.
      The node bodies are the existing pieces: ChoiceOption groups for
      single and multi, ui-sdk: a bulk ask_user — one scale applied to a list of items, answered in one card #583's and ui-sdk: an ask_user_rank tool — the user puts a list of items in order, by drag or without it #584's row lists without their own head
      and action row, and a kit input for text. Factor them as ScaleList /
      RankList, so the standalone ask_user_list / ask_user_rank cards
      (which stay tools of their own) and the form share one implementation.
    • Stories: FormFilm, FormBoardGame, FormWalk, FormSwitchSetAside
      (a play that checks two genres, switches, asserts the positions, the
      toast, Undo and answers), FormThreeLevels, FormAnswered (three
      paths), and FormFlagged. Each runs at 320 and wide, in both themes.
    • ui-react: one binding renders one card for one form. It must not map
      nodes to cards, which is the ask-user-card.tsx:284 pattern this
      replaces.
  6. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    and removed
    needs: designBlocked on a design drop or a visual answer.
    on Sep 29, 2026
  7. self-assigned this
    on Sep 30, 2026
  8. 5 remaining items

  9. schlessera commented on Sep 30, 2026

    @schlessera
    OwnerAuthor

    Dependency reconciliation: standalone ranking is on main through PR #721, squash 35fb78d4. The prior blocker was missing implementation; that prerequisite is satisfied, so the body is updated and blocked is removed while agent-ready is retained.

    #584 stays open for physical-device/live-agent verification. The available export is AskUserRankCard, a standalone card. The form design section 12 still calls for extracting ScaleList / RankList so the independent tools and embedded form share the same row behavior without nested headers or action rows. Preserve all node kinds and verify the configurable limits and remaining form criteria during its own work-issue readiness review.

  10. self-assigned this
    on Oct 1, 2026
  11. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    Claiming #585 for the conditional form tool and its shared scale/rank controls. Claim token: 585-form-01a0f248. Intended branch: feat/585-conditional-form-01a0f248. I will verify the full design, current source and contract prerequisites, then implement and test in a dedicated worktree.

  12. added
    contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.
    on Oct 1, 2026
  13. added
    needs: humanWaiting on an action only a human can perform. State the required action in the issue.
    and removed
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Oct 1, 2026
  14. removed their assignment
    on Oct 1, 2026
  15. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    Merged PR #749, squash 0c0c9dfb32f3167f773c2ae2603a4657443c004a, and verified that commit is on main.

    Final CI tested head 84b0e817 together with its current base: 8,036 unit tests passed, 45 skipped, zero failed across 518 files. Both browser shards, strict typecheck, packaging/consumer checks, contract, changeset, leakage and runtime probe passed. The PR records the restored behavioral mutation receipts and implemented schema-cost estimates. The separate existing lazy Files-tree test timing failure is recorded in #753; it was not folded into this feature.

    The body now contains the remaining physical-phone/live-agent check and exact sanitized completion evidence. The issue stays open with needs: human; agent-ready is removed and claim 585-form-01a0f248 is released. On a physical phone: Film → non-empty genres → Board game → confirm genres disappear → reorder games → Submit → confirm the reply uses only the ranking. Record device/browser, backend/package version, interaction results, visible-node/result shape and the reply's use of it. Close only after that required receipt exists.

  16. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    2026-10-01 triage: repaired all current form-limit environment references at 5df68f65a70236c9371565c2f3414cc53d2ad49e after the budget descriptors moved them. PR #749 remains delivered; the physical-phone/live-agent receipts are still missing, so needs: human remains.

  17. schlessera commented on Oct 1, 2026

    @schlessera
    OwnerAuthor

    2026-10-01 triage: verified and corrected the three form-limit environment descriptors to config/env.ts:89–91 at main 0a6389cf3f30341db7093e195637cf08a0f27e6a. Existing shared-control/card/schema anchors still match. No physical-phone/live-agent receipt is recorded; needs: human and the required handoff remain.

  18. schlessera commented on Oct 6, 2026

    @schlessera
    OwnerAuthor

    Physical-phone / live-agent receipt — 2026-10-07

    Run by the maintainer on an Android phone, installed PWA, Claude backend, release 0.40.0 (which contains #749).

    Step Result
    Agent asked to help choose tonight's activity with a form ask_user_form card shown
    Film selected, non-empty genres chosen pass
    Switched to Board game pass: the genre question disappeared
    Reordered the games pass: drag/reorder usable
    Branch Undo / reselection pass: Undo restores the last branch change. It is one step deep, which matches the shipped design (drafts retained for Undo of the replaced branch), not a multi-level history
    Submit pass
    Agent reply acted only on the game ranking; no genres

    Taps, reordering, Undo/reselection and Submit were all usable on the device. The required check is met; closing.

  19. removed
    needs: humanWaiting on an action only a human can perform. State the required action in the issue.
    on Oct 6, 2026
  20. added this to the 0.40.0 milestone on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: backendsAgentBackend implementations and the seam they share.area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.area: ui-reactReact chat/files/voice components, stores, WebSocket transport.area: ui-sdkWire protocol, runtime schemas, the server and client SDK surfaces.contractTouches the integration contract: CONTRACT: commit, contract doc updated in the same commit.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: featA new capability or a change in user-visible behaviour.

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions