Beads - A memory upgrade for your coding agent https://beads.gascity.com
  • Go 95.2%
  • Python 1.6%
  • Starlark 1.5%
  • Shell 1.3%
  • Rust 0.2%
Find a file
Rongjun GENG 686bc798cb
fix(prime): honor shared-server mode consistently across bd prime's store resolution paths (#6589)
* fix(store-factory): honor shared-server mode in prime's store resolution

newDoltStoreFromConfig and its read-only sibling
openNonMutatingStoreFromConfig checked only cfg.IsDoltServerMode(),
which deliberately does not read dolt.shared-server from config.yaml
(to avoid a circular import with the doltserver package). A workspace
with config.yaml tracked but metadata.json gitignored as machine-local
state — the common shape of a linked git worktree — left
configfile.Load returning (nil, nil), so both paths silently fell
through to the embedded backend and created a phantom database named
"beads" instead of reaching the real shared server.

cmd/bd/main.go's own top-level command resolution already compensates
for this exact gap (GH#3817), but bd prime resolves its store through
a separate path (formatMemoriesForPrime -> ensureStoreActiveForPrime
-> ensureStoreActiveWithContext -> newDoltStoreFromConfig) that never
got the same fix. Centralized the compensation into
effectiveServerMode so the two internal paths and main.go's own
resolution cannot drift from each other again.

Fixes #6551.

* fix(store-factory): route read-only shared mode

* fix(store-factory): reach the !cgo twins and scope shared-server per workspace

Maintainer review fixes for PR #6589 (GH#6551). Addresses the three majors in
the review synthesis, plus the two non-gating items, and corrects two false
claims in the PR's own new prose.

1. major — the !cgo twins kept the unfixed gate, and "centralizing the check
   here keeps them from drifting again" was structurally false.
   effectiveServerMode sat behind //go:build cgo, so store_factory_nocgo.go's
   own copies of newDoltStoreFromConfig / newReadOnlyStoreFromConfig could not
   call it: the released CGO_ENABLED=0 binaries (.goreleaser.yml ships three)
   still ignored shared-server in the exact GH#6551 shape, and there the
   fallthrough is the "reinstall with embedded support" refusal rather than a
   phantom database — actively misleading, in the one build where a shared
   server is the only usable backend. Moved the helper to a new untagged file,
   store_factory_server_mode.go, and called it at all four sites. The
   centralization claim is now true rather than reworded, and the new file's
   header records why it must stay untagged.

2. major — TestPrimeCfgNilHonorsSharedServer was vacuous. Two separate causes,
   both fixed:
   - the beads dir had no files at all, so hasBeadsProjectFiles was false,
     FindBeadsDir() returned "" and ensureStoreActiveWithContext refused with
     ErrNoBeadsDatabase before the factory was reached. It now gets the
     config.yaml the reported shape actually has, which is simultaneously
     discoverable and still metadata.json-less.
   - it exported BEADS_DOLT_SHARED_SERVER=1, which the OLD gate already
     honored, so the A/B stayed green on unfixed code even after the first
     fix. The env var is now deliberately empty: the config.yaml layer is the
     whole of the base gap. Renamed to TestPrimeHonorsSharedServerConfigYaml,
     because the "cfg == nil" mechanism the old name asserts does not happen at
     this call site — normalizeLoadedConfig substitutes DefaultConfig() before
     the gate, so the gate's `cfg != nil` conjunct never short-circuited here.
     The same false mechanism is corrected in TestEffectiveServerMode's comment.
   Also added the positive assertion the test lacked: it now requires the
   captured output to name the port it pinned, so a refusal before store
   resolution can no longer pass. Confirmed by A/B against the reverted gate.

3. major — cross-workspace opens resolved activation from the launcher's
   process-global config, contradicting the invariant three lines above the
   gate. doltserver.IsSharedServerMode() reads process-global state, but
   routed.go:214, create.go:408 and init_contributor.go:330 pass a foreign
   beadsDir, so a launcher enabling shared-server in its own config.yaml could
   retarget a workspace that explicitly asked for embedded — a connect failure
   or a same-named database holding someone else's rows.
   effectiveServerMode now takes beadsDir and resolves the yaml layer against
   it via config.WorkspaceYamlValueStrictWithLocal (config.yaml only in the
   first iteration; see item 4 below). The env arm stays machine-global
   (configfile.IsDoltServerMode already honors it above an explicit dolt_mode,
   so that is base-equivalent), and the process-wide merge is still consulted
   when the target declares no dolt_mode of its own — which preserves both the
   GH#6551 headline fix and base behavior, since IsDoltServerMode falls through
   to config.yaml only when c.DoltMode == "". Purely workspace-scoping the read
   as prescribed would have dropped the user-global layer, which viper merges,
   and regressed the fix it was meant to protect.
   Shared-server mode still wins over a stale metadata.json dolt_mode=embedded
   for the bound workspace (main.go:1710 / shouldUseExternalDoltStatus,
   GH#2946); TestEffectiveServerModeResolvesYamlPerWorkspace pins both halves
   of that pair, and each half was mutation-proved to fail independently.

Non-gating, taken because they were adjacent:
- TestEffectiveServerMode's false-case assertions are now hermetic
  (config.ResetForTesting + HOME/BEADS_DIR scoping), matching its sibling.
- the new assertion no longer matches on internal/storage/dolt's connection
  prose; it uses errors.Is(err, syscall.ECONNREFUSED) and the port the test
  itself pins, both owned outside the package this PR does not own.

Required by fix 1 rather than optional: routing the !cgo factories through
effectiveServerMode makes them consult ambient config, which reds the two
pre-existing TestNocgoNew*FromConfig flag-suggestion tests on any machine with
dolt.shared-server enabled. Both now isolate those signals first, verified by
running them with BEADS_DOLT_SHARED_SERVER=1.

Tests: TestNocgoFactoriesHonorSharedServer is new and is the missing behavioral
half of fix 1 — the cgo-tagged tests cannot observe the !cgo twins and the
pure-Go CI job only checks compilation. Each of its two arms was proved by
reverting one !cgo call site at a time.

Validated: gofmt, git diff --check, go build and go vet under both CGO_ENABLED
settings, and every touched test individually in both lanes under a private
temp root (the shared /tmp suite-root sweeper races sibling agent sessions; see
the pre-review CI note).

Iteration 2 of the maintainer review found one new major, introduced by fix 3
itself, plus four non-gating items. All five are addressed here.

4. major -- the workspace-scoped read dropped the config.local.yaml layer, so
   the four factories resolved dolt.shared-server differently from main.go,
   bootstrap, doctor and migrate-dolt-mode: the same resolver-divergence class
   GH#6551 is an instance of, newly introduced by scoping the read. Initialize
   merges .beads/config.local.yaml LAST (the file-loading block at the end of
   Initialize), i.e. at the
   highest priority, and it is the documented place for machine-specific
   settings that must not be committed (docs/reference/configuration.md).
   dolt.shared-server is exactly that kind of state while .beads/config.yaml is
   git-tracked, so "the repo tracks it, this machine opts out" is the ordinary
   use of the escape hatch -- this repo is itself that shape. The divergence ran
   both ways and the enabling direction was the silent one: config.yaml false
   (what `bd dolt shared-server off` persists) plus a local true fell through to
   embeddeddolt.Open and re-created the GH#6551 phantom database with no error.
   Added config.WorkspaceYamlValueStrictWithLocal beside WorkspaceYamlValueStrict
   so the layering lives in the package that owns it, and pointed the helper at
   it. Each layer keeps the strict contract -- absent file or absent key falls
   through, unreadable/unparseable/non-scalar is an error -- which matches
   Initialize, since it fails outright on a config.local.yaml it cannot merge.
   config.local.yaml's name is now a config constant used by both readers, so
   the merged and workspace-scoped paths cannot drift onto different files.
   TestEffectiveServerModeHonorsWorkspaceLocalYaml pins both directions and uses
   the merged config.GetBool as its oracle, so the assertion cannot drift from
   the layer order it pins; reverting to the config.yaml-only reader fails both
   arms independently. The config package's own contract test additionally pins
   the order, the fallthrough when the local file is silent on the key, and the
   error on a malformed local file; inverting the two layers fails it.
   The prescription asked for cast.ToBool parsing. Used strconv.ParseBool
   instead: spf13/cast is an indirect dependency, ParseBool is exactly what
   cast.ToBool calls for a string (so "1"/"t"/"T"/"TRUE" resolve here as they do
   everywhere else, which was the point), and it matches migrationSharedTopology,
   the in-tree precedent for parsing this key from this reader. An unparseable
   value is viper's false too, and now says so.
   Corrected the parity claim the finding named: for the bound workspace these
   are the same two files the process-wide merge reads, which is true only now.

Non-gating items from iteration 2, taken because the iteration was already
forced and all four live in code this fixup owns:
- the read-only factory's positive discriminator was a near-tautology: the
  pinned port was "1", OR'd with errors.Is(ECONNREFUSED), so the string half
  matched any errno, timestamp or port containing that digit and held up
  wherever the dial error was not ECONNREFUSED. Pinned 59998 instead, five
  distinctive digits like the prime sibling. Verified both halves now fire
  independently, so neither is carrying the other.
- the new !cgo behavioral pin ran in no CI lane: the pure-Go cmd/bd test step is
  a name allowlist and omitted it, so the exact single-call-site regression this
  commit mutation-simulated would have passed every job. Added the three Nocgo
  test names to that -run group in both pr.yml and main.yml. The three pass
  under -tags gms_pure_go, CGO_ENABLED=0, -short in 0.4s with no server, and
  reverting store_factory_nocgo.go's first call site now reds that lane --
  failing only the mutated arm, so per-site discrimination is preserved. (This
  also retires the "the pure-Go CI job only checks compilation" note above: that
  job does run a named subset, and now it runs these.)
- the unreadable-config.yaml arm degraded silently and its comment claimed the
  opposite: it said the configfile.Load error path "refuses to degrade to the
  embedded default", but returning false IS the degrade to embedded here. Kept
  the conservative false (main.go degrades identically on the same corrupt
  input, so it is parity, and a target whose own config is unreadable must not
  be retargeted by the LAUNCHER's config), added a debug.Logf so the discarded
  parse error is recoverable, and corrected the comment to describe what the
  code does.
- TestNocgoFactoriesHonorSharedServer's discriminator was negative-only, the
  one-sidedness class this commit fixed twice elsewhere: any future pre-gate
  refusal would have passed it without the shared-server arm running. Added the
  positive half the siblings use, against its own distinctive pinned port.

Iteration 2 validation: gofmt, git diff --check, go build ./... and go vet under
both CGO_ENABLED settings, the full internal/config suite, the cmd/bd
store-factory and prime shared-server tests (including the 30s flagship binary
test), and the exact pure-Go CI step command with the widened allowlist. Every
fix above was mutation-proved, each arm separately.

Iteration 3 of the maintainer review returned approve with no blocker or major
finding: one minor and five nits. All but one are addressed here, amended into
this same fixup rather than stacked.

5. minor -- the layered reader honored a lone config.local.yaml, so the fixed
   divergence survived at the edge of the fix. Initialize hangs its local merge
   off the project config.yaml it actually found (primaryConfigPath, assigned
   only where an os.Stat on a config.yaml succeeded), so a .beads holding
   config.local.yaml ALONE is never merged: config.GetBool answers from defaults
   while the four patched factories answered from the local file. Same
   resolver-divergence class as item 4, one-directional instead of two, and loud
   (a split-brain connect failure) rather than a phantom database.
   Took the "require the pair" arm rather than only narrowing the prose. A
   reader whose entire contract is "resolve the way Initialize's merged reader
   does" should satisfy that contract instead of documenting where it does not,
   and the permissive read left it the single resolver in the tree that honors a
   file nothing else reads -- the divergence pointed the other way. Two lines in
   WorkspaceYamlValueStrictWithLocal; a stat error other than not-exist drops the
   layer too, matching Initialize, whose own probes for a project config.yaml
   fail the same way, and the tracked read then surfaces that error instead of
   swallowing it.
   Added the missing table arm (local only, no tracked config.yaml) and mutation-
   proved the guard in both directions: neutralizing it reds that arm alone, with
   the divergent ("true", true) answer, while all seven incumbent arms stay green;
   always dropping the local layer reds the two override arms and the malformed-
   local arm while the new one stays green. The guard fires on exactly the
   population it was written for.
   Both parity claims now state Initialize's condition as well as its order
   (store_factory_server_mode.go, yaml_config.go).

Nits, taken because amending this fixup costs nothing extra:
- the !cgo test's own comment still told the reader the pure-Go job "only checks
  that the package compiles" -- in the commit that allowlisted that test by name
  in both workflows. It reads as license to drop the name, which would retire
  exactly the coverage iteration 2 bought. It now says the job runs this test by
  name in pr.yml and main.yml, and that the test name and both allowlists must
  move together.
- three new doc comments cited loadConfigFiles, which does not exist; the merge
  is inline at the end of Initialize. All three now cite Initialize, as does
  item 4 of this message.
- the new constants' justification claimed they keep the merged reader and the
  workspace-scoped reader from drifting onto different files, but only the local
  path was switched -- Initialize still spells config.yaml literally everywhere
  it probes for one. Narrowed the comment to what the constants actually bind,
  rather than rewriting config-path literals this PR has no other reason to move.
- the three pinned "nothing listens here" ports (59997/59998/59999) sat inside
  the kernel's ephemeral range (32768-60999 here and on the GitHub runners).
  That only became load-bearing because the two discriminator fixes worked: the
  assertions now mean "we dialed THIS port and were refused", so a process that
  bound :0 and landed there would answer the dial and red a correct
  implementation. Moved all three to 19997/19998/19999. Each move is proved live
  by the assertion that names its constant -- the prime test still finds its port
  in the captured output.

Declined: switching migrationSharedTopology (migrate_dolt_mode.go:1238) to the
layered reader. Both lanes graded it optional and explicitly non-regressing --
migrate has always read config.yaml only -- and it is a production behavior
change to `bd migrate dolt-mode` that no further review pass would see, on an
iteration that is otherwise approve. It belongs with the five other unlayered
IsDoltServerMode resolvers iteration 2 recorded (where.go:143,
context_cmd.go:140, doctor/database.go:311, doctor/shared_store.go:45,
doctor/server.go:73) as follow-up.

Iteration 3 validation: gofmt, git diff --check, go vet in the default,
CGO_ENABLED=0/gms_pure_go and GOOS=windows modes, the full internal/config
suite, the five cmd/bd resolver and call-site tests including the 33s prime
binary test at its new port, the migrate-dolt-mode topology test, and the exact
pure-Go CI step command (ok, 0.44s).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-27 10:32:56 -07:00
.agent/workflows docs: replace bd sync with bd dolt push/pull in agent instructions (GH#2563) 2026-03-13 11:01:06 -07:00
.beads/formulas release: prep v1.3.0 — version bump, changelog rollup, release process docs, formula fixes (#6038) 2026-08-30 22:19:35 -07:00
.claude test: reconcile the sqlite-era tests the reapply left asserting live support 2026-07-18 02:43:57 +00:00
.claude-plugin release: make release/1.3.0 tag-ready — revert #6281, stamp 1.3.0, date the changelog (#6564) 2026-09-15 12:13:59 -07:00
.devcontainer docs: move internal/maintainer docs from docs/ to engdocs/ 2026-07-12 10:37:07 -07:00
.githooks Accept uutils coreutils timeout in generated hooks, and check the shims against real implementations (#6561) 2026-09-27 03:38:45 -07:00
.github fix(prime): honor shared-server mode consistently across bd prime's store resolution paths (#6589) 2026-09-27 10:32:56 -07:00
backend test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
beadserrors test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
cmd/bd fix(prime): honor shared-server mode consistently across bd prime's store resolution paths (#6589) 2026-09-27 10:32:56 -07:00
docs docs(recovery): init-safety re-clone playbook covers damaged-store and fresh-clone gotchas (#6431) 2026-09-27 03:41:05 -07:00
engdocs Accept uutils coreutils timeout in generated hooks, and check the shims against real implementations (#6561) 2026-09-27 03:38:45 -07:00
examples security: v1.3.0 dependency + toolchain bumps (7 reachable stdlib advisories, criticals triaged) (#6047) 2026-08-28 23:26:04 -07:00
format build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
integrations chore(deps): bump the beads-mcp-python group across 1 directory with 5 updates (#6495) 2026-09-26 15:46:48 -07:00
internal fix(prime): honor shared-server mode consistently across bd prime's store resolution paths (#6589) 2026-09-27 10:32:56 -07:00
issueops test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
journalops test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
memoryops test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
npm-package release: make release/1.3.0 tag-ready — revert #6281, stamp 1.3.0, date the changelog (#6564) 2026-09-15 12:13:59 -07:00
plugins/beads test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
release-gates fix(metrics): stop failing the reap test on a transient zombie (#6262) 2026-09-08 18:16:35 -07:00
schema build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
scripts test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
test test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
tests docs(dep): say what --no-cycle-check skips on a single-edge add (#6688) 2026-09-26 06:43:14 -07:00
third_party/patches build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
tools test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
winget docs: update user-facing URLs from steveyegge/beads to gastownhall/beads 2026-04-24 08:17:42 -07:00
.bazelignore test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
.bazelrc build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
.bazelversion build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
.buildflags chore: purge deleted docs-pipeline references from release tooling, CI, and repo plumbing 2026-07-12 11:07:26 -07:00
.gitattributes build: make repository text EOL deterministic (#5319) 2026-08-10 20:48:09 -07:00
.gitignore build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
.golangci.yml Retire the last three wisp-switch call sites, and bound the wisp-inclusive union reads (ga-2ltro.12, ga-2ltro.7) (#5587) 2026-08-10 17:07:59 -07:00
.goreleaser.yml fix(release): branch install header for prerelease vs stable (#4530) 2026-07-01 22:59:50 -07:00
.pre-commit-config.yaml fix: detect Go version mismatch in pre-commit hook before golangci-lint panics (bd-66nc) 2026-03-02 18:50:29 -08:00
.test-skip fix: rewrite TestRepairMultiplePrefixes for Dolt rename semantics (bd-alk64) 2026-02-14 11:05:39 -08:00
AGENT_INSTRUCTIONS.md fix(ui): stop using blocked ● for priority in CLI output (#5511) 2026-08-10 06:19:51 -07:00
AGENTS.md fix(ui): stop using blocked ● for priority in CLI output (#5511) 2026-08-10 06:19:51 -07:00
ARTICLES.md fix(docs): remove stale --branch flag and SQLite refs from QUICKSTART (GH#2522) (#2525) 2026-03-11 12:54:30 -07:00
beads.go fix(storage): shared stores refuse version-bump migration without explicit consent (#5920, #5043) (#6048) 2026-08-29 21:47:24 -07:00
beads_cgo.go fix(storage): truthful legacy-backend tombstone rejection — detect present Dolt data, give the exact heal (D-8) (#6044) 2026-08-28 23:27:39 -07:00
beads_gated_test.go feat(workspacegate): shared physical-root resolver, beads.OpenGated, and CLI gate wiring (part 2) (#5093) 2026-07-31 01:41:20 -07:00
beads_nocgo.go fix(storage): truthful legacy-backend tombstone rejection — detect present Dolt data, give the exact heal (D-8) (#6044) 2026-08-28 23:27:39 -07:00
beads_test.go fix: TestMain teardown was dead code after os.Exit — 101 dolt containers leaked over 6 days (#5876) 2026-08-20 06:06:32 -07:00
BENCHMARKS.md test: add perf reference benchmarks (#4032) 2026-05-19 18:39:13 -07:00
build-docs.md fix: correct brew commands and remove dead homebrew CI job 2026-02-09 08:02:42 +01:00
BUILD.bazel test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
CHANGELOG.md Accept uutils coreutils timeout in generated hooks, and check the shims against real implementations (#6561) 2026-09-27 03:38:45 -07:00
checks.nix Accept uutils coreutils timeout in generated hooks, and check the shims against real implementations (#6561) 2026-09-27 03:38:45 -07:00
claim.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
claim_roundtrip_test.go feat(storage): events + dependents reads, batched blocked, public claim surface (#4926) 2026-07-22 07:41:47 -07:00
claim_test.go feat(storage): events + dependents reads, batched blocked, public claim surface (#4926) 2026-07-22 07:41:47 -07:00
CLAUDE.md docs: move internal/maintainer docs from docs/ to engdocs/ 2026-07-12 10:37:07 -07:00
codecov.yml test: improve coverage signal policy (#4219) 2026-05-27 22:05:14 -07:00
CONTRIBUTING.md docs(lint): align contributor guidance with CI (saa-90w) (#5317) 2026-08-07 05:37:12 -07:00
CONTRIBUTING_PR_GUIDELINES.md docs: add CONTRIBUTING_PR_GUIDELINES.md (codify reviewer expectations for contributors) (#3913) 2026-07-06 22:12:29 -07:00
default.nix chore(deps): bump the go-deps group across 1 directory with 20 updates (#6494) 2026-09-27 01:07:14 -07:00
errors_test.go feat(issueops): name the two dependency-endpoint refusals (bd-yby99.9) 2026-08-07 19:45:54 +00:00
export_dependency_add_options_test.go feat: export DependencyAddOptions from the root package (#4870) 2026-07-17 20:34:32 -07:00
FEDERATION-SETUP.md chore: purge deleted docs-pipeline references from release tooling, CI, and repo plumbing 2026-07-12 11:07:26 -07:00
flake.lock flake.lock: Update (#4501) 2026-07-08 12:21:24 -07:00
flake.nix Accept uutils coreutils timeout in generated hooks, and check the shims against real implementations (#6561) 2026-09-27 03:38:45 -07:00
go.mod chore(deps): bump the go-deps group across 1 directory with 20 updates (#6494) 2026-09-27 01:07:14 -07:00
go.sum chore(deps): bump the go-deps group across 1 directory with 20 updates (#6494) 2026-09-27 01:07:14 -07:00
install.ps1 docs: update user-facing URLs from steveyegge/beads to gastownhall/beads 2026-04-24 08:17:42 -07:00
issue_lifecycle_external_test.go feat(storage): one guarded issue-lifecycle surface for the CLI and linked consumers (#5191) 2026-07-31 11:26:38 -07:00
issue_roles_external_test.go Add issueops.GraphCounter: how many edges, in one named direction (ga-itny5) (#5485) 2026-08-09 11:29:32 -07:00
issues.jsonl ci: add nix build check to catch vendorHash drift (GH#3298) (#3364) 2026-04-20 13:21:53 -07:00
LICENSE Initial commit: Beads issue tracker with security fixes 2025-10-11 20:07:36 -07:00
Makefile test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
mint.sh chore: purge deleted docs-pipeline references from release tooling, CI, and repo plumbing 2026-07-12 11:07:26 -07:00
MODULE.bazel build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
MODULE.bazel.lock build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
NEWSLETTER.md Retire legacy Homebrew tap publishing (#4478) 2026-06-22 19:26:46 -07:00
open_backend_selection_test.go fix(storage): truthful legacy-backend tombstone rejection — detect present Dolt data, give the exact heal (D-8) (#6044) 2026-08-28 23:27:39 -07:00
open_nocgo_test.go :remove uneccessary locking 2026-05-01 17:46:37 -07:00
overlay.nix feat(nix): expose packages as an overlay for downstream override (#3910) 2026-07-06 22:39:37 -07:00
packages.nix feat(nix): expose packages as an overlay for downstream override (#3910) 2026-07-06 22:39:37 -07:00
PR_MAINTAINER_GUIDELINES.md docs(maintainer): prior-art pass is part of every review; rebases are maintainer work (#5094) 2026-07-26 21:40:34 -07:00
PROPOSAL-cas-conditional-update.md fix(claim): verify claim-family writes by re-read under a degraded server (bd-zccb9) (#5006) 2026-07-24 07:21:24 -07:00
PROPOSAL-pluggable-storage-backends.md Reapply "Simplify the supported backends: roll back the direct PostgreSQL and MySQL adapters" (#4857) 2026-07-18 02:43:56 +00:00
PROPOSAL-pull-config-wedge.md fix(dolt): pre-pull commit must include config (kv.memory.* pull-wedge) (#4412) 2026-06-19 21:31:33 -07:00
query_interfaces_cgo_test.go feat(storage): events + dependents reads, batched blocked, public claim surface (#4926) 2026-07-22 07:41:47 -07:00
query_interfaces_test.go feat(storage): events + dependents reads, batched blocked, public claim surface (#4926) 2026-07-22 07:41:47 -07:00
README.md docs: schema-version guard in README and CHANGELOG (be-x0rl6) (#4161) 2026-07-23 19:13:38 -07:00
RELEASING.md release: prep v1.3.0 — version bump, changelog rollup, release process docs, formula fixes (#6038) 2026-08-30 22:19:35 -07:00
renovate.json chore: harden release and dependency security 2026-04-28 08:45:22 +00:00
SECURITY.md docs(ci): add Mintlify preview, docsync guard, and broken-links workflow 2026-07-12 10:37:07 -07:00
THIRD_PARTY_LICENSES revert: restore embedded Dolt mode (was only supposed to be removed from Gas Town) 2026-02-07 21:21:24 -08:00
VERSIONED-BEADS-WRITE-PATHS.md Four-leg no-op conformance case for #5898: duplicate dep add and absent dep remove mint no version on any leg (#6650) 2026-09-26 14:48:30 -07:00

bd - Beads

Distributed graph issue tracker for AI agents, powered by Dolt.

Platforms: macOS, Linux, Windows, FreeBSD

License Go Report Card Release npm version PyPI

Docs: https://beads.gascity.com/

Beads provides a persistent, structured memory for coding agents. It replaces messy markdown plans with a dependency-aware graph, allowing agents to handle long-horizon tasks without losing context.

flowchart LR
    create["bd create<br/>new bead"] --> depgraph["dependency<br/>graph"]
    depgraph --> ready["bd ready<br/>claimable work"]
    ready --> claim["bd update --claim<br/>agent takes it"]
    claim --> close["bd close<br/>work done"]
    close -->|blockers released| ready
    depgraph <-->|"bd dolt push / pull"| remote[("other machines<br/>and agents")]

⚡ Quick Start

# Install beads CLI (system-wide - don't clone this repo into your project)
curl -fsSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh | bash

# Initialize in YOUR project
cd your-project
bd init

# Optional: refresh or install richer instructions for your agent
bd setup codex    # Codex CLI - installs skill, AGENTS.md guidance, and hooks
bd setup claude   # Claude Code - installs hooks/settings
bd setup factory  # Factory.ai Droid - creates/updates AGENTS.md

Note: Beads is a CLI tool you install once and use everywhere. You don't need to clone this repository into your project.

bd init creates or updates AGENTS.md by default so agents can discover the beads workflow, and also installs project Claude/Codex integrations unless you pass --skip-agents or --stealth. Use bd setup --list to see supported integrations, including bd setup codex, bd setup factory, bd setup claude, bd setup mux, bd setup cursor, and more. See Agent and IDE setup.

Manual copy-paste is only for unsupported agents, existing projects where you cannot rerun bd init/bd setup, or custom instruction files. In those cases, run bd onboard and paste the printed snippet into the file your agent reads.

If your agent is not covered by bd setup, add this minimal AGENTS.md section:

This project uses bd (beads) for issue tracking.

- Run `bd prime` for workflow context and command guidance.
- Use `bd ready`, `bd show <id>`, `bd update <id> --claim`, and `bd close <id>`.
- Use `bd remember "insight"` for persistent project memory; do not create MEMORY.md files.
- Do not use markdown TODO lists for task tracking.

🛠 Features

  • Dolt-Powered: Version-controlled SQL database with cell-level merge, native branching, and built-in sync via Dolt remotes.
  • Agent-Optimized: JSON output, dependency tracking, and auto-ready task detection.
  • Zero Conflict: Hash-based IDs (bd-a1b2) prevent merge collisions in multi-agent/multi-branch workflows.
  • Compaction: Semantic "memory decay" summarizes old closed tasks to save context window.
  • Messaging: Message issue type with threading (--thread), ephemeral lifecycle, and mail delegation.
  • Graph Links: relates-to, duplicates, supersedes, and replies-to for knowledge graphs.

📖 Essential Commands

Command Action
bd ready List tasks with no open blockers.
bd create "Title" -p 0 Create a P0 task.
bd update <id> --claim Atomically claim a task (sets assignee + in_progress).
bd dep add <child> <parent> Link tasks (blocks, related, parent-child).
bd show <id> View task details and audit trail.
bd prime Print agent workflow context and persistent memories.
bd remember "insight" Store project memory that bd prime injects later.

🔗 Hierarchy & Workflow

Beads supports hierarchical IDs for epics:

  • bd-a3f8 (Epic)
  • bd-a3f8.1 (Task)
  • bd-a3f8.1.1 (Sub-task)

Stealth Mode: Run bd init --stealth to use Beads locally without committing files to the main repo. Perfect for personal use on shared projects. See Git-Free Usage below.

Contributor vs Maintainer: When working on open-source projects:

  • Contributors (forked repos): Run bd init --contributor to route planning issues to a separate repo (e.g., ~/.beads-planning). Keeps experimental work out of PRs.
  • Maintainers (write access): Beads auto-detects maintainer role via SSH URLs or HTTPS with credentials. Only need git config beads.role maintainer if using GitHub HTTPS without credentials but you have write access.

📦 Installation

brew install beads           # macOS / Linux (recommended)
npm install -g @beads/bd     # Node.js users

Other methods: install script | go install | from source | Windows | Arch AUR

Requirements: macOS, Linux, Windows, or FreeBSD. See docs/getting-started/installation.md for complete installation guide.

Upgrading? Replacing the binary is not always the whole story. Short version: sync remote-backed databases with your current bd, back up with bd export --all, upgrade the binary, then run bd info --whats-new, bd hooks install, and bd version. If the upgrade crosses a schema migration on a remote-backed database, exactly one designated clone runs bd migrate and bd dolt push; other clones install the new binary and run bd bootstrap. See the full upgrade guide or docs/getting-started/installation.md.

Security And Verification

Before trusting any downloaded binary, verify its checksum against the release checksums.txt.

The install scripts verify release checksums before install. For manual installs, do this verification yourself before first run.

On macOS, scripts/install.sh preserves the downloaded signature by default. Local ad-hoc re-signing is explicit opt-in via BEADS_INSTALL_RESIGN_MACOS=1.

See docs/reference/antivirus.md for Windows AV false-positive guidance and verification workflow.

💾 Storage Modes

Beads uses Dolt as its database. Two modes:

  • Embedded (default) — bd init. Dolt runs in-process, data lives in .beads/embeddeddolt/, single writer. Recommended for most users.
  • Server — bd init --server. Connects to an external dolt sql-server for multiple concurrent writers; data lives in .beads/dolt/.

Cross-machine sync uses bd dolt push / bd dolt pull against refs/dolt/data on your git remote; .beads/issues.jsonl is an export for viewers and interchange, not the source of truth or a backup. Back up and migrate between modes with bd backup; reclaim space with bd prune / bd purge.

Full detail — connection flags, sockets, maintenance, backup, and migration — in the Dolt backend guide.

Schema Version Guard

bd checks the database schema version at open time. If the database has been migrated by a newer binary and an older binary tries to open it, bd exits with an actionable error rather than issuing queries that fail with cryptic SQL errors:

schema version mismatch: database is at v45, binary knows up to v42 (3 migrations ahead)

  Your bd binary is stale. Queries for dropped or renamed columns will fail
  with cryptic SQL errors (e.g. "column X could not be found in any table in scope").

  Rebuild from main:
    CGO_ENABLED=0 go build -tags gms_pure_go ./cmd/bd

  Or install the latest release:
    CGO_ENABLED=0 go install -tags gms_pure_go github.com/steveyegge/beads/cmd/bd@latest

  To proceed despite the risk (some read commands may still work):
    BD_IGNORE_SCHEMA_SKEW=1 bd <command>
    bd --ignore-schema-skew <command>

When this fires: only when the database schema is ahead of the binary (a newer binary migrated the database; this binary doesn't know those migrations). Normal upgrades, where the binary migrates the database forward, are unaffected.

Escape hatch: BD_IGNORE_SCHEMA_SKEW=1 (or --ignore-schema-skew) bypasses the guard with a warning on stderr. Use this only if you know the forward migrations are additive and safe for your specific workload.

🌐 Community Tools

See docs/community-tools.md for a curated list of community-built UIs, extensions, and integrations—including terminal interfaces, web UIs, editor extensions, and native apps.

See docs/related-projects.md for adjacent or complementary projects that solve different problems in the same neighborhood.

🚀 Git-Free Usage

Beads works without git. The Dolt database is the storage backend — git integration (hooks, repo discovery, identity) is optional.

# Initialize without git
export BEADS_DIR=/path/to/your/project/.beads
bd init --quiet --stealth

# All core commands work with zero git calls
bd create "Fix auth bug" -p 1 -t bug
bd ready --json
bd update bd-a1b2 --claim
bd prime
bd close bd-a1b2 "Fixed"

BEADS_DIR tells bd where to put the .beads/ database directory, bypassing git repo discovery. --stealth sets no-git-ops: true in config, disabling all git hook installation and git operations.

This is useful for:

  • Non-git VCS (Sapling, Jujutsu, Piper) — no .git/ directory needed
  • Monorepos — point BEADS_DIR at a specific subdirectory
  • CI/CD — isolated task tracking without repo-level side effects
  • Evaluation/testing — ephemeral databases in /tmp

📝 Documentation