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 actionable insights banner for priority attention items

Adam Eivyf7860911d5b7
diff --git a/.changelog/v0.12.x.md b/.changelog/v0.12.x.md
index b54e94070a..4798706e11 100644
--- a/.changelog/v0.12.x.md
+++ b/.changelog/v0.12.x.md
@@ -237,3 +237,21 @@ This release adds branch management and automated release workflow capabilities
- `client/src/services/api.js` — Added `getCosBriefings()`, `getCosLatestBriefing()`, `getCosBriefing(date)` functions
- `client/src/components/Layout.jsx` — Added Briefing link to CoS sidebar navigation
- `client/src/pages/ChiefOfStaff.jsx` — Imported and rendered BriefingTab
+
+### CoS — Actionable Insights Banner
+- **Priority action surfacing**: New banner at the top of the Tasks tab that surfaces the single most important thing requiring user attention
+- **Multi-source intelligence**: Aggregates insights from pending approvals, blocked tasks, health issues, learning failures, and unread notifications
+- **Priority ranking**: Insights are sorted by priority (critical → high → medium → low → info), showing the most urgent item first
+- **One-click actions**: Each insight has a labeled action button that navigates directly to the relevant page to address the item
+- **Dismissible**: Insights can be dismissed for the session to focus on remaining items
+- **Compact design**: Gradient-styled banner with priority-based coloring (red pulse for critical, orange for high priority) that doesn't overwhelm the UI
+- **Remaining count**: Shows "+N more actions available" when multiple insights exist
+
+**Server changes**:
+- `server/routes/cos.js` — Added `GET /actionable-insights` endpoint that aggregates pending approvals, blocked tasks, health issues, learning failures, and notifications into prioritized actionable items
+
+**Client changes**:
+- `client/src/components/cos/ActionableInsightsBanner.jsx` — New component with priority-based styling, action buttons, dismiss functionality, and auto-refresh every 60 seconds
+- `client/src/components/cos/index.js` — Exported ActionableInsightsBanner component
+- `client/src/services/api.js` — Added `getCosActionableInsights()` API function
+- `client/src/pages/ChiefOfStaff.jsx` — Renders ActionableInsightsBanner above QuickSummary on the Tasks tab
diff --git a/client/src/components/cos/ActionableInsightsBanner.jsx b/client/src/components/cos/ActionableInsightsBanner.jsx
new file mode 100644
index 0000000000..960bddc000
--- /dev/null
+++ b/client/src/components/cos/ActionableInsightsBanner.jsx
@@ -0,0 +1,161 @@
+import { useState, useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
+import {
+ AlertCircle,
+ AlertTriangle,
+ XCircle,
+ Brain,
+ Newspaper,
+ ListTodo,
+ ChevronRight,
+ X,
+ Zap
+} from 'lucide-react';
+import * as api from '../../services/api';
+
+const ICON_MAP = {
+ AlertCircle,
+ AlertTriangle,
+ XCircle,
+ Brain,
+ Newspaper,
+ ListTodo
+};
+
+const PRIORITY_STYLES = {
+ critical: {
+ bg: 'bg-gradient-to-r from-port-error/20 to-port-error/5',
+ border: 'border-port-error/50',
+ iconColor: 'text-port-error',
+ pulse: true
+ },
+ high: {
+ bg: 'bg-gradient-to-r from-port-warning/20 to-port-warning/5',
+ border: 'border-port-warning/50',
+ iconColor: 'text-port-warning',
+ pulse: false
+ },
+ medium: {
+ bg: 'bg-gradient-to-r from-port-accent/15 to-port-accent/5',
+ border: 'border-port-accent/30',
+ iconColor: 'text-port-accent',
+ pulse: false
+ },
+ low: {
+ bg: 'bg-port-card',
+ border: 'border-port-border',
+ iconColor: 'text-gray-400',
+ pulse: false
+ },
+ info: {
+ bg: 'bg-port-card/50',
+ border: 'border-port-border/50',
+ iconColor: 'text-gray-500',
+ pulse: false
+ }
+};
+
+export default function ActionableInsightsBanner() {
+ const [data, setData] = useState(null);
+ const [dismissed, setDismissed] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const navigate = useNavigate();
+
+ useEffect(() => {
+ const loadInsights = async () => {
+ const result = await api.getCosActionableInsights().catch(() => null);
+ setData(result);
+ setLoading(false);
+ };
+
+ loadInsights();
+ // Refresh every 60 seconds
+ const interval = setInterval(loadInsights, 60000);
+ return () => clearInterval(interval);
+ }, []);
+
+ const handleDismiss = (type) => {
+ setDismissed(prev => [...prev, type]);
+ };
+
+ const handleAction = (route) => {
+ navigate(route);
+ };
+
+ if (loading || !data) {
+ return null;
+ }
+
+ // Filter out dismissed insights
+ const visibleInsights = data.insights.filter(i => !dismissed.includes(i.type));
+
+ // Don't render if no insights to show
+ if (visibleInsights.length === 0) {
+ return null;
+ }
+
+ // Show only the top insight if there are many
+ const primaryInsight = visibleInsights[0];
+ const remainingCount = visibleInsights.length - 1;
+
+ const styles = PRIORITY_STYLES[primaryInsight.priority] || PRIORITY_STYLES.info;
+ const Icon = ICON_MAP[primaryInsight.icon] || AlertCircle;
+
+ return (
+ <div className={`${styles.bg} border ${styles.border} rounded-lg p-3 mb-4 transition-all`}>
+ <div className="flex items-start gap-3">
+ {/* Icon */}
+ <div className={`shrink-0 mt-0.5 ${styles.iconColor} ${styles.pulse ? 'animate-pulse' : ''}`}>
+ <Icon size={18} />
+ </div>
+
+ {/* Content */}
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 flex-wrap">
+ <span className="font-medium text-white text-sm">
+ {primaryInsight.title}
+ </span>
+ {primaryInsight.priority === 'critical' && (
+ <span className="px-1.5 py-0.5 text-[10px] font-semibold bg-port-error/30 text-port-error rounded uppercase">
+ Urgent
+ </span>
+ )}
+ </div>
+ {primaryInsight.description && (
+ <p className="text-xs text-gray-400 mt-0.5 line-clamp-1">
+ {primaryInsight.description}
+ </p>
+ )}
+
+ {/* Additional insights indicator */}
+ {remainingCount > 0 && (
+ <div className="flex items-center gap-1 mt-1.5 text-xs text-gray-500">
+ <Zap size={10} />
+ <span>+{remainingCount} more action{remainingCount > 1 ? 's' : ''} available</span>
+ </div>
+ )}
+ </div>
+
+ {/* Actions */}
+ <div className="flex items-center gap-2 shrink-0">
+ {primaryInsight.action && (
+ <button
+ onClick={() => handleAction(primaryInsight.action.route)}
+ className="flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium bg-white/10 hover:bg-white/20 text-white rounded transition-colors min-h-[32px]"
+ >
+ {primaryInsight.action.label}
+ <ChevronRight size={12} />
+ </button>
+ )}
+ <button
+ onClick={() => handleDismiss(primaryInsight.type)}
+ className="p-1.5 text-gray-500 hover:text-gray-300 hover:bg-white/5 rounded transition-colors min-w-[32px] min-h-[32px] flex items-center justify-center"
+ title="Dismiss"
+ >
+ <X size={14} />
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/components/cos/index.js b/client/src/components/cos/index.js
index e2e940dfe4..e54910337e 100644
--- a/client/src/components/cos/index.js
+++ b/client/src/components/cos/index.js
@@ -18,6 +18,7 @@ export { default as StatCard } from './StatCard';
export { default as StatusBubble } from './StatusBubble';
export { default as EventLog } from './EventLog';
export { default as QuickSummary } from './QuickSummary';
+export { default as ActionableInsightsBanner } from './ActionableInsightsBanner';
// Tab Components
export { default as TasksTab } from './tabs/TasksTab';
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index 6e1e1e9d84..bd59d07b6b 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -21,6 +21,7 @@ import {
StatusBubble,
EventLog,
QuickSummary,
+ ActionableInsightsBanner,
TasksTab,
AgentsTab,
JobsTab,
@@ -568,6 +569,9 @@ export default function ChiefOfStaff() {
</button>
</div>
+ {/* Actionable Insights - priority items requiring attention */}
+ {activeTab === 'tasks' && <ActionableInsightsBanner />}
+
{/* Quick Summary - at-a-glance stats on tasks tab only */}
{activeTab === 'tasks' && <QuickSummary />}
diff --git a/client/src/services/api.js b/client/src/services/api.js
index e0d41f1a9e..14acb57132 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -531,6 +531,7 @@ export const getCosProductivity = () => request('/cos/productivity');
export const getCosProductivitySummary = () => request('/cos/productivity/summary');
export const recalculateCosProductivity = () => request('/cos/productivity/recalculate', { method: 'POST' });
export const getCosQuickSummary = () => request('/cos/quick-summary');
+export const getCosActionableInsights = () => request('/cos/actionable-insights');
// Task Schedule (Configurable Intervals)
export const getCosSchedule = () => request('/cos/schedule');
diff --git a/server/routes/cos.js b/server/routes/cos.js
index c6297d28ac..a66ba411be 100644
--- a/server/routes/cos.js
+++ b/server/routes/cos.js
@@ -878,6 +878,119 @@ router.post('/productivity/recalculate', asyncHandler(async (req, res) => {
res.json({ success: true, data });
}));
+// GET /api/cos/actionable-insights - Get prioritized action items requiring user attention
+// Surfaces the most important things to address right now across all CoS subsystems
+router.get('/actionable-insights', asyncHandler(async (req, res) => {
+ const [tasksData, learningSummary, healthCheck, notificationsModule] = await Promise.all([
+ cos.getAllTasks().catch(() => ({ user: null, cos: null })),
+ taskLearning.getLearningInsights().catch(() => null),
+ cos.runHealthCheck().catch(() => ({ issues: [] })),
+ import('../services/notifications.js')
+ ]);
+
+ const notificationsData = await notificationsModule.getNotifications({ unreadOnly: true, limit: 10 }).catch(() => []);
+
+ const insights = [];
+
+ // 1. Pending approvals (highest priority)
+ const pendingApprovals = tasksData.cos?.awaitingApproval || [];
+ if (pendingApprovals.length > 0) {
+ insights.push({
+ type: 'approval',
+ priority: 'high',
+ icon: 'AlertCircle',
+ title: `${pendingApprovals.length} task${pendingApprovals.length > 1 ? 's' : ''} awaiting approval`,
+ description: pendingApprovals[0]?.description?.substring(0, 80) + (pendingApprovals[0]?.description?.length > 80 ? '...' : ''),
+ action: { label: 'Review', route: '/cos/tasks' },
+ count: pendingApprovals.length
+ });
+ }
+
+ // 2. Blocked tasks
+ const blockedUser = tasksData.user?.grouped?.blocked || [];
+ const blockedCos = tasksData.cos?.grouped?.blocked || [];
+ const blockedCount = blockedUser.length + blockedCos.length;
+ if (blockedCount > 0) {
+ const firstBlocked = blockedUser[0] || blockedCos[0];
+ insights.push({
+ type: 'blocked',
+ priority: 'high',
+ icon: 'XCircle',
+ title: `${blockedCount} blocked task${blockedCount > 1 ? 's' : ''}`,
+ description: firstBlocked?.metadata?.blocker || firstBlocked?.description?.substring(0, 80),
+ action: { label: 'Unblock', route: '/cos/tasks' },
+ count: blockedCount
+ });
+ }
+
+ // 3. Health issues
+ const healthIssues = healthCheck?.issues || [];
+ if (healthIssues.length > 0) {
+ const criticalIssues = healthIssues.filter(i => i.severity === 'critical');
+ insights.push({
+ type: 'health',
+ priority: criticalIssues.length > 0 ? 'critical' : 'medium',
+ icon: 'AlertTriangle',
+ title: `${healthIssues.length} system health issue${healthIssues.length > 1 ? 's' : ''}`,
+ description: healthIssues[0]?.message,
+ action: { label: 'Check Health', route: '/cos/health' },
+ count: healthIssues.length
+ });
+ }
+
+ // 4. Learning failures (skipped task types)
+ const skippedTypes = learningSummary?.skippedTypes || [];
+ if (skippedTypes.length > 0) {
+ insights.push({
+ type: 'learning',
+ priority: 'low',
+ icon: 'Brain',
+ title: `${skippedTypes.length} task type${skippedTypes.length > 1 ? 's' : ''} auto-skipped`,
+ description: `Due to low success rates: ${skippedTypes.slice(0, 2).map(t => t.type).join(', ')}`,
+ action: { label: 'View Learning', route: '/cos/learning' },
+ count: skippedTypes.length
+ });
+ }
+
+ // 5. Unread notifications (briefings, reviews, etc.)
+ const briefingNotifs = notificationsData.filter(n => n.type === 'briefing_ready');
+ if (briefingNotifs.length > 0) {
+ insights.push({
+ type: 'briefing',
+ priority: 'low',
+ icon: 'Newspaper',
+ title: 'New briefing available',
+ description: 'Your daily briefing is ready for review',
+ action: { label: 'Read Briefing', route: '/cos/briefing' },
+ count: 1
+ });
+ }
+
+ // 6. Pending user tasks (informational)
+ const pendingUserTasks = tasksData.user?.grouped?.pending || [];
+ if (pendingUserTasks.length > 0 && insights.length < 4) {
+ insights.push({
+ type: 'tasks',
+ priority: 'info',
+ icon: 'ListTodo',
+ title: `${pendingUserTasks.length} pending task${pendingUserTasks.length > 1 ? 's' : ''}`,
+ description: pendingUserTasks[0]?.description?.substring(0, 80),
+ action: { label: 'View Tasks', route: '/cos/tasks' },
+ count: pendingUserTasks.length
+ });
+ }
+
+ // Sort by priority
+ const priorityOrder = { critical: 0, high: 1, medium: 2, low: 3, info: 4 };
+ insights.sort((a, b) => (priorityOrder[a.priority] || 5) - (priorityOrder[b.priority] || 5));
+
+ res.json({
+ insights: insights.slice(0, 5), // Max 5 insights
+ hasActionableItems: insights.some(i => ['critical', 'high'].includes(i.priority)),
+ totalCount: insights.length
+ });
+}));
+
// GET /api/cos/quick-summary - Get at-a-glance dashboard summary
// Combines today's activity, streak status, next job, and pending approvals into one efficient call
router.get('/quick-summary', asyncHandler(async (req, res) => {