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
fix: persist wordplay per-question breakdown from the in-session runner too
[._.]/ Adam Eivy85f28e20d2e0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 84c1ba017c..366b5e027c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -17,7 +17,7 @@- **[issue-2101] POST config & UX polish: Morse in the sidebar, config presets, keyboard-accessible history, pausable transitions.** Morse is now a full nav entry under the POST sidebar section (previously reachable only via the launcher or ⌘K). The drill config page gained one-click presets — "Balanced daily", "Math focus", "Cognitive focus", and "Everything (local-only)" — plus per-group "Enable all / Disable all" buttons on the Mental Math, Cognitive, and LLM sections (bulk-enabling LLM drills is blocked until you've picked an AI provider). History session rows now expand/collapse with the keyboard (Enter/Space), not just a mouse click. The inter-drill transition screen gained a Pause/Resume control and pauses its 3-second auto-advance countdown while you're hovering or focused on it, so you're never yanked into the next drill mid-read.- **[issue-2097] The Wordplay tab now tracks your practice.** Completing a round of Compound Chain, Bridge Word, Double Meaning, or Idiom Twist in the standalone Wordplay tab used to score every response and then throw the result away — closing the tab meant the practice never happened. Each completed round now logs to your training history (same log the in-session drills and streak use), so Wordplay accuracy shows up in training stats and counts toward your practice streak. The standalone tab and the in-session drill runner now also share one scoring path for these four types, and a bug that always logged 0% accuracy for in-session LLM-drill training rounds (regardless of actual performance) is fixed too.-- **[issue-2114] Wordplay training-log entries now keep the per-question breakdown, not just the round total.** Follow-up to #2097: each completed Wordplay round previously logged only the aggregate question/correct counts. It now also stores each question's prompt/response, score, feedback, and whether it cleared the correct threshold — so a future progress dashboard can trend which individual wordplay prompts you miss. Entries without a breakdown (older rows, and other training modules) remain fully valid.+- **[issue-2114] Wordplay training-log entries now keep the per-question breakdown, not just the round total.** Follow-up to #2097: each completed Wordplay round — whether from the standalone Wordplay tab or a wordplay drill inside an in-session training session — previously logged only the aggregate question/correct counts. It now also stores each question's prompt/response, score, feedback, and whether it cleared the correct threshold — so a future progress dashboard can trend which individual wordplay prompts you miss. Bridge Word's persisted prompt is now the clue set it actually showed you (it previously had no readable prompt at all). Entries without a breakdown (older rows, and other training modules) remain fully valid.- **[issue-2094] Scores now separate how *accurate* you were from how *fast* — and stop rewarding not answering.** Every scored drill now records accuracy (of the answers you actually gave), completion (how much of a timed drill you reached), and average speed as distinct numbers alongside the blended headline score, so the session and history views show accuracy and speed side by side instead of one merged figure. Running out of time on a timed drill now lowers *completion*, not accuracy — an unreached question no longer counts as wrong. Adaptive difficulty follows your accuracy (with a guard that skips adjusting when you barely started a drill), so a fast-but-sloppy run and a slow-but-careful run now push difficulty in different, correct directions. The n-back drill is rescored with proper signal-detection: never pressing now lands at ~50% (chance) instead of the old ~70% freebie, and always-pressing is penalized for its false alarms. The reaction-time drill is now scored on your median reaction speed (false starts invalidate their trial) with your best time tracked too. Older saved sessions without the new fields still display and chart correctly.- **[issue-2093] Session results now teach from mistakes on every drill, not just AI ones.** Expanding a math, memory, or cognitive (n-back, digit-span, Stroop, Schulte table, mental rotation, reaction time) drill row on the results screen used to do nothing — only AI-scored drills showed a review. Every drill row now expands into a per-question/per-trial breakdown: a "missed items" summary up top, then a type-appropriate view — a prompt/answer/expected table for math and memory, letter-sequence hit/miss/false-alarm marks for n-back, shown-vs-recalled digits for digit span, word/ink/your-answer for Stroop, and per-trial timing with slow-response outliers flagged for the pure speed drills. Unanswered questions are shown distinctly from wrong ones. The same review now also appears when you expand a past session in History.- **Multiplication drills now ramp up instead of starting hard.** The mental-math multiplication drill used to open at a fixed 2-digit × 2-digit difficulty (e.g. `566 × 191`) for everyone. It now climbs a mastery-gated ladder — `1×1` → `1×2` → `1×1×1` → `2×2` → … — starting at single-digit × single-digit and advancing to the next rung only after you answer a level quickly *and* accurately (≥90% correct within a per-rung speed target). The drill header and the config page show your current rung and per-level mastery. On by default; turn off "Progressive difficulty" on the Multiplication card to go back to the manual Max Digits setting.diff --git a/client/src/components/meatspace/post/PostLlmDrillRunner.jsx b/client/src/components/meatspace/post/PostLlmDrillRunner.jsxindex 39b6c58cc9..ac7e49c672 100644--- a/client/src/components/meatspace/post/PostLlmDrillRunner.jsx+++ b/client/src/components/meatspace/post/PostLlmDrillRunner.jsx@@ -104,13 +104,23 @@ export default function PostLlmDrillRunner({ drill, timeLimitSec, drillIndex, dr} else if (drillType === 'verbal-fluency' || drillType === 'compound-chain' || drillType === 'alternative-uses') {responseObj = {questionIndex,+ // Compound Chain's root word (undefined/dropped for the other two+ // items-based types) — needed so a completed training round can+ // persist a readable per-question prompt (issue #2114), matching the+ // standalone WordplayTrainer tab's compound-chain result shape.+ prompt: currentPrompt?.rootWord,items: items,responseMs};} else {responseObj = {questionIndex,- prompt: currentPrompt?.prompt || currentPrompt?.setup || currentPrompt?.category || currentPrompt?.rootWord || currentPrompt?.word || currentPrompt?.idiom || '',+ // Bridge Word puzzles have no rootWord/word/idiom field, only `clues`+ // — without this fallback the persisted per-question prompt silently+ // fell through to '' for this mode (issue #2114, same bug fixed in+ // the standalone WordplayTrainer tab).+ prompt: currentPrompt?.prompt || currentPrompt?.setup || currentPrompt?.category || currentPrompt?.rootWord || currentPrompt?.word || currentPrompt?.idiom+ || (currentPrompt?.clues || []).join(' / ') || '',response: inputValue.trim(),responseMs};diff --git a/client/src/components/meatspace/post/PostLlmDrillRunner.test.jsx b/client/src/components/meatspace/post/PostLlmDrillRunner.test.jsxindex df8865dd09..31739d0e77 100644--- a/client/src/components/meatspace/post/PostLlmDrillRunner.test.jsx+++ b/client/src/components/meatspace/post/PostLlmDrillRunner.test.jsx@@ -78,6 +78,34 @@ describe('PostLlmDrillRunner — wordplay types render via the shared WordplayDr});});+describe('PostLlmDrillRunner — per-question prompt for training-log persistence (issue #2114)', () => {+ // Regression: Bridge Word puzzles carry only `clues`, not rootWord/word/idiom+ // — the prompt fallback chain used to fall through to '' for this mode, so+ // a completed in-session round's persisted training-log breakdown couldn't+ // identify which puzzle a missed answer belonged to.+ it('builds a readable prompt for a completed Bridge Word round from its clue set', async () => {+ const onComplete = vi.fn();+ render(+ <PostLlmDrillRunner+ drill={{ type: 'bridge-word', puzzles: [{ clues: ['news___', '___back'], answer: 'paper' }] }}+ timeLimitSec={60}+ drillIndex={0}+ drillCount={1}+ onComplete={onComplete}+ isTraining={false}+ />+ );++ const input = screen.getByPlaceholderText(/bridge word is/i);+ fireEvent.change(input, { target: { value: 'paper' } });+ fireEvent.click(screen.getByText('Submit'));++ await waitFor(() => expect(onComplete).toHaveBeenCalled());+ const drillResult = onComplete.mock.calls[0][0];+ expect(drillResult.responses[0]).toMatchObject({ prompt: 'news___ / ___back', response: 'paper' });+ });+});+describe('PostLlmDrillRunner — training-mode scoring path', () => {it('scores a wordplay type through the shared scoreWordplayResponse core', async () => {scorePostLlmDrill.mockResolvedValue({diff --git a/client/src/hooks/usePostSession.js b/client/src/hooks/usePostSession.jsindex c38892a5b5..3fd7607991 100644--- a/client/src/hooks/usePostSession.js+++ b/client/src/hooks/usePostSession.js@@ -1,7 +1,10 @@import { useState, useCallback, useRef } from 'react';import { generatePostDrill, submitPostSession, scorePostLlmDrill, submitTrainingEntry } from '../services/api';import toast from '../components/ui/Toast';-import { LLM_DRILL_TYPES, MEMORY_DRILL_TYPES, DRILL_TO_DOMAIN, countLlmCorrect } from '../components/meatspace/post/constants';+import {+ LLM_DRILL_TYPES, MEMORY_DRILL_TYPES, DRILL_TO_DOMAIN, countLlmCorrect,+ WORDPLAY_LLM_DRILL_TYPES, LLM_TRAINING_CORRECT_THRESHOLD,+} from '../components/meatspace/post/constants';function computeSessionScoreFromResults(results) {if (!results.length) return 0;@@ -325,12 +328,31 @@ export function usePostSession() {const correctCount = isLlmDrill? countLlmCorrect(r.responses || []): (r.questions?.filter(q => q.correct)?.length ?? 0);+ // Per-question breakdown (issue #2114) — the standalone Wordplay tab+ // (WordplayTrainer.jsx) already threads this through; extend the same+ // breakdown to the in-session runner's completed wordplay rounds so+ // both entry points populate it, not just the standalone tab. Scoped+ // to the four wordplay types since those are the only ones whose+ // `r.responses` entries (post-completeLlmDrill) carry a prompt/response+ // shape a future dashboard could render per-question.+ const questions = WORDPLAY_LLM_DRILL_TYPES.includes(r.type)+ ? (r.responses || []).map(resp => ({+ prompt: resp.prompt,+ response: resp.response,+ items: resp.items,+ responseMs: resp.responseMs,+ score: resp.llmScore != null ? resp.llmScore : undefined,+ feedback: resp.llmFeedback,+ correct: (resp.llmScore ?? 0) >= LLM_TRAINING_CORRECT_THRESHOLD,+ }))+ : undefined;await submitTrainingEntry({module: r.module,drillType: r.type,questionCount,correctCount,totalMs: r.totalMs || 0,+ ...(questions ? { questions } : {}),}).catch(() => {});}toast.success('Training session logged');diff --git a/client/src/hooks/usePostSession.test.js b/client/src/hooks/usePostSession.test.jsindex 2bcd96337e..83c41a5882 100644--- a/client/src/hooks/usePostSession.test.js+++ b/client/src/hooks/usePostSession.test.js@@ -345,3 +345,94 @@ describe('usePostSession — LLM training-log correctCount (issue #2097)', () =>}));});});++describe('usePostSession — LLM training-log per-question breakdown (issue #2114)', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ // Follow-up to #2097: the standalone Wordplay tab already threads a+ // per-question breakdown through submitTrainingEntry (WordplayTrainer.jsx).+ // The in-session runner completes the same four drill types through+ // completeLlmDrill/saveSession here, and must populate the same field so a+ // completed in-session wordplay round isn't missing the breakdown.+ it('threads a per-question breakdown for a completed in-session wordplay drill', async () => {+ generatePostDrill.mockResolvedValue({+ type: 'compound-chain', config: {}, challenges: [{ rootWord: 'fire' }],+ });+ scorePostLlmDrill.mockResolvedValue({+ score: 90,+ questions: [{ questionIndex: 0, prompt: 'fire', items: ['firehouse'], responseMs: 500, llmScore: 90, llmFeedback: 'Nice!' }],+ evaluation: { overallScore: 90, scores: [{ score: 90, feedback: 'Nice!' }] },+ });+ submitTrainingEntry.mockResolvedValue({});++ const { result } = renderHook(() => usePostSession());++ await act(async () => {+ await result.current.startSession([{ type: 'compound-chain', config: {}, timeLimitSec: 120 }], true);+ });++ await act(async () => {+ await result.current.completeLlmDrill({+ module: 'llm-drills',+ type: 'compound-chain',+ config: {},+ drillData: {},+ responses: [{ questionIndex: 0, prompt: 'fire', items: ['firehouse'], responseMs: 500 }],+ totalMs: 5000,+ });+ });++ await act(async () => {+ await result.current.saveSession({});+ });++ expect(submitTrainingEntry).toHaveBeenCalledWith(expect.objectContaining({+ drillType: 'compound-chain',+ questions: [expect.objectContaining({+ prompt: 'fire', items: ['firehouse'], score: 90, feedback: 'Nice!', correct: true,+ })],+ }));+ });++ // Non-wordplay LLM drill types (word-association, story-recall, etc.) have+ // no dashboard use case yet and their `r.responses` shape isn't guaranteed+ // to carry a renderable prompt — scope the breakdown to WORDPLAY_LLM_DRILL_TYPES+ // only, same as the standalone tab.+ it('omits the questions field for a non-wordplay LLM drill type', async () => {+ generatePostDrill.mockResolvedValue({+ type: 'word-association', config: {}, prompts: ['x'],+ });+ scorePostLlmDrill.mockResolvedValue({+ score: 80,+ questions: [{ questionIndex: 0, response: 'y', llmScore: 80 }],+ evaluation: { overallScore: 80, scores: [{ score: 80 }] },+ });+ submitTrainingEntry.mockResolvedValue({});++ const { result } = renderHook(() => usePostSession());++ await act(async () => {+ await result.current.startSession([{ type: 'word-association', config: {}, timeLimitSec: 120 }], true);+ });++ await act(async () => {+ await result.current.completeLlmDrill({+ module: 'llm-drills',+ type: 'word-association',+ config: {},+ drillData: {},+ responses: [{ questionIndex: 0, response: 'y', responseMs: 500 }],+ totalMs: 3000,+ });+ });++ await act(async () => {+ await result.current.saveSession({});+ });++ const entry = submitTrainingEntry.mock.calls[0][0];+ expect(entry).not.toHaveProperty('questions');+ });+});