Recipes: rerun analyses on new data, or have an AI build your project

Updated

A recipe is a short list of StatLab commands, each with its settings, that names columns by their names. StatLab writes one from results you already have, and runs one on whatever data the worksheet holds now: next week's lot, another line, another shift. A recipe can also carry a whole project: the data, a title and description, and notes between the analyses. Because a recipe is plain text, an AI assistant can write one. You give the assistant a file that explains StatLab, it asks you what you need and for your data, and it hands you a project that StatLab opens and runs, doing every calculation itself.

When to use it

  • You run the same analyses on every new batch of data: the weekly capability check, the monthly control charts.
  • You want coworkers to make the same charts with the same settings, so their results compare with yours.
  • You are new to StatLab, or to statistics, and want an AI assistant to set up the whole project from your question and your data.
  • You want an AI assistant's help choosing analyses without sending it your measurements.
  • You want a readable record of exactly which commands and settings produced a result.

How it works

Save a recipe

Run your analyses as usual, then choose File › Save recipe…. The dialog lists every result in the Output pane, each ticked; untick the ones the recipe should leave out and give it a name. The preview shows the recipe as it will be saved. Save writes a .recipe.json file, and Copy puts the text on the clipboard.

A recipe keeps each result's command and the settings it ran with, columns by name. It holds no values from the worksheet.

Run a recipe

Choose File › Run recipe… and paste a recipe into the box, or Open a recipe file…. You can also paste an AI assistant's whole answer: StatLab takes the first JSON block it finds.

StatLab checks every step against the worksheet before anything runs, and lists the steps:

  • ✓ the step is ready. The columns it will read are shown under it.
  • ✕ the step cannot run, with each reason: a column the worksheet lacks, a setting that is missing, misspelled or out of range, settings that don't go together (subgroups of 1 on an Xbar-R chart, say), or a command StatLab does not have yet.
  • ✎ a note, which goes into the Output pane as written.

The button says how many steps will run, such as Run 3 steps or Run 2 of 3 steps. Each step adds a result or a note to the Output pane, just as its dialog would. A message records which recipe ran.

The recipe file

{
  "format": "statlab-recipe",
  "version": 2,
  "name": "Shaft lot check",
  "steps": [
    { "command": "graph.histogram", "settings": { "columns": ["Diameter"], "fit": true } },
    { "command": "stat.control-charts.individuals.i-mr", "settings": { "columns": ["Diameter"] } }
  ]
}

Each step names a command by its id (graph.histogram is Graph › Histogram) and gives its settings. Settings left out take the values the command's dialog starts with. Column names match in any case, and a column without a name is C1, C2 and so on by its place. Recipes run the Stat and Graph commands; Data and Calc commands, which change the worksheet, are done by hand.

A whole project in one file

A recipe can also bring its own data, a description and notes:

{
  "format": "statlab-recipe",
  "version": 2,
  "name": "Lathe 3 shaft diameters",
  "description": "Does lathe 3 turn shafts within 25.00 ± 0.05 mm?",
  "data": {
    "columns": [
      { "name": "Diameter (mm)", "type": "numeric", "values": [25.012, 24.998, 25.004, 25.021, 24.99, 25.007] },
      { "name": "Operator", "type": "text", "values": ["Ana", "Ana", "Ana", "Luis", "Luis", "Luis"] }
    ]
  },
  "steps": [
    { "note": "Six shafts measured in the order made. First, is the diameter stable?" },
    { "command": "stat.control-charts.individuals.i-mr", "settings": { "columns": ["Diameter (mm)"] } },
    { "note": "Then, do the two operators differ?" },
    { "command": "graph.boxplot", "settings": { "columns": ["Diameter (mm)"], "group": "Operator" } }
  ]
}

Columns are numeric (JSON numbers), text (strings) or date (written "2026-12-01" or "2026-12-01 14:30"), with null for a missing value. Such a recipe starts a new project: Run recipe shows the data and checks the steps against them, and Start the project puts the data in the worksheet, takes the name and description as the project's details, and adds the notes and results in order. If the data have a problem, such as text in a numeric column, StatLab names it by column and row and runs nothing. File › Open project… opens a recipe file too, as does dropping it on StatLab.

Projects from an AI assistant

Download the file for AI assistants: in StatLab, Help › StatLab for AI assistants…, or straight from the site, without opening StatLab, at statlab.cc/ai/statlab-for-ai-assistants.md. Give it to an AI assistant with your question, such as "Is the bore centered between 9.98 and 10.02 mm?".

The file tells the assistant to interview you: what you want to find out, the facts it needs (specification limits, how the samples were taken), then your data, which you paste from a spreadsheet, attach or type. It reads your data back to you, asks about anything odd and proposes a plan. Then it writes the whole project as one recipe: your data, a title and description, notes that explain each step, and the analyses. Open its file with File › Open project…, or paste its answer into File › Run recipe…, and click Start the project. The project is ready for File › Report…, and if StatLab finds a problem, send its message back to the assistant to fix.

