Skip to content

feat: comprehensive cognitive battery (19 tasks)#99

Open
jodeleeuw wants to merge 96 commits intomainfrom
cognitive-battery
Open

feat: comprehensive cognitive battery (19 tasks)#99
jodeleeuw wants to merge 96 commits intomainfrom
cognitive-battery

Conversation

@jodeleeuw
Copy link
Copy Markdown
Member

@jodeleeuw jodeleeuw commented Jan 14, 2026

Summary

This PR adds a comprehensive cognitive battery of psychological assessment tasks to jspsych-timelines. Each task follows consistent patterns for mobile compatibility, text parameterization, and scoring utilities.

New Task Packages (19)

Executive Function:

  • flanker - Eriksen flanker task with congruent/incongruent trials
  • bcst - Berg Card Sorting Test with perseverative error tracking
  • plus-minus - Cognitive flexibility task (Jersild, 1927)
  • global-local - Navon figure selective attention task

Working Memory:

  • digit-span - Forward/backward digit span with adaptive staircase
  • operation-span - Dual-task with math verification and letter recall
  • corsi-block - Spatial working memory span with adaptive staircase

Attention:

  • oddball - Visual oddball paradigm with d-prime calculation

Decision Making:

  • iowa-gambling - Classic Bechara et al. (1994) paradigm

Memory:

  • free-recall - Verbal memory with intrusion detection
  • paired-associates - Associative learning with learn-to-criterion

Processing Speed:

  • simple-rt - Simple reaction time with variable foreperiod
  • choice-rt - Choice reaction time with color-matching stimuli

Motor:

  • fitts - Fitts' Law reciprocal tapping with throughput calculation
  • pursuit-rotor - Circular target tracking (requires plugin-pursuit-rotor)
  • tower-of-london - Planning task (requires plugin-tower-of-london)
  • trail-making - TMT Parts A & B (requires plugin-trail-making)

Visuospatial:

  • mental-rotation - Matrix rotation judgment task

Language:

  • lexical-decision - Word/nonword discrimination with built-in stimuli

Updated Existing Packages (3)

  • bart - Added scoring utilities, task_version, text parameterization
  • go-nogo - Added scoring utilities with commission/omission errors
  • spatial-nback - Added d-prime calculation, utils exports

Housekeeping Changes

  • Standardized peerDependencies, example HTML, and CSS across arrow-flanker, columbia-card, false-memory, hearts-and-flowers, and spatial-cueing

Consistent Features Across All Tasks

  • Mobile-friendly: Touch-optimized with @media (pointer: coarse) responsive CSS
  • Translatable: Full text parameterization via TextConfig
  • Scoring utilities: utils.scoring.calculateScores() and utils.scoring.getSummary()
  • Timeline units: Exportable components for custom experiments
  • Version tracking: task_version in all data output
  • Comprehensive tests: 600+ tests across all packages

Documentation

  • Added COGNITIVE-BATTERY-QUEUE.md for tracking development progress

Test plan

  • Run npm test to verify all tests pass
  • Run npm run build to verify builds succeed
  • Test individual task examples in browser

🤖 Generated with Claude Code

