Guide

Build a task with the AI editor

Describe your experiment in plain English and let the AI write the jsPsych code.

The experiment editor pairs a code editor with an AI assistant. You describe the task; the AI writes and edits jsPsych code you can review, run and refine.

How to work with the AI

  1. 1

    Open the editor

    From a project, open an experiment. Files like experiment.js and config.js appear on the left.

  2. 2

    Describe the task

    In the AI panel, describe what participants should see and do. Be specific about trials, conditions and the data you want recorded.

  3. 3

    Review the generated code

    The AI proposes changes as a diff. Read it, accept or reject, and keep iterating with follow-up messages.

    Keep tunable settings (trial counts, stimuli, labels) in `config.js` on the CONFIG object so you can edit them without regenerating code.

  4. 4

    Preview and save

    Use Preview to try the task in a separate window, then Save your draft.

A good first prompt

Copy this into the AI chat and adapt it to your task:

Starter task prompt

A template that produces a clean, editable jsPsych task.

Build a keypress reaction-time task with jsPsych for the VibeMyExpt platform.

- Keep all tunable settings in config.js on a CONFIG object: number of trials, the stimulus set, valid response keys, fixation duration, and inter-trial interval.
- In experiment.js, show a fixation cross, then a stimulus, then wait for one of the CONFIG response keys.
- Record per trial: stimulus, response key, correct (boolean), and rt (ms).
- Randomize trial order. Add a short instructions screen at the start and a thank-you screen at the end.
- Ensure initJsPsych posts vibemyexpt:trial_data on on_data_update and vibemyexpt:experiment_complete on on_finish. Do not change that protocol.
Starting a new chat clears the AI’s context, which makes following turns cheaper. Start fresh when you switch to an unrelated change.