Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(persona): redesign persona panel with guided builder and template picker

Steven Enamakelec69f95140f5
diff --git a/app/src/components/settings/panels/PersonaPanel.tsx b/app/src/components/settings/panels/PersonaPanel.tsx
index a002cfc21a..8f74fc429e 100644
--- a/app/src/components/settings/panels/PersonaPanel.tsx
+++ b/app/src/components/settings/panels/PersonaPanel.tsx
@@ -21,11 +21,9 @@ import {
import {
Alert,
AlertDescription,
- AvatarFallback,
- AvatarRoot,
Button,
Card,
- Label,
+ Field,
TextArea,
TextField,
ToggleGroupItem,
@@ -171,50 +169,44 @@ const PersonaPanel = ({ embedded = false }: PersonaPanelProps) => {
setSoulError(null);
};
- const initial = (nameDraft.trim() || 'A').charAt(0).toUpperCase();
-
const body = (
<>
- {/* ── Identity: who the assistant is, as shown in the app ───────── */}
+ {/* ── 1. Identity: how the assistant is shown in the app ──────────── */}
<Card
title={t('settings.persona.identityHeading')}
description={t('settings.persona.identityDesc')}>
- <div className="flex flex-col gap-4 p-4 sm:flex-row sm:items-start">
- <AvatarRoot className="h-14 w-14 shrink-0">
- <AvatarFallback className="bg-primary-100 text-xl font-semibold text-primary-700 dark:bg-primary-500/15 dark:text-primary-300">
- {initial}
- </AvatarFallback>
- </AvatarRoot>
- <div className="min-w-0 flex-1 space-y-3">
- <div>
- <Label htmlFor="persona-display-name">{t('settings.persona.displayNameLabel')}</Label>
- <TextField
- id="persona-display-name"
- aria-label={t('settings.persona.displayNameLabel')}
- data-testid="persona-display-name-input"
- value={nameDraft}
- maxLength={MAX_PERSONA_DISPLAY_NAME_LEN}
- placeholder={t('settings.persona.displayNamePlaceholder')}
- onChange={e => setNameDraft(e.target.value)}
- className="mt-1.5"
- />
- </div>
- <div>
- <Label htmlFor="persona-description">{t('settings.persona.descriptionLabel')}</Label>
- <TextArea
- id="persona-description"
- aria-label={t('settings.persona.descriptionLabel')}
- data-testid="persona-description-input"
- value={descriptionDraft}
- maxLength={MAX_PERSONA_DESCRIPTION_LEN}
- rows={2}
- placeholder={t('settings.persona.descriptionPlaceholder')}
- onChange={e => setDescriptionDraft(e.target.value)}
- className="mt-1.5 resize-none"
- />
- </div>
- </div>
- </div>
+ <Field
+ htmlFor="persona-display-name"
+ label={t('settings.persona.displayNameLabel')}
+ control={
+ <TextField
+ id="persona-display-name"
+ aria-label={t('settings.persona.displayNameLabel')}
+ data-testid="persona-display-name-input"
+ value={nameDraft}
+ maxLength={MAX_PERSONA_DISPLAY_NAME_LEN}
+ placeholder={t('settings.persona.displayNamePlaceholder')}
+ onChange={e => setNameDraft(e.target.value)}
+ className="w-72"
+ />
+ }
+ />
+ <Field
+ htmlFor="persona-description"
+ label={t('settings.persona.descriptionLabel')}
+ control={
+ <TextField
+ id="persona-description"
+ aria-label={t('settings.persona.descriptionLabel')}
+ data-testid="persona-description-input"
+ value={descriptionDraft}
+ maxLength={MAX_PERSONA_DESCRIPTION_LEN}
+ placeholder={t('settings.persona.descriptionPlaceholder')}
+ onChange={e => setDescriptionDraft(e.target.value)}
+ className="w-72"
+ />
+ }
+ />
</Card>
{soulLoading ? (
@@ -223,7 +215,7 @@ const PersonaPanel = ({ embedded = false }: PersonaPanelProps) => {
</Card>
) : (
<>
- {/* ── Templates: one click to a sensible starting point ──────── */}
+ {/* ── 2. Role: pick a template, or Custom once edited ───────────── */}
{soulMode === 'guided' && (
<Card
title={t('settings.persona.templates.heading')}
@@ -238,10 +230,14 @@ const PersonaPanel = ({ embedded = false }: PersonaPanelProps) => {
</Card>
)}
- {/* ── Character: the SOUL.md sections, as plain fields ────────── */}
+ {/* ── 3. Character: the SOUL.md sections, as plain fields ──────── */}
<Card
title={t('settings.persona.characterHeading')}
- description={t('settings.persona.characterDesc')}
+ description={
+ soulMode === 'guided'
+ ? t('settings.persona.builder.intro')
+ : t('settings.persona.characterDesc')
+ }
headerRight={
<ToggleGroupRoot
type="single"
diff --git a/app/src/components/settings/panels/persona/PersonaGuidedFields.tsx b/app/src/components/settings/panels/persona/PersonaGuidedFields.tsx
index b403ed80c3..c8a11b222f 100644
--- a/app/src/components/settings/panels/persona/PersonaGuidedFields.tsx
+++ b/app/src/components/settings/panels/persona/PersonaGuidedFields.tsx
@@ -14,6 +14,7 @@ interface PersonaGuidedFieldsProps {
interface FieldDef {
key: PersonaFieldKey;
labelKey: string;
+ helpKey: string;
placeholderKey: string;
testId: string;
}
@@ -22,18 +23,21 @@ const FIELDS: readonly FieldDef[] = [
{
key: 'personality',
labelKey: 'settings.persona.builder.personalityLabel',
+ helpKey: 'settings.persona.builder.personalityHelp',
placeholderKey: 'settings.persona.builder.personalityPlaceholder',
testId: 'persona-guided-personality',
},
{
key: 'voice',
labelKey: 'settings.persona.builder.voiceLabel',
+ helpKey: 'settings.persona.builder.voiceHelp',
placeholderKey: 'settings.persona.builder.voicePlaceholder',
testId: 'persona-guided-voice',
},
{
key: 'about',
labelKey: 'settings.persona.builder.aboutLabel',
+ helpKey: 'settings.persona.builder.aboutHelp',
placeholderKey: 'settings.persona.builder.aboutPlaceholder',
testId: 'persona-guided-about',
},
@@ -52,24 +56,21 @@ const PersonaGuidedFields = ({ value, onChange, disabled = false }: PersonaGuide
const fields = parsePersonaFields(value);
return (
- <div className="space-y-4">
- <p className="text-xs text-content-muted leading-relaxed">
- {t('settings.persona.builder.intro')}
- </p>
-
+ <div className="space-y-5">
{FIELDS.map(field => (
<div key={field.key}>
<Label htmlFor={field.testId}>{t(field.labelKey)}</Label>
+ <p className="mt-0.5 text-xs text-content-muted">{t(field.helpKey)}</p>
<TextArea
id={field.testId}
data-testid={field.testId}
aria-label={t(field.labelKey)}
value={fields[field.key]}
- rows={3}
+ rows={4}
disabled={disabled}
placeholder={t(field.placeholderKey)}
onChange={e => onChange(applyPersonaField(value, field.key, e.target.value))}
- className="mt-1.5"
+ className="mt-2"
/>
</div>
))}
diff --git a/app/src/components/settings/panels/persona/PersonaTemplatePicker.tsx b/app/src/components/settings/panels/persona/PersonaTemplatePicker.tsx
index 20f7405d14..8eedb2807c 100644
--- a/app/src/components/settings/panels/persona/PersonaTemplatePicker.tsx
+++ b/app/src/components/settings/panels/persona/PersonaTemplatePicker.tsx
@@ -1,6 +1,8 @@
+import { Check } from 'lucide-react';
+
+import { cn } from '../../../../lib/cn';
import { useT } from '../../../../lib/i18n/I18nContext';
-import Button from '../../../ui/Button';
-import { applyTemplate, PERSONA_TEMPLATES } from './personaTemplates';
+import { applyTemplate, matchTemplate, PERSONA_TEMPLATES } from './personaTemplates';
interface PersonaTemplatePickerProps {
/** Current raw SOUL.md text a template is spliced into. */
@@ -25,25 +27,67 @@ const PersonaTemplatePicker = ({
}: PersonaTemplatePickerProps) => {
const { t } = useT();
+ const active = matchTemplate(value);
+
+ const tileClass = (selected: boolean) =>
+ cn(
+ 'relative flex w-full flex-col items-start gap-0.5 rounded-lg border px-3 py-2.5 pr-8 text-left transition-colors',
+ 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500/25',
+ 'disabled:cursor-not-allowed disabled:opacity-50',
+ selected
+ ? 'border-primary-500 bg-primary-50 ring-1 ring-primary-500 dark:bg-primary-500/10'
+ : 'border-line hover:border-line-strong hover:bg-surface-hover'
+ );
+
+ const check = (
+ <Check className="absolute right-2.5 top-2.5 h-4 w-4 text-primary-500" aria-hidden />
+ );
+
+ // A radio group: exactly one role describes the current character — a
+ // template it still matches, or Custom once the user has edited away.
return (
- // Heading and description come from the host card.
- <div>
- <div className="grid grid-cols-2 gap-2 sm:grid-cols-3">
- {PERSONA_TEMPLATES.map(template => (
- <Button
+ <div
+ role="radiogroup"
+ aria-label={t('settings.persona.templates.heading')}
+ className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">
+ {PERSONA_TEMPLATES.map(template => {
+ const selected = active?.id === template.id;
+ return (
+ <button
key={template.id}
- variant="secondary"
+ type="button"
+ role="radio"
+ aria-checked={selected}
disabled={disabled}
data-testid={`persona-template-${template.id}`}
onClick={() => onChange(applyTemplate(value, template))}
- className="h-auto w-full flex-col items-start justify-start gap-0.5 rounded-lg border-line px-3 py-2 text-left hover:border-primary-400 hover:bg-surface-hover">
+ className={tileClass(selected)}>
+ {selected && check}
<span className="text-sm font-medium text-content">{t(template.labelKey)}</span>
- <span className="text-[11px] font-normal text-content-muted leading-snug">
+ <span className="text-xs text-content-muted leading-snug">
{t(template.descriptionKey)}
</span>
- </Button>
- ))}
- </div>
+ </button>
+ );
+ })}
+ {/* Custom is a state, not an action: it lights up when the fields no
+ longer match any template, and applies nothing when clicked. */}
+ <button
+ type="button"
+ role="radio"
+ aria-checked={active === null}
+ disabled={disabled}
+ data-testid="persona-template-custom"
+ onClick={() => undefined}
+ className={cn(tileClass(active === null), 'cursor-default')}>
+ {active === null && check}
+ <span className="text-sm font-medium text-content">
+ {t('settings.persona.templates.custom.label')}
+ </span>
+ <span className="text-xs text-content-muted leading-snug">
+ {t('settings.persona.templates.custom.desc')}
+ </span>
+ </button>
</div>
);
};
diff --git a/app/src/components/settings/panels/persona/personaTemplates.ts b/app/src/components/settings/panels/persona/personaTemplates.ts
index 2edef285d8..74c05b90cf 100644
--- a/app/src/components/settings/panels/persona/personaTemplates.ts
+++ b/app/src/components/settings/panels/persona/personaTemplates.ts
@@ -13,7 +13,7 @@
* default SOUL.md is English too), not UI chrome. Only the picker's labels and
* descriptions are localized.
*/
-import { applyPersonaField } from './personaSections';
+import { applyPersonaField, parsePersonaFields } from './personaSections';
interface PersonaTemplate {
id: string;
@@ -126,3 +126,19 @@ export function applyTemplate(soul: string, template: PersonaTemplate): string {
next = applyPersonaField(next, 'voice', template.fields.voice);
return next;
}
+
+/**
+ * The template whose Personality and Communication-style sections the given
+ * SOUL.md currently matches exactly, or `null` once the user has edited away
+ * from every template (the picker then shows "Custom" as selected).
+ */
+export function matchTemplate(soul: string): PersonaTemplate | null {
+ const fields = parsePersonaFields(soul);
+ return (
+ PERSONA_TEMPLATES.find(
+ template =>
+ fields.personality === template.fields.personality.trim() &&
+ fields.voice === template.fields.voice.trim()
+ ) ?? null
+ );
+}
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 4cf2ba6515..176c7ec747 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -6522,12 +6522,15 @@ const en: TranslationMap = {
'settings.persona.builder.intro':
'Fill in a few fields and we write them into your persona for you. No markdown required.',
'settings.persona.builder.personalityLabel': 'Personality',
+ 'settings.persona.builder.personalityHelp': 'Its character and values: how it behaves and what it prioritises.',
'settings.persona.builder.personalityPlaceholder':
'e.g. Warm, curious, and direct. Honest about uncertainty.',
'settings.persona.builder.voiceLabel': 'Communication style',
+ 'settings.persona.builder.voiceHelp': 'How it phrases answers: length, tone, formatting.',
'settings.persona.builder.voicePlaceholder':
'e.g. Lead with the answer, keep it brief, and match my tone.',
'settings.persona.builder.aboutLabel': 'About you',
+ 'settings.persona.builder.aboutHelp': 'Context about you it should keep in mind: your work, preferences, time zone.',
'settings.persona.builder.aboutPlaceholder':
'e.g. I run a small design studio and prefer plain language.',
'settings.persona.builder.preservedNote':
@@ -6535,6 +6538,8 @@ const en: TranslationMap = {
'settings.persona.builder.securityNote': 'Choosing what the assistant is allowed to do?',
'settings.persona.builder.securityLink': 'Open Agent access',
'settings.persona.templates.heading': 'Start from a template',
+ 'settings.persona.templates.custom.label': 'Custom',
+ 'settings.persona.templates.custom.desc': 'Your own mix: edit the fields below',
'settings.persona.templates.desc':
'Pick a starting point: it fills Personality and Communication style. You can edit everything afterwards.',
'settings.persona.templates.doctor.label': 'Clinical assistant',