Overview
Beads uses git for:- Project hosting - Your code repository also hosts beads configuration
- Hooks - Auto-sync on git operations
File Structure
bd init writes .beads/.gitignore to keep the database directory and
runtime files out of git. Never track the database directory
(.beads/embeddeddolt/ or .beads/dolt/) in git or via Git LFS.
A .beads/.gitignore that an older bd wrote can lack patterns a newer bd
adds. In server mode, bd doctor reports the file as outdated, and
bd doctor --fix appends the missing patterns, keeping your own rules, and
untracks runtime files that were already committed. Embedded mode (the
default) and proxied-server mode do not run these checks: there, add the
missing patterns to .beads/.gitignore by hand and run git rm --cached
on any runtime file already committed.
Git Hooks
Installation
bd init installs hooks by default (skip with bd init --skip-hooks). To
install or refresh them manually:
bd hooks run <hook-name>. Upgrading
bd automatically updates the delegated behavior inside that command; the
shim’s generated shell policy remains installed content and changes only when
the hook is installed or refreshed:
The shims use section markers to coexist with existing hooks — content
outside the markers is preserved across installs and upgrades. Install
variants:
bd resolves the shared git directory,
so installing from a linked worktree works.
In releases after v1.3.2, bd hooks install (and the hook install bd init
runs) refuses a hooks directory that is itself a symlink, including a dangling
one, in every mode: .git/hooks, a core.hooksPath directory, .beads-hooks/
and .beads/hooks/. It refuses before copying existing hooks, writing any
hook, or changing core.hooksPath, because each write would land in the
link’s target. Replace the symlink with a real directory and re-run. A symlink
higher up the path, such as a .beads directory that links to external
storage, is still supported.
Status
Uninstall
core.hooksPath. In a real
hooks directory it leaves a symlinked hook and its target untouched, and it
restores a <hook>.backup only when that backup is a regular file; each
skipped entry is named in a warning, and the other hooks are uninstalled as
usual.
External Hook Managers
bd detects these external git hook managers and checks whether their config callsbd hooks run:
- lefthook — YAML/TOML/JSON config
- husky —
.husky/directory scripts - pre-commit —
.pre-commit-config.yaml - prek — Rust-based pre-commit alternative (same config)
- hk — fast hook manager using Pkl config
- overcommit — Ruby-based (detection only)
- yorkie — detection only
- simple-git-hooks — lightweight JS (detection only)
bd doctor reports whether a detected manager is integrated with bd, and
bd doctor --fix reinstalls the hooks with --chain so the manager’s
existing hooks keep running.
For config-driven managers, add bd steps directly. Example hk.pkl:
Hook Timeout
The hook shim applies a soft deadline tobd hooks run when a compatible
helper is available. It
uses timeout or gtimeout only after a successful identity probe for GNU
coreutils or uutils coreutils (same command line, same exit status), avoiding
the incompatible timeout.exe that native Windows can place on PATH. At the
configured deadline the coreutils helper sends TERM to bd and its process
group, which holds the chained hook and the bd export or bd import that
bd waits on. Without one, the Perl fallback runs bd in a process group of
its own and does the same, then sends the group KILL if bd is still
running two seconds later. A Ctrl-C, hangup, or TERM that reaches the hook
is passed on to that group. On Git for Windows a coreutils timeout (GNU or
uutils) is the preferred deadline backend.
The default deadline is 300 seconds (5 minutes), which accommodates chained
pre-commit pipelines (eslint, prettier, TypeScript compilation). Override it
with the BEADS_HOOK_TIMEOUT environment variable:
TERM can
outlive them. Both helpers run bd outside the terminal’s foreground process
group, so a chained hook that reads from the terminal is stopped until the
deadline ends it. If neither a coreutils timeout nor Perl is available, the hook
warns and runs directly without a deadline; that last-resort path can hang until
the hook itself returns.
Already-installed hook sections are not refreshed automatically. After upgrading
to a release that changed the generated timeout probe — the name-only check,
the uutils coreutils banner, or the Perl fallback that could not stop bd
(#7753) — run
bd hooks install once to refresh
already-installed canonical hook sections. Automatic generated-policy adoption is
tracked separately.
When the timeout is reached, beads prints a warning and lets the git
operation proceed — the commit or push is not blocked.
Conflict Resolution
Dolt handles merge conflicts at the database level using its built-in merge capabilities. When conflicts arise during sync, Dolt identifies conflicting rows and allows resolution through SQL.Protected Branches
Dolt stores data underrefs/dolt/data, separate from Git refs. This means
beads data does not conflict with protected Git branches, and no separate
beads-sync branch or protected-branch exception is needed. On new projects
with a Git origin, bd init configures that origin as the Dolt remote
automatically.
See Protected Branches for the full
workflow, including legacy beads-sync cleanup.
Git Worktrees
Beads works in Git worktrees without extra setup. Linked worktrees discover the repository’s.beads workspace and sync issue data through Dolt:
.beads workspace: discovery follows
BEADS_DIR if set, then the main repository’s .beads, preventing database
duplication across worktrees. Use bd where as the authoritative check for
which workspace is active — a local ./.beads may legitimately be absent in
a worktree. Embedded mode (the default) serves one writer at a time; for
concurrent writers across worktrees, use server mode. See
Git Worktrees for the full guide.
Older beads versions documented a sync.branch workflow that created hidden
Git worktrees. That workflow has been removed; current sync uses Dolt remotes.
Branch Workflows
Feature Branch
Fork Workflow
.beads/. Best for open source
contributors, solo developers, and private task tracking on public repos.
bd init auto-detects forks and offers to configure .git/info/exclude
(--setup-exclude) so beads files stay local. Set the role without prompting
via --role contributor or --role maintainer (the default in
non-interactive mode).
Team Workflow
Duplicate Detection
After merging branches:Branchless Workflows (Jujutsu / jj)
Beads works with branchless VCS tools like Jujutsu (jj). Since beads data is stored in Dolt (not git branches), there is no dependency on the “current branch” concept.What Works Without Hooks
All core beads functionality works without git hooks:
To skip hooks entirely during init:
What Works Without AGENTS.md
The AGENTS.md file generated bybd init provides AI agent instructions. If
you manage your own agent instructions or don’t want beads to modify tracked
files:
Jujutsu Setup
Colocated repos (jj git init --colocate): Git hooks work normally.
Beads installs simplified hooks (pre-commit and post-merge only, no
staging logic).
Pure jj repos (no git): Since jj doesn’t have native hooks yet, set up
push aliases:
jj push instead of jj git push.
Best Practices
- Install hooks -
bd hooks install - Push regularly -
bd dolt pushat session end - Pull before work -
bd dolt pullto get latest issues - Use normal Git worktrees - no sync branch is required