Skip to main content
Forking splits the current conversation into a second timeline you can continue independently — try a second approach without losing the first. You are mid-conversation with an agent, you want to try an alternative, and you fork instead of losing your place:

Quick Start

1

Fork here, keep talking

Type /branch mid-conversation to fork at the current point and switch onto the fork:
The next message continues on the fork; the parent stays resumable.
2

Fork from earlier

Rewind before forking with --at NN counts user turns back:
Forks from 3 user turns back and switches onto that fork.
3

Fork a saved session (no REPL)

Fork a session from the command line, then resume the fork:

How It Works

Forking routes through the same HierarchicalSessionStore.fork_session substrate whether you branch in the REPL or from the CLI.

When to Fork

Pick the command that matches where you want to fork from.

Options

/branch (REPL) and praisonai session fork (CLI) share the same substrate but differ in how the fork point is expressed. /branch — REPL command praisonai session fork — CLI verb
--at N in the REPL counts user turns back from the end. --at-message N in the CLI is a 0-based message index into the parent’s full history. They are different units — pick the one that matches the surface you’re on.

Lineage

Forking records parent/child links that surface everywhere sessions are shown. The /session command prints lineage when set:
The parent shows its forks:
session list gains a Parent column — an 8-character parent id prefix, or - for a root session:
The --json output includes parent_id per session:

Guardrails

Forking refuses unsafe operations rather than producing a corrupted timeline.
/branch refuses if a response is still processing — otherwise the parent’s completed turn would land on the freshly-switched fork:
Wait for the turn to settle (check /status), then branch.
N must be a positive integer no greater than the number of user turns:
--at-message is 0-based and validated up front against the parent’s message count — no silent slice wrap:
A session fork on an unknown id exits 1 with a remediation hint:
In the REPL, /branch with no active session prints No active session to branch from. and a store failure prints Could not fork the current session. — neither crashes the REPL.

JSON Output

session fork --json returns the fork result as a single object:
from_message_index and title are null when not passed.

Best Practices

Pass a title (/branch jwt-attempt or --title "...") so session list reads like a menu of explorations instead of anonymous ids.
Branch only after the current response settles — /branch refuses mid-turn to keep the fork clean. Check /status if unsure.
The parent timeline stays on disk. Note its id from the ✓ Branched: line so you can praisonai session resume <parent_id> to jump back.
Use /branch --at N to count user turns in the REPL; use session fork --at-message N for an exact 0-based message index from the CLI.

Session Command

Full session sub-command reference, including fork

Interactive TUI

REPL slash commands, including /branch