Custom Runtimes
Add any language by dropping a runtime.yaml and a kernel script in ~/.config/rat/runtimes/<lang>/. No Go code, no recompilation.
runtime.yaml
Hereβs the built-in R runtime as an example:
name: rdisplay: R
detect: commands: [Rscript, R] env: RAT_R
kernel: type: json script: kernel.R args: ["--no-save", "--no-restore"]
frontend: type: repl prompt: "r> "
install: runtime: manager: r deps: [jsonlite] smoke: run: "1 + 1" expect: "2"Two kernel types are supported:
- json: a subprocess speaking the JSON kernel protocol over stdin/stdout
- tmux: an interactive REPL running in a tmux session with a bridge script
Kernel script
For json kernels, the script reads JSON lines from stdin and writes JSON lines to stdout. The wire format is documented in the Kernel Protocol.
Built-in runtimes
The built-in runtimes (R, pi) use the same mechanism β thereβs nothing special about them.
Architecture
rat (Go binary)βββ CLI install, run, look, status, start, stop, ...βββ REPL rat py β IPython connected to shared kernel via MCPβββ MCP server rat serve β HTTP or stdioβββ Resolver project-scoped naming (py@myproject)βββ Kernels βββ python built-in, IPython + jedi βββ bash built-in, direct PTY βββ r generic JSON kernel (runtime.yaml + kernel.R) βββ pi generic tmux kernel (runtime.yaml + bridge.ts) βββ custom ~/.config/rat/runtimes/<lang>/The MCP server is Go. The kernel subprocess runs in the userβs interpreter with access to their packages. Communication is JSON lines over pipes.