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(dashboard): add Upcoming Tasks widget with schedule preview

Adam Eivy0eabe66f265e
diff --git a/.changelog/v0.13.x.md b/.changelog/v0.13.x.md
index 19a2f33d5e..2da4582cc7 100644
--- a/.changelog/v0.13.x.md
+++ b/.changelog/v0.13.x.md
@@ -99,6 +99,15 @@ This release expands the genome dashboard with comprehensive cancer predispositi
- **Explore script integration** — before each auto-generated action, the script checks the queue for manually-scheduled items and executes them first, respecting rate limits
- **Queue API endpoints**: `GET /queue/:agentId`, `POST /queue`, `DELETE /queue/:id`, `POST /queue/:id/complete`, `POST /queue/:id/fail`
+### Dashboard — Upcoming Tasks Preview Widget
+- **New UpcomingTasksWidget** on the main dashboard — shows what tasks the CoS will work on next, providing visibility into the autonomous schedule
+- **Ready vs scheduled distinction** — tasks ready to run now highlighted in green, scheduled tasks show countdown timer until eligible
+- **Learning-adjusted indicators** — tasks with performance-adjusted intervals show trend arrows (up for high-success fast-tracked tasks, down for struggling tasks with extended cooldowns)
+- **Task metadata** — each row shows task icon, description, interval type (daily/weekly/rotation), last run time, and success rate when available
+- **New API endpoint** `GET /api/cos/upcoming` returns upcoming tasks sorted by eligibility time with timing info
+- **Service function `getUpcomingTasks()`** in taskSchedule.js calculates eligibility, formats timing, and respects learning-based interval adjustments
+- Addresses user preference for "quick visual summaries" and helps understand CoS behavior
+
### Digital Twin — Aesthetic Taste Prompting Spec (brain idea 608dc733)
- **Promoted brain idea 608dc733** ("Prompting Aesthetic Taste Docs via Digital Twin") from dormant idea to concrete P2.5 spec in PLAN.md under M42: Unified Digital Twin Identity System
- **Defined 7 aesthetic domains** for taste capture: movies, music, visual art, architecture, food, plus 2 new domains (fashion/texture and digital/interface aesthetics)
diff --git a/client/src/components/UpcomingTasksWidget.jsx b/client/src/components/UpcomingTasksWidget.jsx
new file mode 100644
index 0000000000..a38065c03b
--- /dev/null
+++ b/client/src/components/UpcomingTasksWidget.jsx
@@ -0,0 +1,222 @@
+import { useState, useEffect, memo } from 'react';
+import { Link } from 'react-router-dom';
+import {
+ Clock,
+ ChevronRight,
+ CheckCircle,
+ Timer,
+ TrendingUp,
+ TrendingDown,
+ Sparkles
+} from 'lucide-react';
+import * as api from '../services/api';
+
+/**
+ * UpcomingTasksWidget - Shows a preview of upcoming scheduled tasks
+ * Helps users understand what the CoS will work on next
+ */
+const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {
+ const [upcoming, setUpcoming] = useState([]);
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ const loadData = async () => {
+ const data = await api.getCosUpcomingTasks(6).catch(() => []);
+ setUpcoming(data);
+ setLoading(false);
+ };
+
+ loadData();
+ // Refresh every 60 seconds
+ const interval = setInterval(loadData, 60000);
+ return () => clearInterval(interval);
+ }, []);
+
+ // Don't render while loading or if no upcoming tasks
+ if (loading || !upcoming.length) {
+ return null;
+ }
+
+ // Separate ready tasks from scheduled ones
+ const readyTasks = upcoming.filter(t => t.status === 'ready');
+ const scheduledTasks = upcoming.filter(t => t.status === 'scheduled');
+
+ // Get interval type label
+ const getIntervalLabel = (intervalType) => {
+ const labels = {
+ daily: 'Daily',
+ weekly: 'Weekly',
+ rotation: 'Rotation',
+ once: 'One-time',
+ custom: 'Custom'
+ };
+ return labels[intervalType] || intervalType;
+ };
+
+ // Get icon for task based on type
+ const getTaskIcon = (taskType) => {
+ const icons = {
+ 'security': '🔒',
+ 'ui-bugs': '🐛',
+ 'mobile-responsive': '📱',
+ 'code-quality': '✨',
+ 'console-errors': '🔧',
+ 'performance': '⚡',
+ 'cos-enhancement': '🤖',
+ 'test-coverage': '🧪',
+ 'documentation': '📝',
+ 'feature-ideas': '💡',
+ 'accessibility': '♿',
+ 'dependency-updates': '📦'
+ };
+ return icons[taskType] || '📋';
+ };
+
+ return (
+ <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">
+ {/* Header */}
+ <div className="flex items-center justify-between mb-4">
+ <div className="flex items-center gap-3">
+ <div className="text-2xl" aria-hidden="true">
+ <Clock className="w-6 h-6 text-port-accent" />
+ </div>
+ <div>
+ <h3 className="text-lg font-semibold text-white">Upcoming Tasks</h3>
+ <p className="text-sm text-gray-500">
+ {readyTasks.length > 0 ? (
+ <span className="text-port-success">{readyTasks.length} ready now</span>
+ ) : (
+ <span>Next: {scheduledTasks[0]?.eligibleInFormatted || 'none scheduled'}</span>
+ )}
+ </p>
+ </div>
+ </div>
+ <Link
+ to="/cos/schedule"
+ className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
+ >
+ <span className="hidden sm:inline">Schedule</span>
+ <ChevronRight size={16} />
+ </Link>
+ </div>
+
+ {/* Task List */}
+ <div className="space-y-2">
+ {/* Ready Tasks */}
+ {readyTasks.slice(0, 3).map((task) => (
+ <div
+ key={task.taskType}
+ className="flex items-center gap-3 p-2 rounded-lg bg-port-success/10 border border-port-success/20"
+ >
+ <span className="text-lg flex-shrink-0" aria-hidden="true">
+ {getTaskIcon(task.taskType)}
+ </span>
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium text-white truncate">
+ {task.description}
+ </span>
+ {task.learningAdjusted && (
+ <span
+ className={`flex items-center gap-0.5 text-xs ${
+ task.adjustmentMultiplier < 1 ? 'text-port-success' : 'text-port-warning'
+ }`}
+ title={`Learning adjusted: ${task.successRate}% success rate`}
+ >
+ {task.adjustmentMultiplier < 1 ? (
+ <TrendingUp size={10} />
+ ) : (
+ <TrendingDown size={10} />
+ )}
+ </span>
+ )}
+ </div>
+ <div className="flex items-center gap-2 text-xs text-gray-500">
+ <span className="flex items-center gap-1">
+ <CheckCircle size={10} className="text-port-success" />
+ Ready
+ </span>
+ <span>|</span>
+ <span>{getIntervalLabel(task.intervalType)}</span>
+ {task.runCount > 0 && (
+ <>
+ <span>|</span>
+ <span>{task.lastRunFormatted}</span>
+ </>
+ )}
+ </div>
+ </div>
+ </div>
+ ))}
+
+ {/* Scheduled Tasks */}
+ {scheduledTasks.slice(0, readyTasks.length > 0 ? 2 : 4).map((task) => (
+ <div
+ key={task.taskType}
+ className="flex items-center gap-3 p-2 rounded-lg bg-port-bg/50"
+ >
+ <span className="text-lg flex-shrink-0 opacity-60" aria-hidden="true">
+ {getTaskIcon(task.taskType)}
+ </span>
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium text-gray-300 truncate">
+ {task.description}
+ </span>
+ {task.learningAdjusted && (
+ <span
+ className={`flex items-center gap-0.5 text-xs ${
+ task.adjustmentMultiplier < 1 ? 'text-port-success' : 'text-port-warning'
+ }`}
+ title={`Learning adjusted: ${task.successRate}% success rate`}
+ >
+ {task.adjustmentMultiplier < 1 ? (
+ <TrendingUp size={10} />
+ ) : (
+ <TrendingDown size={10} />
+ )}
+ </span>
+ )}
+ </div>
+ <div className="flex items-center gap-2 text-xs text-gray-500">
+ <span className="flex items-center gap-1">
+ <Timer size={10} />
+ {task.eligibleInFormatted}
+ </span>
+ <span>|</span>
+ <span>{getIntervalLabel(task.intervalType)}</span>
+ {task.successRate !== null && (
+ <>
+ <span>|</span>
+ <span className={task.successRate >= 70 ? 'text-port-success' : task.successRate >= 40 ? 'text-port-warning' : 'text-port-error'}>
+ {task.successRate}%
+ </span>
+ </>
+ )}
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+
+ {/* Summary */}
+ {upcoming.length > 5 && (
+ <div className="mt-3 pt-3 border-t border-port-border text-xs text-gray-500 text-center">
+ <Link to="/cos/schedule" className="hover:text-port-accent transition-colors">
+ +{upcoming.length - 5} more scheduled tasks
+ </Link>
+ </div>
+ )}
+
+ {/* Learning indicator */}
+ {upcoming.some(t => t.learningAdjusted) && (
+ <div className="mt-3 pt-3 border-t border-port-border flex items-center gap-2 text-xs text-purple-400">
+ <Sparkles size={12} />
+ <span>Schedule adjusted based on task performance</span>
+ </div>
+ )}
+ </div>
+ );
+});
+
+export default UpcomingTasksWidget;
diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsx
index fe911881b5..e22e9c5309 100644
--- a/client/src/pages/Dashboard.jsx
+++ b/client/src/pages/Dashboard.jsx
@@ -4,6 +4,7 @@ import AppTile from '../components/AppTile';
import BrailleSpinner from '../components/BrailleSpinner';
import CosDashboardWidget from '../components/CosDashboardWidget';
import GoalProgressWidget from '../components/GoalProgressWidget';
+import UpcomingTasksWidget from '../components/UpcomingTasksWidget';
import * as api from '../services/api';
import socket from '../services/socket';
@@ -98,6 +99,11 @@ export default function Dashboard() {
<GoalProgressWidget />
</div>
+ {/* Upcoming Tasks Widget */}
+ <div className="mb-6">
+ <UpcomingTasksWidget />
+ </div>
+
{/* App Grid */}
{apps.length === 0 ? (
<div className="bg-port-card border border-port-border rounded-xl p-8 sm:p-12 text-center">
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 62f733ba0a..4bab0bb18e 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -628,6 +628,7 @@ export const getCosGoalProgress = () => request('/cos/goal-progress');
export const getCosGoalProgressSummary = (options) => request('/cos/goal-progress/summary', options);
// Task Schedule (Configurable Intervals)
+export const getCosUpcomingTasks = (limit = 10) => request(`/cos/upcoming?limit=${limit}`);
export const getCosSchedule = () => request('/cos/schedule');
export const getCosScheduleIntervalTypes = () => request('/cos/schedule/interval-types');
export const getCosScheduleDueTasks = () => request('/cos/schedule/due');
diff --git a/server/routes/cos.js b/server/routes/cos.js
index d233707236..855290c0d7 100644
--- a/server/routes/cos.js
+++ b/server/routes/cos.js
@@ -563,6 +563,13 @@ router.get('/schedule', asyncHandler(async (req, res) => {
res.json(status);
}));
+// GET /api/cos/upcoming - Get upcoming tasks preview
+router.get('/upcoming', asyncHandler(async (req, res) => {
+ const limit = parseInt(req.query.limit) || 10;
+ const upcoming = await taskSchedule.getUpcomingTasks(limit);
+ res.json(upcoming);
+}));
+
// GET /api/cos/schedule/self-improvement/:taskType - Get interval for self-improvement task
router.get('/schedule/self-improvement/:taskType', asyncHandler(async (req, res) => {
const { taskType } = req.params;
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index bf6a9445e2..3eefdc49fe 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -1410,3 +1410,122 @@ Repository: {repoPath}
Perform ${taskType} analysis on {appName}.
Analyze the codebase and make improvements. Commit changes with clear descriptions.`;
}
+
+/**
+ * Get upcoming tasks preview - what tasks will run next
+ * Returns a list of tasks sorted by when they'll be eligible to run
+ * @param {number} limit - Maximum number of upcoming tasks to return
+ * @returns {Array} Upcoming tasks with timing info
+ */
+export async function getUpcomingTasks(limit = 10) {
+ const schedule = await loadSchedule();
+ const now = Date.now();
+ const upcoming = [];
+
+ // Process self-improvement tasks
+ for (const [taskType, interval] of Object.entries(schedule.selfImprovement)) {
+ if (!interval.enabled) continue;
+ if (interval.type === INTERVAL_TYPES.ON_DEMAND) continue;
+
+ const check = await shouldRunSelfImprovementTask(taskType);
+ const execution = schedule.executions[`self-improve:${taskType}`] || { lastRun: null, count: 0 };
+ const lastRun = execution.lastRun ? new Date(execution.lastRun).getTime() : 0;
+
+ // Calculate when task becomes eligible
+ let eligibleAt = now;
+ let status = 'ready';
+
+ if (check.shouldRun) {
+ eligibleAt = now;
+ status = 'ready';
+ } else if (check.nextRunAt) {
+ eligibleAt = new Date(check.nextRunAt).getTime();
+ status = 'scheduled';
+ } else if (interval.type === INTERVAL_TYPES.ONCE && execution.count > 0) {
+ status = 'completed';
+ eligibleAt = Infinity;
+ }
+
+ if (status === 'completed') continue;
+
+ upcoming.push({
+ taskType,
+ category: 'selfImprovement',
+ intervalType: interval.type,
+ status,
+ eligibleAt,
+ eligibleIn: eligibleAt - now,
+ eligibleInFormatted: formatTimeRemaining(eligibleAt - now),
+ lastRun: execution.lastRun,
+ lastRunFormatted: execution.lastRun ? formatRelativeTime(new Date(execution.lastRun).getTime()) : 'never',
+ runCount: execution.count,
+ successRate: check.successRate ?? null,
+ learningAdjusted: check.learningApplied || false,
+ adjustmentMultiplier: check.adjustmentMultiplier || 1.0,
+ description: getTaskTypeDescription(taskType)
+ });
+ }
+
+ // Sort by eligibility time (ready tasks first, then by time until eligible)
+ upcoming.sort((a, b) => {
+ if (a.status === 'ready' && b.status !== 'ready') return -1;
+ if (b.status === 'ready' && a.status !== 'ready') return 1;
+ return a.eligibleAt - b.eligibleAt;
+ });
+
+ return upcoming.slice(0, limit);
+}
+
+/**
+ * Format time remaining in human-readable form
+ */
+function formatTimeRemaining(ms) {
+ if (ms <= 0) return 'now';
+
+ const minutes = Math.floor(ms / 60000);
+ const hours = Math.floor(minutes / 60);
+ const days = Math.floor(hours / 24);
+
+ if (days > 0) return `${days}d ${hours % 24}h`;
+ if (hours > 0) return `${hours}h ${minutes % 60}m`;
+ if (minutes > 0) return `${minutes}m`;
+ return '< 1m';
+}
+
+/**
+ * Format relative time (e.g., "2h ago")
+ */
+function formatRelativeTime(timestamp) {
+ const now = Date.now();
+ const diff = now - timestamp;
+
+ const minutes = Math.floor(diff / 60000);
+ const hours = Math.floor(minutes / 60);
+ const days = Math.floor(hours / 24);
+
+ if (days > 0) return `${days}d ago`;
+ if (hours > 0) return `${hours}h ago`;
+ if (minutes > 0) return `${minutes}m ago`;
+ return 'just now';
+}
+
+/**
+ * Get human-readable description for task type
+ */
+function getTaskTypeDescription(taskType) {
+ const descriptions = {
+ 'ui-bugs': 'Find and fix UI bugs',
+ 'mobile-responsive': 'Check mobile responsiveness',
+ 'security': 'Security vulnerability audit',
+ 'code-quality': 'Code quality improvements',
+ 'console-errors': 'Fix console errors',
+ 'performance': 'Performance optimization',
+ 'cos-enhancement': 'Enhance CoS capabilities',
+ 'test-coverage': 'Improve test coverage',
+ 'documentation': 'Update documentation',
+ 'feature-ideas': 'Brainstorm and implement features',
+ 'accessibility': 'Accessibility audit',
+ 'dependency-updates': 'Update dependencies'
+ };
+ return descriptions[taskType] || taskType.replace(/-/g, ' ');
+}