[eric] agents: make tool-ui fire more (direct-call hint + exact component names in the nudge, slim ShowUI tool def ~2.1K tokens)

This commit is contained in:
ciregenz
2026-07-21 14:09:17 -07:00
parent cd6add56b1
commit 8735408c87
2 changed files with 15 additions and 8 deletions
@@ -98,13 +98,19 @@ def compose_turn_system_prompt(
if load_builtin_permissions().get("ShowUI", "always_allow") != "deny":
rich_ui_note = (
"<rich_ui>\n"
"Strongly prefer rendering rich UI over prose, every time the content fits:\n"
"- ShowUI for any structured result: tables, stats, links, plans, progress, code, diffs, "
"charts, maps, media, posts, receipts. Render the component, then add one line of text.\n"
"Strongly prefer rendering rich UI over prose, every time the content fits. The tools "
"are mcp__openswarm-ui__ShowUI and mcp__openswarm-ui__AskUI; they are always available "
"this session, so call them DIRECTLY by that name, no ToolSearch step needed.\n"
"- ShowUI for any structured result. Use the EXACT component name: a table = data-table, "
"stats = stats-display, links = link-preview, a plan = plan, steps = progress-tracker, "
"code = code-block, a diff = code-diff, a chart = chart, a map = geo-map, media = "
"image/image-gallery/video/audio, a social post = x-post/linkedin-post/instagram-post, "
"a receipt = order-summary. Render the component, then add one line of text.\n"
"- For multi-step work, render a progress-tracker FIRST and re-call ShowUI with the SAME "
"props.id after each step so the card advances live; same-id re-calls update in place.\n"
"- AskUI for ANY question with enumerable choices, an approval, or tunable values: render "
"it and wait for the answer instead of asking in prose. Flat choices = option-list; a "
"it (option-list, question-flow, parameter-slider, preferences-panel, approval-card) and "
"wait for the answer instead of asking in prose. Flat choices = option-list; a "
"multi-question form = one AskUI call per question in sequence. The user can always "
"answer off-list in free text (result action 'free_text').\n"
"Describing structured data in plain text when a component fits is the worse answer.\n"
+5 -4
View File
@@ -79,10 +79,11 @@ TOOLS = [
"name": "ShowUI",
"description": (
"Render a rich inline UI component in the chat instead of describing data as text. "
"Use it whenever a result fits one of the shapes. Supported components:\n"
+ "\n".join(f"- '{name}': {spec}" for name, spec in COMPONENT_SPECS.items())
+ "\nCall it with the component name and a props object matching that shape. "
"The component renders in place of raw text; still give a one-line text summary after. "
"Use it whenever a result fits a component. Components: "
+ ", ".join(COMPONENT_SPECS.keys())
+ ". Call it with the component name and a props object; if your props are off, the tool "
"returns that component's exact required shape so you can fix and re-call. The component "
"renders in place of raw text; still give a one-line text summary after. "
"LIVE UPDATES: calling ShowUI again with the SAME component and props.id updates that "
"card in place. Use this to advance progress-tracker/plan step statuses AS you complete "
"each step of real work, or to refresh data; never mint a new id for an update. Before "