website/docs/architecture/index.md
This document explains how Beads' architecture works with Dolt as its storage backend.
Beads uses Dolt as its sole storage backend -- a version-controlled SQL database that provides git-like semantics (branch, merge, diff, push, pull) natively at the database level.
By default, Dolt runs in embedded mode (in-process, no separate server). For multi-writer
setups (multiple agents, orchestrator), switch to server mode which connects to a
running dolt sql-server. See the Dolt Server Mode section below for details.
flowchart TD
subgraph DOLT["🗄️ Dolt Database"]
D[(".beads/dolt/
<i>Version-Controlled SQL</i>")]
end
subgraph REMOTE["🌐 Dolt Remotes"]
R[("DoltHub / S3 / GCS
<i>Sync & Backup</i>")]
end
D <-->|"bd dolt push/pull"| R
U((User)) -->|"bd create
bd update"| D
D -->|"bd list
bd show"| U
style DOLT fill:#2d5a27,stroke:#4a9c3e,color:#fff
style REMOTE fill:#1a4a6e,stroke:#3a8ac4,color:#fff
:::info Source of Truth Dolt is the source of truth. Every write auto-commits to Dolt history, providing full version control, branching, and merge capabilities at the database level.
Recovery is straightforward: pull from a Dolt remote with bd dolt pull, or restore from a Dolt-native backup with bd backup restore.
:::
bd export produces JSONL for migration and interoperabilityUser runs bd create
→ Dolt database updated
→ Auto-committed to Dolt history
User runs bd list
→ Dolt SQL query
→ Results returned immediately
User runs bd dolt push
→ Commits pushed to Dolt remote
User runs bd dolt pull
→ Remote commits fetched and merged
When working across multiple machines or clones:
Always sync before switching machines
bd dolt push # Push changes before leaving
Pull before creating new issues
bd dolt pull # Pull changes first on new machine
bd create "New issue"
Avoid parallel edits - If two machines create issues simultaneously without syncing, Dolt's cell-level merge handles most conflicts automatically
See Sync Failures Recovery for data loss prevention in multi-machine workflows (Pattern A5/C3).
The Dolt server handles background synchronization and database operations:
.beads/dolt/sql-server.log:::tip
Start the Dolt server with bd dolt start. Check health with bd doctor.
:::
For CI/CD pipelines, containers, and single-use scenarios, no server is needed. Beads operates in embedded mode automatically when no Dolt server is running:
bd create "CI-generated issue"
bd dolt push
When embedded mode is appropriate:
:::warning Race Conditions in Multi-Clone Workflows When multiple git clones of the same repository run sync operations simultaneously, race conditions can occur during push/pull operations. This is particularly common in:
Prevention:
bd dolt stop) before switching between clonesSee Sync Failures Recovery for sync race condition troubleshooting (Pattern B2).
Dolt's version control makes recovery straightforward:
bd dolt pullbd backup restore [path] --forceThe following sequence resolves the majority of reported issues. For detailed procedures, see Recovery Runbooks.
bd dolt stop # Stop Dolt server (prevents race conditions)
git worktree prune # Clean orphaned worktrees
bd dolt pull # Pull from Dolt remote
bd dolt start # Restart server
:::warning Use bd doctor --fix With Care
Always back up and preview before running bd doctor --fix:
cp -r .beads .beads.backupbd doctor --dry-run — shows what would be fixed without making changesbd doctor (no flags) — diagnostic only, no changes madebd doctor --fix — or bd doctor --fix -i to confirm each fix individuallyWhy caution? The --fix flag may remove dependencies it flags as circular, including valid parent-child relationships. Use --fix-child-parent only if you're certain the flagged deps are invalid.
Other diagnostic tools:
bd blocked — check which issues are blocked and whybd show <issue-id> — inspect a specific issue's state
:::See Recovery for specific procedures and Database Corruption Recovery for Dolt recovery steps.
Dolt is a version-controlled SQL database that provides git-like semantics natively. Unlike plain SQLite (binary merge conflicts) or JSONL (slow queries), Dolt gives you both fast SQL queries and proper merge semantics.
Beads is designed for offline-first, local-first development. The Dolt server runs locally -- no cloud dependency, no downtime, no vendor lock-in, and full functionality on airplanes or in restricted networks.
| Benefit | Trade-off |
|---|---|
| Works offline | No real-time collaboration |
| Version-controlled database | Requires Dolt server |
| Cell-level merge | Requires initial setup |
| Local-first speed | Manual sync to remotes |
| SQL queries | Dolt binary dependency |
Beads is not suitable for:
For these use cases, consider GitHub Issues, Linear, or Jira.