Interactive coding-agent CLI built around a Recursive Language Model
Project description
fractal
the recursive language model CLI agent
A terminal agent that is an RLM. Powered by
predict-rlm —
Trampoline's self-harnessed Recursive Language Model runtime.
The easiest way to see an RLM in action on your own work.
Website · predict-rlm · Discord
crafted with ♥ in MTL · NYC · FLP · by Trampoline AI
Quick start
curl -LsSf https://fractal.trampoline.ai/install.sh | sh
This installs the fractal command (and uv if you
don't have it). Make sure you meet the Requirements below, then
drop into any project and run fractal.
Requirements
-
Python 3.11+.
-
uv to install and run Fractal.
-
Docker, running. Every Fractal turn executes generated code inside a Docker Sandbox, so the Docker daemon must be up.
-
The
sbxCLI, logged in. Fractal uses predict-rlm'ssbx(Docker Sandboxes) backend for code execution:brew install docker/tap/sbx sbx login
If Docker is not running or
sbxis not logged in, the first turn fails. You can verify the rest of your setup (provider, model, auth) ahead of time withfractal config status. -
A model provider. One of the providers in the configuration table, with its API key available (or
codex loginforopenai-codex, or a local Ollama server). Setup walks you through this on first run.
Installation
Quick start covers the one-line installer, which installs
uv if needed, installs Fractal as an isolated
tool, and checks your Docker/sbx prerequisites. To pin a version, set
FRACTAL_VERSION.
If you already use uv or pipx, install the tool directly instead:
uv tool install fractal-rlm # or: pipx install fractal-rlm
fractal --help
Both create an isolated environment and put fractal on your PATH, so it is
callable from any directory.
Use it with your coding agent
Fractal shines as a tool your main agent (Claude Code, Cursor, …) defers to for
heavy, large-context jobs: it hands Fractal the work in
headless mode and gets back a distilled answer. The bundled
fractal skill teaches an agent when and how to do this.
Install it in Claude Code, Codex, Cursor, or any compatible coding agent:
npx skills add https://github.com/Trampoline-AI/fractal/tree/main/.agents/skills/fractal
See Headless / CI use for the full non-interactive interface.
What is Fractal?
Most agents call a model in a loop that humans hand-engineer — the control flow, the context management, the tool routing. Fractal's loop is the model.
It's a thin terminal UI over predict-rlm, Trampoline's self-harnessed Recursive Language Model runtime. The model writes and runs its own code, calls a sub-model when it needs to, and manages its own context as it works — so capability scales with the underlying model instead of with harness engineering, and without context rot. (It's an implementation of the Recursive Language Models work from MIT CSAIL.)
Fractal adds exactly one thing on top: session management — multi-turn conversation and history, which predict-rlm doesn't do on its own. That's the whole product. Each turn is a single RLM call over your workspace, mounted into a Docker sandbox so the model's own code and project commands run against the real files.
It's an early, intentionally bare-bones proof of concept — released to see what people build with it, and to be the easiest way to get started with an RLM and actually understand how one works, by experimenting on your own tasks.
How it works
Every Fractal turn runs fully inside a Docker Sandbox
(sbx) — an isolated container with no network access by default. Your workspace
is mounted directly into the sandbox via an SBX passthrough mount, so the agent
reads and edits your actual files in place; changes appear on the host
immediately, with no copy or sync step needed.
The agent recurses. predict-rlm spawns sub-LMs to work the shards of a task that won't fit one context, then folds their results back up:
fractal› go through this 123 page contract, build a timeline, set reminders for the deadlines
RLM turn 1/30 (ok)
reasoning: 123 pages won't fit one context — split it
python:
│ class DatedItem(BaseModel):
│ date: datetime.date
│ description: str
│
│ results = await asyncio.gather(*[
│ predict("page: dspy.Image -> items: list[DatedItem]", page=render(page, dpi=80))
│ for page in doc
│ ])
↳ sub-lm 47/123 · page 47
2 items · 2026-04-01 renewal notice · 2026-06-30 term end
↳ returning items to parent
RLM turn 2/30 (ok)
reasoning: 31 items collected — sort them, then write the deliverable
python:
│ items = sorted((i for r in results for i in r.items), key=lambda i: i.date)
│ write_file("timeline.md", to_markdown(items))
│ for i in upcoming(items):
│ add_reminder(i.date, i.description)
Contract timeline · Acme MSA
Across all 123 pages I found 31 dated items. Full timeline written to
timeline.md; the 4 upcoming deadlines are on your calendar.
This is a pseudo trace, to help you understand what goes on inside the RLM.
A single line can stand in for a million sub-calls — in direct contrast to agents that must mechanically emit each sub-agent call one at a time. And every peek, chunk, sub-call, and verification step is fully readable in the trace.
Where it shines
Because the RLM reasons over context programmatically instead of stuffing everything into one prompt, Fractal is strongest on analysis- and context-heavy work: reading across a large or deep codebase, synthesizing an answer from many files, audits, and open-ended investigation — anything where the context is the hard part. Two ways to use it:
- Directly, as your own terminal agent — ask questions, edit code, run tasks.
- As a tool other agents defer to — your main agent (Claude Code, Cursor,
etc.) can hand a heavy analysis or large-context job to Fractal in
headless mode and get back a distilled answer. The
bundled
fractalskill teaches an agent when and how to do this.
Fractal is not trying to replace your daily coding agent — more mature tools exist for that. It's a window onto what a self-harnessed RLM can do.
What you get
- Powered by predict-rlm — recursive and self-harnessed. The runtime is the agent; there's no orchestration to assemble.
- Model-agnostic — OpenAI, Anthropic, Gemini, Groq, Ollama, OpenRouter, or any OpenAI-compatible endpoint.
- Sandboxed by default — every turn runs in an isolated Docker sandbox. Point it at real work without flinching.
- Headless & scriptable — drive it from CI or another agent with
fractal -p "…".
Why RLMs?
- Recursive Language Models — the MIT CSAIL paper introducing RLMs: self-harnessed models that write and run their own inference code.
- LongCoT: a benchmark worthy of an RLM's attention — why standard long-context benchmarks miss what RLMs are actually good at.
- RLMs on the AppWorld benchmark — early results and observations from using an RLM on real tasks.
First run
cd your-project
fractal # first run launches provider/model setup, then a session
On first interactive run with no global config, Fractal runs setup
automatically: pick a provider, a model, an optional cheaper sub-model, and how
to supply the API key. After setup you land in an interactive session in the
current directory. Type a request, and Fractal edits the workspace and reports
what it changed. Use /help to list slash commands and /exit to quit.
Usage
fractal # interactive session in the current directory
fractal -p "fix the tests" # one non-interactive turn
fractal --resume <session-id> # resume a stored workspace session
Interactive slash commands: /help, /sessions, /resume <id>, /new,
/model, /provider, /usage, /verbose, /exit. The header always shows
both the main model and the sub-model.
Workspace and included directories
By default Fractal mounts the directory it was launched from as the workspace — that's what the sandbox sees and what the agent reads and edits.
--workspace DIRchanges which directory is mounted as the workspace, so you can run Fractal against a project other than the current directory.--include DIR(repeatable) mounts an additional directory into the sandbox at its absolute path. Use it when the agent needs files that live outside the workspace. Common cases:- Local path dependencies — a sibling package or editable install your project points at by path; include it so the agent can read and run it.
- Git worktrees — a worktree's
.gitlives in the main checkout, so include that directory to give Fractal access to the real git history.
Command-line options
| Flag | Description |
|---|---|
--workspace DIR |
Workspace directory to edit; defaults to the current directory. |
--include DIR |
Additional directory to mount into the sandbox at its absolute path. Repeatable. |
-p, --prompt TEXT |
Run one turn non-interactively with TEXT; use - to read the prompt from stdin. |
--resume SESSION_ID |
Resume an existing workspace-local session by id. |
--max-iterations N |
Max RLM iterations per turn; defaults to the configured value or 30. |
--lm MODEL |
Override the configured main model for this run (bypasses config resolution). |
--sub-lm MODEL |
Override the configured sub-model for this run. |
--verbose |
Show generated code and model-visible output for each RLM iteration; enabled by default with -p. |
--quiet |
Suppress progress chatter (non-interactive runs). |
--debug |
Enable PredictRLM debug mode. |
Subcommands: fractal config <show|status|setup|get|set|unset|reset> manage
configuration (see Configuration).
Headless / CI use
-p/--prompt runs a single turn without the interactive UI — use it from
scripts, hooks, CI, or to hand Fractal heavy work from another agent:
fractal -p "fix the failing tests" # one turn, prompt as an argument
git diff | fractal -p - # read the entire prompt from stdin
echo "summarize recent changes" | fractal -p "review this diff" # prompt + stdin context
Headless runs show generated code and model-visible output for each RLM
iteration on stderr by default. Use --quiet for stdout-only scripts.
See docs/headless.md for the full output contract, exit codes, and CI patterns.
Configuration
On first run, Fractal walks you through setup interactively — pick a provider,
model, and how to supply your API key. In an interactive session, use /provider
to change provider and /model to switch models.
Supported providers:
| Provider | Default API key env var |
|---|---|
openai-codex |
codex login --device-auth |
openai-api |
OPENAI_API_KEY |
anthropic |
ANTHROPIC_API_KEY |
gemini |
GEMINI_API_KEY |
xai |
XAI_API_KEY |
deepseek |
DEEPSEEK_API_KEY |
mistral |
MISTRAL_API_KEY |
groq |
GROQ_API_KEY |
openrouter |
OPENROUTER_API_KEY |
ollama |
local server, no key |
custom-openai-compatible |
CUSTOM_OPENAI_API_KEY |
See docs/config.md for credentials, non-interactive access, environment variable overrides, and the full config schema.
Development
To work on Fractal itself, clone the repository and use uv:
git clone git@github.com:Trampoline-AI/fractal.git
cd fractal
uv sync # install dependencies
uv run fractal --help
uv run pytest # 200+ tests
When running from a checkout, prefix commands with uv run (e.g. uv run fractal); an installed tool just uses fractal.
See CONTRIBUTING.md for the contribution workflow and CHANGELOG.md for release notes.
Fractal is a fully open-source proof of concept we're putting out to see what people build with it. It's early, and moving fast.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fractal_rlm-0.1.0a1.tar.gz.
File metadata
- Download URL: fractal_rlm-0.1.0a1.tar.gz
- Upload date:
- Size: 5.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdd07c2d9d1ebb1b13b63f883e49b72d70a82fb7361a7595fe682a90e7dbb44e
|
|
| MD5 |
ed3fa11463b9c60373ee15c29d58dec7
|
|
| BLAKE2b-256 |
adb1254ccdde65886630d5123abcdacb2dcc9ec74decaff25e451a7bdc4b1661
|
Provenance
The following attestation bundles were made for fractal_rlm-0.1.0a1.tar.gz:
Publisher:
release.yml on Trampoline-AI/fractal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fractal_rlm-0.1.0a1.tar.gz -
Subject digest:
cdd07c2d9d1ebb1b13b63f883e49b72d70a82fb7361a7595fe682a90e7dbb44e - Sigstore transparency entry: 1861439320
- Sigstore integration time:
-
Permalink:
Trampoline-AI/fractal@7ccdd55e24dd33d68d1e797a3c273c32cddc3fb9 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/Trampoline-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7ccdd55e24dd33d68d1e797a3c273c32cddc3fb9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fractal_rlm-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: fractal_rlm-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 68.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
719835b3914e6ca6e57daf08a7b3cefe1d34f86febdf4c680ff84c17ccd19d82
|
|
| MD5 |
6c6bb6d8b9da25daf7a4a856785459bc
|
|
| BLAKE2b-256 |
fdfbb99b23eef72ec9817f3bb40365de190479b7cb146fd82de0f34222e4284c
|
Provenance
The following attestation bundles were made for fractal_rlm-0.1.0a1-py3-none-any.whl:
Publisher:
release.yml on Trampoline-AI/fractal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fractal_rlm-0.1.0a1-py3-none-any.whl -
Subject digest:
719835b3914e6ca6e57daf08a7b3cefe1d34f86febdf4c680ff84c17ccd19d82 - Sigstore transparency entry: 1861439560
- Sigstore integration time:
-
Permalink:
Trampoline-AI/fractal@7ccdd55e24dd33d68d1e797a3c273c32cddc3fb9 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/Trampoline-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7ccdd55e24dd33d68d1e797a3c273c32cddc3fb9 -
Trigger Event:
push
-
Statement type: