The R AI IDE

A local workspace for reproducible statistical analysis — a persistent R session, editable code, and an AI assistant you control.

Built for medical and clinical research. R is the only prerequisite.
RAI · Workspace R session active
Explorer
1
2
3
4
5
6
Environment
Console Preview · Reader
PlotsPackagesPluginsHelpViewer
AI Assistant
Agent API

Let agents run R — and keep the evidence

External AI clients reach the same R session through structured tools, not by driving the browser.

01 / HTTP

Stable JSON API

Execute R and read back structured output, session state, plots and workspace files from any client that can send HTTP.

POST /api/agent/exec
02 / MCP

Local MCP server

A single-file, zero-dependency bridge exposing R execution, the latest plot, and workspace read/write as MCP tools.

rai_run_r · rai_get_plot
03 / FILES

CLI & file contract

Drop an .R script into a watch folder; collect JSON output, trace and plots — a reliable, version-controlled path.

watch → outbox/*.json
Every execution is traceable
executedCode · seed · rVersion · workdir · timestampUnix
AI produces reviewable analysis — code, real output and a trace — not untraceable conclusions. Medical sign-off stays with the researcher.
Capabilities

One workspace, from dialog to trace

Analysis

Dialog-driven statistics

Choose a method, fill a form, and get readable, editable R code in return.

Analysis

Persistent R session

Variables survive between runs; console, environment and plot history stay in sync.

AI

Your model, your choice

Cloud providers or fully local runtimes. Keys are stored per provider and never returned to the browser.

AI

Tabbed conversations

Multiple sessions, model switching, and tools that read files and run R code.

Extend

Plugin system

Drop in a plugin.json; new analyses and R sources register without frontend changes.

Extend

Package manager

Install from CRAN, Bioconductor, GitHub or a local archive, with a visible install log.

Trace

Reproducible by default

Each run records the code, seed, R version, working directory and timestamp.

Trace

Local-first & offline

Binds 127.0.0.1 only. The offline lock refuses every non-loopback request.

Built-in methods
Descriptive statistics t-test Linear regression Kaplan–Meier Cox regression ROC Sample size
Architecture

Three layers, one source of truth

Interface

Browser UI

Editor · Console / Preview / Reader · Environment · Plots / Packages / Plugins · AI Assistant

React + Vite
Core

Rust backend

axum HTTP/WebSocket · token auth · /api/agent/* · manifest and plugin registry

rai-core
Engine

Persistent R process

session.R main loop · dispatcher.R · vector-first device fallback chain

NDJSON · one line, one request
/api/agent/* The browser and external agents share the same core, the same R session and the same workspace.

R is called over inter-process communication — loose coupling, so the frontend and Rust code remain independent of R's GPL.

Interface

A workspace built around the analysis

Illustration of the RAI workspace: explorer, editor, console, plots and AI assistant

Main workspace

Explorer, editor, environment, console and AI assistant on one screen.

Illustration of the AI assistant panel with a conversation and a model control

AI assistant

Model selection, visible data destination, and agent tools that operate on the workspace.

Illustration of tabbed conversations, model controls and a session timeline

Tabbed conversations

Each analysis keeps its own conversation; switch models without losing context.

Explorer · Editor + Environment · Console / Preview / Reader · Plots / Packages / Plugins / Help / Viewer / Presentation · AI Assistant

Install R. Then install RAI.

Both local. No account, no server.