Problem
Beads is tied to Git worktrees because bd init cannot run inside a worktree:
Error: cannot run 'bd init' from within a git worktree
Git worktrees share the .beads database from the main repository.
This makes it cumbersome to use Beads with Git Workbench's worktree-based workflow.
Solution
Add optional Beads integration to Git Workbench that automatically manages Beads lifecycle across repositories and worktrees.
Core features
- Automatic base initialization: When a new repository is created or cloned, run
bd init in the bare repository directory
- Worktree awareness: When creating worktrees, ensure Beads is initialized in the parent bare repo
- Startup guard: If Beads is enabled in config but
bd is not installed, refuse to start with a clear error message
Shared database (default)
By default, all worktrees share a single Beads database from the bare repository ($git-root/repo-name.git/.beads). This is the Beads-recommended behavior.
A shareBetweenWorktrees option can be set globally or per-repo to give each worktree its own independent database:
{
"beads": {
"enabled": true,
"shareBetweenWorktrees": false
}
}
Per-repo override:
{
"repos": [
{
"repoName": "standalone-project",
"beads": {
"enabled": true,
"shareBetweenWorktrees": false
}
}
]
}
Worktree creation toggle
The Create Worktree dialog should include a "Share beads with main repo" toggle. Default resolution: repo override → global config → true.
Configuration
Beads is disabled by default. Enable via data/repos-tracked.json:
{
"beads": {
"enabled": true,
"shareBetweenWorktrees": true
}
}
Behavior matrix
| Action |
Behavior |
| New repo created |
bd init --prefix <repo-name> -q in bare repo dir |
| Repo cloned |
bd init after clone completes |
| Worktree created (shared) |
Ensure bare repo has .beads; no per-worktree init |
| Worktree created (not shared) |
bd init --prefix <repo-name>-<worktree-name> -q in worktree dir |
| App startup |
Validate bd installed if Beads enabled anywhere |
| Init failure |
Log warning, do not block repo/worktree creation |
Files to change
src/types/config.ts — BeadsConfig interface (enabled, shareBetweenWorktrees)
src/lib/config.ts — Default config, startup validation
src/lib/beads.ts — Core helper module (new file)
src/app/api/repos/create/route.ts — Init Beads after repo creation
src/app/api/clone/route.ts — Init Beads after clone
src/app/api/worktrees/create/route.ts — Accept shareBeads, init accordingly
src/app/api/worktrees/route.ts (POST) — Same
src/app/api/worktrees/create-from-branch/route.ts — Same
src/app/api/worktrees/create-from-main/route.ts — Same
src/app/_client/components/CreateWorktreeModal.tsx — "Share beads" toggle
README.md — Documentation
Requirements
References
Problem
Beads is tied to Git worktrees because
bd initcannot run inside a worktree:This makes it cumbersome to use Beads with Git Workbench's worktree-based workflow.
Solution
Add optional Beads integration to Git Workbench that automatically manages Beads lifecycle across repositories and worktrees.
Core features
bd initin the bare repository directorybdis not installed, refuse to start with a clear error messageShared database (default)
By default, all worktrees share a single Beads database from the bare repository (
$git-root/repo-name.git/.beads). This is the Beads-recommended behavior.A
shareBetweenWorktreesoption can be set globally or per-repo to give each worktree its own independent database:{ "beads": { "enabled": true, "shareBetweenWorktrees": false } }Per-repo override:
{ "repos": [ { "repoName": "standalone-project", "beads": { "enabled": true, "shareBetweenWorktrees": false } } ] }Worktree creation toggle
The Create Worktree dialog should include a "Share beads with main repo" toggle. Default resolution: repo override → global config →
true.Configuration
Beads is disabled by default. Enable via
data/repos-tracked.json:{ "beads": { "enabled": true, "shareBetweenWorktrees": true } }Behavior matrix
bd init --prefix <repo-name> -qin bare repo dirbd initafter clone completes.beads; no per-worktree initbd init --prefix <repo-name>-<worktree-name> -qin worktree dirbdinstalled if Beads enabled anywhereFiles to change
src/types/config.ts—BeadsConfiginterface (enabled,shareBetweenWorktrees)src/lib/config.ts— Default config, startup validationsrc/lib/beads.ts— Core helper module (new file)src/app/api/repos/create/route.ts— Init Beads after repo creationsrc/app/api/clone/route.ts— Init Beads after clonesrc/app/api/worktrees/create/route.ts— AcceptshareBeads, init accordinglysrc/app/api/worktrees/route.ts(POST) — Samesrc/app/api/worktrees/create-from-branch/route.ts— Samesrc/app/api/worktrees/create-from-main/route.ts— Samesrc/app/_client/components/CreateWorktreeModal.tsx— "Share beads" toggleREADME.md— DocumentationRequirements
127.0.0.1:3307)References
docs/features/beads-integration.md