AgentREPL.jl
Persistent Julia REPL for AI agents via MCP (Model Context Protocol). Supports multiple isolated sessions and Revise.jl hot-reloading.
The Problem: Julia's "Time to First X" (TTFX) problem severely impacts AI agent workflows. Each julia -e "..." call incurs 1-2s startup + package loading + JIT compilation. AI agents like Claude Code spawn fresh Julia processes per command, wasting minutes of compute time.
The Solution: AgentREPL provides a persistent Julia session via MCP STDIO transport. The Julia process stays alive, so you only pay the TTFX cost once.
Why AgentREPL?
AgentREPL is the simplest way to give Claude Code a persistent Julia session. Three things set it apart:
-
Zero-friction setup. STDIO transport means Claude Code spawns and manages the Julia process automatically. No server to start, no port to configure, no process to monitor. Install the plugin and start coding.
-
Workflow-native Revise.jl. Every worker auto-loads Revise.jl. The plugin's PostToolUse hook automatically calls revise after you edit .jl files. You never manually reload code.
-
True process isolation. Each session is a separate Distributed.jl worker. You can redefine structs, kill crashed sessions, and run parallel workloads without cross-contamination. reset does what it says -- complete state erasure including type definitions.
AgentREPL is not a Julia IDE replacement. It has 8 tools, not 35. It does not have debugging, semantic search, or a dashboard. If you need those, see the comparison section below. AgentREPL's approach is that eval plus Julia's existing introspection capabilities (which you can call directly via eval) covers most agent workflows with minimal complexity.
Installation
using Pkg
Pkg.add(url="https://github.com/samtalki/AgentREPL.jl")
Or for development:
Pkg.dev("https://github.com/samtalki/AgentREPL.jl")
Quick Start
Option A: Use the Plugin (Recommended)
The easiest way to use AgentREPL is via the included Claude Code plugin:
claude /plugin add samtalki/AgentREPL.jl
This provides:
- Auto-configured MCP server (no manual setup)
- 8 skills:
/julia-reset, /julia-info, /julia-pkg, /julia-activate, /julia-log, /julia-session, /julia-revise, /julia-develop
- Auto-triggering skills for Julia evaluation best practices and language expertise
- Hooks: code display validation before
eval, automatic revise after .jl file edits
Option B: Manual MCP Configuration
claude mcp add julia-repl -- julia --project=/path/to/AgentREPL.jl /path/to/AgentREPL.jl/bin/julia-repl-server
Using AgentREPL
Start a new Claude Code session. The Julia MCP server will auto-start when Claude needs it.
Ask Claude to run Julia code:
"Calculate the first 10 Fibonacci numbers in Julia"
Claude will use the eval tool and display REPL-style output:
julia> [fibonacci(i) for i in 1:10]
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
The first call may take a few seconds for JIT compilation; subsequent calls are instant.
Architecture
AgentREPL uses a multi-session worker subprocess model via Distributed.jl:
┌─────────────────────────────────────────────────────────┐
│ Claude Code │
│ ↕ STDIO (MCP) │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ AgentREPL MCP Server (Main Process) │ │
│ │ ↕ Distributed.jl │ │
│ │ ┌──────────────────┐ ┌──────────────────┐ │ │
│ │ │ Session "default" │ │ Session "testing" │ ... │ │
│ │ │ (Worker 2) │ │ (Worker 3) │ │ │
│ │ └──────────────────┘ └──────────────────┘ │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
Why a worker subprocess?
reset can kill and respawn the worker for a true hard reset
- Type/struct redefinitions work (impossible with in-process reset)
- Each session has isolated variables, packages, and project environment
- The activated environment persists across resets
- Workers are spawned lazily on first use to avoid STDIO conflicts
Tools Provided
eval
Evaluate Julia code in a persistent session. Output is formatted in familiar REPL style:
julia> x = 1 + 1
2
julia> x + 10
12
Variables persist! Multi-line code works too:
julia> function fib(n)
n <= 1 && return n
fib(n-1) + fib(n-2)
end
[fib(i) for i in 1:10]
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
Printed output appears before the result:
julia> println("Computing..."); 42
Computing...
42
Errors are caught with truncated stacktraces:
julia> undefined_var
UndefVarError: `undefined_var` not defined
Stacktrace:
[1] top-level scope
... (truncated)