1
Fork 0
mirror of https://github.com/benkoppe/claude-tree synced 2026-09-19 16:19:52 -07:00
No description
  • TypeScript 98.1%
  • Nix 1.9%
Find a file
2026-09-17 09:53:23 -07:00
.github/workflows build: pin shared Effect adapter for global installations 2026-09-12 20:16:25 -07:00
docs core: order roots by conversation activity 2026-09-17 09:53:23 -07:00
nix cli: add private production history diagnostics 2026-09-11 18:50:01 -07:00
src core: order roots by conversation activity 2026-09-17 09:53:23 -07:00
test core: order roots by conversation activity 2026-09-17 09:53:23 -07:00
.envrc Initial commit 2026-08-29 12:58:56 -07:00
.gitignore core: add Claude conversation tree navigator 2026-08-30 17:48:12 -07:00
AGENTS.md docs: record project goals and agent guidance 2026-08-30 09:33:36 -07:00
bun.lock build: pin shared Effect adapter for global installations 2026-09-12 20:16:25 -07:00
bun.nix core: rewrite runtime with Effect v4 2026-09-02 07:55:54 -07:00
flake.lock nix: use bun2nix binary cache 2026-09-01 10:04:00 -07:00
flake.nix nix: use bun2nix binary cache 2026-09-01 10:04:00 -07:00
LICENSE Add MIT License to the project 2026-08-31 02:07:40 -04:00
package.json build: pin shared Effect adapter for global installations 2026-09-12 20:16:25 -07:00
README.md core: preserve shutdown failure details in error reporting 2026-09-16 15:23:21 -07:00
statix.toml Add statix.toml 2026-08-31 01:41:52 -07:00
tsconfig.json core: enforce unused code checks 2026-09-04 16:21:36 -07:00

claude-tree

/tree (from pi agent) for Claude Code and other agents.

claude-tree turns a project's agent conversations into a navigable message tree, making it much easier to manage large & winding sessions without a long, linear history. Sessions that are out of view keep running in the background in their provider's native interface.

Claude Code is selected by default. Pass --codex to use Codex, and optionally pass the project directory:

claude-tree /path/to/project
claude-tree --codex /path/to/project

claude-tree does not create Git worktrees or restore files to their state at the fork point.

Quick Start

claude-tree is project-scoped. Run it inside your project folder.

Bun

Requires Linux or macOS, Bun, Claude Code or Codex on $PATH, and a truecolor terminal using a nerdfont.

bun add --global github:benkoppe/claude-tree

cd /path/to/project
claude-tree

This installs the current main branch. Run the install command again to update it.

If the command is not found after installation, add $BUN_INSTALL/bin (normally $HOME/.bun/bin) to $PATH.

On musl Linux, set OPENTUI_LIBC=musl when running claude-tree.

Nix

nix run github:benkoppe/claude-tree

If provider CLIs are already installed separately, use #unwrapped to keep the existing commands on $PATH:

nix run github:benkoppe/claude-tree#unwrapped

Shutdown and recovery

Quitting stops the owned agent processes and restores the host terminal. Provider conversations remain available to resume later.

If shutdown fails, the error lists the affected sessions, cleanup stages, and underlying causes. Simultaneous terminal and navigation-persistence failures are reported together.

After an interrupted shutdown, claude-tree checks previous terminal ownership at startup and when opening a session. It releases an orphaned reservation once the old application, its terminal process group, and any recorded Codex sidecar group are definitely gone and its launch artifacts are removed. A saved stopping or cleanup-incomplete status alone does not block reopening.

If cleanup cannot be verified, the error identifies the remaining condition: a surviving process group, unknown liveness, failed artifact cleanup, or an acquisition interrupted before all process identities were recorded. Resolve that condition and retry. Recovery does not signal unidentified processes or guess that an incompletely recorded launch was harmless.

Opening a terminal allows up to ten seconds for each launch persistence operation, including normal contention with navigation saves. Persistence timeout errors include the time budget and last operation phase. Such a timeout means the application stopped waiting; it is not evidence that another terminal is running. Late reservations are released without starting a provider process.

Application metadata uses a strict, reset-only format under $XDG_STATE_HOME (default ~/.local/state). Older terminal-owner records without a resource inventory are rejected in place, rather than automatically upgraded or deleted. Any reset is explicit and affects application-owned relationships and UI metadata, not provider transcripts.

Development

The development shell includes Bun and the validated provider CLIs available for the platform:

nix develop
bun install --frozen-lockfile
bun run check # or nix flake check
bun run start

Without Nix, install Bun and at least one supported provider CLI before running the last three commands.

After changing bun.lock, regenerate the Nix dependency set with nix develop -c bun2nix -o bun.nix.