Skip to content

Claude Integration

LazyJJ integrates with Claude CLI for AI-assisted development workflows.

Prerequisites

Install Claude CLI:

Terminal window
npm install -g @anthropic-ai/claude-code

Optional but recommended:

  • tmux - For workspace management

Commands

CommandShortcutPurpose
claude-startclstartCreate JJ workspace + tmux session
claude-stopclstopStop and clean up workspace
claude-resolveclresolveResolve conflicts using Claude
claude-reviewclreviewReview a PR using Claude
claude-checkpoint-Save checkpoint with message

Workspace Management

Claude workspaces let you have Claude work on your code in an isolated JJ workspace:

Terminal window
# Start a Claude workspace
jj claude-start my-feature
# Output:
# Started tmux session: my-feature
# Attach with: tmux attach -t my-feature

This creates:

  1. A JJ workspace at .jj-workspaces/my-feature
  2. A tmux session running Claude

When done:

Terminal window
# Stop and clean up
jj claude-stop my-feature

Conflict Resolution

When you have merge conflicts, Claude can help:

Terminal window
# After a rebase with conflicts
jj claude-resolve

This runs Claude on each conflicted file to help resolve it.

PR Review

Have Claude review a pull request:

Terminal window
# Review current PR
jj claude-review
# Review specific PR
jj claude-review 123

Checkpointing

Create checkpoints while working:

Terminal window
# Save your progress with a message
jj claude-checkpoint "got auth working"

This describes the current commit and creates a new one.

Why Claude + JJ is Powerful

The combination of Claude and JJ creates unique advantages:

1. Safe Experimentation

JJ’s operation log means Claude can try things without fear. If Claude makes a mistake:

Terminal window
jj undo # Reverse Claude's last action
jj op log # See what Claude did
jj op restore <id> # Jump back if needed

2. First-Class Conflicts

JJ’s conflict model means Claude can attempt merges or rebases without blocking you. If conflicts arise, they’re just marked—you can keep working.

3. Natural Language → Stack Operations

Claude understands stack-based workflows. You can ask:

  • “Split this change into 3 stacked commits”
  • “Rebase my stack onto main and resolve conflicts”
  • “Edit the second commit in my stack to fix the bug”

Claude can manipulate your stack directly using JJ’s powerful commands.

Workflow Example

A typical AI-assisted development session:

Terminal window
# Start fresh from trunk
jj stack-start
# Start a Claude workspace for your feature
jj claude-start auth-feature
# Attach to Claude session
tmux attach -t auth-feature
# ... Claude helps you implement the feature ...
# Checkpoint your work periodically
jj claude-checkpoint "basic auth flow done"
# When done, stop the workspace
jj claude-stop auth-feature
# Review and clean up your commits
jj stack-view
jj squash # if needed
# Create PR
jj pr-stack-create

Tips

Multiple Claude Sessions

You can have multiple Claude workspaces:

Terminal window
jj claude-start feature-a
jj claude-start feature-b
# List workspaces
jj workspace list
# Attach to specific session
tmux attach -t feature-a

Without tmux

If you don’t have tmux, claude-start still creates the workspace:

.jj-workspaces/my-feature
jj claude-start my-feature
# tmux not available - start Claude manually in that directory
cd .jj-workspaces/my-feature
claude

Cleaning Up Old Workspaces

Terminal window
# List all workspaces
jj workspace list
# Forget a workspace
jj workspace forget workspace-name
# Remove the directory
rm -rf .jj-workspaces/workspace-name

Project by Ernesto Jiménez Ernesto Jiménez Bluesky GitHub