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

surface progress analytics on POST launcher

[._.]/ Adam Eivy15c51c6e173a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index c7b4471bf4..680a3e6a44 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -20,6 +20,7 @@
- **[issue-1986] The POST launcher now fills the full desktop width.** The Power On Self Test launcher (`PostSessionLauncher.jsx`) previously wrapped every card in a single ~672px column (`max-w-2xl`), leaving a large dead gutter on wide monitors. It's now a responsive main-plus-sidebar grid (`lg:grid-cols-[minmax(0,1fr)_22rem]`, capped at `max-w-6xl`): the primary session flow — Today's Status, Session Mode toggle, Conditions, and the Start / Quick 5 Min buttons — stays in the left column above the fold, while the Mental Math / Wit & Memory drill summaries and Recent Sessions flow into the right sidebar. On mobile it collapses to a single readable column (Start buttons still prominent), the header action buttons wrap instead of overflowing, and the Start buttons stack on narrow screens. Layout-only — session start, Quick 5 Min, the Test/Train toggle, and condition tags are all unchanged. (`client/src/components/meatspace/post/PostSessionLauncher.jsx`, Closes #1986)
- **[issue-1987] The POST drill config now exposes all 14 LLM drill types in a responsive, domain-grouped layout.** The Drill Configuration screen (`PostDrillConfig.jsx`) previously showed a single narrow column that only surfaced 5 of the 14 generatable LLM drills — so the entire **Imagination** family (What If?, Alternative Uses, Story Prompt, Invention Pitch, Reframe) plus **Compound Chain**, **Bridge Word**, **Double Meaning**, and **Idiom Twist** could be generated server-side but never toggled on for a session. All 14 are now shown as toggle cards grouped under **Wordplay / Verbal Agility / Imagination** section headers, laid out in a responsive grid (single column on mobile, up to three columns on desktop) instead of one page-length stack. Enabling any of them and saving persists via `PUT /post/config` and makes the drill appear in Full POST and Quick 5 Min sessions. (`client/src/components/meatspace/post/PostDrillConfig.jsx`, Closes #1987)
+- **[issue-1990] The POST launcher now shows your progress at a glance — streak, trend, and weakest-domain focus.** The Power On Self Test launcher (`PostSessionLauncher.jsx`) previously surfaced only "Today's Status" plus the last three raw scores, even though the server already computes rich analytics that never reached it. It now loads `GET /post/stats` (30-day and 7-day windows) alongside the config/session fetch and renders a compact analytics strip above the fold: a **current streak** card with the same 🔥/⚡/✨ glyphs as the dashboard Daily POST widget (plus your best streak), a **7-day average** card with a trend arrow showing how the last week compares to your 30-day baseline, and a **weakest-domain callout** ("Lowest domain this month: Verbal Agility — 62 avg") derived from per-drill averages mapped to their training domain. A one-click **Practice \<domain\>** button starts a focused session running every enabled drill in your weakest domain — and it always targets a domain you actually have drills enabled for, so it can't dead-end. Everything degrades gracefully with no history (the strip simply doesn't render), and all existing launcher behavior — Full POST, Quick 5 Min, the Test/Train toggle, and condition tags — is unchanged. Extracted the shared `domainLabel` / `computeDomainAverages` helpers into `constants.js` (now reused by History). (`client/src/components/meatspace/post/PostSessionLauncher.jsx`, `constants.js`, `PostTab.jsx`, Closes #1990)
- **[issue-1988] POST History is now a responsive analytics dashboard.** The History view (`client/src/components/meatspace/post/PostHistory.jsx`) was a single `max-w-3xl` column that stacked a lone overall-score line chart, a 3-up stat block, and the session table — surfacing only a fraction of what `getPostStats` already computes. It now fills desktop width and surfaces the full stats payload: a 4-up summary of **Sessions / Avg Score / Current Streak / Longest Streak**, a wide **Score Trend** line beside a horizontal **Avg by Domain** bar chart (each domain colored to match its `text-*-400` domain class), and a **Drill Breakdown** card that groups every drill's average into per-domain progress bars — so per-domain and per-drill averages plus streaks are visible without opening a single session. The five training domains (Mental Math / Memory / Wordplay / Verbal Agility / Imagination) are derived from each drill's *type* via `DRILL_TO_DOMAIN`, because the runners persist coarse module keys (`mental-math`, `llm-drills`) rather than domain keys — so all LLM drills split correctly across Wordplay/Verbal/Imagination instead of collapsing into one bucket. Mobile stays single-column; the 7/30/90/All range selector still drives every panel from one fetch. (Closes #1988)
- **[issue-1989] POST Memory surfaces are now responsive.** The Memory Builder, Practice, and Session Results screens were all pinned to a single narrow `max-w-2xl` column that wasted desktop width. **Memory Builder** (`MemoryBuilder.jsx`) now renders its saved items as a responsive card grid (`grid-cols-1 md:grid-cols-2 xl:grid-cols-3`) — each card lays out the item icon, title, line/chunk meta, and mastery badge above a full-width Practice button (with an aria-labeled delete for non-built-ins), while the create form and description stay in a readable `max-w-2xl` column above the grid. **Memory Practice** (`MemoryPractice.jsx`) widens the reading-oriented screens to `max-w-4xl` — the practice-mode picker (now a two-column card grid), Learn progressive-reveal, and Speed Run — while the active-recall focus steps (Sequence, Fill-in-the-Blank, Spaced Repetition) stay at a comfortable `max-w-2xl` for readability. **Session Results** (`PostSessionResults.jsx`) widens to `max-w-4xl` and lays the per-drill breakdown out in two columns on desktop. Layout-only: create/edit/delete, practice submission, mastery display, and score/breakdown rendering are unchanged; every surface collapses to a single column on mobile. (Closes #1989)
diff --git a/client/src/components/meatspace/post/PostHistory.jsx b/client/src/components/meatspace/post/PostHistory.jsx
index ccef28b1a3..b7bd3a2589 100644
--- a/client/src/components/meatspace/post/PostHistory.jsx
+++ b/client/src/components/meatspace/post/PostHistory.jsx
@@ -5,7 +5,7 @@ import {
} from 'recharts';
import { getPostSessions, getPostStats } from '../../../services/api';
import useChartColors from '../../../hooks/useChartColors.js';
-import { LLM_DRILL_TYPES, DRILL_LABELS, DOMAINS, DRILL_TO_DOMAIN } from './constants';
+import { LLM_DRILL_TYPES, DRILL_LABELS, DRILL_TO_DOMAIN, domainLabel } from './constants';
const RANGES = [
{ label: '7d', days: 7 },
@@ -24,7 +24,6 @@ const DOMAIN_HEX = {
imagination: '#22d3ee' // cyan-400
};
-const domainLabel = (key) => (key === 'other' ? 'Other' : DOMAINS[key]?.label || key);
const domainHex = (key) => DOMAIN_HEX[key] || '#a3a3a3';
const scoreColorClass = (score) =>
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsx
index 377b18bcbb..20b4b1009c 100644
--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx
+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx
@@ -1,10 +1,16 @@
import { useState, useEffect } from 'react';
-import { Zap, History, Settings, Play, Brain, BookOpen, Dumbbell, Timer, Radio } from 'lucide-react';
+import { Zap, History, Settings, Play, Brain, BookOpen, Dumbbell, Timer, Radio, Target, TrendingUp, TrendingDown, Minus } from 'lucide-react';
import { getProviders } from '../../../services/api';
import { isApiProvider } from '../../../utils/providers';
-import { DOMAINS, DRILL_TO_DOMAIN, DRILL_LABELS } from './constants';
+import { DOMAINS, DRILL_TO_DOMAIN, DRILL_LABELS, computeDomainAverages } from './constants';
-export default function PostSessionLauncher({ config, recentSessions, onStart, onViewHistory, onViewConfig, onViewMemory, onViewMorse }) {
+// Streak glyph tiers mirror DailyPostWidget so the launcher and dashboard agree.
+const streakGlyph = (streak) => (streak >= 7 ? '🔥' : streak >= 3 ? '⚡' : '✨');
+
+const scoreColorClass = (score) =>
+ score >= 80 ? 'text-port-success' : score >= 50 ? 'text-port-warning' : 'text-port-error';
+
+export default function PostSessionLauncher({ config, recentSessions, stats, statsWeek, onStart, onViewHistory, onViewConfig, onViewMemory, onViewMorse }) {
const [tags, setTags] = useState({ sleep: '', caffeine: '', stress: '' });
const [mode, setMode] = useState('test'); // 'test' | 'train'
const [providers, setProviders] = useState([]);
@@ -31,6 +37,14 @@ export default function PostSessionLauncher({ config, recentSessions, onStart, o
const llmProviderId = config.llmDrills?.providerId || null;
const llmModel = config.llmDrills?.model || null;
+ function buildCleanTags() {
+ const cleanTags = {};
+ for (const [k, v] of Object.entries(tags)) {
+ if (v.trim()) cleanTags[k] = v.trim();
+ }
+ return cleanTags;
+ }
+
function handleStart() {
const mathConfigs = enabledMathDrills.map(([type, cfg]) => ({
type,
@@ -56,11 +70,7 @@ export default function PostSessionLauncher({ config, recentSessions, onStart, o
}));
const drillConfigs = [...mathConfigs, ...llmConfigs];
- const cleanTags = {};
- for (const [k, v] of Object.entries(tags)) {
- if (v.trim()) cleanTags[k] = v.trim();
- }
- onStart(drillConfigs, cleanTags, mode === 'train');
+ onStart(drillConfigs, buildCleanTags(), mode === 'train');
}
// Build domain → enabled drills map for quick session
@@ -111,16 +121,62 @@ export default function PostSessionLauncher({ config, recentSessions, onStart, o
drillConfigs.push(drillConfig);
}
- const cleanTags = {};
- for (const [k, v] of Object.entries(tags)) {
- if (v.trim()) cleanTags[k] = v.trim();
- }
- onStart(drillConfigs, cleanTags, mode === 'train');
+ onStart(drillConfigs, buildCleanTags(), mode === 'train');
+ }
+
+ // Focused practice on a single domain: run every enabled drill in that domain
+ // (not one random pick, unlike the balanced quick session) so the weakest
+ // domain gets a substantive workout.
+ function handleFocusDomain(domainKey) {
+ const drills = enabledDomains[domainKey];
+ if (!drills || drills.length === 0) return;
+ const domain = DOMAINS[domainKey];
+ const drillConfigs = drills.map(({ type, cfg, source }) => {
+ const drillConfig = {
+ type,
+ domain: domainKey,
+ config: source === 'math'
+ ? {
+ steps: cfg.steps,
+ count: cfg.count,
+ maxDigits: cfg.maxDigits,
+ subtrahend: cfg.subtrahend,
+ startRange: cfg.startRange,
+ bases: cfg.bases,
+ maxExponent: cfg.maxExponent,
+ tolerancePct: cfg.tolerancePct,
+ }
+ : { count: cfg.count || 5 },
+ timeLimitSec: cfg.timeLimitSec || domain?.timeBudgetSec || 120,
+ };
+ if (source === 'llm') {
+ drillConfig.providerId = cfg.providerId || llmProviderId;
+ drillConfig.model = cfg.model || llmModel;
+ }
+ return drillConfig;
+ });
+ onStart(drillConfigs, buildCleanTags(), mode === 'train');
}
const hasAnyDrills = enabledMathDrills.length > 0 || enabledLlmDrills.length > 0;
const domainCount = Object.keys(enabledDomains).length;
+ // Analytics derived from the 30-day stats window. Streaks span all history.
+ const hasStats = stats && stats.sessionCount > 0;
+ const currentStreak = stats?.currentStreak ?? 0;
+ const longestStreak = stats?.longestStreak ?? 0;
+ const overall30 = stats?.overall ?? null;
+ const overall7 = statsWeek?.overall ?? null;
+ // Trend: 7-day average relative to the 30-day average. Needs both to exist.
+ const trendDelta = overall7 != null && overall30 != null ? overall7 - overall30 : null;
+
+ // Weakest domain = lowest-scoring domain that ALSO has enabled drills, so the
+ // one-click focus button always targets something the user can actually run.
+ const domainAverages = hasStats ? computeDomainAverages(stats.byDrill) : [];
+ const weakestDomain = domainAverages
+ .filter(d => enabledDomains[d.key])
+ .reduce((weakest, d) => (!weakest || d.score < weakest.score ? d : weakest), null);
+
return (
<div className="space-y-6 max-w-6xl mx-auto">
{/* Header */}
@@ -179,6 +235,75 @@ export default function PostSessionLauncher({ config, recentSessions, onStart, o
</div>
</div>
+ {/* Progress analytics — streak, 7-vs-30-day trend, weakest-domain focus.
+ Degrades to nothing until there's scored history to summarize. */}
+ {hasStats && (
+ <div className="space-y-4">
+ <div className="grid grid-cols-2 gap-3">
+ {/* Streak */}
+ <div className="bg-port-card border border-port-border rounded-lg p-4 flex items-center gap-3">
+ <div className="text-2xl" aria-hidden="true">{streakGlyph(currentStreak)}</div>
+ <div className="min-w-0">
+ <div className="text-xl font-bold text-white leading-tight">
+ {currentStreak} day{currentStreak !== 1 ? 's' : ''}
+ </div>
+ <div className="text-xs text-gray-500 truncate">
+ {currentStreak > 0 ? 'Current streak' : 'No streak yet'}
+ {longestStreak > 0 && ` · best ${longestStreak}`}
+ </div>
+ </div>
+ </div>
+ {/* 7-day trend vs 30-day baseline */}
+ <div className="bg-port-card border border-port-border rounded-lg p-4">
+ <div className="flex items-center justify-between gap-2">
+ <div className="min-w-0">
+ <div className={`text-xl font-bold leading-tight ${overall7 != null ? scoreColorClass(overall7) : 'text-gray-500'}`}>
+ {overall7 != null ? overall7 : '—'}
+ </div>
+ <div className="text-xs text-gray-500">7-day avg</div>
+ </div>
+ {trendDelta != null && (
+ <div className={`flex items-center gap-0.5 text-sm font-medium shrink-0 ${
+ trendDelta > 0 ? 'text-port-success' : trendDelta < 0 ? 'text-port-error' : 'text-gray-400'
+ }`}>
+ {trendDelta > 0 ? <TrendingUp size={16} /> : trendDelta < 0 ? <TrendingDown size={16} /> : <Minus size={16} />}
+ {trendDelta > 0 ? '+' : ''}{trendDelta}
+ </div>
+ )}
+ </div>
+ {overall30 != null && (
+ <div className="text-xs text-gray-600 mt-1">vs {overall30} over 30 days</div>
+ )}
+ </div>
+ </div>
+
+ {/* Weakest-domain callout + one-click focused practice */}
+ {weakestDomain && (
+ <div className="bg-port-card border border-port-border rounded-lg p-4 flex flex-col sm:flex-row sm:items-center gap-3">
+ <div className="flex items-start gap-3 min-w-0 flex-1">
+ <Target size={18} className={`mt-0.5 shrink-0 ${DOMAINS[weakestDomain.key]?.color || 'text-port-warning'}`} />
+ <div className="min-w-0">
+ <div className="text-sm text-white">
+ Lowest domain this month:{' '}
+ <span className={`font-semibold ${DOMAINS[weakestDomain.key]?.color || 'text-white'}`}>{weakestDomain.label}</span>
+ {' — '}
+ <span className={`font-mono ${scoreColorClass(weakestDomain.score)}`}>{weakestDomain.score} avg</span>
+ </div>
+ <div className="text-xs text-gray-500">Focus a short session here to bring it up.</div>
+ </div>
+ </div>
+ <button
+ onClick={() => handleFocusDomain(weakestDomain.key)}
+ className="shrink-0 flex items-center justify-center gap-2 px-4 py-2 bg-port-warning/20 hover:bg-port-warning/30 text-port-warning border border-port-warning/40 rounded-lg text-sm font-medium transition-colors"
+ >
+ <Target size={14} />
+ Practice {weakestDomain.label}
+ </button>
+ </div>
+ )}
+ </div>
+ )}
+
{/* Mode Toggle */}
<div className="bg-port-card border border-port-border rounded-lg p-4">
<h3 className="text-sm font-medium text-gray-400 mb-3">Session Mode</h3>
diff --git a/client/src/components/meatspace/post/constants.js b/client/src/components/meatspace/post/constants.js
index aac1d3e695..054e3fd310 100644
--- a/client/src/components/meatspace/post/constants.js
+++ b/client/src/components/meatspace/post/constants.js
@@ -83,6 +83,33 @@ export const DRILL_LABELS = {
'reframe': 'Reframe',
};
+// Human-readable label for a domain key. `other` collects drills whose type
+// isn't mapped to a DOMAINS bucket (e.g. legacy/removed drill types).
+export const domainLabel = (key) => (key === 'other' ? 'Other' : DOMAINS[key]?.label || key);
+
+// Derive per-domain averages from getPostStats().byDrill, which is keyed
+// `${task.module}:${task.type}`. task.module is COARSE (`mental-math`,
+// `llm-drills`, `memory`) so the real fine-grained domain must come from the
+// drill TYPE via DRILL_TO_DOMAIN — NOT the module segment. The per-domain score
+// is the mean of that domain's per-drill averages. Returns an array of
+// { key, label, score } sorted by score descending (strongest first).
+export function computeDomainAverages(byDrill = {}) {
+ const groups = {};
+ for (const [key, score] of Object.entries(byDrill)) {
+ const type = key.slice(key.indexOf(':') + 1);
+ const domain = DRILL_TO_DOMAIN[type] || 'other';
+ if (!groups[domain]) groups[domain] = [];
+ groups[domain].push(score);
+ }
+ return Object.entries(groups)
+ .map(([key, scores]) => ({
+ key,
+ label: domainLabel(key),
+ score: Math.round(scores.reduce((a, b) => a + b, 0) / scores.length),
+ }))
+ .sort((a, b) => b.score - a.score);
+}
+
// Difficulty badge color helper
export const getDifficultyColor = (difficulty) => {
if (difficulty === 'hard') return 'bg-port-error/20 text-port-error';
diff --git a/client/src/components/meatspace/post/constants.test.js b/client/src/components/meatspace/post/constants.test.js
new file mode 100644
index 0000000000..4291f2abe8
--- /dev/null
+++ b/client/src/components/meatspace/post/constants.test.js
@@ -0,0 +1,61 @@
+import { describe, it, expect } from 'vitest';
+import { computeDomainAverages, domainLabel } from './constants';
+
+describe('domainLabel', () => {
+ it('maps known domain keys to their human label', () => {
+ expect(domainLabel('math')).toBe('Mental Math');
+ expect(domainLabel('verbal')).toBe('Verbal Agility');
+ });
+
+ it('labels the catch-all bucket "Other"', () => {
+ expect(domainLabel('other')).toBe('Other');
+ });
+
+ it('falls back to the raw key for unknown domains', () => {
+ expect(domainLabel('mystery')).toBe('mystery');
+ });
+});
+
+describe('computeDomainAverages', () => {
+ it('derives the domain from the drill TYPE, not the coarse module segment', () => {
+ // pun-wordplay lives under the `wordplay` domain even though its coarse
+ // module is `llm-drills`; multiplication is `math`.
+ const result = computeDomainAverages({
+ 'mental-math:multiplication': 90,
+ 'llm-drills:pun-wordplay': 60,
+ });
+ const byKey = Object.fromEntries(result.map(d => [d.key, d]));
+ expect(byKey.math.score).toBe(90);
+ expect(byKey.math.label).toBe('Mental Math');
+ expect(byKey.wordplay.score).toBe(60);
+ expect(byKey.wordplay.label).toBe('Wordplay');
+ });
+
+ it('averages multiple drills within the same domain (rounded)', () => {
+ // pun-wordplay + word-association are both `wordplay`: mean(60, 71) = 65.5 → 66
+ const result = computeDomainAverages({
+ 'llm-drills:pun-wordplay': 60,
+ 'llm-drills:word-association': 71,
+ });
+ expect(result).toEqual([{ key: 'wordplay', label: 'Wordplay', score: 66 }]);
+ });
+
+ it('sorts strongest domain first', () => {
+ const result = computeDomainAverages({
+ 'mental-math:multiplication': 40,
+ 'llm-drills:pun-wordplay': 90,
+ 'llm-drills:story-recall': 70,
+ });
+ expect(result.map(d => d.key)).toEqual(['wordplay', 'verbal', 'math']);
+ });
+
+ it('buckets unmapped drill types under "other"', () => {
+ const result = computeDomainAverages({ 'legacy:removed-drill': 50 });
+ expect(result).toEqual([{ key: 'other', label: 'Other', score: 50 }]);
+ });
+
+ it('returns an empty list for empty stats', () => {
+ expect(computeDomainAverages({})).toEqual([]);
+ expect(computeDomainAverages()).toEqual([]);
+ });
+});
diff --git a/client/src/components/meatspace/tabs/PostTab.jsx b/client/src/components/meatspace/tabs/PostTab.jsx
index c63b569194..460c59ccb5 100644
--- a/client/src/components/meatspace/tabs/PostTab.jsx
+++ b/client/src/components/meatspace/tabs/PostTab.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Loader } from 'lucide-react';
-import { getPostConfig, getPostSessions } from '../../../services/api';
+import { getPostConfig, getPostSessions, getPostStats } from '../../../services/api';
import { usePostSession } from '../../../hooks/usePostSession';
import PostSessionLauncher from '../post/PostSessionLauncher';
import PostDrillRunner from '../post/PostDrillRunner';
@@ -20,6 +20,8 @@ export default function PostTab({ tab = 'launcher', subtab }) {
const navigate = useNavigate();
const [config, setConfig] = useState(null);
const [recentSessions, setRecentSessions] = useState([]);
+ const [stats, setStats] = useState(null);
+ const [statsWeek, setStatsWeek] = useState(null);
const [sessionTags, setSessionTags] = useState({});
const [sessionView, setSessionView] = useState(null);
const session = usePostSession();
@@ -32,12 +34,16 @@ export default function PostTab({ tab = 'launcher', subtab }) {
}, [tab, subtab]);
async function loadData() {
- const [cfg, sessions] = await Promise.all([
+ const [cfg, sessions, st, stWeek] = await Promise.all([
getPostConfig().catch(() => null),
- getPostSessions().catch(() => [])
+ getPostSessions().catch(() => []),
+ getPostStats(30).catch(() => null),
+ getPostStats(7).catch(() => null)
]);
setConfig(cfg);
setRecentSessions(sessions || []);
+ setStats(st);
+ setStatsWeek(stWeek);
}
async function handleStart(drillConfigs, tags, training = false) {
@@ -174,6 +180,8 @@ export default function PostTab({ tab = 'launcher', subtab }) {
<PostSessionLauncher
config={config}
recentSessions={recentSessions}
+ stats={stats}
+ statsWeek={statsWeek}
onStart={handleStart}
onViewHistory={() => navigate('/post/history')}
onViewConfig={() => navigate('/post/config')}