Feature: Redesign agent creation form with sub-agent YAML abstraction and auto-growing textareas
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
descriptionin frontmatter - Hint: "Claude uses this to automatically decide when to invoke this sub-agent"
- This is the most important field
- Maps to
- Allowed Tools (multi-select checkboxes)
- Maps to
toolsfrontmatter field - Options:
Read,Write,Edit,Glob,Grep,Bash,WebFetch,WebSearch,Task - Default / empty state: "All tools (inherited)" — omits the field from frontmatter
- Maps to
- Model (dropdown)
- Maps to
modelfrontmatter field - Options:
inherit(default),sonnet,opus,haiku
- Maps to
- 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
onInputto setel.style.height = 'auto'thenel.style.height = el.scrollHeight + 'px' - Minimum height:
min-h-[80px] - Maximum height:
max-h-[400px]withoverflow-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}.mdYAML + 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
Estado al pausar sesión
COMPLETADO — implementado y verificado (196 tests pasando).
Lo que se hizo
AgentDraftinterface 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 necesitansub_agent_descriptionno 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.
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.