agent_crew icon indicating copy to clipboard operation
agent_crew copied to clipboard

Feature: Redesign agent creation form with sub-agent YAML abstraction and auto-growing textareas

Open sre-helmcode opened this issue 9 months ago • 2 comments

Context

The current TeamBuilder uses a single raw textarea for CLAUDE.md content for every agent. In the new architecture:

  • Leader agents keep a CLAUDE.md, but we abstract it into structured form sections
  • Non-leader agents are sub-agent files with YAML frontmatter — we expose the fields as proper UI inputs

Instead of asking users to write raw YAML or raw Markdown, the UI collects structured inputs and composes the files automatically at deploy time.

Design

Leader agent form

Replaces the single raw CLAUDE.md textarea with structured sections:

  • Role / Identity (auto-growing textarea) — who is this agent and what is its purpose?
  • Instructions (auto-growing textarea) — behavioral guidelines, workflows, constraints

These sections compose into a CLAUDE.md at deploy time.

Sub-agent form (non-leader agents)

Replaces the CLAUDE.md textarea with:

  • Name — existing text input (unchanged)
  • When should the leader delegate to this agent? (auto-growing textarea)
    • Maps to description in frontmatter
    • Hint: "Claude uses this to automatically decide when to invoke this sub-agent"
    • This is the most important field
  • Allowed Tools (multi-select checkboxes)
    • Maps to tools frontmatter field
    • Options: Read, Write, Edit, Glob, Grep, Bash, WebFetch, WebSearch, Task
    • Default / empty state: "All tools (inherited)" — omits the field from frontmatter
  • Model (dropdown)
    • Maps to model frontmatter field
    • Options: inherit (default), sonnet, opus, haiku
  • Instructions / System Prompt (auto-growing textarea)
    • The body of the sub-agent file (after frontmatter)
    • Hint: "Describe what this agent does and how it should behave"

Auto-growing textareas (all textareas in the form)

  • Use onInput to set el.style.height = 'auto' then el.style.height = el.scrollHeight + 'px'
  • Minimum height: min-h-[80px]
  • Maximum height: max-h-[400px] with overflow-y-auto
  • This applies to all textareas in the form (leader and sub-agent)

Step 3 (Review) update

  • Show a preview of the generated file content per agent:
    • Leader: preview of CLAUDE.md composed from sections
    • Sub-agent: preview of the .claude/agents/{name}.md YAML + body
  • Replace or supplement the existing JSON preview with this structured preview

Acceptance Criteria

  • [ ] Leader agent form shows Role and Instructions sections instead of a raw CLAUDE.md textarea
  • [ ] Sub-agent form shows: delegation description, tools multi-select, model dropdown, instructions textarea
  • [ ] All textareas auto-grow with content and scroll when reaching max height
  • [ ] Tools multi-select renders all available Claude Code tools; default is "all inherited"
  • [ ] Model dropdown has the correct 4 options
  • [ ] Step 3 preview shows the generated file content for each agent type
  • [ ] TypeScript compiles without errors (npm run build)
  • [ ] Unit tests updated for the new form structure
  • [ ] E2E test (Playwright): create a team with leader + 1 sub-agent, fill all fields, verify review step shows correct file content

sre-helmcode avatar Feb 21 '26 14:02 sre-helmcode

Estado al pausar sesión

COMPLETADO — implementado y verificado (196 tests pasando).

Lo que se hizo

  • AgentDraft interface actualizado con campos sub-agent
  • Formulario diferenciado: líder (textarea CLAUDE.md auto-growing) vs sub-agent (campos estructurados: Description, Tools, Model, Permission Mode)
  • Auto-growing textareas en todos los campos de texto largo
  • canProceed() actualizado: workers necesitan sub_agent_description no vacío
  • Preview en Step 3: líder muestra CLAUDE.md, sub-agents muestran YAML frontmatter generado
  • Submit payload usa los nuevos campos sub_agent_*
  • UI labels: 'Leader Agent' / 'Sub-Agent {i}', botón '+ Add Sub-Agent'
  • 33 tests (6 actualizados + 6 nuevos)

Pendiente

Review pipeline (DevOps build validation + QoS Playwright + Security audit) — a lanzar cuando todos los issues de backend estén completados.

sre-helmcode avatar Feb 21 '26 15:02 sre-helmcode

Implemented in 06ac288. TeamBuilderPage redesigned with differentiated forms for leader (CLAUDE.md textarea) vs sub-agents (structured fields: description, tools, model, permission mode selects). Step 3 shows YAML frontmatter preview for workers.

sre-helmcode avatar Feb 21 '26 19:02 sre-helmcode