Branch-Aware LLM Writes¶
Type: Safety pattern for agentic applications
Definition¶
Branch-aware writes is the design pattern where LLMs are restricted to writing only on database branches, never on the main branch. The user reviews the diff between the branch and main before deciding to merge or reject the changes. This creates a human-in-the-loop safety mechanism for agentic writes.
This is the database-level equivalent of how developers use feature branches in Git — work in isolation, review before merging.
How It Works¶
- LLM creates a branch (or is given one) for its work
- LLM writes happen on the branch — never touching main
- Diff is computed — what changed between main and the branch
- User reviews the diff — sees exactly what the LLM changed
- User decides:
- Merge — accept changes, apply to main
- Reject — delete branch, main unchanged - Conflict detection — if real user changes happened on main simultaneously, Dolt detects conflicts
Key Properties¶
- Isolation — LLM writes never affect the live application state
- Visibility — diffs show exactly what changed
- Rollback — rejecting is trivial (delete branch)
- Conflict safety — sophisticated detection prevents overwriting real changes
- Auditability — full commit history of what LLMs did and when
Why It Matters¶
Without branch-aware writes, LLM mistakes are:
- Invisible (no diff to see what changed)
- Permanent (no easy undo)
- Dangerous (can overwrite real data)
The Google Sheets + Gemini example: Gemini deleted all data, no diff view, Cmd+Z didn't work. With branch-aware writes, the same mistake would be a branch the user could simply reject.
Related Concepts¶
- cursor-for-everything — the broader pattern this fits into
- versioning/git-automation — Git-level version control (different scope)
- chat-on-the-side — the UI that presents branch diffs to users
- dolt-as-agentic-database — the database that makes this possible
Source¶
- cursor-for-everything — full source article