The file lists every command StatLab can run with each setting, its values and default, which questions each command answers, the project format with a worked example, and the commands that are not built yet. Made from the app, it also gives your worksheet's column names and types, so the assistant can write a recipe for data you already have; summary statistics of each column go in only if you tick the box. It tells the assistant never to state results: every number comes from StatLab.

Recipes from the command line

StatLab's command line runs a recipe on a data file without opening the app, which suits a file that arrives every shift or a test bench that writes one per lot. With Node.js 22 or later installed:

npx -y https://statlab.cc/cli/statlab-1.1.0.tgz run weekly.recipe.json lot-12.csv -o lot-12.pdf -o lot-12.statlab

It reads CSV, text and Excel files and .statlab projects, checks every step as File › Run recipe… does, runs them with the same Python code as the app and writes the report as a PDF, a web page, Markdown or a ZIP, plus the project and a notebook of the code if you ask. A recipe that brings its own data needs no data file. statlab check only checks the steps, and statlab ai-file writes the file for AI assistants. The exit status says whether every step ran, so a script can raise an alarm when one did not. The data stays on the computer; the first run downloads NumPy and SciPy for Python. statlab help lists every option, and the app's guide (Help › How to use StatLab) explains them.

AI apps on your computer (MCP)

AI apps that support the Model Context Protocol, such as Claude and Codex, can run StatLab themselves through statlab mcp. Add it once, for example with claude mcp add statlab -- npx -y https://statlab.cc/cli/statlab-1.1.0.tgz mcp, and the app gets four tools: the guide, a description of a data file (columns, types and summary statistics, never the values), a check and a run that writes the report and the .statlab project. The app interviews you as the file for AI assistants says, runs the project on your computer and explains the report, quoting StatLab's numbers.

In Claude Code, StatLab's plugin sets this up for you: run claude plugin marketplace add andres39-spec/Statlab, then claude plugin install statlab@statlab. The user guide's section on connecting an AI app has the commands for other apps and how to update.

Example

A process engineer checks each lot of shafts from a turning center: a histogram of the diameters, an Xbar-R chart and a capability summary with specification limits 24.95 and 25.05 mm, the data in subgroups of 5. After running the three analyses on the first lot, she chooses File › Save recipe…, names the recipe Shaft lot check and saves Shaft lot check.recipe.json.

The next lot arrives as a CSV file. She imports it with File › Import data…, chooses File › Run recipe… and opens the recipe file. All three steps show ✓ with the column Diameter, so she clicks Run 3 steps and has the same three results for the new lot within seconds.

A month later a lot file calls the column Dia. Every step now shows "The worksheet has no column named “Diameter”." She renames the column in the worksheet and runs the recipe again.

Her supervisor asks whether the night shift's shafts differ from the day shift's. The engineer downloads the file for AI assistants and asks an assistant. It answers with a recipe of a boxplot and an interval plot of Diameter grouped by Shift, and says that a 2-sample t-test is planned for a later version of StatLab. She pastes the answer, runs both steps and reads the graphs herself.

How to read the results

  • The step list is the plan. Nothing runs until you click the button, and only the steps marked ✓ run.
  • The results are ordinary results. They show their code, go into reports and run again when their data change, like results made from the dialogs.
  • The message in the Output pane says which recipe ran and how many of its steps, so the project keeps a record.

Common mistakes

  • Running a recipe on data with other column names. A recipe finds columns by name. Rename the columns, or edit the names in the recipe, rather than renaming them to whatever makes the steps run.
  • Keeping settings that no longer fit. A recipe saved with subgroups of 5 still uses 5 when the new data were collected in subgroups of 4. Read the steps before you run them.
  • Taking an assistant's word for the results. The assistant writes the recipe without seeing your data; StatLab computes the numbers. Read the results yourself, and check that the analysis answers your question.
  • Sharing more than your rules allow. Data you give an AI assistant go to the company that runs it. The file for AI assistants holds your column names, and summary statistics if you add them. Whether you may share your data, or even that, is up to your organization.

Frequently asked questions

Does a recipe contain my data?

Not one that StatLab saves: it holds commands, settings and column names, and the worksheet's values stay in StatLab and in your project file. A recipe can carry data, as an AI assistant's project does, but only data someone wrote into it.

Can I edit a recipe by hand?

Yes. It is plain JSON text, one step to a line. StatLab checks every step when you run it and names anything it does not accept, with the path of the setting, such as subgroup.value.

Which AI assistants can write recipes?

Any assistant that can read a file or a long message. The file explains how to interview you, the commands, the project format and what to answer, so the assistant needs nothing else from StatLab.

What happens to a step StatLab can't run?

It is skipped. The other steps still run if you choose, and the dialog lists the reasons, so you can fix the recipe or the worksheet and run the rest later.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab