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

Add Daily POST dashboard widget with practice-streak tracking

[._.]/ Adam Eivy01c1ea69eb7a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 7370c8a6a8..b3bb7a2e12 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -1,5 +1,9 @@
# Unreleased
+## Dashboard
+
+- **A new "Daily POST" dashboard widget surfaces your cognitive self-test streak and whether you've trained today.** POST (the daily 5-minute math/wordplay/memory/verbal/imagination self-test) had no dashboard presence — you had to navigate to `/post` to even remember it existed, which is exactly the wrong friction for a habit you want to do *daily*. The new widget shows today's status (✓ Done · score%, or a "Start →" nudge), your current practice streak with a fire/zap/sparkle glyph, and your personal-best run — one click into `/post/launcher`. To back it, `getPostStats` now also returns `completedToday`, `currentStreak`, `longestStreak`, `lastDate`, and `todayScore`, computed by a new pure `computePostStreaks(sessions, today)` helper that mirrors the activity-streak grace-window semantics (a not-yet-done today doesn't break the streak if yesterday is logged) using UTC day math so month/DST boundaries don't cause off-by-ones. The widget ships in the built-in **Health** layout and is addable to any layout. (`server/services/meatspacePost.js`, `client/src/components/DailyPostWidget.jsx`, `client/src/components/dashboard/widgetRegistry.jsx`, `server/services/dashboardLayouts.js`)
+
## Catalog
- **[issue-1762] Catalog gains universe/series/tag filters, real pagination, and an Albums grouped view.** The Catalog page had outgrown a flat, hard-capped list of 200 ingredients with only type chips + search. It now exposes the universe, series, and tag facets the server already understood as filter dropdowns (series scoped to the chosen universe), all reflected in the URL (`?type=&universe=&series=&tag=&q=&view=`) so a filtered catalog is shareable and back-button-safe. The flat Grid view paginates past the old cap with a "Load more" button (60/page) and an honest "showing X of N" line. A new **Albums** view groups ingredients by universe with a pinned **"Unsorted / Raw"** album (ingredients linked to nothing yet) and an **"Orphaned"** album (refs whose universe/series was deleted) — each lazy-loading its cards on first expand. The multi-select action bar can now **place a selection into a universe/series** directly, closing the raw → placed loop. Server-side: `listIngredients` gained `refKind`/`refId`/`unlinked`/`orphaned` filters, a new `GET /api/catalog/facets` aggregates type/universe/series/tag facets plus unlinked/orphaned bucket counts in one round-trip, and the shared `<CatalogCard>` is extracted so the grid and albums render identical cards. (`server/services/catalogDB.js`, `server/routes/catalog.js`, `server/lib/catalogValidation.js`, `client/src/pages/Catalog.jsx`, `client/src/components/catalog/`, `client/src/services/apiCatalog.js`)
diff --git a/client/src/components/DailyPostWidget.jsx b/client/src/components/DailyPostWidget.jsx
new file mode 100644
index 0000000000..4c868699c7
--- /dev/null
+++ b/client/src/components/DailyPostWidget.jsx
@@ -0,0 +1,75 @@
+import { useState, useEffect, useCallback } from 'react';
+import { Link } from 'react-router-dom';
+import { Brain, ArrowRight } from 'lucide-react';
+import * as api from '../services/api';
+
+// Surfaces the daily POST cognitive self-test on the dashboard: today's
+// completion status, the current practice streak, and a one-click way into the
+// launcher. Self-fetches its stats (the dashboardState payload doesn't carry
+// POST data), mirroring DeathClockWidget.
+export default function DailyPostWidget() {
+ const [stats, setStats] = useState(null);
+ const [loaded, setLoaded] = useState(false);
+
+ const fetchData = useCallback(async () => {
+ const data = await api.getPostStats().catch(() => null);
+ setStats(data);
+ setLoaded(true);
+ }, []);
+
+ useEffect(() => {
+ fetchData();
+ }, [fetchData]);
+
+ if (!loaded) return null;
+
+ const streak = stats?.currentStreak ?? 0;
+ const longest = stats?.longestStreak ?? 0;
+ const completedToday = !!stats?.completedToday;
+ const todayScore = stats?.todayScore;
+ const streakGlyph = streak >= 7 ? '🔥' : streak >= 3 ? '⚡' : '✨';
+
+ return (
+ <Link
+ to="/post/launcher"
+ className="bg-port-card border border-port-border rounded-xl p-4 h-full block hover:border-gray-600 transition-colors"
+ >
+ <div className="flex items-center gap-2 mb-3">
+ <Brain size={16} className="text-gray-500" />
+ <h3 className="text-sm font-semibold text-white">Daily POST</h3>
+ {completedToday ? (
+ <span className="ml-auto px-2 py-0.5 bg-port-success/20 text-port-success text-xs rounded-full">
+ Done today{typeof todayScore === 'number' ? ` · ${todayScore}%` : ''}
+ </span>
+ ) : (
+ <span className="ml-auto flex items-center gap-1 text-xs text-port-accent">
+ Start <ArrowRight size={12} />
+ </span>
+ )}
+ </div>
+
+ <div className="flex items-center gap-3">
+ <div className="text-2xl" aria-hidden="true">{streakGlyph}</div>
+ <div>
+ <div className="text-xl font-bold text-white">
+ {streak} day{streak !== 1 ? 's' : ''}
+ </div>
+ <div className="text-xs text-gray-500">
+ {streak > 0 ? 'Current streak' : 'No streak — start one today'}
+ </div>
+ </div>
+ {longest > streak && (
+ <div className="ml-auto text-right">
+ <div className="text-sm font-semibold text-port-accent">{longest} days</div>
+ <div className="text-xs text-gray-500">Best</div>
+ </div>
+ )}
+ {streak > 0 && streak === longest && (
+ <div className="ml-auto px-2 py-1 bg-port-success/20 text-port-success text-xs rounded-full">
+ Personal best!
+ </div>
+ )}
+ </div>
+ </Link>
+ );
+}
diff --git a/client/src/components/dashboard/widgetRegistry.jsx b/client/src/components/dashboard/widgetRegistry.jsx
index 5517206d0a..f6945dcc74 100644
--- a/client/src/components/dashboard/widgetRegistry.jsx
+++ b/client/src/components/dashboard/widgetRegistry.jsx
@@ -11,6 +11,7 @@ const GoalProgressWidget = lazyWithReload(() => import('../GoalProgressWidget
const UpcomingTasksWidget = lazyWithReload(() => import('../UpcomingTasksWidget'));
const DecisionLogWidget = lazyWithReload(() => import('../DecisionLogWidget'));
const DeathClockWidget = lazyWithReload(() => import('../DeathClockWidget'));
+const DailyPostWidget = lazyWithReload(() => import('../DailyPostWidget'));
const ProactiveAlertsWidget = lazyWithReload(() => import('../ProactiveAlertsWidget'));
const QuickBrainCapture = lazyWithReload(() => import('../QuickBrainCapture'));
const QuickIdeaCapture = lazyWithReload(() => import('../QuickIdeaCapture'));
@@ -54,6 +55,7 @@ export const WIDGETS = [
{ id: 'network-exposure', label: 'Network Exposure', Component: NetworkExposureWidget, width: 'quarter', defaultH: 5, module: { id: '07', status: 'EXPOSURE', glyph: 'reticle' } },
{ id: 'backup', label: 'Backup', Component: BackupWidget, width: 'quarter', defaultH: 5 },
{ id: 'death-clock', label: 'Death Clock', Component: DeathClockWidget, width: 'quarter', defaultH: 4 },
+ { id: 'daily-post', label: 'Daily POST', Component: DailyPostWidget, width: 'quarter', defaultH: 3 },
{ id: 'quick-stats', label: 'Quick Stats', Component: QuickStatsWidget, width: 'quarter', defaultH: 3, gate: (s) => s.apps.length > 0 },
{ id: 'decision-log', label: 'Decision Log', Component: DecisionLogWidget, width: 'quarter', defaultH: 4 },
{ id: 'activity-streak', label: 'Activity Streak', Component: ActivityStreakWidget, width: 'third', defaultH: 3, gate: (s) => s.usage?.currentStreak > 0 || s.usage?.longestStreak > 0, module: { id: '06', status: 'STREAK', glyph: 'spark' } },
diff --git a/server/services/dashboardLayouts.js b/server/services/dashboardLayouts.js
index 3931a12a8d..32fd198e61 100644
--- a/server/services/dashboardLayouts.js
+++ b/server/services/dashboardLayouts.js
@@ -51,11 +51,12 @@ export const INTENT_LAYOUTS = [
{
id: 'health',
name: 'Health',
- widgets: ['death-clock', 'goal-progress', 'activity-streak', 'quick-brain', 'hourly-activity'],
+ widgets: ['death-clock', 'goal-progress', 'activity-streak', 'daily-post', 'quick-brain', 'hourly-activity'],
grid: [
{ id: 'death-clock', x: 0, y: 0, w: 4, h: 3 },
{ id: 'goal-progress', x: 4, y: 0, w: 5, h: 5 },
{ id: 'activity-streak', x: 9, y: 0, w: 3, h: 3 },
+ { id: 'daily-post', x: 9, y: 3, w: 3, h: 2 },
{ id: 'quick-brain', x: 0, y: 3, w: 4, h: 2 },
{ id: 'hourly-activity', x: 0, y: 5, w: 12, h: 4 },
],
diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.js
index 2334b0491f..aed5b38d76 100644
--- a/server/services/meatspacePost.js
+++ b/server/services/meatspacePost.js
@@ -149,8 +149,63 @@ export async function submitPostSession(sessionData) {
return session;
}
+// Local-date arithmetic on `YYYY-MM-DD` strings via UTC midnight so day math
+// never drifts across DST boundaries (the activity-streak bug class).
+function ymdToUTC(s) {
+ const [y, m, d] = s.split('-').map(Number);
+ return Date.UTC(y, m - 1, d);
+}
+function ymdShift(s, deltaDays) {
+ return new Date(ymdToUTC(s) + deltaDays * 86400000).toISOString().split('T')[0];
+}
+
+/**
+ * Compute POST practice streaks from session records. Pure (takes `todayStr`
+ * explicitly) so it's unit-testable without faking the clock.
+ *
+ * - `completedToday` — at least one session dated today
+ * - `currentStreak` — consecutive days with a session counting back from
+ * today; a not-yet-done today does NOT break the streak as long as yesterday
+ * has one (grace window), mirroring `usage.js` `calculateStreak`
+ * - `longestStreak` — longest consecutive-day run in all history
+ * - `lastDate` — most recent session date (null if never practiced)
+ * - `todayScore` — best session score recorded today (null if none)
+ */
+export function computePostStreaks(sessions, todayStr) {
+ const dateSet = new Set((sessions || []).map(s => s?.date).filter(Boolean));
+ const dates = Array.from(dateSet).sort();
+ const completedToday = dateSet.has(todayStr);
+ const lastDate = dates.length ? dates[dates.length - 1] : null;
+
+ const todayScores = (sessions || [])
+ .filter(s => s?.date === todayStr && typeof s?.score === 'number')
+ .map(s => s.score);
+ const todayScore = todayScores.length ? Math.max(...todayScores) : null;
+
+ let longestStreak = 0;
+ let run = 0;
+ let prev = null;
+ for (const d of dates) {
+ run = prev && ymdToUTC(d) - ymdToUTC(prev) === 86400000 ? run + 1 : 1;
+ if (run > longestStreak) longestStreak = run;
+ prev = d;
+ }
+
+ // Anchor the current streak at today, or yesterday if today isn't done yet.
+ let cursor = completedToday ? todayStr : ymdShift(todayStr, -1);
+ let currentStreak = 0;
+ while (dateSet.has(cursor)) {
+ currentStreak += 1;
+ cursor = ymdShift(cursor, -1);
+ }
+
+ return { completedToday, currentStreak, longestStreak, lastDate, todayScore };
+}
+
export async function getPostStats(days = 30) {
const sessions = await getPostSessions();
+ // Streaks are computed over ALL history, independent of the stats window.
+ const streaks = computePostStreaks(sessions, new Date().toISOString().split('T')[0]);
let recent = sessions;
if (days > 0) {
const cutoff = new Date();
@@ -160,7 +215,7 @@ export async function getPostStats(days = 30) {
}
if (recent.length === 0) {
- return { days, sessionCount: 0, overall: null, byModule: {}, byDrill: {} };
+ return { days, sessionCount: 0, overall: null, byModule: {}, byDrill: {}, ...streaks };
}
const scores = recent.map(s => s.score);
@@ -183,7 +238,7 @@ export async function getPostStats(days = 30) {
for (const key of Object.keys(byModule)) byModule[key] = avg(byModule[key]);
for (const key of Object.keys(byDrill)) byDrill[key] = avg(byDrill[key]);
- return { days, sessionCount: recent.length, overall, byModule, byDrill };
+ return { days, sessionCount: recent.length, overall, byModule, byDrill, ...streaks };
}
// =============================================================================
diff --git a/server/services/meatspacePost.test.js b/server/services/meatspacePost.test.js
index 757e24c8dc..2b232dd294 100644
--- a/server/services/meatspacePost.test.js
+++ b/server/services/meatspacePost.test.js
@@ -7,6 +7,7 @@ import {
generateEstimation,
scoreDrill,
computeExpectedFromPrompt,
+ computePostStreaks,
} from './meatspacePost.js';
// =============================================================================
@@ -361,3 +362,71 @@ describe('scoreDrill', () => {
expect(recomputed[1].correct).toBe(false);
});
});
+
+// =============================================================================
+// STREAK TESTS
+// =============================================================================
+
+describe('computePostStreaks', () => {
+ const s = (date, score = 80) => ({ date, score });
+
+ it('returns a zeroed result when there are no sessions', () => {
+ expect(computePostStreaks([], '2026-06-28')).toEqual({
+ completedToday: false,
+ currentStreak: 0,
+ longestStreak: 0,
+ lastDate: null,
+ todayScore: null,
+ });
+ });
+
+ it('counts a single-day streak when only today is practiced', () => {
+ const r = computePostStreaks([s('2026-06-28')], '2026-06-28');
+ expect(r.completedToday).toBe(true);
+ expect(r.currentStreak).toBe(1);
+ expect(r.longestStreak).toBe(1);
+ expect(r.lastDate).toBe('2026-06-28');
+ });
+
+ it('counts consecutive days back from today', () => {
+ const sessions = [s('2026-06-26'), s('2026-06-27'), s('2026-06-28')];
+ const r = computePostStreaks(sessions, '2026-06-28');
+ expect(r.currentStreak).toBe(3);
+ expect(r.longestStreak).toBe(3);
+ });
+
+ it('keeps the streak alive on a not-yet-done today when yesterday is done', () => {
+ const r = computePostStreaks([s('2026-06-26'), s('2026-06-27')], '2026-06-28');
+ expect(r.completedToday).toBe(false);
+ expect(r.currentStreak).toBe(2);
+ });
+
+ it('breaks the current streak after a two-day gap', () => {
+ const r = computePostStreaks([s('2026-06-20'), s('2026-06-21')], '2026-06-28');
+ expect(r.currentStreak).toBe(0);
+ expect(r.longestStreak).toBe(2);
+ expect(r.lastDate).toBe('2026-06-21');
+ });
+
+ it('reports the longest historical run independent of the current streak', () => {
+ const sessions = [
+ s('2026-06-01'), s('2026-06-02'), s('2026-06-03'), s('2026-06-04'), // run of 4
+ s('2026-06-27'), s('2026-06-28'), // current run of 2
+ ];
+ const r = computePostStreaks(sessions, '2026-06-28');
+ expect(r.currentStreak).toBe(2);
+ expect(r.longestStreak).toBe(4);
+ });
+
+ it('dedups multiple same-day sessions and reports the best score for today', () => {
+ const sessions = [s('2026-06-28', 70), s('2026-06-28', 91), s('2026-06-27', 60)];
+ const r = computePostStreaks(sessions, '2026-06-28');
+ expect(r.currentStreak).toBe(2);
+ expect(r.todayScore).toBe(91);
+ });
+
+ it('spans a month boundary without an off-by-one (UTC day math)', () => {
+ const r = computePostStreaks([s('2026-05-31'), s('2026-06-01')], '2026-06-01');
+ expect(r.currentStreak).toBe(2);
+ });
+});