Skip to content

Skill Builder (UI/TUI): adopt conversational interview + convergence architecture and structured-JSON output #252

Description

@initializ-mk

Summary

Adopt a conversational interview + convergence architecture (and structured-JSON output) in the Forge UI/TUI Skill Builder, aligning it with the interview-style skill builder being built on the platform so the two don't drift.

Current state

The UI Skill Builder is already multi-turn — handleSkillBuilderChat passes the full req.Messages history to the LLM with skillBuilderSystemPrompt(mode, existing) (forge-ui/handlers_skill_builder.go:185, forge-ui/skill_builder_context.go). So the chat plumbing exists. What's missing is in the prompt:

  1. No convergence discipline. skillBuilderPromptBase says "ask clarifying questions about requirements, security, and integration" but sets no ceiling — nothing stops it from over-asking, asking multiple questions at once, or re-asking something already answered. A stuck/looping interview is the main UX failure mode for a chat builder.
  2. Fragile output format. It emits the SKILL.md (and scripts) inside nested quadruple-backtick fences (````skill.md). LLMs frequently mis-nest these, and the UI has to parse them out. A structured JSON envelope ({message, skill}) is far more robust to consume.
  3. No custom-binary install recipes. The prompt can declare requires.bins but has no way to describe how to install a binary the base image lacks (apt/apk package, or download URL + dest + chmod).

The platform builder adds exactly these three (converge-quickly rules, a {message, skill} JSON shape, bins with install recipes). We should bring them into the Forge UI builder too.

Proposal

  • Convergence rules in the prompt: read the whole conversation before replying; never re-ask an answered question; ask at most one blocking question per turn; the moment task + credential + tool are known, stop asking and return the full skill; prefer a sensible default (noted in the description) over a question.
  • Structured output: return { "message": "<question or summary>", "skill": null | {…} } instead of markdown fences. skill: null while still interviewing; the full object once draftable. The UI renders message as chat and skill as the editor preview.
  • Custom-binary install recipes in the bins field: {name} for a base-image/auto-installed tool, or {name, apt} / {name, url, dest, chmod} for a custom one.

Keep the Forge-correctness rules the platform prompt is missing

When porting the interview architecture, do NOT drop the Forge-runtime rules the current TUI prompt already gets right (the platform draft omits several of these — see review notes):

Shared spec to avoid drift

Since the platform and the Forge UI builder now target the same SKILL.md contract, consider a single source-of-truth prompt/spec (or a shared skill JSON schema) consumed by both, so a change to the SKILL.md format updates both builders at once rather than diverging.

Acceptance criteria

  • UI builder prompt enforces the convergence rules (one-question-max, no re-asking, draft-when-sufficient) — verified with a multi-turn test that it drafts without looping.
  • Output is a structured {message, skill} envelope; the handler/UI consumes it instead of fence-parsing.
  • bins supports custom install recipes (apt / url+dest+chmod).
  • Per-tool {input, output, examples} captured so compiled ## Tool: sections are complete.
  • All existing Forge-correctness rules retained ($1 input, JSON output, .sh/python-via-bash, denied_tools, safety, edit-mode tool-name preservation).
  • Docs updated (docs/ui/skill-builder-llm.md).

Context

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions