Architecture
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 runningdolt sql-server. See the Dolt Server Mode section below for details.
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.Why Dolt?
- Version-controlled SQL: Full SQL queries with native version control
- Cell-level merge: Concurrent changes merge automatically at the field level
- Multi-writer: Server mode supports concurrent agents
- Native branching: Dolt branches independent of git branches
- Works offline: All queries run against local database
- Portable:
bd exportproduces JSONL for migration and interoperability
Data Model
The database stores five kinds of records: issues (the beads themselves), dependencies (typed edges such asblocks, parent-child, related, and discovered-from), labels, comments, and events (the audit trail). What each means — and how bd ready computes the claimable frontier from them — is covered in How Beads Works.
Issue IDs are content-derived hashes (bd-a1b2) so that concurrent writers never collide and no central ID coordination is needed. See Hash-based IDs for the design and COLLISION_MATH for the birthday-paradox analysis of hash length vs collision probability.
Issue Schema
Core fields on every issue, as stored in Dolt and emitted inbd export JSONL. Optional fields are omitted when empty.
Issues also carry workflow-layer field groups, among others: scheduling (
due_at, defer_until), claim leasing (lease_expires_at, heartbeat_at), gates (await_type, await_id, timeout), and molecule/wisp fields (ephemeral, mol_type, bonded_from).
Internal fields — content_hash (a SHA-256 of the issue’s canonical content, used for change detection), source_repo, and id_prefix — never appear in exports.
The schema is stable by default: prefer the metadata field for integration-, orchestrator-, or team-specific data before proposing new first-class fields. See the Project Charter’s schema boundary.
Data Flow
Write Path
Read Path
Sync Path
refs/dolt/data, separate from code branches. See Sync Concepts for the wire format and setup.
Cross-repo setups can also exchange beads peer-to-peer via federation. Ephemeral wisps are excluded from federation push by default, so execution traces never enter shared history.
Multi-Machine Sync Considerations
When working across multiple machines or clones:-
Always sync before switching machines
-
Pull before creating new issues
- Avoid parallel edits - If two machines create issues simultaneously without syncing, Dolt’s cell-level merge handles most conflicts automatically
Dolt Server Mode
The Dolt server handles background synchronization and database operations:- Manages the Dolt database backend
- Handles auto-commit for change tracking
- Provides concurrent access for multiple agents
- Runtime files live directly in
.beads/:dolt-server.pid,dolt-server.log, anddolt-server.port
~/.beads/shared-server/ for all projects, enabled with dolt.shared-server: true in config.yaml or BEADS_DOLT_SHARED_SERVER=1 — see Dolt Backend.
Embedded Mode (No Server)
Embedded mode is the default (bd init with no flags): Dolt runs in-process, single-writer, with data at .beads/embeddeddolt/ — no server process and no separate Dolt install. Server mode is opt-in via bd init --server; the choice is persisted in .beads/metadata.json.
- CI/CD pipelines (Jenkins, GitHub Actions)
- Docker containers
- Ephemeral environments
- Scripts that should not leave background processes
Multi-Clone Scenarios
See Sync Failures Recovery for sync race condition troubleshooting (Pattern B2).Directory Layout
bd init writes a .beads/.gitignore that keeps the database and runtime files out of git.
Recovery Model
Dolt’s version control makes recovery straightforward:- Lost database? → Pull from Dolt remote:
bd dolt pull - Have a backup? → Restore it:
bd backup restore [path] --force - Merge conflicts? → Dolt handles cell-level merge natively
bd backup init (a filesystem path or DoltHub destination) and push them with bd backup sync. Dolt-native backups preserve full commit history; a JSONL export does not.
Universal Recovery Sequence
The following sequence resolves the majority of reported issues. For detailed procedures, see Recovery Runbooks.Design Decisions
Why Dolt?
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.Why not a cloud server?
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.Trade-offs
When NOT to use Beads
Beads is not suitable for:- Large teams (10+) — Git-based sync doesn’t scale well for high-frequency concurrent edits
- Non-developers — Requires Git and command-line familiarity
- Real-time collaboration — No live updates; requires explicit sync
- Rich media attachments — Designed for text-based issue tracking
Related Documentation
- How Beads Works — The concept model: beads, dependencies, ready work, molecules
- Sync Concepts — Cross-machine sync, wire format, and anti-patterns
- Dolt Backend — Embedded vs server mode in depth, shared server, migration
- Recovery Runbooks — Step-by-step procedures for common issues
- CLI Reference — Complete command documentation
- Getting Started — Installation and first steps
- Project Charter — Product scope and boundaries (contributor doc)
- Internals — Implementation details (contributor doc)