feat: principle #34 — git worktrees for agent isolation

This commit is contained in:
2026-03-31 21:39:04 +00:00
parent 691c0067b6
commit 4cc68ed3ae

View File

@@ -374,6 +374,26 @@ The goal is not containers for containers' sake — it's **isolation + reproduci
- Dev environment already uses `.devcontainer/Dockerfile`
- Next step: containerized worker execution (docker/podman per job)
### 34. Git Worktrees for Agent Isolation
When multiple agents work on the same repo, use git worktrees instead of branches. Each agent gets a full working copy without cloning.
- Agent writes to its own worktree — no merge conflicts during work
- Main branch stays clean until merge
- Agents can work in parallel on the same files
- Worktree = disposable sandbox. Commit → merge → delete.
- Cheaper than containers for code-only isolation (no image build, instant)
**Combination with containers:** Container for runtime isolation (process, network, filesystem). Worktree for code isolation (git history, no conflicts). Best of both:
- Agent runs in container (sandboxed execution)
- Container mounts a worktree (isolated code copy)
- Agent commits to worktree branch
- Team lead merges worktree branches → main
**Origin:** "Genauso wie git worktree, was wohl auch sehr clever ist"
**Caveat:** Worktree safety is critical — agents MUST commit before worktree deletion. See Principle #17 (Worktree Safety).
---
## (inbox — unsorted ideas)