Parallel AI agent isolation for Git repositories.
git-lanes enables multiple AI coding agents (Claude Code, Cursor, Aider) to work simultaneously on the same Git repository without creating conflicts. Each agent gets its own isolated lane β a dedicated branch and worktree β so they never step on each other's work.
- Problem
- Features
- Installation
- Quick Start
- Commands
- Configuration
- Adapter Support
- Architecture
- Requirements
- Contributing
- License
When multiple AI agents edit code simultaneously in a repository, they:
- Overwrite each other's changes
- Create merge conflicts
- Produce messy, interleaved commit histories
- Lose work during crashes or timeouts
git-lanes solves this by giving each agent its own isolated workspace with automatic change tracking, conflict detection, and clean PR generation.
- π Session Isolation β Each agent gets a dedicated Git worktree and branch, mapped by process ID
- π Change Tracking β Automatic tracking of file modifications with commit history
β οΈ Conflict Detection β Built-in detection of file overlaps across active sessions with resolution suggestions- πΎ Work Preservation β Auto-checkpoint captures work during timeouts or crashes via WIP commits
- π§Ή Clean PR Generation β Squash incremental edits into reviewable commits and generate pull requests
- π Multi-Adapter Support β Hooks for Claude Code, Cursor, and Aider
- π Multi-Forge PRs β Create pull requests on GitHub, GitLab, or Bitbucket
- π File Locking β Prevent race conditions with atomic manifest operations
- π¦ Zero Dependencies β Uses only Bun built-ins, no external runtime packages
# Install globally
bun install -g git-lanes
# Or use npx
bunx git-lanes <command># 1. Start a session
git lanes start add-search-feature
# 2. Work normally β files are tracked automatically
# (your AI agent edits files here)
# 3. Commit your changes
git lanes commit -m "add search component with fuzzy matching"
# 4. Check for conflicts with other sessions
git lanes conflicts
# 5. Run tests
git lanes test
# 6. Create a pull request
git lanes pr --title "Add search feature with fuzzy matching"
# 7. End the session
git lanes end| Command | Description |
|---|---|
git lanes start <name> |
Create a new isolated session |
git lanes end [-m <msg>] |
Finalize session, commit pending changes |
git lanes abort |
Discard session and all changes |
| Command | Description |
|---|---|
git lanes track <files...> |
Mark files for next commit |
git lanes status |
Show current session state |
git lanes diff |
Show staged/unstaged modifications |
git lanes commit -m <msg> |
Record a changeset |
git lanes log |
List all changesets in session |
git lanes undo |
Revert last commit, keep changes |
| Command | Description |
|---|---|
git lanes squash -m <msg> |
Consolidate commits into one |
git lanes merge |
Integrate session into main branch |
git lanes pr --title <t> |
Create pull request |
| Command | Description |
|---|---|
git lanes conflicts |
Detect file overlaps across sessions |
git lanes test |
Run tests in session worktree |
git lanes test --combine |
Run tests on merged sessions |
| Command | Description |
|---|---|
git lanes which |
Identify active session |
git lanes list |
Display all active sessions |
git lanes prune |
Remove orphaned sessions |
git lanes install-hooks |
Install agent hooks |
git lanes uninstall-hooks |
Remove agent hooks |
| Flag | Description |
|---|---|
--session, -s <name> |
Specify session explicitly |
--forge, -f <type> |
PR forge: github, gitlab, bitbucket |
--adapter, -a <name> |
Hook adapter: claude-code, cursor, aider |
--command, -c <cmd> |
Test command override |
Create a .lanes.json file in your repository root:
{
"shared_dirs": ["node_modules", ".venv"],
"main_branch_policy": "block",
"force_cleanup": "prompt",
"adopt_changes": "always",
"branch_prefix": "lanes/"
}| Option | Values | Default | Description |
|---|---|---|---|
shared_dirs |
string[] | [] |
Directories symlinked into worktrees |
main_branch_policy |
block, allow, prompt |
block |
Main branch write protection |
force_cleanup |
force, fail, prompt |
prompt |
Cleanup behavior on errors |
adopt_changes |
always, never, prompt |
always |
Uncommitted change adoption |
branch_prefix |
string | lanes/ |
Prefix for session branches |
git lanes install-hooks --adapter claude-codeInstalls three hooks that fully automate the git-lanes workflow:
| Hook | Trigger | What it does |
|---|---|---|
PreToolUse |
Before Write/Edit | Warns if no session is active |
PostToolUse |
After Write/Edit | Auto-tracks modified files |
Stop |
Claude Code exits | Auto-commits pending work as WIP |
Once installed, Claude Code will automatically track every file it touches. You just need to start a session:
git lanes start my-feature
# Claude Code works β files are auto-tracked
# When Claude exits, uncommitted changes are saved as WIP
git lanes mergegit lanes install-hooks --adapter cursorInstalls pre-save hooks for automatic file tracking.
git lanes install-hooks --adapter aiderInstalls pre-edit hooks to ensure session isolation.
git-lanes uses Git's native worktree feature to create isolated workspaces:
your-repo/
.lanes/
worktrees/
feature-a/ # Agent 1's isolated workspace
feature-b/ # Agent 2's isolated workspace
.git/
lanes-manifests/
feature-a.json # Session metadata
feature-b.json
Each session consists of:
- A Git branch (e.g.,
lanes/feature-a) - A Git worktree (isolated working directory)
- A manifest (JSON metadata tracking changesets and pending files)
See ARCHITECTURE.md for detailed technical documentation.
- Bun 1.0+ (or Node.js 20+ for npm installation)
- Git 2.20+ (for worktree support)
- GitHub CLI (
gh) β optional, forgit lanes prwith GitHub - GitLab CLI (
glab) β optional, forgit lanes pr --forge gitlab
See CONTRIBUTING.md for development setup and guidelines.