fractal README

The project's README from github.com/plasma-ai/fractal. As one markdown file: README.md.

fractal

license build docs lint tests codecov pre-commit

Hierarchical agent loops with recursive self-organization.

In a fractal, autonomous agent loops arrange themselves into a tree: a node iterates toward a goal in its own git worktree and spawns child nodes for separable subtasks, so the tree grows to fit the problem rather than a fixed plan. Hard caps (iterations, depth, children, cost, time) keep each loop bounded, and an operator can steer or stop it at any point. Run metadata (including cost) lands in one local SQLite database, which can be interacted with live in a terminal UI.

fractal TUI dashboard

[!WARNING] Nodes run their agent without permission prompts by default. Unattended loops cannot stop to ask, so every seeded agent config disables the approval gate — Claude bypassPermissions, Codex danger-full-access, Grok --always-approve, opencode --auto, omp --yolo. A node can therefore run any command its agent decides to run, with your credentials and your machine's reach. The per-node git worktree isolates the branch it commits to, not the filesystem, the network, or anything else outside it. Only launch nodes whose task you would trust to run unsupervised, and prefer a sandboxed or otherwise disposable host for anything else.


Source: https://github.com/plasma-ai/fractal

Package: https://pypi.org/project/plasma-fractal/

Documentation: https://docs.plasma.ai/fractal


Installation

Install the fractal package from PyPI:

pip install plasma-fractal

or

pip install fractal

Use pipx install or uv tool install to install the package in an isolated environment. If you use one of these two methods, you must also install plasma-wiki (a plain pip install pulls plasma-wiki and puts wiki on your PATH, but this is not the case when using pipx install or uv tool install).

uv tool install plasma-fractal --with-executables-from plasma-wiki does the same in one command.

Open the dashboard from your project root with fractal open (requires an initialized fractal). Pass --light if your terminal uses a light color scheme.

Skill

Install the skill for your agent via the plugin marketplace (Claude Code and Codex):

# Claude Code
/plugin marketplace add plasma-ai/plugins
/plugin install fractal@plasma

# Codex
codex plugin marketplace add plasma-ai/plugins
codex plugin add fractal@plasma

Another install route is from the CLI, which copies (or symlinks) the fractal and wiki skills into ~/.claude/skills and ~/.agents/skills (add --project for the current project only):

fractal install [--link]

After upgrading the package, re-run fractal install to refresh the copied skills (pass --link for symlinked install).

Usage

A fractal is a tree of git worktrees, each running an autonomous agent loop. The root (user) node is your current branch itself — it has no worktree or loop of its own; top-level nodes branch from it, and child nodes branch from their parent. Agents iterate in tmux sessions (or, with --headless, in detached process groups), and all state (runs, iters, steps, costs, signals) is tracked in a local SQLite database.

Five agent backends are supported — Claude Code (claude), Codex (codex), Grok Build (grok), OpenCode (opencode), and Oh My Pi (omp) — selected per node with --agent (children inherit it). Claude and Codex can additionally route through OpenRouter with --provider=openrouter, which authenticates via OPENROUTER_API_KEY from the launching shell; OpenCode and Oh My Pi reach OpenRouter natively through their own openrouter/<author>/<model> model ids.

Use the /fractal skill to spawn and manage agent nodes. The fractal CLI is also available directly — run fractal --help and fractal <command> --help to explore.

The skill is invoked as /fractal [directive] and takes plain-language instructions. The agent interprets the directive and prints any suggested NODE.md instructions and completion requirement it can distill from the directive, plus a table of every parameter (empty where the directive said nothing), then asks for anything it could not infer. From there it walks you through refining the node's definition and, once you approve, launches the node in a tmux session. On hosts where tmux cannot run, add --headless; the node's output appends to headless.log, delegated child starts follow the parent's backend, and an unflagged relaunch reuses the backend the node last launched with.

Parameters the skill interprets from the directive:

Development

Install

Run install.sh in the package root. With no environment active it creates and uses a local .venv; with one active (e.g. pyenv) it installs into that environment (editable), without recreating it:

