Skip to content
YuniqueUnicPublic

About

Interactive UI for AI agents — turn structured questions into browser forms.

Topics

Resources

Stars

27 stars

Watchers

0 watching

Forks

Repository files navigation

a2ui-ask

Interactive UI for AI agents — turn structured questions into browser forms.

Give your AI agent a real UI. When Claude Code, Codex, Cursor, or any other agent needs you to pick options or fill in structured config, a2ui-ask pops open a real browser form — with validation, defaults, and multi-select — instead of a wall of chat text. By default, your workspace keeps a timestamped copy of each question and answer for you and the agent to read again.

English | 中文文档

a2ui-ask form UI — schema navigation, form editor, and live JSON preview

Every control the engine can draw — sliders, range sliders with marks, segmented controls, radio groups, switches, a custom color picker, conditional fields — driven entirely by schema hints, and the skill tells the agent to reach for them. Figures ride the same hints: a question or an option can carry a Mermaid diagram, an inline SVG, or sanitised Markdown (x-content / x-options), and an answer can be a diagram via the live-preview x-control: "mermaid" editor. The full set lives in schemaui's controls gallery and rich-content gallery; examples/web-research-brief.schema.json is the worked example that uses every one of them (中文).

The control gallery: sliders, ranges, segmented, radio, color picker and more
Figure-bearing options: each deployment topology option ships its own Mermaid diagram
The mermaid editor: source on the left, live preview on the right

Why

Agent tool calls run in subprocesses with no TTY — a terminal prompt renders nowhere and the agent hangs on a question nobody can see. And answers shouted into chat scroll away and can't be audited.

a2ui-ask fixes both:

  1. Browser form, not terminal. The agent spawns a local Web UI (schemaui as the engine) bound to 0.0.0.0, reachable from your desktop, phone, SSH tunnel, or IDE port-forward.
  2. Workspace records. By default, schemaui archives the question and answer under a topic derived from the title or schema filename. Find the files with schemaui record-dir, or prefill a follow-up with --config record:<topic>. Choose --output - for stdout only. Set SCHEMAUI_HOME to choose the record root.
Agent process                     Your browser (any device)
┌──────────────┐                 ┌──────────────────┐
│ generates    │  1. spawn       │  desktop / phone │
│ schema       │───────────────► │  on the LAN      │
│              │  ask.py         │                  │
│ 2. tells you │                 │  http://<ip>     │
│ the URL in   │────────────────►│  :8787           │
│ chat         │                 │                  │
│              │  3. you fill in │  live validation │
│ 4. reads the │◄────────────────│  Save & Exit     │
│ answer file  │  answer saved   │                  │
│ 5. continues │                 │                  │
└──────────────┘                 └──────────────────┘

Install

Prerequisite: the schemaui binary (the form engine, YuniqueUnic/schemaui). The auto-installer detects your platform and grabs the prebuilt binary:

bash scripts/install.sh      # macOS / Linux / FreeBSD
pwsh scripts/install.ps1     # Windows / PowerShell 7+

It downloads from GitHub and falls back to the Gitee mirror when github.com is unreachable — the usual case from mainland China. Pin one side with --source github|gitee (sh) or -Source github|gitee (ps1):

bash scripts/install.sh --source gitee

Other channels (brew, scoop, winget, cargo, manual download): see install.md.

Then pick one way to install the skill:

Option 1 — one line (recommended, via skills.sh)

npx skills add YuniqueUnic/a2ui-ask

Option 2 — let your agent install it

Say to any agent (Claude Code / Codex / Cursor / …):

Please find and install the skill at https://github.com/YuniqueUnic/a2ui-ask — clone it into my skills directory and wire it up.

Option 3 — manual clone

# global (all projects)
git clone https://github.com/YuniqueUnic/a2ui-ask.git ~/.claude/skills/a2ui-ask
# or per-project
git clone https://github.com/YuniqueUnic/a2ui-ask.git .claude/skills/a2ui-ask

Option 4 — npm

The npm package ships the same skill files. Install it globally and link it into your skills directory; after that, npm update -g a2ui-ask upgrades the skill in place:

npm install -g a2ui-ask
mkdir -p ~/.claude/skills
ln -s "$(npm root -g)/a2ui-ask" ~/.claude/skills/a2ui-ask

Codex / zcode users: paste the ready-made block from prompts/ask.prompt.md into your AGENTS.md.

5-minute quickstart

From the skill directory (a clone or the npm package), with schemaui on your PATH:

python3 scripts/ask.py \
  --schema examples/env-schema.json \
  --config examples/env-defaults.json \
  --title "Deployment Config"
  1. The script prints SCHEMAUI_URL=http://127.0.0.1:8787/ and opens your browser.
  2. You edit the form (live validation) and click Save & Exit.
  3. The answer prints to stdout. SCHEMAUI_RESULT gives the saved answer's path.

Choose Exit without saving to leave your current edits behind. If you already clicked Save in this session, the script returns that saved answer. Otherwise it exits with code 130 and records nothing.

That's the whole loop. From now on your agent runs the same command whenever it needs a decision — you get a form instead of an interrogation.

Windows / PowerShell 7+: pwsh scripts/ask.ps1 -Schema … -Title …. macOS/Linux without Python: bash scripts/ask.sh --schema ….

What your agent does with it

  • Asks one form per cluster of decisions, with its recommended answer already filled in and written in your language.
  • Picks the control the answer deserves: sliders, two-handle ranges, colour pickers, segmented and radio choices, checkboxes, conditional fields, record lists and key/value maps.
  • Puts a diagram on each option when the options differ in shape, and lets you edit an answer that is itself a diagram.
  • Always leaves an other option with a free-text box, so you are never forced into a wrong choice.
  • If you leave without submitting, the agent asks in chat whether to continue. It fixes a rejected schema or config and retries. For other failures it asks the questions in plain text.

The agent-facing rules live in SKILL.md; the control catalogue in references/controls.md; the script contract, raw CLI and theming in references/engine.md.

Examples

Runnable forms in examples/ (each with recommended answers in the matching .defaults.json):

Example Scenario
env-schema.json minimal 4-field deploy form — first smoke test
web-research-brief.schema.json research: scope a web-research task — every control in the gallery (中文)
feature-brief.schema.json 12-question requirements brief using every control type (EN)
invoice-reimbursement.schema.json office: invoice & expense reimbursement (中文)
ecommerce-main-image.schema.json design: e-commerce hero images — sizes, fonts, colors, backgrounds (中文)
seo-diagnosis.schema.json SEO triage: site, issues, keywords, competitors (中文)
deployment-architecture.schema.json architecture choice: every option carries a diagram (中文 — the figures reference)

Development

# unit + e2e tests (e2e drives the real schemaui HTTP API, no browser needed)
SCHEMAUI_BIN=$(command -v schemaui) python3 -m pytest tests/
# PowerShell e2e runs when pwsh is on PATH (or PWSH_BIN is set)

Links

License

MIT — see LICENSE.

About

Interactive UI for AI agents — turn structured questions into browser forms.

Topics

Resources

Stars

27 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages