JetBrains / JetBrains/thinkrail
Expose pi's session fork to roll back conversation without touching files
- Dominant language
- TypeScript
- Stars
- 467
- Forks
- 37
- Avg merge
- 1d 56m
- Merged PRs (30d)
- 141
Description
## Problem
Claude Code has `/rewind`, which lets you roll a conversation back to an earlier point without touching the working tree's file changes — useful when the agent went down a bad reasoning path but the code edits made along the way are still worth keeping (or you want to retry the conversation from that point independently of the files).
ThinkRail's underlying engine, `pi`, already has the matching primitive: a `fork` RPC command (`get_fork_messages` to list candidate user messages, `fork` / `AgentSessionRuntime.fork()` to create a new session starting at a chosen earlier user message). Forking only replaces the active session/conversation state — it doesn't touch files on disk.
However, this capability isn't wired into ThinkRail at all: there's no handler for it in `packages/server`, nothing in `packages/contracts`, and no UI affordance in `apps/web` (no button/command on past user messages, no session picker). Today there's no way to rewind a conversation from the ThinkRail UI.
## Proposed solution
Expose `pi`'s fork capability through ThinkRail:
- Add `fork` / `get_fork_messages` to the server-side RPC handling and the typed wire in `packages/contracts`.
- Add a UI affordance in `apps/web/src/chat` — e.g. a "rewind to here" / "fork from here" action on past user messages — that lists forkable messages and starts a new session at the chosen point, leaving the working tree untouched.
## Alternatives considered
## Additional context
Relevant `pi` docs: `docs/sessions.md` (`/fork`, `/tree`, `/clone`), `docs/rpc.md` (`fork`, `get_fork_messages` commands), `docs/sdk.md` (`AgentSessionRuntime.fork()`).
Contributor guide
Research direction
Read docs/sessions.md, docs/rpc.md, and docs/sdk.md for pi's fork and get_fork_messages commands, then inspect packages/server, packages/contracts, and apps/web/src/chat. Trace how existing RPCs and chat actions cross the wire. Done means forkable messages can be selected in the UI, a new session starts at the chosen point, and working-tree files remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- full-stack
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100