jodeleeuw and others added 24 commits January 14, 2026 14:54
Mobile-friendly Eriksen Flanker task for measuring selective attention
and cognitive control. Features congruent/incongruent trials, practice
with feedback, comprehensive scoring (accuracy, RT, interference effect),
and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Digit Span task for measuring working memory capacity. Features forward
and backward modes, staircase adaptive algorithm, mobile-friendly number
pad input, comprehensive scoring (max span, total correct), and full
text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wisconsin/Berg Card Sorting Test for measuring cognitive flexibility and
set-shifting. Features CSS-rendered cards (no images needed), configurable
rule change threshold, perseverative error detection, comprehensive scoring
(categories completed, perseverative errors), and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Iowa Gambling Task for measuring decision-making under uncertainty.
Features classic Bechara payoff schedules, 4 decks with 40-card penalty
cycles, comprehensive scoring (deck preferences, advantageous selections,
learning curve), and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Operation Span task for measuring working memory capacity. Features
dual-task paradigm with math verification and letter memory, interactive
recall grid, configurable set sizes, OSPAN and absolute span scoring,
and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Trail Making Test for measuring attention and executive function.
Features Part A (numbers) and Part B (alternating numbers/letters),
practice trials, comprehensive scoring (completion time, errors,
path distance, B-A difference), and full text parameterization.
Uses @jspsych-contrib/plugin-trail-making.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tower of London task for measuring planning and problem-solving.
Features 10 default puzzles (2-6 move difficulty), practice trial,
comprehensive scoring (puzzles solved, optimal solutions, by-difficulty
breakdown), and full text parameterization. Uses
@jspsych-contrib/plugin-tower-of-london.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pursuit Rotor task for measuring motor learning and coordination.
Features 4 default trials, practice trial, comprehensive scoring
(percent on target, improvement, learning slope), and full text
parameterization. Uses @jspsych-contrib/plugin-pursuit-rotor.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Mental Rotation task based on PEBL matrix rotation. Features 6x6 grid
patterns with one filled cell per row/column, study-test paradigm with
90-degree rotation judgments, practice trials with feedback, comprehensive
scoring (accuracy by condition, RT), and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Lexical Decision task for measuring word recognition. Features 40 built-in
words and 40 nonwords, customizable word lists, d-prime calculation,
practice trials with feedback, comprehensive scoring (accuracy, RT by
condition), and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Plus-Minus task for measuring cognitive flexibility (Jersild, 1927).
Features 3 blocks (addition, subtraction, alternating), mobile-friendly
number pad input, switch cost calculation, per-block and overall accuracy,
and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Global-Local (Navon figures) task for measuring selective attention.
Features CSS-rendered composite letters, global and local attention blocks,
congruent/incongruent trial types, interference effect calculation,
and full text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Paired Associates task for measuring associative memory. Features 8
default word pairs, study-test paradigm with multiple learning rounds,
multiple choice test format with distractors, learn-to-criterion option,
comprehensive scoring (rounds to learn, per-round performance), and full
text parameterization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Visual oddball paradigm for sustained attention measurement. Features:
- Colored circle stimuli (standard vs target)
- Configurable target proportion (default 20%)
- d-prime calculation with log-linear correction
- Hit/miss/false alarm/correct rejection scoring
- Practice trials with feedback
- Full text parameterization for translation support

33 passing tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Mobile-friendly button-based antisaccade paradigm for inhibitory control. Features:
- Gap timing between fixation and cue
- Prosaccade (same side) and antisaccade (opposite side) blocks
- RT cost calculation between block types
- Error tracking and accuracy metrics
- Practice trials with feedback
- Full text parameterization for translation support

38 passing tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Verbal memory task measuring encoding and retrieval. Features:
- 15 default words (customizable word list)
- Sequential word presentation
- Text input recall using survey-text plugin
- Intrusion and repetition detection
- Serial position tracking for primacy/recency analysis
- Recall rate calculation
- Full text parameterization for translation support

27 passing tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Processing speed measurement combining simple and choice reaction time. Features:
- Variable foreperiod to prevent anticipation
- Simple RT block (single response target)
- Choice RT block (left/right response targets)
- Anticipated response detection
- RT standard deviation calculation
- Choice cost metric (RT difference between blocks)
- Full text parameterization for translation support

39 passing tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Motor control measurement using Fitts' Law paradigm. Features:
- 6 default conditions varying target width and distance
- Index of Difficulty (ID) calculation per condition
- Throughput (bits/s) calculation
- Per-condition performance tracking
- Touch and click support for mobile compatibility
- Error tracking for missed targets
- Full text parameterization for translation support

32 passing tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to align with cognitive battery conventions:
- Add scoring utilities (utils.scoring.getSummary)
- Add task_version to data output
- Rename text_object to text parameter
- Export TextConfig type
- Update tests for new structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to align with cognitive battery conventions:
- Add scoring utilities (utils.scoring.getSummary)
- Add timelineUnits export
- Add task_version to data output
- Rename text_object to text parameter
- Export TextConfig type
- Update tests for new structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to align with cognitive battery conventions:
- Add scoring utilities (utils.scoring.getSummary with go/nogo accuracy,
  commission/omission errors)
- Add task_version to data output
- Rename text_object to text parameter
- Export TextConfig type
- Update TASK_NAME constant usage
- Update tests for new structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to align with cognitive battery conventions:
- Add utils.scoring (with d-prime, hit rate, false alarm rate, RT metrics)
- Add utils.constants (TASK_NAME, VERSION)
- Add utils.text export
- Add task_version to data output
- Update tests for new structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive tracking document for cognitive battery development:
- Phase 1-4 task organization by domain and complexity
- Status tracking for spec, implementation, verification, and PR
- Custom plugins queue
- Progress summary (22/24 tasks complete)
- Notes log documenting implementation decisions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new cognitive battery task packages to workspace configuration:
- antisaccade, bcst, choice-rt, digit-span, fitts
- flanker, free-recall, global-local, iowa-gambling
- lexical-decision, mental-rotation, oddball, operation-span
- paired-associates, plus-minus, pursuit-rotor, tower-of-london
- trail-making

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 8196af4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@jspsych-timelines/bart Patch
@jspsych-timelines/corsi-block Patch
@jspsych-timelines/go-nogo Patch
@jspsych-timelines/spatial-nback Patch
@jspsych-timelines/choice-rt Minor
@jspsych-timelines/continuous-performance-test Minor
@jspsych-timelines/fitts Minor
@jspsych-timelines/free-recall Minor
@jspsych-timelines/global-local Minor
@jspsych-timelines/lexical-decision Minor
@jspsych-timelines/mental-rotation Minor
@jspsych-timelines/oddball Minor
@jspsych-timelines/paired-associates Minor
@jspsych-timelines/plus-minus Minor
@jspsych-timelines/pursuit-rotor Minor
@jspsych-timelines/simon-task Minor
@jspsych-timelines/simple-rt Minor
@jspsych-timelines/stop-signal-task Minor
@jspsych-timelines/task-switching Minor
@jspsych-timelines/tower-of-london Minor
@jspsych-timelines/trail-making Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jodeleeuw and others added 5 commits January 14, 2026 15:26
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New timelines: trail-making, tower-of-london, pursuit-rotor, mental-rotation,
lexical-decision, plus-minus, global-local, paired-associates, oddball,
antisaccade, free-recall, choice-rt, fitts

