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 an AI assistant with your experiment’s code. You describe the task; the AI writes and edits jsPsych code you can run, review 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 chat, describe what participants should see and do. Be specific about trials, conditions and the data you want recorded.

  3. 3

    Watch it run

    In Chat view the AI’s changes apply straight away and the preview beside the chat reruns. If you don’t like a change, click Undo under that reply.

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

  4. 4

    Read the code (optional)

    Switch to Code view to edit files yourself. There the AI’s changes arrive as a diff you review before applying.

Going back

  • A version is saved before every AI turn. Each AI reply has Restore to before this turn , which puts the code back exactly as it was then.
  • Restoring is undoable: your current code is saved as a version first.
  • In Code view, the Versions panel lists every saved version, grouped by AI chat. You can view, restore, or name one (e.g. “Pilot ready”).
  • Restoring brings back code only. Stimuli and libraries stay as they are now.
Versions saved by the AI are kept for 90 days. Versions you name and versions you published are kept for good.

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.