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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Merge remote-tracking branch 'origin/main' into next/issue-2006
Adam Eivy3079232cc551
diff --cc .changelog/NEXT.mdindex ef24495dae,340322a3dd..7644a28dd0--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@@ -29,7 -29,7 +29,8 @@@- **[issue-1992] Opt-in adaptive difficulty for mental-math POST drills.** Math drill params (`steps` / `maxDigits` / `maxExponent` / estimation `tolerancePct`) were fixed values from config that never responded to how you were doing. A new **Adaptive difficulty** toggle in the Drill Configuration screen (default OFF, so existing installs are unchanged) makes each math drill nudge its primary difficulty knob from your recent scored performance: sustained high accuracy (≥90% over enough sessions) bumps it one step harder, repeated misses (≤50%) ease it back, all clamped to safe min/max bounds — and it won't move until it has enough scored samples to trust. The adjustment is a pure, unit-tested policy (`server/lib/postAdaptive.js`) applied server-side at drill-generation time, so manual config still wins whenever Adaptive is off. It's fully transparent: each math drill card shows the effective difficulty (e.g. "Adaptive: max digits 2 → 3 (harder · 94% recent)") via a new `GET /post/adaptive-preview` endpoint, so it's never a black box. (`server/lib/postAdaptive.js`, `server/services/meatspacePost.js`, `client/src/components/meatspace/post/PostDrillConfig.jsx`, Closes #1992)- **[issue-1993] New deterministic cognitive drills — N-Back, Digit Span, and Stroop.** POST spanned math, LLM, and memory drills but was missing classic non-LLM cognitive-training exercises. A new **Cognitive** domain adds three provider-free drills: **N-Back** (1/2/3-back working-memory matching), **Digit Span** (forward/backward sequence recall), and **Stroop** (name the ink color, not the word — attention/inhibition). Each is configurable in the Drill Configuration screen, playable in both Test and Train modes via a dedicated interactive runner, scored, and saved to your training history alongside every other drill — with **zero AI provider calls**. Scoring is recomputed server-side from the generated drill (never trusting the client) using a shared 80% accuracy + 20% speed blend, and the drills are picked up by Full POST and Quick 5 Min automatically. (Closes #1993)- **[issue-1994] Optional daily reminder for your POST session.** POST is meant to be a daily habit, but nothing ever nudged you to actually do it. A new **Daily Reminder** toggle in the Drill Configuration screen — off by default — lets you pick a time of day; if you haven't completed a session by then, you'll get a single in-app notification reminding you, and it stays silent once you've already practiced that day. Turning it off stops all nudges immediately. No AI calls are involved, and changing the time takes effect right away without a restart. (Closes #1994)+ - **[issue-2008] Cognitive drills (N-Back, Digit Span, Stroop) no longer show a "Time Limit" field that did nothing.** These three drills are self-paced/stimulus-driven and never counted down against it, unlike Mental Math and Wit & Memory drills, which genuinely do enforce their time limit. The dead field is removed from the Drill Configuration screen and drill summaries, along with the unreachable `stimulusMs`/`showMs` config pass-through (no UI ever set them — the drills always used their built-in pacing anyway). No behavior change to how the drills actually play. (Closes #2008)+- **[issue-2006] Three more Cognitive drills — Schulte Table, Mental Rotation, and Reaction Time.** Rounds out the Cognitive domain from #1993 with the three follow-up exercises: **Schulte Table** (scan a shuffled numbered grid and tap 1, 2, 3... in order — visual attention and scan speed), **Mental Rotation** (pick which of four shapes is the reference shape rotated, not mirrored — spatial reasoning), and **Reaction Time** (simple or choice reaction-time baseline, with a false-start penalty for jumping the gun). All three are configurable, playable in Test and Train modes, scored, and saved to your training history alongside the rest of POST — with zero AI provider calls, same as the rest of the Cognitive domain.## Media Generationdiff --cc client/src/components/meatspace/post/PostDrillConfig.jsxindex 382abef646,8f3169a134..fac1df0a56--- a/client/src/components/meatspace/post/PostDrillConfig.jsx+++ b/client/src/components/meatspace/post/PostDrillConfig.jsx@@@ -171,47 -175,9 +175,43 @@@ const COGNITIVE_DRILL_META =desc: 'Name the ink color of a color-word — attention & inhibition',fields: [{ key: 'count', label: 'Trials', type: 'number', min: 5, max: 40 },- { key: 'timeLimitSec', label: 'Time Limit (sec)', type: 'number', min: 10, max: 300 },],- defaults: { enabled: true, count: 15, timeLimitSec: 60 },+ defaults: { enabled: true, count: 15 },},+ 'schulte-table': {+ label: 'Schulte Table',+ desc: 'Scan a shuffled grid and tap 1, 2, 3... in order — visual attention & speed',+ fields: [+ { key: 'size', label: 'Grid Size (NxN)', type: 'number', min: 3, max: 7 },- { key: 'timeLimitSec', label: 'Time Limit (sec)', type: 'number', min: 10, max: 300 },+ ],- defaults: { enabled: true, size: 5, timeLimitSec: 120 },++ defaults: { enabled: true, size: 5 },+ },+ 'mental-rotation': {+ label: 'Mental Rotation',+ desc: 'Pick the shape that’s the same, just rotated — spatial reasoning',+ fields: [+ { key: 'count', label: 'Trials', type: 'number', min: 4, max: 20 },- { key: 'timeLimitSec', label: 'Time Limit (sec)', type: 'number', min: 10, max: 300 },+ ],- defaults: { enabled: true, count: 8, timeLimitSec: 120 },++ defaults: { enabled: true, count: 8 },+ },+ 'reaction-time': {+ label: 'Reaction Time',+ desc: 'React the instant a stimulus appears — processing speed baseline',+ fields: [+ { key: 'mode', label: 'Mode', type: 'select', options: [+ { value: 'simple', label: 'Simple' },+ { value: 'choice', label: 'Choice' },+ ] },+ { key: 'count', label: 'Trials', type: 'number', min: 5, max: 40 },+ { key: 'minDelayMs', label: 'Min Delay (ms)', type: 'number', min: 300, max: 5000 },+ { key: 'maxDelayMs', label: 'Max Delay (ms)', type: 'number', min: 300, max: 8000 },+ // Only meaningful in Choice mode (the generator ignores it for Simple),+ // but shown unconditionally — DrillCard has no per-field conditional+ // visibility and this mirrors how other fields already behave.+ { key: 'choices', label: 'Choices (Choice mode)', type: 'number', min: 2, max: 4 },- { key: 'timeLimitSec', label: 'Time Limit (sec)', type: 'number', min: 10, max: 300 },+ ],- defaults: { enabled: true, mode: 'simple', count: 15, minDelayMs: 1000, maxDelayMs: 3000, choices: 3, timeLimitSec: 90 },++ defaults: { enabled: true, mode: 'simple', count: 15, minDelayMs: 1000, maxDelayMs: 3000, choices: 3 },+ },};// String-valued cognitive config keys must NOT be coerced to Number on edit.diff --cc client/src/components/meatspace/post/PostSessionLauncher.jsxindex b5130d9c76,dc106381bf..1813e1a958--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx@@@ -49,26 -54,9 +54,24 @@@ export default function PostSessionLaundirection: cfg.direction,startLength: cfg.startLength,maxLength: cfg.maxLength,- showMs: cfg.showMs,count: cfg.count,+ size: cfg.size,+ mode: cfg.mode,+ minDelayMs: cfg.minDelayMs,+ maxDelayMs: cfg.maxDelayMs,+ choices: cfg.choices,});+ // Short "at a glance" summary chip per cognitive drill type, shown next to+ // its label in the launcher sidebar.+ function cognitiveSummary(type, cfg) {+ if (type === 'n-back') return `${cfg.n ?? 2}-back`;+ if (type === 'digit-span') return `${cfg.startLength ?? 3}–${cfg.maxLength ?? 8}`;+ if (type === 'schulte-table') return `${cfg.size ?? 5}×${cfg.size ?? 5}`;+ if (type === 'reaction-time') return `${cfg.count ?? 15} trials (${cfg.mode ?? 'simple'})`;+ return cfg.count ? `${cfg.count} trials` : '';+ }+function buildCleanTags() {const cleanTags = {};for (const [k, v] of Object.entries(tags)) {@@@ -499,8 -488,7 +503,7 @@@<div key={type} className="flex items-center justify-between text-sm"><span className="text-white">{DRILL_LABELS[type] || type}</span><span className="text-gray-500">- {type === 'n-back' ? `${cfg.n ?? 2}-back` : type === 'digit-span' ? `${cfg.startLength ?? 3}–${cfg.maxLength ?? 8}` : cfg.count ? `${cfg.count} trials` : ''}+ {cognitiveSummary(type, cfg)}- {cfg.timeLimitSec ? ` · ${cfg.timeLimitSec}s` : ''}</span></div>))}diff --cc server/lib/postValidation.jsindex adfbd8d830,54dfb4b214..dea7aa0f3c--- a/server/lib/postValidation.js+++ b/server/lib/postValidation.js@@@ -76,19 -73,16 +76,22 @@@ const drillTypeConfigSchema = z.object(// `length`'s effective floor is `n + 5` (dynamic, up to 8) inside the// generator — Zod can't express a cross-field minimum here, so this schema// keeps a conservative fixed floor of 6 and lets the generator clamp up.+ // (timeLimitSec above is validated but NOT enforced for these drill types —+ // they're self-paced/stimulus-driven; see PostCognitiveDrillRunner.jsx.)+ // No stimulusMs/showMs here — no UI ever set them (issue #2008), so they were+ // dead validated-but-unreachable knobs; the generators (meatspacePostCognitive.js)+ // keep their own internal defaults regardless.n: z.number().int().min(1).max(3).optional(),length: z.number().int().min(6).max(60).optional(),- stimulusMs: z.number().int().min(1000).max(5000).optional(),direction: z.enum(['forward', 'backward']).optional(),startLength: z.number().int().min(3).max(9).optional(),- maxLength: z.number().int().min(3).max(12).optional()+ maxLength: z.number().int().min(3).max(12).optional(),- showMs: z.number().int().min(400).max(4000).optional(),+ // --- Cognitive drill knobs (schulte-table / mental-rotation / reaction-time) ---+ size: z.number().int().min(3).max(7).optional(),+ mode: z.enum(['simple', 'choice']).optional(),+ minDelayMs: z.number().int().min(300).max(5000).optional(),+ maxDelayMs: z.number().int().min(300).max(8000).optional(),+ choices: z.number().int().min(2).max(4).optional()});// Task result within a sessiondiff --cc server/services/meatspacePost.jsindex 70f26032b6,4d958b01aa..ba1f922e9e--- a/server/services/meatspacePost.js+++ b/server/services/meatspacePost.js@@@ -45,12 -47,9 +47,12 @@@ const DEFAULT_CONFIG =cognitive: {enabled: true,drillTypes: {- 'n-back': { enabled: true, n: 2, length: 20, timeLimitSec: 90 },- 'digit-span': { enabled: true, direction: 'forward', startLength: 3, maxLength: 8, timeLimitSec: 120 },- 'stroop': { enabled: true, count: 15, timeLimitSec: 60 },- 'schulte-table': { enabled: true, size: 5, timeLimitSec: 120 },- 'mental-rotation': { enabled: true, count: 8, timeLimitSec: 120 },- 'reaction-time': { enabled: true, mode: 'simple', count: 15, minDelayMs: 1000, maxDelayMs: 3000, choices: 3, timeLimitSec: 90 }+ 'n-back': { enabled: true, n: 2, length: 20 },+ 'digit-span': { enabled: true, direction: 'forward', startLength: 3, maxLength: 8 },- 'stroop': { enabled: true, count: 15 }++ 'stroop': { enabled: true, count: 15 },++ 'schulte-table': { enabled: true, size: 5 },++ 'mental-rotation': { enabled: true, count: 8 },++ 'reaction-time': { enabled: true, mode: 'simple', count: 15, minDelayMs: 1000, maxDelayMs: 3000, choices: 3 }}},sessionModules: ['mental-math'],diff --cc server/services/meatspacePostCognitive.jsindex 40c4bb0c7d,a46aa0e9c0..23c79cac59--- a/server/services/meatspacePostCognitive.js+++ b/server/services/meatspacePostCognitive.js@@@ -207,90 -148,6 +207,90 @@@ export function generateStroop(config};}+/**+ * Schulte table: a size x size grid holding the numbers 1..size*size shuffled+ * into random cells. The player scans the grid and taps 1, 2, 3... in order —+ * pure visual-attention/scan-speed, no recall required.+ */+export function generateSchulteTable(config = {}) {+ const size = clampInt(config.size, 3, 7, 5);+ const total = size * size;+ const numbers = Array.from({ length: total }, (_, i) => i + 1);+ const cells = shuffle(numbers);+ return {+ type: 'schulte-table',- config: { size, timeLimitSec: clampInt(config.timeLimitSec, 10, 600, 120) },++ config: { size },+ cells,+ };+}++/**+ * Mental rotation: each trial shows a reference shape (an asymmetric+ * grid-cell footprint) and 4 candidate shapes — exactly one is the reference+ * rotated (0/90/180/270deg); the rest are mirrored (reflected) at a random+ * rotation, so they share a silhouette "feel" without being a true rotation+ * match. `correctIndex` is the answer key; scoring recomputes it independently+ * from `shape`/`rotationSteps`, never trusting the stored index round-trip.+ */+export function generateMentalRotation(config = {}) {+ const count = clampInt(config.count, 4, 20, 8);+ const shapeKeys = Object.keys(ROTATION_SHAPES);+ const trials = [];+ for (let i = 0; i < count; i++) {+ const shapeKey = pick(shapeKeys);+ const baseCells = ROTATION_SHAPES[shapeKey];+ const rotationSteps = 1 + Math.floor(Math.random() * 3); // 1-3 (nonzero: 90/180/270deg)+ const correctCells = rotateCells(baseCells, rotationSteps);++ const options = [{ cells: correctCells, isMatch: true }];+ let guard = 0;+ while (options.length < 4 && guard < 50) {+ guard++;+ const mirrored = mirrorCells(rotateCells(baseCells, Math.floor(Math.random() * 4)));+ const key = cellsKey(mirrored);+ if (options.some(o => cellsKey(o.cells) === key)) continue;+ options.push({ cells: mirrored, isMatch: false });+ }+ const shuffled = shuffle(options);+ const correctIndex = shuffled.findIndex(o => o.isMatch);++ trials.push({+ shape: shapeKey,+ target: normalizeCells(baseCells),+ options: shuffled.map(o => o.cells),+ correctIndex,+ });+ }+ return { type: 'mental-rotation', config: { count, gridSize: 4 }, trials };+}++/**+ * Reaction time: simple (react the instant a stimulus appears) or choice+ * (react to WHICH of `choices` stimuli appeared) RT baseline. Each trial's+ * `delayMs` is randomized so the stimulus onset can't be anticipated.+ */+export function generateReactionTime(config = {}) {+ const mode = config.mode === 'choice' ? 'choice' : 'simple';+ const count = clampInt(config.count, 5, 40, 15);+ const minDelayMs = clampInt(config.minDelayMs, 300, 5000, 1000);+ const maxDelayMs = Math.max(minDelayMs, clampInt(config.maxDelayMs, 300, 8000, 3000));+ // `choices` is only meaningful (and only schema-valid, min 2) in choice mode —+ // simple mode omits it entirely rather than persisting an out-of-range value+ // like 1, which session submission's `choices: min(2)` schema would reject.+ const choices = mode === 'choice' ? clampInt(config.choices, 2, 4, 3) : undefined;++ const trials = [];+ for (let i = 0; i < count; i++) {+ const delayMs = minDelayMs + Math.floor(Math.random() * (maxDelayMs - minDelayMs + 1));+ const trial = { delayMs };+ if (mode === 'choice') trial.target = Math.floor(Math.random() * choices);+ trials.push(trial);+ }+ const trialConfig = { mode, count, minDelayMs, maxDelayMs };+ if (choices !== undefined) trialConfig.choices = choices;+ return { type: 'reaction-time', config: trialConfig, trials };+}+export function generateCognitiveDrill(type, config = {}) {switch (type) {case 'n-back':