The REAL Reason Pi Is Better Than Claude Code or Codex

The REAL Reason Pi Is Better Than Claude Code or Codex

Ben Holmes · ~8 min · Deep Dive Document
Video thumbnail
⏱ ~8 min 🎤 Ben Holmes 🏷 Pi · Claude Code · Codex · Conversation History · /tree · Agent Workflows

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

▶ 0:00

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.

The core problem: "How do I go back to the previous plan we built and explore that other option?" This is a common situation — you've gone deep into one solution and realize you want to backtrack and try a different approach.

2 Option 1 — Ask the Agent Directly

▶ 1:39

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

▶ 2:05

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

▶ 2:35

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
The problem with forking: to get a clean branch from an earlier decision point, you would have needed to be "super smart up front" — saving plans to markdown files or running /fork at exactly the right moment. This requires upfront thinking that contradicts how most developers actually work with agents.

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

▶ 3:31

Pi's /tree command is the solution: fork from any point in the past, not just the current position.

How It Works

  • Run /tree to 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

▶ 5:13

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
"You don't have to plan out when you save architecture diagrams or when you're going to fork. You can just move forward as far as you want and then branch off later. It's the grug-brain approach."

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

▶ 6:10

/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 curl but the web search extension wasn't installed — roll back to that tool call and fix the setup
  • The agent used a create-worktree skill but created the worktree from an unexpected directory — roll back to inspect why

8 Debugging Agent Meta-Behavior with /tree

▶ 6:33

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.

The /tree command turns debugging from a new-conversation problem into an in-context surgical fix. Roll back to the problematic tool call, ask why, fix the skill, then return to the main thread — all without losing context or starting over.

🎯 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

Timestamp Index

▶ 0:00Intro — Pi as a coding agent harness, /tree feature
▶ 0:29Real example — exploratory E2E testing conversation in Codex
▶ 1:19Realizing MCP server might be simpler — the rollback problem
▶ 1:39Option 1 — ask the agent directly (context pollution)
▶ 2:05Option 2 — /fork and /branch (wholesale copy)
▶ 2:35Limitations of forking — no rollback, defensive prompting needed
▶ 3:31Pi's /tree — selecting any point to branch from
▶ 4:30Summarization options — compact, custom prompt, or clean rollback
▶ 5:13History preservation — branching tree structure, no rewrites
▶ 5:48The grug-brain approach — branch retroactively
▶ 6:10Rolling back to tool calls — debugging agent behavior
▶ 6:33Worktree skill bug — asking why at a specific tool call
▶ 7:29Comparison to /side and /btw in Codex/Claude Code
▶ 7:49Returning to the main thread — arrow key navigation