Refactored for consistency: bart, corsi-block, go-nogo, spatial-nback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace file: references with ^0.1.0 npm versions for:
- @jspsych-contrib/plugin-tower-of-london
- @jspsych-contrib/plugin-pursuit-rotor
- @jspsych-contrib/plugin-trail-making

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added index.html examples for:
- antisaccade
- choice-rt
- fitts
- free-recall
- global-local
- lexical-decision
- mental-rotation
- oddball
- paired-associates
- plus-minus
- pursuit-rotor
- tower-of-london

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jodeleeuw and others added 30 commits March 21, 2026 20:58
Replace jsPsychHtmlKeyboardResponse with jsPsychHtmlButtonResponse
in all example instruction screens for mobile compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move prompt and display out of the fixed-position container so they
stay centered on screen. Only the numpad gets pinned to the bottom.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge practice trials into the instruction flow instead of running them
as a separate block. Practice count is controlled by numPracticeTrials.
Update instruction text to clearly frame trials as practice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When no explicit canvas dimensions are set, scale the canvas, target
radius, and minimum separation to fit the viewport width with padding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use the smaller of width and height (minus padding for prompt text)
so the canvas fits in landscape orientation on mobile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scale canvas proportionally when viewport is smaller than the default
500x400, accounting for both width and height constraints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change default peg capacities from [3,3,3] to [3,2,1] matching the
classic Shallice Tower of London. Redesign default puzzles to respect
capacity constraints. Update plugin dependency to ^1.0.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace node/import-based Quick Start sections with CDN-based HTML
examples using unpkg, matching how most users will actually use these
packages. Applies to all 7 READMEs in the PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace custom puzzles with the 12 standard problems from Krikorian,
Bartok & Gay (1994). Start state: green/red on peg 1, blue on peg 2.
Problems graded 2-5 moves (2×2, 2×3, 4×4, 4×5). All move counts
verified by BFS solver.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scale canvas, path radius, and target radius proportionally when
viewport is smaller than the default 500x500.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the Continuous Performance Test (CPT) with three modes:
- Standard (Rosvold/TOVA-style): respond to rare target
- Inhibition (Conners CPT-style): respond to all except rare non-target
- AX-CPT: respond to probe X only after cue A

Features: configurable ISI (fixed, range, or set), blocked designs with
rest screens, d-prime/beta scoring with log-linear correction, per-block
vigilance decrement analysis, per-trial-type AX scoring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all keyboard responses with html-button-response for mobile
compatibility. Add RESPOND button, use on_load+setTimeout for stimulus
duration timing, disabled buttons for non-interactive displays.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mobile-friendly Simon Task with button responses. Colored stimuli appear
at lateralized positions; participants tap left/right buttons based on
color (not position). Supports congruent/incongruent/neutral conditions,
proportion congruent manipulation, sequential transition control for
Gratton effect analysis, and multi-block designs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use 80vw width on simon-container so absolute-positioned stimuli
actually appear at left/right positions instead of all centering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use :has() selector to scope the spread layout to button groups
with multiple buttons, keeping single buttons centered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Supports cued mode (explicit task cue before each stimulus) and
alternating-runs mode (AABB predictable pattern). Participants classify
digits by magnitude (LOW/HIGH) or parity (ODD/EVEN). Measures switch
cost in RT and accuracy. Mobile-friendly with button responses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass instruction_task HTML directly as stimulus instead of stripping
tags via regex and re-wrapping in a paragraph.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Stop Signal Task measuring response inhibition. Uses adaptive SSD
staircase (converges on ~50% stop accuracy). Estimates SSRT via
integration method. Based on @jspsych-contrib/plugin-stop-signal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant