Environment:777genius Agent teams ai Git Worktrees
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Version_Control |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Git worktree infrastructure for scoped code changes, diff extraction, and review application in isolated working directories.
Description
The app uses Git worktrees to isolate code changes made by AI agent teammates. Each teammate works in its own worktree, and the app extracts diffs, applies review decisions, and manages file transactions within those worktree directories. The app detects worktree sources from multiple tools (Cursor, Vibe Kanban, Conductor, Auto-Claude, 21st/1code, Claude Desktop, Claude Code) and groups sessions by worktree. File mutations use atomic write-then-rename with review file transaction manifests for crash recovery.
Usage
Use this environment for implementations that extract diffs, apply review decisions, or detect worktree-grouped sessions: `ChangeExtractorService`, `ReviewApplierService`, and worktree session discovery.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | macOS, Windows, or Linux | Cross-platform; path normalization differs on Windows |
| Tool | Git >= 2.20 | Worktree support required |
| Disk | Worktree storage | Separate working directory per teammate |
Dependencies
System Packages
- `git` >= 2.20 (worktree support)
Node.js Packages
- No additional packages — uses Node.js `fs` and `child_process` for git operations
Credentials
No special credentials required. Git authentication is handled by the user's existing Git configuration.
Quick Install
# Git is typically pre-installed. Verify worktree support:
git worktree list
# The app auto-detects worktrees from known paths:
# .claude/worktrees/, .claude-worktrees/, .cursor/worktrees/, etc.
Code Evidence
Worktree source types from `domain.ts:155-161`:
export type WorktreeSource =
| 'vibe-kanban' // /tmp/vibe-kanban/worktrees/{issue-branch}/{repo}
| 'conductor' // Conductor-managed worktrees
| 'auto-claude' // /Users/.../.auto-claude/worktrees/tasks/{task-id}
| '21st' // /Users/.../.21st/worktrees/{id}/{name}
| 'claude-desktop' // /Users/.../.claude-worktrees/{repo}/{name}
| 'claude-code' // /Users/.../.claude/worktrees/{name}
Worktree pattern constants from `worktreePatterns.ts:12-13`:
export const WORKTREES_DIR = 'worktrees';
Atomic file transaction for review mutations from `atomicWrite.ts:595-637`:
// prepare → detach → publish phases with manifest
// Uses hardlinks for crash-safe atomic publish
await writeReviewFileTransactionManifest(transaction, 'published');
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| File changed during review update | Concurrent modification of source file | Transaction manifest detects identity change; operation aborts |
| Review mutation refuses symbolic or multiply-linked files | Symlink or hardlink with nlink > 1 detected | Worktree must contain regular files only |
| Worktree not detected | Unknown worktree path pattern | Add pattern to `worktreePatterns.ts` |
Compatibility Notes
- Windows: Path normalization lowercases all paths; `path.win32` used for worktree path operations.
- Symlinks: Review file transactions refuse symbolic or multiply-linked files to prevent ambiguous state.
- Crash recovery: Three-phase transaction (prepare → detach → publish) with manifest allows resuming interrupted mutations.