./install.sh --all-extras --groups=test,lint,type

Run ./install.sh --help for all options. Alternatively, run uv sync --all-extras --group test --group lint --group type and uv run pre-commit install to set up the environment manually.

Installing a dependency as editable (e.g. a sibling package) is left to the caller: uv pip install --editable <path>.

With an editable install, fractal install --link symlinks the bundled skill into the agent skill directories instead of copying it, so skill edits apply without re-running the install.

Once installed, run tools with uv run --no-sync <command>, or activate the environment first (source .venv/bin/activate).

Tests

Run the test suite:

pytest .

The suite runs with --doctest-modules enabled, and the integration tests create real git repositories and worktrees.

Linting

Run linters and formatters:

pre-commit run --all-files

Contributing

The contribution workflow, repository conventions, and release process (version sources, tagging, CI guard) are documented in:

Pull requests should be branched from dev, not main, and opened against dev — main only advances at releases.

License

Licensed under the Apache License 2.0 — see LICENSE.

Copyright © 2026 Plasma AI

fractal (plasma-ai/fractal)

Searching Database…

这是什么?Fractal 会生成自主的编程智能体循环,并把它们组织成一棵树:每个节点在自己的 git worktree 中朝着目标迭代,还可以为子任务派生子节点,让树随问题生长,而不是遵循固定计划。
这是 CLI 工具还是别的东西?它是一个 Python CLI 包(fractal 命令)外加一个终端仪表板。所有运行状态(运行、迭代、步骤、成本)都记录在单一的本地 SQLite 数据库中,你可以通过 TUI 实时浏览。
怎么安装并开始使用?从 PyPI 安装 fractal 包(或通过 pipx/uv tool install),然后在项目根目录运行 fractal open 启动仪表板。智能体技能可以通过插件市场添加,或运行 fractal install 把它们复制到 ~/.claude/skills 和 ~/.agents/skills。
它支持哪些编程智能体?支持五种智能体后端,用 --agent 按节点选择:Claude Code、Codex、Grok Build、OpenCode 和 Oh My Pi。Claude 和 Codex 还可以通过 OpenRouter 路由来获取模型,每个节点需要一个 tmux 会话(如果没有 tmux,可用 --headless 模式)。
运行之前最需要了解的风险是什么?默认情况下,每个预置的智能体配置都会禁用审批门槛(Claude 的 bypassPermissions、Codex 的 danger-full-access、Grok 的 --always-approve 等),因此节点可以按照其智能体的决定,用你的凭据和机器权限运行任何命令。每个节点的 git worktree 只把提交隔离到自己的分支,并不能隔离文件系统或网络,所以不可信的任务应在经过沙箱隔离或用过即弃的主机上运行。
它是为谁打造的?面向乐于运行无人值守、绕过权限的编程智能体的开发者,他们想把单个任务扩展成一棵相互协作的智能体循环树,同时对迭代次数、深度、成本和时间设置硬性上限,让一切保持可控。
fractal 如何控制每个智能体循环的成本?你可以设置按运行、按迭代和按步骤的成本上限(max-cost、max-iter-cost、max-step-cost),外加用于收尾的 reserve-budget;由于各次运行相互隔离,每次启动都会重新启用上限,而且在一次预算耗尽的运行之后,node start --continue 若不显式指定 --max-cost 将拒绝继续。
节点能在没有 tmux 的情况下运行吗?可以,传入 --headless 即可让节点作为独立的进程组而不是 tmux 会话运行,输出会追加到 headless.log。
日常怎么派生和管理节点?在你的智能体中使用 /fractal 技能并用大白话下达指令;它会推断名称、范围、预算和超时等参数,询问缺失的部分,等你批准后再启动节点。
节点的 git worktree 实际能提供什么隔离?它只隔离节点提交代码所在的分支,不隔离文件系统、网络或 worktree 之外的任何东西——所以危险的任务仍然需要经过沙箱隔离或用过即弃的主机。
Creator
plasma-ai
Size
5.8 MB
Stars
783
Updated
CommitSep 17
Age
3mo
Commits · 90 Days