Skip to content

WorkTrees

WorkTrees are the foundation of how Lody isolates and manages concurrent tasks.

What is a WorkTree?

A Git worktree is a linked working copy of your repository. Each worktree has its own working directory with a separate checked-out branch, but shares the same Git history with your main repository.

How Lody Uses WorkTrees

When you create a task in Lody, it automatically:

  1. Creates a new branch - Default name is session/<shortSessionId> (first 8 chars of sessionId; you can rename it)
  2. Sets up a worktree - An isolated directory where the agent works (one per session)
  3. Syncs changes - Real-time updates visible in the web UI
~/.lody/repos/<repoId>/
├── bare.git/                # Bare Git repository (shared history)
├── cache/                   # Build cache, etc.
└── worktrees/
    ├── <sessionId-1>/       # WorkTree for session 1
    └── <sessionId-2>/       # WorkTree for session 2

Benefits

Parallel Execution

Each task gets its own worktree, so agents never step on each other's changes.

Clean Isolation

  • No uncommitted changes mixing between tasks
  • Easy to review, approve, or discard individual tasks
  • Simple PR creation per task

Automatic Cleanup

Cleanup is not fully implemented yet. For now, you can manually delete the ~/.lody/repos directory to clean up. In the future, worktrees will be cleaned up when archived sessions are deleted.

Next Steps