Memories (from `bd remember`) may contain sensitive agent context — API
patterns, debugging notes, credential hints. They were included in both
`bd export` and auto-export (pre-commit hook) by default, leaking
private data into git history.
Changes:
- auto-export: pass includeMemories=false to exportToFile
- bd export: flip default to exclude memories; add --include-memories
opt-in flag; --all also includes memories
- --no-memories is preserved (hidden) for backward compat but is now
the default behavior
Adds TestExportExcludesMemoriesByDefault to verify default exclusion
and that --include-memories / --all still include them.
Wisps are private/transient and must not reach git history or external
integrations. Both bd export and auto-export (pre-commit hook) included
wisps because the SearchIssues filter had Ephemeral=nil (match all).
Set filter.Ephemeral=false (persistent-only) in both export.go and
export_auto.go. The --all flag overrides to include everything.
Adds TestExportExcludesWispsByDefault to verify default exclusion and
that --all still includes wisps.
* fix(export): sort memory keys for deterministic JSONL output (GH#3474)
Go map iteration is non-deterministic, so _type:"memory" lines were
shuffled on every export. Sort keys before writing to eliminate noisy
diffs in committed issues.jsonl.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(export): sort memory keys in export_auto.go + add determinism test (GH#3474)
export_auto.go:210 had the same unsorted map iteration as export.go.
Apply identical sort fix and upgrade the silent json.Marshal error
to a returned error for parity.
Add TestExportMemoryDeterminism: seeds 5 memories, exports twice,
asserts byte-identical output and alphabetical key order.
Addresses review feedback on PR #3482.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: remove duplicate wisp query in bd export (#3352)
SearchIssues with Ephemeral=nil already queries both the issues and
wisps tables with ID-based dedup (issueops/search.go). The separate
Ephemeral=true query followed by append caused every wisp to appear
twice in the exported JSONL.
Remove the redundant wisp query from both export.go (manual export)
and export_auto.go (auto-export/exportToFile). The SearchIssues call
with Ephemeral=nil continues to include all wisps correctly.
* fix: suppress gosec G304 false positive in hookWorkTreeRoot
The path is filepath.Join(os.Getenv("GIT_DIR"), "gitdir") — reading a
well-known git internal file from a trusted environment variable set by
git itself during hook execution. Not a user-controlled file inclusion.
This false positive causes the Lint CI check to fail on every PR in
the repo, masking real lint issues.
* test(export): add regression test for duplicate wisp entries (GH#3352)
Addresses review feedback requesting test coverage for the duplicate-wisp
export fix. Creates 3 regular issues and 3 ephemeral wisps, runs export,
and asserts: no duplicate IDs in output, wisp count matches source count,
and total exported count equals expected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(export): add _type discriminator to JSONL issue lines (GH#3271)
bd export produces JSONL with mixed schemas: issue lines and memory lines.
Memory lines carry "_type":"memory" but issue lines had no _type field,
causing downstream consumers to crash when they encounter an unexpected
schema (e.g. json.loads(line)["status"] throws KeyError on memory lines).
Add "_type":"issue" to all exported issue records via an exportIssueRecord
wrapper struct. This makes every JSONL line self-describing without changing
the Issue or IssueWithCounts types used elsewhere.
Both export paths updated: manual (runExport) and auto (exportToFile).
Import already handles this gracefully - unknown fields are ignored during
json.Unmarshal into types.Issue.
* test(export): add _type discriminator assertion to embedded export tests
Verifies that every JSONL line from bd export carries a _type field
("issue" or "memory") and that each type has its expected key fields.
Addresses codecov 0% patch coverage flag on PR #3272.
bd export populated comment_count but never called GetCommentsForIssues()
to populate the Comments field on each issue. This meant bd export | bd import
silently lost all comment history. Now both export.go and export_auto.go
bulk-load comments alongside labels and dependencies.
Fixes#3007
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd export now includes persistent memories (from bd remember) as JSONL
lines with {"_type":"memory","key":"...","value":"..."}. bd import
detects these records and restores them via SetConfig, making
bd export | bd import a lossless round-trip for both issues and memories.
New flags:
- bd export --no-memories: exclude memories from export
Backward compatible: JSONL without _type fields imports as before.
Co-Authored-By: Patrick Farrell <pfarrell@whamcloud.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Export: sanitize zero-value time.Time fields (year 0001) to Unix epoch
before JSON marshaling. NULL datetime columns from Dolt scan as
time.Time{} which causes MarshalJSON to fail.
Templates: replace stale 'bd sync' with 'bd dolt push' in agent
instruction templates generated by bd setup factory.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DefaultInfraTypes was an exported mutable slice while defaultInfraSet
was computed once at init() time. If external code modified the slice
after init, IsInfraType() would silently become inconsistent.
Fix: unexport the slice as defaultInfraTypes, add DefaultInfraTypes()
function that returns a defensive copy. Internal (same-package) callers
use the unexported var directly; external callers get a safe copy.
Fixes#2193
Amp-Thread-ID: https://ampcode.com/threads/T-019ca75d-c29a-74d8-9f43-9bdad824dabe
Co-authored-by: Amp <amp@ampcode.com>
Add a proper `bd export` command that exports issues to JSONL format
(one JSON object per line), replacing the previous workaround of piping
`bd list --all --json` through Python for JSON-to-JSONL conversion.
Features:
- Export to stdout (default) or file via -o flag
- Includes labels, dependencies, and comment/dependency counts
- Excludes infra beads by default (--all or --include-infra to include)
- Excludes templates by default (--all to include)
- --scrub flag to filter out test/pollution records
- Includes wisps (ephemeral beads) automatically
- Output compatible with `bd import` for round-trip backup/restore
- Registered as read-only command (no Dolt writes)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
- Remove Config.ServerMode and Config.OpenTimeout fields (dead since embedded removal)
- Rewrite doctor/dolt.go to use MySQL protocol instead of embedded dolthub/driver
- Rename openDoltDBWithLock to openDoltConn, remove closeDoltDB helpers
- Delete dolt_nocgo.go stubs (doctor + store_nocgo_test.go)
- Remove cgo build tags from doctor package
- Update lock error messages for server-only world
- Clean up unused lockTimeout parameter threading in list.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run make fmt to fix all gofmt issues. Add nolint directives for:
- G204 (gosec) in cmd/bd/stubs.go: git args are internal, not user-supplied
- unparam in internal/syncbranch/worktree.go: error return kept for callers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
Phase 7 (a5da57e3) deleted internal/storage/factory/ and internal/storage/memory/
but left 30+ files still importing them. This commit fixes all broken references:
- Created internal/storage/dolt/open.go with NewFromConfig/NewFromConfigWithOptions
- Replaced all factory.New/NewFromConfig/NewWithOptions with dolt equivalents
- Broke import cycles in dolt/bootstrap.go (routing/utils/audit → local types)
- Removed dead storage.Config struct
- Converted all test files from memory.New() to dolt.New() test stores
- Removed tests that depended on deleted detectPrefix/LoadFromIssues/mockRemoteStore
46 files changed, 249 insertions(+), 851 deletions(-)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Delete internal/storage/sqlite/ entirely (131 files, ~40K LOC). Update
factory to route all backends through Dolt registry. Rewrite SQLite
migration reader with raw database/sql. Remove to-SQLite escape hatch.
Update all production and test code to use Dolt or memory stores.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Add dec/adr aliases to utils.NormalizeIssueType() so CLI commands
like `bd list --type dec` resolve correctly. Add TypeDecision to
coreWorkTypes so `bd types` lists it. Update remaining help strings
in export, ready, and claude-plugin commands. Add alias test cases.
Co-authored-by: dariye <dariye@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
The Dolt transition epic (dolt-test-woho) was executed on Feb 10, 11 days
before Phase 2 planned date of ~Feb 21, and before the upstream blocker
(dolt-test-djfr: Dolt-in-Git lands upstream) was resolved.
This reverts the premature removal of SQLite backend (42K+ lines) and JSONL
sync layer (9K+ lines) while preserving all non-transition changes merged
since the transition (PRs #1655, #1660, #1670, #1675, #1680, #1684, #1689).
Restored:
- internal/storage/sqlite/ (131 files, full SQLite storage backend)
- internal/importer/ (7 files, JSONL import engine)
- internal/storage/dolt/dirty.go (dirty tracking for Dolt)
- cmd/bd/autoflush.go, autoimport.go, export.go (JSONL sync layer)
- Storage interface dirty tracking methods
- Factory defaults to SQLite (Dolt available via registry)
- Test helpers create SQLite stores instead of Dolt
Removed transition-only files:
- cmd/bd/config_local.go, import_engine.go, jsonl_bootstrap.go, jsonl_path.go
Applied PR #1680 retry logic to restored internal/importer/importer.go.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Delete the JSONL sync layer files (autoflush.go, autoimport.go, export.go,
import.go, jsonl_deprecated.go) and the internal/importer/ package as part
of the Dolt transition Phase 2.
Preserved actively-used functions in new focused files:
- config_local.go: YAML config parsing (isNoDbModeConfigured, etc.)
- jsonl_path.go: JSONL path resolution and utilities
- jsonl_bootstrap.go: Git-based auto-import on empty database
- import_engine.go: Core import engine inlined from internal/importer/
Removed all FlushManager references, markDirtyAndScheduleFlush calls,
autoImportIfNewer calls, and deleted tests for removed functionality.
38 files changed, -9,753 lines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Since daemonClient is always nil (daemon_deprecated.go stub), every
`if daemonClient != nil` branch was dead code. This removes all 171
occurrences across 56 command files, keeping only the direct storage
(else) branches. Also cleans up unused rpc/json/types imports and
fixes variable shadowing issues left behind.
Part of Dolt transition Phase 2 (dolt-test-woho epic).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
The ensureDatabaseFresh + daemonClient nil check + error handling
pattern was duplicated across 16 command files with inconsistent
error handling (some used FatalErrorRespectJSON, others fmt.Fprintf).
Extracted into requireFreshDB() wrapper that standardizes on
FatalErrorRespectJSON for consistent --json support.
Closes dolt-test-7y4
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merged internal/util (NormalizeIssueType, NormalizeLabels) into
internal/utils package. Updated 8 consumers to import from the
consolidated package. Eliminates the confusing coexistence of
two similarly-named utility packages.
Closes dolt-test-oli
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These read commands were querying the database without verifying it was
in sync with JSONL, causing users to get stale results without warning.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When exporting to a sync-branch worktree, the JSONL is written to
.git/beads-worktrees/<branch>/.beads/issues.jsonl, but the SQLite
database remains in the main repo's .beads/ directory.
The code was incorrectly deriving the database path from the JSONL
directory, causing:
Warning: failed to update database mtime: chtimes .../beads-worktrees/beads-sync/.beads/beads.db: no such file or directory
Fix: Use store.Path() to get the actual database location instead of
constructing it from the JSONL path.
- Add test TestWorktreeExportUsesCorrectDBPath to verify the fix
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add two new filter flags to the export command:
- --id: Filter by specific issue IDs (comma-separated)
- --parent: Filter by parent issue ID (shows children)
Also fix safety checks (empty DB, staleness) to skip when filters
are active, since filtered exports intentionally produce subsets.
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Add GetAllEventsSince to the Storage interface and implement it in
SQLite, Dolt, and Memory backends. Create exportEventsToJSONL which
reads events_last_exported_id from metadata, fetches new events, appends
them as JSON lines, and updates the high-water mark.
Hook the events export into daemon_sync and autoflush, guarded by
config.GetBool("events.export") so it's opt-in. Add events.jsonl to
the sync file list in gitCommitBeadsDir. Add --events and --events-reset
flags to the export command (always available regardless of config).
Include a test verifying GetAllEventsSince returns all event columns.
Tickets: bd-w9f, bd-8fq, bd-w9w, bd-1ai, bd-2qd, bd-b22, bd-mmc, bd-3pc
Merge PR #819 from justbry with improvements:
- Add --format obsidian option to bd export
- Generate Obsidian Tasks-compatible markdown
- Default output to ai_docs/changes-log.md
- Map status to checkboxes, priority to emoji, type to tags
- Support parent-child hierarchy with indentation
- Use official Obsidian Tasks format (🆔, ⛔ emojis)
Improvement over PR: replaced O(n²) bubble sort with slices.SortFunc
for date ordering.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: justbry <justbu42@proton.me>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Strip (bd-xxx), (gt-xxx) suffixes from code comments and changelog
entries. The descriptions remain meaningful without the ephemeral
issue IDs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Analysis found these commands are dead code:
- gt never calls `bd pin` - uses `bd update --status=pinned` instead
- Beads.Pin() wrapper exists but is never called
- bd hook functionality duplicated by gt mol status
- Code comment says "pinned field is cosmetic for bd hook visibility"
Removed:
- cmd/bd/pin.go
- cmd/bd/unpin.go
- cmd/bd/hook.go
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the --priority (-p) flag to bd export for filtering by exact priority,
matching the behavior of bd list. This completes the comprehensive filtering
support for bd export.
The flag uses cmd.Flags().Changed() to properly handle P0 (priority 0), which
would otherwise be interpreted as "not set" due to Go zero-value semantics.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add async gates - coordination primitives for agents to wait on external events
like CI completion, PR merges, timers, or human approval.
Changes:
- Add 'gate' issue type to types.go with gate-specific fields:
- AwaitType: condition type (gh:run, gh:pr, timer, human, mail)
- AwaitID: condition identifier
- Timeout: max wait duration
- Waiters: mail addresses to notify when gate clears
- Add SQLite migration 027_gate_columns for new fields
- Update all SQLite storage queries to handle gate fields
- Add bd gate commands: create, show, list, close, wait
- All commands support --json output and --no-daemon mode
Closes: bd-2v0f, bd-lz49, bd-u66e
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Modernize sorting code to use Go 1.21+ slices package:
- Replace sort.Slice with slices.SortFunc across 16 files
- Use cmp.Compare for orderable types (strings, ints)
- Use time.Time.Compare for time comparisons
- Use cmp.Or for multi-field sorting
- Use slices.SortStableFunc where stability matters
Benefits: cleaner 3-way comparison, slightly better performance,
modern idiomatic Go.
Part of GH#692 refactoring epic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wisp = ephemeral vapor produced by the Steam Engine (Gas Town).
This aligns with the metaphor:
- Claude = Fire
- Claude Code = Steam
- Gas Town = Steam Engine
- Wisps = ephemeral vapor it produces
Changes:
- types.Issue.Ephemeral → types.Issue.Wisp
- types.IssueFilter.Ephemeral → types.IssueFilter.Wisp
- JSON field: "ephemeral" → "wisp"
- CLI flag: --ephemeral → --wisp (bd cleanup)
- All tests updated
Note: SQLite column remains "ephemeral" (no migration needed).
This is a breaking change for JSON consumers using 0.33.0.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ephemeral issues should never be exported to issues.jsonl. They exist only
in SQLite and are shared via .beads/redirect pointers. This prevents
"zombie" issues from resurrecting after mol squash deletes them.
Changes:
- Filter ephemeral issues in autoflush, export, and multirepo_export
- Add --summary flag to bd mol squash for agent-provided summaries
- Fix DeleteIssue to also remove comments (missing cascade)
- Add tests for ephemeral filtering and comment deletion
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update nix vendorHash after fatih/color removal
- Bump version to 0.30.7
- Add GroupID to remaining commands for proper cobra grouping
- Apply semantic color rendering to list and stale commands
- Update pre-commit hook template
- Close bd-6y5 (getLocalSyncBranch tests)
- Include tombstone export logic fix (bd-81x6)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update import/export to handle tombstones for deletion sync propagation:
Exporter:
- Include tombstones in JSONL output by setting IncludeTombstones: true
- Both single-repo and multi-repo exports now include tombstones
Importer:
- Tombstones from JSONL are imported as-is (they're issues with status=tombstone)
- Legacy deletions.jsonl entries are converted to tombstones via convertDeletionToTombstone()
- Non-tombstone issues in deletions manifest are still skipped (backward compat)
- purgeDeletedIssues() now creates tombstones instead of hard-deleting
This is Phase 2 of the tombstone implementation (bd-dli design), enabling
inline soft-delete tracking for cross-clone deletion synchronization.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>