◆ Overview
Ben Holmes zeros in on a single killer feature that makes the Pi coding agent harness stand out from Claude Code and Codex: /tree — a conversation history management system that lets you roll back to any previous point in a conversation and branch from there. Unlike the simple /fork or /branch commands available in other harnesses, /tree gives you surgical control over context, letting you explore alternative solutions without losing progress or polluting context. Ben demonstrates real-world scenarios including architecture exploration and debugging agent tool call behavior, making a compelling case for Pi's "grug-brain" approach to agent conversation management.
1 The Problem with Long Agent Conversations
Ben describes his typical workflow with coding agents — what he calls a "lazy" approach:
- No planning mode, no saved architecture documents
- Just have a long, exploratory conversation about what he wants to build
- When they arrive at something that feels buildable, ask the agent to implement it
He demonstrates with a real example: setting up end-to-end testing for a desktop app. The agent came back with multiple options, he picked one (a CLI package), the agent implemented it and verified it worked. But then Ben realized through reading the implementation that it might be simpler as an MCP server instead.
2 Option 1 — Ask the Agent Directly
The simplest approach — just tell the agent you want to change direction:
"I'm not sure I agree with this implementation. It might be simpler as an MCP server. Can you go explore that?"
This works "well enough," but creates context pollution:
- The agent still knows everything about the previous implementation (the Pi extension)
- You want a fresh start to explore the new solution — not a course correction contaminated by the old one
- The agent may carry assumptions and biases from the previous approach into the new exploration
3 Option 2 — Fork / Branch
Every major harness has a forking mechanism:
- Claude Code —
/branch - Codex —
/fork
The mechanics are simple: take your current conversation and copy it to a new thread. You keep the original thread to revisit later, and you get a new thread to explore a different solution. You can even work in a separate worktree with the forked conversation.
4 The Limitations of Forking
Forking doesn't solve the fundamental problem:
- No context control — fork copies everything wholesale. You can't choose what comes along
- No rollback — you can't go back to a specific earlier point in the conversation. The fork happens from wherever you currently are
- Requires defensive prompting — you have to predict in advance when you might need to fork and proactively save architecture docs or create branches
Ben's preferred style — prompt forward, explore freely, and branch when you realize you need to — doesn't fit the fork model.
5 Pi's /tree — A Wayback Machine for Agents
Pi's /tree command is the solution: fork from any point in the past, not just the current position.
How It Works
- Run
/treeto see every call and response in the conversation, including tool calls - Use arrow keys to page through the full history
- Select the exact point you want to roll back to
- Optionally summarize the context — compact everything, or add a custom prompt ("This solution didn't work, now explore a new one")
- The original prompt from that point is placed back in the prompt box — literally a Wayback Machine
In Ben's example, he rolls all the way back to the initial architecture plan where the agent listed multiple options, selects that point, and describes a new direction to explore — starting clean from the original decision point.
6 How /tree Preserves History
A critical design choice: /tree doesn't rewrite history when you resume from a previous point. It creates a branching tree structure:
- The original conversation thread is fully preserved
- New branches appear as forks from the selected rollback point
- You can visualize the entire tree of all branches and their divergence points
- No progress is ever lost — every path you've explored remains accessible
This is the key philosophical difference: instead of requiring defensive, upfront planning about when to save checkpoints, Pi lets you retrospectively create forks — work first, organize later.
7 Rolling Back to Tool Calls
/tree doesn't just show user prompts and agent responses — it shows individual tool calls too. Ben uses this for debugging agent meta-behavior:
- The agent tried to do a
curlbut the web search extension wasn't installed — roll back to that tool call and fix the setup - The agent used a
create-worktreeskill but created the worktree from an unexpected directory — roll back to inspect why
8 Debugging Agent Meta-Behavior with /tree
Ben demonstrates a powerful pattern: rolling back to a specific tool call and asking why the agent made that decision:
"Why did we create a worktree off of the other working directory? I would expect this to create a worktree off of the main branch always. Update the skill if we need to."
This is analogous to /side or /btw in Codex/Claude Code — asking a question unrelated to the main thread but with full context. The difference: Pi lets you target the exact tool call that was problematic.
In this case, the agent patched its skill file to always branch off of main. Then Ben used the arrow keys to navigate back to the main conversation thread and continue working — seamlessly.
🎯 Key Takeaways
🔑 Key Takeaways
- Context pollution is a real problem — telling an agent to change direction keeps all the old implementation context, biasing the new exploration
- /fork and /branch are limited — they copy the entire context from the current point, with no way to roll back or select what comes along
- Pi's /tree is fork + rollback — choose any previous point in the conversation to branch from, not just the current position
- History is never rewritten — /tree creates a branching tree structure where all paths are preserved and accessible
- The "grug-brain" approach — no need to defensively plan forks in advance. Prompt forward freely, branch retroactively when needed
- Tool calls are first-class citizens — /tree shows individual tool calls, not just user prompts and agent responses
- Debug agent behavior in-context — roll back to a problematic tool call, ask why the agent made that decision, fix the underlying skill, then return to the main thread
- Summarization is optional — when rolling back, you can compact context with a summary or add a custom prompt, or just roll back clean
- Similar to /side or /btw — but with the added power of targeting exact points in history rather than just forking from the current position
🔗 Resources & Links
- Pi — the minimal, extensible coding agent harness
- Warp Terminal — terminal with built-in voice mode and code review panel for Pi