Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(cos): add dynamic avatar switching based on task context

Adam Eivy0674b868f70f
diff --git a/.changelog/v0.10.x.md b/.changelog/v0.10.x.md
index 3720b4c184..3846971488 100644
--- a/.changelog/v0.10.x.md
+++ b/.changelog/v0.10.x.md
@@ -35,6 +35,12 @@ This release introduces a structured changelog documentation system for creating
- **State-Reactive Visuals**: Core wireframes in investigation mode, increased distortion during thinking, shard orbit speed increases during coding/thinking states
- **Speaking Animation**: Core pulses rapidly when the agent is speaking
+### Chief of Staff - Dynamic Avatar Switching
+- **Dynamic Avatar Mode**: New toggle in CoS Config > Appearance that automatically switches the avatar style based on the active task's context
+- **Context-Aware Rules**: Avatar resolves based on priority order: provider (Codex → Esoteric, LM Studio/Gemini → Sigil), self-improvement type (security/code-quality → Cyberpunk), task type (internal → Sigil), and priority (CRITICAL → Esoteric)
+- **Seamless Transitions**: Avatar changes when an agent spawns and reverts to the configured default when the agent completes or CoS stops
+- **Provider ID in Metadata**: Agent metadata now includes `providerId` for accurate provider-based avatar resolution
+
### Dashboard - Activity Streak
- **Current Streak Display**: Shows consecutive days of activity with dynamic emoji (fire for 7+ days, lightning for 3+, sparkles for less)
- **Longest Streak Tracking**: Displays your personal best streak alongside current streak
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index efb6684c82..0c306419c3 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -147,3 +147,72 @@ export const formatInterval = (ms) => {
if (ms < 3600000) return `${ms / 60000}min`;
return `${ms / 3600000}hr`;
};
+
+// Avatar style labels for display
+export const AVATAR_STYLE_LABELS = {
+ svg: 'Digital (SVG)',
+ cyber: 'Cyberpunk (3D)',
+ sigil: 'Arcane Sigil (3D)',
+ esoteric: 'Esoteric (3D)',
+ ascii: 'Minimalist (ASCII)'
+};
+
+// Dynamic avatar rules - maps task context to avatar styles
+// Priority order: provider > selfImprovementType > taskType > priority > fallback
+const DYNAMIC_AVATAR_RULES = {
+ // Provider-based: different providers get distinct visual identities
+ provider: {
+ codex: 'esoteric', // OpenAI Codex → mystical/ancient aesthetic
+ 'lm-studio': 'sigil', // Local LM Studio → arcane/occult aesthetic
+ 'gemini-cli': 'sigil', // Gemini → arcane aesthetic
+ },
+ // Self-improvement task types → cyberpunk (system working on itself)
+ selfImprovementType: {
+ security: 'cyber',
+ 'code-quality': 'cyber',
+ 'test-coverage': 'cyber',
+ performance: 'cyber',
+ 'console-errors': 'cyber',
+ },
+ // Task analysis types
+ taskType: {
+ 'self-improve': 'cyber', // System self-improvement → cyberpunk
+ internal: 'sigil', // Internal CoS tasks → arcane
+ },
+ // Priority-based: critical tasks get a distinctive look
+ priority: {
+ CRITICAL: 'esoteric',
+ }
+};
+
+/**
+ * Resolve which avatar style to display based on active agent metadata.
+ * Returns null if no rule matches (caller should use configured default).
+ */
+export const resolveDynamicAvatar = (agentMetadata) => {
+ if (!agentMetadata) return null;
+
+ // Check provider rules first
+ const providerId = agentMetadata.providerId || agentMetadata.provider;
+ if (providerId && DYNAMIC_AVATAR_RULES.provider[providerId]) {
+ return DYNAMIC_AVATAR_RULES.provider[providerId];
+ }
+
+ // Check self-improvement type
+ if (agentMetadata.selfImprovementType &&
+ DYNAMIC_AVATAR_RULES.selfImprovementType[agentMetadata.selfImprovementType]) {
+ return DYNAMIC_AVATAR_RULES.selfImprovementType[agentMetadata.selfImprovementType];
+ }
+
+ // Check task type
+ if (agentMetadata.taskType && DYNAMIC_AVATAR_RULES.taskType[agentMetadata.taskType]) {
+ return DYNAMIC_AVATAR_RULES.taskType[agentMetadata.taskType];
+ }
+
+ // Check priority
+ if (agentMetadata.priority && DYNAMIC_AVATAR_RULES.priority[agentMetadata.priority]) {
+ return DYNAMIC_AVATAR_RULES.priority[agentMetadata.priority];
+ }
+
+ return null;
+};
diff --git a/client/src/components/cos/tabs/ConfigTab.jsx b/client/src/components/cos/tabs/ConfigTab.jsx
index 65a89da5c5..b6733eac74 100644
--- a/client/src/components/cos/tabs/ConfigTab.jsx
+++ b/client/src/components/cos/tabs/ConfigTab.jsx
@@ -3,7 +3,7 @@ import { Settings, Activity, CheckCircle, FileText } from 'lucide-react';
import toast from 'react-hot-toast';
import * as api from '../../../services/api';
import ConfigRow from './ConfigRow';
-import { AUTONOMY_LEVELS, detectAutonomyLevel, formatInterval } from '../constants';
+import { AUTONOMY_LEVELS, detectAutonomyLevel, formatInterval, AVATAR_STYLE_LABELS } from '../constants';
// Color classes for autonomy level buttons
const LEVEL_COLORS = {
@@ -313,29 +313,52 @@ export default function ConfigTab({ config, onUpdate, onEvaluate, avatarStyle, s
{/* Avatar Style */}
<div>
<h4 className="text-sm font-medium text-gray-400 mb-2">Appearance</h4>
- <div className="bg-port-card border border-port-border rounded-lg p-4">
+ <div className="bg-port-card border border-port-border rounded-lg p-4 space-y-4">
<div
className="flex items-center justify-between"
- title="Choose the visual style for the CoS avatar in the sidebar panel"
+ title="Choose the default visual style for the CoS avatar in the sidebar panel"
>
- <span className="text-gray-400 cursor-help">CoS Avatar Style</span>
+ <span className="text-gray-400 cursor-help">Default Avatar Style</span>
<select
value={avatarStyle}
onChange={async (e) => {
const style = e.target.value;
await setAvatarStyle(style);
- const labels = { svg: 'Digital', ascii: 'Minimalist', cyber: 'Cyberpunk 3D', sigil: 'Arcane Sigil 3D', esoteric: 'Esoteric (3D)' };
- toast.success(`Avatar style changed to ${labels[style] || style}`);
+ toast.success(`Avatar style changed to ${AVATAR_STYLE_LABELS[style] || style}`);
}}
className="bg-port-bg border border-port-border rounded px-3 py-1.5 text-white text-sm"
>
- <option value="svg">Digital (SVG)</option>
- <option value="cyber">Cyberpunk (3D)</option>
- <option value="sigil">Arcane Sigil (3D)</option>
- <option value="esoteric">Esoteric (3D)</option>
- <option value="ascii">Minimalist (ASCII)</option>
+ {Object.entries(AVATAR_STYLE_LABELS).map(([value, label]) => (
+ <option key={value} value={value}>{label}</option>
+ ))}
</select>
</div>
+ <div
+ className="flex items-center justify-between"
+ title="When enabled, the avatar style changes automatically based on the active task type, provider, or priority"
+ >
+ <div>
+ <span className="text-gray-400 cursor-help">Dynamic Avatar</span>
+ <p className="text-xs text-gray-600 mt-0.5">Auto-switch style based on task type, provider, or priority</p>
+ </div>
+ <button
+ onClick={async () => {
+ const newVal = !config?.dynamicAvatar;
+ await api.updateCosConfig({ dynamicAvatar: newVal });
+ toast.success(`Dynamic avatar ${newVal ? 'enabled' : 'disabled'}`);
+ onUpdate();
+ }}
+ className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
+ config?.dynamicAvatar ? 'bg-port-accent' : 'bg-port-border'
+ }`}
+ >
+ <span
+ className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
+ config?.dynamicAvatar ? 'translate-x-6' : 'translate-x-1'
+ }`}
+ />
+ </button>
+ </div>
</div>
</div>
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index 4088f29ee9..7179ed246c 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -30,6 +30,7 @@ import {
HealthTab,
ConfigTab
} from '../components/cos';
+import { resolveDynamicAvatar } from '../components/cos/constants';
export default function ChiefOfStaff() {
const { tab } = useParams();
@@ -50,10 +51,14 @@ export default function ChiefOfStaff() {
const [liveOutputs, setLiveOutputs] = useState({});
const [eventLogs, setEventLogs] = useState([]);
const [agentPanelCollapsed, setAgentPanelCollapsed] = useState(false);
+ const [activeAgentMeta, setActiveAgentMeta] = useState(null);
const socket = useSocket();
- // Derive avatar style from server config
- const avatarStyle = status?.config?.avatarStyle || 'svg';
+ // Derive avatar style from server config, with optional dynamic override
+ const configAvatarStyle = status?.config?.avatarStyle || 'svg';
+ const dynamicAvatarEnabled = status?.config?.dynamicAvatar || false;
+ const dynamicStyle = dynamicAvatarEnabled ? resolveDynamicAvatar(activeAgentMeta) : null;
+ const avatarStyle = dynamicStyle || configAvatarStyle;
// Update avatar style via server config
const setAvatarStyle = async (style) => {
@@ -105,6 +110,10 @@ export default function ChiefOfStaff() {
setAgentState(newState);
// Use default state message - real messages come from socket events
setStatusMessage(STATE_MESSAGES[newState]);
+
+ // Set active agent metadata for dynamic avatar (use first running agent)
+ const runningAgent = agentsData.find(a => a.status === 'running');
+ setActiveAgentMeta(runningAgent?.metadata || null);
}, [deriveAgentState]);
useEffect(() => {
@@ -133,6 +142,7 @@ export default function ChiefOfStaff() {
if (!data.running) {
setAgentState('sleeping');
setStatusMessage("Stopped - daemon not running");
+ setActiveAgentMeta(null);
}
});
@@ -148,6 +158,8 @@ export default function ChiefOfStaff() {
setStatusMessage(`Running: ${shortDesc}`);
setSpeaking(true);
setTimeout(() => setSpeaking(false), 2000);
+ // Track active agent metadata for dynamic avatar resolution
+ if (data?.metadata) setActiveAgentMeta(data.metadata);
// Initialize empty output buffer for new agent
if (data?.agentId || data?.id) {
setLiveOutputs(prev => ({ ...prev, [data.agentId || data.id]: [] }));
@@ -180,6 +192,8 @@ export default function ChiefOfStaff() {
setStatusMessage(success ? "Task completed successfully" : "Task failed - checking errors...");
setSpeaking(true);
setTimeout(() => setSpeaking(false), 2000);
+ // Clear active agent metadata so avatar reverts to default
+ setActiveAgentMeta(null);
fetchData();
});
@@ -562,7 +576,7 @@ export default function ChiefOfStaff() {
)}
{activeTab === 'config' && (
<div role="tabpanel" id="tabpanel-config" aria-labelledby="tab-config">
- <ConfigTab config={status?.config} onUpdate={fetchData} onEvaluate={handleForceEvaluate} avatarStyle={avatarStyle} setAvatarStyle={setAvatarStyle} evalCountdown={evalCountdown} />
+ <ConfigTab config={status?.config} onUpdate={fetchData} onEvaluate={handleForceEvaluate} avatarStyle={configAvatarStyle} setAvatarStyle={setAvatarStyle} evalCountdown={evalCountdown} />
</div>
)}
</div>
diff --git a/data.sample/cos/state.json b/data.sample/cos/state.json
index 91cebaae12..c68d6f3745 100644
--- a/data.sample/cos/state.json
+++ b/data.sample/cos/state.json
@@ -28,7 +28,8 @@
}
],
"autoStart": false,
- "selfImprovementEnabled": true
+ "selfImprovementEnabled": true,
+ "dynamicAvatar": false
},
"stats": {
"tasksCompleted": 0,
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.js
index c63136a4fd..0e0d22ad9b 100644
--- a/server/services/subAgentSpawner.js
+++ b/server/services/subAgentSpawner.js
@@ -1191,6 +1191,7 @@ export async function spawnAgentForTask(task) {
taskDescription: task.description,
taskType: task.taskType,
priority: task.priority,
+ providerId: provider.id,
model: selectedModel,
modelTier: modelSelection.tier,
modelReason: modelSelection.reason,