Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

Group persona presets into Tech and Non-tech, add non-tech personas and avatars

Oleksandr Ivanchenko7281fd98274c
diff --git a/README.md b/README.md
index af7125ad..2508d349 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Kwants is a high-performance, self-hosted multi-agent AI platform packaged as a
- **Hybrid Driver Fleet**: Run direct cloud & local APIs (xAI Grok, Anthropic Claude, OpenAI, OpenRouter, local Ollama) or supervise host CLI agents (`claude`, `codex`, `grok` CLIs).
- **Kwant-to-Kwant Handoffs**: Every kwant knows its teammates in the current channel or team. When a reply @mentions a teammate (or `@everyone`), that teammate answers right after in the same chat, up to 4 handoffs per message.
- **Moderated Team Discussions**: When a team question needs several perspectives, the lead opens with a short take (or first asks you a clarifying question and waits), teammates respond to each other by name in under ~120 words or pass if they have nothing to add, and the lead closes with one summary. The back-and-forth folds into a collapsible "Team discussed" thread so the chat shows the answer.
-- **Persona Presets & Avatars**: Create agents from ten ready-made personas (Product, Designer, Frontend, Backend, QA, Security, SRE, Data, Writer, Research) or start blank, and pick from twelve pixel avatar styles. The chosen avatar always wins over hints in the agent's name.
+- **Persona Presets & Avatars**: Create agents from ready-made personas grouped into **Tech** (Product, Designer, Frontend, Backend, QA, Security, SRE, Data, Tech Writer) and **Non-tech** (Research, Marketing, Copywriter, Sales, Finance, Legal, Support, People, Coach, Tutor), or start blank, and pick from sixteen pixel avatar styles. The chosen avatar always wins over hints in the agent's name.
- **Editable Agents**: Hover any agent in the sidebar (team members or the Agent Fleet) and click the pencil, or use **Edit** in a direct chat header, to change its name, title, avatar, preferred model, or persona. Renames carry over to the agent's past messages.
- **Human-in-the-Loop Permission Broker**: Security-critical operations (shell execution, workspace file edits) require user approval via modern security cards: `[Allow Once]`, `[Always Allow]`, `[Deny]`.
- **Sleek Modern Grok Bot Interface**: Dark zinc aesthetics (`zinc-950`), clean typography (`Inter`, `JetBrains Mono`), collapsible reasoning disclosures (`Thought for Xs • Laya [Grok] • Low Effort`), role-based SVG/gradient avatars, and subtle modern micro-interaction click & completion sounds synthesized via the Web Audio API.
diff --git a/frontend/src/agentPresets.ts b/frontend/src/agentPresets.ts
index 9997d98e..7e34d99f 100644
--- a/frontend/src/agentPresets.ts
+++ b/frontend/src/agentPresets.ts
@@ -1,5 +1,13 @@
+export type PresetGroup = 'tech' | 'nontech';
+
+export const PRESET_GROUPS: Array<{ id: PresetGroup; label: string }> = [
+ { id: 'tech', label: 'Tech' },
+ { id: 'nontech', label: 'Non-tech' },
+];
+
export interface AgentPreset {
id: string;
+ group: PresetGroup;
/** Short label for the picker. */
label: string;
name: string;
@@ -13,6 +21,7 @@ export interface AgentPreset {
export const AGENT_PRESETS: AgentPreset[] = [
{
id: 'product',
+ group: 'tech',
label: 'Product',
name: 'ProductManager',
title: 'Product Manager',
@@ -23,6 +32,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'designer',
+ group: 'tech',
label: 'Designer',
name: 'Designer',
title: 'UX & Product Designer',
@@ -33,6 +43,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'frontend',
+ group: 'tech',
label: 'Frontend',
name: 'Frontend',
title: 'Frontend Engineer',
@@ -43,6 +54,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'backend',
+ group: 'tech',
label: 'Backend',
name: 'Backend',
title: 'Backend Engineer',
@@ -53,6 +65,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'qa',
+ group: 'tech',
label: 'QA',
name: 'QA',
title: 'QA & Test Engineer',
@@ -63,6 +76,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'security',
+ group: 'tech',
label: 'Security',
name: 'SecurityAuditor',
title: 'Security Auditor',
@@ -73,6 +87,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'sre',
+ group: 'tech',
label: 'SRE',
name: 'SRE',
title: 'Site Reliability Engineer',
@@ -83,6 +98,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'data',
+ group: 'tech',
label: 'Data',
name: 'DataAnalyst',
title: 'Data Analyst',
@@ -93,6 +109,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'writer',
+ group: 'tech',
label: 'Writer',
name: 'TechWriter',
title: 'Technical Writer',
@@ -103,6 +120,7 @@ export const AGENT_PRESETS: AgentPreset[] = [
},
{
id: 'research',
+ group: 'nontech',
label: 'Research',
name: 'Researcher',
title: 'Research Analyst',
@@ -111,6 +129,105 @@ export const AGENT_PRESETS: AgentPreset[] = [
persona_prompt:
'You are a Research Analyst. Investigate questions methodically: clarify what is being asked, compare the main options or sources, and separate established facts from opinions and guesses. Present findings as a short summary first, then supporting evidence with sources when available, and finish with a recommendation and how confident you are in it.',
},
+ {
+ id: 'marketing',
+ group: 'nontech',
+ label: 'Marketing',
+ name: 'Marketer',
+ title: 'Marketing Strategist',
+ avatar_sprite: 'marketing',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a Marketing Strategist. Start from the audience: who they are, what they care about, and where to reach them. Shape positioning and a clear value proposition, then propose campaigns, channels, and messaging with a simple way to measure results. Prefer specific, testable ideas over buzzwords, and point out when the budget or timeline does not match the goal.',
+ },
+ {
+ id: 'copywriter',
+ group: 'nontech',
+ label: 'Copywriter',
+ name: 'Copywriter',
+ title: 'Copywriter & Editor',
+ avatar_sprite: 'writer',
+ preferred_model: 'auto',
+ persona_prompt:
+ "You are a Copywriter and Editor. Write and polish emails, landing pages, posts, and announcements so they are clear, persuasive, and on-brand. Lead with the benefit, keep sentences short, and end with one clear call to action. When editing, keep the author's voice, fix structure before wording, and offer two or three alternatives for key headlines.",
+ },
+ {
+ id: 'sales',
+ group: 'nontech',
+ label: 'Sales',
+ name: 'SalesLead',
+ title: 'Sales Lead',
+ avatar_sprite: 'product',
+ preferred_model: 'auto',
+ persona_prompt:
+ "You are an experienced Sales Lead. Help qualify prospects, prepare for calls, handle objections, and write outreach that sounds human. Focus on the customer's problem and the business value, not features. Suggest concrete next steps and questions to ask, and be honest when a prospect is not a good fit.",
+ },
+ {
+ id: 'finance',
+ group: 'nontech',
+ label: 'Finance',
+ name: 'FinanceAnalyst',
+ title: 'Finance Analyst',
+ avatar_sprite: 'data',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a Finance Analyst. Build budgets, forecasts, pricing models, and unit economics, showing your assumptions and formulas so they can be checked. Highlight cash flow, margins, and the few numbers that drive the outcome, and run a quick best/worst case. You are not a licensed financial or tax advisor; say so when a decision needs one.',
+ },
+ {
+ id: 'legal',
+ group: 'nontech',
+ label: 'Legal',
+ name: 'LegalAdvisor',
+ title: 'Legal & Compliance Advisor',
+ avatar_sprite: 'legal',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a Legal and Compliance Advisor. Explain contracts, terms, privacy rules (such as GDPR), and licensing in plain language, flag risky clauses, and list questions to raise with the other party. Be precise about what depends on jurisdiction. You are not a lawyer and this is not legal advice; recommend a qualified lawyer for binding decisions.',
+ },
+ {
+ id: 'support',
+ group: 'nontech',
+ label: 'Support',
+ name: 'Support',
+ title: 'Customer Support Lead',
+ avatar_sprite: 'tech_lead',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a Customer Support Lead. Draft replies that are empathetic, clear, and solve the problem in as few steps as possible. Acknowledge the issue, give the fix or next step, and set expectations on timing. Spot recurring problems and suggest help-center articles, macros, or product fixes that would prevent them.',
+ },
+ {
+ id: 'hr',
+ group: 'nontech',
+ label: 'People',
+ name: 'PeopleOps',
+ title: 'People & Recruiting Partner',
+ avatar_sprite: 'coach',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a People and Recruiting Partner. Write fair, inclusive job descriptions, structured interview plans with scoring rubrics, onboarding checklists, and feedback that is specific and kind. Help managers handle difficult conversations with empathy and clarity. Flag anything that could be discriminatory or raise legal concerns.',
+ },
+ {
+ id: 'coach',
+ group: 'nontech',
+ label: 'Coach',
+ name: 'Coach',
+ title: 'Career & Productivity Coach',
+ avatar_sprite: 'coach',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a supportive Career and Productivity Coach. Ask a few good questions to understand the goal and what is in the way, then help break it into small, concrete next steps. Offer frameworks for prioritizing, planning, and giving feedback only when useful. Be encouraging but honest, and keep the person accountable to what they committed to.',
+ },
+ {
+ id: 'tutor',
+ group: 'nontech',
+ label: 'Tutor',
+ name: 'Tutor',
+ title: 'Patient Tutor',
+ avatar_sprite: 'teacher',
+ preferred_model: 'auto',
+ persona_prompt:
+ 'You are a patient Tutor who can teach any subject. First check what the learner already knows, then explain step by step with simple language, analogies, and worked examples. Ask short questions to check understanding instead of lecturing, and adapt when something does not click. Encourage the learner to try before revealing full answers.',
+ },
];
/** Picks the preset's name, or the first free numbered variant if it's taken. */
diff --git a/frontend/src/components/ModernAvatar.tsx b/frontend/src/components/ModernAvatar.tsx
index 556af12c..f20c972e 100644
--- a/frontend/src/components/ModernAvatar.tsx
+++ b/frontend/src/components/ModernAvatar.tsx
@@ -10,7 +10,8 @@ interface ModernAvatarProps {
type Accessory =
| 'antenna' | 'spikes' | 'ears' | 'horns' | 'sprout' | 'crown' | 'visor'
- | 'beret' | 'glasses' | 'goggles' | 'tie' | 'quill' | 'bulb' | 'none';
+ | 'beret' | 'glasses' | 'goggles' | 'tie' | 'quill' | 'bulb'
+ | 'mortarboard' | 'star' | 'bowtie' | 'cap' | 'none';
interface Creature {
body: string;
@@ -40,6 +41,10 @@ const PALETTES: Record<string, Omit<Creature, 'accessory'>> = {
gold: { body: '#f7c948', shade: '#c28a14', light: '#fff1b8', accent: '#e5484d' },
lilac: { body: '#d49cff', shade: '#9a5fd1', light: '#f1ddff', accent: '#f5f2ff' },
mint: { body: '#9be564', shade: '#5e9e33', light: '#e2ffc7', accent: '#ffe066' },
+ sky: { body: '#7cc8ff', shade: '#3f8fd1', light: '#d6efff', accent: '#4b44a6' },
+ magenta: { body: '#f06bd8', shade: '#b13a9c', light: '#ffd3f5', accent: '#ffd23f' },
+ slate: { body: '#a3aecf', shade: '#66719a', light: '#e3e8f7', accent: '#e5484d' },
+ amber: { body: '#ffb347', shade: '#c9771a', light: '#ffe2b8', accent: '#3c5fcf' },
};
/** Avatar styles an agent can pick; `avatar_sprite` stores the id. */
@@ -55,6 +60,10 @@ export const AVATAR_STYLES: Array<{ id: string; label: string }> = [
{ id: 'product', label: 'Product' },
{ id: 'writer', label: 'Writing' },
{ id: 'research', label: 'Research' },
+ { id: 'teacher', label: 'Teacher' },
+ { id: 'marketing', label: 'Marketing' },
+ { id: 'legal', label: 'Legal' },
+ { id: 'coach', label: 'Coach' },
{ id: 'default', label: 'Droid' },
];
@@ -73,6 +82,10 @@ const ROLE_CREATURES: Record<string, [keyof typeof PALETTES, Accessory]> = {
product: ['gold', 'tie'],
writer: ['lilac', 'quill'],
research: ['mint', 'bulb'],
+ teacher: ['sky', 'mortarboard'],
+ marketing: ['magenta', 'star'],
+ legal: ['slate', 'bowtie'],
+ coach: ['amber', 'cap'],
};
const hash = (s: string) => {
@@ -100,12 +113,17 @@ function pickCreature(role: string, name: string): Creature {
[['product', 'manager'], 'gold', 'tie'],
[['writer', 'docs'], 'lilac', 'quill'],
[['research', 'scientist'], 'mint', 'bulb'],
+ [['teacher', 'tutor'], 'sky', 'mortarboard'],
+ [['marketing'], 'magenta', 'star'],
+ [['legal', 'lawyer'], 'slate', 'bowtie'],
+ [['coach', 'mentor'], 'amber', 'cap'],
];
for (const [keys, palette, accessory] of rules) {
if (keys.some((k) => norm.includes(k))) return { ...PALETTES[palette], accessory };
}
// Unknown roles still get a stable, distinct creature per name
- const palettes = Object.keys(PALETTES);
+ // Fixed list so adding palettes never recolors existing agents
+ const palettes: Array<keyof typeof PALETTES> = ['yellow', 'green', 'pink', 'cyan', 'violet', 'orange', 'blue'];
const accessories: Accessory[] = ['antenna', 'spikes', 'ears', 'horns', 'sprout', 'antenna'];
const h = hash(name || role);
return {
@@ -163,6 +181,15 @@ function renderAccessory(c: Creature) {
px(12, 2, 2, 1, c.accent), px(11, 3, 4, 2, c.accent), px(12, 3, 1, 1, '#ffffff'),
px(12, 5, 2, 1, '#8a8aa8'), px(12, 6, 2, 1, INK),
];
+ case 'mortarboard':
+ return [px(8, 5, 10, 1, c.accent), px(10, 4, 6, 1, c.accent), px(12, 3, 2, 1, c.accent), px(10, 6, 6, 1, c.accent), px(17, 6, 1, 3, '#ffd23f')];
+ case 'star':
+ return [
+ px(13, 2, 1, 1, c.accent), px(12, 3, 3, 1, c.accent), px(11, 4, 5, 1, c.accent),
+ px(12, 5, 3, 1, c.accent), px(11, 6, 1, 1, c.accent), px(15, 6, 1, 1, c.accent), px(13, 3, 1, 1, '#ffffff'),
+ ];
+ case 'cap':
+ return [px(9, 5, 8, 2, c.accent), px(10, 4, 6, 1, c.accent), px(5, 6, 4, 1, c.accent), px(12, 4, 2, 1, '#ffffff')];
default:
return [];
}
@@ -181,6 +208,8 @@ function renderOverlay(c: Creature) {
px(7, 8, 12, 1, INK), px(9, 7, 3, 2, c.accent), px(14, 7, 3, 2, c.accent),
px(9, 7, 1, 1, '#ffffff'), px(14, 7, 1, 1, '#ffffff'),
];
+ case 'bowtie':
+ return [px(10, 16, 2, 2, c.accent), px(14, 16, 2, 2, c.accent), px(12, 16, 2, 1, '#a8323a'), px(12, 17, 2, 1, c.accent)];
case 'tie':
return [px(12, 16, 2, 1, c.accent), px(12, 17, 2, 1, c.accent), px(12, 18, 2, 1, '#a8323a')];
default:
diff --git a/frontend/src/components/NewAgentModal.tsx b/frontend/src/components/NewAgentModal.tsx
index ceec4254..bb8bc6c6 100644
--- a/frontend/src/components/NewAgentModal.tsx
+++ b/frontend/src/components/NewAgentModal.tsx
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { X, Sparkles, Pencil } from 'lucide-react';
import { ModernAvatar, AVATAR_STYLES } from './ModernAvatar';
-import { AGENT_PRESETS, AgentPreset, uniqueAgentName } from '../agentPresets';
+import { AGENT_PRESETS, AgentPreset, PRESET_GROUPS, PresetGroup, uniqueAgentName } from '../agentPresets';
import { playSfx } from '../audio/chiptune';
export interface AgentFormData {
@@ -46,6 +46,7 @@ export const NewAgentModal: React.FC<NewAgentModalProps> = ({
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
const [presetId, setPresetId] = useState<string | null>(null);
+ const [presetGroup, setPresetGroup] = useState<PresetGroup>('tech');
const isEdit = !!initial;
useEffect(() => {
@@ -131,9 +132,30 @@ export const NewAgentModal: React.FC<NewAgentModalProps> = ({
<form onSubmit={handleSubmit} className="space-y-4">
{!isEdit && (
<div>
- <label className="block text-xs font-medium text-zinc-400 mb-1">Start from a persona</label>
+ <div className="flex items-center justify-between mb-1.5">
+ <label className="text-xs font-medium text-zinc-400">Start from a persona</label>
+ <div className="flex p-0.5 rounded-lg bg-zinc-950 border border-zinc-800" role="tablist">
+ {PRESET_GROUPS.map((g) => (
+ <button
+ key={g.id}
+ type="button"
+ role="tab"
+ aria-selected={presetGroup === g.id}
+ onClick={() => {
+ playSfx('click');
+ setPresetGroup(g.id);
+ }}
+ className={`px-2.5 py-0.5 rounded-md text-[11px] font-medium transition-colors ${
+ presetGroup === g.id ? 'bg-sky-500/15 text-sky-200' : 'text-zinc-500 hover:text-zinc-300'
+ }`}
+ >
+ {g.label}
+ </button>
+ ))}
+ </div>
+ </div>
<div className="grid grid-cols-3 gap-1.5">
- {[null, ...AGENT_PRESETS].map((preset) => {
+ {[null, ...AGENT_PRESETS.filter((p) => p.group === presetGroup)].map((preset) => {
const active = (preset?.id ?? null) === presetId;
return (
<button
diff --git a/frontend/tests/agentPresets.test.mjs b/frontend/tests/agentPresets.test.mjs
index 03409644..2a7d06ba 100644
--- a/frontend/tests/agentPresets.test.mjs
+++ b/frontend/tests/agentPresets.test.mjs
@@ -22,9 +22,13 @@ test('picks a free name when the preset name is taken', () => {
test('presets have mentionable names, distinct ids and real avatar styles', async () => {
const avatarSource = await load('../src/components/ModernAvatar.tsx');
const styleIds = Array.from(avatarSource.matchAll(/\{ id: '([a-z_]+)', label:/g), (m) => m[1]);
- assert.ok(styleIds.length >= 12);
+ assert.ok(styleIds.length >= 16);
assert.equal(new Set(AGENT_PRESETS.map((p) => p.id)).size, AGENT_PRESETS.length);
+ for (const group of ['tech', 'nontech']) {
+ assert.ok(AGENT_PRESETS.filter((p) => p.group === group).length >= 5, `${group} group is too small`);
+ }
for (const p of AGENT_PRESETS) {
+ assert.ok(['tech', 'nontech'].includes(p.group), `${p.id} has unknown group ${p.group}`);
assert.match(p.name, /^[^\s@]+$/, p.name);
assert.ok(styleIds.includes(p.avatar_sprite), `${p.id} uses unknown avatar ${p.avatar_sprite}`);
assert.ok(p.persona_prompt.length > 100, `${p.id} persona is too thin`);