Mechanism: Branch-per-Experiment
One-sentence definition
Branch-per-experiment means each agent attempt, slice, or hypothesis gets its own git branch — so you can compare, abandon, or merge one outcome without entangling others.
The problem
One branch accumulates three approaches: Redis cache attempt, in-memory fix, and the actual solution. Commits are interleaved. You cannot merge the winner without cherry-picking through noise. Deleting bad work means surgery.
One branch for all vibes is one shared scratchpad — convenient until it isn’t.
Symptoms:
- Branch name does not match current task
git logreads like a novel, not a PR- Hard to show colleague “approach A vs B”
- Abandoning work feels expensive
How it works
Hypothesis or slice
│
▼
branch experiment/
│
├── merge (winner)
├── abandon (delete branch)
└── compare (diff against base) Naming: experiment/health-uptime-bootstrap, agent/verbose-health-slice-2 — searchable, disposable.
Pair with rollback: branch tip is the snapshot.
When to use it
- Best-of-N comparisons
- Escalation retries that should not pile on same diff
- Split & conquer slices that might merge independently
- Any “let me try something else” moment
When not to use it
- Single linear slice already on a feature branch — one branch per feature is enough
- Branch explosion without cleanup — delete abandoned experiments weekly
Failure modes
Branch hoarding — 40 stale experiment/*. Fix: Delete or archive; document winner.
Same branch, new experiment — Commit approach B on approach A’s branch. Fix: New branch from base.
Merge without compare — First finished branch wins. Fix: Verify + checkpoint against criteria.
Base drift — Experiments branch from old main. Fix: Rebase or branch from current target.
Minimal example
Context: Two ideas for uptime: read from process.uptime() vs custom startedAt.
Steps:
experiment/health-uptime-process— agent implements A, test.experiment/health-uptime-started-at— fresh branch, agent implements B, test.- Compare curls and diff size; merge one; delete the other.
Done when: Loser branch deleted without touching winner’s history.
Tool instances (optional deep-dive)
Portable idea above; this section is tool-specific. Date: June 2026.
Cursor
- Agent on current branch; you create branch before agent starts.
git worktreefor parallel local experiments without switching.
Other tools
GitHub compare view, git diff main...experiment/foo.
Related mechanisms
- Playground — branches as playground units
- Rollback — reset branch to snapshot
- Best-of-N — N branches for N attempts
Try it yourself
Exercise: For your next “try another way” moment, create a new branch from base instead of continuing on the current one.
Done when: You can delete the failed branch with git branch -D guilt-free.

