* test(config): add specs for central server config library
Add test cases for LoadCentralConfig, ApplyCentralDefaults, and
DefaultCentralConfigPath with stub implementations. Tests define
the expected behavior; implementations follow in the next commit.
* feat(config): implement central server config library
Implement LoadCentralConfig and ApplyCentralDefaults to satisfy
the specs from the previous commit. LoadCentralConfig reads and
parses ~/.config/beads/server.json; ApplyCentralDefaults merges
server-only fields into per-project config at zero values.
* test(config): add integration specs for central config wiring
Add tests that verify applyCentralConfigDefaults loads the central
server config and merges it into the per-project config. Stub
implementation is a no-op; tests define expected behavior before
the wiring is implemented.
* feat(config): wire central config into store open paths
Implement applyCentralConfigDefaults and call it in both
NewFromConfigWithOptions and NewFromConfigWithCLIOptions so that
server fields from ~/.config/beads/server.json are applied as
defaults before per-project config resolution.
Add ServerSocket config field and BEADS_DOLT_SERVER_SOCKET env var to
connect to Dolt via unix sockets instead of TCP. This eliminates port
conflicts between concurrent projects and simplifies sandbox integration.
- Wire --server-socket CLI flag through bd init and bd dolt set (dolt.socket)
- Add GetDoltServerSocket() to configfile with env var precedence
- Socket mode disables auto-start with socket-specific error hints
- TLS settings honored regardless of transport
- Integration test: starts dolt sql-server --socket, verifies end-to-end SQL
- Document in README.md server mode table
Closes#2939
Adds a project-agnostic beads_global database to shared-server mode so
clients can track issues globally across all projects on the server.
- Add EnsureGlobalDatabase() to create the DB during shared server init
- Add --global persistent flag to switch CLI commands to the global DB
- Add global_dolt_database field to metadata.json for connection info
- Seed global DB with issue_prefix="global" and sentinel project ID
- Export/import default to global-issues.jsonl with --global flag
- --global errors when not in shared-server mode (additive, no breakage)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add credentials file support for Dolt server passwords
Add INI-style credentials file (~/.config/beads/credentials) as a
fallback for Dolt server passwords, keyed by [host:port] section.
This lets users working with multiple servers avoid juggling env vars
per project.
Lookup order: BEADS_DOLT_PASSWORD env var > credentials file > empty.
Path overridable via BEADS_CREDENTIALS_FILE env var.
Warns on overly permissive file permissions (unix only, mirrors ssh).
* docs: document credentials file in DOLT.md
Add credentials file section to the Dolt backend docs covering file
format, default location, permission warnings, and password resolution
order. Update the config reference and env var table to reference the
new feature.
* fix: use resolved runtime port for credentials file lookup
The credential file lookup in GetDoltServerPassword() used the port
from metadata.json, but the actual connection port comes from
doltserver.DefaultConfig() which has its own priority chain (port file >
config.yaml > metadata.json). When these diverge — e.g., IAP tunnel on
3308 vs local Dolt on 3307 — the credentials file lookup used the wrong
[host:port] section.
Add GetDoltServerPasswordForPort() that accepts an explicit port, and
use it in main.go where the resolved runtime port is already known.
Existing GetDoltServerPassword() delegates to the new method for
backward compatibility.
* fix: use mysql.Config.FormatDSN for proper password escaping
Passwords with special characters (& < > / % etc.) were inserted raw
into the DSN string, breaking go-sql-driver/mysql parsing. Passwords
like "zId&z,L9P4X,%k4n4rylGV<Ibos9<)/p" would cause "Access denied"
errors even though the password was correct.
Switch from manual fmt.Sprintf DSN construction to mysql.Config's
FormatDSN(), which handles escaping correctly. This also consolidates
timeout and TLS configuration into the typed Config struct instead of
string concatenation.
* test: add DSN special character password roundtrip tests
Covers passwords with &, <, >, /, ?, %, @, :, and () — all of which
broke the old fmt.Sprintf DSN construction. Verifies that FormatDSN
produces a parseable DSN and the password survives the roundtrip.
* fix: prevent silent fallback to embedded mode when shared-server is active (GH#2949)
Root cause: ResolveServerMode() and IsDoltServerMode() checked
metadata.json dolt_mode=embedded BEFORE runtime env vars, so stale
persisted metadata silently overrode active shared-server config.
Fixes:
- ResolveServerMode: env vars (BEADS_DOLT_SERVER_MODE, BEADS_DOLT_SHARED_SERVER)
now checked before metadata.json, preventing stale embedded override
- IsDoltServerMode: now checks BEADS_DOLT_SHARED_SERVER env var (shared-server
implies server-backed storage)
- warnSharedServerEmbeddedMismatch -> repairSharedServerEmbeddedMismatch:
auto-repairs stale dolt_mode=embedded in metadata.json instead of just warning
- Added 6 regression tests covering the upgrade path
Closes#2949
Amp-Thread-ID: https://ampcode.com/threads/T-019d4b84-cddd-725a-a3c6-ee7e3631f2aa
Co-authored-by: Amp <amp@ampcode.com>
* fix: treat --shared-server as server mode for metadata.json DoltMode (#2946)
--shared-server sets BEADS_DOLT_SHARED_SERVER for directory resolution but
never set initServerMode, so metadata.json recorded DoltMode as "embedded"
and all subsequent commands used embedded Dolt despite config.yaml having
dolt.shared-server: true.
Also override metadata.json at runtime when dolt.shared-server is set,
so existing installs with stale metadata.json are handled without re-init.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: ensure shared server runs during init and fix isEmbeddedMode check
Two additional fixes for GH#2946:
1. Init auto-starts the shared Dolt server if not already running,
since ResolveServerMode classifies shared-server as External
which suppresses the normal auto-start path.
2. isEmbeddedMode() now checks doltserver.IsSharedServerMode() as a
fallback. Dolt subcommands (status, start, stop) skip DB init in
PersistentPreRun, so serverMode is never set from metadata.json.
Without this, "bd dolt status" would still report embedded mode
even with dolt.shared-server: true in config.yaml.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: apply shared-server override to loadServerModeFromConfig()
Closes the gap flagged in PR review: no-db commands (bd dolt start,
bd dolt status, bd doctor, etc.) go through loadServerModeFromConfig()
which didn't have the shared-server override for stale metadata.json.
This ensures isEmbeddedMode() returns false for all command paths when
dolt.shared-server is true in config.yaml, not just commands that pass
the no-db guard in PersistentPreRun.
GH#2946
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d4f6f-01f8-72d4-b474-f75d7909b8b9
---------
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace gastown-specific references with generic alternatives throughout
the codebase:
- Rename --gastown flag to --orchestrator in bd doctor
- Rename gastownMode/gastownThreshold params to orchestratorMode/orchestratorThreshold
- Rename isGasTownTownRoot() to isOrchestratorRoot()
- Replace "gastown" in CLI examples with generic rig names (my-project, other-project)
- Update comments replacing "Gas Town" with "orchestrator" or "multi-agent workspace"
- Update active docs (DOLT.md, CONFIG.md, ADVANCED.md, etc.)
- Update test data to use generic names instead of "gastown"
- Update role templates (deacon, witness, refinery) to use generic language
Preserved as historical (not changed):
- CHANGELOG.md entries (historical record)
- ARTICLES.md (links to real published articles)
- info.go version notes (historical release notes)
- gastown/ file path references in dolt-concurrency.md (point to actual repo)
Replace DerivePort() (FNV-32a hash into 1000-port range) with OS-assigned
ephemeral ports via net.Listen(":0"). This eliminates birthday-problem port
collisions (#2098) and complements Layer 2 identity verification (c6e41803)
for defense-in-depth against cross-project data leakage (#2372).
Start() now allocates ephemeral ports with a retry loop (10 attempts) for
TOCTOU races. Explicit port config (env var, config.yaml, metadata.json)
is preserved with conflict detection via reclaimPort.
Closes#2098. Partially addresses #2372.
Co-Authored-By: Tim Visher <194828183+timvisher-dd@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all BEADS_NO_DAEMON env var handling from test files (dead code
since daemon removal in v0.50.0), delete stopRepoDaemon() and daemon
file guards from test setup, remove no-daemon config key from tests,
and update daemon→server wording in docs and comments.
37 files changed, -193 lines net.
Co-Authored-By: davetashner <davetashner@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Projects initialized before GH#2372 have no project_id in metadata.json
or _project_id in the database metadata table. Adds a doctor check that
detects missing fields and --fix path that backfills a UUID into both
stores, protecting against cross-project data leakage.
Co-Authored-By: timvisher-dd <timvisher-dd@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gas Town sets BEADS_DOLT_PORT to route bd commands to the correct Dolt
server. This adds it as a fallback after BEADS_DOLT_SERVER_PORT but
before config/default.
Co-Authored-By: joshuavial <joshuavial@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three P1 fixes for the Dolt server stabilization epic (bd-109c):
1. Idle-monitor single-instance enforcement (GH#2367): RunIdleMonitor now
acquires an exclusive file lock at startup. If another monitor is already
running, the new one exits immediately. This prevents the accumulation
bug where Start() called from within the monitor watchdog would fork
additional monitors (one per minute, ~32MB each).
2. Port config isolation (GH#2372): The port file (dolt-server.port, now
gitignored) is elevated to primary source for port resolution, ahead of
metadata.json and config.yaml which are git-tracked and can propagate
to collaborators. metadata.json DoltServerPort emits a deprecation
warning when used.
3. Client-side project identity verification (GH#2372): bd init now generates
a UUID stored in both metadata.json (project_id) and the database metadata
table (_project_id). On every store open, these are compared. A mismatch
means the client is connected to the wrong projects Dolt server and the
connection is refused with a clear diagnostic message.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Embedded Dolt is being reintroduced for standalone/solo Beads users
(Dolt team delivering improved embedded support). Update docs and code
comments that asserted embedded was permanently removed. Gas Town
continues to use server mode exclusively.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
metadata.json is committed to git and propagates to other clones.
Absolute paths in dolt_data_dir are machine-specific and cause data
loss when other clones try to use the wrong directory.
- Save() now strips absolute dolt_data_dir before writing
- bd dolt set data-dir warns about absolute paths and points to
BEADS_DOLT_DATA_DIR env var for persistence
SQLite is dead. Dolt is the only backend.
- Remove BackendSQLite constant and all SQLite branches from configfile
- GetBackend() now always returns "dolt" (ignores BEADS_BACKEND env var for sqlite)
- DatabasePath() no longer has SQLite path resolution (GH#2016 compat removed)
- Delete 13 SQLite→Dolt migration files (migrate_auto, migrate_dolt, migrate_shim,
migrate_import, migrate_safety and their tests/nocgo variants)
- Remove --to-dolt flag from bd migrate command
- Remove autoMigrateSQLiteToDolt() call from main.go startup path
- Delete broken_migration doctor check/fix (SQLite residue detection)
- Rescue CheckEmbeddedModeConcurrency into its own file (Dolt-specific, not legacy)
- Update federation and configfile tests to reflect Dolt-only world
- Net: -7,045 lines
Closes: hq-x8jhj, hq-1jaou
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix TestCheckDoltLocks_NotDoltBackend by adding metadata.json to test
fixture so non-Dolt backend is correctly detected. Apply gofumpt to
4 files with formatting drift.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use doltserver.IsRunning(beadsDir) instead of manually checking PID file
at filepath.Join(doltPath, "dolt-server.pid") — PID file lives in beadsDir,
not doltPath. This also handles Gas Town daemon PID files correctly.
- Read remotesapi port from config (DoltRemotesAPIPort field, env var
BEADS_DOLT_REMOTESAPI_PORT) instead of hardcoding 8080.
- Add configfile.GetDoltRemotesAPIPort() getter with DefaultDoltRemotesAPIPort.
- Add test coverage for all federation check functions.
Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
* fix(configfile): respect backend field in metadata.json
GetBackend() was hardcoded to always return "dolt", ignoring the
backend field in metadata.json. This forced all SQLite users onto
Dolt with no migration path and no way to opt out.
- Add BackendSQLite constant and case-insensitive normalization
- GetBackend() reads backend field: sqlite → sqlite, empty/dolt → dolt
- DatabasePath() routes to SQLite or Dolt path based on backend
- BEADS_BACKEND env var override as escape hatch for corrupted configs
- CapabilitiesForBackend handles sqlite backend
- Warning on unrecognized BEADS_BACKEND values
- 55 tests covering all paths including env var, case normalization,
roundtrip persistence, and DatabasePath routing
Fixes#2016.
Authored by: Aaron Lippold<lippold@gmail.com>
* feat(migrate): add shared migration safety functions
Extract reusable safety functions for SQLite→Dolt migration:
- backupSQLite: file copy with O_EXCL + 0600 permissions
- verifyServerTarget: TCP + SQL check to prevent wrong-server writes
- verifyMigrationCounts: source vs target count verification
- finalizeMigration: atomic metadata update (last step only)
- rollbackMetadata: restore original config on failure
22 unit tests covering all functions including counter overflow,
non-MySQL server detection, deps-only mismatch, nil config rollback,
server config preservation, and no-metadata scenarios.
Authored by: Aaron Lippold<lippold@gmail.com>
* refactor(migrate): use safety functions in auto-migration
Refactor both CGO and non-CGO auto-migration paths to use shared
safety functions instead of inline logic:
Phase 1 (pre-flight):
- Always backup SQLite before any migration attempt
- Verify server target to prevent writing to wrong Dolt server
- Skip migration when backend explicitly set to sqlite (GH#2016)
- Use GetBackend() for SQLite guard, strings.EqualFold for Dolt
stale-leftover detection (preserves legacy empty-backend migration)
Phase 2 (import):
- Unchanged: extract from SQLite, create Dolt store, import data
Phase 3 (verify + finalize):
- Verify issue counts match before updating metadata
- Atomic finalization via finalizeMigration (metadata last)
- Rollback with warning on failure (not silent discard)
Clear, actionable error messages at every failure point showing
backup path. 13 unit tests including new SQLite backend guard test.
Authored by: Aaron Lippold<lippold@gmail.com>
* fix(main): clear error when SQLite backend detected
When GetBackend() returns "sqlite" (user opted to stay on SQLite or
migration was skipped), print a clear error with migration instructions
instead of falling through to dolt.New() which produces a confusing
Dolt connection failure.
Fixes#2016.
Authored by: Aaron Lippold<lippold@gmail.com>
* feat(doctor): detect and fix broken migration states
Add three new doctor checks for migration-related issues:
CheckBrokenMigrationState: detects metadata claiming Dolt backend
but no Dolt directory present (with server-mode awareness). Offers
bd doctor --fix to restore SQLite backend from beads.db or
beads.db.migrated files.
CheckSQLiteResidue: detects leftover beads.db after successful
migration. Fix renames to .migrated (with backend guard to prevent
accidentally renaming active SQLite database).
CheckEmbeddedModeConcurrency: detects embedded mode with lock
contention indicators (dolt-access.lock, noms LOCK files).
Recommends switching to server mode for multi-agent workflows.
Addresses #2086.
19 doctor tests covering all detection paths including server mode,
backup file detection, .migrated-only recovery, zero-byte files,
concurrent access with access locks and noms locks.
Fixes#2086.
Authored by: Aaron Lippold<lippold@gmail.com>
* test(migrate): add integration tests for migration safety
8 integration tests covering key business flows:
- Full migration lifecycle (SQLite → backup → Dolt → bd list works)
- Failed migration recovery (corrupt SQLite → backup exists → intact)
- Doctor detects broken state and fix restores SQLite backend
- Doctor fixes beads.db.migrated rename-back recovery
- Idempotent retry (second migration is no-op)
- SQLite guard prevents auto-migration (data intact, no backup)
- Backup content matches source byte-for-byte
- Metadata JSON valid with all required fields after migration
Authored by: Aaron Lippold<lippold@gmail.com>
* feat(scripts): add migrate-audit.sh for batch SQLite→Dolt migration
Utility script to audit and batch-migrate beads boards:
- Scans all .beads/ directories under a configurable root
- Reports backend state, issue count, and schema version for each board
- --dry-run: shows what --migrate would do without changes
- --migrate: batch converts eligible SQLite boards to Dolt
- --exclude PATTERN: skip projects matching regex (e.g., "backup|test")
- --port/--host: target a specific Dolt server
Safety features:
- Backs up metadata.json before modifying each board
- Restores original metadata.json on migration failure
- Skips boards with old schema (missing owner column)
- bd binary handles SQLite backup, server verification, count verification
- Uses jq for JSON (consistent with existing scripts, no python dependency)
Companion tool for the migration safety PR (GH#2016, GH#2086).
Authored by: Aaron Lippold<lippold@gmail.com>
* fix(migrate): handle all schema versions in SQLite extract
Databases from older beads versions are missing columns added over time
(owner, created_by, crystallizes, mol_type, work_type, quality_score,
source_system, and others). The extract functions hardcoded COALESCE
for all columns, causing "no such column" errors.
Fix: make ALL non-id columns use sqliteOptionalTextExpr via a DRY
opt() helper in both CGO extract and shim extract paths. Missing
columns default to empty/zero/null. Also adds empty/corrupt beads.db
handling to the migrate-audit.sh script.
Tested against 12 real-world databases spanning multiple beads versions,
from the earliest (~30 columns) to the current schema (50+ columns).
All 28 boards migrated successfully.
Authored by: Aaron Lippold<lippold@gmail.com>
Add support for placing dolt data on a different filesystem than .beads/.
This is useful on WSL where the project lives on a slow NTFS mount (9P)
but dolt data can be placed on native ext4 for 5-10x I/O speedup.
Configuration:
- metadata.json: "dolt_data_dir": "/path/to/fast/storage"
- Environment: BEADS_DOLT_DATA_DIR=/path/to/fast/storage
- CLI: bd dolt set data-dir /path/to/fast/storage
When set, the dolt sql-server uses the custom directory instead of
.beads/dolt/. The JSONL source of truth remains in .beads/ — only the
dolt database (which is fully recreatable from JSONL) moves.
Changes:
- configfile: add DoltDataDir field, GetDoltDataDir() getter, update
DatabasePath() to check custom dir first
- doltserver: add ResolveDoltDir() helper, update Start(), IsRunning(),
and reclaimPort() to use it instead of hardcoded path
- cmd/bd/dolt: add "data-dir" key to bd dolt set command
Callers were using configfile.GetDoltServerPort() or hardcoded 3307
instead of doltserver.DefaultConfig(beadsDir) which correctly resolves
all three cases: explicit config, Gas Town (3307), and hash-derived
standalone ports (13307-14306).
- Add BEADS_DOLT_SERVER_PORT env var to doltserver.DefaultConfig() as
highest-priority override (parity with configfile.GetDoltServerPort)
- Fix testDoltConnection, testServerConnection, openDoltServerConnection
in cmd/bd/dolt.go to use resolved port
- Replace three hardcoded 3307 literals in cmd/bd/doctor/perf_dolt.go
- Fix migrate_auto.go connection port and remove 3307 persistence
- Fix init.go display output to show resolved port
- Update help text from "default: 3307" to "auto-detected"
- Deprecate configfile.GetDoltServerPort() with guidance comment
Delete broken store_nocgo_test.go (references undefined errNoCGO),
remove dead bootstrapEmbeddedDolt/hasDoltSubdir functions, and clean up
stale comments and docs that still referenced embedded mode, CGO
requirements, or in-process Dolt across 20 files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Four fixes enabling Hosted Dolt instances:
1. TLS support: ServerTLS config + BEADS_DOLT_SERVER_TLS env var
2. Remote auth: --user flag for DOLT_PUSH/DOLT_PULL with Hosted Dolt
3. Explicit branch in Pull() to avoid "did not specify a branch" errors
4. Config plumbing for server user/password/TLS through to dolt.Config
Also adds bd dolt push/pull commands (already referenced by bd sync
deprecation messages) and ForcePush() for overwriting remote state.
Refactors DSN construction into buildServerDSN() helper, eliminating
duplicated connection string building.
Note: bd dolt commit was omitted as bd vc commit already exists.
Co-authored-by: bryanhirsch <bryanhirsch@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Update comments and user-facing messages across 17 production files to
reflect the current Dolt-native architecture (no daemon):
- Gitignore template: reorganized, daemon/SQLite entries moved to legacy section
- Doctor fix messages: removed references to non-existent bd daemon commands
- Doctor federation: updated fix suggestions to use gt dolt start / server mode
- Doctor integrity: removed "daemon won't start" messaging
- Code comments: replaced daemon mode references with current architecture terms
- Lock handling: marked daemon.lock as legacy cleanup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Restore bd migrate --to-dolt for users still on SQLite. Update all tests
that referenced .db files to use dolt/ directories. Fix FindAllDatabases
to detect dolt directories. Remove daemon-related test expectations
removed in Phase 8.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Phase 3 of Dolt-Native Pruning. Removed ~1,855 lines:
- Deleted migrate_dolt_cmd.go, migrate_dolt_cmd_nocgo.go, migration_hint.go
- Gutted migrate_dolt.go to just listMigrations()
- Removed SQLite codepaths from migrate.go (detectDatabases, getDBVersion, etc.)
- Removed BackendSQLite constant from configfile
- Removed GetConfiguredBackend, LegacyDatabaseNames from beads.go
- Removed NewSQLiteStorage from public API
- Simplified findDatabaseInBeadsDir (no more .db file scanning)
- Simplified backend_migration doctor check (always Dolt)
- Removed SQLite migration hint from main.go
WIP: Need to restore bd migrate --to-dolt as user migration path,
and fix remaining test failures in configfile, beads, cmd/bd packages.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Code health review found 30+ instances of error suppression using blank
identifier without explanation. Added comments to 82 files explaining WHY
each error is safely ignored (best-effort cleanup, advisory operations,
safe defaults, etc.) to improve code maintainability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
Revert commits e5330641 and 0df41523 which removed embedded Dolt mode
from the beads codebase. The embedded Dolt removal was only intended for
Gas Town, not for Beads.
Restores:
- dolthub/driver dependency and embedded connection path
- Advisory flock (AccessLock) for concurrent process protection
- Embedded connector lifecycle management in DoltStore
- All CGO build tags across ~45 files
- Vendored go-icu-regex library
- nocgo stub files for non-CGO builds
- Bootstrap and embedded_uow helpers
- factory_dolt_test.go and dolt_singleprocess_test.go
Merge conflict resolutions:
- store.go: TCP fail-fast check wrapped inside if cfg.ServerMode
- store.go: backtick-quoting for embedded CREATE DATABASE (prefix-based names)
- perf_dolt.go: port references updated from 3306 to 3307
- ci.yml: restored continue-on-error for Nix (dolthub/driver requires Go 1.25.6+)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Remove the embedded Dolt driver (dolthub/driver) and all associated code,
keeping only server-mode connections via MySQL protocol to dolt sql-server.
Key changes:
- Remove dolthub/driver dependency and go-icu-regex vendored dep
- Remove embedded connection path, access locks, bootstrap, nocgo stubs
- Remove CGO build tags from all ~40 files
- Remove CGO/ICU settings from Makefile and scripts/test.sh
- Simplify configfile: Dolt is always server mode now
- Update doctor checks, factory, daemon guard for server-only
- Binary size reduced from ~120MB to ~44MB
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
B1: DatabasePath() now always resolves to .beads/dolt/ for dolt backend,
ignoring stale Database field values like town, wyvern, beads_rig
that caused bd to look in the wrong directory.
B2: bootstrapEmbeddedDolt() now blocks JSONL auto-import in dolt-native
sync mode. If the dolt DB does not exist, it returns an error instead of
silently creating a new database from stale JSONL backup.
B-build: Makefile and scripts/test.sh now detect Homebrew keg-only
icu4c and export CGO_CFLAGS/CGO_CPPFLAGS/CGO_LDFLAGS so dolt
go-icu-regex dependency can compile and link.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove auto-detection of running dolt sql-server in bd init; server
mode now requires explicit --server flag
- Delete dead init_dolt_cgo.go and init_dolt_nocgo.go
- Doctor server check: embedded mode returns StatusOK not StatusWarning
- Update configfile comments to reflect embedded as default
- Fix store.go initSchemaOnDB using wrong receiver (s.db → db)
- Guard auto-import in dolt-native sync mode
- Update sync mode defaults and staleness checks for embedded-first
Closes: gt-dolt-embedded-default
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enable Gas Town agent tmux sessions to configure Dolt server mode via
BEADS_DOLT_SERVER_* environment variables without modifying metadata.json.
Adds IsDoltServerMode(), GetDoltServerHost/Port/User/Database() getter
methods to configfile.Config with env var → config → default precedence.
Wires factory to populate server opts from config when server mode is active.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add stale_closed_issues_days config option to metadata.json:
- 0 (default): Check disabled - repos keep unlimited beads
- >0: Enable check with specified day threshold
Design philosophy: Time-based cleanup is a crude proxy for the real
concern (database size). Disabled by default since a repo with 100
closed issues from 5 years ago doesn't need cleanup.
Also adds a warning when check is disabled but database has >10,000
closed issues, recommending users enable the threshold.
Co-Authored-By: SageOx <ox@sageox.ai>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
- Add dolt_mode, dolt_server_host, dolt_server_port fields to configfile.Config
- Add IsDoltServerMode(), GetDoltServerHost(), GetDoltServerPort() helpers
- Update factory to read server mode config and set Options accordingly
- Skip bootstrap in server mode (database lives on server)
- Pass Database name to dolt.Config for USE statement after connecting
- Disable dolt stats collection to avoid lock issues in embedded mode
This enables bd to connect to a running dolt sql-server (started via
'gt dolt start') instead of using embedded mode, allowing multi-client
access without file locking conflicts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Skip Bootstrap when ServerMode is true (bootstrap is for embedded cold-start)
- Fix doltExists() to follow symlinks using os.Stat
- Pass database name from metadata.json to DoltStore config
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code review fix: In server mode, Dolt connects to an external sql-server
and should NOT be single-process-only. The whole point of server mode is
to enable multi-writer access.
Changes:
- Add Config.GetCapabilities() method that considers server mode
- Update daemon_guard, daemon_autostart, daemons, main to use GetCapabilities()
- Add TestGetCapabilities test
- Update init command help text to document server mode flags
The existing CapabilitiesForBackend(string) is kept for backward compatibility
but now includes a note to use Config.GetCapabilities() when the full config
is available.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Dolt server mode configuration to metadata.json for multi-writer access:
- Add DoltMode, DoltServerHost, DoltServerPort, DoltServerUser fields to Config
- Add helper methods with sensible defaults (127.0.0.1:3306, root user)
- Update factory to read server mode config and pass to dolt.Config
- Add --server, --server-host, --server-port, --server-user flags to bd init
- Validate that --server requires --backend dolt
- Add comprehensive tests for server mode configuration
Example metadata.json for server mode:
{
"backend": "dolt",
"database": "dolt",
"dolt_mode": "server",
"dolt_server_host": "192.168.1.100",
"dolt_server_port": 3306,
"dolt_server_user": "beads"
}
Password should be set via BEADS_DOLT_PASSWORD env var for security.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 2 of Dolt integration - enables runtime backend selection:
- Add --backend flag to bd init (sqlite|dolt)
- Create storage factory for backend instantiation
- Update daemon and main.go to use factory with config detection
- Update database discovery to find Dolt backends via metadata.json
- Fix Dolt schema init to split statements for MySQL compatibility
- Add ReadOnly mode to skip schema init for read-only commands
Usage: bd init --backend dolt --prefix myproject
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces the default retention period for deletion manifest entries.
Shorter TTL limits blast radius of stale deletions that can poison
beads installations when agents get out of sync.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Root cause: metadata.json is tracked in git and contains last_bd_version.
When git operations (pull, checkout, merge) reset metadata.json to the
committed version, the upgrade notification would fire repeatedly.
Fix: Store the last used bd version in .beads/.local_version which is
gitignored, so git operations don't affect version tracking.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Change default JSONL filename from beads.jsonl to issues.jsonl
- Add bd doctor check and fix to auto-migrate legacy beads.jsonl configs
- Update FindJSONLPath to prefer issues.jsonl over beads.jsonl
- Add CheckLegacyJSONLConfig and CheckLegacyJSONLFilename checks
- Add LegacyJSONLConfig fix to rename files and update config
- Update .gitattributes to reference issues.jsonl
- Fix tests to expect new canonical filename
- Add bd-6xd to v0.25.1 release notes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements two P1 tasks for the deletions manifest epic:
bd-v2x: Add deletions pruning to bd compact
- PruneDeletions function removes records older than retention period
- Default retention: 7 days (configurable via metadata.json)
- CLI --retention flag for override
- Atomic file rewrite prevents corruption
- Called automatically during all compact operations
bd-pnm: Add git history fallback for pruned deletions
- Catches deletions where manifest entry was pruned
- Uses git log -S to search for ID in JSONL history
- Batches multiple IDs for efficiency (git -G regex)
- Self-healing: backfills manifest on hit
- Conservative: keeps issue if git check fails (shallow clone)
Tests added for both features with edge cases covered.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Summary
When metadata.json gets deleted (git clean, merge conflict, rebase), the
version tracking code auto-recreates it using DefaultConfig() which hardcoded
jsonl_export to 'issues.jsonl'. But many repos (including beads itself) use
'beads.jsonl', causing a mismatch between config and actual JSONL file.
## Changes
1. **bd doctor --fix auto-detection** (cmd/bd/doctor/fix/database_config.go)
- New DatabaseConfig() fix function that auto-detects actual JSONL file
- Prefers beads.jsonl over issues.jsonl (canonical name)
- Skips backup files and merge artifacts
- Wired into doctor.go applyFixes()
2. **Version tracking auto-detection** (cmd/bd/version_tracking.go)
- trackBdVersion() now scans for existing JSONL files before defaulting
- Prevents mismatches when metadata.json gets recreated
- Added findActualJSONLFile() helper function
3. **Canonical default name** (internal/configfile/configfile.go)
- DefaultConfig() changed from issues.jsonl to beads.jsonl
- Aligns with canonical naming convention
4. **FindJSONLPath preference** (internal/beads/beads.go)
- Now prefers beads.jsonl over issues.jsonl when scanning
- Default changed from issues.jsonl to beads.jsonl
5. **Test coverage**
- Added comprehensive tests for DatabaseConfig fix
- Updated configfile tests for new default
- Verified backup file skipping logic
## Testing
- All existing tests pass
- New tests verify auto-fix behavior
- Integration tested with simulated mismatches
Closes: bd-afd
Implement automatic bd version tracking and upgrade awareness:
- Add LastBdVersion field to Config struct in metadata.json
- Auto-update version on every bd command in PersistentPreRun
- Add 'bd upgrade' command with status/review/ack subcommands
- Show upgrade notifications on 'bd ready' and 'bd list'
- Non-intrusive: only shows once per session, skipped for JSON output
The system tracks version changes automatically and helps users stay
aware of bd upgrades without manual intervention. Notifications are
graceful - failures don't break commands.
Example output on bd ready after upgrade:
🔄 bd upgraded from v0.22.0 to v0.24.2 since last use
💡 Run 'bd upgrade review' to see what changed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The canonical beads database name is issues.jsonl. Tens of thousands of users
have issues.jsonl, and beads.jsonl was only used by the Beads project itself
due to git history pollution.
Changes:
- Updated bd doctor to warn about beads.jsonl instead of issues.jsonl
- Changed default config from beads.jsonl to issues.jsonl
- Reversed precedence in checkGitForIssues to prefer issues.jsonl
- Updated git merge driver config to use issues.jsonl
- Updated all tests to expect issues.jsonl as the default
issues.jsonl is now the canonical default; beads.jsonl is legacy
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Removes noisy version mismatch warnings on every bd upgrade
- Version field in metadata.json was redundant with daemon version checking via RPC
- Daemon version mismatches still detected via HealthResponse
- Removes checkVersionMismatch() function and related test file
- Updates .beads/.gitignore to properly ignore merge artifacts
Amp-Thread-ID: https://ampcode.com/threads/T-7ba8aff2-97a0-4d0c-9008-e858bdfadd61
Co-authored-by: Amp <amp@ampcode.com>