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 activity calendar to dashboard widget

Adam Eivy4ac7e6568f9e
diff --git a/.changelog/v0.13.x.md b/.changelog/v0.13.x.md
index bf6e06fd2b..431e2a8c58 100644
--- a/.changelog/v0.13.x.md
+++ b/.changelog/v0.13.x.md
@@ -120,3 +120,14 @@ This release expands the genome dashboard with comprehensive cancer predispositi
- **Increased default timeout** from 120s to 180s for both CLI and API providers — CLI LLM analysis of projects without existing ecosystem configs often exceeds 2 minutes
- **Added API fetch timeout** — `executeApiAnalysis` now uses `AbortController` with the same provider timeout, preventing indefinite hangs on unresponsive API endpoints
- **Added timing diagnostics** — `analyzeApp` now logs the provider name, type, and elapsed time for each analysis, making slow provider issues easier to diagnose
+
+### CoS Dashboard Activity Calendar
+- **GitHub-style activity heatmap** — the CosDashboardWidget now displays a compact contribution-style calendar showing the last 8 weeks of CoS task completion
+- **Color-coded intensity** — squares colored by volume (more tasks = brighter) and success rate (green for 80%+, amber for 50-79%, red for <50%)
+- **Streak indicator** — shows current daily streak with flame icon badge
+- **Interactive tooltips** — hover on any day to see date, task count, and success rate
+- **Today highlight** — current day marked with accent ring
+- **Summary stats** — total tasks, active days, and overall success rate displayed below the calendar
+- **Mini legend** — visual guide showing Less-to-More color scale
+- **New API endpoint** — `GET /api/cos/productivity/calendar?weeks=N` returns calendar-optimized daily activity data with intensity calculations
+- Directly addresses user preference for "quick visual summaries of recent task completion directly on the dashboard"
diff --git a/client/src/components/CosDashboardWidget.jsx b/client/src/components/CosDashboardWidget.jsx
index 17f51b6594..67b7d127df 100644
--- a/client/src/components/CosDashboardWidget.jsx
+++ b/client/src/components/CosDashboardWidget.jsx
@@ -11,7 +11,8 @@ import {
Zap,
Bot,
XCircle,
- History
+ History,
+ Activity
} from 'lucide-react';
import * as api from '../services/api';
@@ -23,19 +24,22 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {
const [summary, setSummary] = useState(null);
const [learningSummary, setLearningSummary] = useState(null);
const [recentTasks, setRecentTasks] = useState(null);
+ const [activityCalendar, setActivityCalendar] = useState(null);
const [loading, setLoading] = useState(true);
const [tasksExpanded, setTasksExpanded] = useState(false);
useEffect(() => {
const loadData = async () => {
- const [quickData, learningData, tasksData] = await Promise.all([
+ const [quickData, learningData, tasksData, calendarData] = await Promise.all([
api.getCosQuickSummary().catch(() => null),
api.getCosLearningSummary().catch(() => null),
- api.getCosRecentTasks(5).catch(() => null)
+ api.getCosRecentTasks(5).catch(() => null),
+ api.getCosActivityCalendar(8).catch(() => null)
]);
setSummary(quickData);
setLearningSummary(learningData);
setRecentTasks(tasksData);
+ setActivityCalendar(calendarData);
setLoading(false);
};
@@ -184,6 +188,11 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {
</Link>
</div>
+ {/* Activity Calendar - GitHub-style heatmap */}
+ {activityCalendar?.weeks?.length > 0 && activityCalendar.summary.totalTasks > 0 && (
+ <ActivityCalendar data={activityCalendar} />
+ )}
+
{/* Recent Tasks Section */}
{recentTasks?.tasks?.length > 0 && (
<div className="mt-4 pt-4 border-t border-port-border">
@@ -257,4 +266,112 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {
);
});
+/**
+ * ActivityCalendar - Compact GitHub-style activity heatmap
+ * Shows daily task completion as colored squares
+ */
+function ActivityCalendar({ data }) {
+ // Calculate intensity level (0-4) based on tasks completed
+ const getIntensityLevel = (tasks) => {
+ if (tasks === 0) return 0;
+ if (tasks === 1) return 1;
+ const max = data.maxTasks || 1;
+ const ratio = tasks / max;
+ if (ratio >= 0.75) return 4;
+ if (ratio >= 0.5) return 3;
+ if (ratio >= 0.25) return 2;
+ return 1;
+ };
+
+ // Get color class based on intensity and success rate
+ const getColorClass = (day) => {
+ if (day.tasks === 0 || day.isFuture) return 'bg-port-border/20';
+ const intensity = getIntensityLevel(day.tasks);
+
+ // Color based on success rate
+ if (day.successRate >= 80) {
+ const shades = ['', 'bg-emerald-900/50', 'bg-emerald-700/60', 'bg-emerald-500/70', 'bg-emerald-400'];
+ return shades[intensity];
+ } else if (day.successRate >= 50) {
+ const shades = ['', 'bg-amber-900/50', 'bg-amber-700/60', 'bg-amber-500/70', 'bg-amber-400'];
+ return shades[intensity];
+ } else {
+ const shades = ['', 'bg-red-900/50', 'bg-red-700/60', 'bg-red-500/70', 'bg-red-400'];
+ return shades[intensity];
+ }
+ };
+
+ const formatDate = (dateStr) => {
+ const date = new Date(dateStr + 'T12:00:00');
+ return date.toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' });
+ };
+
+ return (
+ <div className="mt-4 pt-4 border-t border-port-border">
+ <div className="flex items-center justify-between mb-2">
+ <div className="flex items-center gap-2">
+ <Activity size={14} className="text-port-accent" />
+ <span className="text-sm font-medium text-gray-300">Activity</span>
+ {data.currentStreak > 0 && (
+ <span className="flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-orange-500/20 text-orange-400">
+ <Flame size={10} />
+ {data.currentStreak}d
+ </span>
+ )}
+ </div>
+ <Link
+ to="/cos/productivity"
+ className="flex items-center gap-1 text-xs text-gray-500 hover:text-port-accent transition-colors"
+ >
+ {data.summary.activeDays} active days
+ <ChevronRight size={12} />
+ </Link>
+ </div>
+
+ {/* Calendar Grid */}
+ <div className="overflow-x-auto scrollbar-hide">
+ <div className="flex gap-0.5" style={{ minWidth: 'max-content' }}>
+ {data.weeks.map((week, weekIdx) => (
+ <div key={weekIdx} className="flex flex-col gap-0.5">
+ {week.map((day) => (
+ <div
+ key={day.date}
+ className={`
+ w-[9px] h-[9px] sm:w-[10px] sm:h-[10px]
+ rounded-sm transition-colors cursor-default
+ ${getColorClass(day)}
+ ${day.isToday ? 'ring-1 ring-port-accent' : ''}
+ ${day.isFuture ? 'opacity-30' : ''}
+ `}
+ title={day.isFuture ? '' : `${formatDate(day.date)}: ${day.tasks} task${day.tasks !== 1 ? 's' : ''} (${day.successRate}% success)`}
+ />
+ ))}
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* Summary Row */}
+ <div className="flex items-center justify-between mt-2 text-xs text-gray-500">
+ <span>
+ <span className="text-white font-medium">{data.summary.totalTasks}</span> tasks,{' '}
+ <span className={`font-medium ${
+ data.summary.successRate >= 80 ? 'text-port-success' :
+ data.summary.successRate >= 50 ? 'text-port-warning' : 'text-port-error'
+ }`}>{data.summary.successRate}%</span> success
+ </span>
+ {/* Mini Legend */}
+ <div className="flex items-center gap-0.5">
+ <span className="mr-1 hidden sm:inline">Less</span>
+ <div className="w-2 h-2 rounded-sm bg-port-border/20" />
+ <div className="w-2 h-2 rounded-sm bg-emerald-900/50" />
+ <div className="w-2 h-2 rounded-sm bg-emerald-500/70" />
+ <div className="w-2 h-2 rounded-sm bg-emerald-400" />
+ <span className="ml-1 hidden sm:inline">More</span>
+ </div>
+ </div>
+ </div>
+ );
+}
+
export default CosDashboardWidget;
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 48082e3fa1..0128f83c6a 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -376,10 +376,10 @@ export const checkAgentPosts = (agentId, accountId, days, maxReplies, maxUpvotes
});
// Moltworld Tools
-export const moltworldJoin = (accountId, x, y, thinking, say, sayTo) =>
+export const moltworldJoin = (accountId, x, y, thinking, say, sayTo, agentId) =>
request('/agents/tools/moltworld/join', {
method: 'POST',
- body: JSON.stringify({ accountId, x, y, thinking, say, sayTo })
+ body: JSON.stringify({ accountId, agentId, x, y, thinking, say, sayTo })
});
export const moltworldBuild = (accountId, agentId, x, y, z, type, action) =>
request('/agents/tools/moltworld/build', {
@@ -397,6 +397,58 @@ export const moltworldBalance = (accountId) =>
request(`/agents/tools/moltworld/balance?accountId=${accountId}`);
export const moltworldRateLimits = (accountId) =>
request(`/agents/tools/moltworld/rate-limits?accountId=${accountId}`);
+export const moltworldThink = (accountId, thought, agentId) =>
+ request('/agents/tools/moltworld/think', {
+ method: 'POST',
+ body: JSON.stringify({ accountId, agentId, thought })
+ });
+export const moltworldSay = (accountId, message, sayTo, agentId) =>
+ request('/agents/tools/moltworld/say', {
+ method: 'POST',
+ body: JSON.stringify({ accountId, agentId, message, ...(sayTo ? { sayTo } : {}) })
+ });
+
+// Moltworld Action Queue
+export const moltworldGetQueue = (agentId) =>
+ request(`/agents/tools/moltworld/queue/${agentId}`);
+export const moltworldAddToQueue = (agentId, actionType, params, scheduledFor) =>
+ request('/agents/tools/moltworld/queue', {
+ method: 'POST',
+ body: JSON.stringify({ agentId, actionType, params, scheduledFor })
+ });
+export const moltworldRemoveFromQueue = (id) =>
+ request(`/agents/tools/moltworld/queue/${id}`, { method: 'DELETE' });
+
+// Moltworld WebSocket Relay
+export const moltworldWsConnect = (accountId) =>
+ request('/agents/tools/moltworld/ws/connect', {
+ method: 'POST',
+ body: JSON.stringify({ accountId })
+ });
+export const moltworldWsDisconnect = () =>
+ request('/agents/tools/moltworld/ws/disconnect', { method: 'POST' });
+export const moltworldWsStatus = () =>
+ request('/agents/tools/moltworld/ws/status');
+export const moltworldWsMove = (x, y, thought) =>
+ request('/agents/tools/moltworld/ws/move', {
+ method: 'POST',
+ body: JSON.stringify({ x, y, ...(thought ? { thought } : {}) })
+ });
+export const moltworldWsThink = (thought) =>
+ request('/agents/tools/moltworld/ws/think', {
+ method: 'POST',
+ body: JSON.stringify({ thought })
+ });
+export const moltworldWsNearby = (radius) =>
+ request('/agents/tools/moltworld/ws/nearby', {
+ method: 'POST',
+ body: JSON.stringify({ ...(radius ? { radius } : {}) })
+ });
+export const moltworldWsInteract = (to, payload) =>
+ request('/agents/tools/moltworld/ws/interact', {
+ method: 'POST',
+ body: JSON.stringify({ to, payload })
+ });
// Agent Drafts
export const getAgentDrafts = (agentId) => request(`/agents/tools/drafts?agentId=${agentId}`);
@@ -565,6 +617,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 getCosProductivityTrends = (days = 30) => request(`/cos/productivity/trends?days=${days}`);
+export const getCosActivityCalendar = (weeks = 12) => request(`/cos/productivity/calendar?weeks=${weeks}`);
export const getCosQuickSummary = () => request('/cos/quick-summary');
export const getCosRecentTasks = (limit = 10) => request(`/cos/recent-tasks?limit=${limit}`);
export const getCosActionableInsights = () => request('/cos/actionable-insights');
diff --git a/server/routes/cos.js b/server/routes/cos.js
index 3986c3a23e..c61f31faa3 100644
--- a/server/routes/cos.js
+++ b/server/routes/cos.js
@@ -912,6 +912,13 @@ router.get('/productivity/trends', asyncHandler(async (req, res) => {
res.json(trends);
}));
+// GET /api/cos/productivity/calendar - Get activity calendar for GitHub-style heatmap
+router.get('/productivity/calendar', asyncHandler(async (req, res) => {
+ const weeks = parseInt(req.query.weeks) || 12;
+ const calendar = await productivity.getActivityCalendar(weeks);
+ res.json(calendar);
+}));
+
// 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) => {
diff --git a/server/services/productivity.js b/server/services/productivity.js
index f3d3b371f4..b76c4f75ab 100644
--- a/server/services/productivity.js
+++ b/server/services/productivity.js
@@ -500,3 +500,86 @@ export async function getDailyTrends(days = 30) {
}
};
}
+
+/**
+ * Get activity calendar data for GitHub-style heatmap
+ * Returns last N weeks of daily activity in a format optimized for calendar display
+ * @param {number} weeks - Number of weeks to include (default: 12)
+ * @returns {Object} Calendar data with days organized by week
+ */
+export async function getActivityCalendar(weeks = 12) {
+ const data = await loadProductivity();
+ const dailyHistory = data.dailyHistory || {};
+
+ // Calculate date range: from start of week N weeks ago to today
+ const today = new Date();
+ const todayStr = getDateString(today);
+
+ // Find the start of the range (weeks ago, aligned to Sunday)
+ const startDate = new Date(today);
+ startDate.setDate(startDate.getDate() - (weeks * 7) + 1);
+ // Align to Sunday
+ const startDayOfWeek = startDate.getDay();
+ startDate.setDate(startDate.getDate() - startDayOfWeek);
+
+ // Build calendar grid: array of weeks, each containing 7 days
+ const calendar = [];
+ let currentDate = new Date(startDate);
+ let currentWeek = [];
+ let maxTasks = 1;
+
+ while (currentDate <= today) {
+ const dateStr = getDateString(currentDate);
+ const dayData = dailyHistory[dateStr] || { tasks: 0, successes: 0, failures: 0, successRate: 0 };
+
+ if (dayData.tasks > maxTasks) {
+ maxTasks = dayData.tasks;
+ }
+
+ currentWeek.push({
+ date: dateStr,
+ dayOfWeek: currentDate.getDay(),
+ tasks: dayData.tasks,
+ successes: dayData.successes,
+ failures: dayData.failures,
+ successRate: dayData.successRate,
+ isToday: dateStr === todayStr,
+ isFuture: currentDate > today
+ });
+
+ // Start new week on Sunday
+ if (currentDate.getDay() === 6) {
+ calendar.push(currentWeek);
+ currentWeek = [];
+ }
+
+ currentDate.setDate(currentDate.getDate() + 1);
+ }
+
+ // Add remaining days if any
+ if (currentWeek.length > 0) {
+ calendar.push(currentWeek);
+ }
+
+ // Calculate summary stats
+ const allDays = calendar.flat();
+ const activeDays = allDays.filter(d => d.tasks > 0);
+ const totalTasks = activeDays.reduce((sum, d) => sum + d.tasks, 0);
+ const totalSuccesses = activeDays.reduce((sum, d) => sum + d.successes, 0);
+
+ return {
+ weeks: calendar,
+ maxTasks,
+ summary: {
+ totalDays: allDays.length,
+ activeDays: activeDays.length,
+ totalTasks,
+ totalSuccesses,
+ successRate: totalTasks > 0 ? Math.round((totalSuccesses / totalTasks) * 100) : 0,
+ avgTasksPerActiveDay: activeDays.length > 0
+ ? Math.round((totalTasks / activeDays.length) * 10) / 10
+ : 0
+ },
+ currentStreak: data.streaks?.currentDaily || 0
+ };
+}