From 58f37d05c60e7d48c94ee784429a37e7919df04f Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 23 Nov 2025 19:04:22 -0800 Subject: [PATCH] refactor: Split monolithic sqlite.go into focused files (bd-0a43) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split internal/storage/sqlite/sqlite.go (1050 lines) into focused files for better maintainability and code discovery: - store.go (306 lines): SQLiteStorage struct, New() constructor, initialization logic, and database utilities (Close, Path, IsClosed, UnderlyingDB, UnderlyingConn, CheckpointWAL) - queries.go (1173 lines): Issue CRUD operations including CreateIssue, GetIssue, GetIssueByExternalRef, UpdateIssue, UpdateIssueID, CloseIssue, DeleteIssue, DeleteIssues, SearchIssues with all helpers - config.go (95 lines): Configuration and metadata management (SetConfig, GetConfig, GetAllConfig, DeleteConfig, SetMetadata, GetMetadata) plus OrphanHandling type definitions - comments.go (83 lines): Comment operations (AddIssueComment, GetIssueComments) - sqlite.go (31 lines): Package documentation explaining file organization Additional changes: - Removed duplicate OrphanHandling definition from ids.go (was causing build error with new config.go) Impact: - Zero functional changes, all tests pass (2.6s runtime) - Improved code discovery: easy to locate specific functionality - Better maintainability: related code grouped logically - Reduced cognitive load: smaller, focused files πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .beads/beads.jsonl | 1329 ++++++++++----------- internal/storage/sqlite/comments.go | 83 ++ internal/storage/sqlite/config.go | 95 ++ internal/storage/sqlite/ids.go | 10 - internal/storage/sqlite/queries.go | 1173 +++++++++++++++++++ internal/storage/sqlite/sqlite.go | 1651 +-------------------------- internal/storage/sqlite/store.go | 306 +++++ 7 files changed, 2351 insertions(+), 2296 deletions(-) create mode 100644 internal/storage/sqlite/comments.go create mode 100644 internal/storage/sqlite/config.go create mode 100644 internal/storage/sqlite/queries.go create mode 100644 internal/storage/sqlite/store.go diff --git a/.beads/beads.jsonl b/.beads/beads.jsonl index ec62345d..31f0e10c 100644 --- a/.beads/beads.jsonl +++ b/.beads/beads.jsonl @@ -1,664 +1,665 @@ -{"id":"bd-0088","content_hash":"7449088a4560a2a2821eeda8dca1e44c0017667314236a13df8d8112cda20101","title":"Create npm package structure for bd-wasm","description":"Set up npm package for distribution:\n- Create package.json with bd-wasm name\n- Bundle bd.wasm + wasm_exec.js\n- Create CLI wrapper (bin/bd) that invokes WASM\n- Add installation scripts if needed\n- Configure package for Claude Code Web sandbox compatibility","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.295058-08:00","updated_at":"2025-11-03T20:56:22.700641-08:00","closed_at":"2025-11-03T20:56:22.700641-08:00","source_repo":".","dependencies":[{"issue_id":"bd-0088","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.475356-08:00","created_by":"stevey"}]} -{"id":"bd-0134cc5a","content_hash":"d45c0e44c01c5855f14f07693bd800f4bfeac3084e10ceb17970ff54c58f6a40","title":"Fix auto-import creating duplicates instead of updating issues","description":"ROOT CAUSE: server_export_import_auto.go line 221 uses ResolveCollisions: true for ALL auto-imports. This is wrong.\n\nProblem:\n- ResolveCollisions is for branch merges (different issues with same ID)\n- Auto-import should UPDATE existing issues, not create duplicates\n- Every git pull creates NEW duplicate issues with different IDs\n- Two agents ping-pong creating endless duplicates\n\nEvidence:\n- 31 duplicate groups found (bd duplicates)\n- bd-236-246 are duplicates of bd-224-235\n- Both agents keep pulling and creating more duplicates\n- JSONL file grows endlessly with duplicates\n\nThe Fix:\nChange checkAndAutoImportIfStale in server_export_import_auto.go:\n- Remove ResolveCollisions: true (line 221)\n- Use normal import logic that updates existing issues by ID\n- Only use ResolveCollisions for explicit bd import --resolve-collisions\n\nImpact: Critical - makes beads unusable for multi-agent workflows","acceptance_criteria":"- Auto-import does NOT create duplicates when pulling git changes\n- Existing issues are updated in-place by ID match\n- No ping-pong commits between agents\n- Test: two agents updating same issue should NOT create duplicates\n- bd duplicates shows 0 groups after fix","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-27T21:48:57.733846-07:00","updated_at":"2025-10-30T17:12:58.21084-07:00","closed_at":"2025-10-27T22:26:40.627239-07:00","source_repo":"."} -{"id":"bd-02a4","content_hash":"fbaca84d9502239656f05a14f62e8e6adec8f8dd492b1e91694fefcd0bdf310c","title":"Modify CreateIssue to support parent resurrection","description":"Update internal/storage/sqlite/sqlite.go:182-196 to call TryResurrectParent before failing on missing parent. Coordinate with EnsureIDs changes for consistent behavior. Handle edge case where parent never existed in JSONL (fail gracefully).","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-04T12:31:59.701571-08:00","updated_at":"2025-11-05T00:08:42.811436-08:00","closed_at":"2025-11-05T00:08:42.81144-08:00","source_repo":"."} -{"id":"bd-0447029c","content_hash":"f32f7d8f0b07aaaeb9d07d8a1d000eef8fc79cf864e8aa20ebb899f6e359ebda","title":"bd find-duplicates - AI-powered duplicate detection","description":"Find semantically duplicate issues.\n\nApproaches:\n1. Mechanical: Exact title/description matching\n2. Embeddings: Cosine similarity (cheap, scalable)\n3. AI: LLM-based semantic comparison (expensive, accurate)\n\nUses embeddings by default for \u003e100 issues.\n\nFiles: cmd/bd/find_duplicates.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T12:40:11.705915-05:00","updated_at":"2025-11-20T12:40:11.705915-05:00","closed_at":"2025-10-29T16:15:10.64719-07:00","source_repo":"."} -{"id":"bd-0458","content_hash":"c4427da2aec84621525f7f286c626f6c94365a7e6ff8e35e9676b184c85e1adb","title":"Consolidate export/import/commit/push into sync.go","description":"Create internal/daemonrunner/sync.go with Syncer type. Add ExportOnce, ImportOnce, CommitAndMaybePush methods. Replace createExportFunc/createAutoImportFunc with thin closures calling Syncer.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.874539-07:00","updated_at":"2025-11-02T12:32:00.157369-08:00","closed_at":"2025-11-02T12:32:00.157375-08:00","source_repo":"."} -{"id":"bd-05a1","content_hash":"b79b0efa41b4eca8d7e5ab9738d5ecaa403c35497877a056a502efe0583ca251","title":"Isolate RPC server startup into rpc_server.go","description":"Create internal/daemonrunner/rpc_server.go with StartRPC function. Move startRPCServer logic here and return typed handle.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.876839-07:00","updated_at":"2025-11-02T12:32:00.158054-08:00","closed_at":"2025-11-02T12:32:00.158057-08:00","source_repo":"."} -{"id":"bd-0650a73b","content_hash":"a596aa8d6114d4938471e181ebc30da5d0315f74fd711a92dbbb83f5d0e7af88","title":"Create cmd/bd/daemon_debouncer.go (~60 LOC)","description":"Implement Debouncer to batch rapid events into single action. Default 500ms, configurable via BEADS_DEBOUNCE_MS. Thread-safe with mutex.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.431118-07:00","updated_at":"2025-10-30T17:12:58.221711-07:00","closed_at":"2025-10-28T12:03:35.614191-07:00","source_repo":"."} -{"id":"bd-06aec0c3","content_hash":"330e69cf6ca40209948559b453ed5242c15a71b5c949a858ad6854488b12dca2","title":"Integration Testing","description":"Verify cache removal doesn't break any workflows","acceptance_criteria":"- All test cases pass\n- No stale data observed\n- Performance is same or better\n- MCP works as before\n\nTest cases:\n1. Basic daemon operations (bd daemon --stop, bd daemon, bd list, bd create, bd show)\n2. Auto-import/export cycle (edit beads.jsonl externally, bd list auto-imports)\n3. Git workflow (git pull updates beads.jsonl, bd list shows pulled issues)\n4. Concurrent operations (multiple bd commands simultaneously)\n5. Daemon health (bd daemon --health, bd daemon --metrics)\n6. MCP operations (test MCP server with multiple repos, verify project switching)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T10:50:15.126668-07:00","updated_at":"2025-10-30T17:12:58.217214-07:00","closed_at":"2025-10-28T10:49:20.471129-07:00","source_repo":"."} -{"id":"bd-06y7","content_hash":"d8a9c155c8bf968766fc88eccf360ce547d984a1282adb4cc720c502cef0d91f","title":"Show dependency status in bd show output","description":"When bd show displays dependencies and dependents, include their status (open/closed/in_progress/blocked) for quick progress tracking. Improves context rebuilding and planning.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T11:22:11.606837-08:00","updated_at":"2025-11-05T11:23:30.431049-08:00","closed_at":"2025-11-05T11:23:30.431049-08:00","source_repo":"."} -{"id":"bd-0702","content_hash":"bed8c3ea786ecdbc1867ba5df8b4968894cc49368eaf1ce3238f560fa742cf97","title":"Consolidate ID generation and validation into ids.go","description":"Extract ID logic into ids.go: ValidateIssueIDPrefix, GenerateIssueID, EnsureIDs. Move GetAdaptiveIDLength here. Unify single and bulk ID generation flows.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.877886-07:00","updated_at":"2025-11-02T15:28:11.996618-08:00","closed_at":"2025-11-02T15:28:11.996624-08:00","source_repo":"."} -{"id":"bd-07af","content_hash":"23a2ed4081f7935099be0ec1c6b57cd7d861461d27de392648be28bd31d4c051","title":"Need comprehensive daemon health check command (bd daemon doctor?)","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-10-31T21:08:09.092473-07:00","updated_at":"2025-11-01T20:10:41.957435-07:00","closed_at":"2025-11-01T20:10:41.957435-07:00","source_repo":".","dependencies":[{"issue_id":"bd-07af","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:09.093276-07:00","created_by":"stevey"}]} -{"id":"bd-08e556f2","content_hash":"cd9e7cc106b733dc4893e92a75feae3331b422238f261a7c738c21a18e29719f","title":"Remove Cache Configuration Docs","description":"Remove documentation of deprecated cache env vars","acceptance_criteria":"- Documentation doesn't reference removed env vars\n- CHANGELOG documents breaking change\n- No mentions of storage cache except in CHANGELOG\n\nFiles to update:\n- ADVANCED.md (remove cache configuration section)\n- commands/daemons.md (remove cache env vars)\n- integrations/beads-mcp/SETUP_DAEMON.md (remove cache tuning)\n- CHANGELOG.md (add removal entry)\n\nDeprecated env vars:\n- BEADS_DAEMON_MAX_CACHE_SIZE\n- BEADS_DAEMON_CACHE_TTL\n- BEADS_DAEMON_MEMORY_THRESHOLD_MB","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T10:50:15.125488-07:00","updated_at":"2025-10-30T17:12:58.216329-07:00","closed_at":"2025-10-28T10:48:20.606979-07:00","source_repo":"."} -{"id":"bd-08fd","content_hash":"1fc998c05fb1ccb8725bc0fe9b930b201c0c291353b9f9d578c44865eef5dde9","title":"Test child issue","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-02T11:50:40.640901-08:00","updated_at":"2025-11-02T11:50:47.309652-08:00","closed_at":"2025-11-02T11:50:47.309652-08:00","source_repo":".","dependencies":[{"issue_id":"bd-08fd","depends_on_id":"bd-ce75","type":"blocks","created_at":"2025-11-02T11:50:40.642073-08:00","created_by":"stevey"}]} -{"id":"bd-09b5f2f5","content_hash":"02c69c90dc76c4982976362b9cb00ce01bc3fc3d17618feec3a02bab6fa4d196","title":"Daemon fails to auto-import after git pull updates JSONL","description":"After git pull updates .beads/issues.jsonl, daemon doesn't automatically re-import changes, causing stale data to be shown until next sync cycle (up to 5 minutes).\n\nReproduction:\n1. Repo A: Close issues, export, commit, push\n2. Repo B: git pull (successfully updates .beads/issues.jsonl)\n3. bd show \u003cissue\u003e shows OLD status from daemon's SQLite db\n4. JSONL on disk has correct new status\n\nRoot cause: Daemon sync cycle runs on timer (5min). When user manually runs git pull, daemon doesn't detect JSONL was updated externally and continues serving stale data from SQLite.\n\nImpact:\n- High for AI agents using beads in git workflows\n- Breaks fundamental git-as-source-of-truth model\n- Confusing UX: git log shows commit, bd shows old state\n- Data consistency issues between JSONL and daemon\n\nSee WYVERN_SYNC_ISSUE.md for full analysis.","design":"Three possible solutions:\n\nOption 1: Auto-detect and re-import (recommended)\n- Before serving any bd command, check if .beads/issues.jsonl mtime \u003e last import time\n- If newer, auto-import before processing request\n- Fast check, minimal overhead\n\nOption 2: File watcher in daemon\n- Daemon watches .beads/issues.jsonl for mtime changes\n- Auto-imports when file changes\n- More complex, requires file watching infrastructure\n\nOption 3: Explicit sync command\n- User runs `bd sync` after git pull\n- Manual, error-prone, defeats automation\n\nRecommended: Option 1 (auto-detect) + Option 3 (explicit sync) as fallback.","acceptance_criteria":"1. After git pull updates .beads/issues.jsonl, next bd command sees fresh data\n2. No manual import or daemon restart required\n3. Performance impact \u003c 10ms per command (mtime check is fast)\n4. Works in both daemon and non-daemon modes\n5. Test: Two repo clones, update in one, pull in other, verify immediate sync","notes":"**Fixed in v0.21.2!**\n\nThe daemon auto-import is fully implemented:\n- internal/autoimport package handles staleness detection\n- internal/importer package provides shared import logic (used by both CLI and daemon)\n- daemon's checkAndAutoImportIfStale() calls autoimport.AutoImportIfNewer()\n- importFunc uses importer.ImportIssues() with auto-rename enabled\n- All tests passing\n\nThe critical data corruption bug is FIXED:\nβœ… After git pull, daemon detects JSONL is newer (mtime check)\nβœ… Daemon auto-imports before serving requests\nβœ… No stale data served\nβœ… No data loss in multi-agent workflows\n\nVerification needed: Run two-repo test to confirm end-to-end behavior.","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-10-25T23:13:12.270766-07:00","updated_at":"2025-11-01T16:52:50.931197-07:00","closed_at":"2025-11-01T16:52:50.931197-07:00","source_repo":"."} -{"id":"bd-0a43","content_hash":"5d53e4f9d5929940c0734a174d80f51f5bc800ce1b3efc5058a9d3b798fbe65b","title":"Split monolithic sqlite.go into focused files","description":"internal/storage/sqlite/sqlite.go is 1050 lines containing initialization, 20+ CRUD methods, query building, and schema management.\n\nSplit into:\n- store.go: Store struct \u0026 initialization (150 lines)\n- bead_queries.go: Bead CRUD (300 lines)\n- work_queries.go: Work queries (200 lines) \n- stats_queries.go: Statistics (150 lines)\n- schema.go: Schema \u0026 migrations (150 lines)\n- helpers.go: Common utilities (100 lines)\n\nImpact: Impossible to understand at a glance; hard to find specific functionality; high cognitive load\n\nEffort: 6-8 hours","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-16T14:51:16.520465-08:00","updated_at":"2025-11-23T18:28:07.303279-08:00","closed_at":"2025-11-23T18:15:24.333304-08:00","source_repo":"."} -{"id":"bd-0a90","content_hash":"8f19f9a9e01ccf3a4dd42673a84610f2550db9a9e744806105dc3b9e070f4e46","title":"bd show --json doesn't include dependency type field","description":"Fix GitHub issue #202. The JSON output from bd show and bd list commands should include the dependency type field (and optionally created_at, created_by) to match internal storage format and enable better tooling integration.","notes":"PR #203 updated with cleaner implementation: https://github.com/steveyegge/beads/pull/203\n\n## Final Implementation\n\nCleanest possible approach - no internal helper methods needed:\n\n**Design:**\n- `GetDependenciesWithMetadata()` / `GetDependentsWithMetadata()` - canonical implementations with full SQL query\n- `GetDependencies()` / `GetDependents()` - thin wrappers that strip metadata for backward compat\n- `scanIssuesWithDependencyType()` - shared helper for scanning rows with dependency type\n\n**Benefits:**\n- Single source of truth - the `...WithMetadata()` methods ARE the implementation\n- Eliminated ~139 lines of duplicated SQL and scanning code\n- All tests passing (14 dependency-related tests)\n- Backward compatible\n- dependency_type field appears correctly in JSON output\n\n**Note on scan helpers:**\nThe duplication between `scanIssues()` and `scanIssuesWithDependencyType()` is necessary because they handle different SQL result shapes (16 vs 17 columns). This is justified as they serve fundamentally different purposes based on query structure.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-02T09:42:08.712725096Z","updated_at":"2025-11-02T11:50:54.292546-08:00","closed_at":"2025-11-02T11:50:54.292546-08:00","external_ref":"https://github.com/steveyegge/beads/issues/202","source_repo":"."} -{"id":"bd-0d9c","content_hash":"a61ba371d6c50f21a92e4debeaaa00a4c3eb77ef96fbcdfa89f80e9b13ffff7a","title":"YABB: Spurious issue updates during normal operations","description":"Issue bd-627d was updated during config refactoring session without any actual changes to it. Only timestamps and content_hash changed.\n\nObserved: Running various bd commands (list, create, etc.) caused bd-627d updated_at to change from 14:14 to 14:31.\n\nExpected: Issues should only be updated when explicitly modified.\n\nThis causes:\n- Dirty JSONL after every session\n- False conflicts in git\n- Confusing git history\n\nLikely culprit: Daemon auto-import/export cycle or database migration touching all issues.","notes":"Investigated thoroughly - unable to reproduce. The import logic has IssueDataChanged() checks before calling UpdateIssue (importer/importer.go:458). All tests pass. May have been fixed by recent refactorings. Closing as cannot reproduce - please reopen with specific repro steps if it occurs again.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-02T14:36:31.023552-08:00","updated_at":"2025-11-02T16:27:39.023535-08:00","closed_at":"2025-11-02T16:27:39.023539-08:00","source_repo":"."} -{"id":"bd-0dcea000","content_hash":"5f3eccf8635195729691e83818486c31c81e608d939e03a2241f944f645ce90d","title":"Add tests for internal/importer package","description":"Currently 0.0% coverage. Need tests for JSONL import logic including collision detection and resolution.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:21.071024-07:00","updated_at":"2025-11-08T22:42:08.859374-08:00","closed_at":"2025-11-08T18:06:20.150657-08:00","source_repo":".","dependencies":[{"issue_id":"bd-0dcea000","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-29T19:52:05.531279-07:00","created_by":"import-remap"},{"issue_id":"bd-0dcea000","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-29T19:52:05.53166-07:00","created_by":"import-remap"}]} -{"id":"bd-0do3","content_hash":"e6d85ab6360e5704e3d6792eade15bbec8d19d13b878c15e4021f3375cb3d515","title":"Test issue 0","description":"","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-07T19:00:15.156832-08:00","updated_at":"2025-11-07T22:07:17.340826-08:00","closed_at":"2025-11-07T21:55:09.425092-08:00","source_repo":"."} -{"id":"bd-0e1f2b1b","content_hash":"c0b1677fe3f4aa3f395ae4d79bff5362632d5db26477bf571c09f9177b8741ef","title":"Event-driven daemon architecture","description":"Replace 5-second polling sync loop with event-driven architecture that reacts instantly to changes. Eliminates stale data issues while reducing CPU ~60%. Key components: FileWatcher (fsnotify), Debouncer (500ms), RPC mutation events, optional git hooks. Target latency: \u003c500ms (vs 5000ms). See event_driven_daemon.md for full design.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T16:20:02.430479-07:00","updated_at":"2025-10-30T17:12:58.221424-07:00","closed_at":"2025-10-28T16:30:26.631191-07:00","source_repo":"."} -{"id":"bd-0e74","content_hash":"d8ab25b7a6ac1ba0e5012677cac3ac1320d3ca1059df97c979aab8c43ecb579d","title":"Comprehensive testing for separate branch workflow","description":"Comprehensive testing for separate branch workflow including unit tests, integration tests, and performance testing.\n\nTasks:\n- Unit tests for worktree management\n- Unit tests for config parsing\n- Integration tests: create/update/close β†’ beads branch\n- Integration test: merge beads β†’ main\n- Integration test: protected branch scenario\n- Integration test: network failure recovery\n- Integration test: config change handling\n- Manual testing guide\n- Performance testing (worktree overhead)\n\nTest scenarios: fresh setup, issue operations, merge workflow, protected branch, error handling, migration, multiple workspaces, sparse checkout\n\nEstimated effort: 4-5 days","acceptance_criteria":"- All unit tests pass\n- All integration tests pass\n- Manual testing guide works\n- No data loss in any scenario\n- Performance acceptable (\u003c 100ms overhead per commit)","notes":"Completed comprehensive test coverage. Added 4 new integration tests: config change handling, multiple concurrent clones (3-way), performance testing (avg 77ms \u003c 150ms target), and network failure recovery. All tests pass. Coverage includes fresh setup, issue ops, error handling, multiple workspaces, sparse checkout, config changes, network failures, and performance.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.580741-08:00","updated_at":"2025-11-02T21:40:35.337464-08:00","closed_at":"2025-11-02T21:40:35.337468-08:00","source_repo":".","dependencies":[{"issue_id":"bd-0e74","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:51.348226-08:00","created_by":"stevey"}]} -{"id":"bd-0fvq","content_hash":"6fb6e394efe3010fd5d9213669417e5f6376017de4187988d5a6fd0d36c80b40","title":"bd doctor should recommend bd prime migration for existing repos","description":"bd doctor should detect old beads integration patterns and recommend migrating to bd prime approach.\n\n## Current behavior\n- bd doctor checks if Claude hooks are installed globally\n- Doesn't check project-level integration (AGENTS.md, CLAUDE.md)\n- Doesn't recommend migration for repos using old patterns\n\n## Desired behavior\nbd doctor should detect and suggest:\n\n1. **Old slash command pattern detected**\n - Check for /beads:* references in AGENTS.md, CLAUDE.md\n - Suggest: These slash commands are deprecated, use bd prime hooks instead\n \n2. **No agent documentation**\n - Check if AGENTS.md or CLAUDE.md exists\n - Suggest: Run 'bd onboard' or 'bd setup claude' to document workflow\n \n3. **Old MCP-only pattern**\n - Check for instructions to use MCP tools but no bd prime hooks\n - Suggest: Add bd prime hooks for better token efficiency\n\n4. **Migration path**\n - Show: 'Run bd setup claude to add SessionStart/PreCompact hooks'\n - Show: 'Update AGENTS.md to reference bd prime instead of slash commands'\n\n## Example output\n\n⚠ Warning: Old beads integration detected in CLAUDE.md\n Found: /beads:* slash command references (deprecated)\n Recommend: Migrate to bd prime hooks for better token efficiency\n Fix: Run 'bd setup claude' and update CLAUDE.md\n\nπŸ’‘ Tip: bd prime + hooks reduces token usage by 80-99% vs slash commands\n MCP mode: ~50 tokens vs ~10.5k for full MCP scan\n CLI mode: ~1-2k tokens with automatic context recovery\n\n## Benefits\n- Helps existing repos adopt new best practices\n- Clear migration path for users\n- Better token efficiency messaging","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-12T03:20:25.567748-08:00","updated_at":"2025-11-12T03:20:25.567748-08:00","source_repo":"."} -{"id":"bd-0kz8","content_hash":"b641c9c097cdeaa44b090d632eac2f89d89a5c3579f0ea58c8b02320b0fa49f7","title":"Fix default .beads/.gitignore to ignore merge artifacts (GH #274)","description":"Updated the default .gitignore template created by `bd init` to properly ignore merge artifacts and fix overly broad patterns.\n\nChanges:\n- Added `*.db?*` pattern for database files with query strings\n- Added explicit patterns for merge artifacts: beads.{base,left,right}.{jsonl,meta.json}\n- Changed `!*.jsonl` to `!issues.jsonl` to avoid including merge artifact JSONL files\n\nThis fixes GitHub issue #274 reported by rscorer.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-09T11:23:25.595551-08:00","updated_at":"2025-11-09T11:23:28.780095-08:00","closed_at":"2025-11-09T11:23:28.780095-08:00","source_repo":"."} -{"id":"bd-0qeg","content_hash":"50f35dcc442b133e766668f3201f5e4820a66dd05cfac1c5d30595d11806f98e","title":"Fix bd doctor hash ID detection for short all-numeric hashes","description":"bd doctor incorrectly flags hash-based IDs as sequential when they are short (3-4 chars) and all-numeric (e.g., pf-158).\n\nRoot cause: isHashID() in cmd/bd/migrate_hash_ids.go:328-358 uses faulty heuristic:\n- For IDs \u003c 5 chars, only returns true if contains letters\n- But base36 hash IDs can be 3+ chars and all-numeric (MinLength: 3)\n- Example: pf-158 is valid hash ID but flagged as sequential\n\nFix: Check multiple IDs (10-20 samples) instead of single-ID pattern matching:\n- Sample IDs across database \n- Check majority pattern (sequential vs hash format)\n- Sequential: 1-4 digits (bd-1, bd-2...)\n- Hash: 3-8 chars base36 (pf-158, pf-3s9...)\n\nImpact: False positive warnings in bd doctor output","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T13:45:20.733761-08:00","updated_at":"2025-11-16T14:27:48.143485-08:00","closed_at":"2025-11-16T14:27:48.143485-08:00","source_repo":"."} -{"id":"bd-0tr0","content_hash":"6547da64cf31258350e44b07830f8fbce78f02ce20b9fbdc656fe106b9de1f5a","title":"Claude Code frequently creates issues with empty descriptions","description":"## Problem\n\nUsers report that Claude Code creates beads issues with titles but no descriptions when asked to analyze code and create issues. Discussion #366 on GitHub highlights this.\n\n## Evidence\n\nAnalysis of our own projects shows significant rates of empty descriptions:\n- ~/src/beads: 110 empty / 630 total (17.5%)\n- ~/wyvern: 8 empty / 119 total (6.7%)\n- ~/src/vc: 3 empty / 170 total (1.8%)\n\nExamples of real issues with no description:\n- bd-5qim: Optimize GetReadyWork performance\n- bd-ge7/vc-7kln: Improve test coverage (appears in multiple projects)\n- Package-specific test coverage tasks (bd-m0w, bd-4h3, bd-t3b, bd-e92)\n- Wyvern testing tasks (wy-3hx, wy-qc9, wy-66)\n\nMany date from Nov 20-21, suggesting batch creation operations.\n\n## Impact\n\n- Issues lack context for future work\n- Harder to prioritize without understanding scope\n- Need manual follow-up to add details\n- Poor workflow experience for users\n\n## Related\n\n- GitHub Discussion #366: https://github.com/steveyegge/beads/discussions/366","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-23T13:59:45.931488-08:00","updated_at":"2025-11-23T13:59:45.931488-08:00","source_repo":"."} -{"id":"bd-0vfe","content_hash":"e142bd97d91f70e50e8fea0681d8cdcffb17f17fdbd4c106d56607e243005d21","title":"Blocked issue","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:07:17.105974-08:00","updated_at":"2025-11-07T22:07:17.342098-08:00","closed_at":"2025-11-07T21:55:09.425545-08:00","source_repo":"."} -{"id":"bd-1022","content_hash":"0b712a337844711597d2dd950d27d4c032a3b746a27f44326d62db740f5944e9","title":"Use external_ref as primary matching key for import updates","description":"Enable re-syncing from external systems (Jira, GitHub, Linear) by using external_ref as the primary matching key during imports. Currently imports treat any content change as a collision, making it impossible to sync updates from external systems without creating duplicates.\n\nSee GH #142 for detailed proposal and implementation plan.\n\nKey changes needed:\n1. Add findByExternalRef() query function\n2. Update DetectCollisions() to match by external_ref first\n3. Update import_shared.go to update existing issues when external_ref matches\n4. Add index on external_ref for performance\n5. Preserve local issues (no external_ref) from being overwritten\n\nThis enables hybrid workflows: import external backlog, break down with local tasks, re-sync anytime.","notes":"## Code Review Complete βœ…\n\n**Overall Assessment**: EXCELLENT - Production ready\n\n### Implementation Quality\n- βœ“ Clean architecture with proper interface extension\n- βœ“ Dual backend support (SQLite + Memory)\n- βœ“ Smart matching priority: external_ref β†’ ID β†’ content hash\n- βœ“ O(1) lookups with database index\n- βœ“ Timestamp-based conflict resolution\n- βœ“ Comprehensive test coverage (11 test cases)\n\n### Follow-up Issues Filed\nHigh Priority (P2):\n- bd-897a: Add UNIQUE constraint on external_ref column\n- bd-7315: Add validation for duplicate external_ref in batch imports\n\nMedium Priority (P3):\n- bd-f9a1: Add index usage verification test\n- bd-3f6a: Add concurrent import race condition tests\n\nLow Priority (P4):\n- bd-e166: Improve timestamp comparison readability\n- bd-9e23: Optimize Memory backend with index\n- bd-537e: Add external_ref change tracking\n- bd-df11: Add import metrics\n- bd-9f4a: Document external_ref in content hash\n\n### Key Features\nβœ… External systems (Jira, GitHub, Linear) can re-sync without duplicates\nβœ… Hybrid workflows: import external backlog, add local tasks, re-sync anytime\nβœ… Local issues protected from being overwritten\nβœ… Timestamp checking ensures only newer updates applied\nβœ… Performance optimized with database index\n\n**Confidence Level**: 95% - Ship it! πŸš€","status":"closed","priority":0,"issue_type":"feature","created_at":"2025-11-02T14:55:56.355813-08:00","updated_at":"2025-11-02T15:34:56.634126-08:00","closed_at":"2025-11-02T15:27:44.810375-08:00","source_repo":"."} -{"id":"bd-1048","content_hash":"1a889d79a98f8c0919f99094736ee7c856c6d8a2ee062a0add49ce2c06c40174","title":"Daemon crashes silently on RPC query after startup","description":"The daemon fails to handle 'show' RPC commands when:\n1) JSONL is newer than database (needs import)\n2) git pull fails due to uncommitted changes\n\nSymptoms:\n- Daemon appears to run (ps shows process)\n- 'bd list' and other commands work fine \n- 'bd show \u003cid\u003e' returns \"failed to read response: EOF\"\n- No panic or error logged in daemon.log\n\nRoot cause likely: auto-import deadlock or state corruption when import is blocked by git conflicts.\n\nWorkaround: \n- Restart daemon after syncing git state (commit/push changes)\n- OR use --no-daemon flag for all commands\n\nThe panic recovery added in server_lifecycle_conn.go:183 didn't catch any panics, confirming this isn't a panic-based crash.","notes":"Root cause found and fixed: Two bugs - (1) nil pointer check missing in handleShow causing panic, (2) double JSON encoding in show.go ID resolution. Both fixed. bd show now works with daemon.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-02T17:05:03.658333-08:00","updated_at":"2025-11-03T12:08:12.947672-08:00","closed_at":"2025-11-03T12:08:12.947676-08:00","source_repo":"."} -{"id":"bd-11e0","content_hash":"2f0b0a8d0f918cf665e378a1c817c591fc5efc284b65034e73b58b65d58d5674","title":"Database import silently fails when daemon version != CLI version","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:08:09.096749-07:00","updated_at":"2025-11-01T19:29:35.267817-07:00","closed_at":"2025-11-01T19:29:35.267817-07:00","source_repo":"."} -{"id":"bd-1231","content_hash":"94139e31b3a3e58086ea77a916173a6f0c372a66a21925af0b9385de2f387c2f","title":"CI failing on all 3/4 test jobs despite individual tests passing","description":"CI has been broken for a day+ with mysterious test failures. Issue #173 on GitHub tracks this.\n\n## Current Status\n- **Lint job**: βœ… PASSING\n- **Test (Linux)**: ❌ FAILING (exit code 1)\n- **Test (Windows)**: ❌ FAILING (exit code 1)\n- **Test Nix Flake**: ❌ FAILING (exit code 1)\n\n## Key Observations\nAll three failing jobs show identical pattern:\n- Individual test output shows PASS for every test\n- Final result: `FAIL github.com/steveyegge/beads/cmd/bd`\n- Exit code 1 despite no visible test failures\n- Last visible test output before failure: \"No Reason Issue\" test (TestCloseCommand/close_without_reason)\n\n## Investigation So Far\n1. All tests appear to pass when examined individually\n2. Likely causes:\n - Race detector finding data races during test cleanup (`-race` flag)\n - Panic/error occurring after main tests complete\n - Test harness issue not reporting actual failure\n - Possible regression from PR #203 (dependency_type changes)\n\n## Recent CI Runs\n- Run 19015040655 (latest): 3/4 failing\n- Multiple recent commits tried to fix Windows/lint issues\n- Agent on rrnewton/beads fork attempting fixes (2/4 passing there)\n\n## Next Steps\n1. Run tests locally with `-race -v` to see full output\n2. Check for unreported test failures or panics\n3. Examine test cleanup/teardown code\n4. Review recent changes around close command tests\n5. Consider if race detector is too sensitive or catching real issues","notes":"## Progress Update\n\n### βœ… Fixed (commits 09bd4d3, 21a29bc)\n1. **Daemon auto-import** - Always recompute content_hash in importer to avoid stale hashes\n2. **TestScripts failures** - Added bd binary to PATH for shell subprocess tests\n3. **Test infrastructure** - Added .gitignore to test repos, fixed last_import_time metadata\n\n### βœ… CI Status (Run 19015638968)\n- **Test (Linux)**: βœ… SUCCESS - All tests passing\n- **Test (Windows)**: ❌ FAILURE - Pre-existing Windows test failures\n- **Test Nix Flake**: ❌ FAILURE - Build fails with same test errors\n- **Lint**: ❌ FAILURE - Pre-existing issue in migrate.go:647\n\n### ❌ Remaining Issues (not related to original bd-1231)\n\n**Windows failures:**\n- TestFindDatabasePathEnvVar\n- TestHashIDs_MultiCloneConverge \n- TestHashIDs_IdenticalContentDedup\n- TestDatabaseReinitialization (5 subtests)\n- TestFindBeadsDir_NotFound\n- TestMetricsSnapshot/uptime\n\n**Lint failure:**\n- cmd/bd/migrate.go:647:37: cleanupWALFiles - result 0 (error) is always nil (unparam)\n\n**Nix failure:**\n- Build fails during test phase with same test errors\n\n### Next Steps\n1. Investigate Windows-specific test failures\n2. Fix linting issue in migrate.go\n3. Debug Nix build test failures","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-02T08:42:16.142128-08:00","updated_at":"2025-11-02T12:32:00.15834-08:00","closed_at":"2025-11-02T12:32:00.158346-08:00","external_ref":"https://github.com/steveyegge/beads/issues/173","source_repo":"."} -{"id":"bd-12c2","content_hash":"77aa473abba394b850dfbaf1b5c4841aae3523238b21a82038ec0e8b39283677","title":"Add comprehensive tests for show.go commands (show, update, edit, close)","description":"Need to add tests for cmd/bd/show.go which contains show, update, edit, and close commands.\n\n**Challenge**: The existing test patterns use rootCmd.SetArgs() and rootCmd.Execute(), but the global `store` variable needs to match what the commands use. Initial attempt created tests that failed with \"no issue found\" because the test's store instance wasn't the same as the command's store.\n\n**Files to test**:\n- show.go (contains showCmd, updateCmd, editCmd, closeCmd)\n\n**Coverage needed**:\n- show command (single issue, multiple issues, JSON output, with dependencies, with labels, with compaction)\n- update command (status, priority, title, assignee, description, multiple fields, multiple issues)\n- edit command (requires $EDITOR, may need mocking)\n- close command (single issue, multiple issues, with reason, JSON output)\n\n**Test approach**:\n1. Study working test patterns in init_test.go, list_test.go, etc.\n2. Ensure BEADS_NO_DAEMON=1 is set\n3. Properly initialize database with bd init\n4. Use the command's global store, not a separate instance\n5. May need to reset global state between tests\n\n**Success criteria**: \n- All test functions pass\n- Coverage for show.go increases significantly\n- Tests follow existing patterns in cmd/bd/*_test.go","status":"closed","priority":0,"issue_type":"task","created_at":"2025-10-31T20:08:40.545173-07:00","updated_at":"2025-10-31T20:19:22.411066-07:00","closed_at":"2025-10-31T20:19:22.411066-07:00","source_repo":"."} -{"id":"bd-1445","content_hash":"b3272105f48a2b0f11d2cf669d3e7e5c93a5e6c491cbabddf16872966618de0a","title":"Create shared insert/event/dirty helpers","description":"Create issues.go (insertIssue/insertIssues), events.go (recordCreatedEvent/recordCreatedEvents), dirty.go (markDirty/markDirtyBatch). Refactor single and bulk create paths to use these.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.882142-07:00","updated_at":"2025-11-02T15:28:11.99706-08:00","closed_at":"2025-11-02T15:28:11.997063-08:00","source_repo":"."} -{"id":"bd-149","content_hash":"4865a0eaf982fedd744f824f990037f40763be2a133e4c3bb4e28971f8372428","title":"Auth tokens expire too quickly","description":"## Summary\n\n[Brief description of the bug]\n\n## Steps to Reproduce\n\n1. Step 1\n2. Step 2\n3. Step 3\n\n## Expected Behavior\n\n[What should happen]\n\n## Actual Behavior\n\n[What actually happens]\n\n## Environment\n\n- OS: [e.g., macOS 15.7.1]\n- Version: [e.g., bd 0.20.1]\n- Additional context: [any relevant details]\n\n## Additional Context\n\n[Screenshots, logs, or other relevant information]\n","design":"## Root Cause Analysis\n\n[Describe the underlying cause once identified]\n\n## Proposed Fix\n\n[Outline the solution approach]\n\n## Impact Assessment\n\n- Affected features: [list]\n- Breaking changes: [yes/no and details]\n- Migration needed: [yes/no and details]\n","acceptance_criteria":"- [ ] Bug no longer reproduces with original steps\n- [ ] Regression tests added\n- [ ] Related edge cases tested\n- [ ] Documentation updated if behavior changed\n","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-03T19:54:10.671488-08:00","updated_at":"2025-11-05T00:25:06.427601-08:00","closed_at":"2025-11-05T00:25:06.427601-08:00","source_repo":".","labels":["bug"]} -{"id":"bd-164b","content_hash":"5cddac4d59502d1a6b3999f2dd85e1719389c8f9ea15f3515a62d52049d03645","title":"Add template support for issue creation","description":"Support creating issues from predefined templates to streamline common workflows like epics, bug reports, or feature proposals.\n\nExample usage:\n bd create --from-template epic \"Phase 3 Features\"\n bd create --from-template bug \"Login failure\"\n bd template list\n bd template create epic\n\nTemplates should include:\n- Pre-filled description structure\n- Suggested priority and type\n- Common labels\n- Design/acceptance criteria sections\n\nImplementation notes:\n- Store templates in .beads/templates/ directory\n- Support YAML or JSON format\n- Ship with built-in templates (epic, bug, feature)\n- Allow custom project-specific templates","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-03T18:10:18.985902-08:00","updated_at":"2025-11-03T19:56:41.287303-08:00","closed_at":"2025-11-03T19:56:41.287303-08:00","source_repo":"."} -{"id":"bd-17d5","content_hash":"a0e9affb9666bb33ffb26aa9aab151a80b94b37578667aa439bbcccd842243ef","title":"bd sync false positive: conflict detection triggers on JSON-encoded angle brackets in issue content","description":"The bd sync --import-only command incorrectly detects conflict markers when issue descriptions contain the text '\u003c\u003c\u003c\u003c\u003c\u003c\u003c' or '\u003e\u003e\u003e\u003e\u003e\u003e\u003e' as legitimate content (e.g., documentation about git conflict markers).\n\n**Reproduction:**\n1. Create issue with design field containing: 'Read file, extract \u003c\u003c\u003c\u003c\u003c\u003c\u003c / ======= / \u003e\u003e\u003e\u003e\u003e\u003e\u003e markers'\n2. Export to JSONL (gets JSON-encoded as \\u003c\\u003c\\u003c...)\n3. Commit and push\n4. Pull from remote\n5. bd sync --import-only fails with: 'Git conflict markers detected in JSONL file'\n\n**Root cause:**\nThe conflict detection appears to decode JSON before checking for conflict markers, causing false positives when issue content legitimately contains these strings.\n\n**Expected behavior:**\nConflict detection should only trigger on actual git conflict markers (literal '\u003c\u003c\u003c\u003c\u003c\u003c\u003c' bytes in the raw file), not on JSON-encoded content within issue fields.\n\n**Test case:**\nVC project at ~/src/dave/vc has vc-85 'JSONL Conflict Parser' which documents conflict parsing and triggers this bug.\n\n**Suggested fixes:**\n1. Only scan for literal '\u003c\u003c\u003c\u003c\u003c\u003c\u003c' bytes (not decoded JSON content)\n2. Parse JSONL first and only flag unparseable lines\n3. Check git merge state (git status) to confirm actual conflict\n4. Add --skip-conflict-check flag for override","acceptance_criteria":"- bd sync works with vc-85 issue in VC project\n- Conflict detection only triggers on actual git conflict markers\n- False positives eliminated for legitimate issue content\n- Regression test added with conflict marker text in issue description","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T13:02:54.730745-08:00","updated_at":"2025-11-08T13:07:37.108225-08:00","closed_at":"2025-11-08T13:07:37.108225-08:00","source_repo":"."} -{"id":"bd-17fa2d21","content_hash":"b909e616bec8d75eaf6ab0c2deb90ad047740d44892194afeaa5deb07f15f43a","title":"Batch test 2","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:01.877052-07:00","updated_at":"2025-10-31T12:00:43.183657-07:00","closed_at":"2025-10-31T12:00:43.183657-07:00","source_repo":"."} -{"id":"bd-1863608e","content_hash":"beec1c2a11e22fcdfb13b4436918e820038c76f6d873d59be616b415148e741e","title":"Add TestNWayCollision for 5+ clones","description":"## Overview\nAdd comprehensive tests for N-way (5+) collision resolution to verify the solution scales beyond 3 clones.\n\n## Purpose\nWhile TestThreeCloneCollision validates the basic N-way case, we need to verify:\n1. Solution scales to arbitrary N\n2. Performance is acceptable with more clones\n3. Convergence time is bounded\n4. No edge cases in larger collision groups\n\n## Implementation Tasks\n\n### 1. Create TestFiveCloneCollision\nFile: beads_twoclone_test.go (or new beads_nway_test.go)\n\n```go\nfunc TestFiveCloneCollision(t *testing.T) {\n // Test with 5 clones creating same ID with different content\n // Verify all 5 clones converge after sync rounds\n \n t.Run(\"SequentialSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"A\", \"B\", \"C\", \"D\", \"E\")\n })\n \n t.Run(\"ReverseSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"E\", \"D\", \"C\", \"B\", \"A\")\n })\n \n t.Run(\"RandomSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"C\", \"A\", \"E\", \"B\", \"D\")\n })\n}\n```\n\n### 2. Implement generalized testNCloneCollision\nGeneralize the 3-clone test to handle arbitrary N:\n\n```go\nfunc testNCloneCollision(t *testing.T, numClones int, syncOrder ...string) {\n t.Helper()\n \n if len(syncOrder) != numClones {\n t.Fatalf(\"syncOrder length (%d) must match numClones (%d)\", \n len(syncOrder), numClones)\n }\n \n tmpDir := t.TempDir()\n \n // Setup remote and N clones\n remoteDir := setupBareRepo(t, tmpDir)\n cloneDirs := make(map[string]string)\n \n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n cloneDirs[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates issue with same ID but different content\n for name, dir := range cloneDirs {\n createIssue(t, dir, fmt.Sprintf(\"Issue from clone %s\", name))\n }\n \n // Sync in specified order\n for _, name := range syncOrder {\n syncClone(t, cloneDirs[name], name)\n }\n \n // Final pull for convergence\n for name, dir := range cloneDirs {\n finalPull(t, dir, name)\n }\n \n // Verify all clones have all N issues\n expectedTitles := make(map[string]bool)\n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n expectedTitles[fmt.Sprintf(\"Issue from clone %s\", name)] = true\n }\n \n for name, dir := range cloneDirs {\n titles := getTitles(t, dir)\n if !compareTitleSets(titles, expectedTitles) {\n t.Errorf(\"Clone %s missing issues: expected %v, got %v\", \n name, expectedTitles, titles)\n }\n }\n \n t.Log(\"βœ“ All\", numClones, \"clones converged successfully\")\n}\n```\n\n### 3. Add performance benchmarks\nTest convergence time and memory usage:\n\n```go\nfunc BenchmarkNWayCollision(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n // Run N-way collision and measure time\n testNCloneCollisionBench(b, n)\n }\n })\n }\n}\n```\n\n### 4. Add convergence time tests\nVerify bounded convergence:\n\n```go\nfunc TestConvergenceTime(t *testing.T) {\n // Test that convergence happens within expected rounds\n // For N clones, should converge in at most N-1 sync rounds\n \n for n := 3; n \u003c= 10; n++ {\n t.Run(fmt.Sprintf(\"N=%d\", n), func(t *testing.T) {\n rounds := measureConvergenceRounds(t, n)\n maxExpected := n - 1\n if rounds \u003e maxExpected {\n t.Errorf(\"Convergence took %d rounds, expected ≀ %d\", \n rounds, maxExpected)\n }\n })\n }\n}\n```\n\n### 5. Add edge case tests\nTest boundary conditions:\n- All N clones have identical content (dedup works)\n- N-1 clones have same content, 1 differs\n- All N clones have unique content\n- Mix of collisions and non-collisions\n\n## Acceptance Criteria\n- TestFiveCloneCollision passes with all sync orders\n- All 5 clones converge to identical content\n- Performance is acceptable (\u003c 5 seconds for 5 clones)\n- Convergence time is bounded (≀ N-1 rounds)\n- Edge cases handled correctly\n- Benchmarks show scalability to 10+ clones\n\n## Files to Create/Modify\n- beads_twoclone_test.go or beads_nway_test.go\n- Add helper functions for N-clone setup\n\n## Testing Strategy\n\n### Test Matrix\n| N Clones | Sync Orders | Expected Result |\n|----------|-------------|-----------------|\n| 3 | Aβ†’Bβ†’C | Pass |\n| 3 | Cβ†’Bβ†’A | Pass |\n| 5 | Aβ†’Bβ†’Cβ†’Dβ†’E | Pass |\n| 5 | Eβ†’Dβ†’Cβ†’Bβ†’A | Pass |\n| 5 | Random | Pass |\n| 10 | Sequential | Pass |\n\n### Performance Targets\n- 3 clones: \u003c 2 seconds\n- 5 clones: \u003c 5 seconds\n- 10 clones: \u003c 15 seconds\n\n## Dependencies\n- Requires bd-cbed9619.5, bd-cbed9619.4, bd-0dcea000, bd-4d7fca8a to be completed\n- TestThreeCloneCollision must pass first\n\n## Success Metrics\n- All tests pass for N ∈ {3, 5, 10}\n- Convergence time scales linearly (O(N))\n- Memory usage reasonable (\u003c 100MB for 10 clones)\n- No data corruption or loss in any scenario","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T20:02:47.954306-07:00","updated_at":"2025-10-30T17:12:58.182217-07:00","closed_at":"2025-10-28T20:47:28.317007-07:00","source_repo":"."} -{"id":"bd-197b","content_hash":"0077ab3305b0c5a4b8cc600b1a2f4f30b64a289e4674c3b90110ac537c3f8224","title":"Set up WASM build pipeline","description":"Configure Goβ†’WASM compilation pipeline. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Create build-wasm.sh script (GOOS=js GOARCH=wasm)\n- [ ] Test basic WASM module loading in Node.js\n- [ ] Set up wasm_exec.js wrapper\n- [ ] Add WASM build to CI/CD\n- [ ] Document build process\n\n## Validation\n- bd.wasm compiles successfully\n- Can load in Node.js without errors\n- Bundle size \u003c10MB","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-02T18:33:19.407373-08:00","updated_at":"2025-11-05T00:55:48.755936-08:00","closed_at":"2025-11-05T00:55:48.755941-08:00","source_repo":".","dependencies":[{"issue_id":"bd-197b","depends_on_id":"bd-44d0","type":"blocks","created_at":"2025-11-02T18:33:19.407904-08:00","created_by":"daemon"}]} -{"id":"bd-19er","content_hash":"1c5d51dd38f04db00b26c19f47fc7624ff878d554dea59816467ca97eb234970","title":"Create backup and restore procedures","description":"Disaster recovery procedures for Agent Mail data.\n\nAcceptance Criteria:\n- Automated daily snapshots (GCP persistent disk)\n- SQLite backup script\n- Git repository backup\n- Restore procedure documentation\n- Test restore from backup\n\nFile: deployment/agent-mail/backup.sh","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.417403-08:00","updated_at":"2025-11-07T22:43:43.417403-08:00","source_repo":".","dependencies":[{"issue_id":"bd-19er","depends_on_id":"bd-z3s3","type":"blocks","created_at":"2025-11-07T23:04:28.122501-08:00","created_by":"daemon"}]} -{"id":"bd-1a6j","content_hash":"16f978c58b9988457aeb1eaff37fb17f12e91325549b38be10362a08923e9a2d","title":"Test issue 2","description":"","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-07T19:07:12.24632-08:00","updated_at":"2025-11-07T19:07:12.24632-08:00","source_repo":"."} -{"id":"bd-1b0a","content_hash":"57d0a0ca69b2c95554ed7afa95c366187f0a9b53beebe2391b7aa49a3436f470","title":"Add transaction helper to replace manual COMMIT/ROLLBACK","description":"Create tx.go with withTx helper that handles transaction lifecycle. Replace manual transaction blocks in create/insert/update paths.","notes":"Refactoring complete:\n- Created withTx() helper in util.go\n- Added ExecInTransaction() as deprecated wrapper for backward compatibility\n- Refactored all manual transaction blocks to use withTx():\n - events.go: AddComment\n - dirty.go: MarkIssuesDirty, ClearDirtyIssuesByID\n - labels.go: executeLabelOperation\n - dependencies.go: AddDependency, RemoveDependency\n - compact.go: ApplyCompaction\n- All tests pass successfully","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.823323-07:00","updated_at":"2025-11-02T12:41:45.827688-08:00","closed_at":"2025-11-02T12:41:45.827688-08:00","source_repo":"."} -{"id":"bd-1c63eb84","content_hash":"ffb879c48e5d99f98d0cf6efcb0e7c6940820e8936eabea009c8d365af5f9524","title":"Investigate jujutsu integration for beads","description":"Research and document how beads could integrate with jujutsu (jj), the next-generation VCS. Key areas to explore:\n- How jj's operation model differs from git (immutable operations, working-copy-as-commit)\n- JSONL sync strategy with jj's conflict resolution model\n- Daemon compatibility with jj's more frequent rewrites\n- Whether auto-import/export needs changes for jj workflows\n- Example configurations and documentation updates needed","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-23T09:23:23.582009-07:00","updated_at":"2025-11-05T14:30:10.416881-08:00","closed_at":"2025-11-05T14:26:17.967073-08:00","source_repo":"."} -{"id":"bd-1c77","content_hash":"49c554748a8f61dc99eb6a942c620f5856f4c0d240678022f6ae998a102d591e","title":"Implement filesystem shims for WASM","description":"WASM needs JS shims for filesystem access. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Implement file read/write shims\n- [ ] Map WASM syscalls to Node.js fs API\n- [ ] Handle .beads/ directory discovery\n- [ ] Test with real JSONL files\n- [ ] Support both absolute and relative paths\n\n## Technical Notes\n- Use Node.js fs module via syscall/js\n- Consider MEMFS for in-memory option","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-02T18:33:31.280464-08:00","updated_at":"2025-11-05T00:55:48.756428-08:00","closed_at":"2025-11-05T00:55:48.756432-08:00","source_repo":".","dependencies":[{"issue_id":"bd-1c77","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.281134-08:00","created_by":"daemon"}]} -{"id":"bd-1ece","content_hash":"95ec39ad0bf8c9514bc500b929a5996d026936b0fc037e19a99d2234e5315770","title":"Remove obsolete renumber.go command (hash IDs eliminated need)","description":"","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-10-31T21:27:05.559328-07:00","updated_at":"2025-10-31T21:27:11.426941-07:00","closed_at":"2025-10-31T21:27:11.426941-07:00","source_repo":"."} -{"id":"bd-1ezg","content_hash":"bc60ecbe5855255eeec9202147a6331607e98f19bcfab6c033d34dc9ccbace09","title":"Investigate bd export/import sync issue - database and JSONL out of sync","description":"Observed in VC repo: database has 1137 issues but beads.jsonl only has 309. Running 'bd export -o .beads/issues.jsonl' doesn't update the file. Running 'bd import' hangs indefinitely.\n\nReproduction context:\n- VC repo: 1137 issues in DB, 309 in JSONL\n- Created 4 new issues with bd create\n- bd export didn't write them to JSONL\n- bd import hung (possibly daemon lock conflict?)\n\nNeed to investigate:\n1. Why export doesn't update JSONL when DB has more issues\n2. Why import hangs\n3. Daemon lock interaction with export/import\n4. File path handling (issues.jsonl vs beads.jsonl)","design":"Check export logic for silent failures, file locking, path resolution. Check import for blocking operations, daemon conflicts.","acceptance_criteria":"- Root cause of export not updating JSONL identified\n- Root cause of import hanging identified \n- Fix implemented and verified\n- Test coverage for sync scenarios\n- Documentation updated if needed","notes":"## Root Cause Analysis\n\nThe issue was NOT about file path handling or export failing to update JSONL. The actual problem was:\n\n**Import/Export hanging when daemon is running** due to SQLite lock contention:\n\n1. When daemon is connected, `PersistentPreRun` in main.go returns early without initializing the `store` variable\n2. Import/Export commands then tried to open the database directly with `sqlite.New(dbPath)` \n3. This blocked waiting for the database lock that the daemon already holds β†’ **HANGS INDEFINITELY**\n\n## Solution Implemented\n\nModified both import.go and export.go to:\n1. Detect when `daemonClient` is connected\n2. Explicitly close the daemon connection before opening direct SQLite access\n3. Added debug logging to help diagnose similar issues\n\nThis ensures import/export commands always run in direct mode, avoiding lock contention.\n\n## File Path Handling\n\nThe file path confusion (issues.jsonl vs beads.jsonl) was a red herring. The code uses `filepath.Glob(\"*.jsonl\")` which correctly finds ANY `.jsonl` file in `.beads/` directory, so both filenames work.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T19:00:55.78797-08:00","updated_at":"2025-11-06T19:07:15.077983-08:00","closed_at":"2025-11-06T19:07:15.077983-08:00","source_repo":"."} -{"id":"bd-1f28","content_hash":"850a14659d6747dc114b7da94e55c3f9594995cabc31c3c85e3089fbd5f61712","title":"Extract migration functions to migrations.go","description":"Move migrateDirtyIssuesTable, migrateExternalRefColumn, migrateCompositeIndexes, migrateClosedAtConstraint, migrateCompactionColumns, migrateSnapshotsTable, migrateCompactionConfig, migrateCompactedAtCommitColumn, migrateExportHashesTable, migrateContentHashColumn to a separate migrations.go file","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.892045-07:00","updated_at":"2025-11-01T20:00:09.038174-07:00","closed_at":"2025-11-01T20:00:09.038178-07:00","source_repo":"."} -{"id":"bd-1f4086c5","content_hash":"5dcfbb24a97a6277ca177bf136cf37741dbf54f798ca7e82eca631ea1b0129a1","title":"Event-driven daemon architecture","description":"Replace 5-second polling sync loop with event-driven architecture that reacts instantly to changes. Eliminates stale data issues while reducing CPU ~60%. Key components: FileWatcher (fsnotify), Debouncer (500ms), RPC mutation events, optional git hooks. Target latency: \u003c500ms (vs 5000ms). See event_driven_daemon.md for full design.","notes":"Production-ready after 3 critical fixes (commit 349b892):\n- Skip redundant imports (mtime check prevents self-trigger loops)\n- Add server.Stop() in serverErrChan case (clean shutdown)\n- Fallback ticker (60s) when watcher unavailable (ensures remote sync)\n\nReady to make default after integration test (bd-1f4086c5.1) passes.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-29T23:05:13.969484-07:00","updated_at":"2025-10-31T20:21:25.464736-07:00","closed_at":"2025-10-31T20:21:25.464736-07:00","source_repo":"."} -{"id":"bd-1f4086c5.1","content_hash":"ba5173c61613a29786641ba06a93427de87bed65ce39dbc3c3ddd2b6900f827e","title":"Integration test: mutation to export latency","description":"Measure time from bd create to JSONL update. Verify \u003c500ms latency. Test with multiple rapid mutations to verify batching.","notes":"Test added to daemon_test.go as TestMutationToExportLatency().\n\nCurrently skipped with note that it should be enabled once bd-146 (event-driven daemon) is fully implemented and enabled by default.\n\nThe test structure is complete:\n1. Sets up test environment with fast debounce (500ms)\n2. SingleMutationLatency: measures latency from mutation to JSONL update\n3. RapidMutationBatching: verifies multiple mutations batch into single export\n\nOnce event-driven mode is default, remove the t.Skip() line and the test will validate \u003c500ms latency.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.103759-07:00","updated_at":"2025-10-30T17:12:58.195867-07:00","closed_at":"2025-10-29T14:19:19.808139-07:00","source_repo":".","dependencies":[{"issue_id":"bd-1f4086c5.1","depends_on_id":"bd-1f4086c5","type":"parent-child","created_at":"2025-10-29T20:49:49.107244-07:00","created_by":"import-remap"}]} -{"id":"bd-1f64","content_hash":"80f404d7c0f06c7f4bc6d52ac02c1a002a95ac7cb60c6485b2ceed5e013dad75","title":"Add comprehensive tests for config.yaml issue-prefix migration","description":"The GH #209 config.yaml migration lacks test coverage:\n\nMissing tests:\n- config.SetIssuePrefix() edge cases (empty file, comments, malformed YAML)\n- config.GetIssuePrefix() with various config states\n- MigrateConfigToYAML() automatic migration logic\n- bd init writing to config.yaml instead of DB\n- bd migrate DBβ†’config.yaml migration path\n\nTest scenarios needed:\n1. SetIssuePrefix with empty config.yaml\n2. SetIssuePrefix with existing config.yaml (preserves other settings)\n3. SetIssuePrefix with commented issue-prefix line\n4. SetIssuePrefix atomic write (temp file cleanup)\n5. GetIssuePrefix fallback behavior\n6. MigrateConfigToYAML when config.yaml missing prefix but DB has it\n7. MigrateConfigToYAML when both missing (detect from issues)\n8. MigrateConfigToYAML when config.yaml already has prefix (no-op)\n9. Integration test: fresh bd init writes to config.yaml only\n10. Integration test: upgrade from v0.21 DB migrates to config.yaml\n\nPriority 1 because this is a user-facing migration affecting all users upgrading to v0.22.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-03T22:33:43.08753-08:00","updated_at":"2025-11-03T22:46:16.306565-08:00","closed_at":"2025-11-03T22:46:16.306565-08:00","source_repo":"."} -{"id":"bd-1fkr","content_hash":"ad8fd9d0254ef9f4ff430253234569af0a606b5d813ee98995dc5a6a2cbf897b","title":"bd-hv01: Storage backend extensibility broken by type assertion","description":"Problem: deletion_tracking.go:69-82 uses type assertion for DeleteIssue which breaks if someone adds a new storage backend.\n\nFix: Check capability before starting merge or add DeleteIssue to Storage interface.\n\nFiles: cmd/bd/deletion_tracking.go:69-82, internal/storage/storage.go","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T18:16:20.770662-08:00","updated_at":"2025-11-06T18:55:08.666253-08:00","closed_at":"2025-11-06T18:55:08.666253-08:00","source_repo":".","dependencies":[{"issue_id":"bd-1fkr","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.925961-08:00","created_by":"daemon"}]} -{"id":"bd-1h8","content_hash":"9c7421a5fa7f7bba3811bb45c5a2dcab78d0b156734ec2dada60b3bd4693fc7e","title":"Fix compact --analyze/--apply error messages to clarify direct mode requirement","description":"**Problem:**\nWhen users run `bd compact --analyze` with daemon running, they get:\n```\nError: compact requires SQLite storage\n```\n\nThis is misleading because they ARE using SQLite (via daemon), but the command needs DIRECT SQLite access.\n\n**Current behavior:**\n- Error message suggests they don't have SQLite\n- No hint about using --no-daemon flag\n- Related to issue #349 item #1\n\n**Proposed fix:**\n1. Update error messages in cmd/bd/compact.go lines 106-114 (analyze) and 121-137 (apply)\n2. Add explicit hint: \"Use --no-daemon flag to bypass daemon\"\n3. Change SQLite check error from \"requires SQLite storage\" to \"failed to open database in direct mode\"\n\n**Files to modify:**\n- cmd/bd/compact.go (lines ~106-137)\n\n**Testing:**\n- Run with daemon: `bd compact --analyze` should show clear error + hint\n- Run with --no-daemon: `bd compact --analyze --no-daemon` should work\n- Verify error message is actionable","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T20:47:45.606924-05:00","updated_at":"2025-11-23T14:14:13.329268-08:00","closed_at":"2025-11-20T20:59:13.406952-05:00","source_repo":".","labels":["bug","documentation","ux"],"comments":[{"id":16,"issue_id":"bd-1h8","author":"stevey","text":"Addresses GitHub issue #349 item 1: https://github.com/steveyegge/beads/issues/349\n\nUser reported misleading error when running 'bd compact --analyze' with daemon active. Error says 'requires SQLite storage' but user IS using SQLite via daemon - the real issue is that --analyze mode needs DIRECT database access.","created_at":"2025-11-21T02:23:27Z"}]} -{"id":"bd-1ls","content_hash":"af79708476d560abaac3cbe9c537bcf43c2100dcb1d676954ea604486f75d199","title":"Override test","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","design":"## Architecture\n\n[Describe the overall architecture and approach]\n\n## Components\n\n- Component 1: [description]\n- Component 2: [description]\n\n## Dependencies\n\n[List external dependencies or constraints]\n","acceptance_criteria":"- [ ] All child issues are completed\n- [ ] Integration tests pass\n- [ ] Documentation is updated\n- [ ] Code review completed\n","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-03T20:15:10.01471-08:00","updated_at":"2025-11-03T22:07:10.946574-08:00","closed_at":"2025-11-03T22:07:10.946574-08:00","source_repo":".","labels":["epic"]} -{"id":"bd-1mzt","content_hash":"3dffe5c0934f51c6fa526a952a975e808665d80e7c69dffbe910aabc87d32a7b","title":"Client self-heal: remove stale pid when lock free + socket missing","description":"When client detects:\n- Socket is missing AND\n- tryDaemonLock shows lock NOT held\n\nThen automatically:\n1. Remove stale daemon.pid file\n2. Optionally auto-start daemon (behind BEADS_AUTO_START_DAEMON=1 env var)\n\nThis prevents stale artifacts from accumulating after daemon crashes.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T16:42:12.75205-08:00","updated_at":"2025-11-07T22:07:17.342845-08:00","closed_at":"2025-11-07T21:21:15.317562-08:00","source_repo":".","dependencies":[{"issue_id":"bd-1mzt","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.753099-08:00","created_by":"daemon"}]} -{"id":"bd-1pj6","content_hash":"de1c1195b29d9a70c88b5f2b05ca1c3497469d1802f9c0be415d5a44b0575deb","title":"Proposal: Custom status states via config","description":"Proposal to add 'custom status states' via `bd config`.\nUsers could define an optional issue status enum (e.g., awaiting_review, review_in_progress) in the config.\nThis would enable multi-step pipelines to process issues where each step correlates to a specific status.\n\nExamples:\n- awaiting_verification\n- awaiting_docs\n- awaiting_testing\n","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-20T18:55:48.670499-05:00","updated_at":"2025-11-20T18:55:48.670499-05:00","source_repo":"."} -{"id":"bd-1rh","content_hash":"dfbc923370ab7d055d53c4ba9a336892e65567a6de4a8a94a50be06e47ec30a5","title":"cmd/bd test suite is absurdly slow - 279 tests taking 8+ minutes","description":"# Problem\n\nThe cmd/bd test suite is painfully slow:\n- **279 tests** in cmd/bd alone\n- Full suite takes **8+ minutes** to run\n- Even with the 16 slowest integration tests now tagged with `integration` build tag, the remaining tests still take forever\n\nThis makes the development loop unusable. We can't wait 8+ minutes every time we want to run tests.\n\n# Root Cause Analysis\n\n## 1. Sheer Volume\n279 tests is too many for a single package. Even at 0.1s per test, that's 28 seconds minimum just for cmd/bd.\n\n## 2. Each Test Creates Full Database + Temp Directories\nEvery test does heavy setup:\n- Creates temp directory (`t.TempDir()` or `os.MkdirTemp`)\n- Initializes SQLite database\n- Sets up git repo in many cases\n- Creates full storage layer\n\nExample from the tests:\n```go\nfunc setupCLITestDB(t *testing.T) string {\n tmpDir := createTempDirWithCleanup(t)\n runBDInProcess(t, tmpDir, \"init\", \"--prefix\", \"test\", \"--quiet\")\n return tmpDir\n}\n```\n\nThis happens 279 times!\n\n## 3. Tests Are Not Properly Categorized\nWe have three types of tests mixed together:\n- **Unit tests** - should be fast, test single functions\n- **Integration tests** - test full workflows, need DB/git\n- **End-to-end tests** - test entire CLI commands\n\nThey're all lumped together in cmd/bd, all running every time.\n\n# What We've Already Fixed\n\nAdded `integration` build tags to 16 obviously-slow test files:\n- import_profile_test.go (performance benchmarking tests)\n- export_mtime_test.go (tests with time.Sleep calls)\n- cli_fast_test.go (full CLI integration tests)\n- delete_test.go, import_uncommitted_test.go, sync_local_only_test.go (git integration)\n- And 10 more in internal/ packages\n\nThese are now excluded from the default `go test ./...` run.\n\n# Proposed Solutions\n\n## Option 1: Shared Test Fixtures (Quick Win)\nCreate a shared test database that multiple tests can use:\n```go\nvar testDB *sqlite.SQLiteStorage\nvar testDBOnce sync.Once\n\nfunc getSharedTestDB(t *testing.T) storage.Storage {\n testDBOnce.Do(func() {\n // Create one DB for all tests\n })\n return testDB\n}\n```\n\n**Pros**: Easy to implement, immediate speedup\n**Cons**: Tests become less isolated, harder to debug failures\n\n## Option 2: Table-Driven Tests (Medium Win)\nCollapse similar tests into table-driven tests:\n```go\nfunc TestCreate(t *testing.T) {\n tests := []struct{\n name string\n args []string\n want string\n }{\n {\"basic issue\", []string{\"create\", \"Test\"}, \"created\"},\n {\"with description\", []string{\"create\", \"Test\", \"-d\", \"desc\"}, \"created\"},\n // ... 50 more cases\n }\n \n db := setupOnce(t) // Setup once, not 50 times\n for _, tt := range tests {\n t.Run(tt.name, func(t *testing.T) {\n // test using shared db\n })\n }\n}\n```\n\n**Pros**: Dramatically reduces setup overhead, tests run in parallel\n**Cons**: Requires refactoring, tests share more state\n\n## Option 3: Split cmd/bd Tests Into Packages (Big Win)\nMove tests into focused packages:\n- `cmd/bd/internal/clitests` - CLI integration tests (mark with integration tag)\n- `cmd/bd/internal/unittests` - Fast unit tests\n- Keep only essential tests in cmd/bd\n\n**Pros**: Clean separation, easy to run just fast tests\n**Cons**: Requires significant refactoring\n\n## Option 4: Parallel Execution (Quick Win)\nAdd `t.Parallel()` to independent tests:\n```go\nfunc TestSomething(t *testing.T) {\n t.Parallel() // Run this test concurrently with others\n // ...\n}\n```\n\n**Pros**: Easy to add, can cut time in half on multi-core machines\n**Cons**: Doesn't reduce actual test work, just parallelizes it\n\n## Option 5: In-Memory Databases (Medium Win)\nUse `:memory:` SQLite databases instead of file-based:\n```go\nstore, err := sqlite.New(ctx, \":memory:\")\n```\n\n**Pros**: Faster than disk I/O, easier cleanup\n**Cons**: Some tests need actual file-based DBs (export/import tests)\n\n# Recommended Approach\n\n**Short-term (this week)**:\n1. Add `t.Parallel()` to all independent tests in cmd/bd\n2. Use `:memory:` databases where possible\n3. Create table-driven tests for similar test cases\n\n**Medium-term (next sprint)**:\n4. Split cmd/bd tests into focused packages\n5. Mark more integration tests appropriately\n\n**Long-term (backlog)**:\n6. Consider shared test fixtures with proper isolation\n\n# Current Status\n\nWe've tagged 16 files with `integration` build tag, but the remaining 279 tests in cmd/bd still take 8+ minutes. This issue tracks fixing the cmd/bd test performance specifically.\n\n# Target\n\nGet `go test ./...` (without `-short` or `-tags=integration`) down to **under 30 seconds**.\n\n\n# THE REAL ROOT CAUSE (Updated Analysis)\n\nAfter examining the actual test code, the problem is clear:\n\n## Every Test Creates Its Own Database From Scratch\n\nLook at `create_test.go`:\n```go\nfunc TestCreate_BasicIssue(t *testing.T) {\n tmpDir := t.TempDir() // ← Creates temp dir\n testDB := filepath.Join(tmpDir, \".beads\", \"beads.db\")\n s := newTestStore(t, testDB) // ← Opens NEW SQLite connection\n // ← Runs migrations\n // ← Sets config\n // ... actual test (3 lines)\n}\n\nfunc TestCreate_WithDescription(t *testing.T) {\n tmpDir := t.TempDir() // ← Creates ANOTHER temp dir\n testDB := filepath.Join(tmpDir, \".beads\", \"beads.db\")\n s := newTestStore(t, testDB) // ← Opens ANOTHER SQLite connection\n // ... actual test (3 lines)\n}\n```\n\n**This happens 279 times!**\n\n## These Tests Don't Need Isolation!\n\nMost tests are just checking:\n- \"Can I create an issue with a title?\"\n- \"Can I create an issue with a description?\"\n- \"Can I add labels?\"\n\nThey don't conflict with each other. They could all share ONE database!\n\n## The Fix: Test Suites with Shared Setup\n\nInstead of:\n```go\nfunc TestCreate_BasicIssue(t *testing.T) {\n s := newTestStore(t, t.TempDir()+\"/db\") // ← Expensive!\n // test\n}\n\nfunc TestCreate_WithDesc(t *testing.T) {\n s := newTestStore(t, t.TempDir()+\"/db\") // ← Expensive!\n // test\n}\n```\n\nDo this:\n```go\nfunc TestCreate(t *testing.T) {\n // ONE setup for all subtests\n s := newTestStore(t, t.TempDir()+\"/db\")\n \n t.Run(\"basic_issue\", func(t *testing.T) {\n t.Parallel() // Can run concurrently - tests don't conflict\n // test using shared `s`\n })\n \n t.Run(\"with_description\", func(t *testing.T) {\n t.Parallel()\n // test using shared `s`\n })\n \n // ... 50 more subtests, all using same DB\n}\n```\n\n**Result**: 50 tests β†’ 1 database setup instead of 50!\n\n## Why This Works\n\nSQLite is fine with concurrent reads and isolated transactions. These tests:\n- βœ… Create different issues (no ID conflicts)\n- βœ… Just read back what they created\n- βœ… Don't depend on database state from other tests\n\nThey SHOULD share a database!\n\n## Real Numbers\n\nCurrent:\n- 279 tests Γ— (create dir + init SQLite + migrations) = **8 minutes**\n\nAfter fix:\n- 10 test suites Γ— (create dir + init SQLite + migrations) = **30 seconds**\n- 279 subtests running in parallel using those 10 DBs = **5 seconds**\n\n**Total: ~35 seconds instead of 8 minutes!**\n\n## Implementation Plan\n\n1. **Group related tests** into suites (Create, List, Update, Delete, etc.)\n2. **One setup per suite** instead of per test\n3. **Use t.Run() for subtests** with t.Parallel()\n4. **Keep tests that actually need isolation** separate (export/import tests, git operations)\n\nThis is way better than shuffling tests into folders!","notes":"## Progress Update (2025-11-21)\n\nβœ… **Completed**:\n- Audited all 280 tests, created TEST_SUITE_AUDIT.md ([deleted:bd-c49])\n- Refactored create_test.go to shared DB pattern ([deleted:bd-y6d])\n- Proven the pattern works: 11 tests now run in 0.04s with 1 DB instead of 11\n\n❌ **Current Reality**:\n- Overall test suite: Still 8+ minutes (no meaningful change)\n- Only 1 of 76 test files refactored\n- Saved ~10 DB initializations out of 280\n\n## Acceptance Criteria (REALISTIC)\n\nThis task is NOT complete until:\n- [ ] All P1 files refactored (create βœ…, dep, stale, comments, list, ready)\n- [ ] Test suite runs in \u003c 2 minutes\n- [ ] Measured and verified actual speedup\n\n## Next Steps\n\n1. Refactor remaining 5 P1 files: dep_test.go, stale_test.go, comments_test.go, list_test.go, ready_test.go\n2. Measure actual time improvement after each file\n3. Continue with P2 files if needed to hit \u003c2min target","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-21T11:37:47.886207-05:00","updated_at":"2025-11-22T17:48:48.06471-08:00","source_repo":".","dependencies":[{"issue_id":"bd-1rh","depends_on_id":"bd-c49","type":"blocks","created_at":"2025-11-21T11:49:26.347518-05:00","created_by":"daemon"}]} -{"id":"bd-1vup","content_hash":"99df92e0d2e6f2998d9ef52c60ae1db55a2e52b84c3e935bf371517e5154ad77","title":"Test FK constraint via close","description":"","status":"closed","priority":4,"issue_type":"task","created_at":"2025-11-07T15:06:10.324045-08:00","updated_at":"2025-11-07T15:06:14.289835-08:00","closed_at":"2025-11-07T15:06:14.289835-08:00","source_repo":"."} -{"id":"bd-1vv","content_hash":"1db907ddb55edaf7a4c06a566c4e1b8244fcd9ba5d7e2fca4d5c053e424ac515","title":"Add WebSocket support","description":"## Feature Request\n\n[Describe the desired feature]\n\n## Motivation\n\n[Why is this feature needed? What problem does it solve?]\n\n## Use Cases\n\n1. **Use Case 1**: [description]\n2. **Use Case 2**: [description]\n\n## Proposed Solution\n\n[High-level approach to implementing this feature]\n\n## Alternatives Considered\n\n- **Alternative 1**: [description and why not chosen]\n- **Alternative 2**: [description and why not chosen]\n","design":"## Technical Design\n\n[Detailed technical approach]\n\n## API Changes\n\n[New commands, flags, or APIs]\n\n## Data Model Changes\n\n[Database schema changes if any]\n\n## Implementation Notes\n\n- Note 1\n- Note 2\n\n## Testing Strategy\n\n- Unit tests: [scope]\n- Integration tests: [scope]\n- Manual testing: [steps]\n","acceptance_criteria":"- [ ] Feature implements all described use cases\n- [ ] All tests pass\n- [ ] Documentation updated (README, commands)\n- [ ] Examples added if applicable\n- [ ] No performance regressions\n","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-03T19:56:41.271215-08:00","updated_at":"2025-11-03T19:56:41.271215-08:00","source_repo":".","labels":["feature"]} -{"id":"bd-1yi5","content_hash":"11044802d32a77f8ca574ca5902939bcc7e252880437bea7281aaf445db8db84","title":"Use -short flag in CI for PR checks","description":"Update CI configuration to use -short flag for PR checks, run full tests nightly.\n\nThe slow tests already support testing.Short() and will be skipped.\n\nExpected savings: ~20 seconds for PR checks (fast tests only)\n\nImplementation:\n- Update .github/workflows/ci.yml to add -short flag for PR tests\n- Create/update nightly workflow for full test runs\n- Update README/docs about test strategy\n\nFile: .github/workflows/ci.yml:30","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T01:24:17.279618-08:00","updated_at":"2025-11-04T10:25:10.616119-08:00","closed_at":"2025-11-04T10:25:10.616119-08:00","source_repo":".","dependencies":[{"issue_id":"bd-1yi5","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:17.280453-08:00","created_by":"daemon"}]} -{"id":"bd-22e0bde9","content_hash":"532c3b7af57bcf046114e2a3e9519fd07729251b3e81450a772d75d920d63e5d","title":"Add TestNWayCollision for 5+ clones","description":"## Overview\nAdd comprehensive tests for N-way (5+) collision resolution to verify the solution scales beyond 3 clones.\n\n## Purpose\nWhile TestThreeCloneCollision validates the basic N-way case, we need to verify:\n1. Solution scales to arbitrary N\n2. Performance is acceptable with more clones\n3. Convergence time is bounded\n4. No edge cases in larger collision groups\n\n## Implementation Tasks\n\n### 1. Create TestFiveCloneCollision\nFile: beads_twoclone_test.go (or new beads_nway_test.go)\n\n```go\nfunc TestFiveCloneCollision(t *testing.T) {\n // Test with 5 clones creating same ID with different content\n // Verify all 5 clones converge after sync rounds\n \n t.Run(\"SequentialSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"A\", \"B\", \"C\", \"D\", \"E\")\n })\n \n t.Run(\"ReverseSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"E\", \"D\", \"C\", \"B\", \"A\")\n })\n \n t.Run(\"RandomSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"C\", \"A\", \"E\", \"B\", \"D\")\n })\n}\n```\n\n### 2. Implement generalized testNCloneCollision\nGeneralize the 3-clone test to handle arbitrary N:\n\n```go\nfunc testNCloneCollision(t *testing.T, numClones int, syncOrder ...string) {\n t.Helper()\n \n if len(syncOrder) != numClones {\n t.Fatalf(\"syncOrder length (%d) must match numClones (%d)\", \n len(syncOrder), numClones)\n }\n \n tmpDir := t.TempDir()\n \n // Setup remote and N clones\n remoteDir := setupBareRepo(t, tmpDir)\n cloneDirs := make(map[string]string)\n \n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n cloneDirs[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates issue with same ID but different content\n for name, dir := range cloneDirs {\n createIssue(t, dir, fmt.Sprintf(\"Issue from clone %s\", name))\n }\n \n // Sync in specified order\n for _, name := range syncOrder {\n syncClone(t, cloneDirs[name], name)\n }\n \n // Final pull for convergence\n for name, dir := range cloneDirs {\n finalPull(t, dir, name)\n }\n \n // Verify all clones have all N issues\n expectedTitles := make(map[string]bool)\n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n expectedTitles[fmt.Sprintf(\"Issue from clone %s\", name)] = true\n }\n \n for name, dir := range cloneDirs {\n titles := getTitles(t, dir)\n if !compareTitleSets(titles, expectedTitles) {\n t.Errorf(\"Clone %s missing issues: expected %v, got %v\", \n name, expectedTitles, titles)\n }\n }\n \n t.Log(\"βœ“ All\", numClones, \"clones converged successfully\")\n}\n```\n\n### 3. Add performance benchmarks\nTest convergence time and memory usage:\n\n```go\nfunc BenchmarkNWayCollision(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n // Run N-way collision and measure time\n testNCloneCollisionBench(b, n)\n }\n })\n }\n}\n```\n\n### 4. Add convergence time tests\nVerify bounded convergence:\n\n```go\nfunc TestConvergenceTime(t *testing.T) {\n // Test that convergence happens within expected rounds\n // For N clones, should converge in at most N-1 sync rounds\n \n for n := 3; n \u003c= 10; n++ {\n t.Run(fmt.Sprintf(\"N=%d\", n), func(t *testing.T) {\n rounds := measureConvergenceRounds(t, n)\n maxExpected := n - 1\n if rounds \u003e maxExpected {\n t.Errorf(\"Convergence took %d rounds, expected ≀ %d\", \n rounds, maxExpected)\n }\n })\n }\n}\n```\n\n### 5. Add edge case tests\nTest boundary conditions:\n- All N clones have identical content (dedup works)\n- N-1 clones have same content, 1 differs\n- All N clones have unique content\n- Mix of collisions and non-collisions\n\n## Acceptance Criteria\n- TestFiveCloneCollision passes with all sync orders\n- All 5 clones converge to identical content\n- Performance is acceptable (\u003c 5 seconds for 5 clones)\n- Convergence time is bounded (≀ N-1 rounds)\n- Edge cases handled correctly\n- Benchmarks show scalability to 10+ clones\n\n## Files to Create/Modify\n- beads_twoclone_test.go or beads_nway_test.go\n- Add helper functions for N-clone setup\n\n## Testing Strategy\n\n### Test Matrix\n| N Clones | Sync Orders | Expected Result |\n|----------|-------------|-----------------|\n| 3 | Aβ†’Bβ†’C | Pass |\n| 3 | Cβ†’Bβ†’A | Pass |\n| 5 | Aβ†’Bβ†’Cβ†’Dβ†’E | Pass |\n| 5 | Eβ†’Dβ†’Cβ†’Bβ†’A | Pass |\n| 5 | Random | Pass |\n| 10 | Sequential | Pass |\n\n### Performance Targets\n- 3 clones: \u003c 2 seconds\n- 5 clones: \u003c 5 seconds\n- 10 clones: \u003c 15 seconds\n\n## Dependencies\n- Requires bd-cbed9619.5, bd-cbed9619.4, bd-cbed9619.3, bd-cbed9619.2 to be completed\n- TestThreeCloneCollision must pass first\n\n## Success Metrics\n- All tests pass for N ∈ {3, 5, 10}\n- Convergence time scales linearly (O(N))\n- Memory usage reasonable (\u003c 100MB for 10 clones)\n- No data corruption or loss in any scenario","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T23:05:13.974702-07:00","updated_at":"2025-10-31T12:00:43.197709-07:00","closed_at":"2025-10-31T12:00:43.197709-07:00","source_repo":"."} -{"id":"bd-23a8","content_hash":"7c54bea4624429ff0842a192489979e0a1eafdd872027a0934b1a1d9b0e80d33","title":"Test simple issue","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T17:11:04.464726-08:00","updated_at":"2025-11-04T11:10:23.529727-08:00","closed_at":"2025-11-04T11:10:23.529731-08:00","source_repo":".","comments":[{"id":23,"issue_id":"bd-23a8","author":"stevey","text":"Testing the new bd comment alias!","created_at":"2025-11-23T01:48:48Z"},{"id":24,"issue_id":"bd-23a8","author":"stevey","text":"Another test with JSON output","created_at":"2025-11-23T01:48:48Z"},{"id":25,"issue_id":"bd-23a8","author":"stevey","text":"Test comment from file\n","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-23o5","content_hash":"dc62c5c254daa81626702505e55935227c0e30890acdc472be3846c6d1d29ed6","title":"Update FAQ: How does OpenSpec/spec-driven development relate to Beads?","description":"Answer the question raised in GH discussion #240 about OpenSpec integration.\n\nAnswer Summary:\n- Single-agent: OpenSpec β†’ Beads β†’ Code\n- Multi-agent swarm: Use Gastown as coordination layer\n- Gastown provides OpenSpec-style planning infrastructure\n- Planning agents create specs, distribute as Beads issues\n- 'Gastown plans, Beads remembers, Agents execute'\n\nAction Items:\n1. Add FAQ entry explaining the architecture layers\n2. Link to Gastown planning design (gt-cke)\n3. Reference discussion #240 and rbergman's insights\n4. Clarify: Beads focuses on execution memory, not planning\n\nCross-Reference:\n- Gastown issue gt-cke: Design OpenSpec-style planning layer\n- GH discussion #240: https://github.com/steveyegge/beads/discussions/240\n\nKeep FAQ concise - detailed architecture lives in Gastown docs.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-23T14:52:23.786022-08:00","updated_at":"2025-11-23T14:52:23.786022-08:00","source_repo":"."} -{"id":"bd-248bdc3e","content_hash":"85c98bac3b48e3cc8466d1b60e4a690fe198c4f795160cf175d7add4691749b5","title":"Add optional post-merge git hook example for bd sync","description":"Create example git hook that auto-runs bd sync after git pull/merge.\n\nAdd to examples/git-hooks/:\n- post-merge hook that checks if .beads/issues.jsonl changed\n- If changed: run `bd sync` automatically\n- Make it optional/documented (not auto-installed)\n\nBenefits:\n- Zero-friction sync after git pull\n- Complements auto-detection as belt-and-suspenders\n\nNote: post-merge hook already exists for pre-commit/post-merge. Extend it to support sync.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-25T22:47:14.668842-07:00","updated_at":"2025-11-06T20:06:49.217298-08:00","closed_at":"2025-11-06T19:51:37.787964-08:00","source_repo":"."} -{"id":"bd-2530","content_hash":"ac8bc0c4d75082ac76200d092b3c1c476fd1523c9e83b890f829ee3dd7dcbb3d","title":"Issue with labels","description":"This is a description","design":"Use MVC pattern","acceptance_criteria":"All tests pass","status":"closed","priority":0,"issue_type":"feature","created_at":"2025-10-31T21:40:34.630173-07:00","updated_at":"2025-11-01T11:11:57.93151-07:00","closed_at":"2025-11-01T11:11:57.93151-07:00","source_repo":".","labels":["bug","critical"]} -{"id":"bd-2752a7a2","content_hash":"064b1ae28914d2cfcca93724e60636c13a6818883dbbb13322772ec93d814170","title":"Create cmd/bd/daemon_watcher.go (~150 LOC)","description":"Implement FileWatcher using fsnotify to watch JSONL file and git refs. Handle platform differences (inotify/FSEvents/ReadDirectoryChangesW). Include edge case handling for file rename, event storm, watcher failure.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T23:05:13.887269-07:00","updated_at":"2025-10-31T18:30:24.131535-07:00","closed_at":"2025-10-31T18:30:24.131535-07:00","source_repo":"."} -{"id":"bd-27ea","content_hash":"6fed2225c017a7f060eef560279cf166c7dd4965657de0c036d6ed5db13803eb","title":"Improve cmd/bd test coverage from 21% to 40% (multi-session effort)","description":"Current coverage: 21.0% of statements in cmd/bd\nTarget: 40%\nThis is a multi-session incremental effort.\n\nFocus areas:\n- Command handler tests (create, update, close, list, etc.)\n- Flag validation and error cases\n- JSON output formatting\n- Edge cases and error handling\n\nTrack progress with 'go test -cover ./cmd/bd'","notes":"Coverage improved from 21% to 27.4% (package) and 42.9% (total function coverage).\n\nAdded tests for:\n- compact.go test coverage (eligibility checks, dry run scenarios)\n- epic.go test coverage (epic status, children tracking, eligibility for closure)\n\nNew test files created:\n- epic_test.go (3 test functions covering epic functionality)\n\nEnhanced compact_test.go:\n- TestRunCompactSingleDryRun\n- TestRunCompactAllDryRun\n\nTotal function coverage now at 42.9%, exceeding the 40% target.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-10-31T19:35:57.558346-07:00","updated_at":"2025-11-01T12:23:39.158922-07:00","closed_at":"2025-11-01T12:23:39.158926-07:00","source_repo":"."} -{"id":"bd-27xm","content_hash":"9254bfdbb6ae2ae387b390365251483d29f8204987e3362d6e68bb82409b3015","title":"Debug MCP Agent Mail tool execution errors","description":"**EXTERNAL WORK**: Debug the standalone MCP Agent Mail server (separate from beads integration).\n\nThe Agent Mail server runs as an independent service at ~/src/mcp_agent_mail. This is NOT beads code - it's a separate GitHub project we're evaluating for optional coordination features.\n\nCurrent Issue:\n- MCP API endpoint returns errors when calling ensure_project tool\n- Error: \"Server encountered an unexpected error while executing tool\"\n- Core HTTP server works, web UI functional, but tool wrapper layer fails\n\nServer Details:\n- Location: ~/src/mcp_agent_mail (separate repo)\n- Repository: https://github.com/Dicklesworthstone/mcp_agent_mail\n- Runs on: http://127.0.0.1:8765\n- Bearer token: In .env file\n\nInvestigation Steps:\n1. Check tool execution logs for full stack trace\n2. Verify Git storage initialization at ~/.mcp_agent_mail_git_mailbox_repo\n3. Review database setup (storage.sqlite3)\n4. Test with simpler MCP tools if available\n5. Compare with working test cases in tests/\n\nWhy This Matters:\n- Blocks [deleted:bd-6hji] (testing file reservations)\n- Need working MCP API to validate Agent Mail benefits\n- Proof of concept for lightweight beads integration later\n\nNote: The actual beads integration (bd-wfmw) will be lightweight HTTP client code only.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T23:20:10.973891-08:00","updated_at":"2025-11-08T03:12:04.151537-08:00","closed_at":"2025-11-07T23:40:19.309202-08:00","source_repo":".","dependencies":[{"issue_id":"bd-27xm","depends_on_id":"bd-muls","type":"discovered-from","created_at":"2025-11-07T23:20:21.895654-08:00","created_by":"daemon"}]} -{"id":"bd-28db","content_hash":"d5e519475ac57322f0ebe7a1f2499af199621f7cab7f7efcf5c4397845702766","title":"Add 'bd status' command for issue database overview","description":"Implement a bd status command that provides a quick snapshot of the issue database state, similar to how git status shows working tree state.\n\nExpected output: Show summary including counts by state (open, in-progress, blocked, closed), recent activity (last 7 days), and quick overview without needing multiple queries.\n\nExample output showing issue counts, recent activity stats, and pointer to bd list for details.\n\nProposed options: --all (show all issues), --assigned (show issues assigned to current user), --json (JSON format output)\n\nUse cases: Quick project health check, onboarding for new contributors, integration with shell prompts or CI/CD, daily standup reference","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-02T17:25:59.203549-08:00","updated_at":"2025-11-02T17:25:59.203549-08:00","source_repo":"."} -{"id":"bd-2997","content_hash":"ba18fb84fd31a9ecd6ea411ff97e6e12d446e4f562d9ec69f8e81c2fe5f8408b","title":"bd-hv01: No snapshot versioning or timestamps causes stale data usage","description":"Problem: If sync is interrupted (crash, kill -9, power loss), stale snapshots persist indefinitely. Next sync uses stale data leading to incorrect deletions.\n\nFix: Add metadata to snapshots with timestamp, version, and commit SHA. Validate snapshots are recent (\u003c 1 hour old), from compatible version, and from expected git commit.\n\nFiles: cmd/bd/deletion_tracking.go (all snapshot functions)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T18:16:21.816748-08:00","updated_at":"2025-11-06T19:34:51.677442-08:00","closed_at":"2025-11-06T19:34:51.677442-08:00","source_repo":".","dependencies":[{"issue_id":"bd-2997","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.968471-08:00","created_by":"daemon"}]} -{"id":"bd-29c128e8","content_hash":"18da5da06505d025d219d9de2e9fe9b7b538725e935efe58ff9463eb11bd1e01","title":"Update AGENTS.md with event-driven mode","description":"Document BEADS_DAEMON_MODE env var. Explain opt-in during Phase 1. Add troubleshooting for watcher failures.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T16:20:02.433145-07:00","updated_at":"2025-10-30T17:12:58.223058-07:00","closed_at":"2025-10-29T15:53:24.019613-07:00","source_repo":"."} -{"id":"bd-2b34","content_hash":"db656dbf5f73f44d98206fbe737a9d0225c24a547598c09f84ca496392ebb93f","title":"Refactor cmd/bd/daemon.go for testability and maintainability","description":"","design":"## Current Structure Analysis\n\ndaemon.go contains:\n- Command setup and CLI flag parsing\n- Path/config resolution (getGlobalBeadsDir, ensureBeadsDir, getPIDFilePath, etc.)\n- Daemon lifecycle (start, stop, status, health, metrics)\n- Lock management (setupDaemonLock, acquireDaemonLock)\n- RPC server setup (startRPCServer)\n- Export/import operations (exportToJSONLWithStore, importToJSONLWithStore)\n- Sync orchestration (createExportFunc, createAutoImportFunc, createSyncFunc)\n- Event loop (runEventLoop, runDaemonLoop)\n- Global daemon mode (runGlobalDaemon)\n- Logging setup (setupDaemonLogger)\n\n## Proposed Module Breakdown\n\n1. **daemon_config.go** - Configuration \u0026 path resolution\n - getGlobalBeadsDir, ensureBeadsDir\n - getPIDFilePath, getLogFilePath, getSocketPathForPID\n - getEnvInt, getEnvBool\n - boolToFlag helper\n\n2. **daemon_lifecycle.go** - Start/stop/status operations\n - isDaemonRunning, startDaemon, stopDaemon\n - showDaemonStatus, showDaemonHealth, showDaemonMetrics\n - migrateToGlobalDaemon\n\n3. **daemon_sync.go** - Export/import/sync logic\n - exportToJSONLWithStore, importToJSONLWithStore\n - createExportFunc, createAutoImportFunc, createSyncFunc\n - validateDatabaseFingerprint\n\n4. **daemon_server.go** - RPC server setup\n - startRPCServer, runGlobalDaemon\n\n5. **daemon_loop.go** - Event loop \u0026 orchestration\n - runEventLoop, runDaemonLoop\n\n6. **daemon_logger.go** - Logging setup\n - setupDaemonLogger, daemonLogger type\n\nKeep daemon.go as Cobra command definition only.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-31T22:28:19.689943-07:00","updated_at":"2025-11-01T19:20:28.102841-07:00","closed_at":"2025-11-01T19:20:28.102847-07:00","source_repo":"."} -{"id":"bd-2b34.1","content_hash":"e152ebc46dbc7f128b6913cf6dc1c312425449cea689d67e945145e8432788e6","title":"Extract daemon logger functions to daemon_logger.go","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.343617-07:00","updated_at":"2025-11-01T20:31:54.434039-07:00","closed_at":"2025-11-01T20:31:54.434039-07:00","source_repo":"."} -{"id":"bd-2b34.2","content_hash":"6d89393a0bdce58ec9b7f5a1d58c9f91d13a39b17bbf502623fcc0f280d48142","title":"Extract daemon server functions to daemon_server.go","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.345639-07:00","updated_at":"2025-11-01T21:02:58.338168-07:00","closed_at":"2025-11-01T21:02:58.338168-07:00","source_repo":"."} -{"id":"bd-2b34.3","content_hash":"0eb6b2eeab32c256a9f99c1505036d4ac13fcb82370c7a5a17e925c7206854ad","title":"Extract daemon sync functions to daemon_sync.go","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.347332-07:00","updated_at":"2025-11-01T21:02:58.339737-07:00","closed_at":"2025-11-01T21:02:58.339737-07:00","source_repo":"."} -{"id":"bd-2b34.4","content_hash":"f0b2091b2406b4b9481770a2ee1697b6b0ad99336db589e7507e2ef489dc9780","title":"Extract daemon config functions to daemon_config.go","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.349237-07:00","updated_at":"2025-11-01T21:02:58.361676-07:00","closed_at":"2025-11-01T21:02:58.361676-07:00","source_repo":"."} -{"id":"bd-2b34.5","content_hash":"b157d1641dd0fcf302fb2d0e7b9e8feb8c8834806bbdea24a148a33336b6951b","title":"Add tests for daemon sync module","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.354701-07:00","updated_at":"2025-11-01T21:06:55.184844-07:00","closed_at":"2025-11-01T21:06:55.184844-07:00","source_repo":"."} -{"id":"bd-2b34.6","content_hash":"49780093236269fa2fbf27802522328ba781cd7a7b77d32c06017b43c2c23e3f","title":"Add tests for daemon lifecycle module","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.359587-07:00","updated_at":"2025-11-01T21:22:39.009259-07:00","closed_at":"2025-11-01T21:22:39.009259-07:00","source_repo":"."} -{"id":"bd-2b34.7","content_hash":"64f698aef173b6ff3b70021be35c423aa14c853b2ef36a30e6ab41099e4b29c3","title":"Add tests for daemon config module","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.373684-07:00","updated_at":"2025-11-01T21:21:42.431252-07:00","closed_at":"2025-11-01T21:21:42.431252-07:00","source_repo":"."} -{"id":"bd-2b34.8","content_hash":"1a859e1791613917defac65bf2632904f5cc79017ad7aa83323027fd54fbd541","title":"Extract daemon lifecycle functions to daemon_lifecycle.go","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.382892-07:00","updated_at":"2025-11-01T21:02:58.350055-07:00","closed_at":"2025-11-01T21:02:58.350055-07:00","source_repo":"."} -{"id":"bd-2c5a","content_hash":"1f430d37e5ae77164b6773e61be6a21b3bf1914a8ae608747a84d5a7424e2f2d","title":"Investigate why test issues persist in database","description":"Test issues (bd-0do3, bd-cjxp, bd-phr2, etc.) keep appearing in ready/list output, cluttering real work. These appear to be leftover test data from test runs.\n\nNeed to investigate:\n1. Why are test issues not being cleaned up after tests?\n2. Are tests creating issues in the main database instead of test databases?\n3. Should we add better test isolation or cleanup hooks?\n4. Can we add a label/prefix to distinguish test issues from real issues?\n\nThese test issues have characteristics:\n- Empty descriptions\n- Generic titles like \"Test issue 0\", \"Bug P0\", \"Issue to reopen with reason\"\n- Created around 2025-11-07 19:00-19:07\n- Some assigned to test users like \"alice\", \"bob\", \"testuser\"","notes":"## Root Cause Analysis\n\n**Problem**: Python MCP integration tests created test issues in production `.beads/beads.db` instead of isolated test databases.\n\n**Evidence**:\n- 29 test issues created on Nov 7, 2025 at 19:00-19:07\n- Patterns: \"Bug P0\", \"Test issue X\", assignees \"alice\"/\"bob\"/\"testuser\"\n- Git commit 0e8936b shows test issues committed to .beads/beads.jsonl\n- Tests were being fixed for workspace isolation around the same time\n\n**Why It Happened**:\n1. Before commit 0e8936b, `test_client_lazy_initialization()` didn't set `BEADS_WORKING_DIR`\n2. Tests fell back to discovering `.beads/` in the project root directory\n3. Auto-sync committed test issues to production database\n\n**Resolution**:\n1. βœ… Closed 29 test pollution issues (bd-0do3, bd-cjxp, etc.)\n2. βœ… Added `failIfProductionDatabase()` guard in Go test helpers\n3. βœ… Added production pollution checks in RPC test setup\n4. βœ… Created `conftest.py` with pytest safety checks for Python tests\n5. βœ… Added `BEADS_TEST_MODE` env var to mark test execution\n6. βœ… Tests now fail fast if they detect production database usage\n\n**Prevention**:\n- All test helper functions now verify database paths are in temp directories\n- Python tests fail immediately if BEADS_DB points to production\n- BEADS_TEST_MODE flag helps identify test vs production execution\n- Clear error messages guide developers to use proper test isolation\n\n**Files Modified**:\n- cmd/bd/test_helpers_test.go - Added failIfProductionDatabase()\n- internal/rpc/rpc_test.go - Added temp directory verification\n- integrations/beads-mcp/tests/conftest.py - New file with pytest safeguards","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T21:31:34.845887-08:00","updated_at":"2025-11-07T21:57:30.892086-08:00","closed_at":"2025-11-07T21:57:30.892086-08:00","source_repo":"."} -{"id":"bd-2cvu","content_hash":"0005d8dfb8153b25b1c80cd49b38cc1b0d5eac46d7c73692366c5a8cb5cf967e","title":"Update AGENTS.md with Agent Mail workflow","description":"Update agent workflow section to include Agent Mail coordination as optional step.\n\nAcceptance Criteria:\n- Add Agent Mail to recommended workflow\n- Show both with/without examples\n- Update \"Multi-Agent Patterns\" section\n- Cross-reference to AGENT_MAIL.md\n\nFile: AGENTS.md (lines 468-475)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:51.295729-08:00","updated_at":"2025-11-08T00:52:34.288915-08:00","closed_at":"2025-11-08T00:52:34.288915-08:00","source_repo":".","dependencies":[{"issue_id":"bd-2cvu","depends_on_id":"bd-xzrv","type":"blocks","created_at":"2025-11-07T23:04:09.773656-08:00","created_by":"daemon"}]} -{"id":"bd-2d5r","content_hash":"c65754b0a284f5f4ce9f8fe07334e084c7bbe371fe63790998326a0dc895550d","title":"Fix silent error handling in RPC response writing","description":"Marshal and write errors silently ignored in writeResponse, can send partial JSON and hang clients.\n\nLocation: internal/rpc/server_lifecycle_conn.go:228-232\n\nProblem:\n- json.Marshal error ignored - cyclic reference sends corrupt JSON\n- Write error ignored - connection closed, no indication to caller \n- WriteByte error ignored - client hangs waiting for newline\n- Flush error ignored - partial data buffered\n\nCurrent code:\nfunc (s *Server) writeResponse(writer *bufio.Writer, resp Response) {\n data, _ := json.Marshal(resp) // Ignored!\n _, _ = writer.Write(data) // Ignored!\n _ = writer.WriteByte('\\n') // Ignored!\n _ = writer.Flush() // Ignored!\n}\n\nSolution: Return errors, handle in caller, close connection on error\n\nImpact: Client hangs waiting for response; corrupt JSON sent\n\nEffort: 1 hour","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:51:47.002242-08:00","updated_at":"2025-11-16T15:04:00.481507-08:00","closed_at":"2025-11-16T15:04:00.481507-08:00","source_repo":"."} -{"id":"bd-2e80","content_hash":"bb7de865be3d63a2c6c167cf1100a458bfcc4d04d85639bcbcf22f310477e408","title":"Document shared memory test isolation pattern in test_helpers.go","description":"Tests were failing because :memory: creates a shared database across all tests. The fix is to use \"file::memory:?mode=memory\u0026cache=private\" for test isolation.\n\nShould document this pattern in test_helpers.go and potentially update newTestStore to use private memory by default.","status":"closed","priority":3,"issue_type":"chore","created_at":"2025-11-01T22:40:58.993496-07:00","updated_at":"2025-11-02T16:27:39.02423-08:00","closed_at":"2025-11-02T16:27:39.024233-08:00","source_repo":"."} -{"id":"bd-2e94","content_hash":"92573586e4d6738191c2edf529feecbf68a0ed3d26f120b385882c55dccf7c9b","title":"Support --parent flag in daemon mode","description":"Added support for hierarchical child issue creation using --parent flag in daemon mode. Previously only worked in direct mode.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T13:55:47.415771-08:00","updated_at":"2025-11-05T13:55:53.252342-08:00","closed_at":"2025-11-05T13:55:53.252342-08:00","source_repo":"."} -{"id":"bd-2f388ca7","content_hash":"27498c808874010ee62da58e12434a6ae7c73f4659b2233aaf8dcd59566a907d","title":"Fix TestTwoCloneCollision timeout","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-28T14:11:25.219607-07:00","updated_at":"2025-10-30T17:12:58.217635-07:00","closed_at":"2025-10-28T16:12:26.286611-07:00","source_repo":"."} -{"id":"bd-2ifg","content_hash":"1a32ca6b21a14e121fc8e1026d83d85683cd3ff3b500f56eb8a05398b89ebf51","title":"bd-hv01: Silent partial deletion failures cause DB inconsistency","description":"Problem: deletion_tracking.go:76-77 logs deletion errors as warnings but continues. If deletion fails midway (database locked, disk full), some issues delete but others don't. System thinks all deletions succeeded.\n\nImpact: Database diverges from JSONL, silent corruption, issues may resurrect on next sync.\n\nFix: Collect errors and fail the operation:\nvar deletionErrors []error\nfor _, id := range acceptedDeletions {\n if err := d.DeleteIssue(ctx, id); err != nil {\n deletionErrors = append(deletionErrors, fmt.Errorf(\"issue %s: %w\", id, err))\n }\n}\nif len(deletionErrors) \u003e 0 {\n return false, fmt.Errorf(\"deletion failures: %v\", deletionErrors)\n}\n\nFiles: cmd/bd/deletion_tracking.go:73-82","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:16:19.465137-08:00","updated_at":"2025-11-06T18:46:55.901973-08:00","closed_at":"2025-11-06T18:46:55.901973-08:00","source_repo":".","dependencies":[{"issue_id":"bd-2ifg","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.833477-08:00","created_by":"daemon"}]} -{"id":"bd-2ku7","content_hash":"65cee891959383f7c8862b54b72c4bafae950ee47eecb47f0f842e6c10c8ba04","title":"Test integration issue","description":"This is a real integration test","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T19:07:11.528577-08:00","updated_at":"2025-11-07T22:07:17.343154-08:00","closed_at":"2025-11-07T21:55:09.426381-08:00","source_repo":"."} -{"id":"bd-2o2","content_hash":"ec587855e11cbd34569de5f35e4c68404eb7f20926595615e852f73821aec950","title":"Add cancellation and timeout tests","description":"Add comprehensive tests for context cancellation and timeout behavior.\n\n## Context\nPart of context propagation work. Validates that bd-rtp and bd-yb8 work correctly.\n\n## Test Coverage Needed\n\n### 1. Cancellation Tests\n- [ ] Import operation cancelled mid-stream\n- [ ] Export operation cancelled mid-stream \n- [ ] Database query cancelled during long operation\n- [ ] No corruption after cancellation\n- [ ] Proper cleanup (defers execute, connections closed)\n\n### 2. Timeout Tests\n- [ ] Operations respect context deadlines\n- [ ] Appropriate error messages on timeout\n- [ ] State remains consistent after timeout\n\n### 3. Signal Handling Tests\n- [ ] SIGINT (Ctrl+C) triggers cancellation\n- [ ] SIGTERM triggers graceful shutdown\n- [ ] Multiple signals handled correctly\n\n## Implementation Approach\n```go\nfunc TestImportCancellation(t *testing.T) {\n ctx, cancel := context.WithCancel(context.Background())\n \n // Start import in goroutine\n go func() {\n err := runImport(ctx, largeFile)\n assert.Error(err, context.Canceled)\n }()\n \n // Cancel after short delay\n time.Sleep(100 * time.Millisecond)\n cancel()\n \n // Verify database integrity\n assertDatabaseConsistent(t, store)\n}\n```\n\n## Files to Create/Update\n- cmd/bd/import_test.go - cancellation tests\n- cmd/bd/export_test.go - cancellation tests\n- internal/storage/sqlite/*_test.go - context timeout tests\n\n## Acceptance Criteria\n- [ ] All critical operations have cancellation tests\n- [ ] Tests verify database integrity after cancellation\n- [ ] Signal handling tested (if feasible)\n- [ ] Test coverage \u003e80% for context paths","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:27:22.854636-05:00","updated_at":"2025-11-20T21:40:25.882758-05:00","closed_at":"2025-11-20T21:40:25.882758-05:00","source_repo":".","labels":["testing"],"dependencies":[{"issue_id":"bd-2o2","depends_on_id":"bd-yb8","type":"blocks","created_at":"2025-11-20T21:27:22.855574-05:00","created_by":"daemon"}]} -{"id":"bd-2q6d","content_hash":"d593b18be7696f1b6447d41a2b6988ee2e993169a183bec16e4df86607f288d1","title":"Beads commands operate on stale database without warning","description":"All beads read operations should validate database is in sync with JSONL before proceeding.\n\n**Current Behavior:**\n- Commands can query/read from stale database\n- Only mutation operations (like 'bd sync') check if JSONL is newer\n- User gets incorrect results without realizing database is out of sync\n\n**Expected Behavior:**\n- All beads commands should have pre-flight check for database freshness\n- If JSONL is newer than database, refuse to operate with error: \"Database out of sync. Run 'bd import' first.\"\n- Same safety check that exists for 'bd sync' should apply to ALL operations\n\n**Impact:**\n- Users make decisions based on incomplete/outdated data\n- Silent failures lead to confusion (e.g., thinking issues don't exist when they do)\n- Similar to running git commands on stale repo without being warned to pull\n\n**Example:**\n- Searched for bd-g9eu issue file: not found\n- Issue exists in .beads/issues.jsonl (in git)\n- Database was stale, but no warning was given\n- Led to incorrect conclusion that issue was already closed/deleted","notes":"## Implementation Complete\n\n**Phase 1: Created staleness check (cmd/bd/staleness.go)**\n- ensureDatabaseFresh() function checks JSONL mtime vs last_import_time\n- Returns error with helpful message when database is stale\n- Auto-skips in daemon mode (daemon has auto-import)\n\n**Phase 2: Added to all read commands**\n- list, show, ready, status, stale, info, duplicates, validate\n- Check runs before database queries in direct mode\n- Daemon mode already protected via checkAndAutoImportIfStale()\n\n**Phase 3: Code Review Findings**\nSee follow-up issues:\n- bd-XXXX: Add warning when staleness check errors\n- bd-YYYY: Improve CheckStaleness error handling\n- bd-ZZZZ: Refactor redundant daemon checks (low priority)\n\n**Testing:**\n- Build successful: go build ./cmd/bd\n- Binary works: ./bd --version\n- Ready for manual testing\n\n**Next Steps:**\n1. Test with stale database scenario\n2. Implement review improvements\n3. Close issue when tests pass","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-20T19:33:40.019297-05:00","updated_at":"2025-11-22T17:48:48.066616-08:00","source_repo":".","comments":[{"id":26,"issue_id":"bd-2q6d","author":"stevey","text":"# Updated Analysis\n\n## Root Cause\n\nThe bug has multiple contributing factors:\n\n1. **Daemon mode bypasses auto-import**: When running in daemon mode (most common), the `PersistentPreRun` returns early (main.go:332) before reaching auto-import logic (main.go:451-467)\n\n2. **No staleness validation on reads**: Read operations (list, show, search) don't verify database is fresh before returning results\n\n3. **Auto-import can be disabled**: Users with `--no-auto-import` can unknowingly operate on stale data\n\n## Current Auto-Import Behavior\n\nAuto-import DOES exist and uses SHA256 hash comparison:\n- Location: `autoflush.go:autoImportIfNewer()`\n- Stores last import hash in DB metadata: `last_import_hash`\n- Runs in `PersistentPreRun` for direct mode only\n- Skipped for: import, delete, sync --dry-run commands\n\n## Proposed Solution\n\nAdd lightweight hash-based staleness check to all read operations:\n\n### Implementation Points:\n1. **Before ANY database read** (list, show, search, ready, etc.):\n ```go\n func ensureDatabaseFresh(ctx context.Context) error {\n // Get stored import hash from DB\n storedHash, _ := store.GetMetadata(ctx, \"last_import_hash\")\n \n // Compute current JSONL hash\n currentHash := computeJSONLHash(findJSONLPath())\n \n if currentHash != storedHash {\n if autoImportEnabled {\n // Try auto-import\n autoImportIfNewer()\n // Re-check - fail if still stale\n } else {\n return fmt.Errorf(\"database out of sync with JSONL. Run 'bd import' or enable auto-import\")\n }\n }\n return nil\n }\n ```\n\n2. **Add to daemon RPC handlers** - daemon mode currently has NO staleness checking\n\n3. **Make check fast** - hash comparison is O(1) if JSONL hash is cached\n\n### Benefits:\n- Works in both daemon and direct mode\n- Minimal performance overhead (just hash comparison)\n- Catches all staleness cases\n- Clear error messages guide users to fix\n- Defense in depth - doesn't rely solely on auto-import\n\n### Alternatives Considered:\n- **mtime comparison**: Unreliable after git operations\n- **Block all reads when stale**: Too aggressive, breaks workflows \n- **Only check on mutations**: Current bug - reads return stale data\n- **Only rely on auto-import**: Fails in daemon mode and when disabled\n\n## Files to Modify:\n- `cmd/bd/list.go` - add check before SearchIssues\n- `cmd/bd/show.go` - add check before GetIssue\n- `cmd/bd/ready.go` - add check before GetReadyWork\n- `internal/rpc/server.go` - add check in daemon RPC handlers\n- Create `cmd/bd/staleness.go` - shared staleness check function","created_at":"2025-11-23T01:48:48Z"},{"id":27,"issue_id":"bd-2q6d","author":"stevey","text":"## Implementation Tasks\n\n### Phase 1: Core Infrastructure\n- [ ] Create `cmd/bd/staleness.go` with `ensureDatabaseFresh()` function\n- [ ] Add unit tests for staleness detection\n- [ ] Handle edge cases (missing JSONL, missing hash, etc.)\n\n### Phase 2: Direct Mode Read Commands\n- [ ] Add check to `cmd/bd/list.go`\n- [ ] Add check to `cmd/bd/show.go`\n- [ ] Add check to `cmd/bd/ready.go`\n- [ ] Add check to `cmd/bd/blocked.go`\n- [ ] Add check to `cmd/bd/stale.go`\n- [ ] Integration tests for direct mode\n\n### Phase 3: Daemon Mode\n- [ ] Add staleness check to daemon RPC handlers in `internal/rpc/server.go`\n- [ ] Ensure daemon can access JSONL path\n- [ ] Integration tests for daemon mode\n\n### Phase 4: Polish\n- [ ] Performance testing (check should be \u003c10ms)\n- [ ] Error message clarity\n- [ ] Documentation updates","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-3","content_hash":"41ae09ef713b88fa3724ae81a255c55eb336b66c2a4173b6146bc298286021ba","title":"Investigate and upgrade to modernc.org/sqlite 1.39.1+","description":"We had to pin modernc.org/sqlite to v1.38.2 due to a FOREIGN KEY constraint regression in v1.39.1 (SQLite 3.50.4).\n\n**Issue:** [deleted:bd-47], GH #144\n\n**Symptom:** CloseIssue fails with \"FOREIGN KEY constraint failed (787)\" when called via MCP/daemon, but works fine via CLI.\n\n**Root Cause:** Unknown - likely stricter FK enforcement in SQLite 3.50.4 or modernc.org wrapper changes.\n\n**Workaround:** Pinned to v1.38.2 (SQLite 3.49.x)\n\n**TODO:**\n1. Monitor modernc.org/sqlite releases for fixes\n2. Check SQLite 3.50.5+ changelogs for FK-related fixes\n3. Investigate why daemon mode fails but CLI succeeds (connection reuse? transaction isolation?)\n4. Consider filing upstream issue with reproducible test case\n5. Upgrade when safe","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T09:43:47.856354-08:00","updated_at":"2025-11-07T15:06:26.240131-08:00","closed_at":"2025-11-07T15:06:26.240131-08:00","source_repo":"."} -{"id":"bd-307","content_hash":"6c1bda0d392414f4bb16f078a18f3958a869d3d1ed72bde6cc9012739eae88ef","title":"Multi-repo hydration layer","description":"Build core infrastructure to hydrate database from N repos (Nβ‰₯1), with smart caching via file mtime tracking and routing writes to correct JSONL based on source_repo metadata.","design":"Components:\n- Config schema for repos.additional\n- source_repo metadata field (which repo owns each issue)\n- Hydration logic (read from N JSONLs)\n- Write routing (write to correct JSONL)\n- Smart caching (file mtime tracking to avoid re-parsing)\n- SQLite DB as cache layer","acceptance_criteria":"1. Can configure N repos via config.toml\n2. Database hydrates from all configured repos\n3. Writes route to correct JSONL via source_repo\n4. File mtime caching prevents re-parsing unchanged JSONLs\n5. Query performance \u003c100ms even with 5-10 polling interval\n6. N=1 (single repo) works unchanged","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:30.655765-08:00","updated_at":"2025-11-05T00:08:42.811877-08:00","closed_at":"2025-11-05T00:08:42.811879-08:00","source_repo":".","dependencies":[{"issue_id":"bd-307","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.823652-08:00","created_by":"daemon"}]} -{"id":"bd-317ddbbf","content_hash":"81a74ccf29037e5a780b12540a4059bab98b9a790a5a043a68118fc00a083cda","title":"Add BEADS_DAEMON_MODE flag handling","description":"Add environment variable BEADS_DAEMON_MODE (values: poll, events). Default to 'poll' for Phase 1. Wire into daemon startup to select runEventLoop vs runEventDrivenLoop.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.433638-07:00","updated_at":"2025-10-30T17:12:58.224373-07:00","closed_at":"2025-10-28T12:31:47.819136-07:00","source_repo":"."} -{"id":"bd-31aab707","content_hash":"8f64a8dbcc5ed63bc73b7d91fca624527033265dc1c89a7775eb2f45b378f382","title":"Unit tests for FileWatcher","description":"Test watcher detects JSONL changes. Test git ref changes trigger import. Test debounce integration. Test watcher recovery from file removal/rename.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T11:30:59.842317-07:00","updated_at":"2025-10-31T12:00:43.189591-07:00","closed_at":"2025-10-31T12:00:43.189591-07:00","source_repo":"."} -{"id":"bd-325da116","content_hash":"92a711fd6fc49c01e3785ee10d914cc04a5cd99cb3ebf6a2debe4f6e420c1f0e","title":"Fix N-way collision convergence","description":"Epic to fix the N-way collision convergence problem documented in n-way-collision-convergence.md.\n\n## Problem Summary\nThe current collision resolution implementation works correctly for 2-way collisions but does not converge for 3-way (and by extension N-way) collisions. TestThreeCloneCollision demonstrates this with reproducible failures.\n\n## Root Causes Identified\n1. Pairwise resolution doesn't scale - each clone makes local decisions without global context\n2. DetectCollisions modifies state during detection (line 83-86 in collision.go)\n3. No remapping history - can't track transitive remap chains (test-1 β†’ test-2 β†’ test-3)\n4. Import-time resolution is too late - happens after git merge\n\n## Solution Architecture\nReplace pairwise resolution with deterministic global N-way resolution using:\n- Content-addressable identity (content hashing)\n- Global collision resolution (sort all versions by hash)\n- Read-only detection phase (separate from modification)\n- Idempotent imports (content-first matching)\n\n## Success Criteria\n- TestThreeCloneCollision passes without skipping\n- All clones converge to identical content after final pull\n- No data loss (all issues present in all clones)\n- Works for N workers (test with 5+ clones)\n- Idempotent imports (importing same JSONL multiple times is safe)\n\n## Implementation Phases\nSee child issues for detailed breakdown of each phase.","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-10-29T23:05:13.889079-07:00","updated_at":"2025-10-31T11:59:41.031668-07:00","closed_at":"2025-10-31T11:59:41.031668-07:00","source_repo":"."} -{"id":"bd-32nm","content_hash":"c9c887eedeb24df52a98a2a786340e8ffdb4628f4747f346e34d10661814fac7","title":"Auto-configure git merge driver during `bd init`","description":"Enhance `bd init` to optionally set up beads-merge as git merge driver.\n\n**Tasks**:\n- Prompt user to install git merge driver\n- Configure `.git/config`: `merge.beads.driver \"bd merge %A %O %L %R\"`\n- Create/update `.gitattributes`: `.beads/beads.jsonl merge=beads`\n- Add `--skip-merge-driver` flag for non-interactive use\n- Update AGENTS.md onboarding section\n\n**Files**:\n- `cmd/bd/init.go`\n- `.gitattributes` template","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.447682-08:00","updated_at":"2025-11-05T19:27:18.370494-08:00","closed_at":"2025-11-05T19:27:18.370494-08:00","source_repo":".","dependencies":[{"issue_id":"bd-32nm","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.723517-08:00","created_by":"daemon"},{"issue_id":"bd-32nm","depends_on_id":"bd-omx1","type":"blocks","created_at":"2025-11-05T18:42:35.453823-08:00","created_by":"daemon"}]} -{"id":"bd-3396","content_hash":"43addfac9a43239dd75e1292a6502a79479cb09e67ff5d6823cc3df1b73390bf","title":"Add merge helper commands (bd sync --merge)","description":"Add commands to merge beads branch back to main.\n\nTasks:\n- Implement bd sync --merge command\n- Implement bd sync --status command\n- Implement bd sync --auto-merge (optional, for automation)\n- Detect merge conflicts and provide guidance\n- Show commit diff between branches\n- Verify main branch is clean before merge\n- Push merged changes to remote\n\nEstimated effort: 2-3 days","acceptance_criteria":"- bd sync --merge successfully merges beads branch\n- Conflicts detected with helpful error message\n- bd sync --status shows clear diff\n- Works with protected main (user must have push access)\n- Git history is clean (no unnecessary merge commits)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.580873-08:00","updated_at":"2025-11-02T17:12:34.620481-08:00","closed_at":"2025-11-02T17:12:34.620486-08:00","source_repo":".","dependencies":[{"issue_id":"bd-3396","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.376916-08:00","created_by":"stevey"}]} -{"id":"bd-3433","content_hash":"008abd738af658ad14ed991c069e15264239a1aa08804c694c93b4c214223f99","title":"Implement topological sort for import ordering","description":"Refactor upsertIssues() to sort issues by hierarchy depth before batch creation. Ensures parents are created before children, fixing latent bug where parent-child pairs in same batch can fail if ordered wrong. Sort by dot count, create in depth-order batches (0β†’1β†’2β†’3).","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-04T12:31:42.22005-08:00","updated_at":"2025-11-05T00:08:42.812154-08:00","closed_at":"2025-11-05T00:08:42.812156-08:00","source_repo":"."} -{"id":"bd-35c7","content_hash":"28e00b560e08ecbf061e998836f8a1dd11392680b273589341c13e6b267df37c","title":"Add label-based filtering to bd ready command","description":"Allow filtering ready work by labels to help organize work by sprint, week, or category.\n\nExample usage:\n bd ready --label week1-2\n bd ready --label frontend,high-priority\n\nThis helps teams organize work into batches and makes it easier for agents to focus on specific categories of work.\n\nImplementation notes:\n- Add --label flag to ready command\n- Support comma-separated labels (AND logic)\n- Should work with existing ready work logic (unblocked issues)","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-03T18:10:18.976536-08:00","updated_at":"2025-11-03T22:27:30.614911-08:00","closed_at":"2025-11-03T22:27:30.614911-08:00","source_repo":"."} -{"id":"bd-36320a04","content_hash":"b98c70f527050b2f0007b4ba64e4fa96fdd56bd2e4f07b71c6d8aa4eba7a1815","title":"Add mutation channel to internal/rpc/server.go","description":"Add mutationChan chan MutationEvent to Server struct. Emit events on CreateIssue, UpdateIssue, DeleteIssue, AddComment. Non-blocking send with default case for full channel.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.860173-07:00","updated_at":"2025-10-31T18:31:27.928693-07:00","closed_at":"2025-10-31T18:31:27.928693-07:00","source_repo":"."} -{"id":"bd-363f","content_hash":"ac5d74a93d0eebb70f9a2eaed4ed637a90be138c75e5d9ceef066165233549be","title":"Document bd-wasm installation and usage","description":"Create documentation for bd-wasm:\n- Update README with npm installation instructions\n- Add troubleshooting section for WASM-specific issues\n- Document known limitations vs native bd\n- Add examples for Claude Code Web sandbox usage\n- Update INSTALLING.md with bd-wasm option","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T21:58:07.305711-08:00","updated_at":"2025-11-05T00:55:48.756684-08:00","closed_at":"2025-11-05T00:55:48.756687-08:00","source_repo":".","dependencies":[{"issue_id":"bd-363f","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.530675-08:00","created_by":"stevey"}]} -{"id":"bd-36870264","content_hash":"d85eac459267257453cd22af0ab79babb86a26b7380584d0625c12a5302e7eb1","title":"Enforce daemon singleton per workspace with file locking","description":"Agent in ~/src/wyvern discovered 4 simultaneous daemon processes running, causing infinite directory recursion (.beads/.beads/.beads/...). Each daemon used relative paths and created nested .beads/ directories.\n\nRoot cause: No singleton enforcement. Multiple `bd daemon` processes can start in same workspace.\n\nExpected: One daemon per workspace (each workspace = separate .beads/ dir with bd.sock)\nActual: Multiple daemons can run simultaneously in same workspace\n\nNote: Separate git clones = separate workspaces = separate daemons (correct). Git worktrees share .beads/ and have known limitations (documented, use --no-daemon).","design":"Use flock (file locking) on daemon socket or database file to enforce singleton:\n\n1. On daemon start, attempt exclusive lock on .beads/bd.sock or .beads/daemon.lock\n2. If lock held by another process, refuse to start (exit with clear error)\n3. Hold lock for lifetime of daemon process\n4. Release lock on daemon shutdown\n\nAlternative: Use PID file with stale detection (check if PID is still running)\n\nImplementation location: Daemon startup code in cmd/bd/ or internal/daemon/","acceptance_criteria":"1. Starting second daemon process in same workspace fails with clear error\n2. Test: Start daemon, attempt second start, verify failure\n3. Killing daemon releases lock, allowing new daemon to start\n4. No infinite .beads/ directory recursion possible\n5. Works correctly with auto-start mechanism","notes":"## Fix Summary\n\nSuccessfully prevented the nested .beads/.beads/ recursion bug by implementing two safeguards:\n\n1. **Path Canonicalization in FindDatabasePath()** (beads.go):\n - Added filepath.Abs() + filepath.EvalSymlinks() to normalize all database paths\n - Prevents relative path edge cases that create nested directories\n - Ensures all daemons see the same canonical path\n\n2. **Nested Directory Detection** (daemon_lifecycle.go):\n - Added explicit check for \".beads/.beads\" pattern in setupDaemonLock()\n - Fails fast with clear error message if nested structure detected\n - Provides user hints about proper usage\n\n## Root Cause\n\nThe daemon lock (added Oct 22, 2025) correctly prevents simultaneous daemons in the SAME workspace. However, when BEADS_DB used a relative path (e.g., \".beads/beads.db\") from inside the .beads directory, FindDatabasePath() would resolve it to a nested path creating a separate workspace:\n- First daemon: /workspace/.beads/beads.db\n- Second daemon from .beads/: /workspace/.beads/.beads/beads.db ← Different lock file!\n\n## Testing\n\nAll acceptance criteria passed:\nβœ… 1. Second daemon start fails with \"daemon already running\" error\nβœ… 2. Killing daemon releases lock, new daemon can start \nβœ… 3. No infinite .beads/ recursion possible (tested nested BEADS_DB path)\nβœ… 4. Works with auto-start mechanism\n\nThe fix addresses the edge case while maintaining the existing lock mechanism's correctness.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-25T23:13:12.269549-07:00","updated_at":"2025-11-01T19:46:06.230339-07:00","closed_at":"2025-11-01T19:46:06.230339-07:00","source_repo":"."} -{"id":"bd-373c","content_hash":"58cdfdb7ea1067aa86d8db19993cdfda4f686ade37936903fc34fd511e483ff2","title":"Daemon crashes silently when multiple .db files exist in .beads/","description":"When daemon detects multiple .db files (after filtering out .backup and vc.db files), it writes error details to .beads/daemon-error file before exiting.\n\nThe error file is checked when:\n1. Daemon discovery fails to connect (internal/daemon/discovery.go)\n2. Auto-start fails to yield a running daemon (cmd/bd/main.go)\n3. Daemon list shows 'daemon not responding' error\n\nThis makes the error immediately visible to users without requiring them to check daemon logs.\n\nFile created: cmd/bd/daemon.go (writes daemon-error on multiple .db detection)\nFiles modified: \n- internal/daemon/discovery.go (reads daemon-error and surfaces in DaemonInfo.Error)\n- cmd/bd/main.go (displays daemon-error when auto-start fails)\n\nTesting: Create multiple .db files in .beads/, start daemon, verify error file created and shown in bd daemons list","notes":"Root cause: Daemon exits with os.Exit(1) when multiple .db files detected (daemon.go:1381), but error only goes to daemon log file. User sees 'daemon not responding' without knowing why.\n\nCurrent detection:\n- daemon.go filters out .backup and vc.db files\n- bd doctor detects multiple databases\n- Error message tells user to run 'bd init' or manually remove\n\nProblem: Error is not user-visible unless they check daemon logs.\n\nProposed fix options:\n1. Surface the error in 'bd info' and 'bd daemons list' output\n2. Add a hint in error messages to run 'bd doctor' when daemon fails\n3. Make daemon write error to a .beads/daemon-error file that gets checked\n4. Improve 'bd doctor' to run automatically when daemon is unhealthy","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-31T21:08:03.389259-07:00","updated_at":"2025-11-01T11:13:48.029427-07:00","closed_at":"2025-11-01T11:13:48.029427-07:00","source_repo":".","dependencies":[{"issue_id":"bd-373c","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:03.390022-07:00","created_by":"stevey"}]} -{"id":"bd-374e","content_hash":"468235095d0f60303f97d0c681d8ff390e3616731664853fab4afe55f4c1e1a3","title":"WASM integration testing","description":"Comprehensive testing of WASM build. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Unit tests for WASM module\n- [ ] Integration tests with real JSONL files\n- [ ] Test all bd commands for parity\n- [ ] Performance benchmarks\n- [ ] Test in actual Claude Code Web sandbox\n- [ ] Document any limitations\n\n## Test Coverage Target\n- \u003e90% of bd CLI commands work identically","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-02T18:33:31.342184-08:00","updated_at":"2025-11-05T00:55:48.756994-08:00","closed_at":"2025-11-05T00:55:48.756996-08:00","source_repo":".","dependencies":[{"issue_id":"bd-374e","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.342928-08:00","created_by":"daemon"}]} -{"id":"bd-379","content_hash":"d1edf5009291680270e9bad61ef0d6e80fe1e24fa90f71fc80748a8bd52b32d2","title":"Implement `bd setup cursor` for Cursor IDE integration","description":"Create a `bd setup cursor` command that integrates Beads workflow into Cursor IDE via .cursorrules file. Unlike Claude Code (which has hooks), Cursor uses a static rules file to provide context to its AI.","design":"## Implementation\n\nCreate `cursor` subcommand in `cmd/bd/setup.go` that manages `.cursorrules` integration:\n\n### Command Interface\n```bash\nbd setup cursor # Install/update Cursor integration\nbd setup cursor --check # Verify .cursorrules has bd section\nbd setup cursor --remove # Remove bd section from .cursorrules\n```\n\n### Behavior\n\n**If `.cursorrules` doesn't exist:**\n- Create new file with complete bd rules template\n- Mark sections for easy identification\n\n**If `.cursorrules` exists:**\n- Check if bd section already exists (look for marker comments)\n- If not exists: append bd section\n- If exists: update in place (preserve user customizations outside bd section)\n- Backup original with `.cursorrules.backup` suffix\n\n### .cursorrules Template\n\n```markdown\n# Beads Issue Tracking\n# Auto-generated by 'bd setup cursor' - do not remove these markers\n# BEGIN BEADS INTEGRATION\n\nThis project uses [Beads (bd)](https://github.com/steveyegge/beads) for issue tracking.\n\n## Core Rules\n- Track ALL work in bd (never use markdown TODOs or comment-based task lists)\n- Use `bd ready` to find available work\n- Use `bd create` to track new issues/tasks/bugs\n- Use `bd sync` at end of session to sync with git remote\n- Git hooks auto-sync on commit/merge\n\n## Quick Reference\n```bash\nbd prime # Load complete workflow context\nbd ready # Show issues ready to work (no blockers)\nbd list --status=open # List all open issues\nbd create --title=\"...\" --type=task # Create new issue\nbd update \u003cid\u003e --status=in_progress # Claim work\nbd close \u003cid\u003e # Mark complete\nbd dep \u003cfrom\u003e \u003cto\u003e # Add dependency (from blocks to)\nbd sync # Sync with git remote\n```\n\n## Workflow\n1. Check for ready work: `bd ready`\n2. Claim an issue: `bd update \u003cid\u003e --status=in_progress`\n3. Do the work\n4. Mark complete: `bd close \u003cid\u003e`\n5. Sync: `bd sync` (or let git hooks handle it)\n\n## Context Loading\nRun `bd prime` to get complete workflow documentation in AI-optimized format (~1-2k tokens).\n\nFor detailed docs: see AGENTS.md, QUICKSTART.md, or run `bd --help`\n\n# END BEADS INTEGRATION\n```\n\n### Detection Logic\n\n```go\nfunc setupCursor() error {\n cursorRulesPath := \".cursorrules\"\n \n // Check if file exists\n content, err := os.ReadFile(cursorRulesPath)\n if err != nil {\n if os.IsNotExist(err) {\n // Create new file\n return createCursorRules(cursorRulesPath)\n }\n return err\n }\n \n // Check if bd section exists\n if hasBeadsSection(string(content)) {\n // Update existing section\n return updateBeadsSection(cursorRulesPath, string(content))\n } else {\n // Append new section\n return appendBeadsSection(cursorRulesPath, string(content))\n }\n}\n\nfunc hasBeadsSection(content string) bool {\n return strings.Contains(content, \"BEGIN BEADS INTEGRATION\")\n}\n```\n\n## Files\n- `cmd/bd/setup.go` - Add cursor subcommand\n- `cmd/bd/setup_cursor.go` - Cursor-specific logic\n- `cmd/bd/setup_cursor_test.go` - Tests\n- Template stored as Go string constant\n\n## Differences from Claude Setup\n\n| Aspect | Claude | Cursor |\n|--------|--------|--------|\n| **Integration file** | `.claude/commands/`, `.claude/hooks/` | `.cursorrules` |\n| **Auto-refresh** | Hooks call `bd prime` | Static rules (manual refresh) |\n| **Setup complexity** | Multiple files | Single file |\n| **Update frequency** | Dynamic (hooks) | Static (updated via `bd setup cursor`) |","acceptance_criteria":"- `bd setup cursor` creates/updates .cursorrules\n- Idempotent (safe to run multiple times)\n- Preserves non-bd content in .cursorrules\n- Backs up existing .cursorrules before modifying\n- `bd setup cursor --check` verifies integration\n- Markers allow updating bd section without affecting user content\n- Unit tests for template insertion/update logic\n- Documentation in AGENTS.md mentions Cursor setup","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-11T23:32:22.170083-08:00","updated_at":"2025-11-11T23:32:22.170083-08:00","source_repo":"."} -{"id":"bd-37dd","content_hash":"cd19e661a3d2b923145dd61e7f1f07bdc6bf93136967fd2543b48b3a8b4134e1","title":"Add topological sort utility functions","description":"Create internal/importer/sort.go with utilities for depth-based sorting of issues. Functions: GetHierarchyDepth(id), SortByDepth(issues), GroupByDepth(issues). Include stable sorting for same-depth issues.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:31:42.309207-08:00","updated_at":"2025-11-05T00:08:42.812378-08:00","closed_at":"2025-11-05T00:08:42.81238-08:00","source_repo":"."} -{"id":"bd-381d7f6c","content_hash":"24b00d276bd245aec3e6dfb6378457e785ac6a01538eba05450dd65dba993178","title":"Audit Current Cache Usage","description":"Understand exactly what code depends on the storage cache","acceptance_criteria":"- Document showing all cache dependencies\n- Confirmation that removing cache won't break MCP\n- List of tests that need updating\n\nFiles to examine:\n- internal/rpc/server_cache_storage.go (cache implementation)\n- internal/rpc/client.go (how req.Cwd is set)\n- internal/rpc/server_*.go (all getStorageForRequest calls)\n- integrations/beads-mcp/ (MCP multi-repo logic)\n\nTasks:\n- Document all callers of getStorageForRequest()\n- Verify req.Cwd is only set by RPC client for database discovery\n- Confirm MCP server doesn't rely on multi-repo cache behavior\n- Check if any tests assume multi-repo routing\n- Review environment variables: BEADS_DAEMON_MAX_CACHE_SIZE, BEADS_DAEMON_CACHE_TTL, BEADS_DAEMON_MEMORY_THRESHOLD_MB","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T23:01:15.172045-07:00","updated_at":"2025-10-30T17:12:58.214409-07:00","closed_at":"2025-10-28T10:47:37.87529-07:00","source_repo":"."} -{"id":"bd-3852","content_hash":"bc2640e4d1c60e0b7a7c3b6d49cb05292f50facb5d4ea3887ba8c414aa7ffef3","title":"Add orphan detection migration","description":"Create migration to detect orphaned children in existing databases. Query: SELECT id FROM issues WHERE id LIKE '%.%' AND substr(id, 1, instr(id || '.', '.') - 1) NOT IN (SELECT id FROM issues). Log results, let user decide action (delete orphans or convert to top-level).","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-04T12:32:30.727044-08:00","updated_at":"2025-11-04T12:32:30.727044-08:00","source_repo":"."} -{"id":"bd-39o","content_hash":"36d58121cc9218718d262a1991ee84695af722d2823cf9c8415c2dfdd44fb390","title":"Rename last_import_hash metadata key to jsonl_content_hash","description":"The metadata key 'last_import_hash' is misleading because it's updated on both import AND export (sync.go:614, import.go:320).\n\nBetter names:\n- jsonl_content_hash (more accurate)\n- last_sync_hash (clearer intent)\n\nThis is a breaking change requiring migration of existing metadata values.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:31:07.568739-05:00","updated_at":"2025-11-20T21:31:07.568739-05:00","source_repo":".","dependencies":[{"issue_id":"bd-39o","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:07.5698-05:00","created_by":"daemon"}]} -{"id":"bd-3b2fe268","content_hash":"601c1649b6cce47b7ff248cd07bf347c7c8ed9073b53ad2b425fe38edbf5dc2e","title":"Add fsnotify dependency to go.mod","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.429763-07:00","updated_at":"2025-11-06T19:36:13.969438-08:00","closed_at":"2025-11-06T19:27:34.921866-08:00","source_repo":"."} -{"id":"bd-3b7f","content_hash":"24c22ea6863edee2b6269e178a9966e68295baa265595b4ba813b68fc67020ac","title":"Add tests for extracted modules","description":"Create tests for migrations.go, hash_ids.go, batch_ops.go, and validators.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.88933-07:00","updated_at":"2025-11-01T23:00:37.751004-07:00","closed_at":"2025-11-01T23:00:37.751004-07:00","source_repo":"."} -{"id":"bd-3bg","content_hash":"d31c94f3a5ea5bc675037d269f3edb255aba01caa7329a7f9df76a9596e30d81","title":"Add performance optimization to hasJSONLChanged with mtime fast-path","description":"hasJSONLChanged() reads entire JSONL file to compute SHA256 hash on every check. For large databases (50MB+), this is expensive and called frequently by daemon.\n\nOptimization: Check mtime first as fast-path. Only compute hash if mtime changed. This catches git operations (mtime changes but content doesn't) while avoiding expensive hash computation in common case (mtime unchanged = content unchanged).\n\nPerformance impact: 99% of checks will use fast path, only git operations need slow path.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T21:31:04.577264-05:00","updated_at":"2025-11-20T21:33:31.499918-05:00","closed_at":"2025-11-20T21:33:31.499918-05:00","source_repo":".","dependencies":[{"issue_id":"bd-3bg","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:04.578768-05:00","created_by":"daemon"}]} -{"id":"bd-3d844c58","content_hash":"e6ed1b4d53fa06b4ba8221ed6e0c213044ab75a387453267cf4ee0474f7b3400","title":"Implement content-hash based collision resolution for deterministic convergence","description":"The current collision resolution uses creation timestamps to decide which issue to keep vs. remap. This is non-deterministic when two clones create issues at nearly the same time.\n\nRoot cause of bd-71107098:\n- Clone A creates test-1=\"Issue from clone A\" at T0\n- Clone B creates test-1=\"Issue from clone B\" at T0+30ms\n- Clone B syncs first, remaps Clone A's to test-2\n- Clone A syncs second, sees collision, remaps Clone B's to test-2\n- Result: titles are swapped between clones\n\nSolution:\n- Use content-based hashing (title + description + priority + type)\n- Deterministic winner: always keep issue with lower hash\n- Same collision on different clones produces same result (idempotent)\n\nImplementation:\n- Modify ScoreCollisions in internal/storage/sqlite/collision.go\n- Replace timestamp-based scoring with content hash comparison\n- Ensure hash function is stable across platforms","status":"closed","priority":0,"issue_type":"task","created_at":"2025-10-28T17:04:06.145646-07:00","updated_at":"2025-10-30T17:12:58.225476-07:00","closed_at":"2025-10-28T19:20:09.943023-07:00","source_repo":".","dependencies":[{"issue_id":"bd-3d844c58","depends_on_id":"bd-71107098","type":"blocks","created_at":"2025-10-31T19:38:09.203365-07:00","created_by":"stevey"}]} -{"id":"bd-3djj","content_hash":"7b34795bb46e12c728bba56ee9b0dc78d55a42d896e77034592c458b200a01c3","title":"Add aider integration for beads issue tracking","description":"Based on GH#206 discussion, add aider-specific integration to help aider users work with beads. Aider requires explicit user command invocation via /run, unlike Claude Code which executes autonomously. Need to create setup command, configuration template, and documentation that accounts for aider's human-in-the-loop workflow.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-23T15:08:17.314598-08:00","updated_at":"2025-11-23T15:13:33.84131-08:00","closed_at":"2025-11-23T15:13:33.84131-08:00","source_repo":"."} -{"id":"bd-3e307cd4","content_hash":"f243be831ac416cc072ad5d6b056450829c1eca76a638f1559936df942c30ceb","title":"File change test issue","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T19:11:28.425601-07:00","updated_at":"2025-10-31T12:00:43.176605-07:00","closed_at":"2025-10-31T12:00:43.176605-07:00","source_repo":"."} -{"id":"bd-3e3b","content_hash":"a6ff8c838c6cce5daf006d9af5c60d869eb1a3f712a29b111fd8a36308bc849b","title":"Add circular dependency detection to bd doctor","description":"Added cycle detection as Check #10 in bd doctor command. Uses same recursive CTE query as DetectCycles() to find circular dependencies. Reports error status with count and fix suggestion if cycles found.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-01T20:18:23.416056-07:00","updated_at":"2025-11-01T20:18:26.76113-07:00","closed_at":"2025-11-01T20:18:26.76113-07:00","source_repo":"."} -{"id":"bd-3e9ddc31","content_hash":"4e03660281dbe2c069617fc8d723d546d6e5eb386142c0359b862747867a1b90","title":"Replace getStorageForRequest with Direct Access","description":"Replace all getStorageForRequest(req) calls with s.storage","acceptance_criteria":"- No references to getStorageForRequest() in codebase (except in deleted file)\n- All handlers use s.storage directly\n- Code compiles without errors\n\nFiles to update:\n- internal/rpc/server_issues_epics.go (~8 calls)\n- internal/rpc/server_labels_deps_comments.go (~4 calls)\n- internal/rpc/server_compact.go (~2 calls)\n- internal/rpc/server_export_import_auto.go (~2 calls)\n- internal/rpc/server_routing_validation_diagnostics.go (~1 call)\n\nPattern: store, err := s.getStorageForRequest(req) β†’ store := s.storage","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T23:20:10.393759-07:00","updated_at":"2025-10-30T17:12:58.21613-07:00","closed_at":"2025-10-28T14:08:38.06721-07:00","source_repo":"."} -{"id":"bd-3ee2c7e9","content_hash":"80a0101dd9082c194cd4f138dc116c0fc14d178d8afacb6b5b61ee863ee2eea7","title":"Add \"bd daemons\" command for multi-daemon management","description":"Add a new \"bd daemons\" command with subcommands to manage daemon processes across all beads repositories/worktrees. Should show all running daemons with metadata (version, workspace, uptime, last sync), allow stopping/restarting individual daemons, auto-clean stale processes, view logs, and show exclusive lock status.","design":"Subcommands:\n- list: Show all running daemons with metadata (workspace, PID, version, socket path, uptime, last activity, exclusive lock status)\n- stop \u003cpath|pid\u003e: Gracefully stop a specific daemon\n- restart \u003cpath|pid\u003e: Stop and restart daemon\n- killall: Emergency stop all daemons\n- health: Verify each daemon responds to ping\n- logs \u003cpath\u003e: View daemon logs\n\nFeatures:\n- Auto-clean stale sockets/dead processes\n- Discovery: Scan for .beads/bd.sock files + running processes\n- Communication: Use existing socket protocol, add GET /status endpoint for metadata","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-26T16:53:40.970042-07:00","updated_at":"2025-11-02T17:12:34.621017-08:00","closed_at":"2025-11-02T17:12:34.62102-08:00","source_repo":"."} -{"id":"bd-3f6a","content_hash":"7fef5b08bbb32c4f4ab7d906539a765b01f1a74d0bb71102c954a5bdec4b442e","title":"Add concurrent import race condition tests","description":"Currently no tests verify behavior when multiple clones import simultaneously with external_ref matching.\n\nScenarios to test:\n1. Two clones import same external_ref update at same time\n2. Clone A imports while Clone B updates same issue\n3. Verify transaction isolation prevents corruption\n4. Document expected behavior (last-write-wins vs timestamp-based)\n\nRelated: bd-1022\nFiles: internal/importer/external_ref_test.go","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-02T15:32:11.286956-08:00","updated_at":"2025-11-02T16:11:16.127009-08:00","closed_at":"2025-11-02T16:11:16.127009-08:00","source_repo":"."} -{"id":"bd-3f80d9e0","content_hash":"6abdab20b716cb5f605f678d0f605bb07c5f9683d573ea724001d6f94177088e","title":"Improve internal/daemon test coverage (currently 22.5%)","description":"Daemon functionality needs better coverage:\n- Auto-start behavior\n- Lock file management\n- Discovery mechanisms\n- Connection handling\n- Error recovery\n\nCurrent coverage: 58.3% (improved from 22.5% as of Nov 2025)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:30.832728-07:00","updated_at":"2025-11-20T12:40:11.70644-05:00","closed_at":"2025-11-15T14:13:47.303529-08:00","source_repo":"."} -{"id":"bd-3sz0","content_hash":"50d2315d5561c2b89acaa7c6ad84e7b2b0f5155f796bbbeeb862818c4b331423","title":"Auto-repair stale merge driver configs with invalid placeholders","description":"Old bd versions (\u003c0.24.0) installed merge driver with invalid placeholders %L %R instead of %A %B. Add detection to bd doctor --fix: check if git config merge.beads.driver contains %L or %R, auto-repair to 'bd merge %A %O %A %B'. One-time migration for users who initialized with old versions.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-21T23:16:10.762808-08:00","updated_at":"2025-11-21T23:16:28.892655-08:00","source_repo":".","dependencies":[{"issue_id":"bd-3sz0","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:10.763612-08:00","created_by":"daemon"}]} -{"id":"bd-3tfh","content_hash":"d8a889d96a2a236db3d6c60d239878ffee607e6c91b2d6fc6dd85bfca938da03","title":"Benchmark Helper Functions","description":"Extend existing benchmark helpers in internal/storage/sqlite/bench_helpers_test.go (or create if organizing separately).\n\nExisting helper (in compact_bench_test.go):\n- setupBenchDB(tb) - Creates temp SQLite database with basic config\n * Used by compact and cycle benchmarks\n * Returns (*SQLiteStorage, cleanup func())\n\nNew helpers to add:\n- setupLargeBenchDB(b *testing.B) storage.Storage\n * Creates 10K issue database using LargeSQLite fixture\n * Returns configured storage instance\n \n- setupXLargeBenchDB(b *testing.B) storage.Storage\n * Creates 20K issue database using XLargeSQLite fixture\n * Returns configured storage instance\n\nImplementation options:\n1. Add to existing compact_bench_test.go (co-located with setupBenchDB)\n2. Create new bench_helpers_test.go for organization\n\nBoth approaches:\n- Build tag: //go:build bench\n- Uses fixture generator from internal/testutil/fixtures\n- Follows existing setupBenchDB() pattern\n- Handles database cleanup\n\nThese helpers reduce duplication across new benchmark functions and provide consistent large-scale database setup.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:22:55.694834-08:00","updated_at":"2025-11-13T23:13:41.244758-08:00","closed_at":"2025-11-13T23:13:41.244758-08:00","source_repo":".","dependencies":[{"issue_id":"bd-3tfh","depends_on_id":"bd-m62x","type":"blocks","created_at":"2025-11-13T22:24:02.632994-08:00","created_by":"daemon"}]} -{"id":"bd-40a0","content_hash":"75611f4fb108e11cb4b98ded732fe94dd41ed700d8058b419e6fc796cf152391","title":"bd doctor should check for multiple DBs, multiple JSONLs, daemon health","description":"","design":"\nCurrently bd doctor only checks:\n- .beads/ directory exists\n- Database version vs CLI version \n- ID format (hash vs sequential)\n- CLI version vs latest GitHub release\n\nIt should ALSO check for operational issues that cause silent failures:\n\n1. **Multiple database files** (*.db excluding backups and vc.db)\n - Warn if multiple *.db files found (ambiguous which to use)\n - Suggest running 'bd migrate' or manually removing old DBs\n\n2. **Multiple JSONL files** \n - Check for both issues.jsonl and beads.jsonl\n - Warn about ambiguity, suggest standardizing on one\n\n3. **Daemon health** (integrate bd daemons health)\n - Check if daemon running for this workspace\n - Detect version mismatches between daemon and CLI\n - Detect zombie daemons (running but unresponsive)\n - Detect stale daemon.pid files\n\n4. **Database-JSONL sync issues**\n - Check if JSONL is newer than last import\n - Warn if they're out of sync\n\n5. **Permissions issues**\n - Check if .beads/ directory is writable\n - Check if database file is readable/writable\n\nImplementation approach:\n- Add new check functions to doctor.go\n- Reuse logic from bd daemons health\n- Keep checks fast (\u003c 1 second total)\n- Output actionable fixes for each issue\n","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-10-31T21:16:47.042913-07:00","updated_at":"2025-10-31T21:21:27.093525-07:00","closed_at":"2025-10-31T21:21:27.093525-07:00","source_repo":"."} -{"id":"bd-4462","content_hash":"a3f7ca75994ca4efb8b5b6ae47ecf5b8544ad33510e4c6f72663efd8c2737f74","title":"Test basic bd commands in WASM (init, create, list)","description":"Compile and verify basic bd functionality works in WASM:\n- Test bd init --quiet\n- Test bd create with simple issue\n- Test bd list --json output\n- Verify SQLite database creation and queries work\n- Document any runtime issues or workarounds needed","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.291771-08:00","updated_at":"2025-11-02T23:07:10.273212-08:00","closed_at":"2025-11-02T23:07:10.273212-08:00","source_repo":".","dependencies":[{"issue_id":"bd-4462","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.448668-08:00","created_by":"stevey"},{"issue_id":"bd-4462","depends_on_id":"bd-b4b0","type":"blocks","created_at":"2025-11-02T22:23:55.596771-08:00","created_by":"stevey"}]} -{"id":"bd-44d0","content_hash":"a20f23c823907e546f852c1bbb0c09166100b2569d4a1192f0a7288ee5d918e8","title":"WASM port of bd for Claude Code Web sandboxes","description":"Enable beads to work in Claude Code Web sandboxes by compiling bd to WebAssembly.\n\n## Problem\nClaude Code Web sandboxes cannot install bd CLI due to network restrictions:\n- GitHub releases return 403\n- go install fails with DNS errors\n- Binary cannot be downloaded\n\n## Solution\nCompile bd Go codebase to WASM, publish to npm as drop-in replacement.\n\n## Technical Approach\n- Use GOOS=js GOARCH=wasm to compile bd\n- modernc.org/sqlite already supports js/wasm target\n- Publish to npm as bd-wasm package\n- Full feature parity with bd CLI\n\n## Success Criteria\n- bd-wasm installs via npm in web sandbox\n- All core bd commands work identically\n- JSONL output matches native bd\n- Performance within 2x of native","notes":"WASM port abandoned - Claude Code Web has full VMs not browser restrictions. Better: npm + native binary","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-11-02T18:32:27.660794-08:00","updated_at":"2025-11-02T23:36:38.679515-08:00","closed_at":"2025-11-02T23:36:38.679515-08:00","source_repo":"."} -{"id":"bd-46381404","content_hash":"580d0d38d9c888804627d6a9cb951fab92935f67d6247156a24759ccfc911f0d","title":"Test database naming","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T18:27:28.309676-07:00","updated_at":"2025-10-31T12:00:43.185201-07:00","closed_at":"2025-10-31T12:00:43.185201-07:00","source_repo":"."} -{"id":"bd-49kw","content_hash":"32637477ea60088882c4637c9153af420f5843cab488a50af255b1c33b5db69e","title":"Workaround for FastMCP outputSchema bug in Claude Code","description":"The beads MCP server (v0.23.1) successfully connects to Claude Code, but all tools fail to load with a schema validation error due to a bug in FastMCP 2.13.1.\n\nError: \"Invalid literal value, expected \\\"object\\\"\" in outputSchema.\n\nRoot Cause: FastMCP generates outputSchema with $ref at root level without \"type\": \"object\" for self-referential models (Issue).\n\nWorkaround: Use slash commands (/beads:ready) or wait for FastMCP fix.\n","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-20T18:55:39.041831-05:00","updated_at":"2025-11-20T18:55:39.041831-05:00","source_repo":"."} -{"id":"bd-4aao","content_hash":"67e1bab2ec59b16ea0daf6220b137588a6704793584663d1cf6d58765d41437e","title":"Fix failing integration tests in beads-mcp","description":"The `beads-mcp` test suite has failures in `tests/test_bd_client_integration.py` (assertion error in `test_init_creates_beads_directory`) and errors in `tests/test_worktree_separate_dbs.py` (setup failures finding database). These need to be investigated and fixed to ensure a reliable CI baseline.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:53:28.4803-05:00","updated_at":"2025-11-20T18:53:28.4803-05:00","source_repo":"."} -{"id":"bd-4aeed709","content_hash":"3ab290915c117ec902bda1761e8c27850512f3fd4b494a93546c44b397d573a3","title":"bd resolve-conflicts - Git merge conflict resolver","description":"Automatically resolve JSONL merge conflicts.\n\nModes:\n- Mechanical: ID remapping (no AI)\n- AI-assisted: Smart merge/keep decisions\n- Interactive: Review each conflict\n\nHandles \u003c\u003c\u003c\u003c\u003c\u003c\u003c conflict markers in .beads/beads.jsonl\n\nFiles: cmd/bd/resolve_conflicts.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T12:40:11.707308-05:00","updated_at":"2025-11-20T12:40:11.707308-05:00","closed_at":"2025-10-28T15:47:33.037021-07:00","source_repo":"."} -{"id":"bd-4b6u","content_hash":"352f8de1093c5d3bc53a4069c5a9c14a788f6214207d2353500d7bd056179800","title":"Update docs with multi-repo patterns","description":"Update AGENTS.md, README.md, QUICKSTART.md with multi-repo patterns. Document: config options, routing behavior, backward compatibility, troubleshooting, best practices.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:04:30.18358-08:00","updated_at":"2025-11-06T19:53:04.721589-08:00","closed_at":"2025-11-06T19:53:04.721589-08:00","source_repo":".","dependencies":[{"issue_id":"bd-4b6u","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.297009-08:00","created_by":"daemon"}]} -{"id":"bd-4ba5908b","content_hash":"70b8d577e5f65acb215f1c4caf18fdafcbd124db14fbc0e70132eea2b1848a93","title":"Implement content-hash based collision resolution for deterministic convergence","description":"The current collision resolution uses creation timestamps to decide which issue to keep vs. remap. This is non-deterministic when two clones create issues at nearly the same time.\n\nRoot cause of bd-71107098:\n- Clone A creates test-1=\"Issue from clone A\" at T0\n- Clone B creates test-1=\"Issue from clone B\" at T0+30ms\n- Clone B syncs first, remaps Clone A's to test-2\n- Clone A syncs second, sees collision, remaps Clone B's to test-2\n- Result: titles are swapped between clones\n\nSolution:\n- Use content-based hashing (title + description + priority + type)\n- Deterministic winner: always keep issue with lower hash\n- Same collision on different clones produces same result (idempotent)\n\nImplementation:\n- Modify ScoreCollisions in internal/storage/sqlite/collision.go\n- Replace timestamp-based scoring with content hash comparison\n- Ensure hash function is stable across platforms","notes":"Rename detection successfully implemented and tested!\n\n**What was implemented:**\n1. Content-hash based rename detection in DetectCollisions\n2. When importing JSONL, if an issue has different ID but same content as DB issue, treat as rename\n3. Delete old ID and accept new ID from JSONL\n4. Added post-import re-export in sync command to flush rename changes\n5. Added post-import commit to capture rename changes\n\n**Test results:**\nTestTwoCloneCollision now shows full convergence:\n- Clone A: test-2=\"Issue from clone A\", test-1=\"Issue from clone B\"\n- Clone B: test-1=\"Issue from clone B\", test-2=\"Issue from clone A\"\n\nBoth clones have **identical content** (titles match IDs correctly). Only timestamps differ (expected).\n\n**What remains:**\n- Test still expects exact JSON match including timestamps\n- Could normalize timestamp comparison, but content convergence is the critical success metric\n- The two-clone collision workflow now works without data corruption!","status":"closed","priority":0,"issue_type":"task","created_at":"2025-10-28T17:04:11.530026-07:00","updated_at":"2025-10-30T17:12:58.225987-07:00","closed_at":"2025-10-28T17:18:27.777019-07:00","source_repo":".","dependencies":[{"issue_id":"bd-4ba5908b","depends_on_id":"bd-71107098","type":"blocks","created_at":"2025-10-28T17:04:18.149604-07:00","created_by":"daemon"}]} -{"id":"bd-4c18","content_hash":"d3d162cefdf9f3637ffb0ead341f48ffefe50fdf5e6ff9edc3ffcd05cdd703b4","title":"bd delete fails to find closed issues","description":"## Steps to Reproduce\n1. Close some issues with `bd close`\n2. Try to delete them with `bd delete \u003cids\u003e --force`\n3. Get error \"issues not found\"\n\n## Expected Behavior\nShould delete the closed issues\n\n## Actual Behavior\n```\nError: issues not found: bd-74ee, bd-9b13, bd-72w, bd-149, bd-5iv, bd-78w\n```\n\nBut `bd list --status closed --json` shows they exist.\n\n## Root Cause\nLikely the delete command is only looking for open issues, or there's a race condition with auto-import.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-03T20:57:31.763179-08:00","updated_at":"2025-11-03T21:31:18.677629-08:00","closed_at":"2025-11-03T21:31:18.677629-08:00","source_repo":"."} -{"id":"bd-4cyb","content_hash":"1d02ccb8a552b2dec49bdfc3a7ed70b3307bcdebcaa8a563902a86a8bdcf7507","title":"Test graceful degradation when server unavailable","description":"Verify that agents continue working normally when Agent Mail server is stopped or unreachable.\n\nAcceptance Criteria:\n- Agent detects server unavailable on startup\n- Logs \"falling back to Beads-only mode\"\n- All bd commands work normally\n- Agent can claim issues (no reservations, like today)\n- Git sync operates as normal\n- No errors or crashes\n\nSuccess Metric: Zero functional difference when Agent Mail unavailable","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-07T22:42:00.094481-08:00","updated_at":"2025-11-08T00:20:29.841174-08:00","closed_at":"2025-11-08T00:20:29.841174-08:00","source_repo":".","dependencies":[{"issue_id":"bd-4cyb","depends_on_id":"bd-6hji","type":"blocks","created_at":"2025-11-07T23:03:53.054449-08:00","created_by":"daemon"}]} -{"id":"bd-4d7fca8a","content_hash":"5da2fc1fc0cbade7e4cfaf7fdb87b58487ce7661443e6ad4083f2f8de655e206","title":"Add tests for internal/utils package","description":"Currently 0.0% coverage. Need tests for utility functions including issue ID parsing and validation.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:24.066403-07:00","updated_at":"2025-11-08T22:42:08.860747-08:00","closed_at":"2025-11-08T17:57:28.956561-08:00","source_repo":".","dependencies":[{"issue_id":"bd-4d7fca8a","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-29T19:52:05.52888-07:00","created_by":"import-remap"},{"issue_id":"bd-4d7fca8a","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-29T19:52:05.529565-07:00","created_by":"import-remap"},{"issue_id":"bd-4d7fca8a","depends_on_id":"bd-0dcea000","type":"blocks","created_at":"2025-10-29T19:52:05.529982-07:00","created_by":"import-remap"}]} -{"id":"bd-4d80b7b1","content_hash":"7465ff154e916f0101dcd2aed683c2ffb72abdb3f1c8b60467a760441232d35b","title":"Investigate and upgrade to modernc.org/sqlite 1.39.1+","description":"We had to pin modernc.org/sqlite to v1.38.2 due to a FOREIGN KEY constraint regression in v1.39.1 (SQLite 3.50.4).\n\n**Issue:** [deleted:bd-cb64c226.2], GH #144\n\n**Symptom:** CloseIssue fails with \"FOREIGN KEY constraint failed (787)\" when called via MCP/daemon, but works fine via CLI.\n\n**Root Cause:** Unknown - likely stricter FK enforcement in SQLite 3.50.4 or modernc.org wrapper changes.\n\n**Workaround:** Pinned to v1.38.2 (SQLite 3.49.x)\n\n**TODO:**\n1. Monitor modernc.org/sqlite releases for fixes\n2. Check SQLite 3.50.5+ changelogs for FK-related fixes\n3. Investigate why daemon mode fails but CLI succeeds (connection reuse? transaction isolation?)\n4. Consider filing upstream issue with reproducible test case\n5. Upgrade when safe","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-24T11:49:12.836292-07:00","updated_at":"2025-11-07T14:55:51.908404-08:00","closed_at":"2025-11-07T14:55:51.908404-08:00","source_repo":"."} -{"id":"bd-4e21b5ad","content_hash":"8029d0c5b14261648d3d17d8bc26413183962eab2875772cd2585db92c0104a6","title":"Add test case for symmetric collision (both clones create same ID simultaneously)","description":"TestTwoCloneCollision demonstrates the problem, but we need a simpler unit test for the collision resolver itself.\n\nTest should verify:\n- Two issues with same ID, different content\n- Content hash determines winner deterministically \n- Result is same regardless of which clone imports first\n- No title swapping occurs\n\nThis can be a simpler test than the full integration test.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T17:46:10.046999-07:00","updated_at":"2025-10-31T12:00:43.196705-07:00","closed_at":"2025-10-31T12:00:43.196705-07:00","source_repo":"."} -{"id":"bd-4ec8","content_hash":"64d140d382b4efd1a0d67cda9a0af9a0240c013cafc4aa61f3644b74b7b1cd94","title":"Widespread double JSON encoding bug in daemon mode RPC calls","description":"Multiple CLI commands had the same double JSON encoding bug found in bd-1048. All commands that called ResolveID via RPC used string(resp.Data) instead of properly unmarshaling the JSON response. This caused IDs to retain JSON quotes (\"bd-1048\" instead of bd-1048), which then got double-encoded when passed to subsequent RPC calls.\n\nAffected commands:\n- bd show (3 instances)\n- bd dep add/remove/tree (5 instances)\n- bd label add/remove/list (3 instances)\n- bd reopen (1 instance)\n\nRoot cause: resp.Data is json.RawMessage (already JSON-encoded), so string() conversion preserves quotes.\n\nFix: Replace all string(resp.Data) with json.Unmarshal(resp.Data, \u0026id) for proper deserialization.\n\nAll commands now tested and working correctly with daemon mode.","status":"open","priority":0,"issue_type":"bug","created_at":"2025-11-02T22:33:01.632691-08:00","updated_at":"2025-11-02T22:33:01.632691-08:00","source_repo":"."} -{"id":"bd-4f582ec8","content_hash":"dbf986afd3a1641a2b701645a85cc3576888c6ecd0ecf217b16f4535448facee","title":"Test auto-start in fred","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-30T17:46:16.668088-07:00","updated_at":"2025-10-31T12:00:43.185723-07:00","closed_at":"2025-10-31T12:00:43.185723-07:00","source_repo":"."} -{"id":"bd-4ff2","content_hash":"9a36dc265788b61d5a45ab75633951f4f653b1130c1a003a66829fd28555488e","title":"Fix CI failures before 0.21.3 release","description":"CI is failing on multiple jobs:\n1. Nix flake: Tests fail due to missing git in build environment\n2. Windows tests: Need to check what's failing\n3. Linux tests: Need to check what's failing\n4. Linter errors: Many unchecked errors need fixing\n\nNeed to fix before tagging v0.21.3 release.","notes":"Fixed linter errors (errcheck, misspell), Nix flake git dependency, and import database discovery bug. Tests still failing - need to investigate further.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-01T23:52:09.244763-07:00","updated_at":"2025-11-02T12:32:57.748324-08:00","closed_at":"2025-11-02T12:32:57.748329-08:00","source_repo":"."} -{"id":"bd-4h3","content_hash":"c31e267da6b7885e45562d6b1d9176a4ea8603de218f7ffd361226e7268d283e","title":"Add test coverage for internal/git package","description":"","design":"Git package has 1 test file. Critical package needs comprehensive testing. Target: 70% coverage","acceptance_criteria":"- At least 4 test files\n- Package coverage \u003e= 70%\n- Tests cover git commands, error handling","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:23.497486-05:00","updated_at":"2025-11-20T21:21:23.497486-05:00","source_repo":".","dependencies":[{"issue_id":"bd-4h3","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.277639-05:00","created_by":"daemon"}]} -{"id":"bd-4ms","content_hash":"940d9a34e84ac71d4b2ab61a4608f5e4e54b8793c6ffc759ebc5d22e9eff26bc","title":"Multi-repo contributor workflow support","description":"Implement separate repository support for OSS contributors to prevent PR pollution while maintaining git ledger and multi-clone sync. Based on contributor-workflow-analysis.md Solution #4.","design":"See docs/contributor-workflow-analysis.md for complete design rationale.\n\nKey architecture:\n- N β‰₯ 1 repos (single repo default, multi-repo opt-in)\n- VCS-agnostic (git, jj, hg, sapling)\n- Config-based routing (no schema changes)\n- Smart caching (file mtime tracking, SQLite cache)\n- Global namespace (hash-based IDs)\n- Cross-repo dependencies supported","acceptance_criteria":"1. Zero PR pollution - contributor planning never reaches upstream\n2. Git ledger preserved - all repos VCS-tracked\n3. Backward compatible - existing single-repo workflows unchanged\n4. Sub-second query performance with polling\n5. Library API stable - transparent to downstream consumers like VC","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:19.515776-08:00","updated_at":"2025-11-05T00:08:42.812659-08:00","closed_at":"2025-11-05T00:08:42.812662-08:00","source_repo":"."} -{"id":"bd-4oob","content_hash":"882364cb36fa68515e857e0c39187a6ed7877e06bda7e60f01b8460d1f8abeeb","title":"bd-hv01: Multi-repo mode not tested with deletion tracking","description":"Problem: Test suite has no coverage for multi-repo mode. ExportToMultiRepo creates multiple JSONL files but snapshot files are hardcoded to single JSONL location.\n\nImpact: Deletion tracking likely silently broken for multi-repo users, could cause data loss.\n\nFix: Add test and update snapshot logic to handle multiple JSONL files.\n\nFiles: cmd/bd/deletion_tracking_test.go, cmd/bd/deletion_tracking.go, cmd/bd/daemon_sync.go:24-34","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-06T18:16:22.965404-08:00","updated_at":"2025-11-06T19:36:13.96995-08:00","closed_at":"2025-11-06T19:20:50.382822-08:00","source_repo":".","dependencies":[{"issue_id":"bd-4oob","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.014196-08:00","created_by":"daemon"}]} -{"id":"bd-4oqu","content_hash":"9d7a6f8fc07220e96e0d1b509579b9d7a292ffc52720b8bc78e5523743a18e38","title":"Test parent issue","description":"","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-05T13:00:39.737739-08:00","updated_at":"2025-11-05T13:01:11.635711-08:00","closed_at":"2025-11-05T13:01:11.635711-08:00","source_repo":"."} -{"id":"bd-4oqu.1","content_hash":"fbeac3089798c66a2c85aa49d5abdc050a38c3c31209599ae1f2117c8ba9f180","title":"Test child direct","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T13:00:55.992712-08:00","updated_at":"2025-11-05T13:01:11.654435-08:00","closed_at":"2025-11-05T13:01:11.654435-08:00","source_repo":"."} -{"id":"bd-4oqu.2","content_hash":"3dfea0ba8e0bfa2424411e65f9fc549af6edecb1490cee786a08d8ceff4c2ed6","title":"Test child daemon mode","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T13:01:06.642305-08:00","updated_at":"2025-11-05T13:01:11.669369-08:00","closed_at":"2025-11-05T13:01:11.669369-08:00","source_repo":"."} -{"id":"bd-4ri","content_hash":"ecd7ab50ad20a55a52ce62fca06c31b885918c3ef00d924480967d171ed8ed4a","title":"Fix TestFallbackToDirectModeEnablesFlush deadlock causing 10min test timeout","description":"## Problem\n\nTestFallbackToDirectModeEnablesFlush in direct_mode_test.go deadlocks for 9m59s before timing out, causing the entire test suite to take 10+ minutes instead of \u003c10 seconds.\n\n## Root Cause\n\nDatabase lock contention between test cleanup and flushToJSONL():\n- Test cleanup (line 36) tries to close DB via defer\n- flushToJSONL() (line 132) is still accessing DB\n- Results in deadlock: database/sql.(*DB).Close() waits for mutex while GetJSONLFileHash() holds it\n\n## Stack Trace Evidence\n\n```\ngoroutine 512 [sync.Mutex.Lock, 9 minutes]:\ndatabase/sql.(*DB).Close(0x14000643790)\n .../database/sql/sql.go:927 +0x84\ngithub.com/steveyegge/beads/cmd/bd.TestFallbackToDirectModeEnablesFlush.func1()\n .../direct_mode_test.go:36 +0xf4\n\nWhile goroutine running flushToJSONL() holds DB connection via GetJSONLFileHash()\n```\n\n## Impact\n\n- Test suite: 10+ minutes β†’ should be \u003c10 seconds\n- ALL other tests pass in ~4 seconds\n- This ONE test accounts for 99.9% of test runtime\n\n## Related\n\nThis is the EXACT same issue documented in MAIN_TEST_REFACTOR_NOTES.md for why main_test.go refactoring was deferred - global state manipulation + DB cleanup = deadlock.\n\n## Fix Approaches\n\n1. **Add proper cleanup sequencing** - stop flush goroutines BEFORE closing DB\n2. **Use test-specific DB lifecycle** - ensure flush completes before cleanup\n3. **Mock the flush mechanism** - avoid real DB for testing this code path \n4. **Add explicit timeout handling** - fail fast with clear error instead of hanging\n\n## Files\n\n- cmd/bd/direct_mode_test.go:36-132\n- cmd/bd/autoflush.go:353 (validateJSONLIntegrity)\n- cmd/bd/autoflush.go:508 (flushToJSONLWithState)\n\n## Acceptance\n\n- Test passes without timeout\n- Test suite completes in \u003c10 seconds\n- No deadlock between cleanup and flush operations","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T20:09:00.794372-05:00","updated_at":"2025-11-23T15:15:00.482016-08:00","closed_at":"2025-11-23T15:15:00.482019-08:00","source_repo":"."} -{"id":"bd-4ry","content_hash":"fc0b5a708c2cbef610437e2bd8dab08712d2b151becbe2080db1bc52ff4c03fa","title":"Clarify JSONL size bounds with multi-repo","description":"The contributor-workflow-analysis.md states (line 226): 'Keep beads.jsonl small enough for agents to read (\u003c25k)'\n\nWith multi-repo hydration, it's unclear whether this bound applies to:\n- Each individual JSONL file (likely intention)\n- The total hydrated size across all repos (unclear)\n- Both (most conservative)\n\nClarification needed because:\n- VC monitors .beads/issues.jsonl size to stay under limit\n- With multi-repo, VC needs to know if each additional repo also has 25k limit\n- Agents reading hydrated data need to know total size bounds\n- Performance characteristics depend on total vs per-repo limits\n\nExample scenario:\n- Primary repo: 20k JSONL\n- Planning repo: 15k JSONL\n- Total hydrated: 35k\nIs this acceptable or does it violate the \u003c25k principle?","acceptance_criteria":"- Documentation explicitly states size bound applies per-repo or total\n- Rationale explained (why that bound matters)\n- Guidance for monitoring size with multi-repo\n- If total bound exists, formula provided (e.g., sum of all repos \u003c25k)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:50.042748-08:00","updated_at":"2025-11-05T14:18:00.550341-08:00","closed_at":"2025-11-05T14:18:00.550341-08:00","source_repo":"."} -{"id":"bd-502e","content_hash":"0f40053f59ff205d858a9ddf0be845df1d52471cc25a812df78cb3d4667efbdd","title":"Add comprehensive tests for sync branch daemon logic","description":"The daemon sync branch functionality (bd-6545) was implemented but needs proper end-to-end testing.\n\nCurrent implementation:\n- daemon_sync_branch.go has syncBranchCommitAndPush() and syncBranchPull()\n- daemon_sync.go has been updated to use these functions when sync.branch is configured\n- All daemon tests pass, but no specific tests for sync branch behavior\n\nTesting needed:\n- Test that daemon commits to sync branch when sync.branch is configured\n- Test that daemon commits to current branch when sync.branch is NOT configured (backward compatibility)\n- Test that daemon pulls from sync branch and syncs JSONL back to main repo\n- Test worktree creation and health checks during daemon operations\n- Test error handling (missing branch, worktree corruption, etc.)\n\nKey challenge: Tests need to run in the context of the git repo (getGitRoot() uses current working directory), so test setup needs to properly change directory or mock the git root detection.\n\nReference existing daemon tests in daemon_test.go and daemon_autoimport_test.go for patterns.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:59:13.341491-08:00","updated_at":"2025-11-02T16:39:53.278313-08:00","closed_at":"2025-11-02T16:39:53.278313-08:00","source_repo":".","dependencies":[{"issue_id":"bd-502e","depends_on_id":"bd-6545","type":"parent-child","created_at":"2025-11-02T15:59:13.342331-08:00","created_by":"daemon"}]} -{"id":"bd-51jl","content_hash":"f926fc6615da9c2d0270449079fa7b4e937f8e817a73c7df179bb6d92ca464e6","title":"Feature P1","description":"","status":"closed","priority":1,"issue_type":"feature","assignee":"bob","created_at":"2025-11-07T19:04:24.852171-08:00","updated_at":"2025-11-07T22:07:17.343481-08:00","closed_at":"2025-11-07T21:55:09.426728-08:00","source_repo":"."} -{"id":"bd-5314bddf","content_hash":"1c57b7a18279f8d87c68af9e1b99234ba4017a03c3f3b1cdb65ce4a8b93e12aa","title":"bd detect-pollution - Test pollution detector","description":"Detect test issues that leaked into production DB.\n\nPattern matching for:\n- Titles starting with 'test', 'benchmark', 'sample'\n- Sequential numbering (test-1, test-2)\n- Generic descriptions\n- Created in rapid succession\n\nOptional AI scoring for confidence.\n\nFiles: cmd/bd/detect_pollution.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T14:48:17.466906-07:00","updated_at":"2025-11-06T19:36:13.970321-08:00","closed_at":"2025-11-06T19:27:11.75884-08:00","source_repo":"."} -{"id":"bd-537e","content_hash":"3d8bd59053d657a3710708f5e70feb9baa9545a87383286ff6fad29437856c44","title":"Add external_ref change tracking and auditing","description":"Currently we don't track when external_ref is added, removed, or changed. This would be useful for debugging and auditing.\n\nProposed features:\n- Log event when external_ref changes\n- Track in events table with old/new values\n- Add query to find issues where external_ref changed\n- Add metrics: issues with external_ref vs without\n\nUse cases:\n- Debugging import issues\n- Understanding which issues are externally managed\n- Auditing external system linkage\n\nRelated: bd-1022","status":"closed","priority":4,"issue_type":"feature","created_at":"2025-11-02T15:32:31.276883-08:00","updated_at":"2025-11-08T02:24:24.68524-08:00","closed_at":"2025-11-08T02:20:01.022406-08:00","source_repo":"."} -{"id":"bd-5599","content_hash":"9fbe6f08f83522e1136f3e6a368b1cd22c527bf5e83cccc70c1f6aaa21712ae0","title":"Fix TestListCommand duplicate dependency constraint violation","description":"","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-31T21:27:05.557548-07:00","updated_at":"2025-10-31T21:27:11.429018-07:00","closed_at":"2025-10-31T21:27:11.429018-07:00","source_repo":"."} -{"id":"bd-56p","content_hash":"786724fdedc39ae5a39c91ec62dc0454d749379108bdfd235db7d43df84e7b07","title":"Add #nosec G304 comments to JSONL file reads in sync.go","description":"sync.go:610 uses os.ReadFile(jsonlPath) without #nosec comment, inconsistent with other JSONL reads that have '// #nosec G304 - controlled path'.\n\nAdd comment for consistency with integrity.go:43 and import.go:316.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:31:09.107493-05:00","updated_at":"2025-11-20T21:34:28.378089-05:00","closed_at":"2025-11-20T21:34:28.378089-05:00","source_repo":".","dependencies":[{"issue_id":"bd-56p","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:09.108632-05:00","created_by":"daemon"}]} -{"id":"bd-581b80b3","content_hash":"04c4d952852ae2673e551d9776698c52b0189754ac5f9ca295bed464a5b86a43","title":"bd find-duplicates - AI-powered duplicate detection","description":"Find semantically duplicate issues.\n\nApproaches:\n1. Mechanical: Exact title/description matching\n2. Embeddings: Cosine similarity (cheap, scalable)\n3. AI: LLM-based semantic comparison (expensive, accurate)\n\nUses embeddings by default for \u003e100 issues.\n\nFiles: cmd/bd/find_duplicates.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.126801-07:00","updated_at":"2025-10-30T17:12:58.218673-07:00","source_repo":"."} -{"id":"bd-589c7c1e","content_hash":"efbc1fe1379d414d2af33f5aff9787e4f8a3234922199bdc9abce25dba99aef0","title":"Fix revive style issues (78 issues)","description":"Style violations: unused parameters (many cmd/args in cobra commands), missing exported comments, stuttering names (SQLiteStorage), indent-error-flow issues.","design":"Rename unused params to _, add godoc comments to exported types, fix stuttering names, simplify control flow.","notes":"Fixed 19 revive issues:\n- 14 unused-parameter (renamed to _)\n- 2 redefines-builtin-id (maxβ†’maxCount, minβ†’minInt)\n- 3 indent-error-flow (gofmt fixed 2, skipped 1 complex nested one)\n\nRemaining issues are acceptable: 11 unused-params in deeper code, 2 empty-blocks with comments, 1 complex indent case, 1 superfluous-else in test.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-27T23:20:10.391821-07:00","updated_at":"2025-10-30T17:12:58.215077-07:00","closed_at":"2025-10-27T23:02:41.30653-07:00","source_repo":"."} -{"id":"bd-58c0","content_hash":"112d4123250ac875619a1f239cbf73c859b58d87f2b45a2d649da320dd72ecc5","title":"Fix transaction conflict in TryResurrectParent","description":"Integration test TestImportWithDeletedParent fails with 'database is locked' error when resurrection happens inside CreateIssue.\n\nRoot cause: TryResurrectParent calls conn.Get() and insertIssue() which conflicts with existing transaction in CreateIssue.\n\nError: failed to create tombstone for parent bd-parent: failed to insert issue: sqlite3: database is locked\n\nSolution: Refactor resurrection to accept optional transaction parameter, use existing transaction when available instead of creating new connection.\n\nImpact: Blocks resurrection from working in CreateIssue flow, only works in EnsureIDs (which may not have active transaction).","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-04T16:32:20.981027-08:00","updated_at":"2025-11-04T17:00:44.258881-08:00","closed_at":"2025-11-04T17:00:44.258881-08:00","source_repo":".","dependencies":[{"issue_id":"bd-58c0","depends_on_id":"bd-d19a","type":"discovered-from","created_at":"2025-11-04T16:32:20.981969-08:00","created_by":"daemon"}]} -{"id":"bd-5a90","content_hash":"819c14b3bb55fcd113b4e848e4bfcb0c3475756658575dba8d34922ca8e14077","title":"Test parent issue","description":"","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-02T11:50:35.85367-08:00","updated_at":"2025-11-02T11:50:35.85367-08:00","source_repo":"."} -{"id":"bd-5aad5a9c","content_hash":"b51a8fcbb4e418f1c2e0eafebaa22fd90476d51f184f0b0727e624fea57abd88","title":"Add TestNWayCollision for 5+ clones","description":"## Overview\nAdd comprehensive tests for N-way (5+) collision resolution to verify the solution scales beyond 3 clones.\n\n## Purpose\nWhile TestThreeCloneCollision validates the basic N-way case, we need to verify:\n1. Solution scales to arbitrary N\n2. Performance is acceptable with more clones\n3. Convergence time is bounded\n4. No edge cases in larger collision groups\n\n## Implementation Tasks\n\n### 1. Create TestFiveCloneCollision\nFile: beads_twoclone_test.go (or new beads_nway_test.go)\n\n```go\nfunc TestFiveCloneCollision(t *testing.T) {\n // Test with 5 clones creating same ID with different content\n // Verify all 5 clones converge after sync rounds\n \n t.Run(\"SequentialSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"A\", \"B\", \"C\", \"D\", \"E\")\n })\n \n t.Run(\"ReverseSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"E\", \"D\", \"C\", \"B\", \"A\")\n })\n \n t.Run(\"RandomSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"C\", \"A\", \"E\", \"B\", \"D\")\n })\n}\n```\n\n### 2. Implement generalized testNCloneCollision\nGeneralize the 3-clone test to handle arbitrary N:\n\n```go\nfunc testNCloneCollision(t *testing.T, numClones int, syncOrder ...string) {\n t.Helper()\n \n if len(syncOrder) != numClones {\n t.Fatalf(\"syncOrder length (%d) must match numClones (%d)\", \n len(syncOrder), numClones)\n }\n \n tmpDir := t.TempDir()\n \n // Setup remote and N clones\n remoteDir := setupBareRepo(t, tmpDir)\n cloneDirs := make(map[string]string)\n \n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n cloneDirs[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates issue with same ID but different content\n for name, dir := range cloneDirs {\n createIssue(t, dir, fmt.Sprintf(\"Issue from clone %s\", name))\n }\n \n // Sync in specified order\n for _, name := range syncOrder {\n syncClone(t, cloneDirs[name], name)\n }\n \n // Final pull for convergence\n for name, dir := range cloneDirs {\n finalPull(t, dir, name)\n }\n \n // Verify all clones have all N issues\n expectedTitles := make(map[string]bool)\n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n expectedTitles[fmt.Sprintf(\"Issue from clone %s\", name)] = true\n }\n \n for name, dir := range cloneDirs {\n titles := getTitles(t, dir)\n if !compareTitleSets(titles, expectedTitles) {\n t.Errorf(\"Clone %s missing issues: expected %v, got %v\", \n name, expectedTitles, titles)\n }\n }\n \n t.Log(\"βœ“ All\", numClones, \"clones converged successfully\")\n}\n```\n\n### 3. Add performance benchmarks\nTest convergence time and memory usage:\n\n```go\nfunc BenchmarkNWayCollision(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n // Run N-way collision and measure time\n testNCloneCollisionBench(b, n)\n }\n })\n }\n}\n```\n\n### 4. Add convergence time tests\nVerify bounded convergence:\n\n```go\nfunc TestConvergenceTime(t *testing.T) {\n // Test that convergence happens within expected rounds\n // For N clones, should converge in at most N-1 sync rounds\n \n for n := 3; n \u003c= 10; n++ {\n t.Run(fmt.Sprintf(\"N=%d\", n), func(t *testing.T) {\n rounds := measureConvergenceRounds(t, n)\n maxExpected := n - 1\n if rounds \u003e maxExpected {\n t.Errorf(\"Convergence took %d rounds, expected ≀ %d\", \n rounds, maxExpected)\n }\n })\n }\n}\n```\n\n### 5. Add edge case tests\nTest boundary conditions:\n- All N clones have identical content (dedup works)\n- N-1 clones have same content, 1 differs\n- All N clones have unique content\n- Mix of collisions and non-collisions\n\n## Acceptance Criteria\n- TestFiveCloneCollision passes with all sync orders\n- All 5 clones converge to identical content\n- Performance is acceptable (\u003c 5 seconds for 5 clones)\n- Convergence time is bounded (≀ N-1 rounds)\n- Edge cases handled correctly\n- Benchmarks show scalability to 10+ clones\n\n## Files to Create/Modify\n- beads_twoclone_test.go or beads_nway_test.go\n- Add helper functions for N-clone setup\n\n## Testing Strategy\n\n### Test Matrix\n| N Clones | Sync Orders | Expected Result |\n|----------|-------------|-----------------|\n| 3 | Aβ†’Bβ†’C | Pass |\n| 3 | Cβ†’Bβ†’A | Pass |\n| 5 | Aβ†’Bβ†’Cβ†’Dβ†’E | Pass |\n| 5 | Eβ†’Dβ†’Cβ†’Bβ†’A | Pass |\n| 5 | Random | Pass |\n| 10 | Sequential | Pass |\n\n### Performance Targets\n- 3 clones: \u003c 2 seconds\n- 5 clones: \u003c 5 seconds\n- 10 clones: \u003c 15 seconds\n\n## Dependencies\n- Requires bd-cbed9619.5, bd-cbed9619.4, bd-cbed9619.3, bd-dcd6f14b to be completed\n- TestThreeCloneCollision must pass first\n\n## Success Metrics\n- All tests pass for N ∈ {3, 5, 10}\n- Convergence time scales linearly (O(N))\n- Memory usage reasonable (\u003c 100MB for 10 clones)\n- No data corruption or loss in any scenario","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T19:52:05.462747-07:00","updated_at":"2025-10-31T12:00:43.198413-07:00","closed_at":"2025-10-31T12:00:43.198413-07:00","source_repo":"."} -{"id":"bd-5arw","content_hash":"b46bc77fc8320c3f10e2e8319c99b9e6152a7bb1076deb97f42c71c79bbb7d54","title":"Fix remaining FK constraint failures in AddComment and ApplyCompaction","description":"Follow-up to PR #348 (Fix FOREIGN KEY constraint failed).\n\nThe initial fix addressed CloseIssue, UpdateIssueID, and RemoveLabel.\nHowever, `AddComment` (in internal/storage/sqlite/events.go) and `ApplyCompaction` (in internal/storage/sqlite/compact.go) still suffer from the same pattern: inserting an event after an UPDATE without verifying the UPDATE affected any rows.\n\nThis causes \"FOREIGN KEY constraint failed\" errors when operating on non-existent issues, instead of clean \"issue not found\" errors.\n\nTask:\n1. Apply the same fix pattern to `AddComment` and `ApplyCompaction`: check RowsAffected() after UPDATE and before event INSERT.\n2. Ensure error messages are consistent (\"issue %s not found\").\n3. Verify with reproduction tests (create a test that calls these methods with a non-existent ID).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T09:53:38.314776-08:00","updated_at":"2025-11-20T11:25:04.698765-08:00","closed_at":"2025-11-20T11:25:04.698765-08:00","source_repo":"."} -{"id":"bd-5b40a0bf","content_hash":"12e4543067c29e5c85e092493d5f5f8898b9bf52b92b168d17b30c7d98fc6eda","title":"Batch test 5","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:02.136118-07:00","updated_at":"2025-10-31T12:00:43.181513-07:00","closed_at":"2025-10-31T12:00:43.181513-07:00","source_repo":"."} -{"id":"bd-5b6e","content_hash":"f82a86b4aae21311f23c8511a242f16e96d03836300995fadd43b8bea945cefa","title":"Add tests for helper functions (GetDirtyIssueHash, GetAllDependencyRecords, export hashes)","description":"Several utility functions have 0% coverage:\n- GetDirtyIssueHash (dirty.go)\n- GetAllDependencyRecords (dependencies.go)\n- GetExportHash, SetExportHash, ClearAllExportHashes (hash.go)\n\nThese are lower priority but should have basic coverage.","status":"open","priority":4,"issue_type":"task","created_at":"2025-11-01T22:40:58.989976-07:00","updated_at":"2025-11-01T22:40:58.989976-07:00","source_repo":"."} -{"id":"bd-5bbf","content_hash":"a7c234437e23726f7a6d9733b20e6a344d1e352a1820b6cce6cd79a3fe1c8713","title":"Test all core bd commands in WASM for feature parity","description":"Comprehensive testing of bd-wasm against native bd:\n- Test all CRUD operations (create, update, show, close)\n- Test dependency management (dep add, dep tree)\n- Test sync operations (sync, import, export)\n- Verify JSONL output matches native bd\n- Run existing Go test suite in WASM if possible\n- Benchmark performance (should be within 2x of native)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.300923-08:00","updated_at":"2025-11-05T00:55:48.757247-08:00","closed_at":"2025-11-05T00:55:48.757249-08:00","source_repo":".","dependencies":[{"issue_id":"bd-5bbf","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.503229-08:00","created_by":"stevey"},{"issue_id":"bd-5bbf","depends_on_id":"bd-b4b0","type":"blocks","created_at":"2025-11-02T22:23:55.623601-08:00","created_by":"stevey"}]} -{"id":"bd-5c4","content_hash":"b3966c81f89cfc88d9338b4342476df29d67104d24dfca23a8925bbfda2d7d52","title":"VCS-agnostic sync support","description":"Make bd sync work with multiple VCS types (git, jujutsu, mercurial, sapling) by detecting VCS per repo and using appropriate sync commands, supporting mixed-VCS multi-repo configs.","design":"Features:\n- Detect VCS type per repo (.git, .jj, .hg, .sl)\n- Sync adapters for each VCS type\n- bd sync runs appropriate commands per repo\n- Handle mixed-VCS configs (git + jj + hg)\n- Fallback to manual sync if no VCS detected\n\nExample:\nbd sync auto-detects:\n- . is git β†’ git pull\n- ~/.beads-planning is jj β†’ jj git fetch \u0026\u0026 jj rebase\n- ~/other is hg β†’ hg pull \u0026\u0026 hg update","acceptance_criteria":"1. Detect VCS type per configured repo\n2. bd sync works with git, jj, hg, sapling\n3. Mixed-VCS configs supported\n4. Graceful fallback if no VCS detected\n5. Error messages guide user on manual sync\n6. Pure git workflows unchanged","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-04T11:22:00.837527-08:00","updated_at":"2025-11-05T14:30:10.417479-08:00","closed_at":"2025-11-05T14:26:17.942832-08:00","source_repo":".","dependencies":[{"issue_id":"bd-5c4","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.817849-08:00","created_by":"daemon"}]} -{"id":"bd-5ce8","content_hash":"23d02fea82e0a87bbb4c878472a368e093262e98c7d1f286374955a5b14ae1e5","title":"Document protected branch workflow","description":"Create comprehensive documentation for protected branch workflow.\n\nTasks:\n- Add \"Protected Branch Workflow\" section to AGENTS.md\n- Create docs/PROTECTED_BRANCHES.md guide\n- Update README.md quick start\n- Add examples to examples/protected-branch/\n- Update bd init --help documentation\n- Add troubleshooting guide\n- Add migration guide for existing users\n- Record demo video (optional)\n\nEstimated effort: 2-3 days","acceptance_criteria":"- Clear quick start (\u003c 2 minutes to set up)\n- Detailed guide covers all scenarios\n- Examples work end-to-end\n- Troubleshooting answers common questions\n- Platform-agnostic (not GitHub-specific)","notes":"Completed protected branch workflow documentation. Created comprehensive guide (docs/PROTECTED_BRANCHES.md), updated AGENTS.md with workflow section, added feature to README.md, and created working example (examples/protected-branch/). All commands verified working (bd init --branch, bd sync --status, bd sync --merge, bd config get/set sync.branch).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.59013-08:00","updated_at":"2025-11-04T11:10:23.530618-08:00","closed_at":"2025-11-04T11:10:23.530621-08:00","source_repo":".","dependencies":[{"issue_id":"bd-5ce8","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.379767-08:00","created_by":"stevey"}]} -{"id":"bd-5dae5504","content_hash":"79a2ae8e266e8efb253d2e0794805d5d3975efa651d694aae0f5c611a0718ade","title":"Export deduplication breaks when JSONL and export_hashes table diverge","description":"## Problem\n\nThe export deduplication feature (timestamp-only skipping) breaks when the JSONL file and export_hashes table get out of sync, causing exports to skip issues that aren't actually in the file.\n\n## Symptoms\n\n- `bd export` reports \"Skipped 128 issue(s) with timestamp-only changes\"\n- JSONL file only has 38 lines but DB has 149 issues\n- export_hashes table has 149 entries\n- Auto-import doesn't trigger (hash matches despite missing data)\n- Two repos on same commit show different issue counts\n\n## Root Cause\n\nshouldSkipExport() in autoflush.go compares current issue hash with stored export_hashes entry. If they match, it skips export assuming the issue is already in the JSONL.\n\nThis assumption fails when:\n1. Git operations (pull, reset, checkout) change JSONL without clearing export_hashes\n2. Manual JSONL edits or corruption\n3. Import operations that modify DB but don't update export_hashes\n4. Partial exports that update export_hashes but don't complete\n\n## Impact\n\n- **Critical data loss risk**: Issues appear to be tracked but aren't persisted to git\n- Breaks multi-repo sync (root cause of today's debugging session)\n- Auto-import fails to detect staleness (hash matches despite missing data)\n- Silent data corruption (no error messages, just missing issues)\n\n## Reproduction\n\n1. Have DB with 149 issues, all in export_hashes table\n2. Truncate JSONL to 38 lines (simulate git reset or corruption)\n3. Run `bd export` - it skips 128 issues\n4. JSONL still has only 38 lines but export thinks it succeeded\n\n## Current Workaround\n\n```bash\nsqlite3 .beads/beads.db \"DELETE FROM export_hashes\"\nbd export -o .beads/beads.jsonl\n```\n\n## Proposed Solutions\n\n**Option 1: Verify JSONL integrity before skipping**\n- Count lines in JSONL, compare with export_hashes count\n- If mismatch, clear export_hashes and force full export\n- Safe but adds I/O overhead\n\n**Option 2: Hash-based JSONL validation**\n- Store hash of entire JSONL file in metadata\n- Before export, check if JSONL hash matches\n- If mismatch, clear export_hashes\n- More efficient, detects any JSONL corruption\n\n**Option 3: Disable timestamp-only deduplication**\n- Remove the feature entirely\n- Always export all issues\n- Simplest and safest, but creates larger git commits\n\n**Option 4: Clear export_hashes on git operations**\n- Add post-merge hook to clear export_hashes\n- Clear on any import operation\n- Defensive approach but may over-clear\n\n## Recommended Fix\n\nCombination of Options 2 + 4:\n1. Store JSONL file hash in metadata after export\n2. Check hash before export, clear export_hashes if mismatch \n3. Clear export_hashes on import operations\n4. Add `bd validate` check for JSONL/export_hashes sync\n\n## Files Involved\n\n- cmd/bd/autoflush.go (shouldSkipExport)\n- cmd/bd/export.go (export with deduplication)\n- internal/storage/sqlite/metadata.go (export_hashes table)","notes":"## Recovery Session (2025-10-29 21:30)\n\n### What Happened\n- Created 14 new hash ID issues (bd-f8b764c9 through bd-f8b764c9.1) \n- bd sync appeared to succeed\n- Canonical repo (~/src/beads): 162 issues in DB + JSONL βœ“\n- Secondary repo (fred/beads): Only 145 issues vs 162 in canonical βœ—\n- Both repos on same git commit but different issue counts!\n\n### Bug Manifestation During Recovery\n\n1. **Initial state**: fred/beads had 145 issues, 145 lines in JSONL, 145 export_hashes entries\n\n2. **After git reset --hard origin/main**: \n - JSONL: 162 lines (from git)\n - DB: 150 issues (auto-import partially worked)\n - Auto-import failed with UNIQUE constraint error\n\n3. **After manual import --resolve-collisions**:\n - DB: 160 issues\n - JSONL: Still 162 lines\n - export_hashes: 159 entries\n\n4. **After bd export**: \n - **JSONL reduced to 17 lines!** ← The bug in action\n - export_hashes: 159 entries (skipped exporting 142 issues)\n - Silent data loss - no error message\n\n5. **After clearing export_hashes and re-export**:\n - JSONL: 159 lines (missing 3 issues still)\n - DB: 159 issues\n - Still diverged from canonical\n\n### The Bug Loop\nOnce export_hashes and JSONL diverge:\n- Export skips issues already in export_hashes\n- But those issues aren't actually in JSONL\n- This creates corrupt JSONL with missing issues\n- Auto-import can't detect the problem (file hash matches what was exported)\n- Data is lost with no error messages\n\n### Recovery Solution\nCouldn't break the loop with export alone. Had to:\n1. Copy .beads/beads.db from canonical repo\n2. Clear export_hashes\n3. Full re-export\n4. Finally converged to 162 issues\n\n### Key Learnings\n\n1. **The bug is worse than we thought**: It can create corrupt exports (17 lines instead of 162!)\n\n2. **Auto-import can't save you**: Once export is corrupt, auto-import just imports the corrupt data\n\n3. **Silent failure**: No warnings, no errors, just missing issues\n\n4. **Git operations trigger it**: git reset, git pull, etc. change JSONL without clearing export_hashes\n\n5. **Import operations populate export_hashes**: Even manual imports update export_hashes, setting up future export failures\n\n### Immediate Action Required\n\n**DISABLE EXPORT DEDUPLICATION NOW**\n\nThis feature is fundamentally broken and causes data loss. Should be disabled until properly fixed.\n\nQuick fix options:\n- Set environment variable to disable feature\n- Comment out shouldSkipExport check\n- Always clear export_hashes before export\n- Add validation that DB count == JSONL line count before allowing export\n\n### Long-term Fix\n\nNeed Option 2 + 4 from proposed solutions:\n1. Store JSONL file hash after every successful export\n2. Before export, verify JSONL hash matches expected\n3. If mismatch, log WARNING and clear export_hashes\n4. Clear export_hashes on every import operation\n5. Add git post-merge hook to clear export_hashes\n6. Add `bd validate` command to detect divergence\n","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-29T23:05:13.959435-07:00","updated_at":"2025-10-30T17:12:58.207148-07:00","closed_at":"2025-10-29T21:57:03.06641-07:00","source_repo":"."} -{"id":"bd-5e1f","content_hash":"5b0aa7a2f651393bc13c46c172828acc4306d22d749ff71fbae96f0d25741847","title":"Issue with desc","description":"This is a description","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-31T21:41:11.128718-07:00","updated_at":"2025-11-04T11:10:23.531094-08:00","closed_at":"2025-11-04T11:10:23.531097-08:00","source_repo":"."} -{"id":"bd-5f26","content_hash":"5131931d43040061d669159635de863740ed90e7c946c4b646c36c53bc274d6f","title":"Refactor daemon.go into internal/daemonrunner","description":"Extract daemon runtime from daemon.go (1,565 lines) into internal/daemonrunner with focused modules: config.go, daemon.go, process.go, rpc_server.go, sync.go, git.go. Keep cobra command thin.","design":"New structure:\n- internal/daemonrunner/config.go: Config struct\n- internal/daemonrunner/daemon.go: Daemon struct + Start/Stop\n- internal/daemonrunner/process.go: PID/lock/socket handling\n- internal/daemonrunner/rpc_server.go: RPC lifecycle\n- internal/daemonrunner/sync.go: Export/import/commit/push logic\n- internal/daemonrunner/git.go: Git operations interface\n- cmd/bd/daemon.go: Thin cobra command","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-01T11:41:14.821017-07:00","updated_at":"2025-11-01T21:44:44.507747-07:00","closed_at":"2025-11-01T21:44:44.507747-07:00","source_repo":"."} -{"id":"bd-5f483051","content_hash":"c14449fb07074c3ff76a653cc632f5795e2e0fb8f381c5f1a1f0dd831fe4f13f","title":"Implement bd resolve-conflicts (git merge conflicts in JSONL)","description":"Automatically detect and resolve git merge conflicts in .beads/issues.jsonl file.\n\nFeatures:\n- Detect conflict markers in JSONL\n- Parse conflicting issues from HEAD and BASE\n- Provide mechanical resolution (remap duplicate IDs)\n- Support AI-assisted resolution (requires internal/ai package)\n\nSee repair_commands.md lines 125-353 for design.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T19:37:55.722827-07:00","updated_at":"2025-11-06T19:36:13.970903-08:00","closed_at":"2025-11-06T19:26:45.397628-08:00","source_repo":"."} -{"id":"bd-5ibn","content_hash":"3e651d081ea1dec7e5e30aaa2f9f521f3b9eaff7832d0dd55e5e6f89525f6b94","title":"Latency test 1","description":"","notes":"Resetting stale in_progress status from old executor run (yesterday)","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-20T12:16:30.703754-05:00","updated_at":"2025-11-21T14:38:35.458351-05:00","source_repo":"."} -{"id":"bd-5iv","content_hash":"229ad9764bd3eb8b09441adefce960aede63fd1b5466d52cc74f112f5bb610ac","title":"Test Epic","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","design":"## Architecture\n\n[Describe the overall architecture and approach]\n\n## Components\n\n- Component 1: [description]\n- Component 2: [description]\n\n## Dependencies\n\n[List external dependencies or constraints]\n","acceptance_criteria":"- [ ] All child issues are completed\n- [ ] Integration tests pass\n- [ ] Documentation is updated\n- [ ] Code review completed\n","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-03T20:15:03.864229-08:00","updated_at":"2025-11-05T00:25:06.538749-08:00","closed_at":"2025-11-05T00:25:06.538749-08:00","source_repo":".","labels":["epic"]} -{"id":"bd-5ki8","content_hash":"d89e5e528819934bcb7ee162fa7e32c27298db5816ecf51bcc8ede1809f1d5b9","title":"Add integration tests for adapter library","description":"Test suite for beads_mail_adapter.py covering all scenarios.\n\nAcceptance Criteria:\n- Test enabled mode (server available)\n- Test disabled mode (server unavailable)\n- Test graceful degradation (server dies mid-operation)\n- Test reservation conflicts\n- Test message sending/receiving\n- Mock HTTP server for testing\n- 90%+ code coverage\n\nFile: lib/test_beads_mail_adapter.py","notes":"Test suite completed with 29 comprehensive tests covering:\n- Enabled mode (server available): 10 tests\n- Disabled mode (server unavailable): 2 tests \n- Graceful degradation: 4 tests\n- Reservation conflicts: 2 tests\n- Configuration: 5 tests\n- Health check scenarios: 3 tests\n- HTTP error handling: 3 tests\n\n**Performance**: All tests run in 10ms (fast!)\n\n**Coverage highlights**:\nβœ… Server health checks (ok, degraded, error, timeout)\nβœ… All API operations (reserve, release, notify, check_inbox, get_reservations)\nβœ… HTTP errors (404, 409 conflict, 500, 503)\nβœ… Network errors (timeout, connection refused)\nβœ… Malformed responses (bad JSON, empty body, plain text errors)\nβœ… Environment variable configuration\nβœ… Graceful degradation when server dies mid-operation\nβœ… Conflict handling with both JSON and plain text errors\nβœ… Dict wrapper responses ({\"messages\": [...]} and {\"reservations\": [...]})\nβœ… Custom TTL for reservations\nβœ… Default agent name fallback\n\nNo external dependencies, no slow integration tests, just fast unit tests with mocks.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:43:21.294596-08:00","updated_at":"2025-11-08T01:32:39.906342-08:00","closed_at":"2025-11-08T01:32:39.906342-08:00","source_repo":".","dependencies":[{"issue_id":"bd-5ki8","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T22:43:21.296024-08:00","created_by":"daemon"}]} -{"id":"bd-5otr","content_hash":"d08e4780fc80ffd39e678cab64038d50c31ccf842d2d9f4e6e598746324f2711","title":"Create startup hook snippet for upgrade detection","description":"Provide a reusable startup hook that agents can use to detect bd upgrades automatically.\n\n## What to Create\nA bash script snippet that:\n1. Reads current bd version\n2. Compares to last-seen version in metadata.json\n3. Shows 'bd info --whats-new' output when version changes\n4. Updates metadata.json with new version\n5. Auto-runs 'bd hooks install' if hooks outdated\n\n## Where to Document\n- Create examples/hooks/startup-version-check.sh\n- Document in AGENTS.md with usage instructions\n- Add comment header explaining how to integrate with Claude Code, Cursor, etc.\n\n## Key Features\n- Works today with zero bd code changes\n- Leverages existing bd info --whats-new\n- Uses metadata.json for persistence\n- Auto-fixes outdated git hooks\n\n## Acceptance Criteria\n- Script works standalone\n- Clear integration instructions for popular AI environments\n- Handles edge cases (no metadata.json, first run, etc.)\n","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T16:21:52.07179-08:00","updated_at":"2025-11-23T16:29:30.969796-08:00","closed_at":"2025-11-23T16:29:30.969796-08:00","source_repo":".","dependencies":[{"issue_id":"bd-5otr","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:52.073748-08:00","created_by":"daemon"}]} -{"id":"bd-5ots","content_hash":"ba3efab3e7a2b9bb2bd2dba3aace56cfbdd1b67efd1cfc4758d9c79919f632af","title":"SearchIssues N+1 query causes context timeout with GetLabels","description":"scanIssues() calls GetLabels in a loop for every issue, causing N+1 queries and context deadline exceeded errors when used with short timeouts or in-memory databases. This is especially problematic since SearchIssues already supports label filtering via SQL WHERE clauses.","acceptance_criteria":"- Optimize scanIssues to batch-load labels for all issues in one query\n- Or make label loading optional/lazy\n- Add test that calls SearchIssues repeatedly with label filters and short context timeouts","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-05T19:12:02.245879-08:00","updated_at":"2025-11-05T19:22:11.668682-08:00","closed_at":"2025-11-05T19:22:11.668682-08:00","source_repo":"."} -{"id":"bd-5qim","content_hash":"5117e87c5a56b5b8254402d982e85bea1478c1961f05654a50cf2df11e7ad6bf","title":"Optimize GetReadyWork performance - 752ms on 10K database (target: \u003c50ms)","description":"","notes":"# Performance Analysis (10K Issue Database)\n\nAnalyzed using CPU profiles from benchmark suite on Apple M2 Pro.\n\n## Operation Performance\n\n| Operation | Time | Allocations | Memory |\n|----------------------------------|---------|-------------|--------|\n| bd ready (GetReadyWork) | ~752ms | 167,466 | 16MB |\n| bd list (SearchIssues no filter) | ~11.6ms | 89,214 | 5.8MB |\n| bd list (SearchIssues filtered) | ~9.2ms | 62,365 | 3.5MB |\n| bd create (CreateIssue) | ~2.6ms | 146 | 8.6KB |\n| bd update (UpdateIssue) | ~0.32ms | 364 | 15KB |\n| bd close (UpdateIssue) | ~0.32ms | 364 | 15KB |\n\n**Target: \u003c50ms for all operations on 10K database**\n\n**Current issue: GetReadyWork is 15x over target (752ms vs 50ms)**\n\n## Root Cause\n\nGetReadyWork (internal/storage/sqlite/ready.go:90-128) uses recursive CTE to propagate blocking:\n- 65x slower than SearchIssues\n- Recalculates entire blocked issue tree on every call\n- Algorithm:\n 1. Find directly blocked issues via 'blocks' dependencies\n 2. Recursively propagate blockage to descendants (max depth: 50)\n 3. Exclude all blocked issues from results\n\n## CPU Profile Analysis\n\n- Database syscalls (pthread_cond_signal, syscall6): ~75%\n- SQLite engine overhead: inherent to recursive CTE\n- Application code (query construction): \u003c1%\n\n**Bottleneck is the recursive CTE query execution, not application code.**\n\n## Optimization Recommendations\n\n### High Impact (Likely to achieve \u003c50ms target)\n\n1. **Cache blocked issue calculation**\n - Add `blocked_issues` table updated on dependency changes\n - Trade write complexity for read speed (ready called \u003e\u003e dependency changes)\n - Eliminates recursive CTE on every read\n\n2. **Add/verify database indexes**\n ```sql\n CREATE INDEX IF NOT EXISTS idx_dependencies_blocked \n ON dependencies(issue_id, type, depends_on_id);\n CREATE INDEX IF NOT EXISTS idx_issues_status \n ON issues(status);\n ```\n\n### Medium Impact\n\n3. **Reduce allocations** (167K allocations for GetReadyWork)\n - Profile `scanIssues()` for object pooling opportunities\n - Reuse slice capacity for repeated calls\n\n### Low Impact (Not recommended)\n- Query optimization for CRUD operations (already \u003c3ms)\n- Connection pooling tuning (not showing in profiles)\n\n## Verification\n\nRun benchmarks to validate optimization:\n```bash\nmake bench-quick\ngo tool pprof -http=:8080 internal/storage/sqlite/bench-cpu-*.prof\n```\n\nProfile files automatically generated in `internal/storage/sqlite/`.","status":"open","priority":0,"issue_type":"bug","created_at":"2025-11-14T09:02:46.507526-08:00","updated_at":"2025-11-14T09:03:44.073236-08:00","source_repo":"."} -{"id":"bd-5xt","content_hash":"1a44abd45874666cea2170bb3559934f72acf3b5171d0b587cc49eef386e110d","title":"Log errors from timer-triggered flushes instead of discarding","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:22:06.694953-05:00","updated_at":"2025-11-21T10:59:00.406689-05:00","closed_at":"2025-11-20T21:35:53.117434-05:00","source_repo":".","comments":[{"id":20,"issue_id":"bd-5xt","author":"stevey","text":"In FlushManager.run() at flush_manager.go:197-200, timer-triggered flushes silently discard errors:\n\n```go\ncase \u003c-fm.timerFiredCh:\n if isDirty {\n _ = fm.performFlush(needsFullExport) // ← Error discarded!\n```\n\nUsers won't know if auto-flush is failing. Should at minimum log errors.\n\nConsider:\n- Log error with debug.Logf() or fmt.Fprintf(os.Stderr)\n- Optionally expose flush status via a Status() method\n- Track last flush error for diagnostics\n\nRelated: Code review finding #4 from bd-52 race condition fix review.","created_at":"2025-11-21T15:59:00Z"}]} -{"id":"bd-6049","content_hash":"16c54bc547f4ab180aee39efbb197709a47a39047f5bc2dd59e6e6b57ca8bc87","title":"bd doctor --json flag not working","description":"The --json flag on bd doctor command doesn't produce JSON output. It continues to show human-readable output instead. The flag is registered locally on doctorCmd but the code uses the global jsonOutput variable set by PersistentPreRun. Need to investigate why the flag isn't being honored.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-02T17:08:18.170428-08:00","updated_at":"2025-11-02T18:41:01.376783-08:00","closed_at":"2025-11-02T18:41:01.376786-08:00","source_repo":".","comments":[{"id":28,"issue_id":"bd-6049","author":"stevey","text":"Fixed by removing the local --json flag definition in doctor.go that was shadowing the persistent --json flag from main.go. The doctor command now correctly uses the global jsonOutput variable.","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-6214875c","content_hash":"d4d20e71bbf5c08f1fe1ed07f67b7554167aa165d4972ea51b5cacc1b256c4c1","title":"Split internal/rpc/server.go into focused modules","description":"The file `internal/rpc/server.go` is 2,273 lines with 50+ methods, making it difficult to navigate and prone to merge conflicts. Split into 8 focused files with clear responsibilities.\n\nCurrent structure: Single 2,273-line file with:\n- Connection handling\n- Request routing\n- All 40+ RPC method implementations\n- Storage caching\n- Health checks \u0026 metrics\n- Cleanup loops\n\nTarget structure:\n```\ninternal/rpc/\nβ”œβ”€β”€ server.go # Core server, connection handling (~300 lines)\nβ”œβ”€β”€ methods_issue.go # Issue operations (~400 lines)\nβ”œβ”€β”€ methods_deps.go # Dependency operations (~200 lines)\nβ”œβ”€β”€ methods_labels.go # Label operations (~150 lines)\nβ”œβ”€β”€ methods_ready.go # Ready work queries (~150 lines)\nβ”œβ”€β”€ methods_compact.go # Compaction operations (~200 lines)\nβ”œβ”€β”€ methods_comments.go # Comment operations (~150 lines)\nβ”œβ”€β”€ storage_cache.go # Storage caching logic (~300 lines)\n└── health.go # Health \u0026 metrics (~200 lines)\n```\n\nMigration strategy:\n1. Create new files with appropriate methods\n2. Keep `server.go` as main file with core server logic\n3. Test incrementally after each file split\n4. Final verification with full test suite","acceptance_criteria":"- All 50 methods split into appropriate files\n- Each file \u003c500 LOC\n- All methods remain on `*Server` receiver (no behavior change)\n- All tests pass: `go test ./internal/rpc/...`\n- Verify daemon works: start daemon, run operations, check health\n- Update internal documentation if needed\n- No change to public API","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T14:21:37.51524-07:00","updated_at":"2025-10-30T17:12:58.2179-07:00","closed_at":"2025-10-28T14:11:04.399811-07:00","source_repo":"."} -{"id":"bd-6221bdcd","content_hash":"6749091ed73f5ec7b55af226b2ae8c9aa134759951435e08e65a363c674ea0c9","title":"Optimize cmd/bd test suite performance (currently 30+ minutes)","description":"CLI test suite is extremely slow (~30+ minutes for full run). Tests are poorly designed and need performance optimization before expanding coverage.\n\nCurrent coverage: 24.8% (improved from 20.2%)\n\n**Problem**: Tests take far too long to run, making development iteration painful.\n\n**Priority**: Fix test performance FIRST, then consider increasing coverage.\n\n**Investigation needed**:\n- Profile test execution to identify bottlenecks\n- Look for redundant git operations, database initialization, or daemon operations\n- Identify opportunities for test parallelization\n- Consider mocking or using in-memory databases where appropriate\n- Review test design patterns\n\n**Related**: bd-ktng mentions 13 CLI tests with redundant git init calls (31s total)\n\n**Goal**: Get full test suite under 1-2 minutes before adding more tests.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T14:06:27.951656-07:00","updated_at":"2025-11-08T22:42:08.862178-08:00","closed_at":"2025-11-08T22:41:05.766749-08:00","source_repo":".","dependencies":[{"issue_id":"bd-6221bdcd","depends_on_id":"bd-4d7fca8a","type":"blocks","created_at":"2025-10-29T19:52:05.532391-07:00","created_by":"import-remap"}]} -{"id":"bd-627d","content_hash":"5b3d3d69ceac28dcbfbc2c7ea2f7a6ff2a3a02bc58ce02dcf6b05f8469e8bddc","title":"AI-supervised database migrations for safer schema evolution","description":"## Problem\n\nDatabase migrations can lose user data through edge cases that are hard to anticipate (e.g., GH #201 where bd migrate failed to set issue_prefix, or bd-d355a07d false positive data loss warnings). Since beads is designed to be run by AI agents, we should leverage AI to make migrations safer.\n\n## Current State\n\nMigrations run blindly with:\n- No pre-flight validation\n- No data integrity verification\n- No rollback on failure\n- Limited post-migration testing\n\nRecent issues:\n- GH #201: Migration didn't set issue_prefix config, breaking commands\n- bd-d355a07d: False positive \"data loss\" warnings on collision resolution\n- Users reported migration data loss (fixed but broader problem remains)\n\n## Proposal: AI-Supervised Migration Framework\n\nUse AI to supervise migrations through structured verification:\n\n### 1. Pre-Migration Analysis\n- AI reads migration code and current schema\n- Identifies potential data loss scenarios\n- Generates validation queries to verify assumptions\n- Creates snapshot queries for before/after comparison\n\n### 2. Migration Execution\n- Take database backup/snapshot\n- Run validation queries (pre-state)\n- Execute migration in transaction\n- Run validation queries (post-state)\n\n### 3. Post-Migration Verification\n- AI compares pre/post snapshots\n- Verifies data integrity invariants\n- Checks for unexpected data loss\n- Validates config completeness (like issue_prefix)\n\n### 4. Rollback on Anomalies\n- If AI detects data loss, rollback transaction\n- Present human-readable error report\n- Suggest fix before retrying\n\n## Example Flow\n\n```\n$ bd migrate\n\nβ†’ Analyzing migration plan...\nβ†’ AI identified 3 potential data loss scenarios\nβ†’ Generating validation queries...\nβ†’ Creating pre-migration snapshot...\nβ†’ Running migration in transaction...\nβ†’ Verifying post-migration state...\nβœ“ All 247 issues accounted for\nβœ“ Config table complete (issue_prefix: \"mcp\")\nβœ“ Dependencies intact (342 relationships verified)\nβ†’ Migration successful!\n```\n\nIf something goes wrong:\n```\n$ bd migrate\n\nβ†’ Analyzing migration plan...\nβ†’ AI identified issue: Missing issue_prefix config after migration\nβ†’ Recommendation: Add prefix detection step\nβ†’ Aborting migration - database unchanged\n```\n\n## Implementation Ideas\n\n### A. Migration Validator Tool\nCreate `bd migrate --validate` that:\n- Simulates migration on copy of database\n- Uses AI to verify data integrity\n- Reports potential issues before real migration\n\n### B. Migration Test Generator\nAI generates test cases for migrations:\n- Edge cases (empty DB, large DB, missing config)\n- Data integrity checks\n- Regression tests\n\n### C. Migration Invariants\nDefine invariants that AI checks:\n- Issue count should not decrease (unless collision resolution)\n- All required config keys present\n- Foreign key relationships intact\n- No orphaned dependencies\n\n### D. Self-Healing Migrations\nAI detects incomplete migrations and suggests fixes:\n- Missing config values (like GH #201)\n- Orphaned data\n- Index inconsistencies\n\n## Benefits\n\n1. **Catch edge cases**: AI explores scenarios humans miss\n2. **Self-documenting**: AI explains what migration does\n3. **Agent-friendly**: Agents can run migrations confidently\n4. **Fewer rollbacks**: Detect issues before committing\n5. **Better testing**: AI generates comprehensive test suites\n\n## Open Questions\n\n1. Which AI model? (Fast: Haiku, Thorough: Sonnet/GPT-4)\n2. How to balance safety vs migration speed?\n3. Should AI validation be required or optional?\n4. How to handle offline scenarios (no API access)?\n5. What invariants should always be checked?\n\n## Related Work\n\n- bd-b245: Migration registry (makes migrations introspectable)\n- GH #201: issue_prefix migration bug (motivating example)\n- bd-d355a07d: False positive data loss warnings","design":"## Architecture: Agent-Supervised Migrations (Inversion of Control)\n\n**Key principle:** Beads provides observability and validation primitives. AI agents supervise using their own reasoning. Beads NEVER makes AI API calls.\n\n## Phase 1: Migration Invariants (Pure Validation)\n\nCreate `internal/storage/sqlite/migration_invariants.go`:\n\n```go\ntype MigrationInvariant struct {\n Name string\n Description string\n Check func(*sql.DB, *Snapshot) error\n}\n\ntype Snapshot struct {\n IssueCount int\n ConfigKeys []string\n DependencyCount int\n LabelCount int\n}\n\nvar invariants = []MigrationInvariant{\n {\n Name: \"required_config_present\",\n Description: \"Required config keys must exist\",\n Check: checkRequiredConfig, // Would have caught GH #201\n },\n {\n Name: \"foreign_keys_valid\",\n Description: \"No orphaned dependencies or labels\",\n Check: checkForeignKeys,\n },\n {\n Name: \"issue_count_stable\",\n Description: \"Issue count should not decrease unexpectedly\",\n Check: checkIssueCount,\n },\n}\n\nfunc checkRequiredConfig(db *sql.DB, snapshot *Snapshot) error {\n required := []string{\"issue_prefix\", \"schema_version\"}\n for _, key := range required {\n var value string\n err := db.QueryRow(\"SELECT value FROM config WHERE key = ?\", key).Scan(\u0026value)\n if err != nil || value == \"\" {\n return fmt.Errorf(\"required config key missing: %s\", key)\n }\n }\n return nil\n}\n```\n\n## Phase 2: Dry-Run \u0026 Inspection Tools\n\nAdd `bd migrate --dry-run --json`:\n\n```json\n{\n \"pending_migrations\": [\n {\"name\": \"dirty_issues_table\", \"description\": \"Adds dirty_issues table\"},\n {\"name\": \"content_hash_column\", \"description\": \"Adds content_hash for collision resolution\"}\n ],\n \"current_state\": {\n \"schema_version\": \"0.9.9\",\n \"issue_count\": 247,\n \"config\": {\"schema_version\": \"0.9.9\"},\n \"missing_config\": [\"issue_prefix\"]\n },\n \"warnings\": [\n \"issue_prefix config not set - may break commands after migration\"\n ],\n \"invariants_to_check\": [\n \"required_config_present\",\n \"foreign_keys_valid\",\n \"issue_count_stable\"\n ]\n}\n```\n\nAdd `bd info --schema --json`:\n\n```json\n{\n \"tables\": [\"issues\", \"dependencies\", \"labels\", \"config\"],\n \"schema_version\": \"0.9.9\",\n \"config\": {},\n \"sample_issue_ids\": [\"mcp-1\", \"mcp-2\"],\n \"detected_prefix\": \"mcp\"\n}\n```\n\n## Phase 3: Pre/Post Snapshots with Rollback\n\nUpdate `RunMigrations()`:\n\n```go\nfunc RunMigrations(db *sql.DB) error {\n // Capture pre-migration snapshot\n snapshot := captureSnapshot(db)\n \n // Run migrations in transaction\n tx, err := db.Begin()\n if err != nil {\n return err\n }\n defer tx.Rollback()\n \n for _, migration := range migrations {\n if err := migration.Func(tx); err != nil {\n return fmt.Errorf(\"migration %s failed: %w\", migration.Name, err)\n }\n }\n \n // Verify invariants before commit\n if err := verifyInvariants(tx, snapshot); err != nil {\n return fmt.Errorf(\"post-migration validation failed (rolled back): %w\", err)\n }\n \n return tx.Commit()\n}\n```\n\n## Phase 4: MCP Tools for Agent Supervision\n\nAdd to beads-mcp:\n\n```python\n@server.tool()\nasync def inspect_migration(workspace_root: str) -\u003e dict:\n \"\"\"Get migration plan and current state for agent analysis.\n \n Agent should:\n 1. Review pending migrations\n 2. Check for warnings (missing config, etc.)\n 3. Verify invariants will pass\n 4. Decide whether to run bd migrate\n \"\"\"\n result = run_bd([\"migrate\", \"--dry-run\", \"--json\"], workspace_root)\n return json.loads(result.stdout)\n\n@server.tool() \nasync def get_schema_info(workspace_root: str) -\u003e dict:\n \"\"\"Get current database schema for migration analysis.\"\"\"\n result = run_bd([\"info\", \"--schema\", \"--json\"], workspace_root)\n return json.loads(result.stdout)\n```\n\n## Agent Workflow Example\n\n```python\n# Agent detects user wants to migrate\nmigration_plan = inspect_migration(\"/path/to/workspace\")\n\n# Agent analyzes (using its own reasoning, no API calls from beads)\nif \"issue_prefix\" in migration_plan[\"missing_config\"]:\n schema = get_schema_info(\"/path/to/workspace\")\n detected_prefix = schema[\"detected_prefix\"]\n \n # Agent fixes issue before migration\n run_bd([\"config\", \"set\", \"issue_prefix\", detected_prefix])\n \n# Now safe to migrate\nrun_bd([\"migrate\"])\n```\n\n## What Beads Provides\n\nβœ… Deterministic validation (invariants)\nβœ… Structured inspection (--dry-run, --explain)\nβœ… Rollback on invariant failure\nβœ… JSON output for agent parsing\n\n## What Beads Does NOT Do\n\n❌ No AI API calls\n❌ No external model access\n❌ No agent invocation\n\nAgents supervise migrations using their own reasoning and the inspection tools beads provides.","acceptance_criteria":"Phase 1: Migration invariants implemented and tested, checked after every migration, clear error messages when invariants fail.\n\nPhase 2: Snapshot capture before migrations, comparison after, rollback on verification failure.\n\nPhase 3 (stretch): AI validation optional flag implemented, AI can analyze migration code and generate custom validation queries.\n\nPhase 4 (stretch): Migration test fixtures created, all fixtures pass migrations, CI runs migration tests.","notes":"## Progress\n\n### βœ… Phase 1: Migration Invariants (COMPLETED)\n\n**Implemented:**\n- Created internal/storage/sqlite/migration_invariants.go with 3 invariants\n- Updated RunMigrations() to verify invariants after migrations\n- All tests pass βœ“\n\n### βœ… Phase 2: Inspection Tools (COMPLETED \u0026 PUSHED)\n\n**Commit:** 1abe4e7 - \"Add migration inspection tools for AI agents (bd-627d Phase 2)\"\n\n**Implemented:**\n1. βœ… bd migrate --inspect --json - Shows migration plan\n2. βœ… bd info --schema --json - Returns schema details\n3. βœ… Migration warnings system\n4. βœ… Documentation updated in AGENTS.md\n5. βœ… All tests pass\n\n### βœ… Phase 3: MCP Tools (COMPLETED \u0026 PUSHED)\n\n**Commit:** 2493693 - \"Add MCP tools for migration inspection (bd-627d Phase 3)\"\n\n**Implemented:**\n1. βœ… inspect_migration(workspace_root) tool in beads-mcp\n2. βœ… get_schema_info(workspace_root) tool in beads-mcp\n3. βœ… Abstract methods in BdClientBase\n4. βœ… CLI client implementations\n5. βœ… All tests pass\n\n**All phases complete!** Migration inspection fully integrated into MCP server.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-02T12:57:10.722048-08:00","updated_at":"2025-11-02T14:31:25.095296-08:00","closed_at":"2025-11-02T14:31:25.095308-08:00","source_repo":"."} -{"id":"bd-62a0","content_hash":"b8b2a58a86211a19aed9d21ec5215b4f14ef341ee95d4ed845e1412840d00fd7","title":"Create WASM build infrastructure (Makefile, scripts)","description":"Set up build tooling for WASM compilation:\n- Add GOOS=js GOARCH=wasm build target\n- Copy wasm_exec.js from Go distribution\n- Create wrapper script for Node.js execution\n- Add build task to Makefile or build script","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.286826-08:00","updated_at":"2025-11-02T22:23:49.376789-08:00","closed_at":"2025-11-02T22:23:49.376789-08:00","source_repo":".","dependencies":[{"issue_id":"bd-62a0","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.423064-08:00","created_by":"stevey"}]} -{"id":"bd-63e9","content_hash":"7c709804b6d15ce63897344b0674dfae6a4fe97e3ae2768585e2a3407484bad0","title":"Fix Nix flake build test failures","description":"Nix build is failing during test phase with same test errors as Windows.\n\n**Error:**\n```\nerror: Cannot build '/nix/store/rgyi1j44dm6ylrzlg2h3z97axmfq9hzr-beads-0.9.9.drv'.\nReason: builder failed with exit code 1.\nFAIL github.com/steveyegge/beads/cmd/bd 16.141s\n```\n\nThis may be related to test environment setup or the same issues affecting Windows tests.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-02T09:29:37.2851-08:00","updated_at":"2025-11-04T11:10:23.531386-08:00","closed_at":"2025-11-04T11:10:23.531389-08:00","source_repo":".","dependencies":[{"issue_id":"bd-63e9","depends_on_id":"bd-1231","type":"blocks","created_at":"2025-11-02T09:29:37.28618-08:00","created_by":"stevey"}]} -{"id":"bd-64c05d00","content_hash":"ab391b33353bfe693ef571e9fcb4a222eb5289a07e60258bd88c29565e85c4d0","title":"Multi-clone collision resolution testing and documentation","description":"Epic to track improvements to multi-clone collision resolution based on ultrathinking analysis of-3d844c58 and [deleted:bd-71107098].\n\nCurrent state:\n- 2-clone collision resolution is SOUND and working correctly\n- Hash-based deterministic collision resolution works\n- Test fails due to timestamp comparison, not actual logic issues\n\nWork needed:\n1. Fix TestTwoCloneCollision to compare content not timestamps\n2. Add TestThreeCloneCollision for regression protection\n3. Document 3-clone ID non-determinism as known behavior","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T17:58:38.316626-07:00","updated_at":"2025-11-05T00:32:09.153134-08:00","closed_at":"2025-11-04T11:10:23.531681-08:00","source_repo":"."} -{"id":"bd-64c05d00.1","content_hash":"4ed407ab9518dbf45a4097460354d7857dd53881b913ad770def31d46dc6dc15","title":"Fix TestTwoCloneCollision to compare content not timestamps","description":"The test at beads_twoclone_test.go:204-207 currently compares full JSON output including timestamps, causing false negative failures.\n\nCurrent behavior:\n- Both clones converge to identical semantic content\n- Clone A: test-2=\"Issue from clone A\", test-1=\"Issue from clone B\"\n- Clone B: test-1=\"Issue from clone B\", test-2=\"Issue from clone A\"\n- Titles match IDs correctly, no data corruption\n- Only timestamps differ (expected and acceptable)\n\nFix needed:\n- Replace exact JSON comparison with content-aware comparison\n- Normalize or ignore timestamp fields when asserting convergence\n- Test should PASS after this fix\n\nThis blocks completion of bd-71107098.","acceptance_criteria":"- Test compares issue content (title, description, status, priority) not timestamps\n- TestTwoCloneCollision passes\n- Both clones shown to have identical semantic content\n- Timestamps explicitly documented as acceptable difference","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T17:58:52.057194-07:00","updated_at":"2025-10-30T17:12:58.226744-07:00","closed_at":"2025-10-28T18:01:38.751895-07:00","source_repo":".","dependencies":[{"issue_id":"bd-64c05d00.1","depends_on_id":"bd-64c05d00","type":"parent-child","created_at":"2025-10-28T17:58:52.058202-07:00","created_by":"stevey"},{"issue_id":"bd-64c05d00.1","depends_on_id":"bd-71107098","type":"blocks","created_at":"2025-10-28T17:58:52.05873-07:00","created_by":"stevey"}]} -{"id":"bd-64c05d00.2","content_hash":"bee12f24cd1fc490bef9065a1981f4d4f5289d375102290db320e24afa90a3ca","title":"Document 3-clone ID non-determinism in collision resolution","description":"Document the known behavior of 3+ way collision resolution where ID assignments may vary based on sync order, even though content always converges correctly.\n\nUpdates needed:\n- Update bd-71107098 notes to mark 2-clone case as solved\n- Document 3-clone ID non-determinism as known limitation\n- Add explanation to ADVANCED.md or collision resolution docs\n- Explain why this happens (pairwise hash comparison is deterministic, but multi-way ID allocation uses sync-order dependent counters)\n- Clarify trade-offs: content convergence βœ… vs ID stability ❌\n\nKey points to document:\n- Hash-based resolution is pairwise deterministic\n- Content always converges correctly (all issues present with correct data)\n- Numeric ID assignments in 3+ way collisions depend on sync order\n- This is acceptable for most use cases (content convergence is primary goal)\n- Full determinism would require complex multi-way comparison","acceptance_criteria":"- bd-71107098 updated with notes about 2-clone solution being complete\n- 3-clone ID non-determinism documented in ADVANCED.md or similar\n- Explanation includes why it happens and trade-offs\n- Links to TestThreeCloneCollision as demonstration\n- Users understand this is expected behavior, not a bug","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T17:59:21.93014-07:00","updated_at":"2025-11-20T12:40:11.70764-05:00","closed_at":"2025-11-15T14:13:47.304584-08:00","source_repo":".","dependencies":[{"issue_id":"bd-64c05d00.2","depends_on_id":"bd-64c05d00","type":"parent-child","created_at":"2025-10-28T17:59:21.938709-07:00","created_by":"stevey"}]} -{"id":"bd-64c05d00.3","content_hash":"e006b991353a26f949bc3ae4476849ef785f399f6aca866586eb6fa03d243b35","title":"Add TestThreeCloneCollision for regression protection","description":"Add a 3-clone collision test to document behavior and provide regression protection.\n\nPurpose:\n- Verify content convergence regardless of sync order\n- Document the ID non-determinism behavior (IDs may be assigned differently based on sync order)\n- Provide regression protection for multi-way collisions\n\nTest design:\n- 3 clones create same ID with different content\n- Test two different sync orders (Aβ†’Bβ†’C vs Cβ†’Aβ†’B)\n- Assert content sets match (ignore specific ID assignments)\n- Add comment explaining ID non-determinism is expected behavior\n\nKnown limitation:\n- Content always converges correctly (all issues present with correct titles)\n- Numeric ID assignments (test-2 vs test-3) depend on sync order\n- This is acceptable if content convergence is the primary goal","acceptance_criteria":"- TestThreeCloneCollision added to beads_twoclone_test.go (or new file)\n- Tests 3 clones with same ID collision\n- Tests two different sync orders\n- Asserts content convergence (all issues present, correct titles)\n- Documents ID non-determinism in test comments\n- Test passes consistently","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T17:59:05.941735-07:00","updated_at":"2025-10-30T17:12:58.227089-07:00","closed_at":"2025-10-28T18:09:12.717604-07:00","source_repo":".","dependencies":[{"issue_id":"bd-64c05d00.3","depends_on_id":"bd-64c05d00","type":"parent-child","created_at":"2025-10-28T17:59:05.942783-07:00","created_by":"stevey"}]} -{"id":"bd-64z4","content_hash":"d707d871411b33bd6268d2a83ec6cc7696d9b38c86510dc7cb7a073fb2a8cfa3","title":"Assigned issue","description":"","status":"closed","priority":1,"issue_type":"task","assignee":"testuser","created_at":"2025-11-07T19:04:24.201309-08:00","updated_at":"2025-11-07T22:07:17.344151-08:00","closed_at":"2025-11-07T21:55:09.427387-08:00","source_repo":"."} -{"id":"bd-6545","content_hash":"1d49e101cae39bc8115422fdef1e2cde999e88e176e5bc5614a5aefdbcd174da","title":"Update daemon commit logic for separate branch","description":"Modify daemon to use worktree for commits when sync.branch configured.\n\nTasks:\n- Update internal/daemon/server_export_import_auto.go\n- Detect sync.branch configuration\n- Ensure worktree exists before commit\n- Sync JSONL to worktree\n- Commit in worktree context\n- Push to configured branch\n- Fallback to current behavior if sync.branch not set\n- Handle git errors (network, permissions, conflicts)\n\nEstimated effort: 3-4 days","acceptance_criteria":"- When sync.branch configured, commits go to separate branch\n- When sync.branch not configured, commits to current branch (backward compatible)\n- No disruption to primary worktree\n- Git errors handled gracefully with retry\n- Daemon logs show which branch was used","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.598861-08:00","updated_at":"2025-11-04T11:10:23.531964-08:00","closed_at":"2025-11-04T11:10:23.531966-08:00","source_repo":".","dependencies":[{"issue_id":"bd-6545","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.375661-08:00","created_by":"stevey"}]} -{"id":"bd-69bce74a","content_hash":"f15c14239ece575a79cbff8ab8351c9b8559e69f170db578de19c5a57d705317","title":"Platform tests: Linux, macOS, Windows","description":"Test event-driven mode on all platforms. Verify inotify (Linux), FSEvents (macOS), ReadDirectoryChangesW (Windows). Test fallback behavior on each.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.85636-07:00","updated_at":"2025-10-30T17:12:58.193697-07:00","closed_at":"2025-10-29T15:33:22.149551-07:00","source_repo":"."} -{"id":"bd-69fbe98e","content_hash":"d32265738f9b6db19c1db87c5d8416f56f12c1f2497b08cbaf04f7493224ab52","title":"Implement \"bd daemons logs\" subcommand","description":"Add command to view daemon logs for a specific workspace. Requires daemon logging to file (may need separate issue for log infrastructure).","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-26T19:41:11.099659-07:00","updated_at":"2025-11-06T20:06:49.218369-08:00","closed_at":"2025-11-06T19:53:45.855798-08:00","source_repo":"."} -{"id":"bd-6ada971e","content_hash":"3979df7395526a6796508aa1ed1e89c4fedc46ee5c2b79dd85066c8a78c8487a","title":"Create cmd/bd/daemon_event_loop.go (~200 LOC)","description":"Implement runEventDrivenLoop to replace polling ticker. Coordinate FileWatcher, mutation events, debouncer. Include health check ticker (60s) for daemon validation.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.429383-07:00","updated_at":"2025-10-30T17:12:58.220612-07:00","closed_at":"2025-10-28T12:30:44.067036-07:00","source_repo":"."} -{"id":"bd-6bebe013","content_hash":"f22a22149f90f02b8fcc211c3082f2bbb014ee6700ee7749037851e9d1f9cf2f","title":"Rapid 1","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.404437-07:00","updated_at":"2025-11-07T23:21:44.922966-08:00","closed_at":"2025-11-07T23:18:52.368766-08:00","source_repo":"."} -{"id":"bd-6c68","content_hash":"e35e484e4f95b135186624795a5eaa5ef8fc13bbcbdde30829a4796c420c4412","title":"bd info shows 'auto_start_disabled' even when daemon is crashed/missing","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:08:03.385681-07:00","updated_at":"2025-11-01T19:13:43.819004-07:00","closed_at":"2025-11-01T19:13:43.819004-07:00","source_repo":".","dependencies":[{"issue_id":"bd-6c68","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:03.387045-07:00","created_by":"stevey"}]} -{"id":"bd-6cxz","content_hash":"e083f81a4836dc434a214cdc4f1fefdfebfdcb523d08a89486f682fe25e0e16b","title":"Fix MCP tools failing to load in Claude Code (GH#346)","description":"Fix FastMCP schema generation bug by refactoring `Issue` model to avoid recursion.\n \n - Refactored `Issue` in `models.py` to use `LinkedIssue` for dependencies/dependents.\n - Restored missing `Mail*` models to `models.py`.\n - Fixed `tests/test_mail.py` mock assertion.\n \n Fixes GH#346.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T18:53:40.229801-05:00","updated_at":"2025-11-20T18:53:44.280296-05:00","closed_at":"2025-11-20T18:53:44.280296-05:00","source_repo":"."} -{"id":"bd-6d7efe32","content_hash":"e5c88e7c673bc83ef3b7c24deea92055c4f663327f6831c41f2aa601d0855528","title":"CRDT-based architecture for guaranteed convergence (v2.0)","description":"## Vision\nRedesign beads around Conflict-Free Replicated Data Types (CRDTs) to provide mathematical guarantees for N-way collision resolution at arbitrary scale.\n\n## Current Limitations\n- Content-hash based collision resolution fails at 5+ clones\n- Non-deterministic convergence in multi-round scenarios\n- UNIQUE constraint violations during rename operations\n- No formal proof of convergence properties\n\n## CRDT Benefits\n- Provably convergent (Strong Eventual Consistency)\n- Commutative/Associative/Idempotent operations\n- No coordination required between clones\n- Scales to 100+ concurrent workers\n- Well-understood mathematical foundations\n\n## Proposed Architecture\n\n### 1. UUID-Based IDs\nReplace sequential IDs with UUIDs:\n- Current: bd-1c63eb84, bd-9063acda, bd-4d80b7b1\n- CRDT: bd-a1b2c3d4-e5f6-7890-abcd-ef1234567890\n- Human aliases maintained separately: #42 maps to UUID\n\n### 2. Last-Write-Wins (LWW) Elements\nEach field becomes an LWW register:\n- title: (timestamp, clone_id, value)\n- status: (timestamp, clone_id, value)\n- Deterministic conflict resolution via Lamport timestamp + clone_id tiebreaker\n\n### 3. Operation Log\nTrack all operations as CRDT ops:\n- CREATE(uuid, timestamp, clone_id, fields)\n- UPDATE(uuid, field, timestamp, clone_id, value)\n- DELETE(uuid, timestamp, clone_id) - tombstone, not hard delete\n\n### 4. Sync as Merge\nSyncing becomes merging two CRDT states:\n- No merge conflicts possible\n- Deterministic merge function\n- Guaranteed convergence\n\n## Implementation Phases\n\n### Phase 1: Research \u0026 Design (4 weeks)\n- Study existing CRDT implementations (Automerge, Yjs, Loro)\n- Design schema for CRDT-based issue tracking\n- Prototype LWW-based Issue CRDT\n- Benchmark performance vs current system\n\n### Phase 2: Parallel Implementation (6 weeks)\n- Implement CRDT storage layer alongside SQLite\n- Build conversion tools: SQLite ↔ CRDT\n- Maintain backward compatibility with v1.x format\n- Migration path for existing databases\n\n### Phase 3: Testing \u0026 Validation (4 weeks)\n- Formal verification of convergence properties\n- Stress testing with 100+ clone scenario\n- Performance profiling and optimization\n- Documentation and examples\n\n### Phase 4: Migration \u0026 Rollout (4 weeks)\n- Release v2.0-beta with CRDT backend\n- Gradual migration from v1.x\n- Monitoring and bug fixes\n- Final v2.0 release\n\n## Risks \u0026 Mitigations\n\n**Risk 1: Performance overhead**\n- Mitigation: Benchmark early, optimize hot paths\n- CRDTs can be slower than append-only logs\n- May need compaction strategy\n\n**Risk 2: Storage bloat**\n- Mitigation: Implement operation log compaction\n- Tombstone garbage collection for deleted issues\n- Periodic snapshots to reduce log size\n\n**Risk 3: Breaking changes**\n- Mitigation: Maintain v1.x compatibility layer\n- Gradual migration tools\n- Dual-mode operation during transition\n\n**Risk 4: Complexity**\n- Mitigation: Use battle-tested CRDT libraries\n- Comprehensive documentation\n- Clear migration guide\n\n## Success Criteria\n- 100-clone collision test passes without failures\n- Formal proof of convergence properties\n- Performance within 2x of current system\n- Zero manual conflict resolution required\n- Backward compatible with v1.x databases\n\n## Timeline\n18-20 weeks total (4-5 months)\n\n## References\n- Automerge: https://automerge.org\n- Yjs: https://docs.yjs.dev\n- Loro: https://loro.dev\n- CRDT theory: Shapiro et al, A comprehensive study of CRDTs\n- Related issues: bd-e6d71828, bd-7a2b58fc, bd-81abb639","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-10-29T20:48:00.267237-07:00","updated_at":"2025-10-31T20:06:44.604643-07:00","closed_at":"2025-10-31T20:06:44.604643-07:00","source_repo":"."} -{"id":"bd-6ed8","content_hash":"f9c4f8b0dfc2f32b8976294a030120a3122a7a0163fbabbf97e23e6c1240c1ae","title":"Fixture Generator for Realistic Test Data","description":"Create internal/testutil/fixtures/fixtures.go with functions to generate realistic test data at scale.\n\nFunctions:\n- LargeSQLite(storage) - 10K issues, native SQLite\n- XLargeSQLite(storage) - 20K issues, native SQLite \n- LargeFromJSONL(storage) - 10K issues imported from JSONL\n- XLargeFromJSONL(storage) - 20K issues imported from JSONL\n\nData characteristics:\n- Epic hierarchies (depth 4): Epic β†’ Feature β†’ Task β†’ Subtask\n- Cross-linked dependencies (tasks blocking across epics)\n- Realistic status/priority/label distribution\n- Representative assignees and temporal data\n\nImplementation:\n- Single file: internal/testutil/fixtures/fixtures.go\n- No config structs, simple direct functions\n- Seeded RNG for reproducibility\n- Reusable by both benchmarks and tests","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:22:28.233977-08:00","updated_at":"2025-11-13T22:40:19.485552-08:00","closed_at":"2025-11-13T22:40:19.485552-08:00","source_repo":".","dependencies":[{"issue_id":"bd-6ed8","depends_on_id":"bd-3tfh","type":"blocks","created_at":"2025-11-13T22:23:58.120794-08:00","created_by":"daemon"},{"issue_id":"bd-6ed8","depends_on_id":"bd-m62x","type":"blocks","created_at":"2025-11-13T22:24:02.598071-08:00","created_by":"daemon"}]} -{"id":"bd-6hji","content_hash":"6da407d81b32c439e93754b0d5322a6ba2a4377569b9f7a425d02c6b1b1987dc","title":"Test exclusive file reservations with two agents","description":"Simulate two agents racing to claim the same issue and verify that exclusive reservations prevent collision.\n\nAcceptance Criteria:\n- Agent A reserves bd-123 β†’ succeeds\n- Agent B tries to reserve bd-123 β†’ fails with clear error message\n- Agent B can see who has the reservation\n- Reservation expires after TTL\n- Agent B can claim after expiration","notes":"Successfully tested file reservations:\n- Agent BrownBear reserved bd-123 β†’ granted\n- Agent ChartreuseHill tried same β†’ conflicts returned\n- System correctly prevents collision","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-07T22:41:59.963468-08:00","updated_at":"2025-11-08T00:03:18.004972-08:00","closed_at":"2025-11-08T00:03:18.004972-08:00","source_repo":".","dependencies":[{"issue_id":"bd-6hji","depends_on_id":"bd-muls","type":"blocks","created_at":"2025-11-07T23:03:52.897843-08:00","created_by":"daemon"},{"issue_id":"bd-6hji","depends_on_id":"bd-27xm","type":"blocks","created_at":"2025-11-07T23:20:21.911222-08:00","created_by":"daemon"},{"issue_id":"bd-6hji","depends_on_id":"bd-spmx","type":"parent-child","created_at":"2025-11-08T00:02:47.904652-08:00","created_by":"daemon"}]} -{"id":"bd-6ku3","content_hash":"44f4b7c866bd65391dccc5aadee556a7be9b07661e355018c6cb8906b73e3ab3","title":"Fix TestMigrateHashIDs test failure","description":"Test failure in cmd/bd/migrate_hash_ids_test.go:100 - New ID bd-09970281 for bd-1 is not a hash ID. This test is validating the hash ID migration but the generated ID doesn't match the expected format.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:52:58.114046-08:00","updated_at":"2025-11-06T19:04:58.804373-08:00","closed_at":"2025-11-06T19:04:58.804373-08:00","source_repo":"."} -{"id":"bd-6mjj","content_hash":"2226a78fdb09302679f4fd9424d4e8c8fbdef1ef374bdd3789471b4c0868358d","title":"Split test suites: fast vs. integration","description":"Reorganize tests into separate packages/files for fast unit tests vs slow integration tests.\n\nBenefits:\n- Clear separation of concerns\n- Easier to run just fast tests during development\n- Can parallelize CI jobs better\n\nFiles to organize:\n- beads_hash_multiclone_test.go (slow integration tests)\n- beads_integration_test.go (medium-speed integration tests)\n- Other test files (fast unit tests)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-04T01:24:21.040347-08:00","updated_at":"2025-11-04T10:38:12.408674-08:00","closed_at":"2025-11-04T10:38:12.408674-08:00","source_repo":".","dependencies":[{"issue_id":"bd-6mjj","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:21.041228-08:00","created_by":"daemon"}]} -{"id":"bd-6sd1","content_hash":"1db772b8c6d380085b5f9b5978cf9c853723c24b5aa9245b307e473ce894d1d5","title":"Issue to close","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T19:00:16.547698-08:00","updated_at":"2025-11-07T19:00:16.570826-08:00","closed_at":"2025-11-07T19:00:16.570826-08:00","source_repo":"."} -{"id":"bd-6uix","content_hash":"13189ab05a00f5291ba60c8d3331d7f0d6aacbc9d14da79ca6344214eaf5d1ba","title":"Message System Improvements","description":"Consolidate improvements to the bd message command including core functionality (message reading), reliability (timeouts), validation, and code quality refactoring","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-08T12:55:47.907771-08:00","updated_at":"2025-11-08T12:59:05.802367-08:00","closed_at":"2025-11-08T12:59:05.802367-08:00","source_repo":"."} -{"id":"bd-6z7l","content_hash":"96ccdda5d2ef893f70cba842f813665cd3a8ae05cdc5fffef5f8f8a17425f145","title":"Auto-detect scenarios and prompt users","description":"Detect when user is in fork/contributor scenario and prompt with helpful suggestions. Check: git remote relationships, existing .beads config, repo ownership. Suggest appropriate wizard.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:04:30.070695-08:00","updated_at":"2025-11-05T19:27:33.074733-08:00","closed_at":"2025-11-05T18:57:03.315476-08:00","source_repo":".","dependencies":[{"issue_id":"bd-6z7l","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.205478-08:00","created_by":"daemon"}]} -{"id":"bd-70419816","content_hash":"5b7eac7e0a00f1253fd8fd3932695b2b4b3a1e0afc632ee0d1a53ffa3ad60a77","title":"Export deduplication breaks when JSONL and export_hashes table diverge","description":"## Problem\n\nThe export deduplication feature (timestamp-only skipping) breaks when the JSONL file and export_hashes table get out of sync, causing exports to skip issues that aren't actually in the file.\n\n## Symptoms\n\n- `bd export` reports \"Skipped 128 issue(s) with timestamp-only changes\"\n- JSONL file only has 38 lines but DB has 149 issues\n- export_hashes table has 149 entries\n- Auto-import doesn't trigger (hash matches despite missing data)\n- Two repos on same commit show different issue counts\n\n## Root Cause\n\nshouldSkipExport() in autoflush.go compares current issue hash with stored export_hashes entry. If they match, it skips export assuming the issue is already in the JSONL.\n\nThis assumption fails when:\n1. Git operations (pull, reset, checkout) change JSONL without clearing export_hashes\n2. Manual JSONL edits or corruption\n3. Import operations that modify DB but don't update export_hashes\n4. Partial exports that update export_hashes but don't complete\n\n## Impact\n\n- **Critical data loss risk**: Issues appear to be tracked but aren't persisted to git\n- Breaks multi-repo sync (root cause of today's debugging session)\n- Auto-import fails to detect staleness (hash matches despite missing data)\n- Silent data corruption (no error messages, just missing issues)\n\n## Reproduction\n\n1. Have DB with 149 issues, all in export_hashes table\n2. Truncate JSONL to 38 lines (simulate git reset or corruption)\n3. Run `bd export` - it skips 128 issues\n4. JSONL still has only 38 lines but export thinks it succeeded\n\n## Current Workaround\n\n```bash\nsqlite3 .beads/beads.db \"DELETE FROM export_hashes\"\nbd export -o .beads/beads.jsonl\n```\n\n## Proposed Solutions\n\n**Option 1: Verify JSONL integrity before skipping**\n- Count lines in JSONL, compare with export_hashes count\n- If mismatch, clear export_hashes and force full export\n- Safe but adds I/O overhead\n\n**Option 2: Hash-based JSONL validation**\n- Store hash of entire JSONL file in metadata\n- Before export, check if JSONL hash matches\n- If mismatch, clear export_hashes\n- More efficient, detects any JSONL corruption\n\n**Option 3: Disable timestamp-only deduplication**\n- Remove the feature entirely\n- Always export all issues\n- Simplest and safest, but creates larger git commits\n\n**Option 4: Clear export_hashes on git operations**\n- Add post-merge hook to clear export_hashes\n- Clear on any import operation\n- Defensive approach but may over-clear\n\n## Recommended Fix\n\nCombination of Options 2 + 4:\n1. Store JSONL file hash in metadata after export\n2. Check hash before export, clear export_hashes if mismatch \n3. Clear export_hashes on import operations\n4. Add `bd validate` check for JSONL/export_hashes sync\n\n## Files Involved\n\n- cmd/bd/autoflush.go (shouldSkipExport)\n- cmd/bd/export.go (export with deduplication)\n- internal/storage/sqlite/metadata.go (export_hashes table)","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-29T23:05:13.960352-07:00","updated_at":"2025-10-30T17:12:58.19679-07:00","closed_at":"2025-10-29T22:22:20.406934-07:00","source_repo":"."} -{"id":"bd-710a4916","content_hash":"f868eafd3460dccd57e0c50a27ad7fb273547d37dad7eb83efd3678106fad62a","title":"CRDT-based architecture for guaranteed convergence (v2.0)","description":"## Vision\nRedesign beads around Conflict-Free Replicated Data Types (CRDTs) to provide mathematical guarantees for N-way collision resolution at arbitrary scale.\n\n## Current Limitations\n- Content-hash based collision resolution fails at 5+ clones\n- Non-deterministic convergence in multi-round scenarios\n- UNIQUE constraint violations during rename operations\n- No formal proof of convergence properties\n\n## CRDT Benefits\n- Provably convergent (Strong Eventual Consistency)\n- Commutative/Associative/Idempotent operations\n- No coordination required between clones\n- Scales to 100+ concurrent workers\n- Well-understood mathematical foundations\n\n## Proposed Architecture\n\n### 1. UUID-Based IDs\nReplace sequential IDs with UUIDs:\n- Current: bd-1c63eb84, bd-9063acda, bd-4d80b7b1\n- CRDT: bd-a1b2c3d4-e5f6-7890-abcd-ef1234567890\n- Human aliases maintained separately: #42 maps to UUID\n\n### 2. Last-Write-Wins (LWW) Elements\nEach field becomes an LWW register:\n- title: (timestamp, clone_id, value)\n- status: (timestamp, clone_id, value)\n- Deterministic conflict resolution via Lamport timestamp + clone_id tiebreaker\n\n### 3. Operation Log\nTrack all operations as CRDT ops:\n- CREATE(uuid, timestamp, clone_id, fields)\n- UPDATE(uuid, field, timestamp, clone_id, value)\n- DELETE(uuid, timestamp, clone_id) - tombstone, not hard delete\n\n### 4. Sync as Merge\nSyncing becomes merging two CRDT states:\n- No merge conflicts possible\n- Deterministic merge function\n- Guaranteed convergence\n\n## Implementation Phases\n\n### Phase 1: Research \u0026 Design (4 weeks)\n- Study existing CRDT implementations (Automerge, Yjs, Loro)\n- Design schema for CRDT-based issue tracking\n- Prototype LWW-based Issue CRDT\n- Benchmark performance vs current system\n\n### Phase 2: Parallel Implementation (6 weeks)\n- Implement CRDT storage layer alongside SQLite\n- Build conversion tools: SQLite ↔ CRDT\n- Maintain backward compatibility with v1.x format\n- Migration path for existing databases\n\n### Phase 3: Testing \u0026 Validation (4 weeks)\n- Formal verification of convergence properties\n- Stress testing with 100+ clone scenario\n- Performance profiling and optimization\n- Documentation and examples\n\n### Phase 4: Migration \u0026 Rollout (4 weeks)\n- Release v2.0-beta with CRDT backend\n- Gradual migration from v1.x\n- Monitoring and bug fixes\n- Final v2.0 release\n\n## Risks \u0026 Mitigations\n\n**Risk 1: Performance overhead**\n- Mitigation: Benchmark early, optimize hot paths\n- CRDTs can be slower than append-only logs\n- May need compaction strategy\n\n**Risk 2: Storage bloat**\n- Mitigation: Implement operation log compaction\n- Tombstone garbage collection for deleted issues\n- Periodic snapshots to reduce log size\n\n**Risk 3: Breaking changes**\n- Mitigation: Maintain v1.x compatibility layer\n- Gradual migration tools\n- Dual-mode operation during transition\n\n**Risk 4: Complexity**\n- Mitigation: Use battle-tested CRDT libraries\n- Comprehensive documentation\n- Clear migration guide\n\n## Success Criteria\n- 100-clone collision test passes without failures\n- Formal proof of convergence properties\n- Performance within 2x of current system\n- Zero manual conflict resolution required\n- Backward compatible with v1.x databases\n\n## Timeline\n18-20 weeks total (4-5 months)\n\n## References\n- Automerge: https://automerge.org\n- Yjs: https://docs.yjs.dev\n- Loro: https://loro.dev\n- CRDT theory: Shapiro et al, A comprehensive study of CRDTs\n- Related issues: bd-e6d71828, bd-7a2b58fc,-1","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-10-29T10:23:57.978339-07:00","updated_at":"2025-11-08T01:58:15.280264-08:00","closed_at":"2025-11-08T00:54:51.171319-08:00","source_repo":"."} -{"id":"bd-71107098","content_hash":"9feb9a8dc8ae2dc65b11edeff37cf5ce48d8f28e1ced45d64ac0176937610296","title":"Make two-clone workflow actually work (no hacks)","description":"TestTwoCloneCollision proves beads CANNOT handle two independent clones filing issues simultaneously. This is the basic collaborative workflow and it must work cleanly.\n\nTest location: beads_twoclone_test.go\n\nThe test creates two git clones, both file issues with same ID (test-1), --resolve-collisions remaps clone B's to test-2, but after sync:\n- Clone A has test-1=\"Issue from clone A\", test-2=\"Issue from clone B\" \n- Clone B has test-1=\"Issue from clone B\", test-2=\"Issue from clone A\"\n\nThe TITLES are swapped! Both clones have 2 issues but with opposite title assignments.\n\nWe've tried many fixes (per-project daemons, auto-sync, lamport hashing, precommit hooks) but nothing has made the test pass.\n\nGoal: Make the test pass WITHOUT hacks. The two clones should converge to identical state after sync.","acceptance_criteria":"1. TestTwoCloneCollision passes without EXPECTED FAILURE\n2. Both clones converge to identical issue database\n3. No manual conflict resolution required\n4. Git status clean in both clones\n5. bd ready output identical in both clones","notes":"**Major progress achieved!** The two-clone workflow now converges correctly.\n\n**What was fixed:**\n--3d844c58: Implemented content-hash based rename detection\n- bd-64c05d00.1: Fixed test to compare content not timestamps\n- Both clones now converge to identical issue databases\n- test-1 and test-2 have correct titles in both clones\n- No more title swapping!\n\n**Current status (VERIFIED):**\nβœ… Acceptance criteria 1: TestTwoCloneCollision passes (confirmed Oct 28)\nβœ… Acceptance criteria 2: Both clones converge to identical issue database (content matches)\nβœ… Acceptance criteria 3: No manual conflict resolution required (automatic)\nβœ… Acceptance criteria 4: Git status clean\nβœ… Acceptance criteria 5: bd ready output identical (timestamps are expected difference)\n\n**ALL ACCEPTANCE CRITERIA MET!** This issue is complete and can be closed.","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-10-28T16:34:53.278793-07:00","updated_at":"2025-10-31T19:38:09.206303-07:00","closed_at":"2025-10-28T19:20:04.143242-07:00","source_repo":"."} -{"id":"bd-71ky","content_hash":"83942b83e4bdf8446d1fa2309145e6469d80e3992ab4fdc9eea704fa3920afac","title":"Fix bd --version and bd completion to work without database","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T02:06:00.78393-08:00","updated_at":"2025-11-08T02:06:11.452474-08:00","closed_at":"2025-11-08T02:06:11.452474-08:00","source_repo":"."} -{"id":"bd-72w","content_hash":"55110afd5c4cd8e94796fe61fada9e32351e76f7fca57ce15e52fe6443e6e117","title":"Q4 Platform Improvements","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","design":"## Architecture\n\n[Describe the overall architecture and approach]\n\n## Components\n\n- Component 1: [description]\n- Component 2: [description]\n\n## Dependencies\n\n[List external dependencies or constraints]\n","acceptance_criteria":"- [ ] All child issues are completed\n- [ ] Integration tests pass\n- [ ] Documentation is updated\n- [ ] Code review completed\n","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-03T19:54:03.794244-08:00","updated_at":"2025-11-05T00:25:06.51152-08:00","closed_at":"2025-11-05T00:25:06.51152-08:00","source_repo":".","labels":["epic"]} -{"id":"bd-7315","content_hash":"81137222aba60b33d3bcd7637891cf94547b5c876a1608e3e3370a578ba165f3","title":"Add validation for duplicate external_ref in batch imports","description":"Currently, if a batch import contains multiple issues with the same external_ref, the behavior is undefined. We should detect and handle this case.\n\nCurrent behavior:\n- No validation for duplicate external_ref within a batch\n- Last-write-wins or non-deterministic behavior\n\nProposed solution:\n- Detect duplicate external_ref values in incoming batch\n- Fail with clear error message OR\n- Merge duplicates intelligently (use newest timestamp)\n- Add test case for this scenario\n\nRelated: bd-1022","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:31:55.85634-08:00","updated_at":"2025-11-02T16:03:50.374552-08:00","closed_at":"2025-11-02T16:03:50.374552-08:00","source_repo":"."} -{"id":"bd-7324","content_hash":"639f5eef2922178daae7416831b850bf58ebeb39b8b91e7124387e0b6dfea33c","title":"Add is_tombstone flag to schema","description":"Optionally add is_tombstone boolean field to issues table. Marks resurrected parents that were deleted. Allows distinguishing tombstones from normal deleted issues. Update schema.go and create migration.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:31:59.745076-08:00","updated_at":"2025-11-05T00:44:27.947578-08:00","closed_at":"2025-11-05T00:44:27.947584-08:00","source_repo":"."} -{"id":"bd-736d","content_hash":"4743b1f41ff07fee3daa63240f0d5f7ac3f876e928b22c4ce0bee2cdf544e53a","title":"Refactor path canonicalization into helper function","description":"The path canonicalization logic (filepath.Abs + EvalSymlinks) is duplicated in 3 places:\n- beads.go:131-137 (BEADS_DIR handling)\n- cmd/bd/main.go:446-451 (--no-db cleanup)\n- cmd/bd/nodb.go:26-31 (--no-db initialization)\n\nRefactoring suggestion:\nExtract to a helper function like:\n func canonicalizePath(path string) string\n\nThis would:\n- Reduce code duplication\n- Make the logic easier to maintain\n- Ensure consistent behavior across all path handling\n\nRelated to bd-e16b implementation.","status":"open","priority":3,"issue_type":"chore","created_at":"2025-11-02T18:33:47.727443-08:00","updated_at":"2025-11-02T18:33:47.727443-08:00","source_repo":"."} -{"id":"bd-73iz","content_hash":"6003ff8e78d951d6a708f6aac6bcf841637977cab4f4a93a80b3dc2bab3287cb","title":"Test issue 1","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:04:17.430269-08:00","updated_at":"2025-11-07T22:07:17.344468-08:00","closed_at":"2025-11-07T21:55:09.427697-08:00","source_repo":"."} -{"id":"bd-74ee","content_hash":"476deaacd64c91c96e5c9aca9ba0640dcf0f3854f9f11bbaa25a8ae80af3adf3","title":"Frontend task","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-03T19:11:59.358631-08:00","updated_at":"2025-11-05T00:25:06.457813-08:00","closed_at":"2025-11-05T00:25:06.457813-08:00","source_repo":".","labels":["frontend","week1"]} -{"id":"bd-74q9","content_hash":"426f1e44ca47486e2fa5b97832a635612ac9fcb98064f00559c8833480f11bd6","title":"Issue to reopen with reason","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T19:43:48.752747-05:00","updated_at":"2025-11-20T19:43:48.752747-05:00","closed_at":"2025-11-09T16:13:23.938513-08:00","source_repo":"."} -{"id":"bd-763c","content_hash":"31265106d3d8856bdda09f00708f6efdda862abc97a14f8e2bcacc8535870099","title":"~/src/beads daemon has 'sql: database is closed' errors - zombie daemon","description":"","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-31T21:08:03.388007-07:00","updated_at":"2025-10-31T21:52:04.214274-07:00","closed_at":"2025-10-31T21:52:04.214274-07:00","source_repo":".","dependencies":[{"issue_id":"bd-763c","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:03.388716-07:00","created_by":"stevey"}]} -{"id":"bd-77gm","content_hash":"b227320f0cf0c889a1e0d617922c572a48eee563c9afb1662b44a22e183c0c80","title":"Import reports misleading '0 created, 0 updated' when actually importing all issues","description":"When running 'bd import' on a fresh database (no existing issues), the command reports 'Import complete: 0 created, 0 updated' even though it successfully imported all issues from the JSONL file.\n\n**Steps to reproduce:**\n1. Delete .beads/beads.db\n2. Run: bd import .beads/issues.jsonl\n3. Observe output: 'Import complete: 0 created, 0 updated'\n4. Run: bd list\n5. Confirm: All issues are actually present in the database\n\n**Expected behavior:**\nReport the actual number of issues imported, e.g., 'Import complete: 523 created, 0 updated'\n\n**Actual behavior:**\n'Import complete: 0 created, 0 updated' (misleading - makes user think import failed)\n\n**Impact:**\n- Users think import failed when it succeeded\n- Confusing during database sync operations (e.g., after git pull)\n- Makes debugging harder (can't tell if import actually worked)\n\n**Context:**\nDiscovered during VC session when syncing database after git pull. The misleading message caused confusion about whether the database was properly synced with the canonical JSONL file.","acceptance_criteria":"- Import command reports accurate count of created/updated issues\n- Fresh database import shows 'N created' where N is the actual number\n- Update operations show 'N updated' where N is the actual number changed\n- Message clearly indicates success vs failure","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-09T16:20:13.191156-08:00","updated_at":"2025-11-09T16:20:13.191156-08:00","source_repo":"."} -{"id":"bd-78w","content_hash":"dd79ef79bf68b3a87f3a5b8d50fdfba9d6c6f7e6d728713e37dd34cf9fff835e","title":"Test Epic 2","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","design":"## Architecture\n\n[Describe the overall architecture and approach]\n\n## Components\n\n- Component 1: [description]\n- Component 2: [description]\n\n## Dependencies\n\n[List external dependencies or constraints]\n","acceptance_criteria":"- [ ] All child issues are completed\n- [ ] Integration tests pass\n- [ ] Documentation is updated\n- [ ] Code review completed\n","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-03T20:15:03.878216-08:00","updated_at":"2025-11-05T00:25:06.566242-08:00","closed_at":"2025-11-05T00:25:06.566242-08:00","source_repo":".","labels":["epic"]} -{"id":"bd-790","content_hash":"63946cfa6aad99217e470d575b73771ecfc379d1572456c2a6756724dc90d718","title":"Document which files to commit after bd init --branch","description":"GH #312 reported confusion about which files should be committed after running 'bd init --branch beads-metadata'. Updated PROTECTED_BRANCHES.md to clearly document:\n\n1. Files that should be committed to protected branch (main):\n - .beads/.gitignore\n - .gitattributes\n\n2. Files that are automatically gitignored\n3. Files that live in the sync branch (beads-metadata)\n\nChanges:\n- Added step-by-step instructions in Quick Start section\n- Added 'What lives in each branch' section to How It Works\n- Clarified the directory structure diagram\n\nFixes: https://github.com/steveyegge/beads/issues/312","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:47:25.813954-05:00","updated_at":"2025-11-20T21:47:33.567649-05:00","closed_at":"2025-11-20T21:47:33.567651-05:00","source_repo":"."} -{"id":"bd-7a00c94e","content_hash":"5ea01765a9fdf5c4c75f485b1db26c942eaaa762f1cdcb497306a78c65132721","title":"Rapid 2","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.430725-07:00","updated_at":"2025-11-07T23:21:44.923877-08:00","closed_at":"2025-11-07T23:18:52.352188-08:00","source_repo":"."} -{"id":"bd-7a2b58fc","content_hash":"02b9e5c0f7a58576876637f09cf67a97d180686a216d53b15351ca2c099c8e5f","title":"Implement clone-scoped ID allocation to prevent N-way collisions","description":"## Problem\nCurrent ID allocation uses per-clone atomic counters (issue_counters table) that sync based on local database state. In N-way collision scenarios:\n- Clone B sees {test-1} locally, allocates test-2\n- Clone D sees {test-1, test-2, test-3} locally, allocates test-4\n- When same content gets assigned test-2 and test-4, convergence fails\n\nRoot cause: Each clone independently allocates IDs without global coordination, leading to overlapping assignments for the same content.\n\n## Solution\nAdd clone UUID to ID allocation to make every ID globally unique:\n\n**Current format:** `test-1`, `test-2`, `test-3`\n**New format:** `test-1-a7b3`, `test-2-a7b3`, `test-3-c4d9`\n\nWhere suffix is first 4 chars of clone UUID.\n\n## Implementation\n\n### 1. Add clone_identity table\n```sql\nCREATE TABLE clone_identity (\n clone_uuid TEXT PRIMARY KEY,\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n### 2. Modify getNextIDForPrefix()\n```go\nfunc (s *SQLiteStorage) getNextIDForPrefix(ctx context.Context, prefix string) (string, error) {\n cloneUUID := s.getOrCreateCloneUUID(ctx)\n shortUUID := cloneUUID[:4]\n \n nextNum := s.getNextCounterForPrefix(ctx, prefix)\n return fmt.Sprintf(\"%s-%d-%s\", prefix, nextNum, shortUUID), nil\n}\n```\n\n### 3. Update ID parsing logic\nAll places that parse IDs (utils.ExtractIssueNumber, etc.) need to handle new format.\n\n### 4. Migration strategy\n- Existing IDs remain unchanged (no suffix)\n- New IDs get clone suffix automatically\n- Display layer can hide suffix in UI: `bd-cb64c226.3-a7b3` β†’ `#42`\n\n## Benefits\n- **Zero collision risk**: Same content in different clones gets different IDs\n- **Maintains readability**: Still sequential numbering within clone\n- **No coordination needed**: Works offline, no central authority\n- **Scales to 100+ clones**: 4-char hex = 65,536 unique clones\n\n## Concerns\n- ID format change may break existing integrations\n- Need migration path for existing databases\n- Display logic needs update to hide/show suffixes appropriately\n\n## Success Criteria\n- 10+ clone collision test passes without failures\n- Existing issues continue to work (backward compatibility)\n- Documentation updated with new ID format\n- Migration guide for v1.x β†’ v2.x\n\n## Timeline\nMedium-term (v1.1-v1.2), 2-3 weeks implementation\n\n## References\n- Related to bd-0dcea000 (immediate fix)\n- See beads_nway_test.go for failing N-way tests","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-10-29T20:02:47.952447-07:00","updated_at":"2025-11-06T19:36:13.971527-08:00","closed_at":"2025-11-06T19:27:29.41629-08:00","source_repo":"."} -{"id":"bd-7bbc4e6a","content_hash":"22e1c05b37a94f72f0734c62fac64f56de9b2304fac262148923f6b0059bf783","title":"Add MCP server functions for repair commands","description":"Expose new repair commands via MCP server for agent access:\n\nFunctions to add:\n- beads_repair_deps()\n- beads_detect_pollution()\n- beads_validate()\n- beads_resolve_conflicts() (when implemented)\n\nUpdate integrations/beads-mcp/src/beads_mcp/server.py\n\nSee repair_commands.md lines 803-884 for design.","notes":"Implemented all three MCP server functions:\n\n1. **repair_deps(fix=False)** - Find/fix orphaned dependencies\n2. **detect_pollution(clean=False)** - Detect/clean test issues \n3. **validate(checks=None, fix_all=False)** - Run comprehensive health checks\n\nChanges:\n- Added abstract methods to BdClientBase\n- Implemented in BdCliClient (CLI execution)\n- Added NotImplementedError stubs in BdDaemonClient (falls back to CLI)\n- Created wrapper functions in tools.py\n- Registered @mcp.tool decorators in server.py\n\nAll commands tested and working with --no-daemon flag.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T09:49:06.993201-08:00","updated_at":"2025-11-07T21:02:55.469601-08:00","closed_at":"2025-11-07T19:38:12.152437-08:00","source_repo":"."} -{"id":"bd-7bd2","content_hash":"3e2921e120a51c2ed88f11db427d6620b0c12ba5526c0023ce96b3abf3ece0f3","title":"Complete remaining sync branch daemon tests","description":"4 remaining test scenarios in daemon_sync_branch_test.go need completion:\n\n⚠️ MINOR FIXES (apply same pattern as TestSyncBranchCommitAndPush_Success):\n1. TestSyncBranchCommitAndPush_NoChanges\n - Reorder: call initMainBranch() BEFORE creating JSONL\n - Pattern: init branch β†’ create issue β†’ export JSONL β†’ test\n\n2. TestSyncBranchCommitAndPush_WorktreeHealthCheck\n - Same reordering needed\n - Verify worktree corruption detection and auto-repair\n\nπŸ”§ MORE WORK NEEDED (remote branch setup):\n3. TestSyncBranchPull_Success\n - Issue: remote doesn't have sync branch after push\n - Need to verify branch is pushed to remote correctly\n - Then test pull from clone2\n\n4. TestSyncBranchIntegration_EndToEnd\n - Full workflow: Agent A commits β†’ Agent B pulls β†’ Agent B commits β†’ Agent A pulls\n - Same remote branch issue\n\nPattern to apply (from TestSyncBranchCommitAndPush_Success):\n- Call initMainBranch(t, dir) BEFORE creating issues/JSONL\n- This ensures sync branch worktree has changes to commit\n\nAcceptance:\n- All 7 tests pass\n- go test -v -run TestSyncBranch ./cmd/bd/ succeeds","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T16:29:29.044162-08:00","updated_at":"2025-11-02T16:39:53.277529-08:00","closed_at":"2025-11-02T16:39:53.277529-08:00","source_repo":".","dependencies":[{"issue_id":"bd-7bd2","depends_on_id":"bd-502e","type":"discovered-from","created_at":"2025-11-02T16:29:29.045104-08:00","created_by":"stevey"}]} -{"id":"bd-7c5915ae","content_hash":"25f278eff5227a6e3ba39b58fb23c3a28bc043ae2b1f7dc8fa28292c93f143d3","title":"Run final validation and cleanup checks","description":"Final validation pass to ensure all cleanup objectives met and no regressions introduced.\n\nValidation checklist:\n1. Dead code verification: `go run golang.org/x/tools/cmd/deadcode@latest -test ./...`\n2. Test coverage: `go test -cover ./...`\n3. Build verification: `go build ./cmd/bd/`\n4. Linting: `golangci-lint run`\n5. Integration tests\n6. Metrics verification\n7. Git clean check\n\nFinal metrics to report:\n- LOC removed: ~____\n- Files deleted: ____\n- Files created: ____\n- Test coverage: ____%\n- Build time: ____ (before/after)\n- Test run time: ____ (before/after)\n\nImpact: Confirms all cleanup objectives achieved successfully","acceptance_criteria":"- Zero unreachable functions per deadcode analyzer\n- All tests pass: `go test ./...`\n- Test coverage maintained or improved\n- Builds cleanly: `go build ./...`\n- Linting shows improvements\n- Integration tests all pass\n- LOC reduction target achieved (~2,500 LOC)\n- No unintended behavior changes\n- Git commit messages document all changes","notes":"## Validation Results (Oct 31, 2025)\n\n**Dead Code:** βœ… Removed 5 unreachable functions (~200 LOC)\n- computeIssueContentHash, shouldSkipExport (autoflush.go)\n- addDependencyUnchecked, removeDependencyIfExists (dependencies.go)\n- isUniqueConstraintError (util.go)\n\n**Tests:** βœ… All pass\n**Coverage:** \n- Main package: 39.6%\n- cmd/bd: 19.5%\n- internal/daemon: 37.8%\n- internal/storage/sqlite: 58.1%\n- internal/rpc: 58.6%\n\n**Build:** βœ… Clean (24.5 MB binary)\n**Linting:** 247 issues (mostly errcheck on defer/Close statements)\n**Integration Tests:** βœ… All pass\n**Metrics:** 55,622 LOC across 200 Go files\n**Git:** 3 files modified (dead code removal)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.131575-07:00","updated_at":"2025-10-31T15:12:01.955668-07:00","closed_at":"2025-10-31T15:12:01.955668-07:00","source_repo":".","dependencies":[{"issue_id":"bd-7c5915ae","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-31T19:38:09.176473-07:00","created_by":"stevey"}]} -{"id":"bd-7c831c51","content_hash":"0dc852cec8162089b7e2bfdca245fb096d5debc9fceb4b658af5c6afb50025a3","title":"Run final validation and cleanup checks","description":"Final validation pass to ensure all cleanup objectives met and no regressions introduced.\n\nValidation checklist:\n1. Dead code verification: `go run golang.org/x/tools/cmd/deadcode@latest -test ./...`\n2. Test coverage: `go test -cover ./...`\n3. Build verification: `go build ./cmd/bd/`\n4. Linting: `golangci-lint run`\n5. Integration tests\n6. Metrics verification\n7. Git clean check\n\nFinal metrics to report:\n- LOC removed: ~____\n- Files deleted: ____\n- Files created: ____\n- Test coverage: ____%\n- Build time: ____ (before/after)\n- Test run time: ____ (before/after)\n\nImpact: Confirms all cleanup objectives achieved successfully","acceptance_criteria":"- Zero unreachable functions per deadcode analyzer\n- All tests pass: `go test ./...`\n- Test coverage maintained or improved\n- Builds cleanly: `go build ./...`\n- Linting shows improvements\n- Integration tests all pass\n- LOC reduction target achieved (~2,500 LOC)\n- No unintended behavior changes\n- Git commit messages document all changes","notes":"## Validation Results\n\n**Dead Code:** βœ… Found and removed 1 unreachable function (`DroppedEventsCount`) \n**Tests:** βœ… All pass \n**Coverage:** \n- Main: 39.6%\n- cmd/bd: 20.2%\n- Created follow-up issues (bd-85487065 through bd-bc2c6191) to improve coverage\n \n**Build:** βœ… Clean \n**Linting:** 73 issues (up from 34 baseline) \n- Increase due to unused functions from refactoring\n- Need cleanup in separate issue\n \n**Integration Tests:** βœ… All pass \n**Metrics:** 56,464 LOC across 193 Go files \n**Git:** 2 files modified (deadcode fix + auto-synced JSONL)\n\n## Follow-up Issues Created\n- bd-85487065: Add tests for internal/autoimport (0% coverage)\n- bd-0dcea000: Add tests for internal/importer (0% coverage)\n- bd-4d7fca8a: Add tests for internal/utils (0% coverage)\n- bd-6221bdcd: Improve cmd/bd coverage (20.2% -\u003e target higher)\n- bd-bc2c6191: Improve internal/daemon coverage (22.5% -\u003e target higher)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:02:47.956276-07:00","updated_at":"2025-10-30T17:12:58.193468-07:00","closed_at":"2025-10-29T14:19:35.095553-07:00","source_repo":"."} -{"id":"bd-7da9437e","content_hash":"74f3d9016d544b94a35adb125c1186037461a802f77452fefcbe12e7cf98e851","title":"Latency test","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:28:52.729923-07:00","updated_at":"2025-10-31T12:00:43.184758-07:00","closed_at":"2025-10-31T12:00:43.184758-07:00","source_repo":"."} -{"id":"bd-7e0d6660","content_hash":"84f212d47832be4670333dc0148e3de158ca3a2dc7cb68b992f8536409272cfb","title":"Handle unchecked errors (errcheck - 683 issues)","description":"683 unchecked error returns, mostly in tests (Close, Rollback, RemoveAll). Many already excluded in config but still showing up.","design":"Review .golangci.yml exclude-rules. Most defer Close/Rollback errors in tests can be ignored. Add systematic exclusions or explicit _ = assignments where appropriate.","notes":"Fixed all errcheck warnings in production code:\n- Enabled errcheck linter (was disabled)\n- Set tests: false in .golangci.yml to focus on production code\n- Fixed 27 total errors in production code using Oracle guidance:\n * Database patterns: defer func() { _ = rows.Close() }() and defer func() { _ = tx.Rollback() }()\n * Best-effort closers: _ = store.Close(), _ = client.Close()\n * Proper error handling for file writes, fmt.Scanln(), os.Remove()\n- All tests pass\n- Only 2 \"unused\" linter warnings remain (not errcheck)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-27T23:20:10.392336-07:00","updated_at":"2025-10-30T17:12:58.215288-07:00","closed_at":"2025-10-27T23:05:31.945328-07:00","source_repo":"."} -{"id":"bd-7e7ddffa","content_hash":"80a5b60d066d509bbd8d0f1340a16ea1d989d9178910155da3ff2c8df245b9c9","title":"Repair Commands \u0026 AI-Assisted Tooling","description":"Add specialized repair tools to reduce agent repair burden:\n1. Git merge conflicts in JSONL\n2. Duplicate issues from parallel work\n3. Semantic inconsistencies\n4. Orphaned references\n\nSee ~/src/fred/beads/repair_commands.md for full design doc.\n\nReduces agent repair time from 5-10 minutes to \u003c30 seconds per repair.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T19:30:17.465812-07:00","updated_at":"2025-11-02T16:40:51.866302-08:00","closed_at":"2025-11-02T16:40:51.866302-08:00","source_repo":"."} -{"id":"bd-7e7ddffa.1","content_hash":"df6de1f6a58a995d979a7be59c2fb38800e81b96e8fa0bd39980f8bf9f1a4f37","title":"bd resolve-conflicts - Git merge conflict resolver","description":"Automatically resolve JSONL merge conflicts.\n\nModes:\n- Mechanical: ID remapping (no AI)\n- AI-assisted: Smart merge/keep decisions\n- Interactive: Review each conflict\n\nHandles \u003c\u003c\u003c\u003c\u003c\u003c\u003c conflict markers in .beads/beads.jsonl\n\nFiles: cmd/bd/resolve_conflicts.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-10-28T14:48:30.083642-07:00","updated_at":"2025-10-30T17:12:58.220145-07:00","source_repo":".","dependencies":[{"issue_id":"bd-7e7ddffa.1","depends_on_id":"bd-7e7ddffa","type":"parent-child","created_at":"2025-10-29T19:58:28.847736-07:00","created_by":"stevey"}]} -{"id":"bd-7eed","content_hash":"38bc75490042cd3b3dea4dd9c7fd0ce576212b2c31ccf3d51992d1dc73b0fbd9","title":"Remove obsolete stale.go command (executor tables never implemented)","description":"","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-10-31T21:27:05.555369-07:00","updated_at":"2025-10-31T21:27:11.427631-07:00","closed_at":"2025-10-31T21:27:11.427631-07:00","source_repo":"."} -{"id":"bd-7fe8","content_hash":"106aa3a1717d3c2a6ff518a8881976fd70911b006714b04f47327959d7ca1444","title":"Fix linting error in migrate.go","description":"Linter reports error:\n```\ncmd/bd/migrate.go:647:37: cleanupWALFiles - result 0 (error) is always nil (unparam)\n```\n\nThe `cleanupWALFiles` function always returns nil, so the error return type should be removed or the function should actually return errors when appropriate.","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-11-02T09:29:37.279747-08:00","updated_at":"2025-11-02T09:46:52.18793-08:00","closed_at":"2025-11-02T09:46:52.18793-08:00","source_repo":".","dependencies":[{"issue_id":"bd-7fe8","depends_on_id":"bd-1231","type":"blocks","created_at":"2025-11-02T09:29:37.280881-08:00","created_by":"stevey"}]} -{"id":"bd-7kua","content_hash":"2dedc0d0d5444db45ab146cc59f3c51bc4bfc3c864da43d3c086a9153613c29f","title":"Reduce sync rounds in multiclone tests","description":"Analyze and reduce the number of sync rounds in hash multiclone tests.\n\nCurrent state:\n- TestHashIDs_MultiCloneConverge: 1 round of syncs across 3 clones\n- TestHashIDs_IdenticalContentDedup: 2 rounds across 2 clones\n\nInvestigation needed:\n- Profile to see how much time each sync takes\n- Determine minimum rounds needed for convergence\n- Consider making rounds configurable via env var\n\nFile: beads_hash_multiclone_test.go:70, :132","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-04T01:24:18.405038-08:00","updated_at":"2025-11-04T10:26:34.449434-08:00","closed_at":"2025-11-04T10:26:34.449434-08:00","source_repo":".","dependencies":[{"issue_id":"bd-7kua","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:18.405883-08:00","created_by":"daemon"}]} -{"id":"bd-7yg","content_hash":"a421df3d78f39edb93e421f18e042ad113f6d26c91439d1f732d3df7c80eee62","title":"Git merge driver uses invalid placeholders (%L, %R instead of %A, %B)","description":"## Problem\n\nThe beads git merge driver is configured with invalid Git placeholders:\n\n```\ngit config merge.beads.driver \"bd merge %A %O %L %R\"\n```\n\nGit doesn't recognize `%L` or `%R` as valid merge driver placeholders. The valid placeholders are:\n- `%O` = base (common ancestor)\n- `%A` = current version (ours)\n- `%B` = other version (theirs)\n\n## Impact\n\n- Affects ALL users when they have `.beads/beads.jsonl` merge conflicts\n- Automatic JSONL merge fails with error: \"error reading left file: failed to open file: open 7: no such file or directory\"\n- Users must manually resolve conflicts instead of getting automatic merge\n\n## Root Cause\n\nThe `bd init` command (or wherever the merge driver is configured) is using non-standard placeholders. When Git encounters `%L` and `%R`, it either passes them literally or interprets them incorrectly.\n\n## Fix\n\nUpdate the merge driver configuration to:\n```\ngit config merge.beads.driver \"bd merge %A %O %A %B\"\n```\n\nWhere:\n- 1st `%A` = output file (current file, will be overwritten)\n- `%O` = base (common ancestor)\n- 2nd `%A` = left/current version\n- `%B` = right/other version\n\n## Action Items\n\n1. Fix `bd init` (or equivalent setup command) to use correct placeholders\n2. Add migration/warning for existing users with misconfigured merge driver\n3. Update documentation with correct merge driver setup\n4. Consider adding validation when `bd init` is run","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-21T19:51:55.747608-05:00","updated_at":"2025-11-21T19:51:55.747608-05:00","source_repo":"."} -{"id":"bd-8072","content_hash":"32bd0e33433bbf535cb56eb47828ac80ebecc57512e9039420a39cd2342790d2","title":"Add import.orphan_handling config option","description":"Add configuration option to control orphan handling behavior: 'strict' (fail on missing parent, current behavior), 'resurrect' (auto-resurrect from JSONL, recommended default), 'skip' (skip orphaned issues with warning), 'allow' (import orphans without validation). Update CONFIG.md documentation.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:08.569239-08:00","updated_at":"2025-11-05T00:44:27.948157-08:00","closed_at":"2025-11-05T00:44:27.94816-08:00","source_repo":"."} -{"id":"bd-812a","content_hash":"0d802dec82dff53e88e68bb4f1fef75754165a590996ff8b1578ff93e781622d","title":"Add unit tests for import ordering","description":"Test topological sort: import [child, parent] should succeed, import [parent.1.2, parent, parent.1] should sort correctly. Verify depth-based batching works. Test max depth limits.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.278448-08:00","updated_at":"2025-11-05T00:08:42.812949-08:00","closed_at":"2025-11-05T00:08:42.812952-08:00","source_repo":"."} -{"id":"bd-81a","content_hash":"0f43da9e36bc3c5db20f302b82021377685a9425f519a36bab5a2cf1b85f13d8","title":"Add programmatic tip injection API","description":"Allow tips to be programmatically injected at runtime based on detected conditions. This enables dynamic tips (not just pre-defined ones) to be shown with custom priority and frequency.","design":"## API Design\n\nAdd to `cmd/bd/tips.go`:\n\n```go\n// InjectTip adds a dynamic tip to the registry at runtime\nfunc InjectTip(id, message string, priority int, frequency time.Duration, probability float64, condition func() bool) {\n tipsMutex.Lock()\n defer tipsMutex.Unlock()\n \n tips = append(tips, Tip{\n ID: id,\n Condition: condition,\n Message: message,\n Frequency: frequency,\n Priority: priority,\n Probability: probability,\n })\n}\n\n// RemoveTip removes a tip from the registry\nfunc RemoveTip(id string) {\n tipsMutex.Lock()\n defer tipsMutex.Unlock()\n \n for i, tip := range tips {\n if tip.ID == id {\n tips = append(tips[:i], tips[i+1:]...)\n return\n }\n }\n}\n```\n\n## Use Cases\n\n### Example 1: Critical Security Update\n```go\n// In bd version check code\nif criticalSecurityUpdate {\n InjectTip(\n \"security_update\",\n fmt.Sprintf(\"CRITICAL: Security update available (bd %s). Update immediately!\", remoteVersion),\n 100, // Highest priority\n 0, // No frequency limit\n 1.0, // Always show (100% probability)\n func() bool { return true },\n )\n}\n```\n\n### Example 2: New Version Available\n```go\n// In bd version check code\nif remoteVersion \u003e currentVersion {\n InjectTip(\n \"upgrade_available\",\n fmt.Sprintf(\"New bd version %s available (you have %s). Run: go install github.com/steveyegge/beads/cmd/bd@latest\", remoteVersion, currentVersion),\n 90, // High priority\n 7 * 24 * time.Hour, // Weekly\n 0.8, // 80% probability (frequent but not always)\n func() bool { return true },\n )\n}\n```\n\n### Example 3: Large Issue Count Suggestion\n```go\n// In bd list code\nif issueCount \u003e 100 {\n InjectTip(\n \"use_filters\",\n \"You have many issues. Use filters: 'bd list --status=open --priority=1'\",\n 50, // Medium priority\n 14 * 24 * time.Hour, // Bi-weekly\n 0.4, // 40% probability (occasional suggestion)\n func() bool { return true },\n )\n}\n```\n\n### Example 4: No Dependencies Used\n```go\n// After analyzing project\nif hasIssues \u0026\u0026 noDependenciesCreated {\n InjectTip(\n \"try_dependencies\",\n \"Try using dependencies: 'bd dep \u003cissue\u003e \u003cblocks-issue\u003e' to track blockers\",\n 30, // Low priority\n 30 * 24 * time.Hour, // Monthly\n 0.3, // 30% probability (low-key suggestion)\n func() bool { return true },\n )\n}\n```\n\n## Probability Guidelines\n\n- **1.0 (100%)**: Critical security, breaking changes, data loss prevention\n- **0.7-0.9 (70-90%)**: Important updates, major new features\n- **0.4-0.6 (40-60%)**: General tips, workflow improvements, feature discovery\n- **0.1-0.3 (10-30%)**: Nice-to-know features, advanced tips, optional optimizations\n\n## Thread Safety\n- Use mutex to protect tip registry\n- Safe for concurrent command execution\n- Deterministic testing via BEADS_TIP_SEED env var","acceptance_criteria":"- InjectTip() API exists and is documented\n- RemoveTip() API exists\n- Thread-safe with mutex protection\n- Can inject tips from any command\n- Injected tips participate in priority/frequency rotation\n- Unit tests for injection API\n- Example usage in code comments","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:29:46.645583-08:00","updated_at":"2025-11-11T23:50:12.209135-08:00","source_repo":".","dependencies":[{"issue_id":"bd-81a","depends_on_id":"bd-d4i","type":"blocks","created_at":"2025-11-11T23:29:46.646327-08:00","created_by":"daemon"}]} -{"id":"bd-81abb639","content_hash":"ddf6496e654e8cd8e69620a08e2d607d8c8bda152a8dc884908e29747d39376d","title":"Investigate jujutsu VCS as potential solution for conflict-free merging","description":"## Context\nCurrent N-way collision resolution struggles with Git line-based merge model. When 5+ clones create issues with same ID, Git merge conflicts require manual resolution, and our collision resolver can fail during convergence rounds.\n\n## Research Question\nCould jujutsu (jj) provide better conflict handling for JSONL files?\n\n## Jujutsu Overview\n- Next-gen VCS built on libgit2\n- Designed to handle conflicts as first-class citizens\n- Supports conflict-free replicated data types (CRDTs) in some scenarios\n- Better handling of concurrent edits\n- Can work with Git repos (compatible with existing infrastructure)\n\n## Investigation Tasks\n1. JSONL Merge Behavior - How does jj handle line-by-line JSONL conflicts?\n2. Integration Feasibility - Can beads use jj as backend while maintaining Git compatibility?\n3. Conflict Resolution Model - Does jj conflict model map to our collision resolution?\n4. Operational Transform Support - Does jj implement operational transforms?\n\n## Deliverables\n1. Technical report on jj merge algorithm for JSONL\n2. Proof-of-concept: 5-clone collision test using jj instead of Git\n3. Performance comparison: Git vs jj for beads workload\n4. Recommendation: Adopt, experiment further, or abandon\n\n## References\n- https://github.com/martinvonz/jj\n- Related to bd-e6d71828, bd-7a2b58fc","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T20:02:47.953008-07:00","updated_at":"2025-10-30T17:12:58.19464-07:00","closed_at":"2025-10-29T20:47:52.910985-07:00","source_repo":"."} -{"id":"bd-824","content_hash":"ba893642ee6145900797db1937943f5dc38e848ed85e74307bcfa0352c2130a6","title":"Add migration guide for library consumers","description":"The contributor-workflow-analysis.md has excellent migration examples for CLI users (lines 508-549) but lacks examples for library consumers like VC that use beadsLib in Go/TypeScript code.\n\nLibrary consumers need to know:\n- Whether their existing code continues to work unchanged (backward compatibility)\n- How config.toml is automatically read (transparent hydration)\n- When and how to use explicit multi-repo configuration\n- What happens if config.toml doesn't exist (defaults)\n\nExample needed:\n```go\n// Before (v0.17.3)\nstore, err := beadsLib.NewSQLiteStorage(\".beads/vc.db\")\n\n// After (v0.18.0 with multi-repo) - still works!\nstore, err := beadsLib.NewSQLiteStorage(\".beads/vc.db\")\n// Automatically reads .beads/config.toml if present\n\n// Explicit multi-repo (if needed)\ncfg := beadsLib.Config{\n Primary: \".beads/vc.db\",\n Additional: []string{\"~/.beads-planning\"},\n}\nstore, err := beadsLib.NewStorageWithConfig(cfg)\n```","acceptance_criteria":"- Section added to contributor-workflow-analysis.md for library consumers\n- Code examples showing backward compatibility\n- Code examples showing explicit multi-repo configuration\n- Guidance on when library consumers should use multi-repo vs single-repo","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:17.748337-08:00","updated_at":"2025-11-05T14:15:44.154675-08:00","closed_at":"2025-11-05T14:15:44.154675-08:00","source_repo":"."} -{"id":"bd-82dv","content_hash":"a5f24bc24c6b85c34577386af16ec2f20dc0b7816a91f484169e6e06bb46d1d3","title":"cmd/bd tests fail without -short flag (parallel test deadlock)","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T22:58:38.72748-08:00","updated_at":"2025-11-09T12:54:44.557562-08:00","closed_at":"2025-11-09T12:54:44.557562-08:00","source_repo":"."} -{"id":"bd-833559b3","content_hash":"d4b0ded6c4696813257f7e3fa84913e3e159690b74f78c909e68debae8d1e727","title":"bd validate - Comprehensive health check","description":"Run all validation checks in one command.\n\nChecks:\n- Duplicates\n- Orphaned dependencies\n- Test pollution\n- Git conflicts\n\nSupports --fix-all for auto-repair.\n\nDepends on bd-cbed9619.1, bd-0dcea000, bd-2752a7a2, bd-9826b69a.\n\nFiles: cmd/bd/validate.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:02:47.957692-07:00","updated_at":"2025-11-05T00:16:42.294117-08:00","closed_at":"2025-11-05T00:16:42.294117-08:00","source_repo":"."} -{"id":"bd-8507","content_hash":"96a07fcf39392143fa9c75cbc96f54136809609f6ced80dd9581ec9144d54b1f","title":"Publish bd-wasm to npm","description":"Package and publish WASM build to npm. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Optimize WASM bundle (compression)\n- [ ] Create README for npm package\n- [ ] Set up npm publishing workflow\n- [ ] Publish v0.1.0-alpha\n- [ ] Test installation in clean environment\n- [ ] Update beads AGENTS.md with installation instructions\n\n## Package Name\nbd-wasm (or @beads/wasm-cli)","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-02T18:33:31.371535-08:00","updated_at":"2025-11-05T00:55:48.757492-08:00","closed_at":"2025-11-05T00:55:48.757494-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8507","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.372224-08:00","created_by":"daemon"},{"issue_id":"bd-8507","depends_on_id":"bd-374e","type":"blocks","created_at":"2025-11-02T22:27:56.025207-08:00","created_by":"daemon"}]} -{"id":"bd-8534","content_hash":"05b543a341ac0210f6025318e2eaead1da295b8d270fd17356fa3337c856607d","title":"Switch from modernc.org/sqlite to ncruces/go-sqlite3 for WASM support","description":"modernc.org/sqlite depends on modernc.org/libc which has no js/wasm support (platform-specific syscalls). Need to switch to ncruces/go-sqlite3 which wraps a WASM build of SQLite using wazero runtime.\n\nKey differences:\n- ncruces/go-sqlite3: Uses WASM build of SQLite + wazero runtime\n- modernc.org/sqlite: Pure Go translation, requires libc for syscalls\n\nThis is a prerequisite for bd-62a0 (WASM build infrastructure).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T22:14:27.627154-08:00","updated_at":"2025-11-02T22:23:49.377223-08:00","closed_at":"2025-11-02T22:23:49.377223-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8534","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.555691-08:00","created_by":"stevey"}]} -{"id":"bd-85487065","content_hash":"f11f458db379288179b4c2434eacee8940eac910781a74c721c7e6e889f76bc1","title":"Add tests for internal/autoimport package","description":"Currently 0.0% coverage. Need tests for auto-import functionality that detects and imports updated JSONL files.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:18.154805-07:00","updated_at":"2025-11-08T22:42:08.862467-08:00","closed_at":"2025-11-08T18:06:25.811317-08:00","source_repo":"."} -{"id":"bd-85d1","content_hash":"a82c0064b840eacb4896f68e73650a3e99aaeaffbb2a7269a857b6c4245b5572","title":"Add integration tests for multi-repo sync","description":"Test: Clone A deletes issue, Clone B imports Clone A's JSONL. Verify Clone B handles deletion gracefully with resurrection. Test concurrent imports with same orphans (should be idempotent). Test round-trip fidelity (exportβ†’delete parentβ†’importβ†’verify structure).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.410318-08:00","updated_at":"2025-11-05T00:44:27.948465-08:00","closed_at":"2025-11-05T00:44:27.948467-08:00","source_repo":"."} -{"id":"bd-8788","content_hash":"31af4635755d7ee1b09d75690de5e8d058417a176fd0b49490d3c968fb3a16a4","title":"Fix monitor-webui status filter","description":"","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-21T11:54:18.982820303-07:00","updated_at":"2025-11-21T11:54:36.091639066-07:00","closed_at":"2025-11-21T11:54:36.091639066-07:00","source_repo":"."} -{"id":"bd-879d","content_hash":"9716c230d9b2793bd1e51d9e3c380c06caf7b3e9a0dd20253764af19e3de7ac8","title":"Test issue 1","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T09:44:12.538697729Z","updated_at":"2025-11-02T09:45:20.76214671Z","closed_at":"2025-11-02T09:45:20.76214671Z","source_repo":".","dependencies":[{"issue_id":"bd-879d","depends_on_id":"bd-d3e5","type":"discovered-from","created_at":"2025-11-02T09:44:22.103468321Z","created_by":"mrdavidlaing"}]} -{"id":"bd-87a0","content_hash":"b6c322852ff360ade9f0d46bb2af29a7cf3d3acc8b7469dcbb5d98bf48050240","title":"Publish @beads/bd package to npm registry","description":"Publish the npm package to the public npm registry:\n\n## Prerequisites\n- npm account created\n- Organization @beads created (or use different namespace)\n- npm login completed locally\n- Package tested locally (bd-f282 completed)\n\n## Publishing steps\n1. Verify package.json version matches current bd version\n2. Run npm pack and inspect tarball contents\n3. Test installation from tarball one more time\n4. Run npm publish --access public\n5. Verify package appears on https://www.npmjs.com/package/@beads/bd\n6. Test installation from registry: npm install -g @beads/bd\n\n## Post-publish\n- Add npm badge to README.md\n- Update CHANGELOG.md with npm package release\n- Announce in release notes\n\n## Note\n- May need to choose different name if @beads namespace unavailable\n- Alternative: beads-cli, bd-cli, or unscoped beads-issue-tracker","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:40:25.263569-08:00","updated_at":"2025-11-03T10:39:41.772338-08:00","closed_at":"2025-11-03T10:39:41.772338-08:00","source_repo":".","dependencies":[{"issue_id":"bd-87a0","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:33.014043-08:00","created_by":"daemon"}],"comments":[{"id":29,"issue_id":"bd-87a0","author":"stevey","text":"Package is ready to publish. All code complete and tested locally. Next steps: 1) npm login, 2) create @beads org if needed, 3) npm publish --access public. See npm-package/PUBLISHING.md for complete instructions.","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-8900f145","content_hash":"4a07f36a9e5d24aaffb092c89e2273cb58f9de357d24eeb01fcde6a4079ba775","title":"Testing event-driven mode!","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:28:33.564871-07:00","updated_at":"2025-10-30T17:12:58.186325-07:00","closed_at":"2025-10-29T19:12:54.43368-07:00","source_repo":"."} -{"id":"bd-8931","content_hash":"409c16d9e6c83c2bf6cccfa6ee6cb18e1e1eee032b522fb99500bb40f2a05649","title":"Daemon gets stuck when auto-import blocked by git conflicts","description":"CRITICAL: The daemon enters a corrupt state that breaks RPC commands when auto-import is triggered but git pull fails due to uncommitted changes.\n\nImpact: This is a data integrity and usability issue that could cause users to lose trust in Beads. The daemon silently fails for certain commands while appearing healthy.\n\nReproduction:\n1. Make local changes to issues (creates uncommitted .beads/beads.jsonl)\n2. Remote has updates (JSONL newer, triggers auto-import)\n3. Daemon tries to pull but fails: 'cannot pull with rebase: You have unstaged changes'\n4. Daemon enters bad state - 'bd show' and other commands return EOF\n5. 'bd list' still works, daemon process is running, no errors logged\n\nTechnical details:\n- Auto-import check runs in handleRequest() before processing RPC commands\n- When import is blocked, it appears to corrupt daemon state\n- Likely: deadlock, unclosed transaction, or storage handle corruption\n- Panic recovery (server_lifecycle_conn.go:183) didn't catch anything - not a panic\n\nRequired fix:\n- Auto-import must not block RPC command execution\n- Handle git pull failures gracefully without corrupting state\n- Consider: skip auto-import if git is dirty, queue import for later, or use separate goroutine\n- Add timeout/circuit breaker for import operations\n- Log clear warnings when auto-import is skipped\n\nWithout this fix, users in collaborative environments will frequently encounter mysterious EOF errors that require daemon restarts.","design":"Options to fix:\n\n1. Skip auto-import when git is dirty (safest, simplest)\n - Check git status before pull\n - Log warning and continue without import\n - User must manually import after cleaning git state\n\n2. Async import with timeout (better UX)\n - Run auto-import in background goroutine\n - Don't block RPC command execution\n - Timeout after 5s, log error if stuck\n - Use sync.Once or similar to prevent concurrent imports\n\n3. Transactional import with rollback\n - Wrap import in database transaction\n - Rollback if git operations fail\n - Ensure storage is never left in bad state\n\nRecommended: Combine #1 and #2\n- Check git status first, skip if dirty\n- If clean, do async import with timeout\n- Add metrics to track import success/failure rates","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-02T17:15:25.181425-08:00","updated_at":"2025-11-03T12:08:12.949061-08:00","closed_at":"2025-11-03T12:08:12.949064-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8931","depends_on_id":"bd-1048","type":"blocks","created_at":"2025-11-02T17:15:25.181857-08:00","created_by":"stevey"}]} -{"id":"bd-897a","content_hash":"ae488407bf5e71242535f4c35b59b0981d2b8b338d1701f19acba2c8e93049f0","title":"Add UNIQUE constraint on external_ref column","description":"The external_ref column should have a UNIQUE constraint to prevent multiple issues from having the same external reference. This ensures data integrity when syncing from external systems (Jira, GitHub, Linear).\n\nCurrent behavior:\n- Multiple issues can have the same external_ref\n- GetIssueByExternalRef returns first match (non-deterministic with duplicates)\n\nProposed solution:\n- Add UNIQUE constraint to external_ref column\n- Add migration to check for and resolve existing duplicates\n- Update tests to verify constraint enforcement\n\nRelated: bd-1022","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:31:54.718005-08:00","updated_at":"2025-11-02T16:01:45.742666-08:00","closed_at":"2025-11-02T16:01:45.742666-08:00","source_repo":"."} -{"id":"bd-89e2","content_hash":"c7da1d6c0d28b2fe9a5a1166a7b6712a870b5271fdf21558e4ef639e2675f92f","title":"Daemon race condition: stale export overwrites recent DB changes","description":"**Symptom:**\nMerged bd-fc2d into bd-fb05 in ~/src/beads (commit ce4d756), pushed to remote. The ~/src/fred/beads daemon then exported its stale DB state and committed (8cc1bb4), reverting bd-fc2d back to \"open\" status.\n\n**Timeline:**\n1. 21:45:12 - Merge committed from ~/src/beads (ce4d756): bd-fc2d closed\n2. 21:49:42 - Daemon in ~/src/fred/beads exported stale state (8cc1bb4): bd-fc2d open again\n\n**Root cause:**\nThe fred/beads daemon had a stale database (bd-fc2d still open) and didn't auto-import the newer JSONL before exporting. When it exported, it overwrote the merge with its stale state.\n\n**Expected behavior:**\nDaemon should detect that JSONL is newer than its last export and import before exporting.\n\n**Actual behavior:**\nDaemon exported stale DB state, creating a conflicting commit that reverted upstream changes.\n\n**Impact:**\nMulti-workspace setups with daemons can silently lose changes if one daemon has stale state and exports.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-01T21:53:07.930819-07:00","updated_at":"2025-11-01T22:01:25.54126-07:00","closed_at":"2025-11-01T22:01:25.54126-07:00","source_repo":"."} -{"id":"bd-8a39","content_hash":"cf11bd12f8906b73236f46998076d6111d69f05e76198e9823a8f10f3e03112b","title":"Fix Windows-specific test failures in CI","description":"Several tests are failing on Windows but passing on Linux:\n\n**Failing tests:**\n- TestFindDatabasePathEnvVar\n- TestHashIDs_MultiCloneConverge\n- TestHashIDs_IdenticalContentDedup\n- TestDatabaseReinitialization (all 5 subtests):\n - fresh_clone_auto_import\n - database_removal_scenario\n - legacy_filename_support\n - precedence_test\n - init_safety_check\n- TestFindBeadsDir_NotFound\n- TestMetricsSnapshot/uptime (in internal/rpc)\n\n**CI Run:** https://github.com/steveyegge/beads/actions/runs/19015638968\n\nThese are likely path separator or filesystem behavior differences between Windows and Linux.","notes":"Fixed all Windows path issues:\n1. TestFindDatabasePathEnvVar - expects canonicalized paths βœ…\n2. TestHashIDs tests - use platform-specific bd.exe command βœ… \n3. TestMetricsSnapshot/uptime - enforce minimum 1 second uptime βœ…\n4. TestFindBeadsDir_NotFound - allow finding .beads in parent dirs βœ…\n5. TestDatabaseReinitialization - fix git path conversion on Windows (git returns /c/Users/... but filepath needs C:\\Users\\...) βœ…\n\nCI run in progress to verify all fixes.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-02T09:29:37.274103-08:00","updated_at":"2025-11-02T12:32:00.158713-08:00","closed_at":"2025-11-02T12:32:00.158716-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8a39","depends_on_id":"bd-1231","type":"blocks","created_at":"2025-11-02T09:29:37.276579-08:00","created_by":"stevey"}]} -{"id":"bd-8ayj","content_hash":"291e1a56d1aefe412ecf58170e539ed34febc8f01d8d100062e7de8e67ca5361","title":"bd-hv01: Race condition with concurrent snapshot operations","description":"## Problem\nSnapshot files have no locking. Multiple processes can call captureLeftSnapshot simultaneously:\n\n1. Process A: export β†’ begins snapshot\n2. Process B: export β†’ begins snapshot\n3. Process A: writes partial left.jsonl\n4. Process B: overwrites with its left.jsonl\n5. Process A: completes merge with wrong snapshot\n\n## Impact\n- Data corruption in multi-process scenarios\n- Daemon + manual sync race\n- Multiple git clones on same filesystem\n\n## Fix\nUse atomic file operations with process-specific temp files:\n```go\nfunc captureLeftSnapshot(jsonlPath string) error {\n _, leftPath := getSnapshotPaths(jsonlPath)\n tempPath := fmt.Sprintf(\"%s.%d.tmp\", leftPath, os.Getpid())\n if err := copyFileSnapshot(jsonlPath, tempPath); err != nil {\n return err\n }\n return os.Rename(tempPath, leftPath) // Atomic on POSIX\n}\n```\n\n## Files Affected\n- cmd/bd/deletion_tracking.go:24-29 (captureLeftSnapshot)\n- cmd/bd/deletion_tracking.go:31-36 (updateBaseSnapshot)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:15:38.177367-08:00","updated_at":"2025-11-06T18:46:55.91344-08:00","closed_at":"2025-11-06T18:46:55.91344-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8ayj","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.875543-08:00","created_by":"daemon"}]} -{"id":"bd-8b65","content_hash":"8675dbc7a679f06245ad85c184730d7bc495559d934ba4081886b576ed628d38","title":"Add depth-based batch creation in upsertIssues","description":"Replace single batch creation with depth-level batching (max depth 3). Create issues at depth 0, then 1, then 2, then 3. Prevents parent validation errors when importing hierarchical issues in same batch. File: internal/importer/importer.go:534-546","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-04T12:31:42.267746-08:00","updated_at":"2025-11-05T00:08:42.813239-08:00","closed_at":"2025-11-05T00:08:42.813246-08:00","source_repo":"."} -{"id":"bd-8f8b","content_hash":"ed8fd55f5795bd49d6640e567bbf3e8d8f00ccc35ad785f0b6c23dbb3aafc19c","title":"Test update","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T12:59:13.608216-08:00","updated_at":"2025-11-05T12:59:20.120052-08:00","closed_at":"2025-11-05T12:59:20.120052-08:00","source_repo":"."} -{"id":"bd-8hf","content_hash":"ec57c5cb45f0afdbccf3c0b9e383f5ff8023f853393f8afda09189edc63ddd95","title":"Auto-routing and maintainer detection","description":"Implement intelligent routing to automatically send new issues to correct repo based on user's maintainer vs contributor status, with discovered issues inheriting parent's source_repo.","design":"Features:\n- Detect maintainer vs contributor (git config, permissions)\n- Config-based routing rules (no schema changes)\n- Auto-route 'bd add' to primary or planning repo\n- Discovered issues inherit parent's source_repo\n- Explicit override via --repo flag\n\nConfig schema:\n[routing]\nmode = \"auto\" # auto | explicit\ndefault = \"~/.beads-planning\"\n[routing.auto]\nmaintainer = \".\"\ncontributor = \"~/.beads-planning\"","acceptance_criteria":"1. Auto-detect maintainer vs contributor status\n2. Route bd add to correct repo automatically\n3. Discovered issues inherit parent's source_repo\n4. --repo flag overrides auto-routing\n5. Config allows explicit routing rules\n6. Works without breaking single-repo workflows","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:50.961196-08:00","updated_at":"2025-11-05T00:08:42.813482-08:00","closed_at":"2025-11-05T00:08:42.813484-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8hf","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:24.262815-08:00","created_by":"daemon"}]} -{"id":"bd-8ift","content_hash":"5a9f0416216cad6d0a611c790cab9cb47a2d4c0e2afa6fea024218d1bc4326a9","title":"Debug test","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-08T00:04:35.254385-08:00","updated_at":"2025-11-08T00:06:46.179396-08:00","closed_at":"2025-11-08T00:06:46.179396-08:00","source_repo":"."} -{"id":"bd-8kde","content_hash":"2bc64e3d456f5490598f8d49e65a870d5b9b6c1579046a80f616a12d98908fc9","title":"bd delete bulk operations fight with auto-import/daemon causing data resurrection","description":"When bulk deleting issues (e.g., 244 closed issues older than 24h), the process fights with auto-import and daemon infrastructure:\n\n**Expected behavior:**\n- Delete 244 issues from 468-issue database\n- Export to JSONL (224 lines)\n- Commit and push\n- Result: 224 issues\n\n**Actual behavior:**\n- Delete 244 issues \n- Import runs (from stale git JSONL with 468 issues)\n- Resurrects deleted issues back into database\n- Export writes 356 lines (not 224)\n- Math: 468 - 244 = 224, but got 356 (132 issues resurrected)\n\n**Root cause:**\nAuto-import keeps re-importing from git during the delete operation, before the new JSONL is committed. The workflow is:\n1. Delete from DB\n2. Auto-import runs (reads old JSONL from git with deleted issues still present)\n3. Issues come back\n4. Export writes partially-deleted state\n\n**Solution options:**\n1. Add `--no-auto-import` flag to bulk delete operations\n2. Atomic delete-export-commit operation that suppresses imports\n3. Dedicated `bd prune` command that handles this correctly\n4. Lock file to prevent auto-import during bulk mutations\n\n**Impact:**\n- Bulk cleanup operations don't work reliably\n- Makes it nearly impossible to prune old closed issues\n- Confusing UX (delete 244, but only 112 actually removed)","notes":"**FIXED**: Auto-import now skips during delete operations to prevent resurrection.\n\n**Root cause confirmed**: Auto-import was running in PersistentPreRun before delete executed, causing it to re-import stale JSONL from git and resurrect deleted issues.\n\n**Solution implemented**:\n1. Added delete to skip list in main.go PersistentPreRun (alongside import and sync --dry-run)\n2. Delete operations now complete atomically without auto-import interference\n3. Added comprehensive test (TestBulkDeleteNoResurrection) to prevent regression\n\n**Test verification**:\n- Creates 20 issues, deletes 10\n- Verifies no resurrection after delete\n- Confirms JSONL has correct count (10 remaining)\n- All existing tests still pass","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T03:01:09.796852-08:00","updated_at":"2025-11-08T03:06:04.416994-08:00","closed_at":"2025-11-08T03:06:04.416994-08:00","source_repo":"."} -{"id":"bd-8mfn","content_hash":"866a8afcdadb8e4e015aab6ab0b8882f48ae9856098181205013b992d2aa08f3","title":"bd message: Implement full message reading functionality","description":"The `bd message read` command is incomplete and doesn't actually fetch or display message content.\n\n**Location:** cmd/bd/message.go:413-441\n\n**Current Behavior:**\n- Only marks message as read\n- Prints placeholder text\n- Doesn't fetch message body\n\n**Expected:**\n- Fetch full message from Agent Mail resource API\n- Display sender, subject, timestamp, body\n- Consider markdown rendering\n\n**Blocker:** Core feature for message system MVP","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-08T12:54:24.018957-08:00","updated_at":"2025-11-08T12:57:32.91854-08:00","closed_at":"2025-11-08T12:57:32.91854-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8mfn","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.811368-08:00","created_by":"daemon"}]} -{"id":"bd-8ph6","content_hash":"c64a644d8f2ea530109e7e6ef569ebd18b553a793cce5a4bd657581d75304167","title":"Support Ubuntu 20.04 LTS (glibc compatibility issue)","description":"Starting at v0.22, precompiled binaries require GLIBC 2.32+ which is not available on Ubuntu 20.04 LTS (Focal Fossa). Ubuntu 20.04 has GLIBC 2.31.\n\nError:\n```\nbd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by bd)\nbd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by bd)\n```\n\nCurrent workarounds:\n1. Upgrade to Ubuntu 22.04+\n2. Build from source: `go build -o bd ./cmd/bd/`\n\nRoot cause: Go 1.24+ runtime requires newer glibc. CGO is already disabled in .goreleaser.yml.\n\nPossible solutions:\n- Pin Go version to 1.21 or 1.22 for releases\n- Use Docker/cross-compile with older build environment\n- Provide separate build for older distros\n- Document minimum requirements clearly","notes":"Decision: Document minimum requirements in README instead of pinning Go version.\n\nRationale:\n- Ubuntu 20.04 LTS standard support ended April 2025 (already EOL)\n- Pinning Go prevents security fixes, performance improvements, and new features\n- Users on EOL distros can upgrade OS or build from source\n- Added Requirements section to README with clear glibc 2.32+ requirement","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-07T14:25:47.055357-08:00","updated_at":"2025-11-07T14:30:15.755733-08:00","closed_at":"2025-11-07T14:30:15.755733-08:00","source_repo":"."} -{"id":"bd-8ql","content_hash":"d5bb8e88dc528e8d6f9873ce58279245bf3f6b889cc068961b32a85e9ede2c4a","title":"Remove misleading placeholder 'bd merge' command from duplicates output","description":"**Problem:**\nThe `bd duplicates` command suggests running a command that doesn't exist:\n```\nbd merge \u003csource-ids\u003e --into \u003ctarget-id\u003e\n```\n\nThis is confusing because:\n1. `bd merge` is actually a git 3-way JSONL merge driver (takes 4 file paths)\n2. The suggested syntax for merging duplicate issues is not implemented\n3. Line 75 in duplicates.go even has: `// TODO: performMerge implementation pending`\n\n**Current behavior:**\n- Users see suggested command that doesn't work\n- No indication that feature is unimplemented\n- Related to issue #349 item #2\n\n**Proposed fix:**\nReplace line 77 in cmd/bd/duplicates.go with either:\n\nOption A (conservative):\n```go\ncmd := fmt.Sprintf(\"# TODO: Merge %s into %s (merge command not yet implemented)\", \n strings.Join(sources, \" \"), target.ID)\n```\n\nOption B (actionable):\n```go\ncmd := fmt.Sprintf(\"# Duplicate found: %s\\n# Manual merge: Close duplicates with 'bd close %s' and link to %s as 'related'\", \n strings.Join(sources, \" \"), strings.Join(sources, \" \"), target.ID)\n```\n\n**Files to modify:**\n- cmd/bd/duplicates.go (line ~77)","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:48:01.707967-05:00","updated_at":"2025-11-23T14:14:13.331484-08:00","closed_at":"2025-11-20T20:59:13.416865-05:00","source_repo":".","labels":["bug","documentation","ux"],"comments":[{"id":17,"issue_id":"bd-8ql","author":"stevey","text":"Addresses GitHub issue #349 item 2: https://github.com/steveyegge/beads/issues/349\n\nUser confused by 'bd merge' help text. The help text is actually correct (it's a git merge driver), but the duplicates command suggests a non-existent 'bd merge \u003cids\u003e --into \u003ctarget\u003e' syntax for merging duplicate issues.","created_at":"2025-11-21T02:23:27Z"}]} -{"id":"bd-8rd","content_hash":"e5845f6bda21414b3715f9589c76f8a02594f4cb8691939ced6765329346e411","title":"Migration and onboarding for multi-repo","description":"Create migration tools, wizards, and documentation to help users adopt multi-repo workflow, with special focus on OSS contributor onboarding and team adoption scenarios.","design":"Components:\n- Migration guide documentation\n- bd migrate command to move issues between repos\n- bd init --contributor wizard for OSS setup\n- bd init --team wizard for team setup\n- Auto-detect scenarios and prompt users\n- Examples for common workflows (OSS, multi-phase, personas)\n\nScenarios:\n1. OSS contributor (fork workflow)\n2. Team member (branch workflow)\n3. Multi-phase development\n4. Multiple personas (architect/implementer)","acceptance_criteria":"1. Migration guide covers all scenarios\n2. bd migrate moves issues with filtering\n3. Init wizards guide common setups\n4. Examples demonstrate key workflows\n5. Auto-detection prompts users when appropriate\n6. Docs updated with multi-repo patterns\n7. Backward compatibility clearly documented","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-04T11:22:13.491033-08:00","updated_at":"2025-11-07T16:08:24.951261-08:00","closed_at":"2025-11-07T16:03:09.75064-08:00","source_repo":".","dependencies":[{"issue_id":"bd-8rd","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.858002-08:00","created_by":"daemon"}]} -{"id":"bd-8wa","content_hash":"0cf757ff7ef5393901a61cfdfaa2d6f7ac627eaa1c62b63165050f21d9b5b390","title":"Code Review Sweep: thorough","description":"Perform thorough code review sweep based on accumulated activity.\n\n**AI Reasoning:**\nSignificant code volume added (150,273 lines) across multiple critical areas, including cmd/bd, internal/storage/sqlite, and internal/rpc. High file change count (616) indicates substantial refactoring or new functionality. The metrics suggest potential for subtle architectural or implementation issues that warrant review.\n\n**Scope:** thorough\n**Target Areas:** cmd/bd, internal/storage/sqlite, internal/rpc\n**Estimated Files:** 12\n**Estimated Cost:** $5\n\n**Task:**\nReview files for non-obvious issues that agents miss during focused work:\n- Inefficiencies (algorithmic, resource usage)\n- Subtle bugs (race conditions, off-by-one, copy-paste)\n- Poor patterns (coupling, complexity, duplication)\n- Missing best practices (error handling, docs, tests)\n- Unnamed anti-patterns\n\nFile discovered issues with detailed reasoning and suggestions.","acceptance_criteria":"- Reviewed target files for code quality issues\n- Filed discovered issues with detailed reasoning\n- Completed sweep according to scope criteria","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T10:25:37.081296-05:00","updated_at":"2025-11-21T10:25:37.081296-05:00","source_repo":".","labels":["code-review-sweep","review-area:cmd/bd","review-area:internal/rpc","review-area:internal/storage/sqlite"]} -{"id":"bd-8y1a","content_hash":"7290f181cb874705a9981d12c510f9506f7c74de40aafa1baa5a9b652e52495a","title":"Update Nix flake Go modules hash","description":"","status":"closed","priority":0,"issue_type":"bug","assignee":"claude","created_at":"2025-11-22T10:56:09.819863-08:00","updated_at":"2025-11-22T10:59:18.858399-08:00","closed_at":"2025-11-22T10:59:18.858399-08:00","source_repo":"."} -{"id":"bd-8zf2","content_hash":"6aaca1fd593b88220f2d8e41f7af9b0cbce6d9152ac4d0b9d2ffe3b8f464adc5","title":"MCP server loses workspace context after Amp restart - causes silent failures","description":"**CRITICAL BUG**: The beads MCP server loses workspace context when Amp restarts, leading to silent failures and potential data corruption.\n\n## Reproduction\n1. Start Amp with beads MCP server configured\n2. Call `mcp__beads__set_context(workspace_root=\"/path/to/project\")`\n3. Use MCP tools successfully (e.g., `mcp__beads__show`, `mcp__beads__list`)\n4. Restart Amp (new thread/session)\n5. Try to use MCP tools without calling `set_context` again\n6. **Result**: \"Not connected\" or \"No workspace set\" errors\n\n## Impact\n- Amp agents silently fail when trying to read/update beads issues\n- May attempt to create duplicate issues because they can't see existing ones\n- Potential for data corruption if operating on wrong database\n- Breaks multi-session workflows\n- Creates confusion: CLI works (`./bd`) but MCP tools don't\n\n## Current Workaround\nManually call `mcp__beads__set_context()` at start of every Amp session.\n\n## Root Cause\nMCP server is stateful and doesn't persist workspace context across restarts.\n\n## Proposed Fix\n**Option 1 (Best)**: Auto-detect workspace from current working directory\n- Match behavior of CLI `./bd` commands\n- Check for `.beads/` directory in current dir or parents\n- No manual context setting needed\n\n**Option 2**: Persist context in MCP server state file\n- Save last workspace_root to `~/.config/beads/mcp_context.json`\n- Restore on server startup\n\n**Option 3**: Require explicit context in every MCP call\n- Add optional `workspace_root` parameter to all MCP tools\n- Fall back to saved context if not provided\n\nAcceptance:\n- MCP tools work across Amp restarts without manual set_context()\n- Auto-detection matches CLI behavior (walks up from CWD)\n- Clear error message when no workspace found\n- set_context() still works for explicit override\n- BEADS_WORKING_DIR env var support\n- Integration test validates restart behavior","design":"**Recommended Implementation: Option 1 (Auto-detect)**\n\n1. Workspace Discovery Algorithm (same as CLI):\n - Start from CWD or provided directory\n - Walk up directory tree looking for .beads/beads.db\n - Cache result for performance\n\n2. MCP Tool Wrapper Changes:\n - Before each MCP tool execution, check if workspace is set\n - If not set, try auto-detection from CWD\n - If found, auto-connect and cache\n - If not found, return clear error with instructions\n\n3. Fallback Behavior:\n - Auto-detect from CWD first\n - Check BEADS_WORKING_DIR env var\n - Check ~/.config/beads/last_workspace (persisted)\n - Return actionable error if all fail\n\n4. Backwards Compatibility:\n - Keep set_context() working for explicit control\n - Auto-detect is always tried first if no explicit context\n - set_context() takes precedence over auto-detect","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T23:50:52.083111-08:00","updated_at":"2025-11-07T23:58:44.397502-08:00","closed_at":"2025-11-07T23:58:44.397502-08:00","source_repo":"."} -{"id":"bd-8zpg","content_hash":"31c8e1312c7d75e9c17f9557f86bc642ca47e5c9a39d4f7e76429cc61bc9793d","title":"Add tests for bd init --contributor wizard","description":"Write integration tests for the contributor wizard:\n- Test fork detection logic\n- Test planning repo creation\n- Test config setup\n- Test with/without upstream remote\n- Test with SSH vs HTTPS origins","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:58:18.171851-08:00","updated_at":"2025-11-06T18:19:16.232739-08:00","closed_at":"2025-11-06T16:14:06.341689-08:00","source_repo":"."} -{"id":"bd-9063acda","content_hash":"0ea4606188e376705c46a14e5d64da1b706aad47a39054a732c21330db601960","title":"Clean up linter errors (914 total issues)","description":"The codebase has 914 linter issues reported by golangci-lint. While many are documented as baseline in LINTING.md, we should clean these up systematically to improve code quality and maintainability.","design":"Break down by linter category, prioritizing high-impact issues:\n1. dupl (7) - Code duplication\n2. goconst (12) - Repeated strings\n3. gocyclo (11) - High complexity functions\n4. revive (78) - Style issues\n5. gosec (102) - Security warnings\n6. errcheck (683) - Unchecked errors (many in tests)","acceptance_criteria":"All linter categories reduced to acceptable levels, with remaining baseline documented in LINTING.md","notes":"Reduced from 56 to 41 issues locally, then to 0 issues.\n\n**Fixed in commits:**\n- c2c7eda: Fixed 15 actual errors (dupl, gosec, revive, staticcheck, unparam)\n- 963181d: Configured exclusions to get to 0 issues locally\n\n**Current status:**\n- βœ… Local: golangci-lint reports 0 issues\n- ❌ CI: Still failing (see [deleted:bd-cb64c226.1])\n\n**Problem:**\nConfig v2 format or golangci-lint-action@v8 compatibility issue causing CI to fail despite local success.\n\n**Next:** Debug [deleted:bd-cb64c226.1] to fix CI/local discrepancy","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-24T01:01:12.997982-07:00","updated_at":"2025-11-04T11:10:23.532431-08:00","closed_at":"2025-11-04T11:10:23.532433-08:00","source_repo":"."} -{"id":"bd-908z","content_hash":"261f49a328da20d0a18a6a1f56010de9ac6034e989c686b61f12e1d85af41500","title":"Add bd hooks install command to embed git hooks in binary","description":"Currently git hooks are installed via `examples/git-hooks/install.sh`, which only exists in the beads source repo. Users who install bd via installer/homebrew/npm can't easily install hooks.\n\n**Proposal:**\nAdd `bd hooks install` command that:\n- Embeds hook scripts in the bd binary (using go:embed)\n- Installs them to .git/hooks/ in current repo\n- Backs up existing hooks\n- Makes them executable\n\n**Commands:**\n- `bd hooks install` - Install all hooks\n- `bd hooks uninstall` - Remove hooks\n- `bd hooks list` - Show installed hooks status\n\n**Benefits:**\n- Works for all bd users, not just source repo users\n- More discoverable (shows in bd --help)\n- Consistent with bd workflow\n- Can version hooks with bd releases","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-08T01:23:24.362827-08:00","updated_at":"2025-11-08T01:28:08.842516-08:00","closed_at":"2025-11-08T01:28:08.842516-08:00","source_repo":"."} -{"id":"bd-90a5","content_hash":"e54904609d3be88a50850d032fbbc1729a48d79436ff0ab5204d1cc044b93c47","title":"Extract hash ID generation functions to hash_ids.go","description":"Move generateHashID, getNextChildNumber, GetNextChildID to hash_ids.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.890883-07:00","updated_at":"2025-11-02T12:32:00.159056-08:00","closed_at":"2025-11-02T12:32:00.159058-08:00","source_repo":"."} -{"id":"bd-90v","content_hash":"9863bc4154603ebc58c4649f8a74b5508f8b30aae6db360e84485e2d7f19fb30","title":"bd prime: AI context loading and Claude Code integration","description":"Implement `bd prime` command and Claude Code hooks for context recovery. Hooks work with BOTH MCP server and CLI approaches - they solve the context memory problem (keeping bd workflow fresh after compaction) not the tool access problem (MCP vs CLI).","design":"## Epic Scope\n\nThis epic covers:\n1. Core `bd prime` command implementation with MCP-aware output\n2. Claude Code hooks via `bd setup claude` (works with MCP OR CLI)\n3. Automatic context recovery via SessionStart/PreCompact hooks\n4. `bd doctor` verification for Claude setup\n5. Documentation updates\n\n## Goals\n- Keep bd workflow fresh in agent context (prevent markdown TODO reversion)\n- Enable automatic context recovery after compaction/clear\n- Adapt to user's workflow preference (MCP vs CLI) automatically\n- Support multi-user projects (mixed Claude/non-Claude teams)\n- Verify setup with `bd doctor`\n\n## Architecture Understanding\n\n**MCP vs CLI is a user preference (not project-level):**\n- User installs MCP server globally β†’ gets native bd tools\n- User doesn't install MCP β†’ uses CLI via Bash tool\n- `bd prime` auto-detects which mode and adapts output\n- Same hooks work for all users regardless of preference\n\n**Hooks complement both approaches:**\n- **With MCP**: Hooks output workflow reminders (~500 tokens) - prevents forgetting to use MCP tools\n- **Without MCP**: Hooks output full CLI reference (~1-2k tokens) - provides command syntax\n- **Both cases**: Prevents markdown TODO reversion after compaction\n\n**Why hooks matter even with MCP:**\n- MCP tools can be forgotten after compaction\n- Hooks refresh \"use bd, not markdown\" reminder\n- PreCompact keeps bd workflow fresh in memory\n- Works in both MCP and CLI scenarios\n\n## Token Optimization\n\n**MCP mode** (~500 tokens):\n- Workflow reminders only\n- No CLI syntax (user has native tools)\n- References to MCP tool names\n\n**Non-MCP mode** (~1-2k tokens):\n- Full workflow rules\n- Complete CLI command reference\n- Examples and common patterns\n\n**Why adaptive output matters:**\n- MCP users waste tokens on CLI docs they don't need\n- Non-MCP users need full command reference\n- Same hook works for everyone, adapts automatically\n- Multi-user projects: each dev gets appropriate output for their setup\n\n## Out of Scope\n- Tip system infrastructure (separate epic)\n- Cursor/Windsurf integration (separate issues)\n- MCP server modifications","acceptance_criteria":"- `bd prime` command exists and outputs AI-optimized markdown\n- `bd setup claude` installs hooks and slash commands\n- Hooks auto-call `bd prime` when .beads/ detected\n- `bd doctor` verifies Claude integration\n- Documentation complete in AGENTS.md, README.md, QUICKSTART.md\n- All child issues closed","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-11T23:31:12.119012-08:00","updated_at":"2025-11-12T00:11:07.743189-08:00","source_repo":"."} -{"id":"bd-942469b8","content_hash":"32c69c723ebb79b1bb948fe0391906b0c81426c473adccf13fdb47dd40ca774b","title":"Rapid 5","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.508166-07:00","updated_at":"2025-11-07T23:21:44.924708-08:00","closed_at":"2025-11-07T23:18:52.298739-08:00","source_repo":"."} -{"id":"bd-96142dec","content_hash":"721a9407dc1f092be7fa260c390100f76d2e095e487e514f937a5a396b5620f7","title":"Add fallback to polling on watcher failure","description":"Detect fsnotify.NewWatcher() errors and log warning. Auto-switch to polling mode with 5s ticker. Add BEADS_WATCHER_FALLBACK env var to control behavior.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.428439-07:00","updated_at":"2025-10-30T17:12:58.220378-07:00","closed_at":"2025-10-28T19:23:43.595916-07:00","source_repo":"."} -{"id":"bd-968f","content_hash":"41376d2927c9107898e7cb72aaa17a76d8b44692a78aa201123e8b2a0404ce34","title":"Add unit tests for config modes","description":"Test all four orphan_handling modes: strict (fails), resurrect (creates tombstone), skip (logs warning), allow (imports orphan). Verify error messages and logging output for each mode.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.367129-08:00","updated_at":"2025-11-05T00:44:27.948775-08:00","closed_at":"2025-11-05T00:44:27.948777-08:00","source_repo":"."} -{"id":"bd-9826b69a","content_hash":"66b54987232cdf53d3b69004af2488330023ed8adb576257750a52550aa5ee59","title":"CRDT-based architecture for guaranteed convergence (v2.0)","description":"## Vision\nRedesign beads around Conflict-Free Replicated Data Types (CRDTs) to provide mathematical guarantees for N-way collision resolution at arbitrary scale.\n\n## Current Limitations\n- Content-hash based collision resolution fails at 5+ clones\n- Non-deterministic convergence in multi-round scenarios\n- UNIQUE constraint violations during rename operations\n- No formal proof of convergence properties\n\n## CRDT Benefits\n- Provably convergent (Strong Eventual Consistency)\n- Commutative/Associative/Idempotent operations\n- No coordination required between clones\n- Scales to 100+ concurrent workers\n- Well-understood mathematical foundations\n\n## Proposed Architecture\n\n### 1. UUID-Based IDs\nReplace sequential IDs with UUIDs:\n- Current: bd-1c63eb84, bd-9063acda, bd-4d80b7b1\n- CRDT: bd-a1b2c3d4-e5f6-7890-abcd-ef1234567890\n- Human aliases maintained separately: #42 maps to UUID\n\n### 2. Last-Write-Wins (LWW) Elements\nEach field becomes an LWW register:\n- title: (timestamp, clone_id, value)\n- status: (timestamp, clone_id, value)\n- Deterministic conflict resolution via Lamport timestamp + clone_id tiebreaker\n\n### 3. Operation Log\nTrack all operations as CRDT ops:\n- CREATE(uuid, timestamp, clone_id, fields)\n- UPDATE(uuid, field, timestamp, clone_id, value)\n- DELETE(uuid, timestamp, clone_id) - tombstone, not hard delete\n\n### 4. Sync as Merge\nSyncing becomes merging two CRDT states:\n- No merge conflicts possible\n- Deterministic merge function\n- Guaranteed convergence\n\n## Implementation Phases\n\n### Phase 1: Research \u0026 Design (4 weeks)\n- Study existing CRDT implementations (Automerge, Yjs, Loro)\n- Design schema for CRDT-based issue tracking\n- Prototype LWW-based Issue CRDT\n- Benchmark performance vs current system\n\n### Phase 2: Parallel Implementation (6 weeks)\n- Implement CRDT storage layer alongside SQLite\n- Build conversion tools: SQLite ↔ CRDT\n- Maintain backward compatibility with v1.x format\n- Migration path for existing databases\n\n### Phase 3: Testing \u0026 Validation (4 weeks)\n- Formal verification of convergence properties\n- Stress testing with 100+ clone scenario\n- Performance profiling and optimization\n- Documentation and examples\n\n### Phase 4: Migration \u0026 Rollout (4 weeks)\n- Release v2.0-beta with CRDT backend\n- Gradual migration from v1.x\n- Monitoring and bug fixes\n- Final v2.0 release\n\n## Risks \u0026 Mitigations\n\n**Risk 1: Performance overhead**\n- Mitigation: Benchmark early, optimize hot paths\n- CRDTs can be slower than append-only logs\n- May need compaction strategy\n\n**Risk 2: Storage bloat**\n- Mitigation: Implement operation log compaction\n- Tombstone garbage collection for deleted issues\n- Periodic snapshots to reduce log size\n\n**Risk 3: Breaking changes**\n- Mitigation: Maintain v1.x compatibility layer\n- Gradual migration tools\n- Dual-mode operation during transition\n\n**Risk 4: Complexity**\n- Mitigation: Use battle-tested CRDT libraries\n- Comprehensive documentation\n- Clear migration guide\n\n## Success Criteria\n- 100-clone collision test passes without failures\n- Formal proof of convergence properties\n- Performance within 2x of current system\n- Zero manual conflict resolution required\n- Backward compatible with v1.x databases\n\n## Timeline\n18-20 weeks total (4-5 months)\n\n## References\n- Automerge: https://automerge.org\n- Yjs: https://docs.yjs.dev\n- Loro: https://loro.dev\n- CRDT theory: Shapiro et al, A comprehensive study of CRDTs\n- Related issues: bd-0dcea000, bd-4d7fca8a, bd-6221bdcd","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-10-29T20:48:00.267736-07:00","updated_at":"2025-10-31T20:06:44.60536-07:00","closed_at":"2025-10-31T20:06:44.60536-07:00","source_repo":"."} -{"id":"bd-98c4e1fa","content_hash":"24b80fab2399079003fd39235e3c7992d404577f8794cc367552340244308636","title":"Event-driven daemon architecture","description":"Replace 5-second polling sync loop with event-driven architecture that reacts instantly to changes. Eliminates stale data issues while reducing CPU ~60%. Key components: FileWatcher (fsnotify), Debouncer (500ms), RPC mutation events, optional git hooks. Target latency: \u003c500ms (vs 5000ms). See event_driven_daemon.md for full design.","notes":"## Implementation Progress\n\n**Completed:**\n1. βœ… Mutation events infrastructure (bd-143 equivalent)\n - MutationEvent channel in RPC server\n - Events emitted for all write operations: create, update, close, label add/remove, dep add/remove, comment add\n - Non-blocking emission with dropped event counter\n\n2. βœ… FileWatcher with fsnotify (bd-b0c7f7ef related)\n - Watches .beads/issues.jsonl and .git/refs/heads\n - 500ms debounce\n - Polling fallback if fsnotify unavailable\n\n3. βœ… Debouncer (bd-144 equivalent)\n - 500ms debounce for both export and import triggers\n - Thread-safe trigger/cancel\n\n4. βœ… Separate export-only and import-only functions\n - createExportFunc(): exports + optional commit/push (no pull/import)\n - createAutoImportFunc(): pull + import (no export)\n - Target latency \u003c500ms achieved by avoiding full sync\n\n5. βœ… Dropped events safety net (bd-eef03e0a related)\n - Atomic counter tracks dropped mutation events\n - 60-second health check triggers export if events were dropped\n - Prevents silent data loss from event storms\n\n**Still Needed:**\n- Platform-specific tests (bd-69bce74a)\n- Integration test for mutationβ†’export latency (bd-140)\n- Unit tests for FileWatcher (bd-b0c7f7ef)\n- Unit tests for Debouncer (bd-144)\n- Event storm stress test (bd-eef03e0a)\n- Documentation update (bd-142)\n\n**Next Steps:**\nAdd comprehensive test coverage before enabling events mode by default.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-29T21:19:36.203436-07:00","updated_at":"2025-10-30T17:12:58.197875-07:00","closed_at":"2025-10-29T15:53:34.022335-07:00","source_repo":"."} -{"id":"bd-98c4e1fa.1","content_hash":"6440d1ece0a91c8f49adc09aafa7a998b049bcd51f257125ad8bc0b7b03e317b","title":"Update AGENTS.md with event-driven mode","description":"Document BEADS_DAEMON_MODE env var. Explain opt-in during Phase 1. Add troubleshooting for watcher failures.","status":"open","priority":2,"issue_type":"task","created_at":"2025-10-29T23:05:13.986452-07:00","updated_at":"2025-10-31T20:36:49.381832-07:00","source_repo":".","dependencies":[{"issue_id":"bd-98c4e1fa.1","depends_on_id":"bd-98c4e1fa","type":"parent-child","created_at":"2025-10-29T21:19:36.206187-07:00","created_by":"import-remap"},{"issue_id":"bd-98c4e1fa.1","depends_on_id":"bd-0e1f2b1b","type":"parent-child","created_at":"2025-10-31T19:38:09.131439-07:00","created_by":"stevey"}]} -{"id":"bd-9ae788be","content_hash":"22ad341d54105f9b2e9b7fecbafbca94100ea270b9ff8588e1fea6cf72603968","title":"Implement clone-scoped ID allocation to prevent N-way collisions","description":"## Problem\nCurrent ID allocation uses per-clone atomic counters (issue_counters table) that sync based on local database state. In N-way collision scenarios:\n- Clone B sees {test-1} locally, allocates test-2\n- Clone D sees {test-1, test-2, test-3} locally, allocates test-4\n- When same content gets assigned test-2 and test-4, convergence fails\n\nRoot cause: Each clone independently allocates IDs without global coordination, leading to overlapping assignments for the same content.\n\n## Solution\nAdd clone UUID to ID allocation to make every ID globally unique:\n\n**Current format:** `test-1`, `test-2`, `test-3`\n**New format:** `test-1-a7b3`, `test-2-a7b3`, `test-3-c4d9`\n\nWhere suffix is first 4 chars of clone UUID.\n\n## Implementation\n\n### 1. Add clone_identity table\n```sql\nCREATE TABLE clone_identity (\n clone_uuid TEXT PRIMARY KEY,\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n### 2. Modify getNextIDForPrefix()\n```go\nfunc (s *SQLiteStorage) getNextIDForPrefix(ctx context.Context, prefix string) (string, error) {\n cloneUUID := s.getOrCreateCloneUUID(ctx)\n shortUUID := cloneUUID[:4]\n \n nextNum := s.getNextCounterForPrefix(ctx, prefix)\n return fmt.Sprintf(\"%s-%d-%s\", prefix, nextNum, shortUUID), nil\n}\n```\n\n### 3. Update ID parsing logic\nAll places that parse IDs (utils.ExtractIssueNumber, etc.) need to handle new format.\n\n### 4. Migration strategy\n- Existing IDs remain unchanged (no suffix)\n- New IDs get clone suffix automatically\n- Display layer can hide suffix in UI: `bd-cb64c226.3-a7b3` β†’ `#42`\n\n## Benefits\n- **Zero collision risk**: Same content in different clones gets different IDs\n- **Maintains readability**: Still sequential numbering within clone\n- **No coordination needed**: Works offline, no central authority\n- **Scales to 100+ clones**: 4-char hex = 65,536 unique clones\n\n## Concerns\n- ID format change may break existing integrations\n- Need migration path for existing databases\n- Display logic needs update to hide/show suffixes appropriately\n\n## Success Criteria\n- 10+ clone collision test passes without failures\n- Existing issues continue to work (backward compatibility)\n- Documentation updated with new ID format\n- Migration guide for v1.x β†’ v2.x\n\n## Timeline\nMedium-term (v1.1-v1.2), 2-3 weeks implementation\n\n## References\n- Related to bd-e6d71828 (immediate fix)\n- See beads_nway_test.go for failing N-way tests","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-10-29T10:22:52.260524-07:00","updated_at":"2025-11-08T01:58:15.281403-08:00","closed_at":"2025-11-08T00:36:58.134558-08:00","source_repo":"."} -{"id":"bd-9b13","content_hash":"9a17da93fb23cdcfcc294d2e7e00239973530ab8c5cc08f110112c9924ca94e1","title":"Backend task","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-03T19:11:59.359262-08:00","updated_at":"2025-11-05T00:25:06.484312-08:00","closed_at":"2025-11-05T00:25:06.484312-08:00","source_repo":".","labels":["backend","week1"]} -{"id":"bd-9bsx","content_hash":"f84ca8560b9f09a14af959b4f567647aec050faaa9348775aa08955d913fe9e1","title":"Recurring dirty state after merge conflicts - bd sync keeps failing","description":"## Problem\n\n`bd sync` consistently fails with merge conflicts in `.beads/beads.jsonl`, creating a loop:\n1. User runs `bd sync`\n2. Git merge conflict occurs\n3. User resolves with `git checkout --theirs` (takes remote)\n4. Daemon auto-exports database state (which has local changes)\n5. JSONL becomes dirty again immediately\n6. Repeat\n\nThis has been happening for **weeks** and is extremely frustrating.\n\n## Root Cause\n\nThe recommended conflict resolution (`git checkout --theirs`) throws away local database state (comments, dependencies, closed issues). The daemon then immediately re-exports, creating a dirty state.\n\n## Current Workaround\n\nManual `bd export -o .beads/beads.jsonl \u0026\u0026 git add \u0026\u0026 git commit \u0026\u0026 git push` after every failed sync.\n\n## Example Session\n\n```bash\n$ bd sync\nCONFLICT (content): Merge conflict in .beads/beads.jsonl\n\n$ git checkout --theirs .beads/beads.jsonl \u0026\u0026 bd import \u0026\u0026 git add \u0026\u0026 git commit \u0026\u0026 git push\n# Pushed successfully\n\n$ git status\nmodified: .beads/beads.jsonl # DIRTY AGAIN!\n```\n\n## Lost Data in Recent Session\n\n- bd-ry1u closure (lost in merge)\n- Comments on bd-08fd, bd-23a8, bd-6049, bd-87a0 (lost)\n- Dependencies that existed only in local DB\n\n## Potential Solutions\n\n1. **Use beads-merge tool** - Implement proper 3-way JSONL merge (bd-bzfy)\n2. **Smarter conflict resolution** - Detect when `--theirs` will lose data, warn user\n3. **Sync validation** - Check if JSONL == DB after merge, re-export if needed\n4. **Daemon awareness** - Pause auto-export during merge resolution\n5. **Transaction log** - Replay local changes after merge instead of losing them\n\n## Related Issues\n\n- bd-bzfy (beads-merge integration)\n- Possibly related to daemon auto-export behavior","notes":"## Solution Implemented\n\nFixed the recurring dirty state after merge conflicts by adding **sync validation** before re-exporting.\n\n### Root Cause\nLines 217-237 in `sync.go` unconditionally re-exported DB to JSONL after every import, even when they were already in sync. This created an infinite loop:\n1. User runs `bd sync` which pulls and imports remote JSONL\n2. Sync unconditionally re-exports DB (which has local changes)\n3. JSONL becomes dirty immediately\n4. Repeat\n\n### Fix\nAdded `dbNeedsExport()` function in `integrity.go` that checks:\n- If JSONL exists\n- If DB modification time is newer than JSONL\n- If DB and JSONL issue counts match\n\nNow `bd sync` only re-exports if DB actually has changes that differ from JSONL.\n\n### Changes\n- Added `dbNeedsExport()` in `cmd/bd/integrity.go` (lines 228-271)\n- Updated `sync.go` lines 217-251 to check before re-exporting\n- Added comprehensive tests in `cmd/bd/sync_merge_test.go`\n\n### Testing\nAll tests pass including 4 new tests:\n- `TestDBNeedsExport_InSync` - Verifies no export when synced\n- `TestDBNeedsExport_DBNewer` - Detects DB modifications\n- `TestDBNeedsExport_CountMismatch` - Catches divergence\n- `TestDBNeedsExport_NoJSONL` - Handles missing JSONL\n\nThis prevents the weeks-long frustration of merge conflicts causing infinite dirty loops.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-05T17:52:14.776063-08:00","updated_at":"2025-11-05T17:58:35.611942-08:00","closed_at":"2025-11-05T17:58:35.611942-08:00","source_repo":"."} -{"id":"bd-9cdc","content_hash":"8fcd4366fd76c0db14c73d0c2623abae40ad4c31a2ca663c15f8d3d52ee572d0","title":"Update docs for import bug fix","description":"Update AGENTS.md, README.md, TROUBLESHOOTING.md with import.orphan_handling config documentation. Document resurrection behavior, tombstones, config modes. Add troubleshooting section for import failures with deleted parents.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-04T12:32:30.770415-08:00","updated_at":"2025-11-04T12:32:30.770415-08:00","source_repo":"."} -{"id":"bd-9csf","content_hash":"4f9094d9a282f13854d2d4c7ff1e4c2feacf1f6ced575bfd2378724466e4d405","title":"Create store.go with Store struct and initialization logic","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:12.295554-08:00","updated_at":"2025-11-23T18:09:47.893126-08:00","closed_at":"2025-11-23T18:09:47.893126-08:00","source_repo":"."} -{"id":"bd-9e23","content_hash":"fa94af8126d5d8c816a6f83d5ad191ebdb954687abb87ce30e4f67eee4f1a9ce","title":"Optimize Memory backend GetIssueByExternalRef with index","description":"Currently GetIssueByExternalRef in Memory storage uses O(n) linear search through all issues.\n\nCurrent code (memory.go:282-308):\nfor _, issue := range m.issues {\n if issue.ExternalRef != nil \u0026\u0026 *issue.ExternalRef == externalRef {\n return \u0026issueCopy, nil\n }\n}\n\nProposed optimization:\n- Add externalRefToID map[string]string to MemoryStorage\n- Maintain it in CreateIssue, UpdateIssue, DeleteIssue\n- Achieve O(1) lookup like SQLite's index\n\nImpact: Low (--no-db mode typically has smaller datasets)\nRelated: bd-1022","status":"open","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:30.242357-08:00","updated_at":"2025-11-02T15:32:30.242357-08:00","source_repo":"."} -{"id":"bd-9e8d","content_hash":"bde8f3625189415e8f00b06acf530454bec619cabee1332132836d45b26771ed","title":"Test Issue","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:41:11.107393-07:00","updated_at":"2025-11-01T20:02:28.292279-07:00","closed_at":"2025-11-01T20:02:28.292279-07:00","source_repo":"."} -{"id":"bd-9f1fce5d","content_hash":"06b6c591090df9e565a67086b354875c5029fce5b60245bce97af7bd63d26166","title":"Add internal/ai package for LLM integration","description":"Shared AI client for repair commands.\n\nProviders:\n- Anthropic (Claude)\n- OpenAI (GPT)\n- Ollama (local)\n\nEnv vars:\n- BEADS_AI_PROVIDER\n- BEADS_AI_API_KEY\n- BEADS_AI_MODEL\n\nFiles: internal/ai/client.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T14:48:29.072473-07:00","updated_at":"2025-11-06T19:36:13.972045-08:00","closed_at":"2025-11-06T19:27:19.128093-08:00","source_repo":"."} -{"id":"bd-9f20","content_hash":"fd9e463ab1b81e62f5ae1441e8c3a661361031a30e6a95502152bb4d7eecf7b2","title":"DetectCycles SQL query has bug preventing cycle detection","description":"The DetectCycles function's SQL query has a bug in the LIKE filter that prevents it from detecting cycles.\n\nCurrent code (line 571):\n```sql\nAND p.path NOT LIKE '%' || d.depends_on_id || 'β†’%'\n```\n\nThis prevents ANY revisit to nodes, including returning to the start node to complete a cycle.\n\nFix:\n```sql\nAND (d.depends_on_id = p.start_id OR p.path NOT LIKE '%' || d.depends_on_id || 'β†’%')\n```\n\nThis allows revisiting the start node (to detect the cycle) while still preventing intermediate node revisits.\n\nImpact: Currently DetectCycles cannot detect any cycles, but this hasn't been noticed because AddDependency prevents cycles from being created. The function would only matter if cycles were manually inserted into the database.","status":"closed","priority":3,"issue_type":"bug","created_at":"2025-11-01T22:50:32.552763-07:00","updated_at":"2025-11-01T22:52:02.247443-07:00","closed_at":"2025-11-01T22:52:02.247443-07:00","source_repo":"."} -{"id":"bd-9f4a","content_hash":"f7fc76124f76636ef40af114a47509885fa9e5af9d2fddaf8820a46542086e42","title":"Document external_ref in content hash behavior","description":"The content hash includes external_ref, which has implications that should be documented.\n\nCurrent behavior:\n- external_ref is included in content hash calculation (collision.go:158-160)\n- Changing external_ref changes content hash\n- This means: local issue β†’ add external_ref β†’ different hash\n\nImplications:\n- Local issue + external_ref addition = looks like 'new content'\n- May not match by content hash in some scenarios\n- Generally correct behavior, but subtle\n\nAction items:\n- Document in code comments\n- Add to ARCHITECTURE.md or similar\n- Add test demonstrating this behavior\n- Consider if this is desired long-term\n\nRelated: bd-1022\nFiles: internal/storage/sqlite/collision.go:158-160","status":"closed","priority":4,"issue_type":"task","created_at":"2025-11-02T15:32:47.715458-08:00","updated_at":"2025-11-08T02:24:24.685778-08:00","closed_at":"2025-11-08T02:20:01.004638-08:00","source_repo":"."} -{"id":"bd-9f86-baseline-test","content_hash":"949195be1662e71536a1324027292b54f9379848b72baa51f5d7a31652ec0bde","title":"Baseline quality gate failure: test","description":"The test quality gate is failing on the baseline (main branch).\n\nThis blocks the executor from claiming work until fixed.\n\nError: go test failed: exit status 1\n\nOutput:\n```\n? \tgithub.com/steveyegge/beads\t[no test files]\n# github.com/steveyegge/beads/internal/beads_test [github.com/steveyegge/beads/internal/beads.test]\ninternal/beads/routing_integration_test.go:142:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\n# github.com/steveyegge/beads/internal/compact [github.com/steveyegge/beads/internal/compact.test]\ninternal/compact/compactor_test.go:17:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\n# github.com/steveyegge/beads/cmd/bd [github.com/steveyegge/beads/cmd/bd.test]\ncmd/bd/integrity_content_test.go:31:32: undefined: ctx\ncmd/bd/integrity_content_test.go:183:32: undefined: ctx\nFAIL\tgithub.com/steveyegge/beads/cmd/bd [build failed]\n# github.com/steveyegge/beads/internal/daemon [github.com/steveyegge/beads/internal/daemon.test]\ninternal/daemon/discovery_test.go:21:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/daemon/discovery_test.go:59:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/daemon/discovery_test.go:232:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\n# github.com/steveyegge/beads/internal/importer [github.com/steveyegge/beads/internal/importer.test]\ninternal/importer/external_ref_test.go:22:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/external_ref_test.go:106:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/external_ref_test.go:197:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/external_ref_test.go:295:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/importer_test.go:566:27: not enough arguments in call to sqlite.New\n\thave (st\n... (truncated, see full output in logs)\n```","notes":"Released by executor after budget limit hit. Tests were already fixed manually. Issue can be closed when tests are verified to pass.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:17:25.962406-05:00","updated_at":"2025-11-23T16:05:29.742436-08:00","closed_at":"2025-11-21T23:21:58.865069-08:00","source_repo":".","labels":["baseline-failure","gate:test","system"]} -{"id":"bd-9li4","content_hash":"7ae7b885e82a2de333584c01f690dbc3ecb924603f18e316f5c91cc44e2256f8","title":"Create Docker image for Agent Mail","description":"Containerize Agent Mail server for easy deployment.\n\nAcceptance Criteria:\n- Dockerfile with Python 3.14\n- Health check endpoint\n- Volume mount for storage\n- Environment variable configuration\n- Multi-arch builds (amd64, arm64)\n\nFile: deployment/agent-mail/Dockerfile","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.231964-08:00","updated_at":"2025-11-07T22:43:43.231964-08:00","source_repo":"."} -{"id":"bd-9msn","content_hash":"69ef2ebc5a847eb407c37e9039391d8ebc761a4cee3b60537de4f5a12011bec3","title":"Add monitoring and alerting","description":"Observability for production Agent Mail server.\n\nAcceptance Criteria:\n- Health check endpoint (/health)\n- Prometheus metrics export\n- Grafana dashboard\n- Alerts for server downtime\n- Alerts for high error rate\n- Log aggregation config\n\nFile: deployment/agent-mail/monitoring/","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.354117-08:00","updated_at":"2025-11-07T22:43:43.354117-08:00","source_repo":".","dependencies":[{"issue_id":"bd-9msn","depends_on_id":"bd-z3s3","type":"blocks","created_at":"2025-11-07T23:04:28.050074-08:00","created_by":"daemon"}]} -{"id":"bd-9nw","content_hash":"7b6ab49b7c23095220c0452b418cf94b230eaa3185b626b6eb9ec300b79eb27c","title":"Document sandbox workarounds for GH #353","description":"Add documentation for sandbox troubleshooting and new flags.\n\n**Tasks:**\n1. Create or update TROUBLESHOOTING.md with sandbox section\n2. Document new flags in CLI reference\n3. Add comment to GH #353 with immediate workarounds\n\n**Content needed:**\n- Symptoms of daemon lock issues in sandboxed environments\n- Usage guide for --sandbox, --force, and --allow-stale flags\n- Step-by-step troubleshooting for Codex users\n- Examples of each escape hatch\n\n**Files to update:**\n- docs/TROUBLESHOOTING.md (create if needed)\n- docs/CLI_REFERENCE.md or README.md\n- GitHub issue #353\n\n**References:**\n- docs/GH353_INVESTIGATION.md (lines 240-276)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T18:52:30.794526-05:00","updated_at":"2025-11-22T17:48:48.067269-08:00","closed_at":"2025-11-21T19:25:19.216834-05:00","source_repo":"."} -{"id":"bd-9rw1","content_hash":"17ad82d17e34ca2bfab2fa7240517520e3c42953a780282664f50cf038c97688","title":"Support P-prefix priority format (P0-P4) in create and update commands","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T13:56:04.796826-08:00","updated_at":"2025-11-05T13:56:08.157061-08:00","closed_at":"2025-11-05T13:56:08.157061-08:00","source_repo":"."} -{"id":"bd-9v7l","content_hash":"10b1c2ca4d67587bdf220cf7ae04253eb01edca8a59756431bc3d453cbb85008","title":"bd status \"Recent Activity\" is misleading - should use git history","description":"## Problem\n\n`bd status` shows \"Recent Activity (last 7 days)\" but the numbers are wrong. It only looks at database timestamps, not git history. Says \"141 issues closed in last 7 days\" when thousands have actually come and go.\n\n## Issues\n\n1. Only queries database timestamps, not git history\n2. 7 days is too long a window\n3. Numbers don't reflect actual activity in JSONL git history\n\n## Proposed Fix\n\nEither:\n- Query git history of `.beads/beads.jsonl` to get actual activity (last 24-48 hours)\n- Remove \"Recent Activity\" section entirely if not useful\n- Make time window configurable and default to 24h\n\n## Example Output (Current)\n```\nRecent Activity (last 7 days):\nIssues Created: 174\nIssues Closed: 141\nIssues Updated: 37\n```\nThis is misleading when thousands of issues have actually cycled through.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-05T01:03:00.234813-08:00","updated_at":"2025-11-06T18:47:42.682987-08:00","closed_at":"2025-11-06T18:47:42.682987-08:00","source_repo":"."} -{"id":"bd-a03d5e36","content_hash":"f63ec5a25a14c9b01ca8b97ea14d0b00c42e8d6fe3b39f6e261411134a024de8","title":"Improve integration test coverage for stateful features","description":"","design":"## Context\n\nbd-70419816 revealed a critical gap: the export deduplication feature had unit tests but no integration tests simulating real-world git operations. This led to silent data loss in production.\n\n## Root Cause\n- Unit tests only tested functions in isolation\n- No integration tests for git operations (pull, reset, checkout) modifying JSONL\n- No tests validating export_hashes and JSONL stay in sync\n- Missing tests for stateful distributed system interactions (DB + JSONL + git)\n\n## Completed (bd-70419816)\nβœ“ TestJSONLIntegrityValidation - unit tests for validation logic\nβœ“ TestImportClearsExportHashes - tests import clears hashes\nβœ“ TestExportIntegrityAfterJSONLTruncation - simulates git reset (would have caught bd-70419816)\nβœ“ TestExportIntegrityAfterJSONLDeletion - tests recovery from file deletion\nβœ“ TestMultipleExportsStayConsistent - tests repeated exports\n\n## Still Needed (High Priority)\n1. Multi-repo sync test - two clones staying in sync after push/pull\n2. Auto-flush integration test - JSONL integrity preserved during auto-flush\n3. Daemon auto-sync integration test - complex state management\n4. Import after corruption test - recovery from partial data loss\n\n## Medium Priority\n- Partial export failure handling (disk full, network interruption)\n- Concurrent export/import race conditions\n- Large dataset performance tests (1000+ issues)\n- Export hash migration tests (version upgrades)\n\n## Testing Principles\n1. Test real-world scenarios: git ops, user errors, system failures, concurrent ops\n2. Integration tests for stateful systems (DB + files + git)\n3. Regression test for every bug fix\n4. Test invariants: JSONL count == DB count, hash consistency, etc.\n\n## Key Lesson\nStateful distributed systems need integration tests, not just unit tests.","acceptance_criteria":"- [ ] Multi-repo sync test implemented\n- [ ] Auto-flush integration test implemented \n- [ ] Daemon auto-sync integration test implemented\n- [ ] Testing guidelines added to CONTRIBUTING.md\n- [ ] CI runs integration tests\n- [ ] All critical workflows have integration test coverage","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-29T21:53:15.397137-07:00","updated_at":"2025-11-08T01:58:15.281757-08:00","closed_at":"2025-11-08T00:36:59.02371-08:00","source_repo":"."} -{"id":"bd-a101","content_hash":"9c8ac3184d936a5483d307ea72e34fa6308e99416b27c930c1b7b05660173f47","title":"Support separate branch for beads commits","description":"Allow beads to commit to a separate branch (e.g., beads-metadata) using git worktrees to support protected main branch workflows.\n\nSolves GitHub Issue #205 - Users need to protect main branch while maintaining beads workflow.\n\nKey advantages:\n- Works on any git platform\n- Main branch stays protected \n- No disruption to user's working directory\n- Backward compatible (opt-in via config)\n- Minimal disk overhead (sparse checkout)\n\nTotal estimate: 17-24 days (4-6 weeks with parallel work)","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-02T15:21:20.098247-08:00","updated_at":"2025-11-04T12:36:53.772727-08:00","closed_at":"2025-11-04T12:36:53.772727-08:00","external_ref":"GH-205","source_repo":"."} -{"id":"bd-a1691807","content_hash":"52a3da17d0db9e7998b77b4962c00eeb866ca1eb3581d362863b68788b162582","title":"Integration test: mutation to export latency","description":"Measure time from bd create to JSONL update. Verify \u003c500ms latency. Test with multiple rapid mutations to verify batching.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.105247-07:00","updated_at":"2025-10-31T12:00:43.198883-07:00","closed_at":"2025-10-31T12:00:43.198883-07:00","source_repo":"."} -{"id":"bd-a40f374f","content_hash":"a9385e9f00bc41e5e2258fdfccd9f2cbd5a702764b5f1d036274e6026f8c3e38","title":"bd validate - Comprehensive health check","description":"Run all validation checks in one command.\n\nChecks:\n- Duplicates\n- Orphaned dependencies\n- Test pollution\n- Git conflicts\n\nSupports --fix-all for auto-repair.\n\nDepends on bd-cbed9619.1, bd-0dcea000, bd-31aab707, bd-9826b69a.\n\nFiles: cmd/bd/validate.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T12:40:11.708313-05:00","updated_at":"2025-11-20T12:40:11.708313-05:00","closed_at":"2025-10-29T20:02:15.318966-07:00","source_repo":"."} -{"id":"bd-a4b5","content_hash":"3966f6f9ab3202fe740f2936c7743f679ea42b75803c99465176ccf69ffd9dd7","title":"Implement git worktree management","description":"Create git worktree lifecycle management for separate beads branch.\n\nTasks:\n- Create internal/git/worktree.go\n- Implement CreateBeadsWorktree(branch, path)\n- Implement RemoveBeadsWorktree(path)\n- Implement CheckWorktreeHealth(path)\n- Configure sparse checkout (only .beads/)\n- Implement SyncJSONLToWorktree()\n- Handle worktree errors gracefully\n- Auto-cleanup on config change\n\nEstimated effort: 3-4 days","acceptance_criteria":"- Worktree created successfully on first use\n- Sparse checkout limits to .beads/ only\n- Health check detects and fixes broken worktrees\n- JSONL synced correctly before commits\n- Cleanup removes worktree completely","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.56423-08:00","updated_at":"2025-11-04T11:10:23.533053-08:00","closed_at":"2025-11-04T11:10:23.533055-08:00","source_repo":".","dependencies":[{"issue_id":"bd-a4b5","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.359843-08:00","created_by":"stevey"}]} -{"id":"bd-a5251b1a","content_hash":"71a54f24d3d1c9eba8bf185c273ab6624815eb1299a8718aa0199c97f518008c","title":"Test RPC mutation event","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T19:08:03.315443-07:00","updated_at":"2025-10-31T12:00:43.177494-07:00","closed_at":"2025-10-31T12:00:43.177494-07:00","source_repo":"."} -{"id":"bd-a557","content_hash":"35b394c75f08f60e3a8bf4cb5f837fd7644ae1bbc7a050d0f4b78d01c9e7a33e","title":"Issue 1 to reopen","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.753517-05:00","updated_at":"2025-11-20T19:43:48.753517-05:00","closed_at":"2025-11-07T21:57:59.910467-08:00","source_repo":"."} -{"id":"bd-a9699011","content_hash":"5c0f39c01f3aa92d6407ef3128f4c8acb44b177f55f5d3906b5e83af5c0a3472","title":"GH#146: No color showing in terminal for some users","description":"User reports color not working in macOS (Taho 26.0.1) with iTerm 3.6.4 and Terminal.app, despite color working elsewhere in terminal. Python rich and printf escape codes work.\n\nNeed to investigate:\n- Is NO_COLOR env var set?\n- Terminal type detection?\n- fatih/color library configuration\n- Does bd list show colors? bd ready? bd init?\n- What's the output of: echo $TERM, echo $NO_COLOR","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-24T22:26:36.22163-07:00","updated_at":"2025-11-08T01:58:15.282138-08:00","closed_at":"2025-11-08T00:54:40.47956-08:00","external_ref":"github:146","source_repo":"."} -{"id":"bd-ad5e","content_hash":"67fdba1ba5b838384b16b82ff45e200cb5fd4960795bb5ae29d6fdec549170ca","title":"Add AI planning docs management guidance to bd onboard (GH-196)","description":"Enhanced bd onboard command to provide guidance for managing AI-generated planning documents (Claude slop).\n\nAddresses GitHub issue #196: https://github.com/steveyegge/beads/issues/196\n\nChanges:\n- Added Managing AI-Generated Planning Documents section to bd onboard\n- Recommends using history/ directory for ephemeral planning files\n- Updated AGENTS.md to demonstrate the pattern\n- Added comprehensive tests\n\nCommit: d46177d","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-02T17:11:33.183636-08:00","updated_at":"2025-11-02T17:12:05.599633-08:00","closed_at":"2025-11-02T17:12:05.599633-08:00","source_repo":"."} -{"id":"bd-aewm","content_hash":"b9f0ebb0c99a35c39c918250a1220f74bfcd77905b85c66715b36d1df9c5ec4b","title":"bd-hv01: Missing cleanup of .merged temp file on failure","description":"Problem: deletion_tracking.go:49 creates tmpMerged file but does not clean up on failure, causing disk space leak and potential interference with subsequent syncs.\n\nFix: Add defer os.Remove(tmpMerged) after creating temp file path.\n\nFiles: cmd/bd/deletion_tracking.go:38-89","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-06T18:16:24.326719-08:00","updated_at":"2025-11-06T18:46:55.924379-08:00","closed_at":"2025-11-06T18:46:55.924379-08:00","source_repo":".","dependencies":[{"issue_id":"bd-aewm","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.061462-08:00","created_by":"daemon"}]} -{"id":"bd-ar2","content_hash":"1eade84a73d2791335e7422e4c7c2e1a0f5acae326f99991a755efa80528f471","title":"Code review follow-up for bd-dvd and bd-ymj fixes","description":"Track improvements and issues identified during code review of parent resurrection (bd-dvd) and export metadata (bd-ymj) bug fixes.\n\n## Context\nCode review identified several areas for improvement:\n- Code duplication in metadata updates\n- Missing multi-repo support\n- Test coverage gaps\n- Potential race conditions\n\n## Related Issues\nOriginal bugs fixed: bd-dvd, bd-ymj\n\n## Goals\n- Eliminate code duplication\n- Add multi-repo support where needed\n- Improve test coverage\n- Address edge cases","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-21T10:24:05.78635-05:00","updated_at":"2025-11-22T17:48:48.067797-08:00","closed_at":"2025-11-21T15:04:48.692231-05:00","source_repo":"."} -{"id":"bd-ar2.1","content_hash":"6e8a7bb1fe690bf7fb4c2383799f2c1ed2c27da25b6ddb0f430ce734e73736e1","title":"Extract duplicated metadata update code in daemon_sync.go","description":"## Problem\nThe same 22-line metadata update block appears identically in both:\n- createExportFunc (lines 309-328)\n- createSyncFunc (lines 520-539)\n\nThis violates DRY principle and makes maintenance harder.\n\n## Solution\nExtract to helper function:\n\n```go\n// updateExportMetadata updates last_import_hash and related metadata after a successful export.\n// This prevents \"JSONL content has changed since last import\" errors on subsequent exports (bd-ymj fix).\nfunc updateExportMetadata(ctx context.Context, store storage.Storage, jsonlPath string, log daemonLogger) {\n currentHash, err := computeJSONLHash(jsonlPath)\n if err != nil {\n log.log(\"Warning: failed to compute JSONL hash for metadata update: %v\", err)\n return\n }\n \n if err := store.SetMetadata(ctx, \"last_import_hash\", currentHash); err != nil {\n log.log(\"Warning: failed to update last_import_hash: %v\", err)\n }\n \n exportTime := time.Now().Format(time.RFC3339)\n if err := store.SetMetadata(ctx, \"last_import_time\", exportTime); err != nil {\n log.log(\"Warning: failed to update last_import_time: %v\", err)\n }\n \n // Store mtime for fast-path optimization\n if jsonlInfo, statErr := os.Stat(jsonlPath); statErr == nil {\n mtimeStr := fmt.Sprintf(\"%d\", jsonlInfo.ModTime().Unix())\n if err := store.SetMetadata(ctx, \"last_import_mtime\", mtimeStr); err != nil {\n log.log(\"Warning: failed to update last_import_mtime: %v\", err)\n }\n }\n}\n```\n\n## Files\n- cmd/bd/daemon_sync.go\n\n## Benefits\n- Easier maintenance\n- Single source of truth\n- Consistent behavior","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:24:18.888412-05:00","updated_at":"2025-11-21T19:15:00.119796-05:00","closed_at":"2025-11-21T10:47:24.430037-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.1","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:24:18.889171-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.10","content_hash":"950032536af657403eed822253edffb57f521af9807185c75e5c004964652272","title":"Fix hasJSONLChanged to support per-repo metadata keys","description":"## Problem\nAfter bd-ar2.2, we store metadata with per-repo keys like `last_import_hash:\u003cpath\u003e`, but `hasJSONLChanged` and `validatePreExport` still only check global keys.\n\n## Impact\n- Multi-repo mode won't benefit from bd-ymj fix\n- validatePreExport will fail incorrectly or pass incorrectly\n- Metadata updates are written but never read\n\n## Location\n- cmd/bd/integrity.go:97 (hasJSONLChanged)\n- cmd/bd/integrity.go:138 (validatePreExport)\n\n## Solution\nUpdate hasJSONLChanged to accept optional keySuffix parameter:\n```go\nfunc hasJSONLChanged(ctx context.Context, store storage.Storage, jsonlPath string, keySuffix string) bool {\n // Build metadata keys with optional suffix\n hashKey := \"last_import_hash\"\n mtimeKey := \"last_import_mtime\"\n if keySuffix != \"\" {\n hashKey += \":\" + keySuffix\n mtimeKey += \":\" + keySuffix\n }\n // ... rest of function\n}\n```\n\nUpdate all callers to pass correct keySuffix.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:58:20.969689-05:00","updated_at":"2025-11-21T11:25:23.421383-05:00","closed_at":"2025-11-21T11:25:23.421383-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.10","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:58:20.970624-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.11","content_hash":"bbdfbff107d36f7c4aaa33204d622c9de1a298f58d1c240471710fef8e04413a","title":"Use stable repo identifiers instead of full paths in metadata keys","description":"## Problem\nbd-ar2.2 uses full absolute paths as metadata key suffixes:\n```go\nupdateExportMetadata(exportCtx, store, path, log, path)\n// Creates: last_import_hash:/Users/stevey/src/cino/beads/repo1/.beads/issues.jsonl\n```\n\n## Issues\n1. Absolute paths differ across machines/clones\n2. Keys are very long\n3. If user moves repo or clones to different path, metadata becomes orphaned\n4. Metadata won't be portable across team members\n\n## Better Approach\nUse source_repo identifiers from multi-repo config (e.g., \".\", \"../frontend\"):\n```go\n// Get mapping of jsonl_path -\u003e source_repo identifier\nfor _, path := range multiRepoPaths {\n repoKey := getRepoKeyForPath(path) // e.g., \".\", \"../frontend\"\n updateExportMetadata(exportCtx, store, path, log, repoKey)\n}\n```\n\nThis creates stable keys like:\n- `last_import_hash:.`\n- `last_import_hash:../frontend`\n\n## Related\nDepends on bd-ar2.10 (hasJSONLChanged update)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:58:34.368544-05:00","updated_at":"2025-11-21T11:25:23.434129-05:00","closed_at":"2025-11-21T11:25:23.434129-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.11","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:58:34.370273-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.12","content_hash":"06f81953dbd74e8fc2d935a3de5c01c67715e672f53491900a368829a1aede95","title":"Add validation and documentation for metadata key format","description":"## Issues\n\n### 1. No validation that keySuffix doesn't contain separator\n```go\nif keySuffix != \"\" {\n hashKey += \":\" + keySuffix // ❌ What if keySuffix contains \":\"?\n}\n```\n\nAdd validation:\n```go\nif strings.Contains(keySuffix, \":\") {\n return fmt.Errorf(\"keySuffix cannot contain ':' separator\")\n}\n```\n\n### 2. Inconsistent keySuffix semantics\nEmpty string means \"global\", non-empty means \"scoped\". Better to always pass explicit key:\n```go\nconst (\n SingleRepoKey = \".\"\n // Multi-repo uses source_repo identifier\n)\n```\n\n### 3. Metadata key format not documented\nNeed to document:\n- `last_import_hash` - single-repo mode\n- `last_import_hash:\u003crepo_key\u003e` - multi-repo mode\n- `last_import_time` - when last import occurred\n- `last_import_mtime` - fast-path optimization\n\nAdd to internal/storage/sqlite/schema.go or docs/","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:59:13.54833-05:00","updated_at":"2025-11-21T11:40:47.687331-05:00","closed_at":"2025-11-21T11:40:47.687331-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.12","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:59:13.550475-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.2","content_hash":"c4dee35a25421d4058d5debd5bd83914b134ebdea5faa4b6a63852d0d82b7ae4","title":"Add multi-repo support to export metadata updates","description":"## Problem\nThe bd-ymj fix only updates metadata for the main jsonlPath, but the codebase supports multi-repo mode where exports write to multiple JSONL files.\n\nOther daemon_sync operations handle multi-repo correctly:\n- Lines 509-518: Snapshots captured for all multi-repo paths\n- Lines 578-587: Deletions applied for all multi-repo paths\n\nBut metadata updates are missing!\n\n## Investigation Needed\nMetadata is stored globally in database (`last_import_hash`, `last_import_mtime`), but multi-repo has per-repo JSONL files. Current schema may not support tracking multiple JSONL files.\n\nOptions:\n1. Store metadata per-repo (new schema)\n2. Store combined hash of all repos\n3. Document that multi-repo doesn't need this metadata (why?)\n\n## Solution (if needed)\n```go\n// After export\nif multiRepoPaths := getMultiRepoJSONLPaths(); multiRepoPaths != nil {\n // Multi-repo mode: update metadata for each JSONL\n for _, path := range multiRepoPaths {\n updateExportMetadata(exportCtx, store, path, log)\n }\n} else {\n // Single-repo mode: update metadata for main JSONL\n updateExportMetadata(exportCtx, store, jsonlPath, log)\n}\n```\n\n## Files\n- cmd/bd/daemon_sync.go (createExportFunc, createSyncFunc)\n- Possibly: internal/storage/sqlite/metadata.go (schema changes)\n\n## Related\nDepends on bd-ar2.1 (extract helper function first)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:24:32.482102-05:00","updated_at":"2025-11-22T17:48:48.068263-08:00","closed_at":"2025-11-21T11:07:17.124957-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.2","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:24:32.482559-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.3","content_hash":"143dac2e836dcf93264d5654d2d9aa0960777d186c0fea1b146c21158a002234","title":"Fix TestExportUpdatesMetadata to test actual daemon functions","description":"## Problem\nTestExportUpdatesMetadata (daemon_sync_test.go:296) manually replicates the metadata update logic rather than calling the fixed functions (createExportFunc/createSyncFunc).\n\nThis means:\n- Test verifies the CONCEPT works\n- But doesn't verify the IMPLEMENTATION in the actual daemon functions\n- If daemon code is wrong, test still passes\n\n## Current Test Flow\n```go\n// Test does:\nexportToJSONLWithStore() // ← Direct call\n// ... manual metadata update ...\nexportToJSONLWithStore() // ← Direct call again\n```\n\n## Should Be\n```go\n// Test should:\ncreateExportFunc(...)() // ← Call actual daemon function\n// ... verify metadata was updated by the function ...\ncreateExportFunc(...)() // ← Call again, should not fail\n```\n\n## Challenge\ncreateExportFunc returns a closure that's run by the daemon. Testing this requires:\n- Mock logger\n- Proper context setup\n- Git operations might need mocking\n\n## Files\n- cmd/bd/daemon_sync_test.go\n\n## Acceptance Criteria\n- Test calls actual createExportFunc and createSyncFunc\n- Test verifies metadata updated by daemon code, not test code\n- Both functions tested (export and sync)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:24:46.756315-05:00","updated_at":"2025-11-22T17:48:48.068767-08:00","closed_at":"2025-11-21T11:07:25.321289-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.3","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:24:46.757622-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.4","content_hash":"2fe8e7ac1334017eabaeb7a906f632d112b3040bb2f618c9cabc00311e7d2886","title":"Use TryResurrectParentChain instead of TryResurrectParent in GetNextChildID","description":"## Context\nCurrent bd-dvd fix uses TryResurrectParent, which only resurrects the immediate parent. For deeply nested hierarchies, this might not be sufficient.\n\n## Example Scenario\nCreating child with parent \"bd-abc.1.2\" where:\n- bd-abc exists in DB\n- bd-abc.1 was deleted (missing from DB, exists in JSONL)\n- bd-abc.1.2 was deleted (missing from DB, exists in JSONL)\n\nCurrent fix: Only tries to resurrect \"bd-abc.1.2\", fails because its parent \"bd-abc.1\" is missing.\n\n## Solution\nReplace TryResurrectParent with TryResurrectParentChain:\n\n```go\nif count == 0 {\n // Try to resurrect entire parent chain from JSONL history (bd-dvd fix)\n // This handles deeply nested hierarchies where intermediate parents are also missing\n resurrected, err := s.TryResurrectParentChain(ctx, parentID)\n if err != nil {\n return \"\", fmt.Errorf(\"failed to resurrect parent chain for %s: %w\", parentID, err)\n }\n if !resurrected {\n return \"\", fmt.Errorf(\"parent issue %s does not exist and could not be resurrected from JSONL history\", parentID)\n }\n}\n```\n\n## Investigation\n- Check if this scenario actually happens in practice\n- TryResurrectParentChain already exists (resurrection.go:174-209)\n- May be overkill if users always create parents before children\n\n## Files\n- internal/storage/sqlite/hash_ids.go\n\n## Testing\nAdd test case for deeply nested resurrection","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:01.376071-05:00","updated_at":"2025-11-22T17:48:48.069262-08:00","closed_at":"2025-11-21T11:40:47.682699-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.4","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:01.376561-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.5","content_hash":"16ae300a7e23d596aef9cb39d131e252556905c04ebc2fdaca2a295256ea1191","title":"Add error handling guidance for export metadata update failures","description":"## Problem\nThe bd-ymj fix treats all metadata update failures as warnings:\n\n```go\nif err := store.SetMetadata(ctx, \"last_import_hash\", currentHash); err != nil {\n log.log(\"Warning: failed to update last_import_hash: %v\", err)\n}\n```\n\nBut if metadata updates fail, the NEXT export will fail with \"JSONL content has changed since last import\".\n\n## Questions\n1. Should metadata failures be critical (return error)?\n2. Should we implement retry logic?\n3. Is warning acceptable (safe, just requires import before next export)?\n\n## Current Behavior\n- Metadata failure is silent (only logged)\n- User won't know until next export fails\n- Next export requires import first (safe but annoying)\n\n## Recommendation\nAdd clear comment explaining the trade-off:\n\n```go\n// Note: Metadata update failures are treated as warnings, not errors.\n// This is acceptable because the worst case is the next export will\n// require an import first, which is safe and prevents data loss.\n// Alternative: Make this critical and fail the export if metadata\n// updates fail (but this makes exports more fragile).\nif err := store.SetMetadata(ctx, \"last_import_hash\", currentHash); err != nil {\n log.log(\"Warning: failed to update last_import_hash: %v\", err)\n log.log(\"Next export may require running 'bd import' first\")\n}\n```\n\n## Files\n- cmd/bd/daemon_sync.go\n\n## Decision Needed\nChoose approach based on failure mode preferences","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:16.52788-05:00","updated_at":"2025-11-22T17:48:48.06977-08:00","closed_at":"2025-11-21T11:40:47.684741-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.5","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:16.528351-05:00","created_by":"daemon"}],"comments":[{"id":30,"issue_id":"bd-ar2.5","author":"stevey","text":"## Code Review Finding (bd-ar2.1 implementation)\n\nThe extracted `updateExportMetadata` function doesn't return errors, making it impossible for callers to detect failures:\n\n```go\nfunc updateExportMetadata(ctx context.Context, store storage.Storage, jsonlPath string, log daemonLogger, keySuffix string) {\n currentHash, err := computeJSONLHash(jsonlPath)\n if err != nil {\n log.log(\"Warning: failed to compute JSONL hash for metadata update: %v\", err)\n return // ❌ Silent failure\n }\n // ...\n}\n```\n\nConsider returning errors so callers can decide how to handle them:\n```go\nfunc updateExportMetadata(...) error {\n // ... return errors\n}\n\n// Caller decides:\nif err := updateExportMetadata(...); err != nil {\n log.log(\"Warning: metadata update failed: %v\", err)\n log.log(\"Next export may require import first\")\n // Don't fail the export, just log\n}\n```","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-ar2.6","content_hash":"f39ade8d1ce69a8a0bc4dd993c85e767053af140e86e761d648cefc0a0732e8e","title":"Add transaction boundaries for export metadata updates","description":"## Problem\nMetadata updates happen after export, but there's no transaction ensuring atomicity between:\n1. JSONL file write (exportToJSONLWithStore)\n2. Metadata update (updateExportMetadata)\n3. Database mtime update (TouchDatabaseFile)\n\nIf process crashes between these steps, metadata will be inconsistent.\n\n## Example Failure Scenario\n```\n1. Export to JSONL succeeds\n2. [CRASH] Process killed before metadata update\n3. Next export: \"JSONL content has changed\" error\n4. User must run import to fix metadata\n```\n\n## Options\n\n### Option 1: Tolerate Inconsistency (Current)\n- Simple, no code changes\n- Safe (worst case: need import before next export)\n- Annoying for users if crashes are frequent\n\n### Option 2: Add Write-Ahead Log\n- Write metadata intent to temp file\n- Complete operations\n- Clean up temp file\n- More complex, better guarantees\n\n### Option 3: Store Metadata in JSONL Comments\n- Add metadata as JSON comment in JSONL file\n- Single atomic write\n- Requires JSONL format change\n\n### Option 4: Defensive Checks\n- On startup, verify metadata matches JSONL\n- Auto-fix if mismatch detected\n- Simplest improvement\n\n## Recommendation\nStart with Option 4 (defensive checks), consider others if needed.\n\n## Files\n- cmd/bd/daemon_sync.go\n- Possibly: cmd/bd/main.go (startup checks)\n\n## Related\nThis is lower priority - current behavior is safe, just not ideal","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:32.469469-05:00","updated_at":"2025-11-22T17:48:48.07026-08:00","closed_at":"2025-11-21T11:40:47.685571-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.6","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:32.470004-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.7","content_hash":"26c901628d9d4119e87337b434d5127686a0acda9442348c1feacfd864e5f792","title":"Add edge case tests for GetNextChildID parent resurrection","description":"## Current Coverage\nTestGetNextChildID_ResurrectParent tests happy path only:\n- Parent exists in JSONL\n- Resurrection succeeds\n\n## Missing Test Cases\n\n### 1. Parent Not in JSONL\n- Parent doesn't exist in DB\n- Parent doesn't exist in JSONL either\n- Should return: \"could not be resurrected from JSONL history\"\n\n### 2. JSONL File Missing\n- Parent doesn't exist in DB\n- No issues.jsonl file exists\n- Should handle gracefully\n\n### 3. Malformed JSONL\n- Parent doesn't exist in DB\n- JSONL file exists but has invalid JSON\n- Should skip bad lines, continue searching\n\n### 4. Concurrent Resurrections\n- Multiple goroutines call GetNextChildID with same parent\n- Only one should resurrect, others should succeed\n- Test for race conditions\n\n### 5. Deeply Nested Missing Parents\n- Creating bd-abc.1.2.1 where:\n - bd-abc exists\n - bd-abc.1 missing (should fail with current fix)\n- Related to bd-ar2.4\n\n### 6. Content Hash Mismatch\n- Parent in JSONL has different content_hash than expected\n- Should still resurrect (content_hash is for integrity, not identity)\n\n## Files\n- internal/storage/sqlite/child_id_test.go\n\n## Implementation\n```go\nfunc TestGetNextChildID_ResurrectParent_NotInJSONL(t *testing.T) { ... }\nfunc TestGetNextChildID_ResurrectParent_NoJSONL(t *testing.T) { ... }\nfunc TestGetNextChildID_ResurrectParent_MalformedJSONL(t *testing.T) { ... }\nfunc TestGetNextChildID_ResurrectParent_Concurrent(t *testing.T) { ... }\n```","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:25:46.661849-05:00","updated_at":"2025-11-22T17:48:48.070745-08:00","closed_at":"2025-11-21T11:40:47.686231-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.7","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:46.66235-05:00","created_by":"daemon"}]} -{"id":"bd-ar2.8","content_hash":"b240e0021797bf78b279a92177b2562e5f85514ae35bdb843bffdfc687cad145","title":"Add edge case tests for export metadata updates","description":"## Current Coverage\nTestExportUpdatesMetadata tests basic happy path only.\n\n## Missing Test Cases\n\n### 1. Multi-Repo Mode\n- Export with multi-repo configuration\n- Verify metadata updated for ALL JSONL files\n- Critical gap (related to bd-ar2.2)\n\n### 2. computeJSONLHash Failure\n- JSONL file deleted/inaccessible after export\n- Should log warning, not crash\n- Verify behavior on next export\n\n### 3. SetMetadata Failures\n- Database write-protected\n- Disk full\n- Should log warnings, continue\n\n### 4. os.Stat Failure\n- JSONL file deleted after export, before stat\n- Should handle gracefully (mtime just not updated)\n\n### 5. Concurrent Exports\n- Two daemon instances export simultaneously\n- Verify metadata doesn't get corrupted\n- Race condition test\n\n### 6. Clock Skew\n- System time goes backward between exports\n- Verify mtime handling still works\n\n### 7. Partial Export Failure\n- Multi-repo mode: some exports succeed, some fail\n- What metadata should be updated?\n\n### 8. Large JSONL Files\n- Performance test with large files (10k+ issues)\n- Verify hash computation doesn't timeout\n\n## Files\n- cmd/bd/daemon_sync_test.go\n\n## Implementation Priority\n1. Multi-repo test (P1 - related to critical issue)\n2. Failure handling tests (P2)\n3. Performance/edge cases (P3)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:25:59.526543-05:00","updated_at":"2025-11-22T17:48:48.071281-08:00","closed_at":"2025-11-21T14:39:53.143561-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.8","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:59.527032-05:00","created_by":"daemon"}],"comments":[{"id":31,"issue_id":"bd-ar2.8","author":"stevey","text":"## Code Review Finding (bd-ar2.3 implementation)\n\nTestUpdateExportMetadataMultiRepo tests the helper function in isolation, but doesn't verify that createExportFunc/createSyncFunc actually call it correctly in multi-repo mode.\n\nNeed integration test that:\n1. Sets up multi-repo config\n2. Creates issues in different repos\n3. Calls createExportFunc (or full daemon flow)\n4. Verifies metadata updated for ALL repos\n5. Verifies validatePreExport passes on subsequent export\n\nChallenge: These functions have complex dependencies (git, locks, etc.) so testing requires mocking or test harness.","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-ar2.9","content_hash":"d7b949abf252bdf02a64e5a9fc579e650b6fcfb7fff91f2bbfd9588783818187","title":"Fix variable shadowing in GetNextChildID resurrection code","description":"## Problem\nMinor variable shadowing in hash_ids.go:\n\n```go\n// Line 33: err declared here\nerr := s.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM issues WHERE id = ?`, parentID).Scan(\u0026count)\n\n// Line 38: err reused/shadowed here\nresurrected, err := s.TryResurrectParent(ctx, parentID)\n```\n\nWhile Go allows this, it can be confusing and some linters flag it.\n\n## Solution\nUse different variable name:\n\n```go\nresurrected, resurrectErr := s.TryResurrectParent(ctx, parentID)\nif resurrectErr != nil {\n return \"\", fmt.Errorf(\"failed to resurrect parent %s: %w\", parentID, resurrectErr)\n}\n```\n\n## Files\n- internal/storage/sqlite/hash_ids.go:38\n\n## Priority\nLow - code works correctly, just a style improvement","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:26:09.734162-05:00","updated_at":"2025-11-22T17:48:48.071927-08:00","closed_at":"2025-11-21T11:25:23.408878-05:00","source_repo":".","dependencies":[{"issue_id":"bd-ar2.9","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:26:09.734618-05:00","created_by":"daemon"}]} -{"id":"bd-au0","content_hash":"755c63ab5b27bc77ee20034d16cc63614a0b3f10a81728f1bde5503cf6615813","title":"Command Set Standardization \u0026 Flag Consistency","description":"Comprehensive improvements to bd command set based on 2025 audit findings.\n\n## Background\nSee docs/command-audit-2025.md for detailed analysis.\n\n## Goals\n1. Standardize flag naming and behavior across all commands\n2. Add missing flags for feature parity\n3. Fix naming confusion\n4. Improve consistency in JSON output\n\n## Success Criteria\n- All mutating commands support --dry-run (no --preview variants)\n- bd update supports label operations\n- bd search has filter parity with bd list\n- Priority flags accept both int and P0-P4 format everywhere\n- JSON output is consistent across all commands","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-21T21:05:55.672749-05:00","updated_at":"2025-11-21T21:05:55.672749-05:00","source_repo":"."} -{"id":"bd-au0.1","content_hash":"c125f8efd60c701e268bdb0c06a472b5ce3c9bdcf9af5d973ec3437ec4200e46","title":"Standardize --dry-run flag across all commands","description":"Replace all instances of --preview with --dry-run for consistency.\n\n**Commands to update:**\n- clean: Change --preview to --dry-run\n\n**Commands to verify:**\n- cleanup, compact, delete, duplicates, epic close-eligible, import, sync\n\n**Testing:**\n- Ensure all mutating commands support --dry-run\n- Verify backward compatibility (deprecation warning for --preview?)\n- Update tests and documentation","notes":"All commands already use --dry-run consistently. Verified:\n- cleanup: line 130\n- compact: line 873\n- delete: line 559\n- duplicates: line 158\n- import: line 703\n- sync: line 333\n- epic close-eligible: line 208\n- clean: line 162\n\nNo --preview flags found in the codebase. This task appears to have been completed before the epic was created.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-21T21:06:09.6033-05:00","updated_at":"2025-11-21T21:28:29.836473-05:00","closed_at":"2025-11-21T21:28:29.836473-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.1","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:09.603828-05:00","created_by":"daemon"}]} -{"id":"bd-au0.10","content_hash":"50d18ebce621f3e83c512a74dcb66d98a6d7f67d6632d872a4278f0e46e4bb7a","title":"Add global verbosity flags (--verbose, --quiet)","description":"Add consistent verbosity controls across all commands.\n\n**Current state:**\n- bd init has --quiet flag\n- No other commands have verbosity controls\n- Debug output controlled by BD_VERBOSE env var\n\n**Proposal:**\nAdd persistent flags:\n- --verbose / -v: Enable debug output\n- --quiet / -q: Suppress non-essential output\n\n**Implementation:**\n- Add to rootCmd.PersistentFlags()\n- Replace BD_VERBOSE checks with flag checks\n- Standardize output levels:\n * Quiet: Errors only\n * Normal: Errors + success messages\n * Verbose: Errors + success + debug info\n\n**Files to modify:**\n- cmd/bd/main.go (add flags)\n- internal/debug/debug.go (respect flags)\n- Update all commands to respect quiet mode\n\n**Testing:**\n- Verify --verbose shows debug output\n- Verify --quiet suppresses normal output\n- Ensure errors always show regardless of mode","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-21T21:08:21.600209-05:00","updated_at":"2025-11-21T21:08:21.600209-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.10","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:08:21.602557-05:00","created_by":"daemon"}]} -{"id":"bd-au0.2","content_hash":"a2fcaf0cc3764b792cf4a7deccf6e7f38f9ea3ff91adda246c7b7da704ac9be4","title":"Add label operations to bd update command","description":"Add --add-label and --remove-label flags to bd update.\n\n**Implementation:**\n- Add flags: --add-label, --remove-label, --set-labels\n- Support multiple labels (repeatable flags)\n- Test with daemon and direct mode\n\n**Files to modify:**\n- cmd/bd/show.go (updateCmd definition)\n- Add RPC support in internal/rpc/protocol.go and server\n\n**Testing:**\n- Add/remove single label\n- Add/remove multiple labels\n- Set labels (replace all)\n- JSON output\n- Daemon mode vs direct mode","notes":"Architecture review complete:\n- Current: separate 'bd label add/remove' commands exist\n- UpdateArgs struct in protocol.go needs new fields: AddLabels, RemoveLabels, SetLabels\n- RPC server needs label operation support in Update handler\n- CLI flags needed: --add-label, --remove-label, --set-labels (repeatable)\n- Both daemon and direct mode need implementation\n- Tests needed for all modes\n\nThis is a moderate-sized feature requiring changes across:\n1. cmd/bd/show.go (updateCmd flags and logic)\n2. internal/rpc/protocol.go (UpdateArgs struct)\n3. internal/rpc/server_issues_epics.go (Update handler)\n4. Tests for daemon/direct modes","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-21T21:06:23.715557-05:00","updated_at":"2025-11-21T22:15:19.213541-05:00","closed_at":"2025-11-21T22:15:19.213543-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.2","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:23.716044-05:00","created_by":"daemon"}]} -{"id":"bd-au0.3","content_hash":"51c9568427922dc2d497ebe32b9a57f7db0177ca760609078049c2b2bd72efec","title":"Fix --title vs --title-contains redundancy in bd list","description":"Clarify or consolidate --title and --title-contains flags in bd list command.\n\n**Analysis needed:**\n- Determine if these serve different purposes\n- Check actual implementation in cmd/bd/list.go\n- Review user expectations\n\n**Options:**\n1. Keep both if they have semantic difference (exact vs substring)\n2. Make one an alias of the other\n3. Remove --title-contains if truly redundant\n\n**Testing:**\n- Verify current behavior\n- Update documentation\n- Add tests for chosen approach","notes":"Investigation complete:\n\n--title and --title-contains serve DIFFERENT purposes:\n- --title: Maps to Query field (searches title, description, AND ID) - line 226\n- --title-contains: Maps to TitleContains field (searches title ONLY) - line 233\n\nThese are NOT redundant. The flag names are confusing:\n- --title is actually a general search\n- --title-contains is title-specific\n\nRECOMMENDATION: Rename --title to --query or --search for clarity\n- More intuitive: 'bd list --query foo' vs 'bd list --title foo'\n- Makes it clear it searches multiple fields\n- --title-contains remains for title-only searches\n\nAlternative: Keep as-is but improve documentation to clarify the difference.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-21T21:06:37.597079-05:00","updated_at":"2025-11-21T21:31:53.446905-05:00","closed_at":"2025-11-21T21:31:53.446905-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.3","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:37.597595-05:00","created_by":"daemon"}]} -{"id":"bd-au0.4","content_hash":"711036fe826d16c2c094bb1eb4978ed0ccb596aadc8a4d78550e3089ffc45922","title":"Standardize priority flag parsing across all commands","description":"Accept both integer (0-4) and P0-P4 format in all commands.\n\n**Commands to update:**\n- bd create: Currently accepts both βœ“\n- bd update: Currently accepts both βœ“\n- bd list: Only accepts int\n- bd search: Add priority filter (missing entirely)\n\n**Implementation:**\n- Create shared priority parsing function\n- Support both formats: '0', '1', 'P0', 'P1', etc.\n- Case-insensitive ('p0', 'P0')\n\n**Files to modify:**\n- cmd/bd/list.go\n- cmd/bd/search.go\n- Add utility function in internal/util/ or internal/types/","notes":"Implementation complete!\n\nChanges made to cmd/bd/list.go:\n1. Added validation import\n2. Changed priority flag from IntP to registerPriorityFlag (line 428)\n3. Changed priority-min/max from Int to String (lines 459-460)\n4. Updated priority parsing to use ValidatePriority (lines 90-97, 230-237)\n5. Updated priority-min/max parsing to use ValidatePriority (lines 195-210)\n\nTesting verified:\nβœ“ bd list -p P0 works\nβœ“ bd list -p 0 works \nβœ“ bd list --priority-min P1 --priority-max P2 works\nβœ“ bd list --priority-min 1 --priority-max 2 works\nβœ“ Invalid priorities rejected with clear error messages\nβœ“ All tests pass\n\nBoth integer (0-4) and P-format (P0-P4) now work consistently across all priority flags in bd list.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-21T21:06:51.741518-05:00","updated_at":"2025-11-21T21:56:50.522813-05:00","closed_at":"2025-11-21T21:56:50.522813-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.4","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:51.743218-05:00","created_by":"daemon"}]} -{"id":"bd-au0.5","content_hash":"add9038348d0512c29c42aaec387bee31f0657a5271fb10542fccd6f906d2339","title":"Add date and priority filters to bd search","description":"Add filter parity with bd list for consistent querying.\n\n**Missing filters to add:**\n- --priority, --priority-min, --priority-max\n- --created-after, --created-before\n- --updated-after, --updated-before\n- --closed-after, --closed-before\n- --empty-description, --no-assignee, --no-labels\n- --desc-contains, --notes-contains\n\n**Files to modify:**\n- cmd/bd/search.go\n- internal/rpc/protocol.go (SearchArgs)\n- internal/storage/storage.go (Search method)\n\n**Testing:**\n- All filter combinations\n- Date format parsing\n- Daemon and direct mode","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T21:07:05.496726-05:00","updated_at":"2025-11-21T21:07:05.496726-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.5","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:05.497762-05:00","created_by":"daemon"}]} -{"id":"bd-au0.6","content_hash":"90eda170769f9e2355b4e86c0a072ea8f6a2ca46c20d14db410b0a9b2e2049e7","title":"Add comprehensive filters to bd export","description":"Enhance bd export with filtering options for selective exports.\n\n**Currently only has:**\n- --status\n\n**Add filters:**\n- --label, --label-any\n- --assignee\n- --type\n- --priority, --priority-min, --priority-max\n- --created-after, --created-before\n- --updated-after, --updated-before\n\n**Use case:**\n- Export only open issues: bd export --status open\n- Export high-priority bugs: bd export --type bug --priority-max 1\n- Export recent issues: bd export --created-after 2025-01-01\n\n**Files to modify:**\n- cmd/bd/export.go\n- Reuse filter logic from list.go","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T21:07:19.431307-05:00","updated_at":"2025-11-21T21:07:19.431307-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.6","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:19.432983-05:00","created_by":"daemon"}]} -{"id":"bd-au0.7","content_hash":"38cf025be27a35266601cc65faa97464ec05db76591388d55372c1ec6d26c68a","title":"Audit and standardize JSON output across all commands","description":"Ensure consistent JSON format and error handling when --json flag is used.\n\n**Scope:**\n1. Verify all commands respect --json flag\n2. Standardize success response format\n3. Standardize error response format\n4. Document JSON schemas\n\n**Commands to audit:**\n- Core CRUD: create, update, delete, show, list, search βœ“\n- Queries: ready, blocked, stale, count, stats, status\n- Deps: dep add/remove/tree/cycles\n- Labels: label commands\n- Comments: comments add/list/delete\n- Epics: epic status/close-eligible\n- Export/import: already support --json βœ“\n\n**Testing:**\n- Success cases return valid JSON\n- Error cases return valid JSON (not plain text)\n- Consistent field naming (snake_case vs camelCase)\n- Array vs object wrapping consistency","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T21:07:35.304424-05:00","updated_at":"2025-11-21T21:07:35.304424-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.7","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:35.305663-05:00","created_by":"daemon"}]} -{"id":"bd-au0.8","content_hash":"3a2fa758b811136e939b5cbb12041106901daab5251effed7ed6f4a6078babd2","title":"Improve clean vs cleanup command naming/documentation","description":"Clarify the difference between bd clean and bd cleanup to reduce user confusion.\n\n**Current state:**\n- bd clean: Remove temporary artifacts (.beads/bd.sock, logs, etc.)\n- bd cleanup: Delete old closed issues from database\n\n**Options:**\n1. Rename for clarity:\n - bd clean β†’ bd clean-temp\n - bd cleanup β†’ bd cleanup-issues\n \n2. Keep names but improve help text and documentation\n\n3. Add prominent warnings in help output\n\n**Preferred approach:** Option 2 (improve documentation)\n- Update short/long descriptions in commands\n- Add examples to help text\n- Update README.md\n- Add cross-references in help output\n\n**Files to modify:**\n- cmd/bd/clean.go\n- cmd/bd/cleanup.go\n- README.md or ADVANCED.md","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-21T21:07:49.960534-05:00","updated_at":"2025-11-21T21:07:49.960534-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.8","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:49.962743-05:00","created_by":"daemon"}]} -{"id":"bd-au0.9","content_hash":"825794959c7b81e7d19cc6028b7d098c707627319b9c53a2477e062ced1d03f4","title":"Review and document rarely-used commands","description":"Document use cases or consider deprecation for infrequently-used commands.\n\n**Commands to review:**\n1. bd rename-prefix - How often is this used? Document use cases\n2. bd detect-pollution - Consider integrating into bd validate\n3. bd migrate-hash-ids - One-time migration, keep but document as legacy\n\n**For each command:**\n- Document typical use cases\n- Add examples to help text\n- Consider if it should be a subcommand instead\n- Add deprecation warning if appropriate\n\n**Not changing:**\n- duplicates βœ“ (useful for data quality)\n- repair-deps βœ“ (useful for fixing broken refs)\n- restore βœ“ (critical for compacted issues)\n- compact βœ“ (performance feature)\n\n**Deliverable:**\n- Updated help text\n- Documentation in ADVANCED.md\n- Deprecation plan if needed","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-21T21:08:05.588275-05:00","updated_at":"2025-11-21T21:08:05.588275-05:00","source_repo":".","dependencies":[{"issue_id":"bd-au0.9","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:08:05.59003-05:00","created_by":"daemon"}]} -{"id":"bd-auf1","content_hash":"68ddc54d14d231775a25f6786b927c44719435cf6af2859592bcca6b55396533","title":"Clean up snapshot files after successful merge","description":"After a successful 3-way merge and import during 'bd sync', the snapshot files (beads.base.jsonl, beads.left.jsonl, and their .meta.json files) are left in the .beads/ directory indefinitely.\n\nThese files are only needed temporarily during the merge process:\n- beads.base.jsonl: snapshot from last successful import\n- beads.left.jsonl: snapshot before git pull\n\nOnce the merge succeeds and the new JSONL is imported, these files serve no purpose and should be cleaned up.\n\nCurrent behavior:\n- sync.go:269 calls updateBaseSnapshot() after successful import\n- UpdateBase() updates beads.base.jsonl to the new state\n- beads.left.jsonl is never removed\n- Both files accumulate in .beads/ directory\n\nExpected behavior:\n- After successful merge and import, clean up both snapshot files\n- Only retain snapshots between sync operations (create on export, use during merge, clean up after import)\n\nThe cleanup logic exists (SnapshotManager.Cleanup()) but is only called on validation failures (deletion_tracking.go:48), not on success.\n\nDiscovered in vc project where stale snapshot files from Nov 8 merge were still present.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-08T22:39:56.460778-08:00","updated_at":"2025-11-23T14:14:13.332096-08:00","closed_at":"2025-11-08T22:47:51.96296-08:00","source_repo":"."} -{"id":"bd-aysr","content_hash":"f8ff127568f471cc42391b1287cce69b376fb1b49bbef20a24d3394f57fba066","title":"Test numeric 1","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T12:58:41.498034-08:00","updated_at":"2025-11-05T12:58:44.73082-08:00","closed_at":"2025-11-05T12:58:44.73082-08:00","source_repo":"."} -{"id":"bd-ayw","content_hash":"825e5540d42018f2d2cad08f79581eb1b819320bbde4802409111fda485d6d53","title":"Add 'When to use daemon mode' decision tree to daemon.md","description":"**Problem:**\nUsers (especially local-only developers) see daemon-related messages but don't understand:\n- What daemon mode does (git sync automation)\n- Whether they need it\n- Why they see \"daemon_unsupported\" messages\n\nRelated to issue #349 item #3.\n\n**Current state:**\ncommands/daemon.md explains WHAT daemon does but not WHEN to use it.\n\n**Proposed addition:**\nAdd a \"When to Use Daemon Mode\" section after line 20 in commands/daemon.md with clear decision criteria:\n\n**βœ… You SHOULD use daemon mode if:**\n- Working in a team with git remote sync\n- Want automatic commit/push of issue changes\n- Need background auto-sync (5-second debounce)\n- Making frequent bd commands (performance benefit)\n\n**❌ You DON'T need daemon mode if:**\n- Solo developer with local-only tracking\n- Working in git worktrees (use --no-daemon)\n- Running one-off commands/scripts\n- Debugging database issues\n\n**Local-only users:** Direct mode is perfectly fine. Daemon mainly helps with git sync automation. You can use `bd sync` manually when needed.\n\n**Files to modify:**\n- commands/daemon.md (add section after line 20)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T20:48:23.111621-05:00","updated_at":"2025-11-23T14:14:13.332678-08:00","closed_at":"2025-11-20T20:59:13.429263-05:00","source_repo":".","labels":["documentation","onboarding"],"comments":[{"id":18,"issue_id":"bd-ayw","author":"stevey","text":"Addresses GitHub issue #349 item 3: https://github.com/steveyegge/beads/issues/349\n\nLocal-only users see daemon-related messages without understanding when they need daemon mode vs when direct mode is sufficient. Need clear decision tree in daemon.md.","created_at":"2025-11-21T02:23:27Z"}]} -{"id":"bd-az0m","content_hash":"91dd58e84b57c84ae065004ef4c15d0b5330935a5fde35eed489a93452feb2e9","title":"Issue 1","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.754145-05:00","updated_at":"2025-11-20T19:43:48.754145-05:00","closed_at":"2025-11-07T21:55:09.42865-08:00","source_repo":".","dependencies":[{"issue_id":"bd-az0m","depends_on_id":"bd-bvo2","type":"related","created_at":"2025-11-07T19:07:21.069031-08:00","created_by":"daemon"}]} -{"id":"bd-azqv","content_hash":"b4e68adcec7b19f567ebee47f505ca6b529c17b4c4b885282cfc564e8a874f9f","title":"Ready issue","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:04:22.247039-08:00","updated_at":"2025-11-07T22:07:17.344986-08:00","closed_at":"2025-11-07T21:55:09.429024-08:00","source_repo":"."} -{"id":"bd-b0c8","content_hash":"87b423a42d509b9405b52b089b2ba92b33a90ad472d6d9094986b48715399a99","title":"Research hooks/skills approach for enforcing issue descriptions","description":"## Solution: Hooks/Skills (mentioned in discussion)\n\nResearch the hooks/skills system mentioned by riordanpawley in discussion #366:\nhttps://www.reddit.com/r/ClaudeAI/s/wrn2tjkMHX\n\n## Investigation Tasks\n\n1. Review the Reddit post to understand the approach\n2. Determine if beads hooks can enforce validation\n3. Check if Claude Code skills/hooks can intercept MCP calls\n4. Assess feasibility and user burden\n\n## Notes\n\nFrom discussion #366:\n\u003e I'm using a skills/hooks system to get Claude to do that kind of thing right similar to https://www.reddit.com/r/ClaudeAI/s/wrn2tjkMHX\n\nThis might be a client-side solution rather than server-side.\n\n## Deliverable\n\nDocument findings in issue notes, with recommendation on whether to pursue this approach.","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-23T14:01:01.57079-08:00","updated_at":"2025-11-23T14:01:01.57079-08:00","source_repo":".","dependencies":[{"issue_id":"bd-b0c8","depends_on_id":"bd-0tr0","type":"discovered-from","created_at":"2025-11-23T14:01:01.572166-08:00","created_by":"daemon"}]} -{"id":"bd-b121","content_hash":"5d71e793a6de110be977bf87cfd25c3b461f452a1e8e44633452de1f8343a098","title":"Fix :memory: database connection pool issue causing \"no such table\" errors","description":"Critical bug in v0.21.6 where :memory: databases with cache=shared create multiple connections in the pool, causing intermittent \"no such table\" errors. SQLite's shared cache for in-memory databases only works reliably with a single connection.\n\nRoot cause: Missing db.SetMaxOpenConns(1) after sql.Open() for :memory: databases.\n\nImpact: 37 test failures in VC project, affects all consumers using :memory: for testing.","acceptance_criteria":"- Add db.SetMaxOpenConns(1) for :memory: databases only\n- Verify VC test suite passes (37 previously failing tests)\n- Add a test in Beads that reproduces the issue\n- Document the pool limitation in code comments\n- Release as Beads v0.21.7","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-04T00:52:56.318619-08:00","updated_at":"2025-11-05T11:31:27.50439-08:00","closed_at":"2025-11-05T00:50:00.558124-08:00","source_repo":"."} -{"id":"bd-b134","content_hash":"455202a74224066aca5a1e300d045ae99e5c4ba5c306c043fd4c4c70c4aea058","title":"Add tests for Integration Layer Implementation","description":"While implementing bd-wfmw, noticed missing tests","notes":"Reviewed existing coverage:\n- Basic test coverage exists in lib/test_beads_mail_adapter.py\n- Integration tests cover failure scenarios in tests/integration/test_mail_failures.py\n- Good coverage of: enabled/disabled modes, graceful degradation, 409 conflicts, HTTP errors, config\n- Missing: authorization headers detail, request body structure validation, concurrent reservation timing, TTL edge cases","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-08T00:20:30.804172-08:00","updated_at":"2025-11-08T02:17:04.046571-08:00","closed_at":"2025-11-08T02:17:04.046571-08:00","source_repo":".","dependencies":[{"issue_id":"bd-b134","depends_on_id":"bd-wfmw","type":"discovered-from","created_at":"2025-11-08T00:20:30.850776-08:00","created_by":"daemon"}]} -{"id":"bd-b245","content_hash":"5ad06a3b7126d4a4eb779cd01319cc4541869f4295afcf6f91cf7d6d36078cb0","title":"Add migration registry and simplify New()","description":"Create migrations.go with Migration type and registry. Change New() to: openDB -\u003e initSchema -\u003e RunMigrations(db). This removes 8+ separate migrate functions from New().","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.862623-07:00","updated_at":"2025-11-02T12:55:59.954845-08:00","closed_at":"2025-11-02T12:55:59.954854-08:00","source_repo":"."} -{"id":"bd-b47c034e","content_hash":"1e8e5ae6388d6546f55421886bd88e7acd2fdade1052d2d7d1b193276777c05d","title":"Address gosec security warnings (102 issues)","description":"Security linter warnings: file permissions (0755 should be 0750), G304 file inclusion via variable, G204 subprocess launches. Many are false positives but should be reviewed.","design":"Review each gosec warning. Add exclusions for legitimate cases to .golangci.yml. Fix real security issues (overly permissive file modes).","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-25T13:47:10.719134-07:00","updated_at":"2025-11-04T11:10:23.533333-08:00","closed_at":"2025-11-04T11:10:23.533338-08:00","source_repo":"."} -{"id":"bd-b4b0","content_hash":"ab3833b7a2cd79e39cbf6e41e35da88c8c45581dff3862bad2b8476b37c3b494","title":"Implement fs bridge layer for WASM (Go syscall/js to Node.js fs)","description":"Go's os package in WASM returns 'not implemented on js' for mkdir and other file operations. Need to create a bridge layer that:\n\n1. Detects WASM environment (GOOS=js)\n2. Uses syscall/js to call Node.js fs module functions\n3. Implements wrappers for:\n - os.MkdirAll\n - os.ReadFile / os.WriteFile\n - os.Open / os.Create\n - os.Stat / os.Lstat\n - filepath operations\n \nApproach:\n- Create internal/wasm/fs_bridge.go with //go:build js \u0026\u0026 wasm\n- Export Node.js fs functions to Go using global.readFileSync, global.writeFileSync, etc.\n- Wrap in Go API that matches os package signatures\n- Update beads.go and storage layer to use bridge when in WASM\n\nThis unblocks bd-4462 (basic WASM testing) and [deleted:bd-5bbf] (feature parity testing).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T22:22:42.796412-08:00","updated_at":"2025-11-03T22:16:38.855334-08:00","closed_at":"2025-11-02T22:47:49.586218-08:00","source_repo":".","dependencies":[{"issue_id":"bd-b4b0","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.585675-08:00","created_by":"stevey"}]} -{"id":"bd-b501fcc1","content_hash":"4cb17f88a8299c0a297b42946c4eaab91fb3f364ba8cd83fe2ee9ff11cb87822","title":"Unit tests for Debouncer","description":"Test debouncer batches multiple triggers into single action. Test timer reset on subsequent triggers. Test cancel during wait. Test thread safety.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.86146-07:00","updated_at":"2025-10-31T17:54:06.880513-07:00","closed_at":"2025-10-31T17:54:06.880513-07:00","source_repo":"."} -{"id":"bd-b54c","content_hash":"1e4750bb1f7a113f3b9b1586927bf1552c60902c8e87243b4958a98e2e6fe43a","title":"Document Claude Code for Web SessionStart hook","description":"Create documentation for using bd in Claude Code for Web:\n\n## Documentation locations\n- README.md - Add Claude Code for Web section\n- Create docs/CLAUDE_CODE_WEB.md with detailed instructions\n\n## SessionStart hook example\n```json\n{\n \"sessionStart\": {\n \"script\": \"npm install -g @beads/bd \u0026\u0026 bd init --quiet --prefix bd || true\"\n }\n}\n```\n\n## Documentation should cover\n- How to configure SessionStart hook in .claude/settings.json\n- Verification: Check bd is installed (bd --version)\n- Basic workflow in Claude Code for Web\n- Troubleshooting common issues\n- Note about network restrictions and why npm approach works\n\n## Examples\n- Creating issues in web sandbox\n- Syncing with git in web environment\n- Using MCP server (if applicable)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T23:40:15.362379-08:00","updated_at":"2025-11-03T10:31:45.382915-08:00","closed_at":"2025-11-03T10:31:45.382915-08:00","source_repo":".","dependencies":[{"issue_id":"bd-b54c","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.991889-08:00","created_by":"daemon"}]} -{"id":"bd-b55e2ac2","content_hash":"44122b61b1dcd06407ecf36f57577ea72c5df6dc8cc2a8c1b173b37d16a10267","title":"Fix autoimport tests for content-hash collision scoring","description":"## Overview\nThree autoimport tests are failing after bd-cbed9619.4 because they expect behavior based on the old reference-counting collision resolution, but the system now uses deterministic content-hash scoring.\n\n## Failing Tests\n1. `TestAutoImportMultipleCollisionsRemapped` - expects local versions preserved\n2. `TestAutoImportAllCollisionsRemapped` - expects local versions preserved \n3. `TestAutoImportCollisionRemapMultipleFields` - expects specific collision resolution behavior\n\n## Root Cause\nThese tests were written when ScoreCollisions used reference counting to determine which version to keep. Now it uses content-hash comparison (introduced in commit 2e87329), which produces different but deterministic results.\n\n## Example\nOld behavior: Issue with more references would be kept\nNew behavior: Issue with lexicographically lower content hash is kept\n\n## Solution\nUpdate each test to:\n1. Verify the new content-hash based behavior is correct\n2. Check that the remapped issue (not necessarily local/remote) has the expected content\n3. Ensure dependencies are preserved on the correct remapped issue\n\n## Acceptance Criteria\n- All three autoimport tests pass\n- Tests verify content-hash determinism (same collision always resolves the same way)\n- Tests check dependency preservation on remapped issues\n- Test documentation explains content-hash scoring expectations\n\n## Files to Modify\n- `cmd/bd/autoimport_collision_test.go`\n\n## Testing\nRun: `go test ./cmd/bd -run \"TestAutoImport.*Collision\" -v`","status":"open","priority":2,"issue_type":"task","created_at":"2025-10-28T19:17:28.358028-07:00","updated_at":"2025-10-30T17:12:58.179059-07:00","source_repo":"."} -{"id":"bd-b5a3","content_hash":"d58f635721d24b7761782f83df452a67f794080d2c41cb4f6fad2f27ef2cf0b6","title":"Extract Daemon struct and config into internal/daemonrunner","description":"Create internal/daemonrunner with Config struct and Daemon struct. Move daemon runtime logic from cmd/bd/daemon.go Run function into Daemon.Start/Stop methods.","notes":"Refactoring complete! Created internal/daemonrunner package with:\n- Config struct (config.go)\n- Daemon struct with Start/Stop methods (daemon.go)\n- RPC server lifecycle (rpc.go)\n- Sync loop implementation (sync.go)\n- Git operations (git.go)\n- Process management (process.go, flock_*.go)\n- Logger setup (logger.go)\n- Platform-specific signal handling (signals_*.go)\n- Database fingerprint validation (fingerprint.go)\n\nBuild succeeds and most daemon tests pass. Import functionality still delegated to cmd/bd (marked with TODO(bd-b5a3)).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.843103-07:00","updated_at":"2025-11-01T20:23:46.475885-07:00","closed_at":"2025-11-01T20:23:46.475888-07:00","source_repo":"."} -{"id":"bd-b6b2","content_hash":"6d2b2f1bbec6b9aa956e5e84c6b78da699a72a487d2317c6533215d574d2209f","title":"Feature with design","description":"This is a description","design":"Use MVC pattern","acceptance_criteria":"All tests pass","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-10-31T21:40:34.612465-07:00","updated_at":"2025-11-04T11:10:23.533636-08:00","closed_at":"2025-11-04T11:10:23.533638-08:00","source_repo":"."} -{"id":"bd-b7d2","content_hash":"cd78e03d80898095a2f7f56c7f000b50e9e3be7b2416797d11f4640e5a0e583a","title":"Add sync.branch configuration","description":"Add configuration layer to support sync.branch setting via config file, environment variable, or CLI flag.\n\nTasks:\n- Add sync.branch field to config schema\n- Add BEADS_SYNC_BRANCH environment variable\n- Add --branch flag to bd init\n- Add bd config get/set sync.branch commands\n- Validation (branch name format, conflicts)\n- Config migration for existing users\n\nEstimated effort: 1-2 days","acceptance_criteria":"- Can set sync.branch via config file, env var, or CLI\n- bd config get sync.branch returns configured value\n- Invalid branch names rejected with clear error\n- Backward compatible (empty = current branch)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.560141-08:00","updated_at":"2025-11-04T11:10:23.533911-08:00","closed_at":"2025-11-04T11:10:23.533913-08:00","source_repo":".","dependencies":[{"issue_id":"bd-b7d2","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.356847-08:00","created_by":"stevey"}]} -{"id":"bd-b92a","content_hash":"01d8b852f1d9936835a253f6b9576c401cbd143772302b25ac859db79b6be76a","title":"Wire config to import pipeline","description":"Connect import.orphan_handling config to importer.go and sqlite validation functions. Pass mode flag through call chain. Implement all four modes (strict/resurrect/skip/allow) with proper error messages and logging.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:08.612142-08:00","updated_at":"2025-11-05T00:44:27.949021-08:00","closed_at":"2025-11-05T00:44:27.949024-08:00","source_repo":"."} -{"id":"bd-bb08","content_hash":"df5b8f359f459b9fc8a24e089878e65222f4b7ba541e829ebb1d34e5beb3a9fc","title":"Add ON DELETE CASCADE to child_counters schema","description":"Update schema.go child_counters table foreign key with ON DELETE CASCADE. When parent deleted, child counter should also be deleted. If parent is resurrected, counter gets recreated from scratch. Add migration for existing databases.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:30.681452-08:00","updated_at":"2025-11-05T11:31:27.505024-08:00","closed_at":"2025-11-05T00:55:12.427194-08:00","source_repo":"."} -{"id":"bd-bc2c6191","content_hash":"46ab7e965823421a1cc06fdbb3a1faa8ef31f0c46487cd05a4cec8127af8e480","title":"Audit Current Cache Usage","description":"Understand exactly what code depends on the storage cache","acceptance_criteria":"- Document showing all cache dependencies\n- Confirmation that removing cache won't break MCP\n- List of tests that need updating\n\nFiles to examine:\n- internal/rpc/server_cache_storage.go (cache implementation)\n- internal/rpc/client.go (how req.Cwd is set)\n- internal/rpc/server_*.go (all getStorageForRequest calls)\n- integrations/beads-mcp/ (MCP multi-repo logic)\n\nTasks:\n- Document all callers of getStorageForRequest()\n- Verify req.Cwd is only set by RPC client for database discovery\n- Confirm MCP server doesn't rely on multi-repo cache behavior\n- Check if any tests assume multi-repo routing\n- Review environment variables: BEADS_DAEMON_MAX_CACHE_SIZE, BEADS_DAEMON_CACHE_TTL, BEADS_DAEMON_MEMORY_THRESHOLD_MB","notes":"Audit complete. See CACHE_AUDIT.md for full findings.\n\nSummary:\n- Cache was already removed in commit 322ab63 (2025-10-28)\n- server_cache_storage.go deleted (~286 lines)\n- All getStorageForRequest calls replaced with s.storage\n- All environment variables removed\n- MCP multi-repo works via per-project daemon architecture\n- All tests updated and passing\n- Only stale comment in server.go needed fixing","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T23:02:43.506373-07:00","updated_at":"2025-11-06T20:06:49.218998-08:00","closed_at":"2025-11-06T19:48:30.520616-08:00","source_repo":"."} -{"id":"bd-bc7l","content_hash":"bc091a6fed46130e6cb791c4d58c777b904e22f92cc6921d231053abf48c3c4b","title":"Issue 2 to reopen","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.754817-05:00","updated_at":"2025-11-20T19:43:48.754817-05:00","closed_at":"2025-11-07T21:57:59.91095-08:00","source_repo":"."} -{"id":"bd-bcrt","content_hash":"1d11548473406a9cc80bd1fa771ad5f6c6b0c350676239152aba1361499fe009","title":"Add validation to require description when creating issues","description":"## Solution: Code-level validation\n\nAdd validation in bd create to warn or require a description when creating non-test issues.\n\n## Implementation Options\n\n### Option 1: Warning (Non-blocking)\n- Print a warning when description is empty\n- Similar to existing 'Test' prefix warning in create.go:62-66\n- Allows users to proceed but raises awareness\n\n### Option 2: Strict validation with bypass\n- Require description for all issues except:\n - Issues with 'test' in title (case-insensitive)\n - When --no-description-check flag is provided\n- Exit with error if description is empty and no bypass\n\n### Option 3: Interactive prompt (CLI only)\n- If description empty, prompt user to enter one\n- Only works in CLI, not via MCP/daemon mode\n- May confuse AI agents expecting non-interactive behavior\n\n## Recommendation\n\nStart with Option 1 (warning) to gather feedback, then potentially move to Option 2 if problem persists.\n\n## Files to modify\n\n- cmd/bd/create.go - Add validation after line 80 (where description is retrieved)\n- Consider adding to RPC handler in daemon mode as well","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T14:00:58.803225-08:00","updated_at":"2025-11-23T14:09:20.790174-08:00","closed_at":"2025-11-23T14:09:20.790174-08:00","source_repo":".","dependencies":[{"issue_id":"bd-bcrt","depends_on_id":"bd-0tr0","type":"discovered-from","created_at":"2025-11-23T14:00:58.804437-08:00","created_by":"daemon"}]} -{"id":"bd-bdaf24d5","content_hash":"64067e38421a77f1b54fca73e6b98923d15aca0933463a1fa6862270c3102566","title":"Final validation test","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T18:27:28.310533-07:00","updated_at":"2025-10-31T12:00:43.184995-07:00","closed_at":"2025-10-31T12:00:43.184995-07:00","source_repo":"."} -{"id":"bd-bdhn","content_hash":"ddbc003327e0492285b53fd765e90a816b9cea1e4cf9fc8797e8a465a1e834bd","title":"bd message: Add input validation for --importance flag","description":"The --importance flag accepts any string without validation, leading to confusing server errors.\n\n**Location:** cmd/bd/message.go:256-258\n\n**Fix:**\n- Add flag validation for: low, normal, high, urgent\n- Add shell completion support\n- Validate in runMessageSend before sending\n\n**Impact:** Better UX, prevents confusing errors","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T12:54:26.43027-08:00","updated_at":"2025-11-08T12:57:59.65367-08:00","closed_at":"2025-11-08T12:57:59.65367-08:00","source_repo":".","dependencies":[{"issue_id":"bd-bdhn","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.910841-08:00","created_by":"daemon"}]} -{"id":"bd-be7a","content_hash":"d9043a7a49f8e42dc88c3c01aaa178c1560b67c1637c3373b39c387272e8b725","title":"Create npm package structure with package.json","description":"Set up initial npm package structure for @beads/bd:\n\n## Files to create\n- npm/package.json - Package metadata, dependencies, scripts\n- npm/bin/bd - CLI wrapper script that invokes native binary\n- npm/.gitignore - Ignore downloaded binaries\n- npm/README.md - Installation and usage instructions\n\n## package.json structure\n- Name: @beads/bd (scoped package)\n- Main: index.js (exports binary path)\n- Bin: bin/bd (CLI entry point)\n- Scripts: postinstall (download binary)\n- Keywords: issue-tracker, cli, beads, bd\n- License: MIT\n\n## Bin wrapper\nSimple Node.js script that:\n- Spawns native binary with child_process.spawn\n- Passes through all arguments and stdio\n- Exits with binary's exit code","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:39:47.416779-08:00","updated_at":"2025-11-03T10:31:45.381258-08:00","closed_at":"2025-11-03T10:31:45.381258-08:00","source_repo":".","dependencies":[{"issue_id":"bd-be7a","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.923859-08:00","created_by":"daemon"}]} -{"id":"bd-bgca","content_hash":"c617d03baef137f2425cea14eb5346012e556b35e9048f0601fe8d719b5b705f","title":"Latency test manual","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-08T00:04:25.028223-08:00","updated_at":"2025-11-08T00:06:46.169654-08:00","closed_at":"2025-11-08T00:06:46.169654-08:00","source_repo":"."} -{"id":"bd-biwp","content_hash":"0e10fbd7c9acb4a476010f29f0669b76613acb8b05302657e894f9a255aa3cc7","title":"Support local-only git repos without remote origin","description":"Daemon crashes when working with local git repos that don't have origin remote configured. Should gracefully degrade to local-only mode: skip git pull/push operations but maintain daemon features (RPC server, auto-flush, JSONL export).","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-09T16:09:50.677769-08:00","updated_at":"2025-11-09T16:16:56.588548-08:00","closed_at":"2025-11-09T16:16:56.588548-08:00","external_ref":"gh#279","source_repo":"."} -{"id":"bd-br8","content_hash":"3f7413965cebb0a08803c601413ce62ea82af565c63b1747da623ca42a791316","title":"Implement `bd setup claude` command for Claude Code integration","description":"Create a `bd setup claude` command that installs Claude Code integration files (slash commands and hooks). This is idempotent and safe to run multiple times.","design":"## Implementation\n\nCreate `cmd/bd/setup.go` with subcommand `claude` that installs hooks via **JSON configuration** (Claude Code's native hook system).\n\n### Command Interface\n```bash\nbd setup claude # Install globally (default)\nbd setup claude --project # Install for this project only\nbd setup claude --check # Verify installation\nbd setup claude --remove # Remove bd hooks\n```\n\n### Claude Code Hook Architecture\n\n**Claude Code uses JSON configuration, NOT file discovery:**\n- Hooks defined in `settings.json` as arrays\n- Multiple tools coexist natively (parallel execution)\n- Configuration-based, not directory-based\n\n**Configuration files:**\n- Global: `~/.claude/settings.json`\n- Project: `./.claude/settings.json` or `./.claude/settings.local.json`\n\n### What Gets Installed\n\n**settings.json configuration only** (no script files needed):\n```json\n{\n \"hooks\": {\n \"SessionStart\": [\n {\n \"matcher\": \"\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"bd prime\"\n }\n ]\n }\n ],\n \"PreCompact\": [\n {\n \"matcher\": \"\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"command\": \"bd prime\"\n }\n ]\n }\n ]\n }\n}\n```\n\n**Why no script files:**\n- `bd prime` is cross-platform (no shell syntax needed)\n- `bd prime` always exits 0 (no `|| true` needed)\n- `bd prime` never writes to stderr (no `2\u003e/dev/null` needed)\n- Simpler: one file to manage (settings.json), not two\n- More portable: no file permissions, no path dependencies\n\n### Installation Logic\n\n```go\nfunc setupClaude(global bool) error {\n var settingsPath string\n \n if global {\n home, _ := os.UserHomeDir()\n settingsPath = filepath.Join(home, \".claude/settings.json\")\n } else {\n settingsPath = \".claude/settings.local.json\"\n }\n \n // Update settings.json (merge with existing)\n return updateSettingsJSON(settingsPath, addBeadsHooks)\n}\n\nfunc updateSettingsJSON(path string, updateFn func(map[string]interface{})) error {\n // Create parent directory if needed\n os.MkdirAll(filepath.Dir(path), 0755)\n \n // Read existing settings (or create empty)\n var settings map[string]interface{}\n if data, err := os.ReadFile(path); err == nil {\n json.Unmarshal(data, \u0026settings)\n } else {\n settings = make(map[string]interface{})\n }\n \n // Apply updates\n updateFn(settings)\n \n // Write back atomically\n data, _ := json.MarshalIndent(settings, \"\", \" \")\n return atomicWriteFile(path, data, 0644)\n}\n\nfunc addBeadsHooks(settings map[string]interface{}) {\n hooks, _ := settings[\"hooks\"].(map[string]interface{})\n if hooks == nil {\n hooks = make(map[string]interface{})\n settings[\"hooks\"] = hooks\n }\n \n // Add SessionStart hook if not present\n addHookCommand(hooks, \"SessionStart\", \"bd prime\")\n \n // Add PreCompact hook if not present\n addHookCommand(hooks, \"PreCompact\", \"bd prime\")\n}\n\nfunc addHookCommand(hooks map[string]interface{}, event, command string) {\n // Get or create event array\n eventHooks, _ := hooks[event].([]interface{})\n if eventHooks == nil {\n eventHooks = []interface{}{}\n }\n \n // Check if bd hook already registered\n for _, hook := range eventHooks {\n hookMap, _ := hook.(map[string]interface{})\n commands, _ := hookMap[\"hooks\"].([]interface{})\n for _, cmd := range commands {\n cmdMap, _ := cmd.(map[string]interface{})\n if cmdMap[\"command\"] == command {\n fmt.Println(\"βœ“ Hook already registered:\", event)\n return // Already present\n }\n }\n }\n \n // Add bd hook to array\n newHook := map[string]interface{}{\n \"matcher\": \"\",\n \"hooks\": []interface{}{\n map[string]interface{}{\n \"type\": \"command\",\n \"command\": command,\n },\n },\n }\n \n eventHooks = append(eventHooks, newHook)\n hooks[event] = eventHooks\n fmt.Println(\"βœ“ Registered hook:\", event)\n}\n```\n\n### Slash Command (Optional)\n\n**`.claude/commands/prime_beads.md`:**\n```markdown\n---\ndescription: Load Beads workflow context\n---\n\nRun `bd prime` to refresh bd workflow understanding.\n```\n\n### Integration with `bd init`\n\nAfter git hooks:\n```go\nif isClaudeDetected() \u0026\u0026 !quietMode {\n fmt.Println(\"\\nClaude Code Integration:\")\n fmt.Println(\" Install hooks to prevent agent from forgetting bd workflow?\")\n fmt.Println(\" (Works with MCP server or CLI approach)\")\n \n choice := promptYesNo(\"Install Claude hooks globally?\")\n if choice {\n setupClaude(true) // global=true\n }\n}\n```\n\n### Safe Multi-Tool Coexistence\n\n**Why this approach is safe:**\n- JSON arrays support multiple tools natively\n- Each tool gets its own array entry\n- Parallel execution (no conflicts)\n- Removal only touches bd entries\n- No file overwriting needed\n\n### Removal\n\n```go\nfunc removeBeadsHooks(settings map[string]interface{}) {\n hooks, _ := settings[\"hooks\"].(map[string]interface{})\n if hooks == nil {\n return\n }\n \n // Remove bd prime hooks from each event\n for _, event := range []string{\"SessionStart\", \"PreCompact\"} {\n removeHookCommand(hooks, event, \"bd prime\")\n }\n}\n\nfunc removeHookCommand(hooks map[string]interface{}, event, command string) {\n eventHooks, _ := hooks[event].([]interface{})\n if eventHooks == nil {\n return\n }\n \n // Filter out bd prime hooks\n var filtered []interface{}\n for _, hook := range eventHooks {\n hookMap, _ := hook.(map[string]interface{})\n commands, _ := hookMap[\"hooks\"].([]interface{})\n \n keepHook := true\n for _, cmd := range commands {\n cmdMap, _ := cmd.(map[string]interface{})\n if cmdMap[\"command\"] == command {\n keepHook = false\n break\n }\n }\n \n if keepHook {\n filtered = append(filtered, hook)\n }\n }\n \n hooks[event] = filtered\n}\n```\n\n### Files to Create\n- `cmd/bd/setup.go` - Setup command with JSON merging logic\n- `cmd/bd/setup_test.go` - Tests for JSON manipulation\n- No hook script files needed (bd prime is self-contained)","acceptance_criteria":"- `bd setup claude` installs .claude/ files\n- Idempotent (can run multiple times safely)\n- Backs up existing files\n- `bd setup claude --check` verifies installation\n- Works when .claude/ doesn't exist (skip with message)\n- Unit tests cover installation logic","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:28:59.374019-08:00","updated_at":"2025-11-12T08:51:23.281292-08:00","closed_at":"2025-11-12T08:51:23.281292-08:00","source_repo":".","dependencies":[{"issue_id":"bd-br8","depends_on_id":"bd-rpn","type":"blocks","created_at":"2025-11-11T23:28:59.375616-08:00","created_by":"daemon"},{"issue_id":"bd-br8","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:23.762685-08:00","created_by":"daemon"}]} -{"id":"bd-bt6y","content_hash":"462f08aa379cf2f196b4c0ca096271fa47ab5e1a18c5663c28d2d86fd02115cf","title":"Improve compact/daemon/merge documentation and UX","description":"Multiple documentation and UX issues encountered:\n1. \"bd compact --analyze\" fails with misleading \"requires SQLite storage\" error when daemon is running. Needs --no-daemon or better error.\n2. \"bd merge\" help text is outdated (refers to 3-way merge instead of issue merging).\n3. Daemon mode purpose isn't clear to local-only users.\n4. Compact/cleanup commands are hard to discover.\n\nProposed fixes:\n- Fix compact+daemon interaction or error message.\n- Update \"bd merge\" help text.\n- Add \"when to use daemon\" section to docs.\n- Add maintenance section to quickstart.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:55:43.637047-05:00","updated_at":"2025-11-20T18:55:43.637047-05:00","source_repo":"."} -{"id":"bd-buol","content_hash":"020dc9dbbd7f3e2b40c35f01bf8a65cf32ab419c188081493ea4e541bad1442e","title":"Invert control for compact: provide tools for agent-driven compaction","description":"Currently compact requires Anthropic API key because bd calls the AI directly. This is backwards - we should provide tools (like all other bd commands) that let an AI agent perform the compaction. The agent decides what to keep/merge, not bd. Related to GH #243 complaint about API key requirement.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-07T00:27:28.498069-08:00","updated_at":"2025-11-07T23:18:08.38606-08:00","closed_at":"2025-11-07T23:08:51.67473-08:00","source_repo":"."} -{"id":"bd-bvo2","content_hash":"66fd2d53d97eb8dcb3231e82702ca7eb0f1887dc9b3ee2b2865e0d5158ca7311","title":"Issue 2","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.755403-05:00","updated_at":"2025-11-20T19:43:48.755403-05:00","closed_at":"2025-11-07T21:55:09.429328-08:00","source_repo":"."} -{"id":"bd-bwk2","content_hash":"b69758a5dd9ce7605a61dc6e1fe3e753b87dfc6824c248d6ad56e038d47e77e7","title":"Centralize error handling patterns in storage layer","description":"80+ instances of inconsistent error handling across sqlite.go with mix of %w, %v, and no wrapping.\n\nLocation: internal/storage/sqlite/sqlite.go (throughout)\n\nProblem:\n- Some use fmt.Errorf(\"op failed: %w\", err) - correct wrapping\n- Some use fmt.Errorf(\"op failed: %v\", err) - loses error chain\n- Some return err directly - no context\n- Hard to debug production issues\n- Can't distinguish error types\n\nSolution: Create internal/storage/sqlite/errors.go:\n- Define sentinel errors (ErrNotFound, ErrInvalidID, etc.)\n- Create wrapDBError(op string, err error) helper\n- Convert sql.ErrNoRows to ErrNotFound\n- Always wrap with operation context\n\nImpact: Lost error context; inconsistent messages; hard to debug\n\nEffort: 5-7 hours","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-16T14:51:54.974909-08:00","updated_at":"2025-11-16T14:51:54.974909-08:00","source_repo":"."} -{"id":"bd-bxha","content_hash":"c2ecc8ebb17f47bbb4b23bfc6d283f91fa45bdbe48076082b0397616de197b81","title":"Default to YES for git hooks and merge driver installation","description":"Currently bd init prompts user to install git hooks and merge driver, but setup is incomplete if user declines. Change to install by default unless --skip-hooks or --skip-merge-driver flags are passed. Better safe defaults. If installation fails, warn user and suggest bd doctor --fix.","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-21T23:16:10.172238-08:00","updated_at":"2025-11-21T23:16:28.369137-08:00","source_repo":".","dependencies":[{"issue_id":"bd-bxha","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:10.173034-08:00","created_by":"daemon"}]} -{"id":"bd-by3x","content_hash":"80149be1ddf4ef26d5d56c444895be01ec8b59492c258c2365fa1c2619061bbd","title":"Windows binaries lack SQLite support (GH #253)","description":"Windows users installing via install.ps1 get \"sql: unknown driver sqlite\" error. Root cause: GoReleaser was building with CGO_ENABLED=0, which excludes SQLite driver.\n\nFixed by:\n1. Enabling CGO in .goreleaser.yml\n2. Installing MinGW cross-compiler in release workflow\n3. Splitting builds per platform to set correct CC for Windows\n\nNeeds new release to fix for users.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T15:54:13.134815-08:00","updated_at":"2025-11-07T15:55:07.024156-08:00","closed_at":"2025-11-07T15:55:07.024156-08:00","source_repo":"."} -{"id":"bd-bzfy","content_hash":"90bbde4d90d68728a9377d5d966682dc836740f1be43a0cf80d3cc69002a560b","title":"Integrate beads-merge tool by @neongreen","description":"**Context**: @neongreen built a production-ready 3-way merge tool for JSONL files that works with both Git and Jujutsu. This is superior to our planned bd resolve-conflicts because it prevents conflicts proactively instead of resolving them after the fact.\n\n**Tool**: https://github.com/neongreen/mono/tree/main/beads-merge\n\n**What it does**:\n- 3-way merge of JSONL files (base, left, right)\n- Field-level merging (titles, status, priority, etc.)\n- Smart dependency merging (union + dedup)\n- Conflict markers for unresolvable conflicts\n- Exit code 1 for conflicts (standard)\n\n**Integration options**:\n\n1. **Recommend (minimal effort)** - Document in AGENTS.md + TROUBLESHOOTING.md\n2. **Bundle binary** - Include in releases (cross-platform builds)\n3. **Port to Go** - Reimplement in bd codebase\n4. **Auto-install hook** - During bd init, offer to install merge driver\n\n**Recommendation**: Start with option 1 (document), then option 2 (bundle) once proven.\n\n**Related**: bd-5f483051 (bd resolve-conflicts - can close as superseded)","notes":"Created GitHub issue to discuss integration approach with @neongreen: https://github.com/neongreen/mono/issues/240\n\nAwaiting their preference on:\n1. Vendor with attribution (fastest)\n2. Extract as importable module (best long-term)\n3. Keep as separate tool (current state)\n\nNext: Wait for response before proceeding with integration.\n\nUPDATE 2025-11-06: @neongreen gave permission to vendor! Quote: \"I switched from beads to my own thing (tk) so I'm very happy to give beads-merge away β€” feel free to move it into the beads repo and I will point mono's readme to beads\"\n\nNext: Vendor beads-merge with full attribution","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T11:31:44.906652-08:00","updated_at":"2025-11-06T18:19:16.233387-08:00","closed_at":"2025-11-06T15:38:37.052274-08:00","source_repo":"."} -{"id":"bd-c01f","content_hash":"14269c39f13784e0ee793fae005b1869fea5c08af1bbdc4a2f841720278180d5","title":"Implement bd stale command to find abandoned/forgotten issues","description":"Add bd stale command to surface issues that haven't been updated recently and may need attention.\n\nUse cases:\n- In-progress issues with no recent activity (may be abandoned)\n- Open issues that have been forgotten\n- Issues that might be outdated or no longer relevant\n\nQuery logic should find non-closed issues where updated_at exceeds a time threshold.\n\nShould support:\n- --days N flag (default 30-90 days)\n- --status filter (e.g., only in_progress)\n- --json output for automation\n\nReferences GitHub issue #184 where user expected this command to exist.","design":"Implementation approach:\n1. Add new command in cmd/bd/stale.go\n2. Query issues with: status != 'closed' AND updated_at \u003c (now - N days)\n3. Support filtering by status (open, in_progress, blocked)\n4. Default threshold: 30 days (configurable via --days)\n5. JSON output for agent consumption\n6. Order by updated_at ASC (oldest first)","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-31T22:48:46.85435-07:00","updated_at":"2025-10-31T22:54:33.704492-07:00","closed_at":"2025-10-31T22:54:33.704492-07:00","source_repo":"."} -{"id":"bd-c13f","content_hash":"0e428b0589a6f763a32195b32241ec71141793101ee102df5df69d3c7fadfaaf","title":"Add unit tests for parent resurrection","description":"Test resurrection with deleted parent (should succeed), resurrection with never-existed parent (should fail gracefully), multi-level resurrection (bd-abc.1.2 with both parents missing). Verify tombstone creation and is_tombstone flag.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.325335-08:00","updated_at":"2025-11-05T00:08:42.813728-08:00","closed_at":"2025-11-05T00:08:42.813731-08:00","source_repo":"."} -{"id":"bd-c362","content_hash":"9bbfaede59e2433760f69b45649405ee0885f18849cb30ff0357e56c90c8d4cd","title":"Extract database search logic into helper function","description":"The logic for finding a database in a beads directory is duplicated:\n- FindDatabasePath() BEADS_DIR section (beads.go:141-169)\n- findDatabaseInTree() (beads.go:248-280)\n\nBoth implement the same search order:\n1. Check config.json first (single source of truth)\n2. Fall back to canonical beads.db\n3. Search for *.db files, filtering backups and vc.db\n\nRefactoring suggestion:\nExtract to a helper function like:\n func findDatabaseInBeadsDir(beadsDir string) string\n\nBenefits:\n- Single source of truth for database search logic\n- Easier to maintain and update search order\n- Reduces code duplication\n\nRelated to [deleted:[deleted:[deleted:bd-e16b]]] implementation.","status":"open","priority":3,"issue_type":"chore","created_at":"2025-11-02T18:34:02.831543-08:00","updated_at":"2025-11-20T20:40:13.912032-05:00","source_repo":".","dependencies":[{"issue_id":"bd-c362","depends_on_id":"bd-e16b","type":"blocks","created_at":"2025-11-02T18:34:02.832607-08:00","created_by":"daemon"}]} -{"id":"bd-c3ei","content_hash":"33a1bd2deaee412d0523c512061f2e31e3f15340858b550869e43b4ccec5211f","title":"Migration guide documentation","description":"Write comprehensive migration guide covering: OSS contributor workflow, team workflow, multi-phase development, multiple personas. Include step-by-step instructions, troubleshooting, and backward compatibility notes.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:29.84662-08:00","updated_at":"2025-11-05T18:12:30.907835-08:00","closed_at":"2025-11-05T18:12:30.907835-08:00","source_repo":".","dependencies":[{"issue_id":"bd-c3ei","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.028291-08:00","created_by":"daemon"}]} -{"id":"bd-c49","content_hash":"f8074b901fa233e2dde691205357ce3963e7e9c7e2b91f3a9d49b421914bcc49","title":"Audit all cmd/bd tests and group into suites","description":"Analyze all 279 tests in cmd/bd and identify:\n1. Which tests can share DB setup (most of them\\!)\n2. Which tests actually need isolation (export/import, git ops)\n3. Optimal grouping into test suites\n\nCreate a mapping document showing:\n- Current: 279 individual test functions\n- Proposed: ~10-15 test suites with subtests\n- Expected speedup per suite\n\nBlocks all refactoring work.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-21T11:49:19.438242-05:00","updated_at":"2025-11-21T15:15:29.50544-05:00","closed_at":"2025-11-21T15:15:29.50544-05:00","source_repo":"."} -{"id":"bd-c4rq","content_hash":"4c096e1d84c3ba5b5b4e107692b990a99166b4c99a4262fd26ec08297fb81046","title":"Refactor: Move staleness check inside daemon branch","description":"## Problem\n\nCurrently ensureDatabaseFresh() is called before the daemon mode check, but it checks daemonClient != nil internally and returns early. This is redundant.\n\n**Location:** All read commands (list.go:196, show.go:27, ready.go:102, status.go:80, etc.)\n\n## Current Pattern\n\nCall happens before daemon check, function checks daemonClient internally.\n\n## Better Pattern\n\nMove staleness check to direct mode branch only, after daemon check.\n\n## Impact\nLow - minor performance improvement (avoids one function call per command in daemon mode)\n\n## Effort\nMedium - requires refactoring 8 command files\n\n## Priority\nLow - can defer to future cleanup PR","status":"open","priority":3,"issue_type":"chore","created_at":"2025-11-20T20:17:45.119583-05:00","updated_at":"2025-11-20T20:17:45.119583-05:00","source_repo":"."} -{"id":"bd-c77d","content_hash":"204eed7c89bcda47198a774340985706baf139c9e1a9f1311d7340dac2b64ec7","title":"Test SQLite WASM compatibility","description":"Verify modernc.org/sqlite works in WASM target. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Compile minimal SQLite test to WASM\n- [ ] Test database create/open operations\n- [ ] Test query execution\n- [ ] Test JSONL import/export\n- [ ] Benchmark performance vs native\n\n## Decision Point\nIf modernc.org/sqlite issues, evaluate ncruces/go-sqlite3 alternative.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-02T18:33:31.247537-08:00","updated_at":"2025-11-05T00:55:48.757762-08:00","closed_at":"2025-11-05T00:55:48.75777-08:00","source_repo":".","dependencies":[{"issue_id":"bd-c77d","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.248112-08:00","created_by":"daemon"}]} -{"id":"bd-c796","content_hash":"7231785c8ce4d15ce296f7e2d22d03b9d6610ed73dcc5501773f86782ffeaf03","title":"Extract batch operations to batch_ops.go","description":"Move validateBatchIssues, generateBatchIDs, bulkInsertIssues, bulkRecordEvents, bulkMarkDirty, CreateIssues to batch_ops.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.887487-07:00","updated_at":"2025-11-02T08:09:51.579971-08:00","closed_at":"2025-11-02T08:09:51.579978-08:00","source_repo":"."} -{"id":"bd-c7eb","content_hash":"8f98709ed61066b4e51c2f26d16c22278846cab66c7597df2bc892172b9a6ad6","title":"Research Go WASM compilation and modernc.org/sqlite WASM support","description":"Investigate technical requirements for compiling bd to WASM:\n- Verify modernc.org/sqlite has working js/wasm support\n- Identify Go stdlib limitations in WASM (syscalls, file I/O, etc.)\n- Research wasm_exec.js runtime and Node.js integration\n- Document any API differences between native and WASM builds","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.284264-08:00","updated_at":"2025-11-02T22:23:49.375941-08:00","closed_at":"2025-11-02T22:23:49.375941-08:00","source_repo":".","dependencies":[{"issue_id":"bd-c7eb","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.378673-08:00","created_by":"stevey"}]} -{"id":"bd-c825f867","content_hash":"e2925468dd33e89b5930382acb9a0ef9c48a3570d376068f9e3a39bb245f0c9d","title":"Add docs/architecture/event_driven.md","description":"Copy event_driven_daemon.md into docs/ folder. Add to documentation index.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T16:20:02.431399-07:00","updated_at":"2025-11-08T01:58:15.282811-08:00","closed_at":"2025-11-08T00:51:06.826771-08:00","source_repo":"."} -{"id":"bd-c947dd1b","content_hash":"79bd51b46b28bc16cfc19cd19a4dd4f57f45cd1e902b682788d355b03ec00b2a","title":"Remove Daemon Storage Cache","description":"The daemon's multi-repo storage cache is the root cause of stale data bugs. Since global daemon is deprecated, we only ever serve one repository, making the cache unnecessary complexity. This epic removes the cache entirely for simpler, more reliable direct storage access.","design":"For local daemon (single repository), eliminate the cache entirely:\n- Use s.storage field directly (opened at daemon startup)\n- Remove getStorageForRequest() routing logic\n- Remove server_cache_storage.go entirely (~300 lines)\n- Remove cache-related tests\n- Simplify Server struct\n\nBenefits:\nβœ… No staleness bugs: Always using live SQLite connection\nβœ… Simpler code: Remove ~300 lines of cache management\nβœ… Easier debugging: Direct storage access, no cache indirection\nβœ… Same performance: Cache was always 1 entry for local daemon anyway","acceptance_criteria":"- Daemon has no storage cache code\n- All tests pass\n- MCP integration works\n- No stale data bugs\n- Documentation updated\n- Performance validated","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T10:50:15.126939-07:00","updated_at":"2025-10-30T17:12:58.21743-07:00","closed_at":"2025-10-28T10:49:53.612049-07:00","source_repo":"."} -{"id":"bd-c9a482db","content_hash":"f939b9e15e7143d89626757438a69530fa9165a2f66588fd55f2e6146c20d646","title":"Add internal/ai package for AI-assisted repairs","description":"Add AI integration package to support AI-powered repair commands.\n\nProviders:\n- Anthropic (Claude)\n- OpenAI\n- Ollama (local)\n\nFeatures:\n- Conflict resolution analysis\n- Duplicate detection via embeddings\n- Configuration via env vars (BEADS_AI_PROVIDER, BEADS_AI_API_KEY, etc.)\n\nSee repair_commands.md lines 357-425 for design.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T19:37:55.722841-07:00","updated_at":"2025-11-06T19:36:13.972304-08:00","closed_at":"2025-11-06T19:27:19.150657-08:00","source_repo":"."} -{"id":"bd-caa9","content_hash":"6e8d4006d4f9b265e63fad9e30f24c6ab29fbf79ef47ec90a7e1225b5d662b67","title":"Migration tool for existing users","description":"Ensure smooth migration for existing users to separate branch workflow.\n\nTasks:\n- Add bd migrate --separate-branch command\n- Detect existing repos, migrate cleanly\n- Preserve git history\n- Add rollback mechanism\n- Test migration on beads' own repo (dogfooding)\n- Communication plan (GitHub discussion, docs)\n- Version compatibility checks\n\nEstimated effort: 2-3 days","acceptance_criteria":"- Existing users can migrate without data loss\n- Rollback works if migration fails\n- Clear communication about breaking changes (if any)\n- beads project itself migrated successfully (dogfooding)\n- Migration tested on 5+ real-world repos","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.627388-08:00","updated_at":"2025-11-04T12:36:53.789201-08:00","closed_at":"2025-11-04T12:36:53.789201-08:00","source_repo":".","dependencies":[{"issue_id":"bd-caa9","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.382619-08:00","created_by":"stevey"}]} -{"id":"bd-cb2f","content_hash":"99b9c1c19d5e9f38308d78f09763426777797f133d4c86edd579419e7ba4043f","title":"Week 1 task","description":"","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-03T19:11:59.358093-08:00","updated_at":"2025-11-03T19:11:59.358093-08:00","source_repo":".","labels":["frontend","week2"]} -{"id":"bd-cb64c226.1","content_hash":"0bfd0735c8985d3b3e4906e44f22b06fb24758c6d795188226e920bd8b3e7cf8","title":"Performance Validation","description":"Confirm no performance regression from cache removal","acceptance_criteria":"- Benchmarks show no significant regression\n- Document performance characteristics\n- Confirm single SQLite connection is reused\n\nBenchmarks: go test -bench=. -benchmem ./internal/rpc/...\n\nMetrics to track:\n- Request latency (p50, p99)\n- Throughput (requests/sec)\n- Memory usage\n- SQLite connection overhead\n\nExpected results:\n- Latency: Same or better (no cache overhead)\n- Throughput: Same (cache was always 1 entry)\n- Memory: Lower (no cache structs)\n- Connection overhead: Zero (single connection reused)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T10:50:15.126019-07:00","updated_at":"2025-10-30T17:12:58.216721-07:00","closed_at":"2025-10-28T10:49:45.021037-07:00","source_repo":"."} -{"id":"bd-cb64c226.10","content_hash":"2dbe416cf266952236a03ed414e5f7f9eb5526d69b70d0821ca0d59b2bc22305","title":"Delete server_cache_storage.go","description":"Remove the entire cache implementation file (~286 lines)","acceptance_criteria":"- File deleted from repository\n- No compilation errors\n- No references to deleted functions\n\nFunctions being removed:\n- StorageCacheEntry struct\n- evictStaleStorage() - LRU eviction\n- evictCacheBasedOnMemory() - memory pressure eviction\n- getStorageForRequest() - cache lookup and routing\n- findDatabaseForCwd() - database discovery\n- evictStorageForRequest() - manual eviction","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:38.729299-07:00","updated_at":"2025-10-30T17:12:58.212391-07:00","closed_at":"2025-10-28T14:08:38.064592-07:00","source_repo":"."} -{"id":"bd-cb64c226.12","content_hash":"ed9fa6273973fb0c68d173564ab4814d360528f9bb035e78406a63875f8f6b43","title":"Remove Storage Cache from Server Struct","description":"Eliminate cache fields and use s.storage directly","acceptance_criteria":"- Server struct has no cache fields\n- NewServer() doesn't initialize cache\n- Start() doesn't run cache cleanup goroutines\n- Stop() only closes single s.storage\n\nChanges needed:\n- Remove cache-related fields from Server struct in server_core.go\n- Remove cache size/TTL parsing from env vars in NewServer()\n- Remove cleanup ticker goroutine from Start()\n- Remove cache cleanup logic from Stop()","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:25.474412-07:00","updated_at":"2025-10-30T17:12:58.211812-07:00","closed_at":"2025-10-28T14:08:38.061444-07:00","source_repo":"."} -{"id":"bd-cb64c226.13","content_hash":"717cedbda6e48b8a98f1a0250cd7925377d0b7b84884ac6697486a77886f7082","title":"Audit Current Cache Usage","description":"Understand exactly what code depends on the storage cache","acceptance_criteria":"- Document showing all cache dependencies\n- Confirmation that removing cache won't break MCP\n- List of tests that need updating\n\nFiles to examine:\n- internal/rpc/server_cache_storage.go (cache implementation)\n- internal/rpc/client.go (how req.Cwd is set)\n- internal/rpc/server_*.go (all getStorageForRequest calls)\n- integrations/beads-mcp/ (MCP multi-repo logic)\n\nTasks:\n- Document all callers of getStorageForRequest()\n- Verify req.Cwd is only set by RPC client for database discovery\n- Confirm MCP server doesn't rely on multi-repo cache behavior\n- Check if any tests assume multi-repo routing\n- Review environment variables: BEADS_DAEMON_MAX_CACHE_SIZE, BEADS_DAEMON_CACHE_TTL, BEADS_DAEMON_MEMORY_THRESHOLD_MB","notes":"AUDIT COMPLETE\n\ngetStorageForRequest() callers: 17 production + 11 test\n- server_issues_epics.go: 8 calls\n- server_labels_deps_comments.go: 4 calls \n- server_export_import_auto.go: 2 calls\n- server_compact.go: 2 calls\n- server_routing_validation_diagnostics.go: 1 call\n- server_eviction_test.go: 11 calls (DELETE entire file)\n\nPattern everywhere: store, err := s.getStorageForRequest(req) β†’ store := s.storage\n\nreq.Cwd usage: Only for multi-repo routing. Local daemon always serves 1 repo, so routing is unused.\n\nMCP server: Uses separate daemons per repo (no req.Cwd usage found). NOT affected by cache removal.\n\nCache env vars to deprecate:\n- BEADS_DAEMON_MAX_CACHE_SIZE (used in server_core.go:63)\n- BEADS_DAEMON_CACHE_TTL (used in server_core.go:72)\n- BEADS_DAEMON_MEMORY_THRESHOLD_MB (used in server_cache_storage.go:47)\n\nServer struct fields to remove:\n- storageCache, cacheMu, maxCacheSize, cacheTTL, cleanupTicker, cacheHits, cacheMisses\n\nTests to delete:\n- server_eviction_test.go (entire file - 9 tests)\n- limits_test.go cache assertions\n\nSpecial consideration: ValidateDatabase endpoint uses findDatabaseForCwd() outside cache. Verify if used, then remove or inline.\n\nSafe to proceed with removal - cache always had 1 entry in local daemon model.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:19.3723-07:00","updated_at":"2025-10-30T17:12:58.211563-07:00","closed_at":"2025-10-28T14:08:38.060291-07:00","source_repo":"."} -{"id":"bd-cb64c226.6","content_hash":"0c7997ff55a05eb6db59702ec72644c0f59658ca2838175125fda0e1cd11d952","title":"Verify MCP Server Compatibility","description":"Ensure MCP server works with cache-free daemon","acceptance_criteria":"- MCP integration tests pass\n- Documented confirmation of MCP multi-repo strategy\n- No regressions in MCP functionality\n\nTest scenarios:\n1. Single repo workflow: MCP with one project directory\n2. Multi-repo workflow: MCP switching between projects (uses separate daemons)\n3. Daemon restart: Verify no stale data after daemon restart\n\nQuestions to answer:\n- Does MCP rely on req.Cwd routing to single daemon for multiple repos?\n- Or does MCP start separate daemons per repo (recommended)?\n- Do existing MCP tests pass?\n\nFiles to review:\n- integrations/beads-mcp/src/beads_mcp/server.py\n- integrations/beads-mcp/tests/test_multi_project_switching.py","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:56:03.241615-07:00","updated_at":"2025-10-30T17:12:58.213372-07:00","closed_at":"2025-10-28T14:08:38.059615-07:00","source_repo":"."} -{"id":"bd-cb64c226.8","content_hash":"d8581fb1f52b60d710b0190d33e7aaca4a0e86f791c6a4c60bb26d122bf73891","title":"Update Metrics and Health Endpoints","description":"Remove cache-related metrics from health/metrics endpoints","acceptance_criteria":"- bd daemon --health output has no cache fields\n- bd daemon --metrics output has no cache fields\n- No compilation errors\n\nChanges needed:\n- Remove cache_size from health endpoint in server_routing_validation_diagnostics.go\n- Remove cache_size, cache_hits, cache_misses from metrics endpoint\n- Remove CacheHits and CacheMisses fields from internal/rpc/metrics.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:49.212047-07:00","updated_at":"2025-10-30T17:12:58.212888-07:00","closed_at":"2025-10-28T14:08:38.06569-07:00","source_repo":"."} -{"id":"bd-cb64c226.9","content_hash":"add00749ba759177be9758ba40b4a3e0f4323e564e798079d9ec3b5bf227cdc9","title":"Remove Cache-Related Tests","description":"Delete or update tests that assume multi-repo caching","acceptance_criteria":"- server_eviction_test.go deleted\n- limits_test.go updated (no cache assertions)\n- All tests pass: go test ./internal/rpc/...\n\nTests to delete:\n- TestCacheEviction\n- TestMemoryPressureEviction\n- TestMtimeInvalidation\n- TestConcurrentCacheAccess\n- TestSubdirectoryCanonicalization\n- TestManualEviction\n- TestLRUEviction\n\nFiles to update:\n- internal/rpc/server_eviction_test.go (DELETE entire file)\n- internal/rpc/limits_test.go (remove cache assertions)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:44.511897-07:00","updated_at":"2025-10-30T17:12:58.212659-07:00","closed_at":"2025-10-28T14:08:38.065118-07:00","source_repo":"."} -{"id":"bd-cbed9619.1","content_hash":"7d32114e1514c8fffd183b5f8ebcdd236149aa96631ba0ffae8a00cee76b2aad","title":"Fix multi-round convergence for N-way collisions","description":"## Problem\n\nN-way collision resolution is working (IDs get remapped correctly), but clones don't fully converge after a single final pull. Each clone is missing some issues that other clones have.\n\nFrom TestFiveCloneCollision results:\n- Clone A has: A, B\n- Clone B has: A, B \n- Clone C has: A, B, C\n- Clone D has: A, B, C, D\n- Clone E has: A, B, C, E\n\n**Expected**: All clones should have A, B, C, D, E after final pull.\n\n## Root Cause\n\nThe current sync workflow does:\n1. Each clone syncs in order (resolving collisions locally)\n2. Final pull to get all changes\n\nBut the final pull itself may need import with collision resolution, which creates new commits. These new commits aren't propagated to other clones, so they remain incomplete.\n\n## Proposed Solution\n\n**Option 1: Multi-round final sync**\n- After final pull, do additional sync rounds until all clones converge\n- Check convergence by comparing issue counts or content hashes\n- Maximum N rounds for N clones\n\n**Option 2: Iterative pull-import-push**\n- Each clone: pull β†’ import with --resolve-collisions β†’ push\n- Repeat until no new changes\n- Guaranteed convergence but may create commit spam\n\n**Option 3: Fix auto-import to be truly idempotent**\n- Ensure importing same JSONL multiple times produces no new commits\n- May require smarter content-based deduplication\n\n## Acceptance Criteria\n\n- TestFiveCloneCollision passes without t.Skip\n- All N clones have all N issues after convergence\n- Convergence happens in bounded rounds (≀ N)\n- No data loss or duplication\n- Works for arbitrary N (tested with 5, 10 clones)\n\n## Impact\n\nThis is the final blocker for bd-cbed9619 epic completion.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T21:22:21.486109-07:00","updated_at":"2025-10-30T17:12:58.180996-07:00","closed_at":"2025-10-29T11:02:40.756891-07:00","source_repo":"."} -{"id":"bd-cbed9619.2","content_hash":"180f318b71b7dfd1a5175afe8ee383ee01676e9a1ea0275458d26373c857ceb4","title":"Implement content-first idempotent import","description":"## Overview\nPhase 4: Refactor import to be content-first and idempotent, ensuring importing same JSONL multiple times always converges correctly.\n\n## Current Problem\nCurrent import is ID-first:\n1. Look up by ID\n2. If exists, update\n3. If not exists, create\n\nThis causes issues when:\n- Same content arrives with different IDs (renames not detected)\n- Multiple rounds of import needed for convergence\n- Import order affects final state\n\n## Solution\nMake import content-first and idempotent:\n1. Hash all incoming and existing issues\n2. Match by content hash first (detect renames)\n3. Handle ID conflicts second (using global resolution)\n4. Ensure importing same data multiple times = no-op\n\n## Implementation Tasks\n\n### 1. Refactor ImportIssues to be content-first\nFile: internal/importer/importer.go\n\n```go\nfunc ImportIssues(ctx context.Context, dbPath string, store storage.Storage, \n issues []*types.Issue, opts Options) (*Result, error) {\n \n result := \u0026Result{...}\n \n sqliteStore, needCloseStore, err := getOrCreateStore(ctx, dbPath, store)\n if err != nil {\n return nil, err\n }\n if needCloseStore {\n defer func() { _ = sqliteStore.Close() }()\n }\n \n // Phase 1: Compute content hashes for all incoming issues\n for _, issue := range issues {\n issue.ContentHash = issue.ComputeContentHash()\n }\n \n // Phase 2: Build content hash maps\n incomingByHash := buildHashMap(issues)\n dbIssues, _ := sqliteStore.SearchIssues(ctx, \"\", types.IssueFilter{})\n dbByHash := buildHashMap(dbIssues)\n dbByID := buildIDMap(dbIssues)\n \n // Phase 3: Content-first matching\n var newIssues []*types.Issue\n var idConflicts []*CollisionDetail\n \n for hash, incoming := range incomingByHash {\n if existing, found := dbByHash[hash]; found {\n // Same content exists\n if existing.ID == incoming.ID {\n // Exact match - idempotent case\n result.Unchanged++\n } else {\n // Same content, different ID - rename detected\n // Delete old ID, keep new ID (incoming is canonical)\n if err := handleRename(ctx, sqliteStore, existing, incoming); err != nil {\n return nil, err\n }\n result.Updated++\n }\n } else {\n // New content - check for ID collision\n if existingWithID, found := dbByID[incoming.ID]; found {\n // ID exists but different content - collision\n idConflicts = append(idConflicts, \u0026CollisionDetail{\n ID: incoming.ID,\n IncomingIssue: incoming,\n ExistingIssue: existingWithID,\n })\n } else {\n // Truly new issue\n newIssues = append(newIssues, incoming)\n }\n }\n }\n \n // Phase 4: Resolve ID conflicts using global algorithm\n if len(idConflicts) \u003e 0 {\n if !opts.ResolveCollisions {\n return nil, fmt.Errorf(\"collision detected\")\n }\n \n idMapping, err := sqlite.ResolveNWayCollisions(ctx, sqliteStore, \n idConflicts, issues)\n if err != nil {\n return nil, err\n }\n \n if err := applyIDMapping(ctx, sqliteStore, idMapping); err != nil {\n return nil, err\n }\n \n result.IDMapping = idMapping\n result.Collisions = len(idConflicts)\n }\n \n // Phase 5: Create new issues\n if len(newIssues) \u003e 0 {\n if err := sqliteStore.CreateIssues(ctx, newIssues, \"import\"); err != nil {\n return nil, err\n }\n result.Created = len(newIssues)\n }\n \n // Phase 6: Import dependencies, labels, comments (existing logic)\n // ...\n \n return result, nil\n}\n```\n\n### 2. Implement helper functions\n\n```go\n// buildHashMap creates a map of content hash β†’ issue\nfunc buildHashMap(issues []*types.Issue) map[string]*types.Issue {\n result := make(map[string]*types.Issue)\n for _, issue := range issues {\n result[issue.ContentHash] = issue\n }\n return result\n}\n\n// buildIDMap creates a map of ID β†’ issue\nfunc buildIDMap(issues []*types.Issue) map[string]*types.Issue {\n result := make(map[string]*types.Issue)\n for _, issue := range issues {\n result[issue.ID] = issue\n }\n return result\n}\n\n// handleRename handles content match with different IDs\nfunc handleRename(ctx context.Context, s *SQLiteStorage, \n existing *types.Issue, incoming *types.Issue) error {\n \n // Delete old ID\n if err := s.DeleteIssue(ctx, existing.ID); err != nil {\n return fmt.Errorf(\"failed to delete old ID %s: %w\", existing.ID, err)\n }\n \n // Create with new ID\n if err := s.CreateIssue(ctx, incoming, \"import-rename\"); err != nil {\n return fmt.Errorf(\"failed to create renamed issue %s: %w\", \n incoming.ID, err)\n }\n \n // Update references from old ID to new ID\n idMapping := map[string]string{existing.ID: incoming.ID}\n return updateReferences(ctx, s, idMapping)\n}\n```\n\n### 3. Add idempotency tests\n\nTest cases:\n1. Import same JSONL twice β†’ second import reports all Unchanged\n2. Import, modify DB, import again β†’ reports Updated\n3. Import with rename, import again β†’ idempotent\n4. Import with collision resolution, import again β†’ idempotent\n\n### 4. Update handleCollisions to use new flow\nCurrent handleCollisions in importer.go needs to be updated to:\n- Use content-first matching\n- Call new ResolveNWayCollisions\n- Apply results using ApplyCollisionResolution\n\n## Acceptance Criteria\n- Import matches by content hash before checking IDs\n- Importing same JSONL multiple times is idempotent (reports Unchanged)\n- Rename detection works (same content, different ID)\n- ID conflicts resolved using global algorithm\n- Result.Unchanged correctly tracks idempotent imports\n- TestThreeCloneCollision passes\n- All existing import tests still pass\n\n## Testing Strategy\n\n### Unit Tests\n- buildHashMap correctly indexes by content hash\n- buildIDMap correctly indexes by ID\n- handleRename deletes old, creates new, updates references\n\n### Integration Tests\n- Import same data twice β†’ idempotent\n- Import renamed issue β†’ handled correctly\n- Import with collision β†’ resolved globally\n- Final pull after 3-way collision β†’ all clones converge\n\n### Property Tests\n- Idempotency: Import(x); Import(x) ≑ Import(x)\n- Commutativity: Import(a); Import(b) ≑ Import(b); Import(a) (for non-colliding issues)\n- Convergence: After N rounds of sync, all clones identical\n\n## Files to Modify\n- internal/importer/importer.go (major refactor of ImportIssues)\n- internal/importer/importer_test.go (new tests)\n- cmd/bd/import_bug_test.go (update for new behavior)\n\n## Dependencies\n- Requires bd-cbed9619.5 (ContentHash field)\n- Requires bd-cbed9619.4 (read-only detection)\n- Requires bd-cbed9619.3 (global resolution)\n\n## Risk Mitigation\nMajor refactor of import logic. Recommend:\n1. Comprehensive tests before modifying\n2. Feature flag to enable/disable\n3. Keep old import code path for rollback\n4. Test with all existing import tests\n5. Manual testing with real repositories\n\n## Success Metrics\nAfter this phase:\n- TestThreeCloneCollision should PASS\n- All clones converge after final pull\n- Import is demonstrably idempotent\n- No data loss in N-way scenarios","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:38:25.671302-07:00","updated_at":"2025-10-30T17:12:58.229134-07:00","closed_at":"2025-10-28T20:21:39.529971-07:00","source_repo":".","dependencies":[{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.616846-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-28T18:39:28.360026-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-28T18:39:28.383624-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-cbed9619.3","type":"blocks","created_at":"2025-10-28T18:39:28.407157-07:00","created_by":"daemon"}]} -{"id":"bd-cbed9619.3","content_hash":"0e73695df08167b3c051641720402afc5de3666dcb52d72e969b10a7629ec781","title":"Implement global N-way collision resolution algorithm","description":"## Overview\nPhase 3: Replace pairwise collision resolution with global N-way resolution that produces deterministic results regardless of sync order.\n\n## Current Problem\nScoreCollisions (collision.go:228) compares issues pairwise:\n```go\ncollision.RemapIncoming = existingHash \u003c incomingHash\n```\n\nThis works for 2-way but fails for 3+ way because:\n- Each clone makes local decisions without global context\n- No guarantee intermediate states are consistent\n- Remapping decisions depend on sync order\n- Can't detect transitive remap chains (test-1 β†’ test-2 β†’ test-3)\n\n## Solution\nImplement global resolution that:\n1. Collects ALL versions of same logical issue\n2. Sorts by content hash (deterministic)\n3. Assigns sequential IDs based on sorted order\n4. All clones converge to same assignments\n\n## Implementation Tasks\n\n### 1. Create ResolveNWayCollisions function\nFile: internal/storage/sqlite/collision.go\n\nReplace ScoreCollisions with:\n```go\n// ResolveNWayCollisions handles N-way collisions deterministically.\n// Groups all versions with same base ID, sorts by content hash,\n// assigns sequential IDs. Returns mapping of old ID β†’ new ID.\nfunc ResolveNWayCollisions(ctx context.Context, s *SQLiteStorage,\n collisions []*CollisionDetail, incoming []*types.Issue) (map[string]string, error) {\n \n if len(collisions) == 0 {\n return make(map[string]string), nil\n }\n \n // Group by base ID pattern (e.g., test-1, test-2 β†’ base \"test-1\")\n groups := groupCollisionsByBaseID(collisions)\n \n idMapping := make(map[string]string)\n \n for baseID, versions := range groups {\n // 1. Collect all unique versions by content hash\n uniqueVersions := deduplicateVersionsByContentHash(versions)\n \n // 2. Sort by content hash (deterministic!)\n sort.Slice(uniqueVersions, func(i, j int) bool {\n return uniqueVersions[i].ContentHash \u003c uniqueVersions[j].ContentHash\n })\n \n // 3. Assign sequential IDs based on sorted order\n prefix := extractPrefix(baseID)\n baseNum := extractNumber(baseID)\n \n for i, version := range uniqueVersions {\n targetID := fmt.Sprintf(\"%s-%d\", prefix, baseNum+i)\n \n // Map this version to its deterministic ID\n if version.ID != targetID {\n idMapping[version.ID] = targetID\n }\n }\n }\n \n return idMapping, nil\n}\n```\n\n### 2. Implement helper functions\n\n```go\n// groupCollisionsByBaseID groups collisions by their logical base ID\nfunc groupCollisionsByBaseID(collisions []*CollisionDetail) map[string][]*types.Issue {\n groups := make(map[string][]*types.Issue)\n for _, c := range collisions {\n baseID := c.ID // All share same ID (that's why they collide)\n groups[baseID] = append(groups[baseID], c.ExistingIssue, c.IncomingIssue)\n }\n return groups\n}\n\n// deduplicateVersionsByContentHash keeps one issue per unique content hash\nfunc deduplicateVersionsByContentHash(issues []*types.Issue) []*types.Issue {\n seen := make(map[string]*types.Issue)\n for _, issue := range issues {\n if _, found := seen[issue.ContentHash]; !found {\n seen[issue.ContentHash] = issue\n }\n }\n result := make([]*types.Issue, 0, len(seen))\n for _, issue := range seen {\n result = append(result, issue)\n }\n return result\n}\n```\n\n### 3. Update handleCollisions in importer\nFile: internal/importer/importer.go\n\nReplace ScoreCollisions call with:\n```go\n// OLD:\nif err := sqlite.ScoreCollisions(ctx, sqliteStore, collisionResult.Collisions, allExistingIssues); err != nil {\n return nil, fmt.Errorf(\"failed to score collisions: %w\", err)\n}\n\n// NEW:\nidMapping, err := sqlite.ResolveNWayCollisions(ctx, sqliteStore, \n collisionResult.Collisions, issues)\nif err != nil {\n return nil, fmt.Errorf(\"failed to resolve collisions: %w\", err)\n}\n```\n\n### 4. Update RemapCollisions\nRemapCollisions currently uses collision.RemapIncoming field. Update to use idMapping directly:\n- Remove RemapIncoming logic\n- Use idMapping to determine what to remap\n- Simplify to just apply the computed mapping\n\n### 5. Add comprehensive tests\n\nTest cases:\n1. 3-way collision with different content β†’ 3 sequential IDs\n2. 3-way collision with 2 identical content β†’ 2 IDs (dedupe works)\n3. Sync order independence (Aβ†’Bβ†’C vs Cβ†’Aβ†’B produce same result)\n4. Content hash ordering is respected\n5. Works with 5+ clones\n\n## Acceptance Criteria\n- ResolveNWayCollisions implemented and replaces ScoreCollisions\n- Groups all versions of same ID together\n- Deduplicates by content hash\n- Sorts by content hash deterministically\n- Assigns sequential IDs starting from base ID\n- Returns complete mapping (old ID β†’ new ID)\n- All clones converge to same ID assignments\n- Works for arbitrary N-way collisions\n- TestThreeCloneCollision passes (or gets much closer)\n\n## Files to Modify\n- internal/storage/sqlite/collision.go (new function, helpers)\n- internal/importer/importer.go (call new function)\n- internal/storage/sqlite/collision_test.go (comprehensive tests)\n\n## Testing Strategy\n\n### Unit Tests\n- groupCollisionsByBaseID correctly groups\n- deduplicateVersionsByContentHash removes duplicates\n- Sorting by hash is stable and deterministic\n- Sequential ID assignment is correct\n\n### Integration Tests\n- 3-way collision resolves to 3 issues\n- Sync order doesn't affect final IDs\n- Content hash ordering determines winner\n\n### Property Tests\n- For any N clones with same content, all converge to same IDs\n- Idempotent: running resolution twice produces same result\n\n## Dependencies\n- Requires bd-cbed9619.5 (ContentHash field) to be completed first\n- Requires bd-cbed9619.4 (read-only detection) for clean integration\n\n## Notes\nThis is the core algorithm that enables convergence. The key insight:\n**Sort by content hash globally, not pairwise comparison.**","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:37:42.85616-07:00","updated_at":"2025-10-30T17:12:58.228707-07:00","closed_at":"2025-10-28T20:03:26.675257-07:00","source_repo":".","dependencies":[{"issue_id":"bd-cbed9619.3","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.593102-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.3","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-28T18:39:28.30886-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.3","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-28T18:39:28.336312-07:00","created_by":"daemon"}]} -{"id":"bd-cbed9619.4","content_hash":"ee2a96d5f3f3cd8a712f460b39c754848fcde8c5299f6b6fdcb2f9c78d8b9037","title":"Make DetectCollisions read-only (separate detection from modification)","description":"## Overview\nPhase 2: Separate collision detection from state modification to enable safe, composable collision resolution.\n\n## Current Problem\nDetectCollisions (collision.go:38-111) modifies database state during detection:\n- Line 83-86: Deletes issues when content matches but ID differs\n- This violates separation of concerns\n- Causes race conditions when processing multiple issues\n- Makes contentToDBIssue map stale after first deletion\n- Partial failures leave DB in inconsistent state\n\n## Solution\nMake DetectCollisions purely read-only. Move all modifications to a separate ApplyCollisionResolution function.\n\n## Implementation Tasks\n\n### 1. Add RenameDetail to CollisionResult\nFile: internal/storage/sqlite/collision.go\n```go\ntype CollisionResult struct {\n ExactMatches []string\n Collisions []*CollisionDetail\n NewIssues []string\n Renames []*RenameDetail // NEW\n}\n\ntype RenameDetail struct {\n OldID string // ID in database\n NewID string // ID in incoming\n Issue *types.Issue // The issue with new ID\n}\n```\n\n### 2. Remove deletion from DetectCollisions\nReplace lines 83-86:\n```go\n// OLD (DELETE THIS):\nif err := s.DeleteIssue(ctx, dbMatch.ID); err != nil {\n return nil, fmt.Errorf(\"failed to delete renamed issue...\")\n}\n\n// NEW (ADD THIS):\nresult.Renames = append(result.Renames, \u0026RenameDetail{\n OldID: dbMatch.ID,\n NewID: incoming.ID,\n Issue: incoming,\n})\ncontinue // Don't mark as NewIssue yet\n```\n\n### 3. Create ApplyCollisionResolution function\nNew function to apply all modifications atomically:\n```go\nfunc ApplyCollisionResolution(ctx context.Context, s *SQLiteStorage,\n result *CollisionResult, mapping map[string]string) error {\n \n // Phase 1: Handle renames (delete old IDs)\n for _, rename := range result.Renames {\n if err := s.DeleteIssue(ctx, rename.OldID); err != nil {\n return fmt.Errorf(\"failed to delete renamed issue %s: %w\", \n rename.OldID, err)\n }\n }\n \n // Phase 2: Create new IDs (from mapping)\n // Phase 3: Update references\n return nil\n}\n```\n\n### 4. Update callers to use two-phase approach\nFile: internal/importer/importer.go (handleCollisions)\n```go\n// Phase 1: Detect (read-only)\ncollisionResult, err := sqlite.DetectCollisions(ctx, sqliteStore, issues)\n\n// Phase 2: Resolve (compute mapping)\nmapping, err := sqlite.ResolveNWayCollisions(ctx, sqliteStore, collisionResult)\n\n// Phase 3: Apply (modify DB)\nerr = sqlite.ApplyCollisionResolution(ctx, sqliteStore, collisionResult, mapping)\n```\n\n### 5. Update tests\n- Verify DetectCollisions doesn't modify DB\n- Test ApplyCollisionResolution separately\n- Add test for rename detection without modification\n\n## Acceptance Criteria\n- DetectCollisions performs zero writes to database\n- DetectCollisions returns RenameDetail entries for content matches\n- ApplyCollisionResolution handles all modifications\n- All existing tests still pass\n- New test verifies read-only detection\n- contentToDBIssue map stays consistent throughout detection\n\n## Files to Modify\n- internal/storage/sqlite/collision.go (DetectCollisions, new function)\n- internal/importer/importer.go (handleCollisions caller)\n- internal/storage/sqlite/collision_test.go (add tests)\n\n## Testing\n- Unit test: DetectCollisions with content match doesn't delete DB issue\n- Unit test: RenameDetail correctly populated\n- Unit test: ApplyCollisionResolution applies renames\n- Integration test: Full flow still works end-to-end\n\n## Risk Mitigation\nThis is a significant refactor of core collision logic. Recommend:\n1. Add comprehensive tests before modifying\n2. Use feature flag to enable/disable new behavior\n3. Test thoroughly with TestTwoCloneCollision first","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:37:09.652326-07:00","updated_at":"2025-10-30T17:12:58.228266-07:00","closed_at":"2025-10-28T19:08:17.715416-07:00","source_repo":".","dependencies":[{"issue_id":"bd-cbed9619.4","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.570276-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.4","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-28T18:39:28.285653-07:00","created_by":"daemon"}]} -{"id":"bd-cbed9619.5","content_hash":"12cd30dee3c08ba58d03e4468e6fe261a47d58c3b75397d9f14f38ee644fab6e","title":"Add content-addressable identity to Issue type","description":"## Overview\nPhase 1: Add content hashing to enable global identification of issues regardless of their assigned IDs.\n\n## Current Problem\nThe system identifies issues only by ID (e.g., test-1, test-2). When multiple clones create the same ID with different content, there's no way to identify that these are semantically different issues without comparing all fields.\n\n## Solution\nAdd a ContentHash field to the Issue type that represents the canonical content fingerprint.\n\n## Implementation Tasks\n\n### 1. Add ContentHash field to Issue type\nFile: internal/types/types.go\n```go\ntype Issue struct {\n ID string\n ContentHash string // SHA256 of canonical content\n // ... existing fields\n}\n```\n\n### 2. Add content hash computation method\nUse existing hashIssueContent from collision.go:186 as foundation:\n```go\nfunc (i *Issue) ComputeContentHash() string {\n return hashIssueContent(i)\n}\n```\n\n### 3. Compute hash at creation time\n- Modify CreateIssue to compute and store ContentHash\n- Modify CreateIssues (batch) to compute hashes\n\n### 4. Compute hash at import time \n- Modify ImportIssues to compute ContentHash for all incoming issues\n- Store hash in database\n\n### 5. Add database column\n- Add migration to add content_hash column to issues table\n- Update SELECT/INSERT statements to include content_hash\n- Index on content_hash for fast lookups\n\n### 6. Populate existing issues\n- Add migration step to compute ContentHash for all existing issues\n- Use hashIssueContent function\n\n## Acceptance Criteria\n- Issue type has ContentHash field\n- Hash is computed automatically at creation time\n- Hash is computed for imported issues\n- Database stores content_hash column\n- All existing issues have non-empty ContentHash\n- Hash is deterministic (same content β†’ same hash)\n- Hash excludes ID, timestamps (only semantic content)\n\n## Files to Modify\n- internal/types/types.go\n- internal/storage/sqlite/sqlite.go (schema, CreateIssue, CreateIssues)\n- internal/storage/sqlite/migrations.go (new migration)\n- internal/importer/importer.go (compute hash during import)\n- cmd/bd/create.go (compute hash at creation)\n\n## Testing\n- Unit test: same content produces same hash\n- Unit test: different content produces different hash \n- Unit test: hash excludes ID and timestamps\n- Integration test: hash persists in database\n- Migration test: existing issues get hashes populated","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:36:44.914967-07:00","updated_at":"2025-10-30T17:12:58.2279-07:00","closed_at":"2025-10-28T18:57:10.985198-07:00","source_repo":".","dependencies":[{"issue_id":"bd-cbed9619.5","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.547325-07:00","created_by":"daemon"}]} -{"id":"bd-cc03","content_hash":"f1e8dcfd29cd9830ae91a044a799a750085fc9139e822c656b0575fa132b9bfa","title":"Build Node.js CLI wrapper for WASM","description":"Create npm package that wraps bd.wasm. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Set up npm package structure (package.json)\n- [ ] Implement CLI argument parsing\n- [ ] Load and execute WASM module\n- [ ] Handle stdout/stderr correctly\n- [ ] Support --json flag for all commands\n- [ ] Add bd-wasm bin script\n\n## Success Criteria\n- bd-wasm ready --json works identically to bd\n- All core commands supported","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-02T18:33:31.310268-08:00","updated_at":"2025-11-05T00:55:48.758194-08:00","closed_at":"2025-11-05T00:55:48.758198-08:00","source_repo":".","dependencies":[{"issue_id":"bd-cc03","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.311017-08:00","created_by":"daemon"}]} -{"id":"bd-cc4f","content_hash":"bf918bc22aedff9e04e09591d0469cdf508345a91a28b66f8ac2e35ab5c05949","title":"Implement TryResurrectParent function","description":"Create internal/storage/sqlite/resurrection.go with TryResurrectParent(ctx, parentID) function. Parse JSONL history to find deleted parent, create tombstone with status=deleted and is_tombstone=true flag. Handle recursive resurrection for multi-level missing parents (bd-abc.1.2 with missing bd-abc and bd-abc.1).","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-04T12:31:59.61107-08:00","updated_at":"2025-11-05T00:08:42.813998-08:00","closed_at":"2025-11-05T00:08:42.814-08:00","source_repo":"."} -{"id":"bd-cdf7","content_hash":"50ba3c5bc3a0f06ebd20dd9b373086e0ecd218eea56a9edbef321f4e042115a4","title":"Add tests for DetectCycles to improve coverage from 29.6%","description":"DetectCycles currently has 29.6% coverage. Need comprehensive tests for:\n- Simple cycles (A-\u003eB-\u003eA)\n- Complex multi-node cycles\n- Acyclic graphs (should not detect cycles)\n- Self-loops\n- Multiple independent cycles\n- Edge cases (empty graph, single node)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-01T22:40:58.977156-07:00","updated_at":"2025-11-01T22:52:02.243223-07:00","closed_at":"2025-11-01T22:52:02.243223-07:00","source_repo":"."} -{"id":"bd-ce37850f","content_hash":"c31f96602e91797883758c5a5b778a148257959256605fca6378bbbc22c54ccc","title":"Add embedding generation for duplicate detection","description":"Use embeddings for scalable duplicate detection.\n\nModel: text-embedding-3-small (OpenAI) or all-MiniLM-L6-v2 (local)\nStorage: SQLite vector extension or in-memory\nCost: ~/bin/bash.0002 per 100 issues\n\nMuch cheaper than LLM comparisons for large databases.\n\nFiles: internal/embeddings/ (new package)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T14:48:29.072913-07:00","updated_at":"2025-11-06T19:36:13.972562-08:00","closed_at":"2025-11-06T19:27:25.234801-08:00","source_repo":"."} -{"id":"bd-ce75","content_hash":"025d43c12e9cc08c6d1db0b4a97f7a086a1a9f24f07769d48a7e2666d04ea217","title":"Test parent issue","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-07T16:08:24.952167-08:00","updated_at":"2025-11-07T22:07:17.343848-08:00","closed_at":"2025-11-07T22:07:17.34385-08:00","source_repo":"."} -{"id":"bd-cf349eb3","content_hash":"1b42289a0cb1da0626a69c6f004bf62fc9ba6e3a0f8eb70159c5f1446497020b","title":"Update LINTING.md with current baseline","description":"After cleanup, document the remaining acceptable baseline in LINTING.md so we can track regression.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T19:43:48.755997-05:00","updated_at":"2025-11-20T19:43:48.755997-05:00","closed_at":"2025-11-07T10:55:55.985273-08:00","source_repo":"."} -{"id":"bd-chsc","content_hash":"ea167029efad3c506e42dfc20748a6ada0914aa93cb04caa14a48ca223386365","title":"Test lowercase p0","description":"","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-05T12:58:41.457875-08:00","updated_at":"2025-11-05T12:58:44.721486-08:00","closed_at":"2025-11-05T12:58:44.721486-08:00","source_repo":"."} -{"id":"bd-cjxp","content_hash":"2a2c0aa49be01be64c5e0a6bd24ebd7b762846d31a06fd8e9360672fb476b879","title":"Bug P0","description":"","status":"closed","priority":0,"issue_type":"bug","assignee":"alice","created_at":"2025-11-07T19:00:22.536449-08:00","updated_at":"2025-11-07T22:07:17.345535-08:00","closed_at":"2025-11-07T21:55:09.429643-08:00","source_repo":"."} -{"id":"bd-ckvw","content_hash":"a4b27c0e21e3ae0a1e8fb9f64913c286164ff6746c657d70bb7cbbdbf2e365c9","title":"Add schema compatibility probe to prevent silent migration failures","description":"Issue #262 revealed a serious bug: migrations may fail silently, causing UNIQUE constraint errors later.\n\nRoot cause:\n- sqlite.New() runs migrations once on open\n- checkVersionMismatch() prints 'database will be upgraded automatically' but only updates metadata\n- If migrations fail or daemon runs older version, queries expecting new columns fail with 'no such column'\n- Import logic misinterprets this as 'not found' and tries INSERT on existing ID\n- Result: UNIQUE constraint failed: issues.id\n\nFix strategy (minimal):\n1. Add schema probe in sqlite.New() after RunMigrations\n - SELECT all expected columns from all tables with LIMIT 0\n - If fails, retry RunMigrations and probe again\n - If still fails, return fatal error with clear message\n2. Fix checkVersionMismatch to not claim 'will upgrade' unless probe passes\n3. Only update bd_version after successful migration probe\n4. Add schema verification before import operations\n5. Map 'no such column' errors to clear actionable message\n\nRelated: #262","design":"Minimal path (now includes daemon gating):\n\n1. Schema probe in sqlite.New()\n - After RunMigrations, verify all expected columns exist\n - SELECT id, title, description, created_at, updated_at, closed_at, content_hash, external_ref, source_repo, compacted_at, compacted_at_commit FROM issues LIMIT 0\n - Also probe: dependencies, labels, events, dirty_issues, export_hashes, snapshots, child_counters\n - If probe fails: retry RunMigrations once, probe again\n - If still fails: return fatal error with missing columns/tables\n\n2. Fix checkVersionMismatch()\n - Don't claim 'will be upgraded automatically' unless probe verified\n - Only update bd_version after successful probe\n\n3. Better error surfacing\n - Wrap storage errors: if 'no such column/table', return ErrSchemaIncompatible\n - Actionable message: 'Database schema is incompatible. Run bd doctor to diagnose.'\n\n4. Add 'bd doctor' command\n - Runs migrations + probe\n - Reports missing columns/tables\n - Suggests fixes (upgrade daemon, run migrations manually, etc.)\n - Exit 1 if incompatible\n\n5. Daemon version gating (REQUIRED - prevents future schema bugs)\n - On RPC connect, client/daemon exchange semver\n - If client.minor \u003e daemon.minor: refuse RPC, print 'Client vX.Y requires daemon upgrade. Run: bd daemons killall'\n - Forces users to restart daemon when bd binary is upgraded\n - Prevents stale daemon serving requests with old schema assumptions\n - Already documented best practice, now enforced\n\nEstimated effort: M-L (3-5h with daemon gating + bd doctor)","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-08T13:23:26.934246-08:00","updated_at":"2025-11-08T13:53:29.219542-08:00","closed_at":"2025-11-08T13:53:29.219542-08:00","source_repo":"."} -{"id":"bd-csvy","content_hash":"88e2ed15c2fe9d9622b16daa530907af7069ef69e621c74dc2a2fafa1da4ac8c","title":"Add tests for merge driver auto-config in bd init","description":"Add comprehensive tests for the merge driver auto-configuration functionality in `bd init`.\n\n**Test cases needed:**\n- Auto-install in quiet mode\n- Skip with --skip-merge-driver flag\n- Detect already-installed merge driver\n- Append to existing .gitattributes\n- Interactive prompt behavior (if feasible)\n\n**File:** `cmd/bd/init_test.go`","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T19:27:04.133078-08:00","updated_at":"2025-11-06T18:19:16.233673-08:00","closed_at":"2025-11-06T15:56:36.014814-08:00","source_repo":".","dependencies":[{"issue_id":"bd-csvy","depends_on_id":"bd-32nm","type":"discovered-from","created_at":"2025-11-05T19:27:04.134299-08:00","created_by":"daemon"}]} -{"id":"bd-d19a","content_hash":"5ff9ba5e70c3e3eeaff40887421797e30dfb75e56e97fcaaf3f3d32332f22aa2","title":"Fix import failure on missing parent issues","description":"Import process fails atomically when JSONL references deleted parent issues. Implement hybrid solution: topological sorting + parent resurrection to handle deleted parents gracefully while maintaining referential integrity. See docs/import-bug-analysis-bd-3xq.md for full analysis.","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-11-04T12:31:30.994759-08:00","updated_at":"2025-11-05T00:08:42.814239-08:00","closed_at":"2025-11-05T00:08:42.814243-08:00","source_repo":"."} -{"id":"bd-d33c","content_hash":"d0820d5dd6ea4ab198e013861d3d7d01da701daa8ab8ec59ad5ef855e6f83b2b","title":"Separate process/lock/PID concerns into process.go","description":"Create internal/daemonrunner/process.go with: acquireDaemonLock, PID file read/write, stopDaemon, isDaemonRunning, getPIDFilePath, socket path helpers, version check.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.871122-07:00","updated_at":"2025-11-01T23:43:55.66159-07:00","closed_at":"2025-11-01T23:43:55.66159-07:00","source_repo":"."} -{"id":"bd-d355a07d","content_hash":"e5e88defa034e6758f63ac603963209245ab74f531510366b25ebbf7b4be36b3","title":"Import validation falsely reports data loss on collision resolution","description":"## Problem\n\nPost-import validation reports 'data loss detected!' when import count reduces due to legitimate collision resolution.\n\n## Example\n\n```\nImport complete: 1 created, 8 updated, 142 unchanged, 19 skipped, 1 issues remapped\nPost-import validation failed: import reduced issue count: 165 β†’ 164 (data loss detected!)\n```\n\nThis was actually successful collision resolution (bd-70419816 duplicated β†’ remapped to-70419816), not data loss.\n\n## Impact\n\n- False alarms waste investigation time\n- Undermines confidence in import validation\n- Confuses users/agents about sync health\n\n## Solution\n\nImprove validation to distinguish:\n- Collision-resolution merges (expected count reduction)\n- Actual data loss (unexpected disappearance)\n\nTrack remapped issue count and adjust expected post-import count accordingly.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-29T23:15:00.815227-07:00","updated_at":"2025-11-08T01:58:15.283088-08:00","closed_at":"2025-11-08T00:33:04.659308-08:00","source_repo":"."} -{"id":"bd-d3e5","content_hash":"2eaf57cb617922924aadb6b04366a3ef058d386752c65e8471f2704b512ea30a","title":"Test issue 2","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T09:44:17.116768539Z","updated_at":"2025-11-08T03:09:48.249933-08:00","closed_at":"2025-11-08T03:09:48.249936-08:00","source_repo":"."} -{"id":"bd-d3f0","content_hash":"d759327f1a1e4817d3e8ec212fd6af2607d0bb5e654201a6fc3640ad0a3b18fd","title":"Add 'bd comment' as alias for 'bd comments add'","description":"The command 'bd comments add' is verbose and unintuitive. Add 'bd comment' as a shorter alias that works the same way.\n\n## Rationale\n- More natural: 'bd comment \u003cissue-id\u003e \u003ctext\u003e' reads better than 'bd comments add \u003cissue-id\u003e \u003ctext\u003e'\n- Matches user expectations: users naturally try 'bd comment' first\n- Follows convention: other commands like 'bd create', 'bd show', 'bd close' are verbs\n\n## Implementation\nCould be implemented as:\n1. A new command that wraps bd comments add\n2. An alias registered in cobra\n3. Keep 'bd comments add' for backwards compatibility\n\n## Examples\n```bash\nbd comment bd-1234 'This is a comment'\nbd comment bd-1234 'Multi-line comment' --body 'Additional details here'\n```","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-02T17:13:18.82563-08:00","updated_at":"2025-11-03T22:20:30.223939-08:00","closed_at":"2025-11-03T22:20:30.223939-08:00","source_repo":"."} -{"id":"bd-d4ec5a82","content_hash":"e0f9aa493571fdb0b5fd578993165042ad224bb2c00186564337732e6221d529","title":"Add MCP functions for repair commands","description":"Add repair commands to beads-mcp for agent access:\n- beads_resolve_conflicts()\n- beads_find_duplicates()\n- beads_detect_pollution()\n- beads_validate()\n\nFiles: integrations/beads-mcp/src/beads_mcp/server.py","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T14:48:29.071495-07:00","updated_at":"2025-11-06T19:36:13.972786-08:00","closed_at":"2025-11-06T19:27:19.170894-08:00","source_repo":"."} -{"id":"bd-d4i","content_hash":"41cafb4bfa5377a84005b08cddd3e703c1317e98ef32b050ddaabf1bdc7718c9","title":"Create tip system infrastructure for contextual hints","description":"Implement a tip/hint system that shows helpful contextual messages after successful commands. This is different from the existing error-path \"Hint:\" messages - tips appear on success paths to educate users about features they might not know about.","design":"## Implementation\n\nCreate `cmd/bd/tips.go` with:\n\n### Core Infrastructure\n```go\ntype Tip struct {\n ID string\n Condition func() bool // Should this tip be eligible?\n Message string\n Frequency time.Duration // Minimum gap between showings\n Priority int // Higher = shown first when eligible\n Probability float64 // 0.0 to 1.0 - chance of showing\n}\n\nfunc maybeShowTip(store storage.Storage) {\n if jsonOutput || quietMode {\n return // Respect output flags\n }\n \n tip := selectNextTip(store)\n if tip != nil {\n fmt.Fprintf(os.Stdout, \"\\nπŸ’‘ Tip: %s\\n\", tip.Message)\n recordTipShown(store, tip.ID)\n }\n}\n\nfunc selectNextTip(store storage.Storage) *Tip {\n now := time.Now()\n var eligibleTips []Tip\n \n // Filter to eligible tips (condition + frequency check)\n for _, tip := range tips {\n if !tip.Condition() {\n continue\n }\n \n lastShown := getLastShown(store, tip.ID)\n if !lastShown.IsZero() \u0026\u0026 now.Sub(lastShown) \u003c tip.Frequency {\n continue\n }\n \n eligibleTips = append(eligibleTips, tip)\n }\n \n if len(eligibleTips) == 0 {\n return nil\n }\n \n // Sort by priority (highest first)\n sort.Slice(eligibleTips, func(i, j int) bool {\n return eligibleTips[i].Priority \u003e eligibleTips[j].Priority\n })\n \n // Apply probability roll (in priority order)\n for _, tip := range eligibleTips {\n if rand.Float64() \u003c tip.Probability {\n return \u0026tip\n }\n }\n \n return nil // No tips won probability roll\n}\n```\n\n### Probability Examples\n\n```go\n// High priority, high probability = shows often\n{Priority: 90, Probability: 0.8} // 80% chance when eligible\n\n// High priority, medium probability = important but not spammy\n{Priority: 100, Probability: 0.6} // 60% chance\n\n// Low priority, low probability = rare suggestion\n{Priority: 30, Probability: 0.3} // 30% chance\n```\n\n### Metadata Storage\nUse existing metadata table to track:\n- `tip_{id}_last_shown` - Timestamp of last display (RFC3339 format)\n- `tip_{id}_dismissed` - User permanently dismissed (future feature)\n\n### Integration Points\nCall `maybeShowTip()` at end of:\n- `bd list` - After showing issues\n- `bd ready` - After showing ready work\n- `bd create` - After creating issue\n- `bd show` - After showing issue details\n\n## Design Decisions\n- Tips shown on stdout (informational, not errors)\n- Respects `--json` and `--quiet` flags\n- Frequency enforces minimum gap between showings\n- Priority determines evaluation order\n- Probability reduces spam (not every eligible tip shows)\n- Store state in metadata table (no new files)\n- Deterministic seed for testing (optional BEADS_TIP_SEED env var)","acceptance_criteria":"- Tip infrastructure exists in cmd/bd/tips.go\n- Tips respect --json and --quiet flags\n- Frequency tracking works (no spam)\n- Metadata table stores tip state\n- Unit tests for tip selection logic\n- Documentation in code comments","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:29:15.693956-08:00","updated_at":"2025-11-11T23:49:50.812933-08:00","source_repo":"."} -{"id":"bd-d68f","content_hash":"1c806ae9c39bb28faaa8730350ce6b20bc25821e33583f537db1567b183bce6d","title":"Add tests for Comments API (AddIssueComment, GetIssueComments)","description":"Comments API currently has 0% coverage. Need tests for:\n- AddIssueComment - adding comments to issues\n- GetIssueComments - retrieving comments\n- Comment ordering and pagination\n- Edge cases (non-existent issues, empty comments)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-01T22:40:58.980688-07:00","updated_at":"2025-11-01T22:53:42.124391-07:00","closed_at":"2025-11-01T22:53:42.124391-07:00","source_repo":"."} -{"id":"bd-d6aq","content_hash":"45a169a72749bb3bc93190bb3e5891950409f264baeac4394cd1a3ad5a75c0f2","title":"Test reservation expiration and renewal","description":"Verify TTL-based reservation expiration works correctly.\n\nAcceptance Criteria:\n- Reserve with short TTL (30s)\n- Verify other agents can't claim\n- Wait for expiration\n- Verify reservation auto-released\n- Other agent can now claim\n- Test renewal/heartbeat mechanism\n\nFile: tests/integration/test_reservation_ttl.py","notes":"Implemented comprehensive TTL/expiration test suite in tests/integration/test_reservation_ttl.py\n\nTest Coverage:\nβœ… Short TTL reservations (30s) - verifies TTL is properly set\nβœ… Reservation blocking - confirms agent2 cannot claim while agent1 holds reservation\nβœ… Auto-release after expiration - validates expired reservations are auto-cleaned and become available\nβœ… Renewal/heartbeat - tests that re-reserving extends expiration time\n\nAll 4 tests passing in 56.9s total (including 30s+ wait time for expiration tests).\n\nMock server implements full TTL management:\n- Reservation class with expiration tracking\n- Auto-cleanup of expired reservations on each request\n- Renewal support (same agent re-reserving)\n- 409 conflict for cross-agent reservation attempts","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T22:43:21.547821-08:00","updated_at":"2025-11-08T02:24:30.296982-08:00","closed_at":"2025-11-08T02:24:30.296982-08:00","source_repo":".","dependencies":[{"issue_id":"bd-d6aq","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T22:43:21.548731-08:00","created_by":"daemon"}]} -{"id":"bd-d76d","content_hash":"b65da5fe9f89a98f1e6fad6ee32d463126ef72785fec4d6dfa5a4774c6a8a393","title":"Modify EnsureIDs to support parent resurrection","description":"Update internal/storage/sqlite/ids.go:189-202 to call TryResurrectParent before failing on missing parent. Add resurrection mode flag, log resurrected parents for transparency. Maintain backwards compatibility with strict validation mode.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-04T12:31:59.659507-08:00","updated_at":"2025-11-05T00:08:42.814463-08:00","closed_at":"2025-11-05T00:08:42.814466-08:00","source_repo":"."} -{"id":"bd-d7e88238","content_hash":"ff14f04a04bf89f52bda3d584933df6b09b554cce8665f47f429f1ac52dafb94","title":"Rapid 3","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.459655-07:00","updated_at":"2025-11-07T23:21:44.925275-08:00","closed_at":"2025-11-07T23:18:52.333825-08:00","source_repo":"."} -{"id":"bd-d84j","content_hash":"72866210b9be677fae063d331cfffcdfe6a1243fd069c80b72c34b719aba7361","title":"Fix PR #319: Performance Improvements - CI failures and lint errors","description":"PR #319 (Performance Improvements) has excellent performance optimizations but is blocked by CI failures.\n\n## The PR\n- URL: https://github.com/steveyegge/beads/pull/319\n- Author: @rsnodgrass (Ryan)\n- Claimed improvements: bd ready 20.5x faster (752ms β†’ 36.6ms), startup 10.5x faster\n\n## CI Failures\n\n### Lint Errors (8 total)\n1. cmd/bd/deletion_tracking.go:57 - unchecked os.Remove\n2. cmd/bd/import.go:548 - unchecked os.RemoveAll\n3. cmd/bd/message.go:205 - unchecked resp.Body.Close\n4. cmd/bd/migrate_issues.go:633 - unchecked fmt.Scanln\n5. cmd/bd/migrate_issues.go:701 - unchecked MarkFlagRequired\n6. cmd/bd/migrate_issues.go:702 - unchecked MarkFlagRequired\n7. cmd/bd/show.go:610 - gosec G104 unhandled error\n8. cmd/bd/show.go:614 - gosec G104 unhandled error\n\n### Test Failures\nAll syncbranch_test.go tests failing with:\n\"migration external_ref_column failed: failed to create index on external_ref: sqlite3: SQL logic error: no such table: main.issues\"\n\nThis suggests the PR branch needs rebasing on current main.\n\n## Required Work\n\n### 1. Fix Lint Errors\nAdd proper error handling for all 8 flagged locations. Most can use _ = or log warnings.\n\n### 2. Rebase on Current Main\nThe migration test failures indicate the branch is out of sync. Need to:\n- git fetch upstream\n- git rebase upstream/main\n- Resolve any conflicts\n- Verify tests pass locally\n\n### 3. Verify CI Passes\n- All lint checks green\n- All tests pass (Linux, Windows, Nix)\n\n## Optional Improvements\n- Consider splitting into smaller PRs (core index, WASM cache, testing infra)\n- Add documentation for benchmark usage\n- Extract helper functions in doctor/perf.go for better testability\n\n## Value\nThis PR delivers real performance improvements. The index optimization alone is worth merging quickly once CI is fixed.","design":"Workflow:\n1. Checkout PR branch locally\n2. Rebase on current main\n3. Fix all 8 lint errors\n4. Run full test suite locally\n5. Push updated branch\n6. Verify CI passes\n7. Request re-review from maintainers","acceptance_criteria":"- All lint errors fixed\n- All tests passing on all platforms\n- PR rebased on current main\n- CI checks all green","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-15T12:24:34.50322-08:00","updated_at":"2025-11-15T12:43:11.49933-08:00","closed_at":"2025-11-15T12:43:11.49933-08:00","source_repo":"."} -{"id":"bd-d9e0","content_hash":"de4e01414f8863b63cb693a709048b85c3f4417f03e7d7b2528560076be0e1f7","title":"Extract validation functions to validators.go","description":"Move validatePriority, validateStatus, validateIssueType, validateTitle, validateEstimatedMinutes, validateFieldUpdate to validators.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.915909-07:00","updated_at":"2025-11-02T12:32:00.159298-08:00","closed_at":"2025-11-02T12:32:00.1593-08:00","source_repo":"."} -{"id":"bd-da96-baseline-lint","content_hash":"e4d4a2d3ef8082c42c6b39a3b73f26ff29ff1639f5f5f78f48e6ef71bb587068","title":"Baseline quality gate failure: lint","description":"The lint quality gate is failing on the baseline (main branch).\n\nThis blocks the executor from claiming work until fixed.\n\nError: golangci-lint failed: exit status 1\n\nOutput:\n```\ncmd/bd/search.go:39:12: Error return value of `cmd.Help` is not checked (errcheck)\n\t\t\tcmd.Help()\n\t\t\t ^\ncmd/bd/clean.go:118:15: G304: Potential file inclusion via variable (gosec)\n\tfile, err := os.Open(gitignorePath)\n\t ^\ncmd/bd/doctor/gitignore.go:98:12: G306: Expect WriteFile permissions to be 0600 or less (gosec)\n\tif err := os.WriteFile(gitignorePath, []byte(GitignoreTemplate), 0644); err != nil {\n\t ^\ncmd/bd/merge.go:121:16: G204: Subprocess launched with variable (gosec)\n\t\t\tgitRmCmd := exec.Command(\"git\", \"rm\", \"-f\", \"--quiet\", fullPath)\n\t\t\t ^\ncmd/bd/doctor.go:167:20: `cancelled` is a misspelling of `canceled` (misspell)\n\t\tfmt.Println(\"Fix cancelled.\")\n\t\t ^\ncmd/bd/flush_manager.go:139:42: `cancelling` is a misspelling of `canceling` (misspell)\n\t\t// Send shutdown request FIRST (before cancelling context)\n\t\t ^\ncmd/bd/flush_manager.go:261:15: `cancelled` is a misspelling of `canceled` (misspell)\n\t\t\t// Context cancelled (shouldn't normally happen)\n\t\t\t ^\ncmd/bd/flush_manager.go:269:55: (*FlushManager).performFlush - result 0 (error) is always nil (unparam)\nfunc (fm *FlushManager) performFlush(fullExport bool) error {\n ^\n8 issues:\n* errcheck: 1\n* gosec: 3\n* misspell: 3\n* unparam: 1\n\n```","design":"Fix the lint gate failures reported above.","acceptance_criteria":"- lint gate passes on main branch\n- Preflight check succeeds\n- Executor can resume claiming work","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:17:25.963791-05:00","updated_at":"2025-11-21T10:25:33.537845-05:00","closed_at":"2025-11-21T10:25:33.53596-05:00","source_repo":".","labels":["baseline-failure","gate:lint","system"]} -{"id":"bd-dcd6f14b","content_hash":"c07a4b8a39e6e81513278ee335fe14aa767cbcba72e3b511cfd95705053483b1","title":"Batch test 4","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:02.053523-07:00","updated_at":"2025-10-31T12:00:43.182861-07:00","closed_at":"2025-10-31T12:00:43.182861-07:00","source_repo":"."} -{"id":"bd-dd6f6d26","content_hash":"1ac634b2515cb7f7738f06bc3ad083d02025bc915aca7eae690c9dcc1a552878","title":"Fix autoimport tests for content-hash collision scoring","description":"## Overview\nThree autoimport tests are failing after [deleted:bd-cbed9619.4] because they expect behavior based on the old reference-counting collision resolution, but the system now uses deterministic content-hash scoring.\n\n## Failing Tests\n1. `TestAutoImportMultipleCollisionsRemapped` - expects local versions preserved\n2. `TestAutoImportAllCollisionsRemapped` - expects local versions preserved \n3. `TestAutoImportCollisionRemapMultipleFields` - expects specific collision resolution behavior\n\n## Root Cause\nThese tests were written when ScoreCollisions used reference counting to determine which version to keep. Now it uses content-hash comparison (introduced in commit 2e87329), which produces different but deterministic results.\n\n## Example\nOld behavior: Issue with more references would be kept\nNew behavior: Issue with lexicographically lower content hash is kept\n\n## Solution\nUpdate each test to:\n1. Verify the new content-hash based behavior is correct\n2. Check that the remapped issue (not necessarily local/remote) has the expected content\n3. Ensure dependencies are preserved on the correct remapped issue\n\n## Acceptance Criteria\n- All three autoimport tests pass\n- Tests verify content-hash determinism (same collision always resolves the same way)\n- Tests check dependency preservation on remapped issues\n- Test documentation explains content-hash scoring expectations\n\n## Files to Modify\n- `cmd/bd/autoimport_collision_test.go`\n\n## Testing\nRun: `go test ./cmd/bd -run \"TestAutoImport.*Collision\" -v`","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T03:09:48.253086-08:00","updated_at":"2025-11-20T19:43:48.756262-05:00","closed_at":"2025-11-08T02:28:35.317704-08:00","source_repo":".","dependencies":[{"issue_id":"bd-dd6f6d26","depends_on_id":"bd-cbed9619.4","type":"discovered-from","created_at":"2025-10-28T19:12:56.345276-07:00","created_by":"daemon"}]} -{"id":"bd-de0h","content_hash":"8b8b43683607e73012cf8bd7cf8631c6ae34498d0c93ca5b77d3f68944c8088d","title":"bd message: Add HTTP client timeout to prevent hangs","description":"HTTP client in `sendAgentMailRequest` uses default http.Post with no timeout.\n\n**Location:** cmd/bd/message.go:181\n\n**Problem:**\n- Can hang indefinitely if server is unresponsive\n- No way to cancel stuck requests\n- Poor UX in flaky networks\n\n**Fix:**\n```go\nclient := \u0026http.Client{Timeout: 30 * time.Second}\nresp, err := client.Post(url, \"application/json\", bytes.NewReader(reqBody))\n```\n\n**Impact:** Production reliability and security issue","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-08T12:54:24.942645-08:00","updated_at":"2025-11-08T12:56:59.948929-08:00","closed_at":"2025-11-08T12:56:59.948929-08:00","source_repo":".","dependencies":[{"issue_id":"bd-de0h","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.860847-08:00","created_by":"daemon"}]} -{"id":"bd-df11","content_hash":"9d688c3fe5f4994ab29ed22c8c4ae467f2069c4cbb676a2168303b2ffcba48c4","title":"Add import metrics for external_ref matching statistics","description":"Add observability for external_ref matching behavior during imports to help debug and optimize import operations.\n\nMetrics to track:\n- Number of issues matched by external_ref\n- Number of issues matched by ID\n- Number of issues matched by content hash\n- Number of external_ref updates vs creates\n- Average import time with vs without external_ref\n\nOutput format:\n- Add to ImportResult struct\n- Include in import command output\n- Consider structured logging\n\nUse cases:\n- Debugging slow imports\n- Understanding match distribution\n- Optimizing import performance\n\nRelated: bd-1022","status":"closed","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:46.157899-08:00","updated_at":"2025-11-08T02:24:24.686136-08:00","closed_at":"2025-11-08T02:20:01.01371-08:00","source_repo":"."} -{"id":"bd-df190564","content_hash":"4966d22faf43b7de1b27315f85365d7ed896741e4e589ed01ee16f4c2f600a24","title":"bd repair-deps - Orphaned dependency cleaner","description":"Find and fix orphaned dependency references.\n\nImplementation:\n- Scan all issues for dependencies pointing to non-existent issues\n- Report orphaned refs\n- Auto-fix with --fix flag\n- Interactive mode with --interactive\n\nFiles: cmd/bd/repair_deps.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.852745-07:00","updated_at":"2025-10-31T18:24:19.418221-07:00","closed_at":"2025-10-31T18:24:19.418221-07:00","source_repo":"."} -{"id":"bd-dow9","content_hash":"5fa420f7eb64396bcd8a58626ae82209d9d75da474a03847d4fbaba76a953846","title":"Improve CheckStaleness error handling","description":"## Problem\n\nCheckStaleness returns 'false' (not stale) for multiple error conditions instead of returning errors. This masks problems.\n\n**Location:** internal/autoimport/autoimport.go:253-285\n\n## Edge Cases That Return False\n\n1. **Invalid last_import_time format** (line 259-262)\n - Corrupted metadata returns 'not stale'\n - Could show stale data\n\n2. **No JSONL file found** (line 267-277)\n - If glob fails, falls back to 'issues.jsonl'\n - If that's empty, returns 'not stale'\n\n3. **JSONL stat fails** (line 279-282)\n - Permission denied, file missing\n - Returns 'not stale' even though can't verify\n\n## Current Code\n\n```go\nlastImportTime, err := time.Parse(time.RFC3339, lastImportStr)\nif err \\!= nil {\n return false, nil // ← Should return error\n}\n\n// ...\n\nif jsonlPath == \"\" {\n return false, nil // ← Should return error\n}\n\nstat, err := os.Stat(jsonlPath)\nif err \\!= nil {\n return false, nil // ← Should return error\n}\n```\n\n## Fix\n\n```go\nlastImportTime, err := time.Parse(time.RFC3339, lastImportStr)\nif err \\!= nil {\n return false, fmt.Errorf(\"corrupted last_import_time: %w\", err)\n}\n\n// ...\n\nif jsonlPath == \"\" {\n return false, fmt.Errorf(\"no JSONL file found\")\n}\n\nstat, err := os.Stat(jsonlPath)\nif err \\!= nil {\n return false, fmt.Errorf(\"cannot stat JSONL: %w\", err)\n}\n```\n\n## Impact\nMedium - edge cases are rare but should be handled\n\n## Effort \n30 minutes - requires updating callers in RPC server\n\n## Dependencies\nRequires: bd-n4td (warning on errors)","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:16:45.658965-05:00","updated_at":"2025-11-20T20:16:45.658965-05:00","source_repo":"."} -{"id":"bd-dvd","content_hash":"207b86533de2134df473186c3f6a83b823943ae263ad0a52fda60c282292b66e","title":"GetNextChildID doesn't attempt parent resurrection from JSONL history","description":"When creating a child issue with --parent flag, GetNextChildID fails immediately if parent doesn't exist in DB, without attempting to resurrect it from JSONL history. This breaks the intended resurrection workflow and causes 'parent issue X does not exist' errors even when the parent exists in JSONL.\n\nRelated to GH #334 and #278.\n\nCurrent behavior:\n- GetNextChildID checks if parent exists in DB\n- If not found, returns error immediately\n- No resurrection attempt\n\nExpected behavior:\n- GetNextChildID should call TryResurrectParent before failing\n- Parent should be restored as tombstone if found in JSONL history\n- Child creation should succeed if resurrection succeeds\n\nImpact: Users cannot create child issues for parents that were deleted but exist in JSONL history.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:02:51.496365-05:00","updated_at":"2025-11-23T18:05:13.760945-08:00","closed_at":"2025-11-21T15:09:02.731171-05:00","source_repo":".","labels":["bug","parent-child","resurrection"]} -{"id":"bd-dxdn","content_hash":"1ad5838334d77403d884787d2b5c99b88c6fa28fb08a16014246c8db0f9f4020","title":"bd ready taking 5 seconds with 132 issues (89 closed)","description":"User reports bd ready is annoyingly slow on M2 Mac - 5 seconds for 132 issues (89 closed). Started noticing after hash-based IDs update. Need to investigate performance regression. Reported in GH #243.","notes":"Root cause identified: Not a query performance issue, but stale daemon locks causing 5s timeout delays.\n\nFixed in bd-ndyz (closed) via 5 sub-issues:\n- bd-expt: Fast-fail socket checks (200ms timeout)\n- bd-wgu4: Lock probe before RPC attempts\n- bd-1mzt: Self-heal stale artifacts\n- bd-vcg5: Panic recovery + socket cleanup\n- bd-j7e2: RPC diagnostics (BD_RPC_DEBUG)\n\nAll fixes merged. Ready for v0.22.2 release.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T00:26:30.359512-08:00","updated_at":"2025-11-08T13:17:08.766029-08:00","closed_at":"2025-11-08T02:35:47.956638-08:00","source_repo":"."} -{"id":"bd-e044","content_hash":"8393c18d7f6edfed3d3e360a32a3075a9e0d9caa6f02d704774482aa1d9b0a7f","title":"Add mermaid output format for bd dep tree","description":"Add visual dependency graph output using Mermaid format for better visualization of issue relationships.\n\nExample usage:\n bd dep tree --format mermaid \u003cissue-id\u003e\n bd dep tree --format mermaid bd-42 \u003e graph.md\n\nThis would output Mermaid syntax that can be rendered in GitHub, documentation sites, or Mermaid live editor.\n\nImplementation notes:\n- Add --format flag to dep tree command\n- Support 'text' (default) and 'mermaid' formats\n- Mermaid graph should show issue IDs, titles, and dependency types\n- Consider using flowchart LR or graph TD syntax","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-03T18:10:18.978383-08:00","updated_at":"2025-11-03T20:55:06.696363-08:00","closed_at":"2025-11-03T20:55:06.69637-08:00","source_repo":"."} -{"id":"bd-e05d","content_hash":"c2f4d60f5bd679d9bf609c35efc9c15e8dd52130fb9b68eacfe47bdda910ecd7","title":"Investigate and optimize test suite performance","description":"Test suite is taking very long to run (\u003e45s for cmd/bd tests, full suite timing unknown but was cancelled).\n\nThis impacts development velocity and CI/CD performance.\n\nInvestigation needed:\n- Profile which tests are slowest\n- Identify bottlenecks (disk I/O, network, excessive setup/teardown?)\n- Consider parallelization opportunities\n- Look for redundant test cases\n- Check if integration tests can be optimized","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:37:44.529955-08:00","updated_at":"2025-11-02T16:35:38.093133-08:00","closed_at":"2025-11-02T16:35:38.093137-08:00","source_repo":"."} -{"id":"bd-e0o","content_hash":"4f1210b547378520d45c54b1236415ca9c71e742893a5d340e2f237daf64ab9a","title":"Phase 3: Enhance daemon robustness for GH #353","description":"Improve daemon health checks and metadata refresh to prevent staleness issues.\n\n**Tasks:**\n1. Enhance daemon health checks to detect unreachable daemons\n2. Add daemon metadata refresh (check disk every 5s)\n3. Comprehensive testing in sandbox environments\n\n**Implementation:**\n- cmd/bd/main.go: Better health check error handling (lines 300-367)\n- cmd/bd/daemon_event_loop.go: Periodic metadata refresh\n- cmd/bd/daemon_unix.go: Permission-aware process checks\n\n**References:**\n- docs/GH353_INVESTIGATION.md (Solutions 4 \u0026 5, lines 161-209)\n- Depends on: Phase 2 (bd-u3t)\n\n**Acceptance Criteria:**\n- Daemon detects when it's unreachable and auto-switches to direct mode\n- Daemon picks up external import operations without restart\n- All edge cases handled gracefully","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T18:52:13.376092-05:00","updated_at":"2025-11-22T17:48:48.073222-08:00","closed_at":"2025-11-21T19:31:42.718395-05:00","source_repo":"."} -{"id":"bd-e1085716","content_hash":"6b1f867ab07cbed86eae8ab342995691aac5b2bfe8fa6cdb869209e81f157d4e","title":"bd validate - Comprehensive health check","description":"Run all validation checks in one command.\n\nChecks:\n- Duplicates\n- Orphaned dependencies\n- Test pollution\n- Git conflicts\n\nSupports --fix-all for auto-repair.\n\nDepends on bd-cbed9619.1, bd-0dcea000, bd-31aab707, bd-9826b69a.\n\nFiles: cmd/bd/validate.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-10-29T23:05:13.980679-07:00","updated_at":"2025-10-30T17:12:58.19736-07:00","source_repo":"."} -{"id":"bd-e166","content_hash":"000f4f9d069ffedceae13894d967ec30fa4a89e318bfcac4847f3c3b16d44a89","title":"Improve timestamp comparison readability in import","description":"The timestamp comparison logic uses double-negative which can be confusing:\n\nCurrent code:\nif !incoming.UpdatedAt.After(existing.UpdatedAt) {\n // skip update\n}\n\nMore readable:\nif incoming.UpdatedAt.After(existing.UpdatedAt) {\n // perform update\n} else {\n // skip (local is newer)\n}\n\nThis is a minor refactor for code clarity.\n\nRelated: bd-1022\nFiles: internal/importer/importer.go:411, 488","status":"open","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:12.27108-08:00","updated_at":"2025-11-02T15:32:12.27108-08:00","source_repo":"."} -{"id":"bd-e16b","content_hash":"969a580f09de305f494c160c21ad58b43e348320023eb990ecb8cf5395cccb6e","title":"Replace BEADS_DB with BEADS_DIR environment variable","description":"Implement BEADS_DIR as a replacement for BEADS_DB to point to the .beads directory instead of the database file directly.\n\nRationale:\n- With --no-db mode, there's no .db file to point to\n- The .beads directory is the logical unit (contains config.yaml, db files, jsonl files)\n- More intuitive: point to the beads directory not the database file\n\nImplementation:\n1. Add BEADS_DIR environment variable support\n2. Maintain backward compatibility with BEADS_DB\n3. Priority order: BEADS_DIR \u003e BEADS_DB \u003e auto-discovery\n4. If BEADS_DIR is set, look for config.yaml in that directory to find actual database path\n5. Update documentation and migration guide\n\nFiles to modify:\n- beads.go (FindDatabasePath function)\n- cmd/bd/main.go (initialization)\n- Documentation (CLI_REFERENCE.md, TROUBLESHOOTING.md, etc.)\n- MCP integration (integrations/beads-mcp/src/beads_mcp/config.py)\n\nTesting:\n- Ensure BEADS_DB still works (backward compatibility)\n- Test BEADS_DIR with both db and --no-db modes\n- Test priority order when both are set\n- Update integration tests\n\nRelated to GitHub issue #179","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-02T18:19:26.131948-08:00","updated_at":"2025-11-02T18:27:14.545162-08:00","closed_at":"2025-11-02T18:27:14.545162-08:00","source_repo":"."} -{"id":"bd-e1d645e8","content_hash":"2f5bc6f9e3cd91a8b5c9d8de92fa5342eb3d9d7a12371d316e54599348b504e4","title":"Rapid 4","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.484329-07:00","updated_at":"2025-11-07T23:21:44.925546-08:00","closed_at":"2025-11-07T23:18:52.316948-08:00","source_repo":"."} -{"id":"bd-e2e6","content_hash":"2f1cf4362e6a12a0e599efd7f13267a7a81a499f56e89a5e0bfe5efc67f213c0","title":"Implement postinstall script for binary download","description":"Create npm/scripts/postinstall.js that downloads platform-specific binaries:\n\n## Platform detection\n- Detect os.platform() and os.arch()\n- Map to GitHub release asset names:\n - linux-amd64 β†’ bd-linux-amd64\n - linux-arm64 β†’ bd-linux-arm64\n - darwin-amd64 β†’ bd-darwin-amd64\n - darwin-arm64 β†’ bd-darwin-arm64\n - win32-x64 β†’ bd-windows-amd64.exe\n\n## Download logic\n- Fetch from GitHub releases: https://github.com/steveyegge/beads/releases/latest/download/${asset}\n- Save to npm/bin/bd (or bd.exe on Windows)\n- Set executable permissions (chmod +x)\n- Handle errors gracefully with helpful messages\n\n## Error handling\n- Check for unsupported platforms\n- Retry on network failures\n- Provide manual download instructions if automated fails\n- Skip download if binary already exists (for local development)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:39:56.652829-08:00","updated_at":"2025-11-03T10:31:45.382215-08:00","closed_at":"2025-11-03T10:31:45.382215-08:00","source_repo":".","dependencies":[{"issue_id":"bd-e2e6","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.94671-08:00","created_by":"daemon"}]} -{"id":"bd-e55c","content_hash":"3cbbade2b125be0445a7654259edb8985dd82ee272f0a44366aa3f0564363eec","title":"Import overwrites newer local issues with older remote versions","description":"## Problem\n\nDuring git pull + import, local issues with newer updated_at timestamps get overwritten by older versions from remote JSONL.\n\n## What Happened\n\nTimeline:\n1. 17:52 - Closed bd-df190564 and bd-b501fcc1 locally (updated_at: 2025-10-31)\n2. 17:51 - Remote pushed same issues with status=open (updated_at: 2025-10-30)\n3. 17:52 - Local sync pulled remote commit and imported JSONL\n4. Result: Issues reverted to open despite local version being newer\n\n## Root Cause\n\nDetectCollisions (internal/storage/sqlite/collision.go:67-79) compares fields but doesn't check timestamps:\n\n```go\nconflictingFields := compareIssues(existing, incoming)\nif len(conflictingFields) == 0 {\n result.ExactMatches = append(result.ExactMatches, incoming.ID)\n} else {\n // Same ID, different content - treats as UPDATE\n result.Collisions = append(result.Collisions, \u0026CollisionDetail{...})\n}\n```\n\nImport applies incoming version regardless of which is newer.\n\n## Expected Behavior\n\nImport should:\n1. Compare updated_at timestamps when collision detected\n2. Skip update if local version is newer\n3. Apply update only if remote version is newer\n4. Warn on timestamp conflicts\n\n## Solution\n\nAdd timestamp checking to DetectCollisions or importIssues:\n\n```go\nif len(conflictingFields) \u003e 0 {\n // Check timestamps\n if !incoming.UpdatedAt.After(existing.UpdatedAt) {\n // Local is newer or same - skip update\n result.ExactMatches = append(result.ExactMatches, incoming.ID)\n continue\n }\n // Remote is newer - apply update\n result.Collisions = append(result.Collisions, \u0026CollisionDetail{...})\n}\n```\n\n## Files\n- internal/storage/sqlite/collision.go\n- internal/importer/importer.go\n\n## References\n- Discovered during bd-df190564, bd-b501fcc1 re-opening","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T17:56:43.919306-07:00","updated_at":"2025-10-31T18:05:55.521427-07:00","closed_at":"2025-10-31T18:05:55.521427-07:00","source_repo":"."} -{"id":"bd-e652","content_hash":"6b95b33d0961d545d24063112c77f58dd09e7a6352c94525e2d3b3ed88b53b3e","title":"bd doctor doesn't detect version mismatches or stale daemons","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:07:56.957214-07:00","updated_at":"2025-11-01T17:05:36.615761-07:00","closed_at":"2025-11-01T17:05:36.615761-07:00","source_repo":".","dependencies":[{"issue_id":"bd-e652","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:07:56.958708-07:00","created_by":"stevey"}]} -{"id":"bd-e6d71828","content_hash":"954fa43e14d3302e5ba105d062b8ad48777f49cd759f9a1d827f03c29ddee9bd","title":"Add transaction + retry logic for N-way collision resolution","description":"## Problem\nCurrent N-way collision resolution fails on UNIQUE constraint violations during convergence rounds when 5+ clones sync. The RemapCollisions function is non-atomic and performs operations sequentially:\n1. Delete old issues (CASCADE deletes dependencies)\n2. Create remapped issues (can fail with UNIQUE constraint)\n3. Recreate dependencies\n4. Update text references\n\nFailure at step 2 leaves database in inconsistent state.\n\n## Solution\nWrap collision resolution in database transaction with retry logic:\n- Make entire RemapCollisions operation atomic\n- Retry up to 3 times on UNIQUE constraint failures\n- Re-sync counters between retries\n- Add better error messages for debugging\n\n## Implementation\nLocation: internal/storage/sqlite/collision.go:342 (RemapCollisions function)\n\n```go\n// Retry up to 3 times on UNIQUE constraint failures\nfor attempt := 0; attempt \u003c 3; attempt++ {\n err := s.db.ExecInTransaction(func(tx *sql.Tx) error {\n // All collision resolution operations\n })\n if !isUniqueConstraintError(err) {\n return err\n }\n s.SyncAllCounters(ctx)\n}\n```\n\n## Success Criteria\n- 5-clone collision test passes reliably\n- No partial state on UNIQUE constraint errors\n- Automatic recovery from transient ID conflicts\n\n## References\n- See beads_nway_test.go:124 for the KNOWN LIMITATION comment\n- Related to-7c5915ae (transaction support)","notes":"## Progress Made\n\n1. Added `ExecInTransaction` helper to SQLiteStorage for atomic database operations\n2. Added `IsUniqueConstraintError` function to detect UNIQUE constraint violations\n3. Wrapped `RemapCollisions` with retry logic (up to 3 attempts) with counter sync between retries\n4. Enhanced `handleRename` to detect and handle race conditions where target ID already exists\n5. Added defensive checks for when old ID has been deleted by another clone\n\n## Test Results\n\nThe changes improve N-way collision handling but don't fully solve the problem:\n- Original error: `UNIQUE constraint failed: issues.id` during first convergence round\n- With changes: Test proceeds further but encounters different collision scenarios\n- New error: `target ID already exists with different content` in later convergence rounds\n\n## Root Cause Analysis\n\nThe issue is more complex than initially thought. In N-way scenarios:\n1. Clone A remaps bd-1c63eb84 β†’ test-2 β†’ test-4\n2. Clone B remaps bd-1c63eb84 β†’ test-3 β†’ test-4 \n3. Both try to create test-4, but with different intermediate states\n4. This creates legitimate content collisions that require additional resolution\n\n## Next Steps \n\nThe full solution requires:\n1. Making remapping fully deterministic across clones (same input β†’ same remapped ID)\n2. OR making `handleRename` more tolerant of mid-flight collisions\n3. OR implementing full transaction support for multi-step collision resolution -7c5915ae)\n\nThe retry logic added here provides a foundation but isn't sufficient for complex N-way scenarios.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T10:22:32.716678-07:00","updated_at":"2025-11-02T16:46:45.864479-08:00","closed_at":"2025-11-02T16:46:45.864479-08:00","source_repo":".","dependencies":[{"issue_id":"bd-e6d71828","depends_on_id":"bd-cbed9619.1","type":"related","created_at":"2025-10-29T10:44:44.14653-07:00","created_by":"daemon"}]} -{"id":"bd-e8be4224","content_hash":"0acf678278ed57153a042264fa4dc04245faf1706224fa94d8b0d767a5c2fa2e","title":"Batch test 3","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:01.964091-07:00","updated_at":"2025-10-31T12:00:43.183212-07:00","closed_at":"2025-10-31T12:00:43.183212-07:00","source_repo":"."} -{"id":"bd-e92","content_hash":"12073b3293b06f99051bc9c00188aeb520cd2e4792cf4694f1fa4b784e625e54","title":"Add test coverage for internal/autoimport package","description":"","design":"The autoimport package has only 1 test file. Need comprehensive tests. Target: 70% coverage","acceptance_criteria":"- At least 3 test files\n- Package coverage \u003e= 70%\n- Tests cover main functionality, error paths, edge cases","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:22.338577-05:00","updated_at":"2025-11-20T21:21:22.338577-05:00","source_repo":".","dependencies":[{"issue_id":"bd-e92","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.128625-05:00","created_by":"daemon"}]} -{"id":"bd-e98221b3","content_hash":"4a4f6912d8de8bf0f9ae867be1a25d83c5a6991383e3aa192537747500bebc6a","title":"Update AGENTS.md and README.md with \"bd daemons\" documentation","description":"Document the new \"bd daemons\" command and all subcommands in AGENTS.md and README.md. Include examples and troubleshooting guidance.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-26T19:41:11.099254-07:00","updated_at":"2025-11-06T20:06:49.219318-08:00","closed_at":"2025-11-06T19:51:57.75321-08:00","source_repo":"."} -{"id":"bd-eb3c","content_hash":"6c7a46d58e565a27e3a7a5375bb1ad8345094bdef422dce52239ee4b7e559143","title":"UX nightmare: multiple ways daemon can fail with misleading messages","description":"","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-10-31T21:08:09.090553-07:00","updated_at":"2025-11-01T20:27:42.79962-07:00","closed_at":"2025-11-01T20:27:42.79962-07:00","source_repo":"."} -{"id":"bd-ee1","content_hash":"12b99c3c3cf61b7a05f08864c592283ee2d273e863c13be24a73b0e6a47b022b","title":"Add security tests for WriteFile permissions in doctor command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:[deleted:bd-da96-baseline-lint]]\n\nIn cmd/bd/doctor/gitignore.go:98, os.WriteFile uses 0644 permissions, flagged by gosec G306 as potentially too permissive.\n\nAdd tests to verify:\n- File is created with appropriate permissions (0600 or less)\n- Existing file permissions are not loosened\n- File ownership is correct\n- Sensitive data handling if .gitignore contains secrets\n\nThis ensures .gitignore files are created with secure permissions to prevent unauthorized access.\n\n_This issue was automatically created by AI test coverage analysis._","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T10:25:33.529153-05:00","updated_at":"2025-11-23T18:05:13.762162-08:00","source_repo":".","labels":["discovered:supervisor"],"dependencies":[{"issue_id":"bd-ee1","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.530705-05:00","created_by":"ai-supervisor"}]} -{"id":"bd-eef03e0a","content_hash":"a7dd31781359f078a172d6d34ceed26be83a3bc8159c05c2026c96717e98a314","title":"Stress test: event storm handling","description":"Simulate 100+ rapid JSONL writes. Verify debouncer batches to single import. Verify no data loss. Test daemon stability.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.138725-07:00","updated_at":"2025-10-31T19:18:50.682925-07:00","closed_at":"2025-10-31T19:18:50.682925-07:00","source_repo":"."} -{"id":"bd-ef72b864","content_hash":"81f5c4fcc229c3ba653d29fc71c9ae3be75ed672296e3e790a88498ee2df3a64","title":"Add MCP server functions for repair commands","description":"Expose new repair commands via MCP server for agent access:\n\nFunctions to add:\n- beads_repair_deps()\n- beads_detect_pollution()\n- beads_validate()\n- beads_resolve_conflicts() (when implemented)\n\nUpdate integrations/beads-mcp/src/beads_mcp/server.py\n\nSee repair_commands.md lines 803-884 for design.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T19:38:02.227921-07:00","updated_at":"2025-10-30T17:12:58.180404-07:00","closed_at":"2025-10-29T23:14:44.187562-07:00","source_repo":"."} -{"id":"bd-ef85","content_hash":"56b7e0c048938940053b127e4f9ed578e797b99dc93d010138ec823efbe7842c","title":"Add --json flags to all bd commands for agent-friendly output","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-10-31T22:39:45.312496-07:00","updated_at":"2025-10-31T22:39:50.157022-07:00","closed_at":"2025-10-31T22:39:50.157022-07:00","source_repo":"."} -{"id":"bd-eimz","content_hash":"03d818a0c6277838251b1bd67f3e88c1aedad81fa458291f27469a807a69fc13","title":"Add Agent Mail to QUICKSTART.md","description":"Mention Agent Mail as optional advanced feature in quickstart guide.\n\nFile: docs/QUICKSTART.md","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T22:42:51.357009-08:00","updated_at":"2025-11-08T01:07:11.598558-08:00","closed_at":"2025-11-08T01:07:11.598558-08:00","source_repo":".","dependencies":[{"issue_id":"bd-eimz","depends_on_id":"bd-xzrv","type":"blocks","created_at":"2025-11-07T23:04:09.841956-08:00","created_by":"daemon"}]} -{"id":"bd-eiz9","content_hash":"0f1722abb1f24d08d2c643d9cd4109935325eb3ea994166ff88202d0a457b003","title":"Help agents understand version changes with bd info --whats-new","description":"**Problem** (from GH Discussion #239 by @maphew):\nWeekly major versions mean agents need to adapt workflows, but currently there's no efficient way to communicate \"what changed that affects you.\"\n\n**Proposed solutions:**\n\n1. **bd info --whats-new** - Show agent-actionable changes since last version\n ```\n Since v0.20.1:\n β€’ Hash IDs eliminate collisions - remove ID coordination workarounds\n β€’ Event-driven daemon (opt-in) - add BEADS_DAEMON_MODE=events\n β€’ Merge driver auto-configured - conflicts rarer\n ```\n\n2. **Version-aware bd onboard** - Detect version changes and show diff of agent-relevant changes\n\n3. **AGENTS.md top section** - \"πŸ†• Recent Changes (Last 3 Versions)\" with workflow impacts\n\n**Why agents need this:**\n- Raw CHANGELOG is token-heavy and buried in release details\n- Full bd onboard re-run wasteful if only 2-3 things changed\n- Currently requires user to manually explain updates\n\n**Related:** https://github.com/steveyegge/beads/discussions/239","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-06T21:03:30.057576-08:00","updated_at":"2025-11-08T02:42:56.733731-08:00","closed_at":"2025-11-08T02:25:55.509249-08:00","source_repo":"."} -{"id":"bd-epvx","content_hash":"f0acf2bcec5857c61c542764f62c5f5a66cfa74cdafa941c1754db40dd173efc","title":"Create Go adapter library (optional)","description":"For agents written in Go, provide native adapter library instead of shelling out to curl.\n\nAcceptance Criteria:\n- agentmail.Client struct\n- HTTP client with timeout/retry logic\n- Same API as Python adapter\n- Example usage in examples/go-agent/\n- Unit tests\n\nFile: pkg/agentmail/client.go\n\nNote: Lower priority - can shell out to curl initially","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-11-07T22:42:28.781577-08:00","updated_at":"2025-11-08T15:58:37.146674-08:00","closed_at":"2025-11-08T15:48:57.83973-08:00","source_repo":".","dependencies":[{"issue_id":"bd-epvx","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T23:04:01.47471-08:00","created_by":"daemon"}]} -{"id":"bd-eqjc","content_hash":"8acc3d91ca9f9bef36d19358cb7f24eac247583a0e6701036aaff92607474c21","title":"bd init creates nested .beads directories","description":"bd init sometimes creates .beads/.beads/ nested directories, which should never happen. This occurs fairly often and can cause confusion about which .beads directory is active. Need to add validation to detect if already inside a .beads directory and either error or use the parent .beads location.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T22:21:22.948727-08:00","updated_at":"2025-11-06T22:22:41.04958-08:00","closed_at":"2025-11-06T22:22:41.04958-08:00","source_repo":"."} -{"id":"bd-es19","content_hash":"5c5951971ed466f30fa12e1d7f73457ecc430464726516f069e6659f762687e6","title":"BG's issue to reopen","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T19:43:48.756893-05:00","updated_at":"2025-11-20T19:43:48.756893-05:00","closed_at":"2025-11-07T21:57:59.90981-08:00","source_repo":"."} -{"id":"bd-expt","content_hash":"6e14db64fb24882e4cf544ec24eaa994aba970fd0ae31c72dda2d8ea88560753","title":"RPC fast-fail: stat socket before dial, cap timeouts to 200ms","description":"Eliminate 5s delay when daemon socket is missing by:\n1. Add os.Stat(socketPath) check before dialing in TryConnect\n2. Return (nil, nil) immediately if socket doesn't exist\n3. Set default dial timeout to 200ms in TryConnect\n4. Keep TryConnectWithTimeout for explicit health/status checks (1-2s)\n\nThis prevents clients from waiting through full timeout when no daemon is running.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-07T16:42:12.688526-08:00","updated_at":"2025-11-07T22:07:17.345918-08:00","closed_at":"2025-11-07T21:04:21.671436-08:00","source_repo":".","dependencies":[{"issue_id":"bd-expt","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.689284-08:00","created_by":"daemon"}]} -{"id":"bd-f0d9bcf2","content_hash":"00e0c7b440024e6257d1bac9c1d5af10f8a12ee1726478e4b5bab06e34bfb586","title":"Batch test 1","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:01.795728-07:00","updated_at":"2025-10-31T12:00:43.184078-07:00","closed_at":"2025-10-31T12:00:43.184078-07:00","source_repo":"."} -{"id":"bd-f282","content_hash":"90043e5e39cbb062ce0ff6a323ce2d0a16465783742d06ac9da1df66d837e025","title":"Test npm package installation locally","description":"Verify npm package works before publishing:\n\n## Local testing\n- Run npm pack in npm/ directory\n- Install tarball globally: npm install -g beads-bd-0.21.5.tgz\n- Test basic commands:\n - bd --version\n - bd init --quiet --prefix test\n - bd create \"Test issue\" -p 1 --json\n - bd list --json\n - bd sync\n\n## Test environments\n- macOS (darwin-arm64 and darwin-amd64)\n- Linux (ubuntu docker container for linux-amd64)\n- Windows (optional, if available)\n\n## Validation\n- Binary downloads during postinstall\n- All bd commands work identically to native\n- No permission issues\n- Proper error messages on failure","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:40:05.71835-08:00","updated_at":"2025-11-03T10:31:45.382577-08:00","closed_at":"2025-11-03T10:31:45.382577-08:00","source_repo":".","dependencies":[{"issue_id":"bd-f282","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.968748-08:00","created_by":"daemon"}]} -{"id":"bd-f8b764c9","content_hash":"45d0f351c47d2bc2c40f271d7442cd3d4facb8e2160b9378c8fd1e540687deb6","title":"Hash-based IDs with aliasing system","description":"Replace sequential auto-increment IDs (bd-1c63eb84, bd-9063acda) with content-hash based IDs (bd-af78e9a2) plus human-friendly aliases (#1, #2).\n\n## Motivation\nCurrent sequential IDs cause collision problems when multiple clones work offline:\n- Non-deterministic convergence in N-way scenarios (bd-cbed9619.1, bd-e6d71828)\n- Complex collision resolution logic (~2,100 LOC)\n- UNIQUE constraint violations during import\n- Requires coordination between workers\n\nHash-based IDs eliminate collisions entirely while aliases preserve human readability.\n\n## Benefits\n- βœ… Collision-free distributed ID generation\n- βœ… Eliminates ~2,100 LOC of collision handling code\n- βœ… Better git merge behavior (different IDs = different JSONL lines)\n- βœ… True offline-first workflows\n- βœ… Simpler auto-import (no remapping needed)\n- βœ… Enables parallel CI/CD workers without coordination\n\n## Design\n- Canonical ID: bd-af78e9a2 (8-char SHA256 prefix of title+desc+timestamp+creator)\n- Alias: #42 (auto-increment per workspace, mutable, display-only)\n- CLI accepts both: bd show bd-af78e9a2 OR bd show #42\n- JSONL stores hash IDs only (aliases reconstructed on import)\n- Alias conflicts resolved via content-hash ordering (deterministic)\n\n## Breaking Change\nThis is a v2.0 feature requiring migration. Provide bd migrate --hash-ids tool.\n\n## Timeline\n~9 weeks (Phase 1: Hash IDs 4w, Phase 2: Aliases 3w, Phase 3: Testing 2w)\n\n## Dependencies\nShould complete after bd-7c5915ae (cleanup validation) and before bd-710a4916 (CRDT).","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-29T21:23:49.592315-07:00","updated_at":"2025-10-31T12:32:32.6038-07:00","closed_at":"2025-10-31T12:32:32.6038-07:00","source_repo":"."} -{"id":"bd-f8b764c9.1","content_hash":"3ef644568dcad3f589d21bc0a99975620d2ce876c832d5d9bddf3dab61404211","title":"Dogfood: Migrate beads repo to hash IDs","description":"Final validation: migrate the beads project itself to hash-based IDs.\n\n## Purpose\nDogfooding the migration on beads' own issue database to:\n1. Validate migration tool works on real data\n2. Discover edge cases\n3. Verify all workflows still work\n4. Build confidence for users\n\n## Pre-Migration Checklist\n- [ ] All bd-f8b764c9 child tasks completed\n- [ ] All tests pass: `go test ./...`\n- [ ] Migration tool tested on test databases\n- [ ] Documentation updated\n- [ ] MCP server updated and published\n- [ ] Clean git status\n\n## Migration Steps\n\n### 1. Create Backup\n```bash\n# Backup database\ncp -r .beads .beads.backup-1761798568\n\n# Backup JSONL\ncp .beads/beads.jsonl .beads/beads.jsonl.backup\n\n# Create git branch for migration\ngit checkout -b hash-id-migration\ngit add .beads.backup-*\ngit commit -m \"Pre-migration backup\"\n```\n\n### 2. Run Migration (Dry Run)\n```bash\nbd migrate --hash-ids --dry-run \u003e migration-plan.txt\ncat migration-plan.txt\n\n# Review:\n# - Number of issues to migrate\n# - Hash collision check (should be zero)\n# - Text reference updates\n# - Dependency updates\n```\n\n### 3. Run Migration (Real)\n```bash\nbd migrate --hash-ids 2\u003e\u00261 | tee migration-log.txt\n\n# Expected output:\n# βœ“ Backup created: .beads/beads.db.backup-1234567890\n# βœ“ Generated 150 hash IDs\n# βœ“ No hash collisions detected\n# βœ“ Updated issues table schema\n# βœ“ Updated 150 issue IDs\n# βœ“ Updated 87 dependencies\n# βœ“ Updated 234 text references\n# βœ“ Exported to .beads/beads.jsonl\n# βœ“ Migration complete!\n```\n\n### 4. Validation\n\n#### Database Integrity\n```bash\n# Check all issues have hash IDs\nbd list | grep -v \"bd-[a-f0-9]\\{8\\}\" \u0026\u0026 echo \"FAIL: Non-hash IDs found\"\n\n# Check all issues have aliases\nsqlite3 .beads/beads.db \"SELECT COUNT(*) FROM issues WHERE alias IS NULL\"\n# Should be 0\n\n# Check no alias duplicates\nsqlite3 .beads/beads.db \"SELECT alias, COUNT(*) FROM issues GROUP BY alias HAVING COUNT(*) \u003e 1\"\n# Should be empty\n```\n\n#### Functionality Tests\n```bash\n# Test show by hash ID\nbd show bd-\n\n# Test show by alias\nbd show #1\n\n# Test create new issue\nbd create \"Test issue after migration\" -p 2\n# Should get hash ID + alias\n\n# Test update\nbd update #1 --priority 1\n\n# Test dependencies\nbd dep tree #1\n\n# Test export\nbd export\ngit diff .beads/beads.jsonl\n# Should show hash IDs\n```\n\n#### Text Reference Validation\n```bash\n# Check that old IDs were updated in descriptions\ngrep -r \"bd-[0-9]\\{1,3\\}[^a-f0-9]\" .beads/beads.jsonl \u0026\u0026 echo \"FAIL: Old ID format found\"\n\n# Verify hash ID references exist\ngrep -o \"bd-[a-f0-9]\\{8\\}\" .beads/beads.jsonl | sort -u | wc -l\n# Should match number of hash IDs\n```\n\n### 5. Commit Migration\n```bash\ngit add .beads/beads.jsonl .beads/beads.db\ngit commit -m \"Migrate to hash-based IDs (v2.0)\n\n- Migrated 150 issues to hash IDs\n- Preserved aliases (#1-#150)\n- Updated 87 dependencies\n- Updated 234 text references\n- Zero hash collisions\n\nMigration log: migration-log.txt\"\n\ngit push origin hash-id-migration\n```\n\n### 6. Create PR\n```bash\ngh pr create --title \"Migrate to hash-based IDs (v2.0)\" --body \"## Summary\nMigrates beads project to hash-based IDs as part of v2.0 release.\n\n## Migration Stats\n- Issues migrated: 150\n- Dependencies updated: 87\n- Text references updated: 234\n- Hash collisions: 0\n- Aliases assigned: 150\n\n## Validation\n- βœ… All tests pass\n- βœ… Database integrity verified\n- βœ… All workflows tested (show, update, create, deps)\n- βœ… Text references updated correctly\n- βœ… Export produces valid JSONL\n\n## Files Changed\n- `.beads/beads.jsonl` - Hash IDs in all entries\n- `.beads/beads.db` - Schema updated with aliases\n\n## Rollback\nIf issues arise:\n\\`\\`\\`bash\nmv .beads.backup-1234567890 .beads\nbd export\n\\`\\`\\`\n\nSee migration-log.txt for full details.\"\n```\n\n### 7. Merge and Cleanup\n```bash\n# After PR approval\ngit checkout main\ngit merge hash-id-migration\ngit push origin main\n\n# Tag release\ngit tag v2.0.0\ngit push origin v2.0.0\n\n# Cleanup\nrm migration-log.txt migration-plan.txt\ngit checkout .beads.backup-* # Keep in git history\n```\n\n## Rollback Procedure\nIf migration fails or has issues:\n\n```bash\n# Restore backup\nmv .beads .beads.failed-migration\nmv .beads.backup-1234567890 .beads\n\n# Regenerate JSONL\nbd export\n\n# Verify restoration\nbd list\ngit diff .beads/beads.jsonl\n\n# Cleanup\ngit checkout hash-id-migration\ngit reset --hard main\n```\n\n## Post-Migration Communication\n\n### GitHub Issue/Discussion\n```markdown\n## Beads v2.0 Released: Hash-Based IDs\n\nWe've migrated beads to hash-based IDs! πŸŽ‰\n\n**What changed:**\n- Issues now use hash IDs (bd-af78e9a2) instead of sequential (bd-cb64c226.3)\n- Human-friendly aliases (#42) for easy reference\n- Zero collision risk in distributed workflows\n\n**Action required:**\nIf you have a local clone, you need to migrate:\n\n\\`\\`\\`bash\ngit pull origin main\nbd migrate --hash-ids\ngit push origin main\n\\`\\`\\`\n\nSee MIGRATION.md for details.\n\n**Benefits:**\n- βœ… No more ID collisions\n- βœ… Work offline without coordination\n- βœ… Simpler codebase (-2,100 LOC)\n\nQuestions? Reply here or see docs/HASH_IDS.md\n```\n\n## Success Criteria\n- [ ] Migration completes without errors\n- [ ] All validation checks pass\n- [ ] PR merged to main\n- [ ] v2.0.0 tagged and released\n- [ ] Documentation updated\n- [ ] Community notified\n- [ ] No rollback needed within 1 week\n\n## Files to Create\n- migration-log.txt (transient)\n- migration-plan.txt (transient)\n\n## Timeline\nExecute after all other bd-f8b764c9 tasks complete (estimated: ~8 weeks from start)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:29:28.591526-07:00","updated_at":"2025-10-31T12:32:32.607092-07:00","closed_at":"2025-10-31T12:32:32.607092-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:29:28.59248-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.4","type":"blocks","created_at":"2025-10-29T21:29:28.593033-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.3","type":"blocks","created_at":"2025-10-29T21:29:28.593437-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.12","type":"blocks","created_at":"2025-10-29T21:29:28.593876-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.2","type":"blocks","created_at":"2025-10-29T21:29:28.594521-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.10","content_hash":"c3e20125c50aa3aa559cde941333906bd7856c298b1b781dab453c3447ef955f","title":"Add alias field to database schema","description":"Extend database schema to support human-friendly aliases alongside hash IDs.\n\n## Database Changes\n\n### 1. Add alias column to issues table\n```sql\nALTER TABLE issues ADD COLUMN alias INTEGER UNIQUE;\nCREATE INDEX idx_issues_alias ON issues(alias);\n```\n\n### 2. Add alias counter table\n```sql\nCREATE TABLE alias_counter (\n id INTEGER PRIMARY KEY CHECK (id = 1),\n next_alias INTEGER NOT NULL DEFAULT 1\n);\nINSERT INTO alias_counter (id, next_alias) VALUES (1, 1);\n```\n\n### 3. Add alias conflict tracking (for multi-clone scenarios)\n```sql\nCREATE TABLE alias_history (\n issue_id TEXT NOT NULL,\n alias INTEGER NOT NULL,\n assigned_at TIMESTAMP NOT NULL,\n workspace_id TEXT NOT NULL,\n PRIMARY KEY (issue_id, alias)\n);\n```\n\n## API Changes\n\n### CreateIssue\n- Generate hash ID\n- Assign next available alias\n- Store both in database\n\n### ResolveAliasConflicts (new function)\n- Detect conflicting alias assignments after import\n- Apply resolution strategy (content-hash ordering)\n- Reassign losers to next available aliases\n\n## Migration Path\n```bash\nbd migrate --add-aliases # Adds columns, assigns aliases to existing issues\n```\n\n## Files to Modify\n- internal/storage/sqlite/schema.go\n- internal/storage/sqlite/sqlite.go (CreateIssue, GetIssue)\n- internal/storage/sqlite/aliases.go (new file for alias logic)\n- internal/storage/sqlite/migrations.go\n\n## Testing\n- Test alias auto-assignment on create\n- Test alias uniqueness constraint\n- Test alias lookup performance\n- Test alias conflict resolution","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:13.968241-07:00","updated_at":"2025-10-31T12:32:32.610663-07:00","closed_at":"2025-10-31T12:32:32.610663-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.10","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:13.96959-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.10","depends_on_id":"bd-f8b764c9.11","type":"blocks","created_at":"2025-10-29T21:29:45.952824-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.11","content_hash":"51d5b42cb64c52b9cf828bfcdd9591e461ad30dc430913e60356f8dcb2bf3811","title":"Design hash ID generation algorithm","description":"Design and specify the hash-based ID generation algorithm.\n\n## Requirements\n- Deterministic: same inputs β†’ same ID\n- Collision-resistant: ~2^32 space for 8-char hex\n- Fast: \u003c1ΞΌs per generation\n- Includes timestamp for uniqueness\n- Includes creator/workspace for distributed uniqueness\n\n## Proposed Algorithm\n```go\nfunc GenerateIssueID(title, desc string, created time.Time, workspaceID string) string {\n h := sha256.New()\n h.Write([]byte(title))\n h.Write([]byte(desc))\n h.Write([]byte(created.Format(time.RFC3339Nano)))\n h.Write([]byte(workspaceID))\n hash := hex.EncodeToString(h.Sum(nil))\n return \"bd-\" + hash[:8] // 8-char prefix = 2^32 space\n}\n```\n\n## Open Questions\n1. 8 chars (2^32) or 16 chars (2^64) for collision resistance?\n2. Include priority/type in hash? (Pro: more entropy. Con: immutable)\n3. How to handle workspace ID generation? (hostname? UUID?)\n4. What if title+desc change? (Answer: ID stays same - hash only used at creation)\n\n## Deliverables\n- Design doc: docs/HASH_ID_DESIGN.md\n- Collision probability analysis\n- Performance benchmarks\n- Prototype implementation in internal/types/id_generator.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:01.843634-07:00","updated_at":"2025-10-31T12:32:32.610902-07:00","closed_at":"2025-10-31T12:32:32.610902-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.11","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:01.844994-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.12","content_hash":"413151630fbf02c0782f6c84199a03f3a562d9f0fb369e8b9216a5a98eb12eb3","title":"Update documentation for hash IDs and aliases","description":"Update all documentation to explain hash-based IDs and aliasing system.\n\n## Files to Update\n\n### 1. README.md\nAdd section explaining hash IDs:\n```markdown\n## Issue IDs\n\nBeads uses **hash-based IDs** for collision-free distributed issue tracking:\n\n- **Hash ID**: `bd-af78e9a2` (8-char SHA256 prefix, immutable, globally unique)\n- **Alias**: `#42` (sequential number, mutable, human-friendly)\n\n### Using IDs\n```bash\nbd show bd-af78e9a2 # Use hash ID\nbd show #42 # Use alias\nbd show 42 # Use alias (shorthand)\n```\n\n### Why Hash IDs?\n- **Collision-free**: Work offline without ID conflicts\n- **Distributed**: No coordination needed between clones\n- **Git-friendly**: Different IDs = different JSONL lines, fewer merge conflicts\n\n### Aliases\nAliases are workspace-local shortcuts for hash IDs. They're:\n- Automatically assigned on issue creation\n- Reassigned deterministically on sync (if conflicts)\n- Can be manually controlled with `bd alias` commands\n```\n\n### 2. AGENTS.md\nUpdate agent workflow:\n```markdown\n## Hash-Based IDs (v2.0+)\n\nBeads v2.0 uses hash-based IDs to eliminate collision problems:\n\n**When creating issues**:\n```bash\nbd create \"Fix bug\" -p 1\n# β†’ Creates bd-af78e9a2 with alias #1\n```\n\n**When referencing issues**:\n- In text: Use hash IDs (stable): \"See bd-af78e9a2 for details\"\n- In CLI: Use aliases (readable): `bd update #42 --status done`\n\n**After sync**:\n- Alias conflicts resolved automatically (content-hash ordering)\n- No ID collisions possible\n- No remapping needed\n\n**Migration from v1.x**:\n```bash\nbd migrate --hash-ids # One-time migration\n```\n```\n\n### 3. QUICKSTART.md (if exists)\nShow alias usage in examples:\n```bash\n# Create issue (gets hash ID + alias)\nbd create \"Fix authentication bug\" -p 1\n# β†’ Created bd-af78e9a2 (alias: #1)\n\n# Reference by alias\nbd show #1\nbd update #1 --status in_progress\nbd close #1 --reason \"Fixed\"\n```\n\n### 4. ADVANCED.md\nAdd section on hash ID internals:\n```markdown\n## Hash ID Generation\n\nHash IDs are generated deterministically:\n\n```go\nSHA256(title || description || timestamp || workspace_id)[:8]\n```\n\n**Collision probability**:\n- 8 hex chars = 2^32 space = ~4 billion IDs\n- Birthday paradox: 50% collision probability at ~65,000 issues\n- For typical projects (\u003c10,000 issues), collision risk is negligible\n\n**Collision detection**:\nIf a hash collision occurs (extremely rare), beads:\n1. Detects on insert (UNIQUE constraint)\n2. Appends random suffix: `bd-af78e9a2-a1b2`\n3. Retries insert\n\n## Alias Conflict Resolution\n\nWhen multiple clones assign same alias to different issues:\n\n**Strategy**: Content-hash ordering (deterministic)\n- Sort conflicting issue IDs lexicographically\n- Lowest hash ID keeps the alias\n- Others reassigned to next available aliases\n\n**Example**:\n```\nClone A: Assigns #42 to bd-a1b2c3d4\nClone B: Assigns #42 to bd-e5f6a7b8\nAfter sync: bd-a1b2c3d4 keeps #42 (lower hash)\n bd-e5f6a7b8 gets #100 (next available)\n```\n```\n\n### 5. MIGRATION.md (new file)\n```markdown\n# Migrating to Hash-Based IDs (v2.0)\n\n## Overview\nBeads v2.0 introduces hash-based IDs to eliminate collision problems. This is a **breaking change** requiring migration.\n\n## Migration Steps\n\n### 1. Backup\n```bash\ncp -r .beads .beads.backup\ngit commit -am \"Pre-migration backup\"\n```\n\n### 2. Run Migration\n```bash\n# Dry run first\nbd migrate --hash-ids --dry-run\n\n# Apply migration\nbd migrate --hash-ids\n```\n\n### 3. Commit Changes\n```bash\ngit add .beads/issues.jsonl\ngit commit -m \"Migrate to hash-based IDs (v2.0)\"\ngit push origin main\n```\n\n### 4. Coordinate with Collaborators\nAll clones must migrate before syncing:\n1. Notify team: \"Migrating to v2.0 on [date]\"\n2. All collaborators pull latest\n3. All run `bd migrate --hash-ids`\n4. All push changes\n5. Resume normal work\n\n## Rollback\n```bash\n# Restore backup\nmv .beads.backup .beads\nbd export # Regenerate JSONL\ngit checkout .beads/issues.jsonl\n```\n\n## FAQ\n\n**Q: Can I mix v1.x and v2.0 clones?**\nA: No. All clones must be on same version.\n\n**Q: Will my old issue IDs work?**\nA: No, but aliases preserve the numbers: bd-1c63eb84 β†’ #1\n\n**Q: What happens to links like \"see bd-cb64c226.3\"?**\nA: Migration updates all text references automatically.\n```\n\n### 6. CHANGELOG.md\n```markdown\n## v2.0.0 (YYYY-MM-DD)\n\n### Breaking Changes\n- **Hash-based IDs**: Issues now use collision-free hash IDs (bd-af78e9a2)\n instead of sequential IDs (bd-1c63eb84, bd-9063acda)\n- **Aliasing system**: Human-friendly aliases (#42) for hash IDs\n- **Migration required**: Run `bd migrate --hash-ids` to convert v1.x databases\n\n### Added\n- `bd alias` command for manual alias control\n- `bd migrate --hash-ids` migration tool\n- Alias conflict resolution (deterministic, content-hash ordering)\n\n### Removed\n- ID collision detection and resolution (~2,100 LOC)\n- `bd import --resolve-collisions` flag (no longer needed)\n\n### Benefits\n- βœ… Zero ID collisions in distributed workflows\n- βœ… Simpler codebase (-1,350 net LOC)\n- βœ… Better git merge behavior\n- βœ… True offline-first operation\n```\n\n## Testing\n- Build docs locally (if using doc generator)\n- Check all links work\n- Verify examples are correct\n- Spellcheck\n\n## Files to Create/Modify\n- README.md (hash ID section)\n- AGENTS.md (workflow updates)\n- ADVANCED.md (internals)\n- MIGRATION.md (new)\n- CHANGELOG.md (v2.0 entry)\n- docs/ (any other docs)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T21:28:10.979971-07:00","updated_at":"2025-10-31T12:32:32.611114-07:00","closed_at":"2025-10-31T12:32:32.611114-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.12","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:28:10.981344-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.12","depends_on_id":"bd-f8b764c9.4","type":"blocks","created_at":"2025-10-29T21:28:10.981767-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.12","depends_on_id":"bd-f8b764c9.13","type":"blocks","created_at":"2025-10-29T21:28:10.982167-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.13","content_hash":"5c74ac497d3d2947cf3840e04b317167ce77240c862e2f503a92671adfe8b89d","title":"Add bd alias command for manual alias control","description":"Add command for users to manually view and reassign aliases.\n\n## Command: bd alias\n\n### Subcommands\n\n#### 1. bd alias list\nShow all alias mappings:\n```bash\n$ bd alias list\n#1 β†’ bd-af78e9a2 Fix authentication bug\n#2 β†’ bd-e5f6a7b8 Add logging to daemon\n#42 β†’ bd-1a2b3c4d Investigate jujutsu integration\n#100 β†’ bd-9a8b7c6d (reassigned after conflict)\n```\n\n#### 2. bd alias set \u003calias\u003e \u003chash-id\u003e\nManually assign alias to specific issue:\n```bash\n$ bd alias set 42 bd-1a2b3c4d\nβœ“ Assigned alias #42 to bd-1a2b3c4d\n\n$ bd alias set 1 bd-af78e9a2\nβœ— Error: Alias #1 already assigned to bd-e5f6a7b8\nUse --force to override\n```\n\n#### 3. bd alias compact\nRenumber all aliases to fill gaps:\n```bash\n$ bd alias compact [--dry-run]\n\nCurrent aliases: #1, #2, #5, #7, #100, #101\nAfter compacting: #1, #2, #3, #4, #5, #6\n\nRenumbering:\n #5 β†’ #3\n #7 β†’ #4\n #100 β†’ #5\n #101 β†’ #6\n\nApply changes? [y/N]\n```\n\n#### 4. bd alias reset\nRegenerate all aliases (sequential from 1):\n```bash\n$ bd alias reset [--sort-by=priority|created|id]\n\nWARNING: This will reassign ALL aliases. Continue? [y/N]\n\nReassigning 150 issues by priority:\n bd-a1b2c3d4 β†’ #1 (P0: Critical security bug)\n bd-e5f6a7b8 β†’ #2 (P0: Data loss fix)\n bd-1a2b3c4d β†’ #3 (P1: Jujutsu integration)\n ...\n```\n\n#### 5. bd alias find \u003chash-id\u003e\nLook up alias for hash ID:\n```bash\n$ bd alias find bd-af78e9a2\n#1\n\n$ bd alias find bd-nonexistent\nβœ— Error: Issue not found\n```\n\n## Use Cases\n\n### 1. Keep Important Issues Low-Numbered\n```bash\n# After closing many P0 issues, compact to free low numbers\nbd alias compact\n\n# Or manually set\nbd alias set 1 bd-\u003ccritical-bug-hash\u003e\n```\n\n### 2. Consistent Aliases Across Clones\n```bash\n# After migration, coordinator assigns canonical aliases\nbd alias reset --sort-by=id\ngit add .beads/aliases.jsonl\ngit commit -m \"Canonical alias assignments\"\ngit push\n\n# Other clones pull and adopt\ngit pull\nbd import # Alias conflicts resolved automatically\n```\n\n### 3. Debug Alias Conflicts\n```bash\n# See which aliases were reassigned\nbd alias list | grep \"#100\"\n```\n\n## Flags\n\n### Global\n- `--dry-run`: Preview changes without applying\n- `--force`: Override existing alias assignments\n\n### bd alias reset\n- `--sort-by=priority`: Assign by priority (P0 first)\n- `--sort-by=created`: Assign by creation time (oldest first)\n- `--sort-by=id`: Assign by hash ID (lexicographic)\n\n## Implementation\n\nFile: cmd/bd/alias.go\n```go\nfunc aliasListCmd() *cobra.Command {\n return \u0026cobra.Command{\n Use: \"list\",\n Short: \"List all alias mappings\",\n Run: func(cmd *cobra.Command, args []string) {\n aliases := storage.GetAllAliases()\n for _, a := range aliases {\n fmt.Printf(\"#%-4d β†’ %s %s\\n\", \n a.Alias, a.IssueID, a.Title)\n }\n },\n }\n}\n\nfunc aliasSetCmd() *cobra.Command {\n return \u0026cobra.Command{\n Use: \"set \u003calias\u003e \u003chash-id\u003e\",\n Short: \"Manually assign alias to issue\",\n Args: cobra.ExactArgs(2),\n Run: func(cmd *cobra.Command, args []string) {\n alias, _ := strconv.Atoi(args[0])\n hashID := args[1]\n \n force, _ := cmd.Flags().GetBool(\"force\")\n if err := storage.SetAlias(alias, hashID, force); err != nil {\n fmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n os.Exit(1)\n }\n fmt.Printf(\"βœ“ Assigned alias #%d to %s\\n\", alias, hashID)\n },\n }\n}\n```\n\n## Files to Create\n- cmd/bd/alias.go\n\n## Testing\n- Test alias list output\n- Test alias set with/without force\n- Test alias compact removes gaps\n- Test alias reset with different sort orders\n- Test alias find lookup","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T21:26:53.751795-07:00","updated_at":"2025-10-31T12:32:32.611358-07:00","closed_at":"2025-10-31T12:32:32.611358-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.13","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:26:53.753259-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.13","depends_on_id":"bd-f8b764c9.7","type":"blocks","created_at":"2025-10-29T21:26:53.753733-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.13","depends_on_id":"bd-f8b764c9.6","type":"blocks","created_at":"2025-10-29T21:26:53.754112-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.2","content_hash":"4c24dd0ae5590b8e1a74ac49cc2ac4ba31391e3e9e24d928b4b10d8a559f51b8","title":"Update MCP server for hash IDs","description":"Update beads-mcp server to support hash IDs and aliases.\n\n## Changes Needed\n\n### 1. MCP Function Signatures (No Change)\nFunctions already use issue IDs as strings, so they work with hash IDs:\n\n```python\n# These already work!\nbeads_show(issue_id: str) # Accepts bd-af78e9a2 or #42\nbeads_update(issue_id: str, ...) # Accepts both formats\nbeads_close(issue_ids: List[str]) # Accepts both formats\n```\n\n### 2. Add Alias Resolution Helper\nFile: integrations/beads-mcp/src/beads_mcp/server.py\n\n```python\ndef resolve_issue_id(issue_id: str) -\u003e str:\n \"\"\"Resolve alias to hash ID if needed.\"\"\"\n # Hash ID: pass through\n if issue_id.startswith('bd-') and len(issue_id) == 11:\n return issue_id\n \n # Alias: #42 or 42\n alias_str = issue_id.lstrip('#')\n try:\n alias = int(alias_str)\n # Call bd to resolve\n result = subprocess.run(\n ['bd', 'alias', 'find', f'bd-{alias}'],\n capture_output=True, text=True\n )\n if result.returncode == 0:\n return result.stdout.strip()\n except ValueError:\n pass\n \n # Invalid format\n raise ValueError(f\"Invalid issue ID: {issue_id}\")\n```\n\n### 3. Update Response Formatting\nShow aliases in responses:\n\n```python\n@server.call_tool()\nasync def beads_show(issue_id: str) -\u003e List[TextContent]:\n resolved_id = resolve_issue_id(issue_id)\n \n result = subprocess.run(['bd', 'show', resolved_id], ...)\n \n # Parse response and add alias info\n # Format: \"bd-af78e9a2 (alias: #42)\"\n ...\n```\n\n### 4. Add beads_alias_* Functions\n\n```python\n@server.call_tool()\nasync def beads_alias_list() -\u003e List[TextContent]:\n \"\"\"List all alias mappings.\"\"\"\n result = subprocess.run(['bd', 'alias', 'list'], ...)\n return [TextContent(type=\"text\", text=result.stdout)]\n\n@server.call_tool()\nasync def beads_alias_set(alias: int, issue_id: str) -\u003e List[TextContent]:\n \"\"\"Manually assign alias to issue.\"\"\"\n result = subprocess.run(['bd', 'alias', 'set', str(alias), issue_id], ...)\n return [TextContent(type=\"text\", text=result.stdout)]\n\n@server.call_tool()\nasync def beads_alias_compact() -\u003e List[TextContent]:\n \"\"\"Compact aliases to fill gaps.\"\"\"\n result = subprocess.run(['bd', 'alias', 'compact'], ...)\n return [TextContent(type=\"text\", text=result.stdout)]\n```\n\n### 5. Update Documentation\nFile: integrations/beads-mcp/README.md\n\n```markdown\n## Issue IDs (v2.0+)\n\nThe MCP server accepts both hash IDs and aliases:\n\n```python\n# Using hash IDs\nawait beads_show(issue_id=\"bd-af78e9a2\")\n\n# Using aliases\nawait beads_show(issue_id=\"#42\")\nawait beads_show(issue_id=\"42\") # Shorthand\n```\n\n## Alias Management\n\nNew functions for alias control:\n\n- `beads_alias_list()` - List all alias mappings\n- `beads_alias_set(alias, issue_id)` - Manually assign alias\n- `beads_alias_compact()` - Compact aliases to fill gaps\n\n## Migration\n\nAfter migrating to hash IDs:\n1. Update beads-mcp: `pip install --upgrade beads-mcp`\n2. Restart MCP server\n3. All existing workflows continue to work\n```\n\n### 6. Version Compatibility\nDetect and handle both v1.x and v2.0 formats:\n\n```python\ndef detect_beads_version() -\u003e str:\n \"\"\"Detect if beads is using sequential or hash IDs.\"\"\"\n result = subprocess.run(['bd', 'list', '-n', '1'], ...)\n first_id = parse_first_issue_id(result.stdout)\n \n if first_id.startswith('bd-') and len(first_id) \u003e 11:\n return '2.0' # Hash ID\n else:\n return '1.x' # Sequential ID\n\n# On startup\nbeads_version = detect_beads_version()\nlogger.info(f\"Detected beads version: {beads_version}\")\n```\n\n## Testing\n\n### Unit Tests\nFile: integrations/beads-mcp/tests/test_hash_ids.py\n\n```python\ndef test_resolve_hash_id():\n \"\"\"Hash IDs pass through unchanged.\"\"\"\n assert resolve_issue_id(\"bd-af78e9a2\") == \"bd-af78e9a2\"\n\ndef test_resolve_alias():\n \"\"\"Aliases resolve to hash IDs.\"\"\"\n # Mock bd alias find command\n assert resolve_issue_id(\"#42\") == \"bd-af78e9a2\"\n assert resolve_issue_id(\"42\") == \"bd-af78e9a2\"\n\ndef test_invalid_id():\n \"\"\"Invalid IDs raise ValueError.\"\"\"\n with pytest.raises(ValueError):\n resolve_issue_id(\"invalid\")\n```\n\n### Integration Tests\n```python\nasync def test_show_with_hash_id(mcp_server):\n result = await mcp_server.beads_show(issue_id=\"bd-af78e9a2\")\n assert \"bd-af78e9a2\" in result[0].text\n\nasync def test_show_with_alias(mcp_server):\n result = await mcp_server.beads_show(issue_id=\"#42\")\n assert \"bd-af78e9a2\" in result[0].text # Resolved\n```\n\n## Backward Compatibility\nThe MCP server should work with both:\n- Beads v1.x (sequential IDs)\n- Beads v2.0+ (hash IDs)\n\nDetection happens at runtime based on issue ID format.\n\n## Files to Modify\n- integrations/beads-mcp/src/beads_mcp/server.py\n- integrations/beads-mcp/README.md\n- integrations/beads-mcp/tests/test_hash_ids.py (new)\n- integrations/beads-mcp/pyproject.toml (bump version)\n\n## Deployment\n```bash\ncd integrations/beads-mcp\n# Bump version to 2.0.0\npoetry version 2.0.0\n# Publish to PyPI\npoetry publish --build\n```","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:28:45.256074-07:00","updated_at":"2025-10-31T12:32:32.60786-07:00","closed_at":"2025-10-31T12:32:32.60786-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.2","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:28:45.257315-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.2","depends_on_id":"bd-f8b764c9.7","type":"blocks","created_at":"2025-10-29T21:28:45.258057-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.3","content_hash":"685a1f658d71a0ac37066a20d0ad119fc2714d9cfe9bdb6ea5617b5305c31199","title":"Test: N-clone scenario with hash IDs (no collisions)","description":"Comprehensive test to verify hash IDs eliminate collision problems.\n\n## Test: TestHashIDsNClones\n\n### Purpose\nVerify that N clones can work offline and sync without ID collisions using hash IDs.\n\n### Test Scenario\n```\nSetup:\n- 1 bare remote repo\n- 5 clones (A, B, C, D, E)\n\nOffline Work:\n- Each clone creates 10 issues with different titles\n- No coordination, no network access\n- Total: 50 unique issues\n\nSync:\n- Clones sync in random order\n- Each pull/import other clones' issues\n\nExpected Result:\n- All 5 clones converge to 50 issues\n- Zero ID collisions\n- Zero remapping needed\n- Alias conflicts resolved deterministically\n```\n\n### Implementation\nFile: cmd/bd/beads_hashid_test.go (new)\n\n```go\nfunc TestHashIDsFiveClones(t *testing.T) {\n tmpDir := t.TempDir()\n remoteDir := setupBareRepo(t, tmpDir)\n \n // Setup 5 clones\n clones := make(map[string]string)\n for _, name := range []string{\"A\", \"B\", \"C\", \"D\", \"E\"} {\n clones[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates 10 issues offline\n for name, dir := range clones {\n for i := 0; i \u003c 10; i++ {\n createIssue(t, dir, fmt.Sprintf(\"%s-issue-%d\", name, i))\n }\n // No sync yet!\n }\n \n // Sync in random order\n syncOrder := []string{\"C\", \"A\", \"E\", \"B\", \"D\"}\n for _, name := range syncOrder {\n syncClone(t, clones[name], name)\n }\n \n // Final convergence round\n for _, name := range []string{\"A\", \"B\", \"C\", \"D\", \"E\"} {\n finalPull(t, clones[name], name)\n }\n \n // Verify all clones have all 50 issues\n for name, dir := range clones {\n issues := getIssues(t, dir)\n if len(issues) != 50 {\n t.Errorf(\"Clone %s: expected 50 issues, got %d\", name, len(issues))\n }\n \n // Verify all issue IDs are hash-based\n for _, issue := range issues {\n if !strings.HasPrefix(issue.ID, \"bd-\") || len(issue.ID) != 11 {\n t.Errorf(\"Invalid hash ID: %s\", issue.ID)\n }\n }\n }\n \n // Verify no collision resolution occurred\n // (This would be in logs if it happened)\n \n t.Log(\"βœ“ All 5 clones converged to 50 issues with zero collisions\")\n}\n```\n\n### Edge Case Tests\n\n#### Test: Hash Collision Detection (Artificial)\n```go\nfunc TestHashCollisionDetection(t *testing.T) {\n // Artificially inject collision by mocking hash function\n // Verify system detects and handles it\n}\n```\n\n#### Test: Alias Conflicts Resolved Deterministically\n```go\nfunc TestAliasConflictsNClones(t *testing.T) {\n // Two clones assign same alias to different issues\n // Verify deterministic resolution (content-hash ordering)\n // Verify all clones converge to same alias assignments\n}\n```\n\n#### Test: Mixed Sequential and Hash IDs (Should Fail)\n```go\nfunc TestMixedIDsRejected(t *testing.T) {\n // Try to import JSONL with sequential IDs into hash-ID database\n // Verify error or warning\n}\n```\n\n### Performance Test\n\n#### Benchmark: Hash ID Generation\n```go\nfunc BenchmarkHashIDGeneration(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n GenerateHashID(\"title\", \"description\", time.Now(), \"workspace-id\")\n }\n}\n\n// Expected: \u003c 1ΞΌs per generation\n```\n\n#### Benchmark: N-Clone Convergence Time\n```go\nfunc BenchmarkNCloneConvergence(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n // Measure total convergence time\n })\n }\n}\n\n// Expected: Linear scaling O(N)\n```\n\n### Acceptance Criteria\n- TestHashIDsFiveClones passes reliably (10/10 runs)\n- Zero ID collisions in any scenario\n- All clones converge in single round (not multi-round like old system)\n- Alias conflicts resolved deterministically\n- Performance benchmarks meet targets (\u003c1ΞΌs hash gen)\n\n## Files to Create\n- cmd/bd/beads_hashid_test.go\n\n## Comparison to Old System\nThis test replaces:\n- TestTwoCloneCollision (bd-71107098) - no longer needed\n- TestThreeCloneCollision (bd-cbed9619) - no longer needed\n- TestFiveCloneCollision (bd-a40f374f) - no longer needed\n\nOld system required complex collision resolution and multi-round convergence.\nNew system: single-round convergence with zero collisions.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:27:26.954107-07:00","updated_at":"2025-10-31T12:32:32.608225-07:00","closed_at":"2025-10-31T12:32:32.608225-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.3","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:27:26.955522-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.3","depends_on_id":"bd-f8b764c9.5","type":"blocks","created_at":"2025-10-29T21:27:26.956175-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.4","content_hash":"aee576c356f257607f55fb4bbbbe8a2da93bd0350ba444e7a5c5629c253de836","title":"Migration tool: sequential β†’ hash IDs","description":"Create migration tool to convert existing sequential-ID databases to hash-ID format.\n\n## Command: bd migrate --hash-ids\n\n```bash\nbd migrate --hash-ids [--dry-run]\n```\n\n## Migration Process\n\n### 1. Backup Database\n```bash\ncp .beads/beads.db .beads/beads.db.backup-1761798384\necho \"βœ“ Backup created: .beads/beads.db.backup-1234567890\"\n```\n\n### 2. Generate Hash IDs for Existing Issues\n```go\nfunc migrateToHashIDs(db *SQLiteStorage) error {\n // Read all issues\n issues, err := db.ListIssues(ctx, ListOptions{Status: \"all\"})\n \n // Generate mapping: old ID β†’ new hash ID\n mapping := make(map[string]string)\n for _, issue := range issues {\n hashID := GenerateHashID(\n issue.Title,\n issue.Description,\n issue.CreatedAt,\n db.workspaceID,\n )\n mapping[issue.ID] = hashID\n }\n \n // Detect hash collisions (extremely rare)\n if hasCollisions(mapping) {\n return fmt.Errorf(\"hash collision detected, aborting\")\n }\n \n return nil\n}\n```\n\n### 3. Update Database Schema\n```sql\n-- Add alias column\nALTER TABLE issues ADD COLUMN alias INTEGER UNIQUE;\n\n-- Populate aliases from old IDs\nUPDATE issues SET alias = CAST(SUBSTR(id, 4) AS INTEGER)\n WHERE id LIKE 'bd-%' AND SUBSTR(id, 4) GLOB '[0-9]*';\n\n-- Create new issues_new table with hash IDs\nCREATE TABLE issues_new (\n id TEXT PRIMARY KEY, -- Hash IDs now\n alias INTEGER UNIQUE,\n title TEXT NOT NULL,\n -- ... rest of schema\n);\n\n-- Copy data with ID mapping\nINSERT INTO issues_new SELECT \n \u003cnew_hash_id\u003e, -- From mapping\n alias,\n title,\n -- ...\nFROM issues;\n\n-- Drop old table, rename new\nDROP TABLE issues;\nALTER TABLE issues_new RENAME TO issues;\n```\n\n### 4. Update Dependencies\n```sql\n-- Update depends_on_id using mapping\nUPDATE dependencies \nSET issue_id = \u003cnew_hash_id\u003e,\n depends_on_id = \u003cnew_depends_on_hash_id\u003e\nFROM mapping;\n```\n\n### 5. Update Text References\n```go\n// Update all text fields that mention old IDs\nfunc updateTextReferences(db *SQLiteStorage, mapping map[string]string) error {\n for oldID, newID := range mapping {\n // Update description, notes, design, acceptance_criteria\n db.Exec(`UPDATE issues SET \n description = REPLACE(description, ?, ?),\n notes = REPLACE(notes, ?, ?),\n design = REPLACE(design, ?, ?),\n acceptance_criteria = REPLACE(acceptance_criteria, ?, ?)\n `, oldID, newID, oldID, newID, oldID, newID, oldID, newID)\n }\n}\n```\n\n### 6. Export to JSONL\n```bash\nbd export # Writes hash IDs to .beads/issues.jsonl\ngit add .beads/issues.jsonl\ngit commit -m \"Migrate to hash-based IDs\"\n```\n\n## Output\n```bash\n$ bd migrate --hash-ids\nMigrating to hash-based IDs...\nβœ“ Backup created: .beads/beads.db.backup-1730246400\nβœ“ Generated 150 hash IDs\nβœ“ No hash collisions detected\nβœ“ Updated issues table schema\nβœ“ Updated 150 issue IDs\nβœ“ Updated 87 dependencies\nβœ“ Updated 234 text references\nβœ“ Exported to .beads/issues.jsonl\nβœ“ Migration complete!\n\nNext steps:\n 1. Test: bd list, bd show #1, etc.\n 2. Commit: git commit -m \"Migrate to hash-based IDs\"\n 3. Push: git push origin main\n 4. Notify collaborators to pull and re-init\n```\n\n## Dry Run Mode\n```bash\n$ bd migrate --hash-ids --dry-run\n[DRY RUN] Would migrate 150 issues:\n bd-1c63eb84 β†’ bd-af78e9a2 (alias: #1)\n bd-9063acda β†’ bd-e5f6a7b8 (alias: #2)\n ...\n bd-150 β†’ bd-9a8b7c6d (alias: #150)\n\n[DRY RUN] Would update:\n - 150 issue IDs\n - 87 dependencies\n - 234 text references in descriptions/notes\n\nNo changes made. Run without --dry-run to apply.\n```\n\n## Files to Create\n- cmd/bd/migrate.go (new command)\n- internal/storage/sqlite/migrations/hash_ids.go\n\n## Testing\n- Test migration on small database (10 issues)\n- Test migration on large database (1000 issues)\n- Test hash collision detection (inject collision artificially)\n- Test text reference updates\n- Test rollback (restore from backup)\n- Test migrated database works correctly\n\n## Rollback Procedure\n```bash\n# If migration fails or has issues\nmv .beads/beads.db.backup-1234567890 .beads/beads.db\nbd export # Restore JSONL from backup DB\n```\n\n## Multi-Clone Coordination\n**Important**: All clones must migrate before syncing:\n\n1. Coordinator sends message: \"Migrating to hash IDs on 2025-10-30 at 10:00 UTC\"\n2. All collaborators pull latest changes\n3. All run: `bd migrate --hash-ids`\n4. All push changes\n5. New work can continue with hash IDs\n\n**Do NOT**:\n- Mix sequential and hash IDs in same database\n- Sync before all clones migrate","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:26:24.563993-07:00","updated_at":"2025-10-31T12:32:32.608574-07:00","closed_at":"2025-10-31T12:32:32.608574-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.4","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:26:24.565325-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.4","depends_on_id":"bd-f8b764c9.9","type":"blocks","created_at":"2025-10-29T21:26:24.565945-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.5","content_hash":"7ae3ba781e9af4bb9d76d8933c3da218bce1e7ca287314ae41a9959eefe0b9b4","title":"Delete collision resolution code","description":"Remove ~2,100 LOC of ID collision detection and resolution code (no longer needed with hash IDs).\n\n## Files to Delete Entirely\n```\ninternal/storage/sqlite/collision.go (~800 LOC)\ninternal/storage/sqlite/collision_test.go (~300 LOC)\ncmd/bd/autoimport_collision_test.go (~400 LOC)\n```\n\n## Code to Remove from Existing Files\n\n### internal/importer/importer.go\nRemove:\n- `DetectCollisions()` calls\n- `ScoreCollisions()` logic\n- `RemapCollisions()` calls\n- `handleRename()` function\n- All collision-related error handling\n\nKeep:\n- Basic import logic\n- Exact match detection (idempotent import)\n\n### beads_twoclone_test.go\nRemove:\n- `TestTwoCloneCollision` (bd-71107098)\n- `TestThreeCloneCollision` (bd-cbed9619)\n- `TestFiveCloneCollision` (bd-a40f374f)\n- All N-way collision tests\n\n### cmd/bd/import.go\nRemove:\n- `--resolve-collisions` flag\n- `--dry-run` collision preview\n- Collision reporting\n\n## Issues Closed by This Change\n- bd-71107098: Add test for symmetric collision\n--89: Content-hash collision resolution\n- bd-cbed9619: N-way collision resolution epic\n- bd-cbed9619.5: Add ScoreCollisions (already done but now unnecessary)\n- bd-cbed9619.4: Make DetectCollisions read-only\n- bd-cbed9619.3: ResolveNWayCollisions function\n- bd-cbed9619.2: Multi-round import convergence\n- bd-cbed9619.1: Multi-round convergence for N-way collisions\n- bd-e6d71828: Transaction + retry logic for collisions\n- bd-70419816: Test case for symmetric collision\n\n## Verification Steps\n1. `grep -r \"collision\" --include=\"*.go\"` β†’ should only find alias conflicts\n2. `go test ./...` β†’ all tests pass\n3. `go build ./cmd/bd` β†’ clean build\n4. Check LOC reduction: `git diff --stat`\n\n## Expected Metrics\n- **Files deleted**: 3\n- **LOC removed**: ~2,100\n- **Test coverage**: Should increase (less untested code)\n- **Binary size**: Slightly smaller\n\n## Caution\nDo NOT delete:\n- Alias conflict resolution (new code in bd-f8b764c9.6)\n- Duplicate detection (bd-581b80b3, bd-149) - different from ID collisions\n- Merge conflict resolution (bd-7e7ddffa.1, bd-5f483051) - git conflicts, not ID collisions\n\n## Files to Modify\n- internal/importer/importer.go (remove collision handling)\n- cmd/bd/import.go (remove --resolve-collisions flag)\n- beads_twoclone_test.go (remove collision tests)\n- Delete: internal/storage/sqlite/collision.go\n- Delete: internal/storage/sqlite/collision_test.go \n- Delete: cmd/bd/autoimport_collision_test.go\n\n## Testing\n- Ensure all remaining tests pass\n- Manual test: create issue on two clones, sync β†’ no collisions\n- Verify error if somehow hash collision occurs (extremely unlikely)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:25:50.976383-07:00","updated_at":"2025-10-31T12:32:32.608942-07:00","closed_at":"2025-10-31T12:32:32.608942-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.5","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:25:50.977857-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.5","depends_on_id":"bd-f8b764c9.9","type":"blocks","created_at":"2025-10-29T21:25:50.978395-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.5","depends_on_id":"bd-f8b764c9.8","type":"blocks","created_at":"2025-10-29T21:25:50.978842-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.6","content_hash":"e887a44bae3f6f34adf0ab6e87daaf48deafab0c1d9d62c773555c89132d5adf","title":"Implement alias conflict resolution","description":"Handle alias conflicts when multiple clones assign same alias to different issues.\n\n## Scenario\n```\nClone A: Creates bd-a1b2c3d4, assigns alias #42\nClone B: Creates bd-e5f6a7b8, assigns alias #42\nAfter sync: Conflict! Which issue gets #42?\n```\n\n## Resolution Strategy: Content-Hash Ordering\nDeterministic, same result on all clones:\n```go\nfunc ResolveAliasConflicts(conflicts []AliasConflict) []AliasRemapping {\n for _, conflict := range conflicts {\n // Sort by hash ID (lexicographic)\n sort.Strings(conflict.IssueIDs)\n \n // Winner: lowest hash ID (arbitrary but deterministic)\n winner := conflict.IssueIDs[0]\n \n // Losers: reassign to next available aliases\n for _, loser := range conflict.IssueIDs[1:] {\n newAlias := getNextAlias()\n remappings = append(remappings, AliasRemapping{\n IssueID: loser,\n OldAlias: conflict.Alias,\n NewAlias: newAlias,\n })\n }\n }\n return remappings\n}\n```\n\n## Detection During Import\nFile: internal/importer/importer.go\n```go\nfunc handleAliasConflicts(imported []Issue, existing []Issue) error {\n // Build alias map from imported issues\n aliasMap := make(map[int][]string) // alias β†’ issue IDs\n \n for _, issue := range imported {\n aliasMap[issue.Alias] = append(aliasMap[issue.Alias], issue.ID)\n }\n \n // Check against existing aliases\n for alias, importedIDs := range aliasMap {\n existingID := storage.GetIssueIDByAlias(alias)\n if existingID != \"\" {\n // Conflict! Resolve it\n allIDs := append(importedIDs, existingID)\n conflicts = append(conflicts, AliasConflict{\n Alias: alias,\n IssueIDs: allIDs,\n })\n }\n }\n \n // Resolve and apply\n remappings := ResolveAliasConflicts(conflicts)\n applyAliasRemappings(remappings)\n}\n```\n\n## Alternative Strategies (For Future Consideration)\n\n### Priority-Based\n```go\n// Higher priority keeps alias\nif issueA.Priority \u003c issueB.Priority {\n winner = issueA\n}\n```\n\n### Timestamp-Based (Last-Write-Wins)\n```go\n// Newer issue keeps alias\nif issueA.UpdatedAt.After(issueB.UpdatedAt) {\n winner = issueA\n}\n```\n\n### Manual Resolution\n```bash\nbd resolve-aliases --manual\n# Interactive prompt for each conflict\n```\n\n## User Notification\n```bash\n$ bd sync\nβœ“ Synced 5 issues\n⚠ Alias conflicts resolved:\n - Issue bd-e5f6a7b8: alias changed from #42 to #100\n - Issue bd-9a8b7c6d: alias changed from #15 to #101\n```\n\n## Files to Create/Modify\n- internal/storage/sqlite/alias_conflicts.go (new)\n- internal/importer/importer.go (detect conflicts)\n- cmd/bd/sync.go (show conflict notifications)\n\n## Testing\n- Test two clones assign same alias to different issues\n- Test conflict resolution is deterministic (same on all clones)\n- Test loser gets new alias\n- Test winner keeps original alias\n- Test multiple conflicts resolved in one import","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:25:27.389191-07:00","updated_at":"2025-10-31T12:32:32.609245-07:00","closed_at":"2025-10-31T12:32:32.609245-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.6","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:25:27.390611-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.6","depends_on_id":"bd-f8b764c9.10","type":"blocks","created_at":"2025-10-29T21:25:27.391127-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.6","depends_on_id":"bd-f8b764c9.8","type":"blocks","created_at":"2025-10-29T21:25:27.39154-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.7","content_hash":"122d3be0208ba25a8f3322c221e2146e970a6d544e171338594e02694774f1eb","title":"CLI accepts both hash IDs and aliases","description":"Update all CLI commands to accept both hash IDs (bd-af78e9a2) and aliases (#42, or just 42).\n\n## Parsing Logic\n```go\n// internal/utils/id_parser.go\nfunc ParseIssueID(input string) (issueID string, err error) {\n // Hash ID: bd-af78e9a2\n if strings.HasPrefix(input, \"bd-\") {\n return input, nil\n }\n \n // Alias: #42 or 42\n aliasStr := strings.TrimPrefix(input, \"#\")\n alias, err := strconv.Atoi(aliasStr)\n if err != nil {\n return \"\", fmt.Errorf(\"invalid issue ID: %s\", input)\n }\n \n // Resolve alias to hash ID\n return storage.GetIssueIDByAlias(alias)\n}\n```\n\n## Commands to Update\nAll commands that accept issue IDs:\n\n### 1. bd show\n```bash\nbd show bd-af78e9a2 # Hash ID\nbd show #42 # Alias\nbd show 42 # Alias (shorthand)\nbd show bd-af78e9a2 #42 # Mixed (multiple IDs)\n```\n\n### 2. bd update\n```bash\nbd update #42 --status in_progress\nbd update bd-af78e9a2 --priority 1\n```\n\n### 3. bd close\n```bash\nbd close #42 --reason \"Done\"\n```\n\n### 4. bd dep add/tree\n```bash\nbd dep add #42 #1 --type blocks\nbd dep tree bd-af78e9a2\n```\n\n### 5. bd label add/remove\n```bash\nbd label add #42 critical\n```\n\n### 6. bd merge\n```bash\nbd merge #42 #43 --into #41\n```\n\n## Display Format\nDefault to showing aliases in output:\n```bash\n$ bd list\n#1 Fix authentication bug P1 open\n#2 Add logging to daemon P2 open \n#42 Investigate jujutsu integration P3 open\n```\n\nWith `--format=hash` flag:\n```bash\n$ bd list --format=hash\nbd-af78e9a2 Fix authentication bug P1 open\nbd-e5f6a7b8 Add logging to daemon P2 open\nbd-1a2b3c4d Investigate jujutsu integration P3 open\n```\n\n## Files to Modify\n- internal/utils/id_parser.go (new)\n- cmd/bd/show.go\n- cmd/bd/update.go\n- cmd/bd/close.go\n- cmd/bd/reopen.go\n- cmd/bd/dep.go\n- cmd/bd/label.go\n- cmd/bd/merge.go\n- cmd/bd/list.go (add --format flag)\n\n## Testing\n- Test hash ID parsing\n- Test alias parsing (#42, 42)\n- Test mixed IDs in single command\n- Test error on invalid ID\n- Test alias resolution failure","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:25:06.256317-07:00","updated_at":"2025-10-31T12:32:32.609634-07:00","closed_at":"2025-10-31T12:32:32.609634-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.7","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:25:06.257796-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.7","depends_on_id":"bd-f8b764c9.10","type":"blocks","created_at":"2025-10-29T21:25:06.258307-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.7","depends_on_id":"bd-f8b764c9.8","type":"blocks","created_at":"2025-10-29T21:29:45.993274-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.8","content_hash":"9acb99b9ef8844849c6b684db012f966db5766e0a7e452f9768d8611d90ad9b8","title":"Update JSONL format to use hash IDs","description":"Update JSONL import/export to use hash IDs, store aliases separately.\n\n## Current JSONL Format\n```jsonl\n{\"id\":\"bd-1c63eb84\",\"title\":\"Fix bug\",\"status\":\"open\",...}\n{\"id\":\"bd-9063acda\",\"title\":\"Add test\",\"status\":\"open\",...}\n```\n\n## New JSONL Format (Option A: Include Alias)\n```jsonl\n{\"id\":\"bd-af78e9a2\",\"alias\":1,\"title\":\"Fix bug\",\"status\":\"open\",...}\n{\"id\":\"bd-e5f6a7b8\",\"alias\":2,\"title\":\"Add test\",\"status\":\"open\",...}\n```\n\n## New JSONL Format (Option B: Hash ID Only)\n```jsonl\n{\"id\":\"bd-af78e9a2\",\"title\":\"Fix bug\",\"status\":\"open\",...}\n{\"id\":\"bd-e5f6a7b8\",\"title\":\"Add test\",\"status\":\"open\",...}\n```\n\nStore aliases in separate .beads/aliases.jsonl (local only, git-ignored):\n```jsonl\n{\"hash\":\"bd-af78e9a2\",\"alias\":1}\n{\"hash\":\"bd-e5f6a7b8\",\"alias\":2}\n```\n\n**Recommendation**: Option B (hash only in main JSONL)\n- Cleaner git diffs (no alias conflicts)\n- Aliases are workspace-local preference\n- Main JSONL is canonical, portable\n\n## Export Changes\nFile: cmd/bd/export.go\n```go\n// Export issues with hash IDs\nfor _, issue := range issues {\n json := marshalIssue(issue) // Uses issue.ID (hash)\n // Don't include alias in JSONL\n}\n\n// Separately export aliases to .beads/aliases.jsonl\nexportAliases(issues)\n```\n\n## Import Changes \nFile: cmd/bd/import.go, internal/importer/importer.go\n```go\n// Import issues by hash ID\nissue := unmarshalIssue(line)\n// Assign new alias on import (don't use incoming alias)\nissue.Alias = getNextAlias()\n\n// No collision detection needed! Hash IDs are globally unique\n```\n\n## Dependency Reference Format\nNo change needed - already uses issue IDs:\n```json\n{\"depends_on_id\":\"bd-af78e9a2\",\"type\":\"blocks\"}\n```\n\n## Files to Modify\n- cmd/bd/export.go (use hash IDs)\n- cmd/bd/import.go (import hash IDs, assign aliases)\n- internal/importer/importer.go (remove collision detection!)\n- .gitignore (add .beads/aliases.jsonl)\n\n## Testing\n- Test export produces hash IDs\n- Test import assigns new aliases\n- Test dependencies preserved with hash IDs\n- Test no collision detection triggered","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:47.408106-07:00","updated_at":"2025-10-31T12:32:32.609925-07:00","closed_at":"2025-10-31T12:32:32.609925-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.8","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:47.409489-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.8","depends_on_id":"bd-f8b764c9.9","type":"blocks","created_at":"2025-10-29T21:24:47.409977-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.8","depends_on_id":"bd-f8b764c9.10","type":"blocks","created_at":"2025-10-29T21:29:45.975499-07:00","created_by":"stevey"}]} -{"id":"bd-f8b764c9.9","content_hash":"f248cddca9cd0cbad13c74ee8537251e73d429d863a272259fdef786a97f53d1","title":"Implement hash ID generation in CreateIssue","description":"Replace sequential ID generation with hash-based IDs in CreateIssue function.\n\n## Current Behavior (internal/storage/sqlite/sqlite.go)\n```go\nfunc (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue) error {\n // ID comes from auto-increment counter\n // Collisions possible across clones\n}\n```\n\n## New Behavior\n```go\nfunc (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue) error {\n // Generate hash ID if not provided\n if issue.ID == \"\" {\n issue.ID = idgen.GenerateHashID(\n issue.Title,\n issue.Description,\n time.Now(),\n s.workspaceID,\n )\n }\n \n // Assign next alias\n issue.Alias = s.getNextAlias()\n \n // Insert with hash ID + alias\n // ...\n}\n```\n\n## Workspace ID Generation\nAdd to database initialization:\n```go\n// Generate stable workspace ID (persisted in .beads/workspace_id)\nworkspaceID := getOrCreateWorkspaceID()\n```\n\nOptions for workspace ID:\n1. Hostname + random suffix\n2. UUID (random)\n3. Git remote URL hash (deterministic per repo)\n\nRecommended: Option 3 (git remote hash) for reproducibility\n\n## Hash Collision Detection\n```go\n// On insert, check for collision (unlikely but possible)\nexisting, err := s.GetIssue(ctx, issue.ID)\nif err == nil {\n // Hash collision! Add random suffix and retry\n issue.ID = issue.ID + \"-\" + randomSuffix(4)\n}\n```\n\n## Files to Create/Modify\n- internal/types/id_generator.go (new)\n- internal/storage/sqlite/sqlite.go (CreateIssue)\n- internal/storage/sqlite/workspace.go (new - workspace ID management)\n- .beads/workspace_id (new file, git-ignored)\n\n## Testing\n- Test hash ID generation is deterministic\n- Test collision detection and retry\n- Test workspace ID persistence\n- Benchmark: hash generation performance (\u003c1ΞΌs)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:29.412237-07:00","updated_at":"2025-10-31T12:32:32.610403-07:00","closed_at":"2025-10-31T12:32:32.610403-07:00","source_repo":".","dependencies":[{"issue_id":"bd-f8b764c9.9","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:29.413417-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.9","depends_on_id":"bd-f8b764c9.11","type":"blocks","created_at":"2025-10-29T21:24:29.413823-07:00","created_by":"stevey"}]} -{"id":"bd-f9a1","content_hash":"97f9387b20f741a9f71ee43b0671b5d970bd594098db299dc871d0b3074c5384","title":"Add index usage verification test for external_ref lookups","description":"Currently we test that idx_issues_external_ref index exists, but we don't verify that it's actually being used by the query planner.\n\nProposed solution:\n- Add test using EXPLAIN QUERY PLAN\n- Verify that 'SEARCH TABLE issues USING INDEX idx_issues_external_ref' appears in plan\n- Ensures O(1) lookup performance is maintained\n\nRelated: bd-1022\nFiles: internal/storage/sqlite/external_ref_test.go:260","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-02T15:32:09.85419-08:00","updated_at":"2025-11-02T16:04:47.221064-08:00","closed_at":"2025-11-02T16:04:47.221064-08:00","source_repo":"."} -{"id":"bd-fasa","content_hash":"bc2c647cac7355a66fa4aefd116c82e01f536da4b4404e922b3307505413210f","title":"Prefix detection treats embedded hyphens as prefix delimiters","description":"The prefix detection logic in bd import incorrectly identifies issues like 'vc-baseline-test' and 'vc-92cl-gate-test' as having different prefixes ('vc-baseline-' and 'vc-92cl-gate-') instead of recognizing them as having the standard 'vc-' prefix with hyphenated suffixes.\n\nThis breaks import with error: 'prefix mismatch detected: database uses vc- but found issues with prefixes: [vc-92cl-gate- (1 issues) vc-baseline- (1 issues)]'\n\nThe prefix should be determined by the pattern: prefix is everything up to and including the first hyphen. The suffix can contain hyphens without being treated as part of the prefix.\n\nExample problematic IDs:\n- vc-baseline-test (detected as prefix: vc-baseline-)\n- vc-92cl-gate-test (detected as prefix: vc-92cl-gate-)\n- vc-test (correctly detected as prefix: vc-)\n\nImpact: Users cannot use descriptive multi-part IDs without triggering false prefix mismatch errors.","acceptance_criteria":"- Prefix detection only considers the first hyphen as prefix delimiter\n- IDs like 'vc-baseline-test' correctly identified as having prefix 'vc-'\n- Import succeeds without --rename-on-import for hyphenated suffixes\n- Tests added for multi-part ID suffix handling","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-09T14:27:19.046489-08:00","updated_at":"2025-11-09T14:53:53.22312-08:00","closed_at":"2025-11-09T14:53:53.22312-08:00","source_repo":"."} -{"id":"bd-fb05","content_hash":"1d99061e4ac1564982acc5e141674adf3bb7db789d546c12deb9108435af6450","title":"Refactor sqlite.go into focused modules","description":"Split sqlite.go (2,298 lines) into focused modules: migrations.go, ids.go, issues.go, events.go, dirty.go, db.go. This will improve maintainability and reduce cognitive load.","design":"Files to create:\n- migrations.go: Migration registry + runner\n- ids.go: ID generation/validation \n- issues.go: CRUD helpers\n- events.go: Event helpers\n- dirty.go: dirty_issues helpers\n- db.go: New/open, DSN construction\n- tx.go: Transaction helper","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-01T11:41:14.805895-07:00","updated_at":"2025-11-01T22:30:09.833675-07:00","closed_at":"2025-11-01T22:30:09.833675-07:00","source_repo":"."} -{"id":"bd-fb95094c","content_hash":"6ed1829c3120d5469de6ca758ca40322d78de477d67892a51a77aedb26fffa0c","title":"Code Health \u0026 Technical Debt Cleanup","description":"Comprehensive codebase cleanup to remove dead code, refactor monolithic files, deduplicate utilities, and improve maintainability. Based on ultrathink code health analysis conducted 2025-10-27.\n\nGoals:\n- Remove ~1,500 LOC of dead/unreachable code\n- Split 2 monolithic files (server.go 2,273 LOC, sqlite.go 2,136 LOC) into focused modules\n- Deduplicate scattered utility functions (normalizeLabels, BD_DEBUG checks)\n- Consolidate test coverage (2,019 LOC of collision tests)\n- Improve code navigation and reduce merge conflicts\n\nImpact: Reduces codebase by ~6-8%, improves maintainability, faster CI/CD\n\nEstimated Effort: 11 days across 4 phases","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-27T20:39:22.22227-07:00","updated_at":"2025-11-23T14:14:13.333263-08:00","closed_at":"2025-11-08T18:15:59.971899-08:00","source_repo":".","labels":["cleanup","epic"]} -{"id":"bd-fb95094c.1","content_hash":"8f7533da448dea49a01aa747892eab9f855127343ced4fbd6e17cb80d56419af","title":"Run final validation and cleanup checks","description":"Final validation pass to ensure all cleanup objectives met and no regressions introduced.\n\nValidation checklist:\n1. Dead code verification: `go run golang.org/x/tools/cmd/deadcode@latest -test ./...`\n2. Test coverage: `go test -cover ./...`\n3. Build verification: `go build ./cmd/bd/`\n4. Linting: `golangci-lint run`\n5. Integration tests\n6. Metrics verification\n7. Git clean check\n\nFinal metrics to report:\n- LOC removed: ~____\n- Files deleted: ____\n- Files created: ____\n- Test coverage: ____%\n- Build time: ____ (before/after)\n- Test run time: ____ (before/after)\n\nImpact: Confirms all cleanup objectives achieved successfully","acceptance_criteria":"- Zero unreachable functions per deadcode analyzer\n- All tests pass: `go test ./...`\n- Test coverage maintained or improved\n- Builds cleanly: `go build ./...`\n- Linting shows improvements\n- Integration tests all pass\n- LOC reduction target achieved (~2,500 LOC)\n- No unintended behavior changes\n- Git commit messages document all changes","notes":"Validation completed:\n- LOC: 52,372 lines total\n- Dead code: 4 functions in import_shared.go (tracked in bd-6fe4622f)\n- Build: βœ“ Successful\n- Test coverage: ~20-82% across packages\n- Test failure: TestTwoCloneCollision (timeout issue)\n- Linting: errcheck warnings present (defer close, fmt errors)\n- Test time: ~20s\n\nIssues found:\n1. bd-6fe4622f: Remove unreachable import functions (renameImportedIssuePrefixes, etc)\n2. TestTwoCloneCollision: Daemon killall timeout causing test failure\n3. Linting: errcheck violations need fixing","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T20:32:00.14166-07:00","updated_at":"2025-10-30T17:12:58.209988-07:00","closed_at":"2025-10-28T14:11:25.218801-07:00","source_repo":".","labels":["phase-4","validation"],"dependencies":[{"issue_id":"bd-fb95094c.1","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:32:00.144113-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.10","content_hash":"61c66c65457e40c96e8d4192ae8f18c8145a516ef81f656f0535a4418d2dfeb5","title":"Consider central serialization package for JSON handling","description":"Multiple parts of the codebase handle JSON serialization of issues with slightly different approaches. Consider creating a centralized serialization package to ensure consistency.\n\nCurrent serialization locations:\n- `cmd/bd/export.go` - JSONL export (issues to file)\n- `cmd/bd/import.go` - JSONL import (file to issues)\n- `internal/rpc/protocol.go` - RPC JSON marshaling\n- `internal/storage/memory/memory.go` - In-memory marshaling\n\nPotential benefits:\n- Single source of truth for JSON format\n- Consistent field naming\n- Easier to add new fields\n- Centralized validation\n\nNote: This is marked **optional** because:\n- Current serialization mostly works\n- May not provide enough benefit to justify refactor\n- Risk of breaking compatibility\n\nDecision point: Evaluate if benefits outweigh refactoring cost\n\nImpact: TBD based on investigation - may defer to future work","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-27T20:31:19.090608-07:00","updated_at":"2025-11-23T14:14:13.333811-08:00","closed_at":"2025-11-08T18:15:54.319047-08:00","source_repo":".","labels":["deduplication","optional","phase-3","refactor","serialization"],"dependencies":[{"issue_id":"bd-fb95094c.10","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:31:19.092328-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.2","content_hash":"685c91a6de8e1610feb5dbda18412f3eee178a37064d9ddf55511fb693dec9ba","title":"Delete skipped tests for \"old buggy behavior\"","description":"Three test functions are permanently skipped with comments indicating they test behavior that was fixed in GH#120. These tests will never run again and should be deleted.\n\nTest functions to remove:\n\n1. `cmd/bd/import_collision_test.go:228`\n ```go\n t.Skip(\"Test expects old buggy behavior - needs rewrite for GH#120 fix\")\n ```\n\n2. `cmd/bd/import_collision_test.go:505`\n ```go\n t.Skip(\"Test expects old buggy behavior - needs rewrite for GH#120 fix\")\n ```\n\n3. `internal/storage/sqlite/collision_test.go:919`\n ```go\n t.Skip(\"Test expects old buggy behavior - needs rewrite for GH#120 fix\")\n ```\n\nImpact: Removes ~150 LOC of permanently skipped tests","acceptance_criteria":"- Delete the 3 test functions entirely (~150 LOC total)\n- Update test file comments to reference GH#120 fix if needed\n- All remaining tests pass: `go test ./...`\n- No reduction in meaningful test coverage (these test fixed bugs)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T20:30:19.961185-07:00","updated_at":"2025-10-30T17:12:58.196387-07:00","closed_at":"2025-10-28T14:09:21.642632-07:00","source_repo":".","labels":["cleanup","dead-code","phase-1","test-cleanup"],"dependencies":[{"issue_id":"bd-fb95094c.2","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:19.962815-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.3","content_hash":"8288e825cb58ac818cc18c0b6a06addd1621a458d68431e4b1747953493f2cad","title":"Update documentation after code health cleanup","description":"Update all documentation to reflect code structure changes after cleanup phases complete.\n\nDocumentation to update:\n1. **AGENTS.md** - Update file structure references\n2. **CONTRIBUTING.md** (if exists) - Update build/test instructions\n3. **Code comments** - Update any outdated references\n4. **Package documentation** - Update godoc for reorganized packages\n\nNew documentation to add:\n1. **internal/util/README.md** - Document shared utilities\n2. **internal/debug/README.md** - Document debug logging\n3. **internal/rpc/README.md** - Document new file organization\n4. **internal/storage/sqlite/migrations/README.md** - Migration system docs\n\nImpact: Keeps documentation in sync with code","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:32:00.141028-07:00","updated_at":"2025-11-23T14:14:13.334363-08:00","closed_at":"2025-11-08T18:15:48.644285-08:00","source_repo":".","labels":["documentation","phase-4"],"dependencies":[{"issue_id":"bd-fb95094c.3","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:32:00.1423-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.4","content_hash":"c2831a4b1f3847a8aff257d72eda7aa280b7f572a3e4e72d2283a9af367b52ea","title":"Audit and consolidate collision test coverage","description":"The codebase has 2,019 LOC of collision detection tests across 3 files. Run coverage analysis to identify redundant test cases and consolidate.\n\nTest files:\n- `cmd/bd/import_collision_test.go` - 974 LOC\n- `cmd/bd/autoimport_collision_test.go` - 750 LOC\n- `cmd/bd/import_collision_regression_test.go` - 295 LOC\n\nTotal: 2,019 LOC of collision tests\n\nAnalysis steps:\n1. Run coverage analysis\n2. Identify redundant tests\n3. Document findings\n\nConsolidation strategy:\n- Keep regression tests for critical bugs\n- Merge overlapping table-driven tests\n- Remove redundant edge case tests covered elsewhere\n- Ensure all collision scenarios still tested\n\nExpected outcome: Reduce to ~1,200 LOC (save ~800 lines) while maintaining coverage\n\nImpact: Faster test runs, easier maintenance, clearer test intent","acceptance_criteria":"- Coverage analysis completed and documented\n- Redundant tests identified (~800 LOC estimated)\n- Consolidated test suite maintains or improves coverage\n- All remaining tests pass: `go test ./cmd/bd/...`\n- Test run time unchanged or faster\n- Document which tests were removed and why\n- Coverage percentage maintained: `go test -cover ./cmd/bd/` shows same %","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:32:00.130855-07:00","updated_at":"2025-11-08T01:58:15.283373-08:00","closed_at":"2025-11-07T23:27:41.970013-08:00","source_repo":".","labels":["phase-4","test-cleanup"],"dependencies":[{"issue_id":"bd-fb95094c.4","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:32:00.132251-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.5","content_hash":"11521fe159f640e2cefd3d138fbbbc3b8d2b4fda48c6542f39761d5a124d6154","title":"Centralize BD_DEBUG logging into debug package","description":"The codebase has 43 scattered instances of `if os.Getenv(\"BD_DEBUG\") != \"\"` debug checks across 6 files. Centralize into a debug logging package.\n\nCurrent locations:\n- `cmd/bd/main.go` - 15 checks\n- `cmd/bd/autoflush.go` - 6 checks\n- `cmd/bd/nodb.go` - 4 checks\n- `internal/rpc/server.go` - 2 checks\n- `internal/rpc/client.go` - 5 checks\n- `cmd/bd/daemon_autostart.go` - 11 checks\n\nTarget structure:\n```\ninternal/debug/\n└── debug.go\n```\n\nBenefits:\n- Centralized debug logging\n- Easier to add structured logging later\n- Testable (can mock debug output)\n- Consistent debug message format\n\nImpact: Removes 43 scattered checks, improves code clarity","acceptance_criteria":"- Create `internal/debug/debug.go` with `Enabled`, `Logf`, `Printf`\n- Add unit tests in `internal/debug/debug_test.go` (test with/without BD_DEBUG)\n- Replace all 43 instances of `os.Getenv(\"BD_DEBUG\")` checks with `debug.Logf()`\n- Verify debug output works: run with `BD_DEBUG=1 bd status`\n- All tests pass: `go test ./...`\n- No behavior change (output identical to before)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:31:19.089078-07:00","updated_at":"2025-11-07T00:28:01.781121-08:00","closed_at":"2025-11-06T20:13:09.412212-08:00","source_repo":".","labels":["deduplication","logging","phase-3","refactor"],"dependencies":[{"issue_id":"bd-fb95094c.5","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T21:48:41.542395-07:00","created_by":"stevey"}]} -{"id":"bd-fb95094c.6","content_hash":"a8fe5793d281df23eb2a4856cbc4fa3fecc0a12762e75f7b80601af7d76d06da","title":"Extract normalizeLabels to shared utility package","description":"The `normalizeLabels` function appears in multiple locations with identical implementation. Extract to a shared utility package.\n\nCurrent locations:\n- `internal/rpc/server.go:37` (53 lines) - full implementation\n- `cmd/bd/list.go:50-52` - uses the server version (needs to use new shared version)\n\nFunction purpose:\n- Trims whitespace from labels\n- Removes empty strings\n- Deduplicates labels\n- Preserves order\n\nTarget structure:\n```\ninternal/util/\nβ”œβ”€β”€ strings.go # String utilities\n └── NormalizeLabels([]string) []string\n```\n\nImpact: DRY principle, single source of truth, easier to test","acceptance_criteria":"- Create `internal/util/strings.go` with `NormalizeLabels`\n- Add comprehensive unit tests in `internal/util/strings_test.go`\n- Update `internal/rpc/server.go` to import and use `util.NormalizeLabels`\n- Update `cmd/bd/list.go` to import and use `util.NormalizeLabels`\n- Remove duplicate implementations\n- All tests pass: `go test ./...`\n- Verify label normalization works: test `bd list --label` commands","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:31:19.078622-07:00","updated_at":"2025-11-06T20:06:49.219555-08:00","closed_at":"2025-11-06T19:58:59.467567-08:00","source_repo":".","labels":["deduplication","phase-3","refactor"],"dependencies":[{"issue_id":"bd-fb95094c.6","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:31:19.08015-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.7","content_hash":"6b0e7ce36c1680778cf79aaa9881688001818f2e2081f8c8a240fa0257f08e10","title":"Extract SQLite migrations into separate files","description":"The file `internal/storage/sqlite/sqlite.go` is 2,136 lines and contains 11 sequential migrations alongside core storage logic. Extract migrations into a versioned system.\n\nCurrent issues:\n- 11 migration functions mixed with core logic\n- Hard to see migration history\n- Sequential migrations slow database open\n- No clear migration versioning\n\nMigration functions to extract:\n- `migrateDirtyIssuesTable()`\n- `migrateIssueCountersTable()`\n- `migrateExternalRefColumn()`\n- `migrateCompositeIndexes()`\n- `migrateClosedAtConstraint()`\n- `migrateCompactionColumns()`\n- `migrateSnapshotsTable()`\n- `migrateCompactionConfig()`\n- `migrateCompactedAtCommitColumn()`\n- `migrateExportHashesTable()`\n- Plus 1 more (11 total)\n\nTarget structure:\n```\ninternal/storage/sqlite/\nβ”œβ”€β”€ sqlite.go # Core storage (~800 lines)\nβ”œβ”€β”€ schema.go # Table definitions (~200 lines)\nβ”œβ”€β”€ migrations.go # Migration orchestration (~200 lines)\n└── migrations/ # Individual migrations\n β”œβ”€β”€ 001_initial_schema.go\n β”œβ”€β”€ 002_dirty_issues.go\n β”œβ”€β”€ 003_issue_counters.go\n [... through 011_export_hashes.go]\n```\n\nBenefits:\n- Clear migration history\n- Each migration self-contained\n- Easier to review migration changes in PRs\n- Future migrations easier to add","acceptance_criteria":"- All 11 migrations extracted to separate files\n- Migration version tracking in database\n- Migrations run in order on fresh database\n- Existing databases upgrade correctly\n- All tests pass: `go test ./internal/storage/sqlite/...`\n- Database initialization time unchanged or improved\n- Add migration rollback capability (optional, nice-to-have)","status":"closed","priority":2,"issue_type":"task","assignee":"amp","created_at":"2025-10-27T20:30:47.870671-07:00","updated_at":"2025-11-06T20:05:05.01308-08:00","closed_at":"2025-11-06T20:05:05.01308-08:00","source_repo":".","labels":["database","phase-2","refactor"],"dependencies":[{"issue_id":"bd-fb95094c.7","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:47.875564-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.8","content_hash":"dd9d2d659380c7988d86194f33a911d887e398336934b6e90602c64ae451eef3","title":"Remove unreachable utility functions","description":"Several small utility functions are unreachable:\n\nFiles to clean:\n1. `internal/storage/sqlite/hash.go` - `computeIssueContentHash` (line 17)\n - Check if entire file can be deleted if only contains this function\n\n2. `internal/config/config.go` - `FileUsed` (line 151)\n - Delete unused config helper\n\n3. `cmd/bd/git_sync_test.go` - `verifyIssueOpen` (line 300)\n - Delete dead test helper\n\n4. `internal/compact/haiku.go` - `HaikuClient.SummarizeTier2` (line 81)\n - Tier 2 summarization not implemented\n - Options: implement feature OR delete method\n\nImpact: Removes 50-100 LOC depending on decisions","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T19:43:48.757493-05:00","updated_at":"2025-11-23T14:14:13.334902-08:00","closed_at":"2025-11-07T10:55:55.982696-08:00","source_repo":".","labels":["cleanup","dead-code","phase-1"],"dependencies":[{"issue_id":"bd-fb95094c.8","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:19.968126-07:00","created_by":"daemon"}]} -{"id":"bd-fb95094c.9","content_hash":"d61fcb1be13f8d39498d7b2be78b6a1aca78bf9d48f0a4f5946b4435fd4ce76a","title":"Remove unreachable RPC methods","description":"Several RPC server and client methods are unreachable and should be removed:\n\nServer methods (internal/rpc/server.go):\n- `Server.GetLastImportTime` (line 2116)\n- `Server.SetLastImportTime` (line 2123)\n- `Server.findJSONLPath` (line 2255)\n\nClient methods (internal/rpc/client.go):\n- `Client.Import` (line 311) - RPC import not used (daemon uses autoimport)\n\nEvidence:\n```bash\ngo run golang.org/x/tools/cmd/deadcode@latest -test ./...\n```\n\nImpact: Removes ~80 LOC of unused RPC code","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T19:43:48.758109-05:00","updated_at":"2025-11-23T14:14:13.335441-08:00","closed_at":"2025-11-07T10:55:55.984293-08:00","source_repo":".","labels":["cleanup","dead-code","phase-1","rpc"],"dependencies":[{"issue_id":"bd-fb95094c.9","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:19.965239-07:00","created_by":"daemon"}]} -{"id":"bd-fc2d","content_hash":"02e7f133acdef2eb52454fe9f5275575e3c237cdf665e57601c1cd09790106d7","title":"Refactor sqlite.go (2298 lines)","description":"Break down internal/storage/sqlite/sqlite.go into smaller, more focused modules. The file is currently 2298 lines and should be split into logical components.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-01T19:28:40.899111-07:00","updated_at":"2025-11-01T22:21:01.729379-07:00","closed_at":"2025-11-01T22:21:01.729379-07:00","source_repo":"."} -{"id":"bd-fd56","content_hash":"50437cea170f5b8a962661711d2ba639f9c7d1494a55115408afe3cbc9bebc86","title":"Wrap git operations in GitClient interface","description":"Create internal/daemonrunner/git.go with GitClient interface (HasUpstream, HasChanges, Commit, Push, Pull). Default implementation using os/exec. Use in Syncer and Run loop for testability.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.88734-07:00","updated_at":"2025-11-02T12:32:00.159595-08:00","closed_at":"2025-11-02T12:32:00.159597-08:00","source_repo":"."} -{"id":"bd-fd8753d9","content_hash":"faea57d583689933e7a173d18595095125b5fd79689cbb3c41039608ba4b335b","title":"Document bd edit command and verify MCP exclusion","description":"Follow-up from PR #152:\n1. Add \"bd edit\" to AGENTS.md with \"Humans only\" note\n2. Verify MCP server doesn't expose bd edit command\n3. Consider adding test for command registration","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-26T13:23:47.982295-07:00","updated_at":"2025-11-06T20:06:49.219828-08:00","closed_at":"2025-11-06T19:41:08.675575-08:00","source_repo":"."} -{"id":"bd-febc","content_hash":"686e0d5e3d56abe0edbd203d3d138ee3b013f55b6aed1eac05a56e6e3a5cc261","title":"npm package for bd with native binaries","description":"Create an npm package that wraps native bd binaries for easy installation in Claude Code for Web and other Node.js environments.\n\n## Problem\nClaude Code for Web sandboxes are full Linux VMs with npm support, but cannot easily download binaries from GitHub releases due to network restrictions or tooling limitations.\n\n## Solution\nPublish bd as an npm package that:\n- Downloads platform-specific native binaries during postinstall\n- Provides a CLI wrapper that invokes the native binary\n- Works seamlessly in Claude Code for Web SessionStart hooks\n- Maintains full feature parity (uses native SQLite)\n\n## Benefits vs WASM\n- βœ… Full SQLite support (no custom VFS needed)\n- βœ… All features work identically to native bd\n- βœ… Better performance (native vs WASM overhead)\n- βœ… ~4 hours effort vs ~2 days for WASM\n- βœ… Minimal maintenance burden\n\n## Success Criteria\n- npm install @beads/bd works in Claude Code for Web\n- All bd commands function identically to native binary\n- SessionStart hook documented for auto-installation\n- Package published to npm registry","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-02T23:39:37.684109-08:00","updated_at":"2025-11-03T10:39:44.932565-08:00","closed_at":"2025-11-03T10:39:44.932565-08:00","source_repo":"."} -{"id":"bd-fkdw","content_hash":"aae326186151d20e26b9b5c34efa43d9261ffd0fe0d6f4de843f951e4c813886","title":"Update bash-agent example with Agent Mail integration","description":"Add Agent Mail integration to examples/bash-agent/agent.sh using curl for HTTP calls.\n\nAcceptance Criteria:\n- Health check function using curl\n- Reserve issue before claiming\n- Send notifications on status change\n- Release on completion\n- Graceful degradation if curl fails\n- No bash errors when Agent Mail unavailable\n\nFile: examples/bash-agent/agent.sh","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-07T22:42:28.722048-08:00","updated_at":"2025-11-08T01:09:25.900138-08:00","closed_at":"2025-11-08T01:09:25.900138-08:00","source_repo":".","dependencies":[{"issue_id":"bd-fkdw","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T23:04:01.398259-08:00","created_by":"daemon"}]} -{"id":"bd-fsb1","content_hash":"a519fdd6d0ca6f70a177c2cb9441994b28d4bc2fe51a663532d4067caf126049","title":"Test issue","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T11:21:51.383077-08:00","updated_at":"2025-11-05T11:21:56.888913-08:00","closed_at":"2025-11-05T11:21:56.888913-08:00","source_repo":".","labels":["test","urgent"]} -{"id":"bd-fzbg","content_hash":"4bf5f57a0a66a94d76882e337c25d49e807ec79257a0aeb636fb81d963493860","title":"Update python-agent example with Agent Mail integration","description":"Modify examples/python-agent/agent.py to use Agent Mail adapter at 4 integration points.\n\nAcceptance Criteria:\n- Import and initialize adapter\n- Check inbox before find_ready_work()\n- Reserve issue before claim_task()\n- Notify on status changes\n- Release reservation on complete_task()\n- Works identically when Agent Mail disabled\n- No changes required to core Beads CLI\n\nFile: examples/python-agent/agent.py","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T22:42:28.661337-08:00","updated_at":"2025-11-08T00:20:35.213902-08:00","closed_at":"2025-11-08T00:20:35.213902-08:00","source_repo":".","dependencies":[{"issue_id":"bd-fzbg","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T23:04:01.315332-08:00","created_by":"daemon"}]} -{"id":"bd-g3ey","content_hash":"e59ecb28d0ceade96c076688de71f5d0022a9b0c0676f3abb1e4e06d90f8f559","title":"bd sync --import-only doesn't update DB mtime causing bd doctor false warning","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T15:18:16.761052+01:00","updated_at":"2025-11-08T15:58:37.147425-08:00","closed_at":"2025-11-08T13:12:01.718252-08:00","source_repo":"."} -{"id":"bd-g5p7","content_hash":"6ef3578afcab8a96c6018ec27f64d36df05b32fe867ad50b5309cdefe6b7f486","title":"Extract duplicated validation logic from CLI commands","description":"~150 lines of identical validation logic duplicated between cmd_create.go and cmd_update.go\n\nDuplication found:\n- validateBeadFields(): 2 identical copies (50+ lines each) \n- parseTimeWithDefault(): 2 identical copies (30 lines each)\n- Flag definitions: 15+ duplicate registrations\n\nSolution: Extract to shared packages:\n- internal/validation/bead.go - Centralized validation\n- internal/utils/time.go - Consolidate time parsing (already exists)\n- cmd/bd/flags.go - Shared flag registration\n\nImpact: Changes require touching 2+ files; high risk of inconsistency; steep learning curve\n\nEffort: 4-6 hours","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-16T14:51:10.159953-08:00","updated_at":"2025-11-21T10:59:00.408364-05:00","closed_at":"2025-11-20T20:39:34.426726-05:00","source_repo":"."} -{"id":"bd-g9eu","content_hash":"79fe2f96d06e3f0750b55f323bc104b02de6ab8a745e0bd36cf3425e125af89c","title":"Investigate TestRoutingIntegration failure","description":"TestRoutingIntegration/maintainer_with_SSH_remote failed during pre-commit check with \"expected role maintainer, got contributor\".\nThis occurred while running `go test -short ./...` on darwin/arm64.\nThe failure appears unrelated to storage/sqlite changes.\nNeed to investigate if this is a flaky test or environmental issue.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T15:55:19.337094-08:00","updated_at":"2025-11-20T15:55:19.337094-08:00","source_repo":"."} -{"id":"bd-gart","content_hash":"c4b3d68ec7d85a26e9c23ef529e4479b4741eade511d17f8f3602d412b0b3f0a","title":"Debug test 2","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-08T00:04:35.317835-08:00","updated_at":"2025-11-08T00:06:46.18875-08:00","closed_at":"2025-11-08T00:06:46.18875-08:00","source_repo":"."} -{"id":"bd-gdn","content_hash":"3411b7c03ec961d665181fbffa8f8b98a7809e296013786e743e371e92e9dc58","title":"Add functional tests for FlushManager correctness verification","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:53.967757-05:00","updated_at":"2025-11-21T10:59:00.4089-05:00","closed_at":"2025-11-20T21:35:53.1183-05:00","source_repo":".","comments":[{"id":21,"issue_id":"bd-gdn","author":"stevey","text":"Current race detector tests only verify \"no race detected\" but don't verify data correctness.\n\nNeed functional tests that:\n- Create real SQLite store with test data\n- Mark issues dirty and trigger flush\n- Verify JSONL file was updated correctly\n- Test debouncing actually reduces flush count\n- Verify shutdown performs final flush\n- Test recovery after flush failures\n\nExample test structure:\n```go\nfunc TestFlushManagerActuallyFlushes(t *testing.T) {\n // Setup real SQLite store in temp dir\n // Create test issue\n // Mark dirty via FlushManager\n // Wait for debounce + flush\n // Read JSONL file\n // Verify issue appears in JSONL with correct data\n}\n```\n\nRelated: Code review finding #3 from bd-52 race condition fix review.","created_at":"2025-11-21T15:59:00Z"}]} -{"id":"bd-gdzd","content_hash":"54a68b8b4c63fd88b33dbf8239de070a3c95f97d4a0aa5f64e694ff1384199b3","title":"Import fails on same-content-different-ID instead of treating as update","description":"## Problem\n\nThe importer still has rename detection (importer.go:482-500) that triggers when same content hash has different IDs. With hash IDs, this shouldn't happen, but when it does (test data, bugs, legacy data), the import fails:\n\n```\nfailed to handle rename bd-ce75 -\u003e bd-5a90: rename collision handling removed - should not occur with hash IDs\n```\n\n## Current Behavior\n\n1. Importer finds same content hash with different IDs\n2. Calls handleRename() (line 490)\n3. handleRename() errors out (line 294): \"rename collision handling removed\"\n4. Import fails\n\n## Expected Behavior\n\nSame content hash + different IDs should be treated as an **update**, not a rename:\n- Keep existing ID (already in database)\n- Update fields if incoming has newer timestamp\n- Discard incoming ID (it's wrong - hash should have generated same ID)\n\n## Impact\n\n- Import fails on legitimate edge cases (test data, data corruption)\n- Cryptic error message\n- Blocks sync operations\n\n## Fix\n\nIn handleRename() or import loop, instead of erroring:\n```go\n// Same content, different ID - treat as update\nif incoming.UpdatedAt.After(existing.UpdatedAt) {\n existing.Status = incoming.Status\n // ... copy other fields\n s.UpdateIssue(ctx, existing)\n}\nresult.Updated++\n```\n\n## Files\n- internal/importer/importer.go:271-294 (handleRename)\n- internal/importer/importer.go:482-500 (rename detection)\n\n## Repro\nImport JSONL with bd-ce75 and bd-5a90 (both \"Test parent issue\" but different content hashes).","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-05T00:27:51.150233-08:00","updated_at":"2025-11-05T01:02:54.469971-08:00","closed_at":"2025-11-05T01:02:54.469979-08:00","source_repo":"."} -{"id":"bd-ge7","content_hash":"84248781654b9924e1f4284058f141b73d761dead05ef9a3d1cc9b9f8cd4b60d","title":"Improve Beads test coverage from 46% to 80%","description":"","design":"Currently at 46% test coverage. Need to systematically improve coverage across all subsystems, focusing first on packages with minimal or no tests.\n\nTarget: 80% overall coverage\n\nApproach:\n- Break down by subsystem (internal/* packages)\n- Prioritize packages with 0-1 test files\n- Each child issue targets specific coverage goals\n- Focus on unit tests for core logic, error paths, and edge cases\n\nThis epic will be executed by the VC executor to test its ability to handle sustained multi-issue work.","acceptance_criteria":"- Overall test coverage reaches 80% or higher\n- All internal/* packages have at least 60% coverage\n- All packages with only 1 test file now have at least 3 test files\n- Quality gates (go test, golangci-lint) pass\n- Tests are maintainable and test actual behavior, not implementation details","status":"open","priority":1,"issue_type":"epic","created_at":"2025-11-20T21:21:03.700271-05:00","updated_at":"2025-11-20T21:21:03.700271-05:00","source_repo":"."} -{"id":"bd-ggbc","content_hash":"bfb238f72474f25fcf132603ae45e6c97c7c1e60ad865062bff75f32f54a9135","title":"Update documentation for merge driver auto-config","description":"Update documentation to reflect the new merge driver auto-configuration during `bd init`.\n\n**Files to update:**\n- README.md - Mention merge driver setup in initialization section\n- AGENTS.md - Update onboarding section about merge driver\n- Possibly QUICKSTART.md\n\n**Content:**\n- Explain what the merge driver does\n- Show --skip-merge-driver flag usage\n- Manual installation steps for post-init setup","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T19:27:04.155662-08:00","updated_at":"2025-11-05T19:29:55.188122-08:00","closed_at":"2025-11-05T19:29:55.188122-08:00","source_repo":".","dependencies":[{"issue_id":"bd-ggbc","depends_on_id":"bd-32nm","type":"discovered-from","created_at":"2025-11-05T19:27:04.156491-08:00","created_by":"daemon"}]} -{"id":"bd-gm7p","content_hash":"4bc3ca7545527e791e7282ad7596cb39f024e20fda1845c3498ffef1ba0100fd","title":"Use in-memory filesystem for test git operations","description":"Use tmpfs/ramdisk for git operations in tests to reduce I/O overhead.\n\nOptions:\n1. Mount /tmp as tmpfs in CI (GitHub Actions supports this)\n2. Use Go's testing.TB.TempDir() which may already use tmpfs on some systems\n3. Explicitly create ramdisk for tests on macOS\n\nExpected savings: 20-30% reduction in git operation time","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-04T01:24:19.803224-08:00","updated_at":"2025-11-04T10:52:42.722474-08:00","closed_at":"2025-11-04T10:52:42.722474-08:00","source_repo":".","dependencies":[{"issue_id":"bd-gm7p","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:19.80414-08:00","created_by":"daemon"}]} -{"id":"bd-gpe7","content_hash":"abafcc321674aa66d99dc353641fe183e510f4b89624adcaf8ffe0cea5ffb1ef","title":"Tests take too long - unacceptable for project size","description":"## Problem\n\nRunning `go test ./internal/importer/... -v` takes an unacceptably long time (minutes). For a project this size, tests should complete in seconds.\n\n## Impact\n\n- Slows down development iteration\n- AI agents waste time waiting for tests\n- Blocks rapid bug fixes and validation\n- Poor developer experience\n\n## Investigation Needed\n\n- Profile which tests are slow\n- Check for unnecessary sleeps, timeouts, or integration tests\n- Look for tests that could be parallelized\n- Consider splitting unit vs integration tests\n\n## Goal\n\nTest suite for a single package should complete in \u003c5 seconds, ideally \u003c2 seconds.","notes":"## Optimizations Applied\n\n1. **Added t.Parallel() to CLI tests** (13 tests) - allows concurrent execution\n2. **Removed unnecessary 200ms sleep** in daemon_autoimport_test.go - Execute() forces auto-import synchronously\n3. **Reduced filesystem settle wait** from 100ms β†’ 50ms on non-Windows platforms\n4. **Optimized debouncer test sleeps** (9 reductions):\n - Before debounce waits: 30ms β†’ 20ms, 20ms β†’ 10ms\n - After debounce waits: 40ms β†’ 35ms, 30ms β†’ 35ms, etc.\n - Thread safety test: 100ms β†’ 70ms\n - Sequential cycles: 50ms β†’ 40ms (3x)\n - Cancel tests: 70-80ms β†’ 60ms\n\n## Results\n\n### cmd/bd package (main improvement target):\n- **Before**: 5+ minutes (timeout)\n- **After**: ~18-20 seconds\n- **Speedup**: ~15-18x faster\n\n### internal/importer package:\n- **After**: \u003c1 second (0.9s)\n\n### Full test suite (with `-short` flag):\n- Most packages complete in \u003c2s\n- Total runtime constrained by sequential integration tests\n\n## Known Issues\n\n- TestConcurrentExternalRefImports hangs due to :memory: connection pool issue (bd-b121)\n- Some sync_branch tests may need sequential execution (git worktree conflicts)","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-05T00:54:47.784504-08:00","updated_at":"2025-11-05T01:41:57.544395-08:00","closed_at":"2025-11-05T01:41:57.544395-08:00","source_repo":"."} -{"id":"bd-gqo","content_hash":"21642505de8036d9501f8593b78de7b761f05869f9d8d11758278e9c0b33c9c3","title":"Implement health checks in daemon event loop","description":"Add health checks to checkDaemonHealth() function in daemon_event_loop.go:170:\n- Database integrity check\n- Disk space check\n- Memory usage check\n\nCurrently it's just a no-op placeholder.","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-21T18:55:07.534304-05:00","updated_at":"2025-11-21T18:55:07.534304-05:00","source_repo":"."} -{"id":"bd-gra","content_hash":"3530c1390ec7251ec2c5a0b4ce54e1619fb8a1cd13f2b8b157da9517a659b7f6","title":"Add error handling test for cmd.Help() in search command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/search.go:39, the return value of cmd.Help() is not checked, flagged by errcheck linter.\n\nAdd test to verify:\n- Error handling when cmd.Help() fails (e.g., output redirection fails)\n- Proper error propagation to caller\n- Command still exits gracefully on help error\n\nThis ensures the search command handles help errors properly and doesn't silently ignore failures.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:33.52308-05:00","updated_at":"2025-11-23T16:05:29.740219-08:00","closed_at":"2025-11-21T19:31:21.889039-05:00","source_repo":".","labels":["discovered:supervisor"],"dependencies":[{"issue_id":"bd-gra","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.526016-05:00","created_by":"ai-supervisor"}]} -{"id":"bd-gz0x","content_hash":"accf3e81a2e27e43c22b26c6aea4a0da418e63876e236cb462803e5700e2095e","title":"Fix daemon exiting after 5s on macOS due to PID 1 parent monitoring","description":"GitHub issue #278 reports that the daemon exits after \u003c=5 seconds on macOS because it incorrectly treats PID 1 (launchd) as a dead parent.\n\nWhen the daemon detaches on macOS, it gets reparented to PID 1 (launchd), which is the init process. The checkParentProcessAlive function was incorrectly treating PID 1 as a sign that the parent died.\n\nFixed by changing the logic to treat PID 1 as a valid parent for detached daemons.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-09T16:15:34.606508-08:00","updated_at":"2025-11-09T16:15:37.46914-08:00","closed_at":"2025-11-09T16:15:37.46914-08:00","source_repo":"."} -{"id":"bd-h4hc","content_hash":"43c11155d74ce32355129c3aac019c07279a4d31c0d58334e9fd5cb100108373","title":"Test child issue","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T13:00:42.368282-08:00","updated_at":"2025-11-05T13:01:11.64526-08:00","closed_at":"2025-11-05T13:01:11.64526-08:00","source_repo":"."} -{"id":"bd-hdt","content_hash":"8e6cf1653ef2ea583b39a421b3d708763ab7c042d6cd494e77202a92af0a7398","title":"Implement auto-merge functionality in duplicates command","description":"The duplicates.go file has a TODO at line 95 to implement the performMerge function for automatic duplicate merging. Currently it just prints a warning message. This would automate the merge process instead of just suggesting commands.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-21T18:55:02.828619-05:00","updated_at":"2025-11-21T18:55:02.828619-05:00","source_repo":"."} -{"id":"bd-hpt5","content_hash":"68813818e69aa94128685887fe733adce22c0a373b2758219ae863340d4bf9d2","title":"show commit hash in 'bd version' when built from source'\n","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-13T13:26:14.662089379-07:00","updated_at":"2025-11-14T09:18:09.721428859-07:00","closed_at":"2025-11-14T09:18:09.721428859-07:00","source_repo":"."} -{"id":"bd-hsl3","content_hash":"e0cccbc75edfcb54e0e6c3bd6749d7544327553a19773cf8b97edfafc11b2187","title":"Updated title","description":"","status":"closed","priority":0,"issue_type":"feature","created_at":"2025-11-07T19:07:12.92354-08:00","updated_at":"2025-11-07T22:07:17.346243-08:00","closed_at":"2025-11-07T21:57:59.911411-08:00","source_repo":"."} -{"id":"bd-htfk","content_hash":"b3c6670c8f66da01492c6f827acdc99c392ef1456e1e8f433ceaf469c8165e5c","title":"Measure notification latency vs git sync","description":"Benchmark end-to-end latency for status updates to propagate between agents using both methods.\n\nAcceptance Criteria:\n- Measure git sync latency (commit β†’ push β†’ pull β†’ import)\n- Measure Agent Mail latency (send_message β†’ fetch_inbox)\n- Document latency distribution (p50, p95, p99)\n- Verify \u003c100ms claim for Agent Mail\n- Compare against 1-5s baseline for git\n\nSuccess Metric: Agent Mail latency \u003c 100ms, git sync latency \u003e 1000ms","notes":"Latency benchmark completed. Results documented in latency_results.md:\n- Git sync: 2000-5000ms (full cycle with network)\n- Agent Mail: \u003c100ms (HTTP API round-trip)\n- Confirms 20-50x latency reduction claim","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:00.031959-08:00","updated_at":"2025-11-08T00:05:02.04159-08:00","closed_at":"2025-11-08T00:05:02.04159-08:00","source_repo":".","dependencies":[{"issue_id":"bd-htfk","depends_on_id":"bd-muls","type":"blocks","created_at":"2025-11-07T23:03:52.969505-08:00","created_by":"daemon"},{"issue_id":"bd-htfk","depends_on_id":"bd-spmx","type":"parent-child","created_at":"2025-11-08T00:02:47.918425-08:00","created_by":"daemon"}]} -{"id":"bd-hv01","content_hash":"293d9078e613afae960df6681f8c8d7a5f6ba28ddd2708e9c7af2010ef76b407","title":"Deletions not propagated across multi-workspace sync","description":"## Problem\n\nWhen working with multiple beads workspaces (clones) sharing the same git remote, deleted issues keep coming back.\n\n## Reproduction\n\n1. Clone A deletes issue `bd-xyz` via `bd delete bd-xyz --force`\n2. Clone A daemon syncs and pushes to GitHub\n3. Clone B still has `bd-xyz` in its database\n4. Clone B daemon exports and pushes its JSONL\n5. Clone A pulls and imports β†’ `bd-xyz` comes back!\n\n## Root Cause\n\n**No deletion tracking mechanism.** The system has no way to distinguish between:\n- \"Issue doesn't exist in JSONL because it was deleted\" \n- \"Issue doesn't exist in JSONL because the export is stale\"\n\nImport treats missing issues as \"not in this export\" rather than \"explicitly deleted.\"\n\n## Solution Options\n\n1. **Tombstone records** - Keep deleted issues in JSONL with `\"status\":\"deleted\"` or `\"deleted_at\"` field\n2. **Deletion log** - Separate `.beads/deletions.jsonl` file tracking all deleted IDs\n3. **Three-way merge** - Import compares: DB state, old JSONL, new JSONL\n4. **Manual conflict resolution** - Detect resurrection and prompt user\n\n## Related\n\n- Similar to resurrection logic for orphaned children (bd-cc4f)\n- beads-merge tool handles this better with 3-way merge","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-05T18:34:24.094474-08:00","updated_at":"2025-11-06T18:19:16.233949-08:00","closed_at":"2025-11-06T17:52:24.860716-08:00","source_repo":".","dependencies":[{"issue_id":"bd-hv01","depends_on_id":"bd-qqvw","type":"blocks","created_at":"2025-11-05T18:42:35.485002-08:00","created_by":"daemon"}]} -{"id":"bd-hw3c","content_hash":"83359ec96e2b8fc9ce2ece25d56bfbc1c1f948b27dfa56cc7b3715dc86c6d024","title":"Fix GH #227: bd edit broken pipe errors","description":"bd edit command gets \"broken pipe\" errors when using daemon mode because editing can take minutes and the daemon connection times out.\n\nSolution: Force bd edit to always use direct mode (--no-daemon) since it's human-only and interactive.\n\nFixed by checking cmd.Name() == \"edit\" in main.go PersistentPreRun and setting noDaemon = true.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-05T14:36:04.289431-08:00","updated_at":"2025-11-05T14:36:08.103964-08:00","closed_at":"2025-11-05T14:36:08.103964-08:00","source_repo":"."} -{"id":"bd-hwmp","content_hash":"dc9fa0bdf033cf2b560624cea8ab231367a2e833544b18237cec69f0ad3be9ed","title":"Document bd info --whats-new in AGENTS.md","description":"Add prominent documentation about bd info --whats-new to help agents discover upgrade changes.\n\n## Changes Needed\n1. Add to 'What's New' section (line 13-28): Emphasize running bd info --whats-new after upgrades\n2. Add to 'Pro Tips for Agents' section (line 474-486): Include version check in session startup routine\n3. Document the bd hooks install command for keeping hooks in sync\n\n## Implementation\n- Update AGENTS.md with clear examples\n- Show both human-readable and --json output options\n- Link to the discussion #239 as motivation\n\n## Acceptance Criteria\n- Agents know to run bd info --whats-new after upgrades\n- Clear guidance on when/why to use it\n- Examples showing both output formats\n","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T16:21:50.533017-08:00","updated_at":"2025-11-23T16:27:43.543439-08:00","closed_at":"2025-11-23T16:27:43.543439-08:00","source_repo":".","dependencies":[{"issue_id":"bd-hwmp","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:50.533861-08:00","created_by":"daemon"}]} -{"id":"bd-hy9p","content_hash":"338c8d09c267dbca4b25d2ee0c5e6f130d94360a59597c3ecb4f1b64308d208b","title":"Add --body-file flag to bd create for reading descriptions from files","description":"## Problem\n\nCreating issues with long/complex descriptions via CLI requires shell escaping gymnastics:\n\n```bash\n# Current workaround - awkward heredoc quoting\nbd create --title=\"...\" --description=\"$(cat \u003c\u003c'EOF'\n...markdown...\nEOF\n)\"\n\n# Often fails with quote escaping errors in eval context\n# Agents resort to writing temp files then reading them\n```\n\n## Proposed Solution\n\nAdd `--body-file` and `--description-file` flags to read description from a file, matching `gh` CLI pattern.\n\n```bash\n# Natural pattern that aligns with training data\ncat \u003e /tmp/desc.md \u003c\u003c 'EOF'\n...markdown content...\nEOF\n\nbd create --title=\"...\" --body-file=/tmp/desc.md\n```\n\n## Implementation\n\n### 1. Add new flags to `bd create`\n\n```go\ncreateCmd.Flags().String(\"body-file\", \"\", \"Read description from file (use - for stdin)\")\ncreateCmd.Flags().String(\"description-file\", \"\", \"Alias for --body-file\")\n```\n\n### 2. Flag precedence\n\n- If `--body-file` or `--description-file` is provided, read from file\n- If value is `-`, read from stdin\n- Otherwise fall back to `--body` or `--description` flag\n- If neither provided, description is empty (current behavior)\n\n### 3. Error handling\n\n- File doesn't exist β†’ clear error message\n- File not readable β†’ clear error message\n- stdin specified but not available β†’ clear error message\n\n## Benefits\n\nβœ… **Matches training data**: `gh issue create --body-file file.txt` is a common pattern\nβœ… **No shell escaping issues**: File content is read directly\nβœ… **Works with any content**: Markdown, special characters, quotes, etc.\nβœ… **Agent-friendly**: Agents already write complex content to temp files\nβœ… **User-friendly**: Easier for humans too when pasting long descriptions\n\n## Related Commands\n\nConsider adding similar support to:\n- `bd update --body-file` (for updating descriptions)\n- `bd comment --body-file` (if/when we add comments)\n\n## Examples\n\n```bash\n# From file\nbd create --title=\"Add new feature\" --body-file=feature.md\n\n# From stdin\necho \"Quick description\" | bd create --title=\"Bug fix\" --body-file=-\n\n# With other flags\nbd create \\\n --title=\"Security issue\" \\\n --type=bug \\\n --priority=0 \\\n --body-file=security-report.md \\\n --label=security\n```\n\n## Testing\n\n- Test with normal files\n- Test with stdin (`-`)\n- Test with non-existent files (error handling)\n- Test with binary files (should handle gracefully)\n- Test with empty files (valid - empty description)\n- Test that `--description-file` and `--body-file` are equivalent aliases","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-22T00:02:08.762684-08:00","updated_at":"2025-11-22T00:02:08.762684-08:00","source_repo":"."} -{"id":"bd-i00","content_hash":"eb91d1bd82defffa773c7706f4094ca1a322f1e7be017aebc91fd7eb8e6b7aad","title":"Convert magic numbers to named constants in FlushManager","description":"","status":"closed","priority":4,"issue_type":"task","created_at":"2025-11-20T21:22:17.845269-05:00","updated_at":"2025-11-21T10:59:00.409385-05:00","closed_at":"2025-11-20T21:35:53.11654-05:00","source_repo":".","comments":[{"id":22,"issue_id":"bd-i00","author":"stevey","text":"Several magic numbers should be named constants for clarity and maintainability:\n\nflush_manager.go:\n- Line 64: `10` (markDirtyCh buffer size)\n- Line 65: `1` (timerFiredCh buffer size)\n- Line 139: `30 * time.Second` (shutdown timeout)\n\nautoflush.go:\n- Line 562: `3` (flush failure threshold before warning)\n\nSuggested constants:\n```go\nconst (\n markDirtyBufferSize = 10 // Buffer rapid mark requests\n timerFiredBufferSize = 1 // Timer notifications coalesce\n shutdownTimeout = 30 * time.Second // Generous for large DBs\n flushFailureThreshold = 3 // Show warning after N failures\n)\n```\n\nRelated: Code review finding #6 from bd-52 race condition fix review.","created_at":"2025-11-21T15:59:00Z"}]} -{"id":"bd-i6eq","content_hash":"2cfe7d86931949dd2aca5485bb6d2acecc005519118443f4a0c744ea55ce85e9","title":"Review and merge open PRs","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-22T16:44:20.568499-08:00","updated_at":"2025-11-23T14:14:13.335959-08:00","closed_at":"2025-11-22T18:18:08.088054-08:00","source_repo":"."} -{"id":"bd-ic1m","content_hash":"b837a8183ba2b636a3116deb35aa96d99fee84eabdfc8f8d93a91415c3ff4490","title":"Benchmark git traffic reduction","description":"Automated benchmark comparing git operations with/without Agent Mail.\n\nAcceptance Criteria:\n- Script that processes 50 issues\n- Counts git operations (pull, commit, push)\n- Generates comparison report\n- Verifies β‰₯70% reduction\n- Fails if regression detected\n\nFile: tests/benchmarks/git_traffic.py\n\nOutput: Without Agent Mail: 450 git operations, With Agent Mail: 135 git operations, Reduction: 70%","notes":"Implemented automated benchmark script with following features:\n- Processes configurable number of issues (default 50)\n- Compares git operations in two modes: git-only vs Agent Mail\n- Generates detailed comparison report with statistics\n- Exit code reflects pass/fail based on 70% reduction target\n- Results: 98.5% reduction (200 ops β†’ 3 ops) for 50 issues\n\nFiles created:\n- tests/benchmarks/git_traffic.py (main benchmark script)\n- tests/benchmarks/README.md (documentation)\n- tests/benchmarks/git_traffic_50_issues.md (sample results)\n\nThe benchmark vastly exceeds the 70% target, showing 98.5% reduction.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:43:21.486095-08:00","updated_at":"2025-11-08T02:08:19.648473-08:00","closed_at":"2025-11-08T02:08:19.648473-08:00","source_repo":".","dependencies":[{"issue_id":"bd-ic1m","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:43:21.486966-08:00","created_by":"daemon"},{"issue_id":"bd-ic1m","depends_on_id":"bd-nemp","type":"blocks","created_at":"2025-11-07T22:43:21.487388-08:00","created_by":"daemon"}]} -{"id":"bd-ihp9","content_hash":"e66bdd32aeb5a67440da6cb06bec0da001d28f123c34c2559352f7c98a6b2381","title":"Fix FOREIGN KEY constraint failures in AddComment and ApplyCompaction","description":"The 'CloseIssue', 'UpdateIssueID', and 'RemoveLabel' methods were fixed in PR #348 to prevent foreign key constraint failures when operating on non-existent issues.\n\nHowever, the Oracle identified two other methods that follow the same problematic pattern:\n1. `AddComment` (in `internal/storage/sqlite/events.go`)\n2. `ApplyCompaction` (in `internal/storage/sqlite/compact.go`)\n\nThese methods attempt to insert an event record after updating the issue, without verifying that the issue update actually affected any rows. This leads to a foreign key constraint failure if the issue does not exist.\n\nWe need to:\n1. Create reproduction tests for these failure cases\n2. Apply the same fix pattern: check `RowsAffected()` after the update, and return a proper \"issue not found\" error if it is 0, before attempting to insert the event.\n3. Standardize the error message format to \"issue %s not found\" or \"issue not found: %s\" for consistency.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T09:49:55.090644-08:00","updated_at":"2025-11-20T09:53:54.466769-08:00","closed_at":"2025-11-20T09:53:54.466769-08:00","source_repo":"."} -{"id":"bd-iou5","content_hash":"4aaf92c783a9ff8acc47ec4a03409cfb9df9259ff73b184013422445bbd10932","title":"Detect and warn about outdated git hooks","description":"Users may have outdated git hooks installed that reference removed flags (e.g., --resolve-collisions). bd should detect this and warn users to reinstall.","design":"\n- Add version comments to hook templates (e.g., # bd-hooks-v0.21.0)\n- Check during 'bd info' or 'bd daemon start' (not every command to avoid overhead)\n- Compare installed hook version against current bd version\n- Warn with clear message: 'Git hooks are outdated (v0.X.Y), run: examples/git-hooks/install.sh'\n- Could also check if hooks exist but aren't installed at all","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-06T13:59:45.778781-08:00","updated_at":"2025-11-06T15:02:16.928192-08:00","closed_at":"2025-11-06T15:02:16.928192-08:00","source_repo":"."} -{"id":"bd-iov0","content_hash":"6a7daf8069628210263fd1fdbf6b9890beab65b764bf0b019c1bb2bc104d5986","title":"Document -short flag in testing guide","description":"Add documentation about the -short flag and how it's used to skip slow tests. Should explain that developers can run 'go test -short ./...' for fast iteration and 'go test ./...' for full coverage.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-06T17:30:49.618187-08:00","updated_at":"2025-11-06T20:06:49.220061-08:00","closed_at":"2025-11-06T19:41:08.643188-08:00","source_repo":"."} -{"id":"bd-iq7n","content_hash":"e6058e742c029c684d63f91a13f2a1e4a95bb461d82f765b652f5a97cf236c6a","title":"Audit and fix JSONL filename mismatches across all repo clones","description":"## Problem\n\nMultiple clones of repos are configured with different JSONL filenames (issues.jsonl vs beads.jsonl), causing:\n1. JSONL files to be resurrected after deletion (one clone pushes issues.jsonl, another pushes beads.jsonl)\n2. Agents unable to see issues filed by other agents after sync\n3. Merge conflicts and data inconsistencies\n\n## Root Cause\n\nWhen repos were \"bd doctored\" or initialized at different times, some got issues.jsonl (old default) and others got beads.jsonl (Beads repo specific). These clones push their respective files, creating duplicates.\n\n## Task\n\nScan all repo clones under ~/src/ (1-2 levels deep) and standardize their JSONL configuration.\n\n### Step 1: Find all beads-enabled repos\n\n```bash\n# Find all directories named 'beads' at levels 1-2 under ~/src/\nfind ~/src -maxdepth 2 -type d -name beads\n```\n\n### Step 2: For each repo found, check configuration\n\nFor each directory from Step 1, check:\n- Does `.beads/metadata.json` exist?\n- What is the `jsonl_export` value?\n- What JSONL files actually exist in `.beads/`?\n- Are there multiple JSONL files (problem!)?\n\n### Step 3: Create audit report\n\nGenerate a report showing:\n```\nRepo Path | Config | Actual Files | Status\n----------------------------------- | ------------- | ---------------------- | --------\n~/src/beads | beads.jsonl | beads.jsonl | OK\n~/src/dave/beads | issues.jsonl | issues.jsonl | MISMATCH\n~/src/emma/beads | issues.jsonl | issues.jsonl, beads.jsonl | DUPLICATE!\n```\n\n### Step 4: Determine canonical name for each repo\n\nFor repos that are the SAME git repository (check `git remote -v`):\n- Group them together\n- Determine which JSONL filename should be canonical (majority wins, or beads.jsonl for the beads repo itself)\n- List which clones need to be updated\n\n### Step 5: Generate fix script\n\nCreate a script that for each mismatched clone:\n1. Updates `.beads/metadata.json` to use the canonical name\n2. If JSONL file needs renaming: `git mv .beads/old.jsonl .beads/new.jsonl`\n3. Removes any duplicate JSONL files: `git rm .beads/duplicate.jsonl`\n4. Commits the change\n5. Syncs: `bd sync`\n\n### Expected Output\n\n1. Audit report showing all repos and their config status\n2. List of repos grouped by git remote (same repository)\n3. Fix script or manual instructions for standardizing each repo\n4. Verification that after fixes, all clones of the same repo use the same JSONL filename\n\n### Edge Cases\n\n- Handle repos without metadata.json (use default discovery)\n- Handle repos with no git remote (standalone/local)\n- Handle repos that are not git repositories\n- Don't modify repos with uncommitted changes (warn instead)\n\n### Success Criteria\n\n- All clones of the same git repository use the same JSONL filename\n- No duplicate JSONL files in any repo\n- All configurations documented in metadata.json\n- bd doctor passes on all repos","status":"open","priority":0,"issue_type":"task","created_at":"2025-11-21T23:58:35.044762-08:00","updated_at":"2025-11-21T23:58:35.044762-08:00","source_repo":"."} -{"id":"bd-irq6","content_hash":"67746afe139a143851078f4240fa40379c7b7d8559c906bca56acb2cdab537cc","title":"Remove unused global daemon infrastructure (internal/daemonrunner/)","description":"The internal/daemonrunner/ package (1,468 LOC) contains the old global daemon implementation that is no longer used. We now use per-workspace daemons.\n\nDeadcode analysis shows all these functions are unreachable:\n- Daemon.Start, runGlobalDaemon, setupLock\n- validateSingleDatabase, validateSchemaVersion\n- registerDaemon, unregisterDaemon\n- validateDatabaseFingerprint\n- Full git client implementation (NewGitClient, HasUpstream, HasChanges, Commit, Push, Pull)\n- Helper functions: isGitRepo, gitHasUpstream, gitHasChanges, gitCommit\n\nThe entire package appears unused since switching to per-workspace daemon architecture.\n\nFiles to remove:\n- daemon.go (9,436 bytes)\n- git.go (3,510 bytes) \n- sync.go (6,401 bytes)\n- fingerprint.go (2,076 bytes)\n- process.go (3,332 bytes)\n- rpc.go (994 bytes)\n- config.go (486 bytes)\n- logger.go (1,579 bytes)\n- flock_*.go (platform-specific file locking)\n- signals_*.go (platform-specific signal handling)\n- All test files\n\nTotal cleanup: ~1,500 LOC","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T19:30:50.936943-08:00","updated_at":"2025-11-06T19:35:10.646498-08:00","closed_at":"2025-11-06T19:35:10.646498-08:00","source_repo":"."} -{"id":"bd-it3x","content_hash":"f31a3aae4297794bd42d7a8a8688ab5cdb4fa6c70f0ed88ffa93be93d76a2128","title":"Issue with labels","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T19:07:18.388873-08:00","updated_at":"2025-11-07T22:07:17.346541-08:00","closed_at":"2025-11-07T21:55:09.429989-08:00","source_repo":".","labels":["backend","urgent"]} -{"id":"bd-iye7","content_hash":"1554b026ccacde081eb05d3889943d95ae9c75a21d3f06c346c57cbe2391dc46","title":"Add path normalization to getMultiRepoJSONLPaths()","description":"From bd-xo6b code review: getMultiRepoJSONLPaths() does not handle non-standard paths correctly.\n\nProblems:\n- No tilde expansion: ~/repos/foo treated as literal path\n- No absolute path conversion: ../other-repo breaks if working directory changes\n- No duplicate detection: If Primary=. and Additional=[.], same JSONL processed twice\n- No empty string handling: Empty paths create invalid /.beads/issues.jsonl\n\nImpact:\nConfig with tilde or relative paths will fail\n\nFix needed:\n1. Use filepath.Abs() for all paths\n2. Add tilde expansion via os.UserHomeDir()\n3. Deduplicate paths (use map to track seen paths)\n4. Filter out empty strings\n5. Validate paths exist and are readable\n\nFiles:\n- cmd/bd/deletion_tracking.go:333-358 (getMultiRepoJSONLPaths function)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T19:31:51.882743-08:00","updated_at":"2025-11-06T19:35:41.246311-08:00","closed_at":"2025-11-06T19:35:41.246311-08:00","source_repo":".","dependencies":[{"issue_id":"bd-iye7","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.267906-08:00","created_by":"daemon"}]} -{"id":"bd-j3zt","content_hash":"531ad51101f41375a93d66b8d22105ce7c4913261db78b662bb759e802bc01e2","title":"Fix mypy errors in beads-mcp","description":"Running `mypy .` in `integrations/beads-mcp` reports 287 errors. These should be addressed to improve type safety and code quality.","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-20T18:53:28.557708-05:00","updated_at":"2025-11-20T18:53:28.557708-05:00","source_repo":"."} -{"id":"bd-j7e2","content_hash":"aeb3aec5ebb3b7554949f7161f58408c445983c993aaa5b31e4df93b083cf19c","title":"RPC diagnostics: BD_RPC_DEBUG timing logs","description":"Add lightweight diagnostic logging for RPC connection attempts:\n- BD_RPC_DEBUG=1 prints to stderr:\n - Socket path being dialed\n - Socket exists check result \n - Dial start/stop time\n - Connection outcome\n- Improve bd daemon --status messaging when lock not held\n\nThis helps field triage of connection issues without verbose daemon logs.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-07T16:42:12.772364-08:00","updated_at":"2025-11-07T22:07:17.346817-08:00","closed_at":"2025-11-07T21:29:32.243458-08:00","source_repo":".","dependencies":[{"issue_id":"bd-j7e2","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.773714-08:00","created_by":"daemon"}]} -{"id":"bd-jgxi","content_hash":"6ff94901125572693d3cff52afcd14f2d44b6baeb553dee149291eb32512c187","title":"Auto-migrate database on CLI version bump","description":"When CLI is upgraded (e.g., 0.24.0 β†’ 0.24.1), database version becomes stale. Add auto-migration in PersistentPreRun or daemon startup. Check dbVersion != CLIVersion and run bd migrate automatically. Fixes recurring UX issue where bd doctor shows version mismatch after every CLI upgrade.","status":"closed","priority":0,"issue_type":"feature","created_at":"2025-11-21T23:16:09.004619-08:00","updated_at":"2025-11-23T18:09:31.399945-08:00","closed_at":"2025-11-23T18:09:31.399945-08:00","source_repo":".","dependencies":[{"issue_id":"bd-jgxi","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:09.005513-08:00","created_by":"daemon"}]} -{"id":"bd-jijf","content_hash":"9ecadb3d67b00337d8822ace5378edfe9b3baaa4e64a9e7edc5a2b43d82d9caf","title":"Fix: --parent flag doesn't create parent-child dependency","description":"When using `bd create --parent \u003cid\u003e`, the code generates a hierarchical child ID (e.g., bd-123.1) but never creates a parent-child dependency. This causes `bd epic status` to show zero children even though child issues exist.\n\nRoot cause: create.go generates child ID using store.GetNextChildID() but never calls store.AddDependency() with type parent-child.\n\nFix: After creating the issue when parentID is set, automatically add a parent-child dependency linking child -\u003e parent.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-15T13:15:22.138854-08:00","updated_at":"2025-11-15T13:18:29.301788-08:00","closed_at":"2025-11-15T13:18:29.301788-08:00","source_repo":"."} -{"id":"bd-jjua","content_hash":"40e73380589198a2e43bc484c7d55dd1d3bef620dbc1529ddaf54ca9282284e4","title":"Auto-invoke 3-way merge for JSONL conflicts","description":"Currently when git pull encounters merge conflicts in .beads/issues.jsonl, the post-merge hook fails with an error message pointing users to manual resolution or the beads-merge tool.\n\nThis is a poor user experience - the conflict detection is working, but we should automatically invoke the advanced 3-way merging instead of just telling users about it.\n\n**Current behavior:**\n- Detect conflict markers in JSONL\n- Display error with manual resolution options\n- Exit with failure\n\n**Desired behavior:**\n- Detect conflict markers in JSONL\n- Automatically invoke beads-merge 3-way merge\n- Only fail if automatic merge cannot resolve the conflicts\n\n**Reference:**\n- beads-merge tool: https://github.com/neongreen/mono/tree/main/beads-merge\n- Error occurs in post-merge hook during bd sync after git pull","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-08T03:09:18.258708-08:00","updated_at":"2025-11-08T03:15:55.529652-08:00","closed_at":"2025-11-08T03:15:55.529652-08:00","source_repo":".","comments":[{"id":32,"issue_id":"bd-jjua","author":"stevey","text":"Implemented automatic 3-way merge resolution for JSONL conflicts.\n\n**Changes Made:**\n\n1. **Modified conflict detection in cmd/bd/import.go (lines 105-152)**\n - When git conflict markers are detected, instead of immediately failing, the system now attempts automatic resolution\n - Calls new `attemptAutoMerge()` function to invoke bd merge tool\n - If auto-merge succeeds, restarts import with the merged JSONL\n - If auto-merge fails, falls back to displaying manual resolution instructions\n\n2. **Added attemptAutoMerge() function (lines 469-585)**\n - Extracts the three git conflict stages: base (:1), ours/left (:2), theirs/right (:3)\n - Creates temporary files for each version\n - Invokes `bd merge` command to perform intelligent 3-way merge\n - Writes merged result back to original file\n - Auto-stages the resolved file with git add\n\n**How it works:**\n- When git pull creates conflicts in .beads/issues.jsonl\n- The post-merge hook runs `bd sync --import-only`\n- Import detects conflict markers on line scan\n- Automatically extracts conflict versions from git\n- Runs bd merge tool with field-level merge intelligence\n- If successful, continues import seamlessly\n- Only fails if conflicts cannot be auto-resolved\n\n**Benefits:**\n- Zero user intervention for most JSONL conflicts\n- Leverages existing bd merge 3-way merge logic\n- Maintains data integrity with field-level merging\n- Graceful fallback to manual resolution when needed\n\n**Testing:**\n- Code builds successfully\n- Ready for real-world testing on next git pull conflict\n\nThe solution transforms the error into an automatic resolution step, significantly improving user experience.","created_at":"2025-11-23T01:48:48Z"},{"id":33,"issue_id":"bd-jjua","author":"stevey","text":"**Discovery: Git merge driver was already configured but not being triggered**\n\nThe 3-way merge tool was properly vendored and `bd init` does configure the git merge driver:\n- `git config merge.beads.driver \"bd merge %A %O %L %R\"`\n- `.gitattributes` entry for `.beads/beads.jsonl merge=beads`\n\nThis should have prevented conflicts entirely by auto-invoking `bd merge` during git merge operations.\n\n**Root Cause:**\nHowever, the automatic merge driver doesn't help when conflicts reach the import stage, which happens in the post-merge hook flow:\n1. Git pull encounters conflicts\n2. Post-merge hook runs `bd sync --import-only`\n3. Import reads the JSONL file and detects conflict markers\n4. Previous behavior: fail with error message\n\nThe merge driver prevents conflicts during git operations, but if conflicts somehow make it through (or if the merge driver itself produces conflicts that it can't resolve), the import process needed fallback handling.\n\n**Our Solution:**\nAdded automatic 3-way merge invocation at the import stage as a safety net. This provides defense-in-depth:\n- Primary: git merge driver prevents most conflicts\n- Fallback: import auto-merge handles any that slip through\n\n**Bonus Discovery:**\nFound that `.beads/issues.jsonl` is a zombie file that keeps reappearing despite multiple removal attempts in git history. Renamed it to `.beads/issues.jsonl.zombie-do-not-use` with a warning message. The canonical file is `.beads/beads.jsonl`.","created_at":"2025-11-23T01:48:48Z"}]} -{"id":"bd-jo38","content_hash":"05e0df789df0a8056258cc1594c3f695d77bb735f2b2ae694d8fbb7c14c51bc9","title":"Add WaitGroup tracking to FileWatcher goroutines","description":"FileWatcher spawns goroutines without WaitGroup tracking, causing race condition on shutdown.\n\nLocation: cmd/bd/daemon_watcher.go:123-182, 215-291\n\nProblem:\n- Goroutines spawned without sync.WaitGroup\n- Close() cancels context but doesn't wait for goroutines to exit\n- Race condition: goroutine may access fw.debouncer during Close() cleanup\n- No guarantee goroutine stopped before fw.watcher.Close() is called\n\nSolution:\n- Add sync.WaitGroup field to FileWatcher\n- Track goroutines with wg.Add(1) and defer wg.Done()\n- Call wg.Wait() in Close() before cleanup\n\nImpact: Race condition on daemon shutdown; potential panic\n\nEffort: 2 hours","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:51:38.591371-08:00","updated_at":"2025-11-16T15:04:00.466334-08:00","closed_at":"2025-11-16T15:04:00.466334-08:00","source_repo":"."} -{"id":"bd-jx90","content_hash":"3dfa306c43d7febfbd072d4bb5c1b6018f8a7301380bb128f53abb0eca5deb65","title":"Add simple cleanup command to delete closed issues","description":"Users want a simple command to delete all closed issues without requiring Anthropic API key (unlike compact). Requested in GH #243.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-07T00:26:30.372137-08:00","updated_at":"2025-11-07T22:07:17.347122-08:00","closed_at":"2025-11-07T22:05:16.325863-08:00","source_repo":"."} -{"id":"bd-k0j9","content_hash":"52d1e6f87bd7655018bd89dbbbaf8da66bdcba45de6138fd237810365a04606a","title":"Test dependency parent","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T11:23:02.505901-08:00","updated_at":"2025-11-05T11:23:20.91305-08:00","closed_at":"2025-11-05T11:23:20.91305-08:00","source_repo":"."} -{"id":"bd-k58","content_hash":"cc90fb20e7bd178b52133d4d0f8781dce2debb46519674ae6356291d597fc13d","title":"Proposal workflow (propose/withdraw/accept)","description":"Implement commands and state machine for moving issues between personal planning repos and canonical upstream repos, enabling contributors to propose work without polluting PRs.","design":"Commands:\n- bd propose \u003cid\u003e [--target \u003crepo\u003e] - Move issue to target repo\n- bd withdraw \u003cid\u003e - Un-propose (move back)\n- bd accept \u003cid\u003e - Maintainer accepts proposal\n\nVisibility states:\n- local: Personal planning only\n- proposed: Staged for upstream PR\n- canonical: Accepted by upstream (default for existing)\n\nOptional visibility field (backward compatible, defaults to canonical)","acceptance_criteria":"1. bd propose moves issue from planning to primary repo\n2. bd withdraw reverses proposal\n3. bd accept (maintainer) finalizes acceptance\n4. Visibility field tracks state (local/proposed/canonical)\n5. Backward compatible - existing issues default to canonical\n6. State transitions are atomic and git-tracked","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:41.113647-08:00","updated_at":"2025-11-05T00:08:42.814698-08:00","closed_at":"2025-11-05T00:08:42.814699-08:00","source_repo":".","dependencies":[{"issue_id":"bd-k58","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.811261-08:00","created_by":"daemon"}]} -{"id":"bd-kazt","content_hash":"83b14f6b183318f85ae852db1caa593d5f6592a00b168ae057bb31238701d4fa","title":"Add tests for 3-way merge scenarios","description":"Comprehensive test coverage for merge logic.\n\n**Test cases**:\n- Simple field updates (left vs right)\n- Dependency merging (union + dedup)\n- Timestamp handling (max wins)\n- Deletion detection (deleted in one, modified in other)\n- Conflict generation (incompatible changes)\n- Issue resurrection prevention (bd-hv01 regression test)\n\n**Files**:\n- `internal/merge/merge_test.go`\n- `cmd/bd/merge_test.go`","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.472275-08:00","updated_at":"2025-11-06T15:52:41.863426-08:00","closed_at":"2025-11-06T15:52:41.863426-08:00","source_repo":".","dependencies":[{"issue_id":"bd-kazt","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.740517-08:00","created_by":"daemon"},{"issue_id":"bd-kazt","depends_on_id":"bd-oif6","type":"blocks","created_at":"2025-11-05T18:42:35.469582-08:00","created_by":"daemon"}]} -{"id":"bd-kb4g","content_hash":"e68405211ed698918001dc1354242971a604bc140a026580f24e2a472747ff8c","title":"TestHooksCheckGitHooks failing - version mismatch (0.23.0 vs 0.23.1)","description":"The test is checking embedded hook versions and expecting 0.23.1, but got 0.23.0. This appears to be a version consistency issue that needs investigation.\n\nTest output:\n```\nHook pre-commit version mismatch: got 0.23.0, want 0.23.1\nHook post-merge version mismatch: got 0.23.0, want 0.23.1\nHook pre-push version mismatch: got 0.23.0, want 0.23.1\n```\n\nThis is blocking the landing of GH #274 fix.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-09T14:13:14.138537-08:00","updated_at":"2025-11-20T18:54:56.496852-05:00","closed_at":"2025-11-10T10:46:09.94181-08:00","source_repo":"."} -{"id":"bd-kdoh","content_hash":"e017424d5478bc870b37142dba22ab2a4a863819d5d399b9224cc8992a0411b4","title":"Add tests for getMultiRepoJSONLPaths() edge cases","description":"From bd-xo6b code review: Missing test coverage for getMultiRepoJSONLPaths() edge cases.\n\nCurrent test gaps:\n- No tests for empty paths in config\n- No tests for duplicate paths\n- No tests for tilde expansion\n- No tests for relative paths\n- No tests for symlinks\n- No tests for paths with spaces\n- No tests for invalid/non-existent paths\n\nTest cases needed:\n\n1. Empty path handling:\n Primary = empty, Additional = [empty]\n Expected: Should either use . as default or error gracefully\n\n2. Duplicate detection:\n Primary = ., Additional = [., ./]\n Expected: Should return unique paths only\n\n3. Path normalization:\n Primary = ~/repos/main, Additional = [../other, ./foo/../bar]\n Expected: Should expand to absolute canonical paths\n\n4. Partial failure scenarios:\n What if snapshot capture succeeds for repos 1-2 but fails on repo 3?\n Test that system does not end up in inconsistent state\n\nFiles:\n- cmd/bd/deletion_tracking_test.go (add new tests)\n\nDependencies:\nDepends on fixing getMultiRepoJSONLPaths() path normalization first.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T19:31:52.921241-08:00","updated_at":"2025-11-06T20:06:49.220334-08:00","closed_at":"2025-11-06T19:53:34.515411-08:00","source_repo":".","dependencies":[{"issue_id":"bd-kdoh","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.353459-08:00","created_by":"daemon"},{"issue_id":"bd-kdoh","depends_on_id":"bd-iye7","type":"blocks","created_at":"2025-11-06T19:32:13.688686-08:00","created_by":"daemon"}]} -{"id":"bd-keb","content_hash":"449e24b36012295a897592b083b8d730a93e08f0fb8195ebc5859a6b5263244a","title":"Add database maintenance commands section to QUICKSTART.md","description":"**Problem:**\nUsers don't discover `bd compact` or `bd cleanup` commands until their database grows large. These maintenance commands aren't mentioned in quickstart documentation.\n\nRelated to issue #349 item #4.\n\n**Current state:**\ndocs/QUICKSTART.md ends at line 217 with \"See README.md for full documentation\" but has no mention of maintenance operations.\n\n**Proposed addition:**\nAdd a \"Database Maintenance\" section after line 140 (before \"Advanced: Agent Mail\" section) covering:\n- When database grows (many closed issues)\n- How to view compaction statistics\n- How to compact old issues\n- How to delete closed issues\n- Warning about permanence\n\n**Example content:**\n```markdown\n## Database Maintenance\n\nAs your project accumulates closed issues, the database grows. Use these commands to manage size:\n\n```bash\n# View compaction statistics\nbd compact --stats\n\n# Preview compaction candidates (30+ days closed)\nbd compact --analyze --json\n\n# Apply agent-generated summary\nbd compact --apply --id bd-42 --summary summary.txt\n\n# Immediately delete closed issues (use with caution!)\nbd cleanup --force\n```\n\n**When to compact:**\n- Database file \u003e 10MB with many old closed issues\n- After major project milestones\n- Before archiving a project phase\n```\n\n**Files to modify:**\n- docs/QUICKSTART.md (add section after line 140)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T20:48:40.488512-05:00","updated_at":"2025-11-23T14:14:13.336494-08:00","closed_at":"2025-11-20T20:59:13.439462-05:00","source_repo":".","labels":["documentation","onboarding"],"comments":[{"id":19,"issue_id":"bd-keb","author":"stevey","text":"Addresses GitHub issue #349 item 4: https://github.com/steveyegge/beads/issues/349\n\nUsers don't discover compact/cleanup commands until database grows large. Quickstart should mention maintenance operations.","created_at":"2025-11-21T02:23:27Z"}]} -{"id":"bd-khnb","content_hash":"4f55475e1150be5a2710768a06f3162510814d96ffb2145b0a1693f5972ca5ae","title":"bd migrate --update-repo-id triggers auto-import that resurrects deleted issues","description":"**Bug:** Running `bd migrate --update-repo-id` can resurrect previously deleted issues from git history.\n\n## What Happened\n\nUser deleted 490 closed issues:\n- Deletion committed successfully (06d655a) with JSONL at 48 lines\n- Database had 48 issues after deletion\n- User ran `bd migrate --update-repo-id` to fix legacy database\n- Migration triggered daemon auto-import\n- JSONL had been restored to 538 issues (from commit 6cd3a32 - before deletion)\n- Auto-import loaded the old JSONL over the cleaned database\n- Result: 490 deleted issues resurrected\n\n## Root Cause\n\nThe auto-import logic in `cmd/bd/sync.go:130-136`:\n```go\nif isJSONLNewer(jsonlPath) {\n fmt.Println(\"β†’ JSONL is newer than database, importing first...\")\n if err := importFromJSONL(ctx, jsonlPath, renameOnImport); err != nil {\n```\n\nThis checks if JSONL mtime is newer than database and auto-imports. The problem:\n1. Git operations (pull, merge, checkout) can restore old JSONL files\n2. Restored file has recent mtime (time of git operation)\n3. Auto-import sees \"newer\" JSONL and imports it\n4. Old data overwrites current database state\n\n## Timeline\n\n- 19:59: Commit 6cd3a32 restored JSONL to 538 issues from d99222d\n- 20:22: Commit 3520321 (bd sync)\n- 20:23: Commit 06d655a deleted 490 issues β†’ JSONL now 48 lines\n- 20:23: User ran `bd migrate --update-repo-id`\n- Migration completed, daemon started\n- Daemon saw JSONL (restored earlier to 538) was \"newer\" than database\n- Auto-import resurrected 490 deleted issues\n\n## Impact\n\n- **Critical data loss bug** - user deletions can be undone silently\n- Affects any workflow that uses git branches, merges, or checkouts\n- Auto-import has no safety checks against importing older data\n- Users have no warning that old data will overwrite current state\n\n## Fix Options\n\n1. **Content-based staleness** (not mtime-based)\n - Compare JSONL content hash vs database content hash\n - Only import if content actually changed\n - Prevents re-importing old data with new mtime\n\n2. **Database timestamp check**\n - Store \"last export timestamp\" in database metadata\n - Only import JSONL if it's newer than last export\n - Prevents importing old JSONL after git operations\n\n3. **User confirmation**\n - Before auto-import, show diff of what will change\n - Require confirmation for large changes (\u003e10% issues affected)\n - Safety valve for destructive imports\n\n4. **Explicit sync mode**\n - Disable auto-import entirely\n - Require explicit `bd sync` or `bd import` commands\n - Trade convenience for safety\n\n## Recommended Solution\n\nCombination of #1 and #2:\n- Add `last_export_timestamp` to database metadata\n- Check JSONL mtime \u003e last_export_timestamp before importing\n- Add content hash check as additional safety\n- Show warning if importing would delete \u003e10 issues\n\nThis preserves auto-import convenience while preventing data loss.\n\n## Files Involved\n\n- `cmd/bd/sync.go:130-136` - Auto-import logic\n- `cmd/bd/daemon_sync.go` - Daemon export/import cycle\n- `internal/autoimport/autoimport.go` - Staleness detection\n\n## Reproduction Steps\n\n1. Create and delete some issues, commit to git\n2. Checkout an earlier commit (before deletion)\n3. Checkout back to current commit\n4. JSONL file now has recent mtime but old content\n5. Run any bd command that triggers auto-import\n6. Deleted issues are resurrected","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-20T20:44:35.235807-05:00","updated_at":"2025-11-20T21:51:31.806158-05:00","closed_at":"2025-11-20T21:51:31.806158-05:00","source_repo":"."} -{"id":"bd-kla1","content_hash":"825b411d37b412a1ee19e3ebc246b6725aca0f32b83e65c8b4680fa4ef2193ff","title":"Add bd init --contributor wizard","description":"Interactive wizard for OSS contributor setup. Guides user through: fork workflow setup, separate planning repo configuration, auto-detection of fork relationships, examples of common OSS workflows.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:29.958409-08:00","updated_at":"2025-11-05T19:27:33.07529-08:00","closed_at":"2025-11-05T18:53:51.267625-08:00","source_repo":".","dependencies":[{"issue_id":"bd-kla1","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.120064-08:00","created_by":"daemon"}]} -{"id":"bd-ktng","content_hash":"0a09f3e1549a70817f23aa57444811aaf18683ff9336944ff6e8c277ac5684b4","title":"Optimize CLI test suite - eliminate redundant git init calls","description":"Current: Each of 13 CLI tests calls git init (31s total). Solution: Use single test binary built once in init(), skip git operations where possible, or use mock filesystem.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-04T11:23:13.660276-08:00","updated_at":"2025-11-04T11:23:13.660276-08:00","source_repo":".","dependencies":[{"issue_id":"bd-ktng","depends_on_id":"bd-l5gq","type":"discovered-from","created_at":"2025-11-04T11:23:13.662102-08:00","created_by":"daemon"}]} -{"id":"bd-ky74","content_hash":"d44651203d5d7996a09dbcfbadede992b6364b40ec6c79fa5efe98f0bb26daee","title":"Optimize cmd/bd long-mode tests by switching to in-process testing","description":"The long-mode CLI tests in cmd/bd are slow (1.4-4.4 seconds each) because they spawn full bd processes via exec.Command() for every operation.\n\nCurrent approach:\n- Each runBD() call spawns new bd process via exec.Command(testBD, args...)\n- Each process initializes Go runtime, loads SQLite, parses CLI flags\n- Tests run serially (create β†’ update β†’ show β†’ close)\n- Even with --no-daemon flag, there's significant process spawn overhead\n\nExample timing from test run:\n- TestCLI_PriorityFormats: 2.21s\n- TestCLI_Show: 2.26s\n- TestCLI_Ready: 2.29s\n- TestCLI_Import: 4.42s\n\nOptimization strategy:\n1. Convert most tests to in-process testing (call bd functions directly)\n2. Reuse test databases across related operations instead of fresh init each time\n3. Keep a few exec.Command() tests that batch multiple operations to verify the CLI path works end-to-end\n\nThis should reduce test time from ~40s to ~5s for the affected tests.","design":"**Approach:**\n\n1. **In-process testing (majority of tests):**\n - Call bd command functions directly instead of exec.Command()\n - Create helper that invokes root command with test args\n - Capture stdout/stderr in-process\n - Benefits: ~10-20x faster, better stack traces, no process overhead\n\n2. **Database reuse:**\n - Share test database across related operations in same test\n - Only create fresh DB when isolation needed\n - Use subtests to share setup cost\n\n3. **Minimal exec.Command() coverage:**\n - Keep 2-3 tests that use exec.Command() for end-to-end validation\n - Batch multiple operations per test (e.g., TestCLI_EndToEnd runs create+update+close+export)\n - Just validates the binary works when executed normally\n\n**Files to change:**\n- cmd/bd/cli_fast_test.go - convert runBD() helper to in-process\n- cmd/bd/test_helpers_test.go - may need new helpers for in-process execution","acceptance_criteria":"- All tests in cli_fast_test.go still pass\n- Test suite runs in \u0026lt;10s (down from ~40s)\n- At least 1-2 tests still use exec.Command() for end-to-end validation\n- No daemon processes spawned during tests\n- Coverage maintained or improved","notes":"Converted all CLI tests in cli_fast_test.go to use in-process testing via rootCmd.Execute(). Created runBDInProcess() helper that:\n- Calls rootCmd.Execute() directly instead of spawning processes\n- Uses mutex to serialize execution (rootCmd/viper not thread-safe)\n- Properly cleans up global state (store, daemonClient)\n- Returns only stdout to avoid JSON parsing issues with stderr warnings\n\nPerformance results:\n- In-process tests: ~0.6s each (cached even faster)\n- exec.Command tests: ~3.7s each \n- Speedup: ~10x faster\n\nKept TestCLI_EndToEnd() that uses exec.Command for end-to-end validation of the actual binary.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T18:40:27.358821-08:00","updated_at":"2025-11-08T18:47:11.107998-08:00","closed_at":"2025-11-08T18:47:11.107998-08:00","source_repo":"."} -{"id":"bd-l4b6","content_hash":"62f76d6f751783139b97ee4b08e1134f6154d0eb5696e0f78ce258f841c9738e","title":"Add tests for bd init --team wizard","description":"Write integration tests for the team wizard:\n- Test branch detection\n- Test sync branch creation\n- Test protected branch workflow\n- Test auto-sync configuration","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:58:18.192425-08:00","updated_at":"2025-11-06T20:06:49.22056-08:00","closed_at":"2025-11-06T19:55:39.687439-08:00","source_repo":"."} -{"id":"bd-l5gq","content_hash":"9c6f895c8e0066874073474fded02d3b1b10a008c3448f1e650e2ff39b5e8e02","title":"Optimize test suite performance - cut runtime by 50%+","description":"## Problem\nTest suite takes ~20.8 seconds, with 95% of time spent in just 2 tests:\n- TestHashIDs_MultiCloneConverge: 11.08s (53%)\n- TestHashIDs_IdenticalContentDedup: 8.78s (42%)\n\nBoth tests in beads_hash_multiclone_test.go perform extensive Git operations (bare repos, multiple clones, sync rounds).\n\n## Goal\nCut total test time by at least 50% (to ~10 seconds or less).\n\n## Analysis\nTests already have some optimizations:\n- --shared --depth=1 --no-tags for fast cloning\n- Disabled hooks, gc, fsync\n- Support -short flag\n\n## Impact\n- Faster development feedback loop\n- Reduced CI costs and time\n- Better developer experience","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-04T01:23:14.410648-08:00","updated_at":"2025-11-04T11:23:13.683213-08:00","closed_at":"2025-11-04T11:23:13.683213-08:00","source_repo":"."} -{"id":"bd-l954","content_hash":"263dd2111cf0353b307f2e47489aa42ecf607e49b1316b54a6497cad9d3722b0","title":"Performance Testing Framework","description":"Add comprehensive performance testing for beads focusing on optimization guidance and validating 10K+ database scale. Uses standard Go tooling, follows existing patterns, minimal complexity.\n\nComponents:\n- Benchmark suite for critical operations at 10K-20K scale\n- Fixture generator for realistic test data (epic hierarchies, cross-links)\n- User diagnostics via bd doctor --perf\n- Always-on profiling integration\n\nGoals:\n- Identify bottlenecks for optimization work\n- Validate performance at 10K+ issue scale\n- Enable users to collect diagnostics for bug reports\n- Support both SQLite and JSONL import paths","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-13T22:22:11.203467-08:00","updated_at":"2025-11-13T22:22:11.203467-08:00","source_repo":"."} -{"id":"bd-la9d","content_hash":"298e5922cb0e6460d1cf14d2b7230c63403e72fcb511fb31d3fe2e2f241fd18a","title":"Blocking issue","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.758706-05:00","updated_at":"2025-11-20T19:43:48.758706-05:00","closed_at":"2025-11-07T21:55:09.43148-08:00","source_repo":"."} -{"id":"bd-lln","content_hash":"650962c39553fb85e797c10044f4f1d89b6311855c7727c3f82c49dfea2ced97","title":"Add tests for performFlush error handling in FlushManager","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/flush_manager.go:269, the performFlush method is flagged by unparam as always returning nil, indicating the error return value is never used.\n\nAdd tests to determine:\n- Whether performFlush can actually return errors in failure scenarios\n- If error return is needed, add tests for error cases (disk full, permission denied, etc.)\n- If error return is not needed, refactor to remove unused return value\n- Test full export vs incremental export error handling\n\nThis ensures proper error handling in the flush mechanism and removes dead code if the return value is unnecessary.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:33.533653-05:00","updated_at":"2025-11-23T16:05:29.738571-08:00","closed_at":"2025-11-21T19:31:21.876949-05:00","source_repo":".","labels":["discovered:supervisor"],"dependencies":[{"issue_id":"bd-lln","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.534913-05:00","created_by":"ai-supervisor"}]} -{"id":"bd-lm2q","content_hash":"b098ab750578221bdbc099aeb93f1275650c3636a6b93badbcb093a411a82d8d","title":"Fix `bd sync` failure due to daemon auto-export timestamp skew","description":"`bd sync` fails with false-positive \"JSONL is newer than database\" after daemon auto-export.\nRoot Cause: Daemon exports local changes to JSONL, updating its timestamp. `bd sync` sees JSONL.mtime \u003e DB.mtime and assumes external changes, blocking export.\nProposed Fixes:\n1. `bd sync` auto-imports if timestamp matches but content differs (or just auto-imports).\n2. Content-based comparison instead of timestamp only.\n","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T18:56:16.876685-05:00","updated_at":"2025-11-20T20:54:39.512574-05:00","closed_at":"2025-11-20T20:54:39.512574-05:00","source_repo":"."} -{"id":"bd-loka","content_hash":"07ae2db6da314a149bcfb0f05a7a161588d0169bfd3df0a8b278ee07548a5318","title":"Add built-in version tracking to bd","description":"Enhance bd to automatically track its own version in metadata.json and detect upgrades.\n\n## Features to Implement\n1. Auto-update metadata.json with 'last_bd_version' field on every bd command\n2. Add 'bd upgrade status' - check if version changed since last run\n3. Add 'bd upgrade review' - show what's new since last-seen version (not just last 3)\n4. Add 'bd upgrade ack' - mark current version as acknowledged\n5. Smart detection output when version changes (show hint on bd ready, bd list, etc.)\n\n## Implementation Details\n- Store last_bd_version in metadata.json\n- Store last_version_check timestamp\n- Compare on every bd command (cached check, low overhead)\n- Only show notification once per session until ack'd\n\n## Example Output\n```\n$ bd ready\nπŸ”„ bd upgraded from v0.23.0 to v0.24.2 since last use\nπŸ’‘ Run 'bd upgrade review' to see what changed\n\nReady work: 5 issues\n...\n```\n\n## Acceptance Criteria\n- Version automatically tracked in metadata.json\n- Upgrade detection works across sessions\n- New bd upgrade subcommands functional\n- Non-intrusive notifications (show once, then quiet)\n","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-23T16:21:53.951611-08:00","updated_at":"2025-11-23T17:06:34.003365-08:00","closed_at":"2025-11-23T17:06:34.003365-08:00","source_repo":".","dependencies":[{"issue_id":"bd-loka","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:53.952998-08:00","created_by":"daemon"}]} -{"id":"bd-loka.1","content_hash":"e6d596b7181f5f22563f30f714b831c30ed916b9578debf79aea28c7de12991c","title":"Add LastBdVersion field to Config struct","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:27.336668-08:00","updated_at":"2025-11-23T16:56:52.180512-08:00","closed_at":"2025-11-23T16:56:52.180512-08:00","source_repo":".","dependencies":[{"issue_id":"bd-loka.1","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:27.337232-08:00","created_by":"daemon"}]} -{"id":"bd-loka.2","content_hash":"71369d71229dc4bdcb17aa5df61f98c6dfc43a260d4b8370d8021af49b54bbae","title":"Add version tracking in PersistentPreRun","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:28.680947-08:00","updated_at":"2025-11-23T16:58:25.180851-08:00","closed_at":"2025-11-23T16:58:25.180851-08:00","source_repo":".","dependencies":[{"issue_id":"bd-loka.2","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:28.681524-08:00","created_by":"daemon"}]} -{"id":"bd-loka.3","content_hash":"adb40ed71c120a86d1e2305ebc31189f706e449a9cdb4219fd28298bd849713b","title":"Implement bd upgrade subcommand with status/review/ack","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:29.849527-08:00","updated_at":"2025-11-23T17:02:54.925905-08:00","closed_at":"2025-11-23T17:02:54.925905-08:00","source_repo":".","dependencies":[{"issue_id":"bd-loka.3","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:29.850054-08:00","created_by":"daemon"}]} -{"id":"bd-loka.4","content_hash":"a943335cf0a782a874ec583ad7e6a435d8a0a3271e097064920bab7ee68fe341","title":"Add upgrade notification system to bd ready/list","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:31.227711-08:00","updated_at":"2025-11-23T17:06:31.830726-08:00","closed_at":"2025-11-23T17:06:31.830726-08:00","source_repo":".","dependencies":[{"issue_id":"bd-loka.4","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:31.228284-08:00","created_by":"daemon"}]} -{"id":"bd-lwnt","content_hash":"ddfa247870eb3734ffa7a4d0da6fcd4a359d2b48e02d70aad8560ec4bc13afdc","title":"Test P1 priority","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T12:58:38.074112-08:00","updated_at":"2025-11-05T12:58:44.711763-08:00","closed_at":"2025-11-05T12:58:44.711763-08:00","source_repo":"."} -{"id":"bd-m0w","content_hash":"e8641e225f1d4cf13fbd97c4a83046e3597df180d3ee134125e4a35abc6941cd","title":"Add test coverage for internal/validation package","description":"","design":"Validation package has 1 test file. Critical for data integrity. Target: 80% coverage","acceptance_criteria":"- At least 4 test files\n- Package coverage \u003e= 80%\n- Tests cover all validation rules","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:24.129559-05:00","updated_at":"2025-11-20T21:21:24.129559-05:00","source_repo":".","dependencies":[{"issue_id":"bd-m0w","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.350477-05:00","created_by":"daemon"}]} -{"id":"bd-m62x","content_hash":"45ec0b71d12d639a662267e71bc8febd4c90c6abce22de4795ea949fb6d204ae","title":"Benchmark Suite for Critical Operations","description":"Extend existing benchmark suite with comprehensive benchmarks for critical operations at 10K-20K scale.\n\nExisting benchmarks (keep these):\n- cycle_bench_test.go - Cycle detection up to 5K issues (linear, tree, dense graphs)\n- compact_bench_test.go - Compaction candidate queries (100 issues)\n- internal/rpc/bench_test.go - Daemon vs direct mode comparison\n\nNew benchmarks to add in sqlite_bench_test.go (~10-12 total):\n1. GetReadyWork - Simple, deep hierarchies, cross-linked (CRITICAL - not currently benchmarked)\n2. SearchIssues - No filters, complex filters (CRITICAL - not currently benchmarked)\n3. CreateIssue - Single issue creation\n4. UpdateIssue - Status/priority/assignee changes\n5. AddDependency - Extend to 10K/20K scale (currently only up to 5K)\n6. JSONL Export - Full export performance\n7. JSONL Import - Import performance\n\nScale levels:\n- Large: 10K issues (5K open, 5K closed)\n- XLarge: 20K issues (10K open, 10K closed)\n\nImplementation:\n- NEW FILE: internal/storage/sqlite/sqlite_bench_test.go\n- Keep existing cycle_bench_test.go and compact_bench_test.go unchanged\n- Build tag: //go:build bench\n- Standard testing.B benchmarks\n- b.ReportAllocs() for memory tracking\n- Test both SQLite and JSONL-imported databases\n\nAlways generates CPU and memory profiles for analysis.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:22:43.770787-08:00","updated_at":"2025-11-13T23:15:33.781023-08:00","closed_at":"2025-11-13T23:15:33.781023-08:00","source_repo":".","dependencies":[{"issue_id":"bd-m62x","depends_on_id":"bd-q13h","type":"blocks","created_at":"2025-11-13T22:24:02.668091-08:00","created_by":"daemon"},{"issue_id":"bd-m62x","depends_on_id":"bd-zj8e","type":"blocks","created_at":"2025-11-13T22:24:06.30131-08:00","created_by":"daemon"}]} -{"id":"bd-m7ge","content_hash":"bb08f2bcbbdd2e392733d92bff2e46a51000337ac019d306dd6a2983916873c4","title":"Add .beads/README.md during 'bd init' for project documentation and promotion","description":"When 'bd init' is run, automatically generate a .beads/README.md file that:\n\n1. Briefly explains what Beads is (AI-native issue tracking that lives in your repo)\n2. Links to the main repository: https://github.com/steveyegge/beads\n3. Provides a quick reference of essential commands:\n - bd create: Create new issues\n - bd list: View all issues\n - bd update: Modify issue status/details\n - bd show: View issue details\n - bd sync: Sync with git remote\n4. Highlights key benefits for AI coding agents and developers\n5. Encourages developers to try it out\n\nThe README should be enthusiastic and compelling to get open source contributors excited about using Beads for their AI-assisted development workflows.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-16T22:32:50.478681-08:00","updated_at":"2025-11-16T22:32:58.492868-08:00","source_repo":"."} -{"id":"bd-m8t","content_hash":"f5e3d149da2c318ceb3d2963a0b33ab46b07f513fd5d9810fc14ead98692198f","title":"Extract computeJSONLHash helper to eliminate code duplication","description":"SHA256 hash computation is duplicated in 3 places:\n- cmd/bd/integrity.go:50-52\n- cmd/bd/sync.go:611-613\n- cmd/bd/import.go:318-319\n\nExtract to shared helper function computeJSONLHash(jsonlPath string) (string, error) that includes proper #nosec comment and error handling.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:31:05.836496-05:00","updated_at":"2025-11-20T21:35:36.04171-05:00","closed_at":"2025-11-20T21:35:36.04171-05:00","source_repo":".","dependencies":[{"issue_id":"bd-m8t","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:05.837915-05:00","created_by":"daemon"}]} -{"id":"bd-m9th","content_hash":"862e45f019a273e93490f1a309ac0740c43f4e33b815ff3a8797b5511f401f00","title":"Create Python adapter library","description":"Create beads_mail_adapter.py library that wraps Agent Mail HTTP calls with health checks and graceful degradation.\n\nAcceptance Criteria:\n- AgentMailAdapter class with health check on init\n- enabled flag auto-disables if server unreachable\n- All methods wrapped in try/catch (non-blocking failures)\n- Methods: reserve_issue(), release_issue(), notify(), check_inbox()\n- Environment-based configuration (AGENT_MAIL_URL, AGENT_MAIL_TOKEN)\n- Unit tests for enabled/disabled modes\n\nFile: lib/beads_mail_adapter.py","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T22:42:28.60152-08:00","updated_at":"2025-11-08T00:11:02.746747-08:00","closed_at":"2025-11-08T00:11:02.746747-08:00","source_repo":".","dependencies":[{"issue_id":"bd-m9th","depends_on_id":"bd-4cyb","type":"blocks","created_at":"2025-11-07T22:42:28.602698-08:00","created_by":"daemon"}]} -{"id":"bd-mf0o","content_hash":"87f9eb99c69925639f19252c6509bcef9a4b21a4dd288d970aa2212b68a4c6b7","title":"Add 'new' as alias for 'create' command","description":"","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-08T03:11:46.791657-08:00","updated_at":"2025-11-08T03:11:51.035418-08:00","closed_at":"2025-11-08T03:11:51.035418-08:00","source_repo":"."} -{"id":"bd-mlcz","content_hash":"c7a69a80bb7a3934692c11aca9bf33d38ab797ab86ca1b3ac2a1347bff39feac","title":"Implement bd migrate command","description":"Add bd migrate command to move issues between repos with filtering. Should support: filtering by status/priority/labels, dry-run mode, preserving dependencies, handling source_repo field updates.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:29.902151-08:00","updated_at":"2025-11-05T18:42:52.536951-08:00","closed_at":"2025-11-05T18:42:52.536951-08:00","source_repo":".","dependencies":[{"issue_id":"bd-mlcz","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.072312-08:00","created_by":"daemon"}]} -{"id":"bd-mn9p","content_hash":"5fc031df24862169c50d6a5c0d6060cfded0f641e0538524db5a22eef5140f3d","title":"bd-hv01: Brittle string comparison breaks with JSON field reordering","description":"## Problem\ndeletion_tracking.go:125 uses string comparison to detect unchanged issues:\n\n```go\nif leftLine, existsInLeft := leftIndex[id]; existsInLeft \u0026\u0026 leftLine == baseLine {\n deletions = append(deletions, id)\n}\n```\n\nThis breaks if:\n- JSON field order changes (legal in JSON)\n- Timestamps updated by import/export\n- Whitespace/formatting changes\n- Floating point precision varies\n\n## Example Failure\n```json\n// baseLine\n{\"id\":\"bd-1\",\"priority\":1,\"status\":\"open\"}\n// leftLine (same data, different order)\n{\"id\":\"bd-1\",\"status\":\"open\",\"priority\":1}\n```\nThese are semantically identical but string comparison fails.\n\n## Fix\nParse and compare JSON semantically:\n```go\nfunc jsonEquals(a, b string) bool {\n var objA, objB map[string]interface{}\n json.Unmarshal([]byte(a), \u0026objA)\n json.Unmarshal([]byte(b), \u0026objB)\n return reflect.DeepEqual(objA, objB)\n}\n```\n\n## Files Affected\n- cmd/bd/deletion_tracking.go:125\n- cmd/bd/deletion_tracking.go:134-170 (buildIDToLineMap)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:15:35.090716-08:00","updated_at":"2025-11-06T18:46:55.889888-08:00","closed_at":"2025-11-06T18:46:55.889888-08:00","source_repo":".","dependencies":[{"issue_id":"bd-mn9p","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.790898-08:00","created_by":"daemon"}]} -{"id":"bd-mnap","content_hash":"c15d3c631656fe6d21291f127fc545af93e712b5f3f94cce028513fb743a4fdb","title":"Investigate performance issues in VS Code Copilot (Windows)","description":"Beads unusable in Windows 11 VS Code Copilot chat with Sonnet 4.5.\nSummary event happens every 3-4 turns, taking 3 minutes.\nCopilot summarizes after ~125k tokens despite model supporting 1M.\nLarge context size of beads might be triggering aggressive summarization.\nNeed workaround or optimization for context size.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:56:30.124918-05:00","updated_at":"2025-11-20T18:56:30.124918-05:00","source_repo":"."} -{"id":"bd-muls","content_hash":"bfe08a41307f596296672aa4fdf33d5fbf7b40366a38eaa94a22fc5052619488","title":"Install and test MCP Agent Mail locally","description":"Install MCP Agent Mail on a single development machine and verify basic functionality.\n\nAcceptance Criteria:\n- Server installed via one-line installer\n- Server running on port 8765\n- Can register a project via HTTP\n- Can register an agent identity\n- Web UI accessible at /mail","notes":"Tested local installation. Server runs on port 8765, web UI works. MCP API tool execution has errors - needs debugging. See /tmp/bd-muls-report.md for details.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-07T22:41:59.896735-08:00","updated_at":"2025-11-07T23:14:59.1182-08:00","closed_at":"2025-11-07T23:14:59.1182-08:00","source_repo":"."} -{"id":"bd-my64","content_hash":"8f4eb8056f81096e7090813f319b3aa996ada6dc5809d81305271d0584c2f364","title":"Pre-push hook and daemon export produce different JSONL","description":"After committing and pushing, git status shows .beads/beads.jsonl as dirty. Investigation shows:\n\n1. Pre-push hook ran successfully and exported DB β†’ JSONL\n2. Push completed\n3. Shortly after, daemon exported DB β†’ JSONL again with different content\n4. Diff shows comments added to old issues (bd-23a8, bd-6049, bd-87a0)\n\nTimeline:\n- Commit c731c45 \"Update beads JSONL\"\n- Pre-push hook exported JSONL\n- Push succeeded\n- Daemon PID 33314 exported again with different content\n\nQuestions:\n1. Did someone run a command between commit and daemon export?\n2. Is there a timing issue where pre-push hook doesn't capture all DB changes?\n3. Should pre-commit hook flush daemon changes before committing?\n\nThe comments appear to be from Nov 5 (created_at: 2025-11-05T08:38:46Z) but are only appearing in JSONL now. This suggests the DB had these comments but they weren't exported during pre-push.\n\nPossible causes:\n- Pre-push hook uses BEADS_NO_DAEMON=1 which might skip pending writes\n- Daemon has unflushed changes in memory\n- Race condition between pre-push export and daemon's periodic export","notes":"Improved fix based on oracle code review:\n1. Pre-push now flushes pending changes first (prevents debounce race)\n2. Uses git status --porcelain to catch all change types\n3. Handles both beads.jsonl and issues.jsonl\n4. Works even if bd not installed (git-only check)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:49:54.570993-08:00","updated_at":"2025-11-06T19:01:14.549032-08:00","closed_at":"2025-11-06T18:57:42.710282-08:00","source_repo":"."} -{"id":"bd-n25","content_hash":"408a2c8ca96f8e93af773363d23b84087b1360d0c1c9ada250bb316ac2df47b9","title":"Speed up main_test.go - tests hang indefinitely due to nil rootCtx","description":"## Problem\n\nmain_test.go tests are hanging indefinitely, making them unusable and blocking development.\n\n## Root Cause\n\nTests that call flushToJSONL() or autoImportIfNewer() hang forever because:\n- rootCtx is nil in test environment (defined in cmd/bd/main.go:67)\n- flushToJSONL() uses rootCtx for DB operations (autoflush.go:503)\n- When rootCtx is nil, DB calls timeout/hang indefinitely\n\n## Affected Tests (10+)\n\n- TestAutoFlushOnExit\n- TestAutoFlushJSONLContent \n- TestAutoFlushErrorHandling\n- TestAutoImportIfNewer\n- TestAutoImportDisabled\n- TestAutoImportWithUpdate\n- TestAutoImportNoUpdate\n- TestAutoImportMergeConflict\n- TestAutoImportConflictMarkerFalsePositive\n- TestAutoImportClosedAtInvariant\n\n## Proof\n\n```bash\n# Before fix: TestAutoFlushJSONLContent HANGS (killed after 2+ min)\n# After adding rootCtx init: Completes in 0.04s\n# Speedup: ∞ β†’ 0.04s\n```\n\n## Solution\n\nSee MAIN_TEST_OPTIMIZATION_PLAN.md for complete fix plan.\n\n**Quick Fix (5 min)**: Add to each hanging test:\n```go\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\noldRootCtx := rootCtx\nrootCtx = ctx\ndefer func() { rootCtx = oldRootCtx }()\n```\n\n**Full Optimization (40 min total)**:\n1. Fix rootCtx (5 min) - unblocks tests\n2. Reduce sleep durations 10x (2 min) - saves ~280ms\n3. Use in-memory DBs (10 min) - saves ~1s\n4. Share test fixtures (15 min) - saves ~1.2s\n5. Fix skipped debounce test (5 min)\n\n## Expected Results\n\n- Tests go from hanging β†’ \u003c5s total runtime\n- Keep critical integration test coverage\n- Tests caught real bugs: bd-270, bd-206, bd-160\n\n## Files\n\n- Analysis: MAIN_TEST_REFACTOR_NOTES.md\n- Solution: MAIN_TEST_OPTIMIZATION_PLAN.md\n- Tests: cmd/bd/main_test.go (18 tests, 1322 LOC)\n\n## Priority\n\nP1 - Blocking development, tests unusable in current state","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T18:27:48.942814-05:00","updated_at":"2025-11-21T18:44:21.944901-05:00","closed_at":"2025-11-21T18:44:21.944901-05:00","source_repo":"."} -{"id":"bd-n4td","content_hash":"1a5222748ad9badd0cdfdcfbe831f96c532deeb41909f9729e111dcbaa119d0d","title":"Add warning when staleness check errors","description":"## Problem\n\nWhen ensureDatabaseFresh() calls CheckStaleness() and it errors (corrupted metadata, permission issues, etc.), we silently proceed with potentially stale data.\n\n**Location:** cmd/bd/staleness.go:27-32\n\n**Scenarios:**\n- Corrupted metadata table\n- Database locked by another process \n- Permission issues reading JSONL file\n- Invalid last_import_time format in DB\n\n## Current Code\n\n```go\nisStale, err := autoimport.CheckStaleness(ctx, store, dbPath)\nif err \\!= nil {\n // If we can't determine staleness, allow operation to proceed\n // (better to show potentially stale data than block user)\n return nil\n}\n```\n\n## Fix\n\n```go\nisStale, err := autoimport.CheckStaleness(ctx, store, dbPath)\nif err \\!= nil {\n fmt.Fprintf(os.Stderr, \"Warning: Could not verify database freshness: %v\\n\", err)\n fmt.Fprintf(os.Stderr, \"Proceeding anyway. Data may be stale.\\n\\n\")\n return nil\n}\n```\n\n## Impact\nMedium - users should know when staleness check fails\n\n## Effort\nEasy - 5 minutes","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:16:34.889997-05:00","updated_at":"2025-11-20T20:16:34.889997-05:00","source_repo":".","dependencies":[{"issue_id":"bd-n4td","depends_on_id":"bd-2q6d","type":"blocks","created_at":"2025-11-20T20:18:20.154723-05:00","created_by":"stevey"}]} -{"id":"bd-na8r","content_hash":"22e87dec83dd0415fbcaa2370a066534f8dcbdfd78c168f34a984b92d5faf876","title":"Improve AGENTS.md instructions for issue creation with descriptions","description":"## Solution: Better documentation\n\nUpdate AGENTS.md to emphasize including descriptions when creating issues.\n\n## Current State\n\nAGENTS.md line 176 shows:\n```bash\nbd create \"Issue title\" -t bug|feature|task -p 0-4 --json\n```\n\nAnd line 223-226 shows discovered-from example without description.\n\n## Proposed Changes\n\n### 1. Update all bd create examples to include --description\n\n```bash\nbd create \"Issue title\" --description=\"Detailed context\" -t bug -p 1 --json\n```\n\n### 2. Add explicit guidance in Issue Tracking section\n\nAdd after line 218 (Workflow section):\n\n\u003e **IMPORTANT: Always include descriptions when creating issues**\n\u003e \n\u003e Issues without descriptions lack context for future work. When creating issues, always include:\n\u003e - **Why** the issue exists (problem statement)\n\u003e - **What** needs to be done (scope)\n\u003e - **How** you discovered it (if applicable)\n\u003e\n\u003e Good: `bd create \"Fix auth bug\" --description=\"Login fails with 500 error when password contains special chars. Found during GH#123 work.\" -t bug -p 1`\n\u003e Bad: `bd create \"Fix auth bug\" -t bug -p 1`\n\n### 3. Update MCP tool docstring\n\nIn integrations/beads-mcp/src/beads_mcp/tools.py:363-367, change:\n```python\n\"\"\"Create a new issue.\n\nUse this when you discover new work during your session.\nLink it back with beads_add_dependency using 'discovered-from' type.\n\"\"\"\n```\n\nTo:\n```python\n\"\"\"Create a new issue.\n\nIMPORTANT: Always provide a meaningful description with context about:\n- Why this issue exists (problem/need)\n- What needs to be done\n- How you discovered it (if applicable)\n\nUse this when you discover new work during your session.\nLink it back with beads_add_dependency using 'discovered-from' type.\n\"\"\"\n```\n\n## Files to modify\n\n- AGENTS.md (lines 176, 218-226, throughout examples)\n- integrations/beads-mcp/src/beads_mcp/tools.py (line 363-367)\n- .github/copilot-instructions.md (if it has similar examples)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T14:01:00.079205-08:00","updated_at":"2025-11-23T14:04:03.191822-08:00","closed_at":"2025-11-23T14:04:03.191822-08:00","source_repo":".","dependencies":[{"issue_id":"bd-na8r","depends_on_id":"bd-0tr0","type":"discovered-from","created_at":"2025-11-23T14:01:00.080937-08:00","created_by":"daemon"}]} -{"id":"bd-nbc","content_hash":"a68bd55cc45bb0574c77fa51573fb6f358edaff5b4d666e522ced541a4b90d93","title":"Add security tests for file path validation in clean command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/clean.go:118, os.Open(gitignorePath) is flagged by gosec G304 for potential file inclusion via variable without validation.\n\nAdd tests covering:\n- Path traversal attempts (../../etc/passwd)\n- Absolute paths outside project directory\n- Symlink following behavior\n- Non-existent file handling\n- Validation that only .gitignore files in valid locations are opened\n\nThis is a security-sensitive code path that needs validation to prevent unauthorized file access.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-21T10:25:33.526884-05:00","updated_at":"2025-11-23T16:05:29.741143-08:00","closed_at":"2025-11-21T19:31:21.864673-05:00","source_repo":".","labels":["discovered:supervisor"],"dependencies":[{"issue_id":"bd-nbc","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.528582-05:00","created_by":"ai-supervisor"}]} -{"id":"bd-ndyz","content_hash":"98629cb6e905127858991beecd39aa298b2c83007d87d64dd3644b1af605e627","title":"GH#243: Recurring stale daemon.lock causes 5s delays","description":"User reports daemon.lock keeps becoming stale after running Claude with beads.\n\nSymptom:\n- bd ready takes 5 seconds (exact)\n- daemon.lock exists but socket is missing\n- bd daemons killall temporarily fixes it\n- Problem recurs after using beads with AI agents\n\nUser on v0.22.0, Macbook M2, 132 issues (89 closed)\n\nHypothesis: Daemon is crashing or exiting uncleanly during agent sessions, leaving stale lock file.\n\nNeed to:\n1. Add crash logging to daemon to understand why it's exiting\n2. Improve cleanup on daemon exit (ensure lock is always removed)\n3. Add automatic stale lock detection/cleanup\n4. Consider making daemon more resilient to crashes","design":"Root cause: 5s delay from slow RPC connect attempts when socket missing but clients retry with long timeouts. Lock file mechanism is fine (OS releases on crash), but missing socket + stale pid cause unnecessary connection attempts.\n\nKey insight: The lock itself isn't stale (OS-managed), but socket cleanup on crash is incomplete, leading clients to wait through full dial timeout.","notes":"Oracle analysis complete. Converting to epic with 5 focused sub-issues:\n1. RPC fast-fail with socket stat + short timeouts (P0)\n2. Standardize daemon detection with lock probe (P1) \n3. Crash recovery improvements (P2)\n4. Self-heal stale artifacts (P2)\n5. Diagnostics and debugging (P3)","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T16:32:23.576171-08:00","updated_at":"2025-11-07T22:07:17.347419-08:00","closed_at":"2025-11-07T21:29:56.009737-08:00","source_repo":"."} -{"id":"bd-nemp","content_hash":"0495137c34f3a429f216180b34551481846c818d7bdf56118eef59b15a7f3a3d","title":"Measure git operation reduction","description":"Quantify the reduction in git operations (pulls, commits, pushes) when using Agent Mail for coordination.\n\nAcceptance Criteria:\n- Baseline: count git ops for 10 issues without Agent Mail\n- With Agent Mail: count git ops for 10 issues\n- Document reduction percentage\n- Verify 70-80% reduction claim\n- Measure impact on .git directory size growth\n\nSuccess Metric: β‰₯70% reduction in git operations","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:00.157334-08:00","updated_at":"2025-11-08T00:20:30.691721-08:00","closed_at":"2025-11-08T00:20:30.691721-08:00","source_repo":".","dependencies":[{"issue_id":"bd-nemp","depends_on_id":"bd-6hji","type":"blocks","created_at":"2025-11-07T23:03:53.131532-08:00","created_by":"daemon"},{"issue_id":"bd-nemp","depends_on_id":"bd-htfk","type":"blocks","created_at":"2025-11-07T23:03:53.200321-08:00","created_by":"daemon"}]} -{"id":"bd-ng56","content_hash":"f570cf399d412baa9b9209bae41140668269513e2d2127c47ddee70fa173d79d","title":"bd-hv01: Three full JSONL reads on every sync (performance)","description":"Problem: computeAcceptedDeletions reads three JSONL files completely into memory (base, left, merged). For 1000 issues at 1KB each, this is 3MB read and 3000 JSON parse operations.\n\nImpact: Acceptable now (~20-35ms overhead) but will be slow for large repos (10k+ issues).\n\nPossible optimizations: single-pass streaming, memory-mapped files, binary format, incremental snapshots.\n\nFiles: cmd/bd/deletion_tracking.go:101-208","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-06T18:16:25.653076-08:00","updated_at":"2025-11-06T20:06:49.220818-08:00","closed_at":"2025-11-06T19:41:04.67733-08:00","source_repo":".","dependencies":[{"issue_id":"bd-ng56","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.148149-08:00","created_by":"daemon"}]} -{"id":"bd-nl8z","content_hash":"a573c9fe29cd810420b602fc5d2c105ace29a409f2294fd251baf515bef0b85e","title":"Documentation","description":"Complete documentation for Agent Mail integration to enable adoption.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-07T22:42:37.969636-08:00","updated_at":"2025-11-08T03:09:48.253476-08:00","closed_at":"2025-11-08T02:34:57.887891-08:00","source_repo":".","dependencies":[{"issue_id":"bd-nl8z","depends_on_id":"bd-wfmw","type":"blocks","created_at":"2025-11-07T22:42:37.970621-08:00","created_by":"daemon"}]} -{"id":"bd-nq41","content_hash":"33f9cfe6a0ef5200dcd5016317b43b1568ff9dc7303537d956bdab02029f6c63","title":"Fix Homebrew warning about Ruby file location","description":"Homebrew warning: Found Ruby file outside steveyegge/beads tap formula directory.\nWarning points to: /opt/homebrew/Library/Taps/steveyegge/homebrew-beads/bd.rb\nIt should likely be inside a Formula/ directory or similar structure expected by Homebrew taps.\n","status":"open","priority":2,"issue_type":"chore","created_at":"2025-11-20T18:56:21.226579-05:00","updated_at":"2025-11-20T18:56:21.226579-05:00","source_repo":"."} -{"id":"bd-nqes","content_hash":"0063981ff72ee9d99ef59e43bf43369b4c8fc0e73479ce1e8bd9e91603b850a3","title":"bd-hv01: Non-atomic snapshot operations can cause data loss","description":"## Problem\nIn sync.go:146-155 and daemon_sync.go:502-505, snapshot capture failures are logged as warnings but sync continues:\n\n```go\nif err := exportToJSONL(ctx, jsonlPath); err != nil { ... }\nif err := captureLeftSnapshot(jsonlPath); err != nil {\n fmt.Fprintf(os.Stderr, \"Warning: failed to capture snapshot...\")\n}\n```\n\nIf export succeeds but snapshot capture fails, the merge uses stale snapshot data, potentially deleting wrong issues.\n\n## Impact\n- Critical data integrity issue\n- Could delete issues incorrectly during multi-workspace sync\n\n## Fix\nMake snapshot capture mandatory:\n```go\nif err := captureLeftSnapshot(jsonlPath); err != nil {\n return fmt.Errorf(\"failed to capture snapshot (required for deletion tracking): %w\", err)\n}\n```\n\n## Files Affected\n- cmd/bd/sync.go:146-155\n- cmd/bd/daemon_sync.go:502-505","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:15:33.574158-08:00","updated_at":"2025-11-06T18:46:55.874814-08:00","closed_at":"2025-11-06T18:46:55.874814-08:00","source_repo":".","dependencies":[{"issue_id":"bd-nqes","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.749153-08:00","created_by":"daemon"}]} -{"id":"bd-nszi","content_hash":"7eb77a2db8edb51267c42176883ad97f11a83103720647c92a8de26e79e6ab3e","title":"Post-merge hook silently fails on JSONL conflicts, poor UX","description":"When git pull results in merge conflicts in .beads/issues.jsonl, the post-merge hook runs 'bd sync --import-only' which fails, but stderr was redirected to /dev/null. User only saw generic warning.\n\nFixed by capturing and displaying the actual error output, so users see 'Git conflict markers detected' message immediately.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T02:31:04.909925-08:00","updated_at":"2025-11-08T02:31:45.237286-08:00","closed_at":"2025-11-08T02:31:45.237286-08:00","source_repo":"."} -{"id":"bd-nxgk","content_hash":"b1124b39715075cd321a6996f662adf9af49871524a97890703819caf87f7da1","title":"Agent upgrade awareness system","description":"Make it easy for AI agents to discover and adapt to bd upgrades without manual intervention.\n\n## Problem\nWhen bd is upgraded (happens weekly), agents need to:\n1. Discover what changed\n2. Update their workflows/instructions\n3. Keep git hooks in sync\n4. Know which new features to adopt\n\nCurrently this requires manual prompting or re-running bd onboard, which is unreliable.\n\n## Solution Layers\n1. Documentation improvements (immediate)\n2. Startup hook snippet for detection (immediate, zero bd code)\n3. Built-in version tracking in bd (short-term)\n4. Separated canonical BD_GUIDE.md (long-term architectural)\n\n## Success Criteria\n- Agents automatically detect bd upgrades at session start\n- Agents see what changed without re-reading all docs\n- Git hooks stay in sync with bd version\n- bd-specific instructions separated from project instructions\n\n## Related Discussion\nGitHub Discussion #239: 'Upgrading beads: how to let the Agent know'\n","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-23T16:21:14.431233-08:00","updated_at":"2025-11-23T16:21:14.431233-08:00","source_repo":"."} -{"id":"bd-o43","content_hash":"4caa0f14a58127378a533362ec0292833b6d59195e503fab7505180c9c5c0438","title":"Add richer query capabilities to bd list","description":"Current bd list filters are limited to basic field matching (status, priority, type, assignee, label). This forces users to resort to piping through jq for common queries.\n\nMissing query capabilities:\n- Pattern matching: --title-contains, --desc-contains\n- Date ranges: --created-after, --updated-before, --closed-after\n- Empty/null checks: --empty-description, --no-assignee, --no-labels\n- Numeric ranges: --priority-min, --priority-max\n- Complex boolean logic: --and, --or operators\n- Full-text search: --search across all text fields\n- Negation: --not-status, --exclude-label\n\nExample use cases:\n- Find issues with empty descriptions\n- Find stale issues not updated in 30 days\n- Find high-priority bugs with no assignee\n- Search for keyword across title/description/notes\n\nImplementation approach:\n- Add query builder pattern to storage layer\n- Support --query DSL for complex queries\n- Keep simple flags for common cases\n- Add --json output for programmatic use","notes":"## Progress Update\n\n**Completed:**\n- βœ… Extended IssueFilter struct with new fields (pattern matching, date ranges, empty/null checks, priority ranges)\n- βœ… Updated SQLite SearchIssues implementation \n- βœ… Added CLI flags to list.go\n- βœ… Added parseTimeFlag helper\n- βœ… Comprehensive tests added - all passing\n\n**Remaining:**\n- ⚠️ RPC layer needs updating (internal/rpc/protocol.go ListArgs)\n- ⚠️ Daemon handler needs to forward new filters\n- ⚠️ End-to-end testing with daemon mode\n- πŸ“ Documentation updates\n\n**Files Modified:**\n- internal/types/types.go\n- internal/storage/sqlite/sqlite.go \n- cmd/bd/list.go\n- cmd/bd/list_test.go\n\n**Next Steps:**\n1. Update RPC protocol\n2. Update daemon handler \n3. Test with daemon mode\n4. Update docs","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-05T00:17:48.677493-08:00","updated_at":"2025-11-05T00:33:38.998433-08:00","closed_at":"2025-11-05T00:33:38.998433-08:00","source_repo":"."} -{"id":"bd-o4qy","content_hash":"28304d9e414cbc475b89dc2d1474f110d8f9d90d50fdbdca8f15961db540806b","title":"Improve CheckStaleness error handling","description":"## Problem\n\nCheckStaleness returns 'false' (not stale) for multiple error conditions instead of returning errors. This masks problems.\n\n**Location:** internal/autoimport/autoimport.go:253-285\n\n## Edge Cases That Return False\n\n1. **Invalid last_import_time format** (line 259-262)\n2. **No JSONL file found** (line 267-277) \n3. **JSONL stat fails** (line 279-282)\n\n## Fix\n\nReturn errors for abnormal conditions:\n\n```go\nlastImportTime, err := time.Parse(time.RFC3339, lastImportStr)\nif err != nil {\n return false, fmt.Errorf(\"corrupted last_import_time: %w\", err)\n}\n\nif jsonlPath == \"\" {\n return false, fmt.Errorf(\"no JSONL file found\")\n}\n\nstat, err := os.Stat(jsonlPath)\nif err != nil {\n return false, fmt.Errorf(\"cannot stat JSONL: %w\", err)\n}\n```\n\n## Impact\nMedium - edge cases are rare but should be handled\n\n## Effort \n30 minutes - requires updating callers in RPC server","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:17:27.606219-05:00","updated_at":"2025-11-20T20:17:27.606219-05:00","source_repo":".","dependencies":[{"issue_id":"bd-o4qy","depends_on_id":"bd-2q6d","type":"blocks","created_at":"2025-11-20T20:18:26.81065-05:00","created_by":"stevey"}]} -{"id":"bd-o78","content_hash":"0d61c7a8e687c16c262db4ba4e6c7f63861fbeb524ec014000c68a0552df7965","title":"Enhance `bd doctor` to verify Claude Code integration","description":"Add checks to `bd doctor` that verify Claude Code integration is properly set up when .claude/ directory or Claude environment is detected.","design":"## Checks to Add\n\n### 1. Claude Environment Detection\n```go\nif isClaudeDetected() {\n fmt.Println(\"βœ“ Claude Code environment detected\")\n \n // Check what's installed\n hasMCP := isMCPServerInstalled()\n hasHooks := isClaudeSetupComplete()\n \n if hasMCP \u0026\u0026 hasHooks {\n fmt.Println(\"βœ“ MCP server installed\")\n fmt.Println(\"βœ“ Claude hooks installed (provides workflow reminders)\")\n } else if !hasMCP \u0026\u0026 hasHooks {\n fmt.Println(\"βœ“ Claude hooks installed (provides CLI reference)\")\n fmt.Println(\" Note: MCP server not detected (using CLI mode)\")\n } else if hasMCP \u0026\u0026 !hasHooks {\n fmt.Println(\"βœ“ MCP server installed\")\n fmt.Println(\"⚠ Claude hooks not installed\")\n fmt.Println(\" Hooks prevent agent from forgetting bd workflow after compaction\")\n fmt.Println(\" Run: bd setup claude\")\n } else {\n fmt.Println(\"⚠ Claude integration not set up\")\n fmt.Println(\" Run: bd setup claude\")\n // TODO (future): Recommend CLI approach once proven in production\n // fmt.Println(\" Tip: CLI mode (without MCP) uses fewer tokens\")\n }\n}\n\nfunc isMCPServerInstalled() bool {\n // Check ~/.claude/settings.json for beads MCP server\n home, _ := os.UserHomeDir()\n settingsPath := filepath.Join(home, \".claude/settings.json\")\n \n data, err := os.ReadFile(settingsPath)\n if err != nil {\n return false\n }\n \n var settings map[string]interface{}\n if err := json.Unmarshal(data, \u0026settings); err != nil {\n return false\n }\n \n // Check mcpServers section for beads\n mcpServers, ok := settings[\"mcpServers\"].(map[string]interface{})\n if !ok {\n return false\n }\n \n // Look for beads server (any key containing \"beads\")\n for key := range mcpServers {\n if strings.Contains(strings.ToLower(key), \"beads\") {\n return true\n }\n }\n \n return false\n}\n```\n\n### 2. Hook Installation Verification (MCP-Aware)\n\n```go\nfunc checkClaudeHooks() {\n home, _ := os.UserHomeDir()\n globalSettings := filepath.Join(home, \".claude/settings.json\")\n projectSettings := \".claude/settings.local.json\"\n \n globalHooks := hasBeadsHooks(globalSettings)\n projectHooks := hasBeadsHooks(projectSettings)\n \n if globalHooks {\n fmt.Println(\"βœ“ Global hooks installed\")\n } else if projectHooks {\n fmt.Println(\"βœ“ Project hooks installed\")\n } else {\n fmt.Println(\"⚠ No hooks installed\")\n fmt.Println(\" Run: bd setup claude\")\n return\n }\n \n // Check if hooks will work\n if !commandExists(\"bd\") {\n fmt.Println(\"⚠ 'bd' command not in PATH\")\n fmt.Println(\" Hooks won't work - ensure bd is installed globally\")\n }\n}\n\nfunc hasBeadsHooks(settingsPath string) bool {\n data, err := os.ReadFile(settingsPath)\n if err != nil {\n return false\n }\n \n var settings map[string]interface{}\n if err := json.Unmarshal(data, \u0026settings); err != nil {\n return false\n }\n \n hooks, ok := settings[\"hooks\"].(map[string]interface{})\n if !ok {\n return false\n }\n \n // Check SessionStart and PreCompact for \"bd prime\"\n for _, event := range []string{\"SessionStart\", \"PreCompact\"} {\n eventHooks, ok := hooks[event].([]interface{})\n if !ok {\n continue\n }\n \n for _, hook := range eventHooks {\n hookMap, _ := hook.(map[string]interface{})\n commands, _ := hookMap[\"hooks\"].([]interface{})\n for _, cmd := range commands {\n cmdMap, _ := cmd.(map[string]interface{})\n if cmdMap[\"command\"] == \"bd prime\" {\n return true\n }\n }\n }\n }\n \n return false\n}\n```\n\n### 3. AGENTS.md/CLAUDE.md Reference Check\n```go\n// Check if documentation references bd prime\nagentsContent := readFileIfExists(\"AGENTS.md\")\nclaudeContent := readFileIfExists(\"CLAUDE.md\")\n\nif strings.Contains(agentsContent, \"bd prime\") || strings.Contains(claudeContent, \"bd prime\") {\n // Verify bd prime command exists in current version\n if !commandExists(\"prime\") {\n fmt.Println(\"⚠ Documentation references 'bd prime' but command not found\")\n fmt.Println(\" Upgrade bd or remove references\")\n } else {\n fmt.Println(\"βœ“ Documentation references match installed features\")\n }\n}\n```\n\n### 4. Context Priming Test\n```go\n// Verify bd prime actually works\ncmd := exec.Command(\"bd\", \"prime\")\noutput, err := cmd.CombinedOutput()\n\nif err != nil {\n fmt.Println(\"⚠ 'bd prime' failed to execute\")\n fmt.Println(\" Error:\", err)\n} else if len(output) == 0 {\n fmt.Println(\"⚠ 'bd prime' produced no output\")\n fmt.Println(\" Expected workflow context markdown\")\n} else {\n // Check if output adapts to MCP mode\n hasMCP := isMCPServerInstalled()\n outputStr := string(output)\n \n if hasMCP \u0026\u0026 strings.Contains(outputStr, \"mcp__plugin_beads_beads__\") {\n fmt.Println(\"βœ“ bd prime detected MCP mode (workflow reminders)\")\n } else if !hasMCP \u0026\u0026 strings.Contains(outputStr, \"bd ready\") {\n fmt.Println(\"βœ“ bd prime using CLI mode (full command reference)\")\n } else {\n fmt.Println(\"⚠ bd prime output may not be adapting to environment\")\n }\n}\n```\n\n## Output Format Examples\n\n### With MCP and Hooks\n```\nbd doctor\n\nDatabase:\nβœ“ Database found at .beads/beads.db\nβœ“ Git hooks installed\n\nClaude Code Integration:\nβœ“ Claude Code environment detected\nβœ“ MCP server installed\nβœ“ Claude hooks installed (provides workflow reminders)\nβœ“ bd prime detected MCP mode (workflow reminders)\nβœ“ Documentation references match installed features\n\nSync Status:\nβœ“ No sync issues detected\n```\n\n### Without MCP, With Hooks\n```\nbd doctor\n\nDatabase:\nβœ“ Database found at .beads/beads.db\nβœ“ Git hooks installed\n\nClaude Code Integration:\nβœ“ Claude Code environment detected\nβœ“ Claude hooks installed (provides CLI reference)\n Note: MCP server not detected (using CLI mode)\nβœ“ bd prime using CLI mode (full command reference)\n\nSync Status:\nβœ“ No sync issues detected\n```\n\n### No Integration\n```\nbd doctor\n\nDatabase:\nβœ“ Database found at .beads/beads.db\nβœ“ Git hooks installed\n\nClaude Code Integration:\nβœ“ Claude Code environment detected\n⚠ Claude integration not set up\n Run: bd setup claude\n\nSync Status:\nβœ“ No sync issues detected\n```\n\n## Future Enhancement (Post-Production Validation)\n\nOnce CLI mode is proven in production, add recommendation:\n\n```go\nif isClaudeDetected() \u0026\u0026 !hasMCP \u0026\u0026 !hasHooks {\n fmt.Println(\"⚠ Claude integration not set up\")\n fmt.Println(\" Run: bd setup claude\")\n fmt.Println(\" Tip: CLI mode (without MCP) uses fewer tokens than MCP server\")\n fmt.Println(\" Both approaches work equally well - choose based on preference\")\n}\n```\n\nThis recommendation should only be added after CLI mode with `bd prime` is validated in real-world usage.","acceptance_criteria":"- bd doctor checks for Claude environment\n- Verifies hook installation if .claude/ exists\n- Checks AGENTS.md/CLAUDE.md for bd prime references\n- Detects version mismatches between docs and installed bd\n- Provides actionable suggestions (bd setup claude, upgrade)\n- Tests cover detection logic","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-11T23:30:05.782406-08:00","updated_at":"2025-11-12T00:12:07.717579-08:00","source_repo":".","dependencies":[{"issue_id":"bd-o78","depends_on_id":"bd-rpn","type":"blocks","created_at":"2025-11-11T23:30:05.783234-08:00","created_by":"daemon"},{"issue_id":"bd-o78","depends_on_id":"bd-br8","type":"blocks","created_at":"2025-11-11T23:30:05.783647-08:00","created_by":"daemon"},{"issue_id":"bd-o78","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:27.886095-08:00","created_by":"daemon"}]} -{"id":"bd-obxt","content_hash":"7e57a01427663290ada787e0f45cf0df28208ed6cda632e9caf2bdb7e9bb077a","title":"Fix bd doctor to recommend issues.jsonl as canonical (not beads.jsonl)","description":"","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T23:27:02.008716-08:00","updated_at":"2025-11-21T23:44:06.081448-08:00","closed_at":"2025-11-21T23:44:06.081448-08:00","source_repo":"."} -{"id":"bd-oif6","content_hash":"5732dcbfd354e39ae9249cbae70f08ec1ccf026a812129519dfda5a8588e5ad1","title":"Vendor beads-merge Go code into internal/merge/","description":"Copy beads-merge source code from @neongreen's repo into bd codebase.\n\n**Tasks**:\n- Create `internal/merge/` package\n- Copy merge algorithm code\n- Add attribution header to all files\n- Update imports to use bd's internal types\n- Add LICENSE/ATTRIBUTION file crediting @neongreen\n- Keep original algorithm intact\n\n**Source**: https://github.com/neongreen/mono/tree/main/beads-merge","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.405283-08:00","updated_at":"2025-11-05T18:52:53.71713-08:00","closed_at":"2025-11-05T18:52:53.71713-08:00","source_repo":".","dependencies":[{"issue_id":"bd-oif6","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.69196-08:00","created_by":"daemon"}]} -{"id":"bd-ola6","content_hash":"79461888e8a7875bf3623b8db44ea004f73a2374daa52ae9cb3fc9d3ce5e6a8b","title":"Implement transaction retry logic for SQLITE_BUSY","description":"BEGIN IMMEDIATE fails immediately on SQLITE_BUSY instead of retrying with exponential backoff.\n\nLocation: internal/storage/sqlite/sqlite.go:223-225\n\nProblem:\n- Under concurrent write load, BEGIN IMMEDIATE can fail with SQLITE_BUSY\n- Current implementation fails immediately instead of retrying\n- Results in spurious failures under normal concurrent usage\n\nSolution: Implement exponential backoff retry:\n- Retry up to N times (e.g., 5)\n- Backoff: 10ms, 20ms, 40ms, 80ms, 160ms\n- Check for context cancellation between retries\n- Only retry on SQLITE_BUSY/database locked errors\n\nImpact: Spurious failures under concurrent write load\n\nEffort: 3 hours","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-16T14:51:31.247147-08:00","updated_at":"2025-11-16T14:51:31.247147-08:00","source_repo":"."} -{"id":"bd-omx1","content_hash":"e61d74adb03fc8275c97242df8ce0e4146db7e49271e4e86c3379b4a3fbab0d8","title":"Add `bd merge` command wrapping 3-way merge logic","description":"Implement CLI command to invoke beads-merge functionality.\n\n**Interface**:\n```bash\nbd merge \u003coutput\u003e \u003cbase\u003e \u003cleft\u003e \u003cright\u003e\nbd merge --debug \u003coutput\u003e \u003cbase\u003e \u003cleft\u003e \u003cright\u003e\n```\n\n**Behavior**:\n- Exit code 0 on clean merge\n- Exit code 1 if conflicts (write conflict markers)\n- Support --debug flag for verbose output\n- Match beads-merge's existing behavior\n\n**File**: `cmd/bd/merge.go`","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.427429-08:00","updated_at":"2025-11-05T19:01:29.071365-08:00","closed_at":"2025-11-05T19:01:29.071365-08:00","source_repo":".","dependencies":[{"issue_id":"bd-omx1","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.709123-08:00","created_by":"daemon"},{"issue_id":"bd-omx1","depends_on_id":"bd-oif6","type":"blocks","created_at":"2025-11-05T18:42:35.436444-08:00","created_by":"daemon"}]} -{"id":"bd-p0zr","content_hash":"5e518ce89ce35cb4b5b534b8c1287679b7984bc73f7c6747773962277d2ad1bc","title":"bd message: Improve type safety with typed parameter structs","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T12:54:29.675678-08:00","updated_at":"2025-11-08T12:58:59.559643-08:00","closed_at":"2025-11-08T12:58:59.559643-08:00","source_repo":".","dependencies":[{"issue_id":"bd-p0zr","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:55.058354-08:00","created_by":"daemon"}]} -{"id":"bd-p3b0","content_hash":"dfac8bfc32127d687aef5524f255f7e7f48e7b78f61d46f15db3221b8f8ab14b","title":"Code review bd-loka implementation","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T17:10:11.237786-08:00","updated_at":"2025-11-23T17:16:12.294528-08:00","closed_at":"2025-11-23T17:16:12.294528-08:00","source_repo":"."} -{"id":"bd-p3b0.1","content_hash":"70dba1732c2fed32f91b405634ed91e312219679e2aa788eb8a187fa60e241a2","title":"Fix variable shadowing in upgradeAckCmd","description":"","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-23T17:12:26.745382-08:00","updated_at":"2025-11-23T17:12:57.792344-08:00","closed_at":"2025-11-23T17:12:57.792344-08:00","source_repo":".","dependencies":[{"issue_id":"bd-p3b0.1","depends_on_id":"bd-p3b0","type":"parent-child","created_at":"2025-11-23T17:12:26.74595-08:00","created_by":"daemon"}]} -{"id":"bd-p3b0.2","content_hash":"23a1a7553b7f939212c411098ec3928e1dea09763f8a2b94197a594176dfc5fb","title":"Fix inconsistent version comparison logic in trackBdVersion","description":"","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-23T17:12:27.953105-08:00","updated_at":"2025-11-23T17:13:28.241231-08:00","closed_at":"2025-11-23T17:13:28.241231-08:00","source_repo":".","dependencies":[{"issue_id":"bd-p3b0.2","depends_on_id":"bd-p3b0","type":"parent-child","created_at":"2025-11-23T17:12:27.953605-08:00","created_by":"daemon"}]} -{"id":"bd-p3b0.3","content_hash":"1cd437a5a1e238c10d9f98c7816bf8402e19e9af0ec94377ea14a6e34894d9b6","title":"Add unit tests for version tracking functions","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T17:12:29.267781-08:00","updated_at":"2025-11-23T17:16:10.649443-08:00","closed_at":"2025-11-23T17:16:10.649443-08:00","source_repo":".","dependencies":[{"issue_id":"bd-p3b0.3","depends_on_id":"bd-p3b0","type":"parent-child","created_at":"2025-11-23T17:12:29.268313-08:00","created_by":"daemon"}]} -{"id":"bd-p65x","content_hash":"9fb7f74dbd1c92d47ff34bae3a58b9a4b97643a065cc07e3f76d20537f93be91","title":"Latency test 1","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T12:09:09.267424-05:00","updated_at":"2025-11-20T12:09:09.267424-05:00","closed_at":"2025-11-08T00:06:46.198388-08:00","source_repo":"."} -{"id":"bd-p68x","content_hash":"2adc58598da8443025691815c351057400ddaa6fa6f0121f1dbb85af58d8d6e8","title":"Create examples for common workflows","description":"Add examples/ subdirectories: OSS contributor workflow, team branch workflow, multi-phase development, multiple personas (architect/implementer). Each with README and sample configs.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:04:30.128257-08:00","updated_at":"2025-11-05T19:27:33.07555-08:00","closed_at":"2025-11-05T19:08:39.035904-08:00","source_repo":".","dependencies":[{"issue_id":"bd-p68x","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.247515-08:00","created_by":"daemon"}]} -{"id":"bd-p6vp","content_hash":"1df6d3b9b438cdcdbc618c24fea48769c1f22e8a8701af4e742531d4433ca7ea","title":"Clarify .beads/.gitattributes handling in Protected Branches docs","description":"Protected Branches docs quick start leaves untracked `.beads` directory and `.gitattributes`.\nQuestion: Are these changes meant to be checked into the protected branch?\nNeed to clarify if these should be ignored or committed, or if the instructions are missing a step.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:56:25.79407-05:00","updated_at":"2025-11-20T18:56:25.79407-05:00","source_repo":"."} -{"id":"bd-pdjb","content_hash":"ac30f03839ef20d09a5a6c4915b8046b270ebdb564c1ee7511edc72128cd8fa0","title":"Testing \u0026 Validation","description":"Ensure reliability through comprehensive testing.","notes":"Completed comprehensive Agent Mail test coverage analysis and implementation.\n\n**Test Coverage Summary:**\n- 66 total tests across 5 files\n- 51 unit tests for HTTP adapter (0.02s)\n- 15 integration tests for multi-agent scenarios (~55s total)\n\n**New Tests Added:**\nCreated `test_multi_agent_coordination.py` (4 tests, 11s) covering:\n1. Fairness: 10 agents competing for 5 issues β†’ exactly 1 claim per issue\n2. Notifications: End-to-end message delivery between agents\n3. Handoff: Clean reservation transfer from agent1 to agent2\n4. Idempotency: Double reserve/release by same agent\n\n**Coverage Quality:**\nβœ… Collision prevention (race conditions)\nβœ… Graceful degradation (7 failure modes)\nβœ… TTL/expiration behavior\nβœ… Multi-agent coordination\nβœ… JSONL consistency\nβœ… HTTP error handling\nβœ… Authorization and configuration\n\n**Intentionally Skipped:**\n- Path traversal (validated elsewhere)\n- Retry policies (nice-to-have)\n- HTTPS/TLS (out of scope)\n- Slow tests (50+ agents, soak tests)\n\nSee `tests/integration/AGENT_MAIL_TEST_COVERAGE.md` for details.\n\nAll tests pass. Agent Mail integration is well-tested and reliable for multi-agent scenarios.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-07T22:43:00.457985-08:00","updated_at":"2025-11-08T03:09:48.253758-08:00","closed_at":"2025-11-08T02:47:34.153586-08:00","source_repo":".","dependencies":[{"issue_id":"bd-pdjb","depends_on_id":"bd-wfmw","type":"blocks","created_at":"2025-11-07T22:43:00.459403-08:00","created_by":"daemon"}]} -{"id":"bd-pdwz","content_hash":"5c35a877ec5fa3af14a45a920764e7a4c289f93c427a479da7b335c068195af0","title":"Add t.Parallel() to slow hash multiclone tests","description":"Add t.Parallel() to TestHashIDs_MultiCloneConverge and TestHashIDs_IdenticalContentDedup so they run concurrently.\n\nExpected savings: ~10 seconds (from 20s to ~11s)\n\nImplementation:\n- Add t.Parallel() call at start of each test function\n- Verify tests don't share resources that would cause conflicts\n- Run tests to confirm they work in parallel\n\nFile: beads_hash_multiclone_test.go:34, :101","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T01:24:15.705228-08:00","updated_at":"2025-11-04T09:52:31.945545-08:00","closed_at":"2025-11-04T09:52:31.945545-08:00","source_repo":".","dependencies":[{"issue_id":"bd-pdwz","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:15.706149-08:00","created_by":"daemon"}]} -{"id":"bd-pi7u","content_hash":"8541369e5e54e5a380a11734ee9819832f5704182cb931b92d66445f3a4d4d14","title":"Fix TestAddCommentUpdatesTimestamp timing flake on Windows","description":"The TestAddCommentUpdatesTimestamp test fails on Windows due to insufficient time resolution between creating an issue and adding a comment. The test expects updated_at to be strictly after the original timestamp, but on Windows both operations can complete within the same time unit, causing them to have identical timestamps.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-23T10:56:40.575897-08:00","updated_at":"2025-11-23T10:57:20.956211-08:00","closed_at":"2025-11-23T10:57:20.956211-08:00","source_repo":"."} -{"id":"bd-pmuu","content_hash":"5e55fb75f647ecdcf928497d05c0263a5db7baf1d1d47e8b4074ca02766672ba","title":"Create architecture decision record (ADR)","description":"Document why we chose Agent Mail, alternatives considered, and tradeoffs.\n\nAcceptance Criteria:\n- Problem statement (git traffic, no locks)\n- Alternatives considered (custom RPC, Redis, etc.)\n- Why Agent Mail fits Beads\n- Integration principles (optional, graceful degradation)\n- Future considerations\n\nFile: docs/adr/002-agent-mail-integration.md","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T22:42:51.420203-08:00","updated_at":"2025-11-08T00:06:01.816892-08:00","closed_at":"2025-11-08T00:06:01.816892-08:00","source_repo":".","dependencies":[{"issue_id":"bd-pmuu","depends_on_id":"bd-spmx","type":"parent-child","created_at":"2025-11-08T00:02:47.93119-08:00","created_by":"daemon"}]} -{"id":"bd-poh9","content_hash":"a8cb703915a08abe2c2123e49a46d768e5a6aefee0ab7c4d9174749d538cfa56","title":"Complete and commit beads-mcp type safety improvements","description":"Uncommitted type safety work in beads-mcp needs review and completion","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:23:32.8516-05:00","updated_at":"2025-11-20T19:27:00.88849-05:00","closed_at":"2025-11-20T19:27:00.88849-05:00","source_repo":"."} -{"id":"bd-q13h","content_hash":"ad443aa59b317e5900e1c0e3a083d693c699c44f8582a6bfdf6c0d93f909e40c","title":"Makefile Integration for Benchmarks","description":"Add a single 'bench' target to the Makefile for running performance benchmarks.\n\nTarget:\n.PHONY: bench\n\nbench:\n\tgo test -bench=. -benchtime=3s -tags=bench \\\n\t\t-cpuprofile=cpu.prof -memprofile=mem.prof \\\n\t\t./internal/storage/sqlite/\n\t@echo \"\"\n\t@echo \"Profiles generated. View flamegraph:\"\n\t@echo \" go tool pprof -http=:8080 cpu.prof\"\n\nFeatures:\n- Single simple target, no complexity\n- Always generates CPU and memory profiles\n- Clear output on how to view results\n- 3 second benchmark time for reliable results\n- Uses bench build tag for heavy benchmarks\n\nUsage:\n make bench # Run all benchmarks\n go test -bench=BenchmarkGetReadyWork... # Run specific benchmark","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-13T22:23:25.922916-08:00","updated_at":"2025-11-14T08:55:17.620824-08:00","closed_at":"2025-11-14T08:55:17.620824-08:00","source_repo":".","dependencies":[{"issue_id":"bd-q13h","depends_on_id":"bd-zj8e","type":"blocks","created_at":"2025-11-13T22:24:06.371947-08:00","created_by":"daemon"}]} -{"id":"bd-q2ri","content_hash":"472cf1c393423f4ec4a4e74a971be0f44fd4b8186ea276860fe0947d031e3eb1","title":"bd-hv01: Add comprehensive edge case tests for deletion tracking","description":"Need to add tests for: corrupted snapshot file, stale snapshot (\u003e 1 hour), concurrent sync operations (daemon + manual), partial deletion failure, empty remote JSONL, multi-repo mode with deletions, git worktree scenario.\n\nAlso refine TestDeletionWithLocalModification to check for specific conflict error instead of accepting any error.\n\nFiles: cmd/bd/deletion_tracking_test.go","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T18:16:26.849881-08:00","updated_at":"2025-11-06T20:06:49.221043-08:00","closed_at":"2025-11-06T19:55:39.700695-08:00","source_repo":".","dependencies":[{"issue_id":"bd-q2ri","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.104113-08:00","created_by":"daemon"}]} -{"id":"bd-q59i","content_hash":"807970859370452e8892779759b15ba2f52740d8d38ad1c1f8f47a364c898cc3","title":"User Diagnostics (bd doctor --perf)","description":"Extend cmd/bd/doctor.go to add --perf flag for user performance diagnostics.\n\nFunctionality:\n- Add --perf flag to existing bd doctor command\n- Collect system info (OS, arch, Go version, SQLite version)\n- Collect database stats (size, issue counts, dependency counts)\n- Time key operations on user's actual database:\n * bd ready\n * bd list --status=open\n * bd show \u003crandom-issue\u003e\n * bd create (with rollback)\n * Search with filters\n- Generate CPU profile automatically (timestamped filename)\n- Output simple report with platform info, timings, profile location\n\nOutput example:\n Beads Performance Diagnostics\n Platform: darwin/arm64\n Database: 8,234 issues (4,123 open)\n \n Operation Performance:\n bd ready 42ms\n bd list --status=open 15ms\n \n Profile saved: beads-perf-2025-11-13.prof\n View: go tool pprof -http=:8080 beads-perf-2025-11-13.prof\n\nImplementation:\n- Extend cmd/bd/doctor.go (~100 lines)\n- Use runtime/pprof for CPU profiling\n- Use time.Now()/time.Since() for timing\n- Rollback test operations (don't modify user's database)","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:23:11.988562-08:00","updated_at":"2025-11-13T22:45:57.26294-08:00","closed_at":"2025-11-13T22:45:57.26294-08:00","source_repo":".","dependencies":[{"issue_id":"bd-q59i","depends_on_id":"bd-zj8e","type":"blocks","created_at":"2025-11-13T22:24:06.336236-08:00","created_by":"daemon"}]} -{"id":"bd-q652","content_hash":"d106ac81413dae0b983c13d405a419c5c3f9c6009668a642d0a115aa43524235","title":"Database pollution in ~/src/dave/vc: 895 issues vs canonical 310","description":"~/src/dave/vc/.beads/beads.db has 895 total issues (675 open, 149 closed), but canonical ~/src/vc/.beads/vc.db has only 310 issues (230 open). This is 585 extra issues - likely pollution from other repositories.\n\nNeed to:\n1. Identify which issues are polluted (use detect-pollution)\n2. Compare issue IDs between dave/vc and canonical vc databases\n3. Determine pollution source (beads repo? other repos?)\n4. Clean up polluted database\n5. Root cause: why did pollution occur?","notes":"Investigation findings so far:\n- Polluted DB (~/src/dave/vc/.beads/beads.db): 241 issues (180 open, 43 closed)\n- Canonical DB (~/src/vc/.beads/vc.db): 310 issues (230 open, 62 closed)\n- Contradiction: Polluted has FEWER issues, not more (241 \u003c 310, diff of 69)\n- Only 1 unique ID in polluted: vc-55fi\n- All source_repo fields are set to \".\" in both databases\n- Issue description claims 895 issues in polluted vs 310 canonical - numbers don't match current state\n- Possible: Pollution was already partially cleaned, or issue description refers to different database?","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T00:07:37.999168-08:00","updated_at":"2025-11-07T00:13:32.179396-08:00","closed_at":"2025-11-07T00:13:32.179396-08:00","source_repo":"."} -{"id":"bd-qhws","content_hash":"8bc709fe88d2b880e7ffa946e4c957d5c0494c8f198bc51b7fe0543a99b30947","title":"Configure database connection pool limits for daemon mode","description":"Database connection pool not configured for file-based databases when running in daemon mode.\n\nLocation: internal/storage/sqlite/sqlite.go:108-116\n\nProblem:\n- Daemon is a long-running server handling concurrent RPC requests\n- Multiple CLI commands hit same daemon simultaneously \n- Go default: unlimited connections (MaxOpenConns=0)\n- SQLite IMMEDIATE transactions serialize on write lock\n- Can have 100+ goroutines blocked waiting, each holding connection\n- Results in connection exhaustion and 'database is locked' errors\n\nCurrent code only limits in-memory DBs:\nif isInMemory {\n db.SetMaxOpenConns(1)\n db.SetMaxIdleConns(1)\n}\n// File DBs: UNLIMITED connections!\n\nFix:\nif !isInMemory {\n maxConns := runtime.NumCPU() + 1 // 1 writer + N readers\n db.SetMaxOpenConns(maxConns)\n db.SetMaxIdleConns(2)\n db.SetConnMaxLifetime(0)\n}\n\nImpact: 'database is locked' errors under concurrent load in daemon mode\n\nNote: NOT an issue for direct CLI usage (each process isolated). Only affects daemon mode where multiple CLI commands share one database pool.\n\nEffort: 1 hour","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:51:24.579345-08:00","updated_at":"2025-11-16T15:04:00.450911-08:00","closed_at":"2025-11-16T15:04:00.450911-08:00","source_repo":"."} -{"id":"bd-qq2i","content_hash":"9e1e4ce5774fa61cdcd093805f0475bc54b39ced9672e81c9fea781441de2ef2","title":"Add 'bd message send' command for Agent Mail messaging","description":"Agent Mail server supports messaging between agents, but bd CLI only uses it for file reservations. Add commands for inter-agent messaging.\n\n## Background\n- Agent Mail server running at http://127.0.0.1:8765\n- 12 workspaces configured across 3 channels (beads.dev, vc.dev, wyvern.dev)\n- Current integration: file reservations only\n- Gap: no way to send messages from bd CLI\n\n## Proposed Commands\n\n```bash\n# Send message to another agent\nbd message send \u003cto-agent\u003e \u003cmessage\u003e [options]\n --subject \u003csubject\u003e\n --thread-id \u003cthread-id\u003e # Optional - group related messages\n --project-id \u003cproject\u003e # Defaults to BEADS_PROJECT_ID\n\n# List inbox messages\nbd message inbox [options]\n --limit \u003cN\u003e\n --unread-only\n\n# Read specific message\nbd message read \u003cmessage-id\u003e\n\n# Mark message as acknowledged\nbd message ack \u003cmessage-id\u003e\n```\n\n## Example Usage\n\n```bash\n# Send message to agent in same channel\nbd message send cino-beads-stevey-macbook \"Working on bd-z0yn, need your review\" \\\n --subject \"Review request\" \\\n --thread-id bd-z0yn\n\n# Check inbox\nbd message inbox --unread-only\n\n# Read and acknowledge\nbd message read msg-abc123\nbd message ack msg-abc123\n```\n\n## Design Notes\n- Use same env vars (BEADS_AGENT_MAIL_URL, BEADS_AGENT_NAME, BEADS_PROJECT_ID)\n- Graceful degradation if Agent Mail unavailable\n- JSON output support for all commands\n- Consider integrating with bd update/close (auto-notify on status changes)\n\n## References\n- Agent Mail README: ~/src/mcp_agent_mail/README.md\n- Beads integration docs: docs/AGENT_MAIL.md","notes":"## Implementation Summary\n\nAdded four new commands to bd CLI for Agent Mail messaging:\n\n1. `bd message send \u003cto-agent\u003e \u003cmessage\u003e` - Send messages to other agents\n - Flags: --subject, --thread-id, --importance, --ack-required\n - Supports markdown content\n - Thread conversations by issue ID\n\n2. `bd message inbox` - List inbox messages\n - Flags: --limit, --unread-only, --urgent-only, --json\n - Shows subject, sender, age, importance\n - Highlights unread and ACK-required messages\n\n3. `bd message read \u003cmessage-id\u003e` - Read and mark message as read\n - Automatically marks message as read\n - Shows message content\n\n4. `bd message ack \u003cmessage-id\u003e` - Acknowledge a message\n - Marks message as acknowledged\n - Also marks as read if not already\n\n## Implementation Details\n\n- Uses JSON-RPC over HTTP to communicate with Agent Mail server\n- Configuration via environment variables (BEADS_AGENT_MAIL_URL, BEADS_AGENT_NAME, BEADS_PROJECT_ID)\n- Graceful error messages when Agent Mail not configured\n- Full JSON output support for programmatic use\n- Follows same patterns as existing bd commands\n\n## Documentation\n\nUpdated:\n- docs/AGENT_MAIL.md - Added \"Messaging Commands\" section with examples and best practices\n- README.md - Added \"Messaging (Agent Mail)\" section in Usage\n\n## Testing\n\n- Compiles successfully\n- Help output works correctly\n- Ready for integration testing with Agent Mail server","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-08T12:44:03.547806-08:00","updated_at":"2025-11-08T12:49:02.436927-08:00","closed_at":"2025-11-08T12:49:02.436927-08:00","source_repo":"."} -{"id":"bd-qqvw","content_hash":"745b79db79433a49b763685e52e45f7083e49e26ca4dc4e82d16848a09ca1817","title":"Vendor and integrate beads-merge tool","description":"Incorporate @neongreen's beads-merge 3-way merge tool into bd to solve:\n- Multi-workspace deletion sync (bd-hv01)\n- Git merge conflicts in JSONL\n- Field-level intelligent merging\n\n**Repository**: https://github.com/neongreen/mono/tree/main/beads-merge\n\n**Integration approach**: Vendor the Go code with attribution, pending @neongreen's approval (GitHub issue #240)\n\n**Benefits**:\n- Prevents deletion resurrection bug\n- Smart dependency merging (union + dedup)\n- Timestamp handling (max wins)\n- Detects deleted-vs-modified conflicts\n- Works as git merge driver\n\n**Acceptance criteria**:\n- beads-merge code vendored into bd codebase\n- Available as `bd merge` command\n- Git merge driver setup during `bd init`\n- Tests verify 3-way merge logic\n- Documentation updated\n- @neongreen credited","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-05T18:41:59.500359-08:00","updated_at":"2025-11-06T18:19:16.234208-08:00","closed_at":"2025-11-06T15:40:24.796921-08:00","source_repo":"."} -{"id":"bd-qs4p","content_hash":"46a4cf3491c85c38d7bf9e3ffc260c939d76e471d9dae41785de197269e3c05c","title":"bd import fails on duplicate external_ref with no resolution options","description":"When JSONL contains duplicate external_ref values (e.g., two issues both have external_ref='BS-170'), bd import fails entirely with no resolution options.\n\nUser must manually edit JSONL to remove duplicates, which is error-prone.\n\nExample error:\n```\nbatch import contains duplicate external_ref values:\nexternal_ref 'BS-170' appears in issues: [opal-39 opal-43]\n```\n\nShould handle this similar to duplicate issue detection - offer to merge, pick one, or clear duplicates.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T10:53:41.906165-08:00","updated_at":"2025-11-06T11:03:16.975041-08:00","closed_at":"2025-11-06T11:03:16.975041-08:00","source_repo":"."} -{"id":"bd-r1pf","content_hash":"aa28faaa7538a6f1691a5dbc3f5136c2f446c7a16836ee0b572d8fe3e86adcff","title":"Test label","description":"","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-06T20:16:20.609492-08:00","updated_at":"2025-11-06T20:16:34.973855-08:00","closed_at":"2025-11-06T20:16:34.973855-08:00","source_repo":".","labels":[""," urgent "," bug "," critical "]} -{"id":"bd-r46","content_hash":"31d26e3081c31f4e8813fc1287c3bb7b2e87763eccc24b930a763c380e8433ab","title":"Support --reason flag in daemon mode for reopen command","description":"The reopen.go command has a TODO at line 61 to add reason as a comment once RPC supports AddComment. Currently --reason flag is ignored in daemon mode with a warning.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-21T18:55:10.773626-05:00","updated_at":"2025-11-21T18:55:10.773626-05:00","source_repo":"."} -{"id":"bd-r79z","content_hash":"2972e60ecf73426a5349415689e57a2404800ee61468ed6d295ab7d4b2c5c7e0","title":"GH#245: Windows MCP subprocess timeout for git rev-parse","description":"User reports git detection timing out on Windows in MCP server, but CLI works fine.\n\nPath: C:\\Users\\chris\\Documents\\DEV_R\\quarto-cli\nError: Git repository detection timed out after 5s\nWorks fine in CLI: `git rev-parse --show-toplevel` succeeds\n\nHypothesis: subprocess.run() with asyncio.to_thread() may have Windows-specific issues or the MCP runtime environment may not have proper PATH/git access.\n\nPotential fixes:\n1. Add subprocess shell=True on Windows\n2. Increase timeout further for Windows\n3. Add better error logging to capture subprocess stderr\n4. Skip git resolution entirely on timeout and just use provided path","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T16:31:37.531223-08:00","updated_at":"2025-11-07T19:00:44.358543-08:00","closed_at":"2025-11-07T19:00:44.358543-08:00","source_repo":"."} -{"id":"bd-rb75","content_hash":"e91418eb7abda986ddb57feaee1b91867043de8c0883d71c21dc1bf4047f5824","title":"Clean up merge conflict artifacts in .beads directory","description":"After resolving merge conflicts in .beads/beads.jsonl, leftover artifacts remain as untracked files:\n- .beads/beads.base.jsonl\n- .beads/beads.left.jsonl\n\nThese appear to be temporary files created during merge conflict resolution.\n\nOptions to fix:\n1. Add these patterns to .beads/.gitignore automatically\n2. Clean up these files after successful merge resolution\n3. Document that users should delete them manually\n4. Add a check in 'bd sync' or 'bd doctor' to detect and remove stale merge artifacts\n\nPreferred solution: Add *.base.jsonl and *.left.jsonl patterns to .beads/.gitignore during 'bd init', and optionally clean them up automatically after successful import.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-06T19:09:16.114274-08:00","updated_at":"2025-11-06T19:13:44.630402-08:00","closed_at":"2025-11-06T19:13:44.630402-08:00","source_repo":"."} -{"id":"bd-rbxi","content_hash":"df423e4150f6f3b5a19467b8cb41a4b90475cc9ced45ed577ebbe9e3e75279f9","title":"bd-hv01: Deletion tracking production readiness","description":"Epic to track all improvements and fixes needed to make the deletion tracking implementation ([deleted:bd-hv01]) production-ready.\n\nThe core 3-way merge algorithm is sound, but there are critical issues around atomicity, error handling, and edge cases that need to be addressed before this can be safely used in production.\n\nCritical path (P1):\n- Non-atomic snapshot operations\n- Brittle JSON string comparison\n- Silent partial deletion failures\n- Race conditions in concurrent scenarios\n\nFollow-up work (P2-P3):\n- Test coverage for edge cases and multi-repo mode\n- Performance optimizations\n- Code refactoring and observability\n\nRelated commit: 708a81c","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-06T18:18:24.315646-08:00","updated_at":"2025-11-08T03:12:04.15385-08:00","closed_at":"2025-11-08T02:19:19.780741-08:00","source_repo":"."} -{"id":"bd-rfj","content_hash":"c38dcf80ea98c965123622c1ff4c9faddefd226609c1f3ad59143182b1f00114","title":"Add unit tests for hasJSONLChanged() function","description":"The hasJSONLChanged() function has no unit tests. Should test:\n- Normal case: hash matches\n- Normal case: hash differs\n- Edge case: empty file\n- Edge case: missing metadata (first run)\n- Edge case: corrupted metadata\n- Edge case: file read errors\n- Edge case: invalid hash format in metadata\n\nAlso add performance benchmarks for large JSONL files.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:31:10.389481-05:00","updated_at":"2025-11-20T21:40:02.664516-05:00","closed_at":"2025-11-20T21:40:02.664516-05:00","source_repo":".","dependencies":[{"issue_id":"bd-rfj","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:10.39058-05:00","created_by":"daemon"}]} -{"id":"bd-ri6d","content_hash":"62b887c13232eeabf1d1b25a514b6044ff6ea7b510a06cbd5a736beabe722c43","title":"bd message: Fix inefficient client-side filtering for --unread-only","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T12:54:28.614867-08:00","updated_at":"2025-11-08T12:58:59.551512-08:00","closed_at":"2025-11-08T12:58:59.551512-08:00","source_repo":".","dependencies":[{"issue_id":"bd-ri6d","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:55.012455-08:00","created_by":"daemon"}]} -{"id":"bd-rpn","content_hash":"4b0c8a22edcf49b95f1caba51397f5a6289bc170a69084bc3c39267a8f43d888","title":"Implement `bd prime` command for AI context loading","description":"Create a `bd prime` command that outputs AI-optimized markdown containing essential Beads workflow context. This provides an alternative to the MCP server for token-conscious users and enables context recovery after compaction/clearing.","design":"## Implementation\n\nCreate `cmd/bd/prime.go` that outputs AI-optimized markdown with **adaptive content based on MCP detection**.\n\n## MCP-Aware Output Strategy\n\n`bd prime` detects if MCP server is active and adjusts output accordingly:\n\n**With MCP detected** (~500 tokens):\n- Workflow reminders only\n- \"Use bd MCP tools, not markdown TODOs\"\n- Session management tips\n- NO CLI command syntax (user has native MCP tools)\n\n**Without MCP** (~1-2k tokens):\n- Full workflow rules\n- Complete CLI command reference with examples\n- All command syntax and options\n\n**Why this matters:**\n- MCP users don't need CLI docs (they have native function calls)\n- Non-MCP users need full command reference\n- Same hook works for all users, adapts to their environment\n- Reduces token waste for MCP users\n\n## MCP Detection Logic\n\n```go\nfunc isMCPActive() bool {\n // Check environment variables that Claude Code sets when MCP servers are loaded\n // Options to investigate:\n // 1. Check for CLAUDE_MCP_SERVERS environment variable\n // 2. Check for specific MCP server process indicators\n // 3. Parse ~/.claude/settings.json for enabled MCP servers\n // 4. Check for MCP socket/connection availability\n \n // Fallback: assume MCP if we can't determine\n // (safer to output less and have user call with --full flag)\n return checkMCPEnvironment()\n}\n```\n\n**Alternative: Command flag for explicit control:**\n```bash\nbd prime # Auto-detect MCP\nbd prime --full # Force full output (ignore MCP detection)\nbd prime --mcp # Force MCP mode (minimal output)\n```\n\n## Discovery Logic\n\n**Skip PersistentPreRun database initialization:**\nAdd \"prime\" to noDbCommands list in main.go so it doesn't require .beads/ upfront.\n\n**Silent, cross-platform execution:**\n```go\nvar primeCmd = \u0026cobra.Command{\n Use: \"prime\",\n Short: \"Output AI-optimized workflow context\",\n Run: func(cmd *cobra.Command, args []string) {\n // Find .beads/ directory (walks up tree like bd does)\n dbPath := beads.FindDatabasePath()\n if dbPath == \"\" {\n // Not in a beads project - silent exit with success\n // CRITICAL: No stderr output, exit 0\n // This enables cross-platform hook integration\n os.Exit(0)\n }\n \n // Detect MCP mode (unless overridden by flags)\n mcpMode := isMCPActive()\n if fullFlag {\n mcpMode = false\n }\n if mcpFlag {\n mcpMode = true\n }\n \n // Output workflow context (adaptive based on MCP)\n if err := outputPrimeContext(mcpMode); err != nil {\n // Suppress all errors - silent exit with success\n // Never write to stderr (breaks Windows compatibility)\n os.Exit(0)\n }\n },\n}\n```\n\n**Why silent execution matters:**\n- **Cross-platform**: No shell-specific syntax needed (`2\u003e/dev/null`, `|| true`)\n- **Hook-friendly**: Can be called directly from JSON: `\"command\": \"bd prime\"`\n- **Windows compatible**: Works in cmd.exe, PowerShell, bash\n- **Non-beads projects**: No error noise when run outside beads projects\n\n## Output Formats\n\n### MCP Mode (~500 tokens)\n```markdown\n# Beads Workflow Context\n\n\u003e **You have native bd MCP tools available** - use them instead of markdown TODOs\n\u003e Run `bd prime --full` for complete CLI reference if needed\n\n## Core Workflow Rules\n\n**Task Tracking:**\n- Use bd MCP tools for ALL work tracking (never markdown TODOs)\n- Check available work: use `mcp__plugin_beads_beads__ready` tool\n- Create issues: use `mcp__plugin_beads_beads__create` tool\n- Update status: use `mcp__plugin_beads_beads__update` tool\n\n**Session Management:**\n- Start: Check `ready` tool for available work\n- During: Keep issues updated with `update` tool\n- End: Verify sync status, close completed issues\n\n**Git Integration:**\n- Hooks auto-sync issues with git commits\n- Run `sync` tool at session end to push to remote\n\n**Need help?** \n- Use `show` tool for issue details\n- Check AGENTS.md for complete workflow\n- Run `bd prime --full` for CLI command reference\n```\n\n### Non-MCP Mode (~1-2k tokens)\n```markdown\n# Beads Workflow Context\n\n\u003e **Context Recovery**: Run `bd prime` after compaction, clear, or new session\n\u003e Hooks auto-call this in Claude Code when .beads/ detected\n\n## Core Rules\n- Track ALL work in bd (no markdown TODOs)\n- Git workflow: hooks auto-sync, run `bd sync` at session end\n- Session management: check `bd ready` for available work\n\n## Essential Commands\n\n### Finding Work\n- `bd ready` - Show issues ready to work (no blockers)\n- `bd list --status=open` - All open issues\n- `bd list --status=in_progress` - Your active work\n- `bd show \u003cid\u003e` - Detailed issue view with dependencies\n\n### Creating \u0026 Updating\n- `bd create --title=\"...\" --type=task|bug|feature` - New issue\n- `bd update \u003cid\u003e --status=in_progress` - Claim work\n- `bd update \u003cid\u003e --assignee=username` - Assign to someone\n- `bd close \u003cid\u003e` - Mark complete\n- `bd close \u003cid\u003e --reason=\"explanation\"` - Close with reason\n\n### Dependencies \u0026 Blocking\n- `bd dep \u003cfrom\u003e \u003cto\u003e` - Add blocker dependency (from blocks to)\n- `bd blocked` - Show all blocked issues\n- `bd show \u003cid\u003e` - See what's blocking/blocked by this issue\n\n### Sync \u0026 Collaboration\n- `bd sync` - Sync with git remote (run at session end)\n- `bd sync --status` - Check sync status without syncing\n\n### Project Health\n- `bd stats` - Project statistics (open/closed/blocked counts)\n- `bd doctor` - Check for issues (sync problems, missing hooks)\n\n## Common Workflows\n\n**Starting work:**\n```bash\nbd ready # Find available work\nbd show \u003cid\u003e # Review issue details\nbd update \u003cid\u003e --status=in_progress # Claim it\n```\n\n**Completing work:**\n```bash\nbd close \u003cid\u003e # Mark done\nbd sync # Push to remote\n```\n\n**Creating dependent work:**\n```bash\nbd create --title=\"Implement feature X\" --type=feature\nbd create --title=\"Write tests for X\" --type=task\nbd dep beads-xxx beads-yyy # Feature blocks tests\n```\n\nFor complete docs: AGENTS.md, QUICKSTART.md, `bd --help`\n```\n\n## Behavior Guarantees\n\n1. **Never writes to stderr** (all errors suppressed internally)\n2. **Always exits 0** (success) even when:\n - Not in a beads project\n - .beads/ not found\n - Any internal error occurs\n3. **Cross-platform compatible** (no shell-specific syntax)\n4. **Hook-safe** (can be called directly without wrappers)\n5. **MCP-aware** (adapts output based on user's tool environment)\n\n## Files\n- `cmd/bd/prime.go` - Command implementation with MCP detection\n- `cmd/bd/prime_test.go` - Tests (including MCP mode switching)\n- Update `cmd/bd/main.go` - Add \"prime\" to noDbCommands list","acceptance_criteria":"- `bd prime` outputs markdown format\n- Output is ~1-2k tokens\n- Output includes workflow rules and command reference\n- Command has unit tests\n- Documentation updated in AGENTS.md","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:28:42.74124-08:00","updated_at":"2025-11-12T08:30:15.711595-08:00","closed_at":"2025-11-12T08:30:15.711595-08:00","source_repo":".","dependencies":[{"issue_id":"bd-rpn","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:20.357861-08:00","created_by":"daemon"}]} -{"id":"bd-rtp","content_hash":"302e1b77241830b37c9bcc6758da110c797bab2481877ebaa9bff931628e97f9","title":"Implement signal-aware context in CLI commands","description":"Replace context.Background() with signal.NotifyContext() to enable graceful cancellation.\n\n## Context\nPart of context propagation work (bd-350). Phase 1 infrastructure is complete - sqlite.New() now accepts context parameter.\n\n## Implementation\nSet up signal-aware context at the CLI entry points:\n\n```go\nctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)\ndefer cancel()\n```\n\n## Key Locations\n- cmd/bd/main.go:438 (marked with TODO(bd-350))\n- cmd/bd/daemon.go:317 (marked with TODO(bd-350))\n- Other command entry points\n\n## Benefits\n- Ctrl+C cancels ongoing database operations\n- Graceful shutdown on SIGTERM\n- Better user experience during long operations\n\n## Acceptance Criteria\n- [ ] Ctrl+C during import cancels operation cleanly\n- [ ] Ctrl+C during export cancels operation cleanly\n- [ ] No database corruption on cancellation\n- [ ] Proper cleanup on signal (defers execute)","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-20T21:26:34.621983-05:00","updated_at":"2025-11-20T21:32:26.288303-05:00","closed_at":"2025-11-20T21:32:26.288303-05:00","source_repo":"."} -{"id":"bd-ry1u","content_hash":"013464efc3cf53d47c2a170040c66099ce77b13d3d1b34c3729e6a5208122799","title":"Publish official devcontainer configuration","description":"","design":"Problem: GH issue #229 shows git hooks aren't available in devcontainers because bd CLI isn't installed. Solution: Provide official .devcontainer/devcontainer.json that installs Go, builds bd from source, runs bd init --quiet, and installs hooks automatically. Benefits: New contributors start immediately, AI assistants work out-of-box, no manual setup. Implementation: Create .devcontainer/devcontainer.json with Go feature, postCreateCommand to build bd and install hooks, environment variables. Acceptance: Container builds with bd installed, hooks functional, documentation updated, tested with Codespaces and VSCode.","notes":"Devcontainer configuration implemented. Manual testing required in actual devcontainer environment (Codespaces or VSCode Remote Containers). All code changes complete, tests pass, linting clean.","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-05T15:02:21.783666-08:00","updated_at":"2025-11-05T17:46:42.70998-08:00","closed_at":"2025-11-05T17:46:42.70998-08:00","source_repo":"."} -{"id":"bd-s02","content_hash":"911d456e4dabae028dd615b643c99058ef12e55ea523cb81cc933783c7b13546","title":"Manual task","description":"","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-03T20:15:10.022202-08:00","updated_at":"2025-11-03T20:15:10.022202-08:00","source_repo":"."} -{"id":"bd-s1xn","content_hash":"0207827e9eec2a520f16f53a2cdaf50a06483dc53736aa5158e1ff971b88acc6","title":"bd message: Refactor duplicated error messages","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T12:54:27.624981-08:00","updated_at":"2025-11-08T12:58:59.542795-08:00","closed_at":"2025-11-08T12:58:59.542795-08:00","source_repo":".","dependencies":[{"issue_id":"bd-s1xn","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.96063-08:00","created_by":"daemon"}]} -{"id":"bd-sc57","content_hash":"84c36e7e83f18357f9123ff25df6d97f10d8ccd9d89fae223b0031b59bdff168","title":"Production Readiness (Optional)","description":"Enable multi-machine deployments with containerization and monitoring.","status":"closed","priority":3,"issue_type":"epic","created_at":"2025-11-07T22:43:31.527617-08:00","updated_at":"2025-11-08T01:06:12.904671-08:00","closed_at":"2025-11-08T01:06:12.904671-08:00","source_repo":".","dependencies":[{"issue_id":"bd-sc57","depends_on_id":"bd-wfmw","type":"blocks","created_at":"2025-11-07T22:43:31.528743-08:00","created_by":"daemon"},{"issue_id":"bd-sc57","depends_on_id":"bd-pdjb","type":"blocks","created_at":"2025-11-07T22:43:31.529193-08:00","created_by":"daemon"}]} -{"id":"bd-sjmr","content_hash":"55d8ded3fe8f5cb6bd2096aad15c70e5e88230bf0bb2ea1a71347376eb2f123d","title":"Fix inconsistent error handling in multi-repo deletion tracking","description":"From bd-xo6b code review: Multi-repo deletion tracking has mixed failure modes that can leave system in inconsistent state.\n\n**Current behavior (daemon_sync.go):**\n- Snapshot capture (L505-514): Hard fail β†’ aborts sync\n- Merge/prune (L575-584): Hard fail β†’ aborts sync \n- Base snapshot update (L613-619): Soft fail β†’ logs warning, continues\n\n**Critical problem:**\nIf merge fails on repo 3 of 5:\n- Repos 1-2 have already merged and deleted issues (irreversible)\n- Repos 3-5 are untouched\n- Database is in partially-updated state\n- No rollback mechanism\n\n**Real-world scenario:**\n```\nSync with repos [A, B, C]:\n1. Capture snapshots A βœ“, B βœ“, C βœ— β†’ ABORT (good)\n2. Merge A βœ“, B βœ— β†’ ABORT but A already deleted issues (BAD - no rollback)\n3. Update base A ⚠, B ⚠ β†’ Warnings only (inconsistent with 1 \u0026 2)\n```\n\n**Solution options:**\n1. **Two-phase commit:**\n - Phase 1: Validate all repos (check files exist, readable, parseable)\n - Phase 2: Apply changes atomically (or fail entirely before any mutations)\n\n2. **Fail-fast validation:**\n - Before any snapshot/merge operations, validate all repos upfront\n - Abort entire sync if any repo fails validation\n\n3. **Make base snapshot update consistent:**\n - Either make it hard-fail like the others, or make all soft-fail\n\n**Files:**\n- cmd/bd/daemon_sync.go:505-514 (snapshot capture)\n- cmd/bd/daemon_sync.go:575-584 (merge/prune)\n- cmd/bd/daemon_sync.go:613-619 (base snapshot update)\n\n**Recommendation:** Use option 1 (two-phase) or option 2 (fail-fast validation) + fix base snapshot inconsistency.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T19:31:29.538092-08:00","updated_at":"2025-11-06T19:35:41.268584-08:00","closed_at":"2025-11-06T19:35:41.268584-08:00","source_repo":".","dependencies":[{"issue_id":"bd-sjmr","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.310033-08:00","created_by":"daemon"}]} -{"id":"bd-spmx","content_hash":"782a21bc7da73f2b62e340ff669b03731fcac21d75bd1bfdd222c04a565ff6ee","title":"Investigation \u0026 Proof of Concept","description":"Validate that MCP Agent Mail works as expected and delivers promised benefits before committing to full integration.","notes":"POC completed successfully:\nβœ… bd-muls: Server installed and tested\nβœ… bd-27xm: MCP tool execution issues resolved\nβœ… [deleted:bd-6hji]: File reservation collision prevention validated\nβœ… bd-htfk: Latency benchmarking shows 20-50x improvement\nβœ… bd-pmuu: ADR 002 created documenting integration decision\n\nResults validate Agent Mail benefits:\n- Collision prevention works (exclusive file reservations)\n- Latency: \u003c100ms (vs 2000-5000ms git sync)\n- Lightweight deployment (\u003c50MB memory)\n- Optional/non-intrusive integration approach validated\n\nNext: bd-wfmw (Integration Layer Implementation)","status":"closed","priority":0,"issue_type":"epic","created_at":"2025-11-07T22:41:37.13757-08:00","updated_at":"2025-11-08T03:12:04.154114-08:00","closed_at":"2025-11-08T00:06:20.731732-08:00","source_repo":"."} -{"id":"bd-srwk","content_hash":"77494cfb4c2b8f2746367239f800f0e36c93959a47385c7dc2a9d4ac54f4256d","title":"bd export should detect and prevent stale database exports","description":"## Problem\n\nWhen `bd export` is run with a stale database (older than issues.jsonl), it silently overwrites the JSONL file with stale data, causing data loss.\n\n## What Happened (vc project)\n\n1. Agent A created 4 new issues and exported to issues.jsonl (commit 99a9d58)\n2. Agent A closed an issue and exported again (commit 58b4613) - JSONL now has 4 epics\n3. Agent B had stale database (from before step 1)\n4. Agent B worked on unrelated issue and exported (commit 0609233)\n5. Agent B's export **overwrote issues.jsonl**, removing the 4 epics created by Agent A\n6. Required manual recovery by re-exporting from Agent A's correct database\n\n## Expected Behavior\n\n`bd export` should detect that the database is stale and either:\n- **Refuse to export** with error message explaining the issue\n- **Warn prominently** and require explicit --force flag to override\n- **Auto-import first** to sync database before exporting\n\n## How to Detect Staleness\n\nCompare modification times (similar to VC's ValidateDatabaseFreshness):\n1. Check .db, .db-wal, .db-shm timestamps (use newest for WAL mode)\n2. Check issues.jsonl timestamp\n3. If JSONL is newer by \u003e1 second: database is stale\n\n## Suggested Fix\n\nAdd staleness check in `bd export`:\n\n```go\nfunc Export(dbPath, jsonlPath string, force bool) error {\n // Check if database is stale\n if !force {\n if err := checkDatabaseFreshness(dbPath, jsonlPath); err != nil {\n return fmt.Errorf(\"database is stale: %w\\n\" +\n \"Run 'bd import %s' first to sync, or use --force to override\",\n err, jsonlPath)\n }\n }\n \n // Proceed with export...\n}\n```\n\n## Impact\n\n- **Severity**: High (silent data loss)\n- **Frequency**: Happens in multi-agent workflows when agents don't sync\n- **Workaround**: Manual recovery (re-export from correct database)\n\n## References\n\n- VC issue tracker: commits 58b4613 -\u003e 0609233 -\u003e c41c638\n- VC has similar check: `storage.ValidateDatabaseFreshness()`\n- Tolerance: 1 second (handles filesystem timestamp precision)","acceptance_criteria":"1. bd export detects stale database (JSONL newer than DB)\n2. Refuses to export with clear error message\n3. Suggests running 'bd import' first\n4. --force flag allows override with warning\n5. Tolerates filesystem timestamp precision (1 second)\n6. Works correctly with WAL mode (.db-wal files)\n7. Test coverage for staleness detection\n8. Documentation updated with export safety warnings","notes":"Fixed with ID-based comparison instead of just count. Now detects:\n1. DB has fewer issues than JSONL (count check)\n2. DB has different issues than JSONL (ID comparison)\n\nBoth scenarios now properly refuse export unless --force is used.\n\nImplementation uses getIssueIDsFromJSONL() to build a set of IDs from JSONL, then checks if any JSONL IDs are missing from DB. Shows specific missing issue IDs in error message.","status":"closed","priority":1,"issue_type":"bug","assignee":"amp","created_at":"2025-11-07T19:39:24.172154-08:00","updated_at":"2025-11-07T20:05:13.649736-08:00","closed_at":"2025-11-07T19:58:43.300177-08:00","source_repo":"."} -{"id":"bd-t3b","content_hash":"c32a3a0f2f836148033fb330e209ac22e06dbecf18894153c15e2036f5afae1c","title":"Add test coverage for internal/config package","description":"","design":"Config package has 1 test file. Need comprehensive tests. Target: 70% coverage","acceptance_criteria":"- At least 3 test files\n- Package coverage \u003e= 70%","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:22.91657-05:00","updated_at":"2025-11-20T21:21:22.91657-05:00","source_repo":".","dependencies":[{"issue_id":"bd-t3b","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.201036-05:00","created_by":"daemon"}]} -{"id":"bd-t4u1","content_hash":"5558c6e25c6aae4be03fd9f112d892f6e69dc020dee2292a24ec185fb7b6a054","title":"False positive detection by Kaspersky Antivirus (Trojan)","description":"Kaspersky Antivirus falsely detects beads (bd.exe v0.23.1) as a Trojan (PDM:Trojan.Win32.Generic) and removes it.\nEvent: Malicious object detected\nComponent: System Watcher\nObject name: bd.exe\n","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-20T18:56:12.498187-05:00","updated_at":"2025-11-20T18:56:12.498187-05:00","source_repo":"."} -{"id":"bd-t596","content_hash":"6264185777b70f01cd5762c310671175311c9e245d925fa1b3e7a3743c32a9ab","title":"Create comments.go with comment methods","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:15.987782-08:00","updated_at":"2025-11-23T18:13:57.446443-08:00","closed_at":"2025-11-23T18:13:57.446443-08:00","source_repo":"."} -{"id":"bd-t5o","content_hash":"0685a34b3db702956f3ae1478eb6f746db3023ed9cf6a84d94deea9c43bba61d","title":"Document error handling strategy for metadata update failures","description":"Multiple places silently ignore metadata update failures (sync.go:614-617, import.go:320-322) with non-fatal warnings. This is intentional (degrades gracefully to mtime-based approach) but not well documented.\n\nAdd comments explaining:\n- Why these failures are non-fatal\n- How system degrades gracefully\n- What the fallback behavior is (mtime-based detection)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:31:12.366861-05:00","updated_at":"2025-11-20T21:36:16.972395-05:00","closed_at":"2025-11-20T21:36:16.972395-05:00","source_repo":".","dependencies":[{"issue_id":"bd-t5o","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:12.367744-05:00","created_by":"daemon"}]} -{"id":"bd-tbz3","content_hash":"ac416dd2c873a4abb653dfbb689464834000b0c11410c09adf0efb2396a33c48","title":"bd init UX Improvements","description":"bd init leaves users with incomplete setup, requiring manual bd doctor --fix. Issues found: (1) git hooks not installed if user declines prompt, (2) no auto-migration when CLI is upgraded, (3) stale merge driver configs from old versions. Fix by making bd init more robust with better defaults and auto-migration.","status":"open","priority":1,"issue_type":"epic","created_at":"2025-11-21T23:16:00.333543-08:00","updated_at":"2025-11-21T23:16:37.811233-08:00","source_repo":"."} -{"id":"bd-tmdx","content_hash":"0976d6529458902f06108d5d316fda3bf6ed299eaa684501aada481d9e4b10a5","title":"Investigate database pollution - unexpected issue count increases","description":"Two repositories showing unexpected issue counts:\n- ~/src/beads: 280 issues (expected ~209-220)\n- ~/src/dave/beads: 895 issues (675 open, 149 closed)\n\nThis suggests database pollution - issues from one repository leaking into another. Need to investigate:\n1. Run bd detect-pollution on both repos\n2. Check for cross-repo contamination\n3. Identify source of pollution (daemon? multi-repo config? import issues?)\n4. Clean up polluted databases\n5. Prevent future pollution","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-06T22:50:16.957689-08:00","updated_at":"2025-11-07T00:05:38.994405-08:00","closed_at":"2025-11-07T00:05:38.994405-08:00","source_repo":"."} -{"id":"bd-tne","content_hash":"2a6596980450714800bddc88e106026743a1a131e96f09198eb7dc2a16d75ca4","title":"Add Claude setup tip with dynamic priority","description":"Add a predefined tip that suggests running `bd setup claude` when Claude Code is detected but not configured. This tip should have higher priority (shown more frequently) until the setup is complete.","design":"## Implementation\n\nAdd to tip registry in `cmd/bd/tips.go`:\n\n```go\n{\n ID: \"claude_setup\",\n Condition: func() bool {\n return isClaudeDetected() \u0026\u0026 !isClaudeSetupComplete()\n },\n Message: \"Run 'bd setup claude' to enable automatic context recovery in Claude Code\",\n Frequency: 24 * time.Hour, // Daily minimum gap\n Priority: 100, // Highest priority\n Probability: 0.6, // 60% chance when eligible\n}\n```\n\n## Detection Logic\n\n```go\nfunc isClaudeDetected() bool {\n // Check environment variables\n if os.Getenv(\"CLAUDE_CODE\") != \"\" || os.Getenv(\"ANTHROPIC_CLI\") != \"\" {\n return true\n }\n // Check if .claude/ directory exists\n if _, err := os.Stat(filepath.Join(os.Getenv(\"HOME\"), \".claude\")); err == nil {\n return true\n }\n return false\n}\n\nfunc isClaudeSetupComplete() bool {\n // Check for global installation\n home, err := os.UserHomeDir()\n if err == nil {\n _, err1 := os.Stat(filepath.Join(home, \".claude/commands/prime_beads.md\"))\n _, err2 := os.Stat(filepath.Join(home, \".claude/hooks/sessionstart\"))\n if err1 == nil \u0026\u0026 err2 == nil {\n return true // Global hooks installed\n }\n }\n \n // Check for project installation\n _, err1 := os.Stat(\".claude/commands/prime_beads.md\")\n _, err2 := os.Stat(\".claude/hooks/sessionstart\")\n return err1 == nil \u0026\u0026 err2 == nil\n}\n```\n\n## Priority and Probability Behavior\n\n**Why 60% probability?**\n- Important message (priority 100) but not critical\n- Daily frequency + 60% = shows ~4 times per week\n- Avoids spam while staying visible\n- Balances persistence with user experience\n\n**Comparison with other probabilities:**\n- 100% probability: Shows EVERY day (annoying)\n- 80% probability: Shows ~6 days per week (too frequent)\n- 60% probability: Shows ~4 days per week (balanced)\n- 40% probability: Shows ~3 days per week (might be missed)\n\n**Auto-stops when setup complete:**\n- Condition becomes false after `bd setup claude`\n- No manual dismissal needed\n- Tip naturally disappears from rotation","acceptance_criteria":"- Claude setup tip added to registry\n- isClaudeDetected() checks environment and filesystem\n- isClaudeSetupComplete() verifies hook installation\n- Tip shows daily until setup complete\n- Tip stops showing after setup\n- Unit tests for detection functions","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-11T23:29:29.871324-08:00","updated_at":"2025-11-11T23:50:29.756454-08:00","source_repo":".","dependencies":[{"issue_id":"bd-tne","depends_on_id":"bd-d4i","type":"blocks","created_at":"2025-11-11T23:29:29.872081-08:00","created_by":"daemon"},{"issue_id":"bd-tne","depends_on_id":"bd-br8","type":"blocks","created_at":"2025-11-11T23:29:29.87252-08:00","created_by":"daemon"}]} -{"id":"bd-tru","content_hash":"0de12031088519a3dcd27968d6bf17eb3a92d1853264e5a0dceef3310b3a2b04","title":"Update documentation for bd prime and Claude integration","description":"Update AGENTS.md, README.md, and QUICKSTART.md to document the new `bd prime` command, `bd setup claude` command, and tip system.","design":"## Documentation Updates\n\n### AGENTS.md\nAdd new section \"Context Recovery\":\n```markdown\n## Context Recovery\n\n### The Problem\nAfter context compaction or clearing conversation, AI agents may forget to use Beads and revert to markdown TODOs. Claude Code hooks solve this.\n\n### bd prime Command\nThe `bd prime` command outputs essential Beads workflow context in AI-optimized markdown format (~1-2k tokens).\n\n**When to use:**\n- After context compaction\n- After clearing conversation\n- Starting new session\n- When agent seems to forget bd workflow\n- Manual context refresh\n\n**Usage:**\n```bash\nbd prime # Output workflow context\n```\n\n### Automatic Integration (Recommended)\n\nRun `bd setup claude` to install hooks that auto-refresh bd context:\n- **SessionStart hook**: Loads context in new sessions\n- **PreCompact hook**: Refreshes context before compaction (survives better)\n- **Works with MCP**: Hooks complement MCP server (not replace)\n- **Works without MCP**: bd prime provides workflow via CLI\n\n**Why hooks matter even with MCP:**\n- MCP provides native tools, but agent may forget to use them\n- Hooks keep \"use bd, not markdown\" fresh in context\n- PreCompact refreshes workflow before compaction\n\n### MCP Server vs bd prime\n\n**Not an either/or choice** - they solve different problems:\n\n| Aspect | MCP Server | bd prime | Both |\n|--------|-----------|----------|------|\n| **Purpose** | Native bd tools | Workflow context | Best of both |\n| **Tokens** | 10.5k always loaded | ~1-2k when called | 10.5k + ~2k |\n| **Tool access** | Function calls | CLI via Bash | Function calls |\n| **Context memory** | Can fade after compaction | Hooks keep fresh | Hooks + tools |\n| **Recommended** | Heavy usage | Token optimization | Best experience |\n\n**Setup options:**\n```bash\nbd setup claude # Install hooks (works with or without MCP)\nbd setup claude --local # Per-project only\nbd setup claude --remove # Remove hooks\n```\n```\n\n### README.md\nAdd to \"Getting Started\" section:\n```markdown\n### AI Agent Integration\n\n**Claude Code users:** Run `bd setup claude` to install automatic context recovery hooks.\n\nHooks work with both MCP server and CLI approaches, preventing agents from forgetting bd workflow after compaction.\n\n**MCP vs bd prime:**\n- **With MCP server**: Hooks keep agent using bd tools (prevents markdown TODO reversion)\n- **Without MCP server**: Hooks provide workflow context via `bd prime` (~1-2k tokens)\n```\n\n### QUICKSTART.md\nAdd section on agent integration:\n```markdown\n## For AI Agents\n\n**Context loading:**\n```bash\nbd prime # Load workflow context (~1-2k tokens)\n```\n\n**Automatic setup (Claude Code):**\n```bash\nbd setup claude # Install hooks for automatic context recovery\n```\n\nHooks prevent agents from forgetting bd workflow after compaction.\n```","acceptance_criteria":"- AGENTS.md has Context Recovery section\n- README.md mentions bd setup claude\n- QUICKSTART.md mentions bd prime\n- Examples show when to use bd prime vs MCP\n- Clear comparison of trade-offs","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-11T23:30:22.77349-08:00","updated_at":"2025-11-11T23:45:23.242658-08:00","source_repo":".","dependencies":[{"issue_id":"bd-tru","depends_on_id":"bd-rpn","type":"blocks","created_at":"2025-11-11T23:30:22.774216-08:00","created_by":"daemon"},{"issue_id":"bd-tru","depends_on_id":"bd-br8","type":"blocks","created_at":"2025-11-11T23:30:22.774622-08:00","created_by":"daemon"},{"issue_id":"bd-tru","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:35.277819-08:00","created_by":"daemon"}]} -{"id":"bd-ts0c","content_hash":"802acdef71cd9252f7b94db3c21e4c5a4903d04306080b007f395e3fc1ee8bbd","title":"Merge PR #300: gitignore upgrade feature","description":"PR #300 is ready to merge but has rebase conflicts with main.\n\n**Context:**\n- PR implements 3 mechanisms for .beads/.gitignore upgrade (bd doctor --fix, daemon auto-upgrade, bd init idempotent)\n- Conflicts resolved locally but diverged branches make push difficult\n- All fixes applied: removed merge artifact, applied new gitignore template\n- Clean scope: only 6 files changed (+194/-42)\n\n**Next steps:**\n1. Option A: Merge via GitHub UI (resolve conflicts in web interface)\n2. Option B: Fresh rebase on main and force push\n3. Verify CI passes\n4. Squash and merge\n\nPR URL: https://github.com/steveyegge/beads/pull/300\nFixes: #274","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-12T11:56:22.778982-08:00","updated_at":"2025-11-12T12:46:36.550488-08:00","closed_at":"2025-11-12T12:46:36.550488-08:00","source_repo":"."} -{"id":"bd-tuqd","content_hash":"06ac95944f03d871a6f58d2cd63796828873e92ef7c9b897eb639d28860a458e","title":"bd init overwrites existing git hooks without detection or chaining","description":"GH #254: bd init silently overwrites existing git hooks (like pre-commit framework) without detecting them, backing them up, or offering to chain. This breaks workflows and can result in committed code with failing tests.\n\nFix: Detect existing hooks, prompt user with options to chain/overwrite/skip.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T15:51:17.582882-08:00","updated_at":"2025-11-07T15:55:01.330531-08:00","closed_at":"2025-11-07T15:55:01.330531-08:00","source_repo":"."} -{"id":"bd-twlr","content_hash":"e0fe5d5f0cac3bb24ae6c12bdcac79ba0dac61f2e85568e9def8b809b7d038b6","title":"Add bd init --team wizard","description":"Interactive wizard for team workflow setup. Guides user through: branch workflow configuration, shared repo setup, team member onboarding, examples of team collaboration patterns.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:30.013645-08:00","updated_at":"2025-11-05T19:27:33.075826-08:00","closed_at":"2025-11-05T18:56:03.004161-08:00","source_repo":".","dependencies":[{"issue_id":"bd-twlr","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.164445-08:00","created_by":"daemon"}]} -{"id":"bd-u3t","content_hash":"0666b1c7fb8f72d592027b74221e620e5f6aeb71a2ab4c3bcc15df190dc6a037","title":"Phase 2: Implement sandbox auto-detection for GH #353","description":"Implement automatic sandbox detection to improve UX for users in sandboxed environments (e.g., Codex).\n\n**Tasks:**\n1. Implement sandbox detection heuristic using syscall.Kill permission checks\n2. Auto-enable --sandbox mode when sandbox is detected\n3. Display informative message when sandbox is detected\n\n**Implementation:**\n- Add isSandboxed() function in cmd/bd/main.go\n- Auto-set sandboxMode = true in PersistentPreRun when detected\n- Show: 'ℹ️ Sandbox detected, using direct mode'\n\n**References:**\n- docs/GH353_INVESTIGATION.md (Solution 3, lines 120-160)\n- Depends on: Phase 1 (bd-???)\n\n**Acceptance Criteria:**\n- Codex users don't need to manually specify --sandbox\n- No false positives in normal environments\n- Clear messaging when auto-detection triggers","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T18:51:57.254358-05:00","updated_at":"2025-11-22T17:48:48.074198-08:00","closed_at":"2025-11-21T19:28:24.467713-05:00","source_repo":"."} -{"id":"bd-u4f5","content_hash":"89c6ae8745a842541c9a2025222c2c2e67e17b4fc33e0e56e58a37f0c5935939","title":"bd import silently succeeds when database matches working tree but not git HEAD","description":"**Critical**: bd import reports '0 created, 0 updated' when database matches working tree JSONL, even when working tree is ahead of git HEAD. This gives false confidence that everything is synced with the source of truth.\n\n## Reproduction\n\n1. Start with database synced to working tree .beads/issues.jsonl (376 issues)\n2. Git HEAD has older version of .beads/issues.jsonl (354 issues)\n3. Run: bd import .beads/issues.jsonl\n4. Output: 'Import complete: 0 created, 0 updated'\n\n## Problem\n\nUser expects 'bd import' after 'git pull' to sync database with committed state, but:\n- Command silently succeeds because DB already matches working tree\n- No warning that working tree has uncommitted changes\n- User falsely believes everything is synced with git\n- Violates 'JSONL in git is source of truth' principle\n\n## Expected Behavior\n\nWhen .beads/issues.jsonl differs from git HEAD, bd import should:\n1. Detect uncommitted changes: git diff --quiet HEAD .beads/issues.jsonl\n2. Warn user: 'Warning: .beads/issues.jsonl has uncommitted changes (376 lines vs 354 in HEAD)'\n3. Clarify status: 'Import complete: 0 created, 0 updated (already synced with working tree)'\n4. Recommend: 'Run git diff .beads/issues.jsonl to review uncommitted work'\n\n## Impact\n\n- Users can't trust 'bd import' status messages\n- Silent data loss risk if user assumes synced and runs git checkout\n- Breaks mental model of 'JSONL in git = source of truth'\n- Critical for VC's landing-the-plane workflow","acceptance_criteria":"1. bd import detects when working tree differs from git HEAD\n2. Warning emitted if JSONL has uncommitted changes \n3. Status message clarifies 'synced with working tree' vs 'synced with git'\n4. Optional flag to suppress warning (e.g., --working-tree mode)\n5. Documentation updated to explain import behavior with uncommitted changes\n6. Test case: import with dirty working tree shows warning","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-07T23:51:28.536822-08:00","updated_at":"2025-11-07T23:58:34.482313-08:00","closed_at":"2025-11-07T23:58:34.482313-08:00","source_repo":".","labels":["data-integrity"]} -{"id":"bd-u4sb","content_hash":"12afcfe4009b34cecb06fcded5903d4b1ce4e06a57e121669068bfbb24446a3e","title":"bd doctor should validate metadata.json version tracking","description":"bd doctor should check that metadata.json has the LastBdVersion field and that it's valid.\n\nChecks to add:\n- metadata.json exists and is valid JSON\n- LastBdVersion field is present\n- LastBdVersion is a valid semver-like string (or empty on first run)\n- Optionally warn if LastBdVersion is very old (\u003e 10 versions behind)\n\nThis helps ensure version tracking (bd-loka) is working correctly.\n\nRelated: bd-loka","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-23T17:19:08.140971-08:00","updated_at":"2025-11-23T17:27:54.857447-08:00","closed_at":"2025-11-23T17:27:54.857447-08:00","source_repo":"."} -{"id":"bd-u8j","content_hash":"91f39bbd4f2394592407c77917682b2c7c3a0b6415a3572eb75a49b0486a17fe","title":"Clarify exclusive lock protocol compatibility with multi-repo","description":"The contributor-workflow-analysis.md proposes per-repo file locking (Decision #7) using flock on JSONL files. However, VC (a downstream library consumer) uses an exclusive lock protocol (vc-195, requires Beads v0.17.3+) that allows bd daemon and VC executor to coexist.\n\nNeed to clarify:\n- Does the proposed per-repo file locking work with VC's existing exclusive lock protocol?\n- Do library consumers like VC need to adapt their locking logic?\n- Can multiple repos be locked atomically for cross-repo operations?\n\nContext: contributor-workflow-analysis.md lines 662-681","acceptance_criteria":"- Documentation explicitly states compatibility or incompatibility with existing lock protocols\n- If incompatible, migration path is documented for library consumers\n- If compatible, example showing coexistence is provided","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:08.257493-08:00","updated_at":"2025-11-05T14:15:01.506885-08:00","closed_at":"2025-11-05T14:15:01.506885-08:00","source_repo":"."} -{"id":"bd-uiae","content_hash":"5c184901daaa674a0f1224a29ab789019b53da6d5b5b4d6ac943e7d5d4846b3e","title":"Update documentation for beads-merge integration","description":"Document the integrated merge functionality.\n\n**Updates needed**:\n- AGENTS.md: Replace \"use external beads-merge\" with \"bd merge\"\n- README.md: Add git merge driver section\n- TROUBLESHOOTING.md: Update merge conflict resolution\n- ADVANCED.md: Document 3-way merge algorithm\n- Create CREDITS.md or ATTRIBUTION.md for @neongreen\n\n**Highlight**: Deletion sync fix (bd-hv01)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:42:20.488998-08:00","updated_at":"2025-11-06T18:19:16.234758-08:00","closed_at":"2025-11-06T15:40:27.830475-08:00","source_repo":".","dependencies":[{"issue_id":"bd-uiae","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.752447-08:00","created_by":"daemon"}]} -{"id":"bd-urob","content_hash":"fc0e79260f5f6860fa8884859c4b33b18f9cc2dad361c1c1abb9bdeb412479b5","title":"bd-hv01: Refactor snapshot management into dedicated module","description":"Problem: Snapshot logic is scattered across deletion_tracking.go. Would benefit from abstraction with SnapshotManager type.\n\nBenefits: cleaner separation of concerns, easier to test in isolation, better encapsulation, could add observability/metrics.\n\nSuggested improvements: add magic constants, track merge statistics, better error messages.\n\nFiles: cmd/bd/deletion_tracking.go (refactor into new snapshot_manager.go)","status":"closed","priority":3,"issue_type":"chore","created_at":"2025-11-06T18:16:27.943666-08:00","updated_at":"2025-11-08T02:24:24.686744-08:00","closed_at":"2025-11-08T02:19:14.152412-08:00","source_repo":".","dependencies":[{"issue_id":"bd-urob","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.192447-08:00","created_by":"daemon"}]} -{"id":"bd-ut5","content_hash":"d9b4ee9c7748c28dc2cd436911b1bee39e68e82df99b718ebe57a246f72a6bcb","title":"Test label update feature","description":"","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-21T22:07:25.488849-05:00","updated_at":"2025-11-21T22:07:25.488849-05:00","source_repo":".","labels":["test-direct"]} -{"id":"bd-vavh","content_hash":"c4683032c24f356aa799a87390c2f95a280bb6ce1cd94d26bb5d4b0d8ea16829","title":"Fix row iterator resource leak in recursive dependency queries","description":"Critical resource leak in findAllDependentsRecursive() where rows.Close() is called AFTER early return on error, never executing.\n\nLocation: internal/storage/sqlite/sqlite.go:1131-1136\n\nProblem: \n- rows.Close() placed after return statement\n- On scan error, iterator never closed\n- Can exhaust SQLite connections under moderate load\n\nFix: Move defer rows.Close() to execute on all code paths\n\nImpact: Connection exhaustion during dependency traversal","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-16T14:50:55.881698-08:00","updated_at":"2025-11-16T15:03:55.009607-08:00","closed_at":"2025-11-16T15:03:55.009607-08:00","source_repo":"."} -{"id":"bd-vcg5","content_hash":"82933ce7e0add2ee5b5830b343785c3585151453c5c06243af2b1f2b934e72b2","title":"Daemon crash recovery: panic handler + socket cleanup","description":"Improve daemon cleanup on unexpected exit:\n1. Add top-level recover() in runDaemonLoop to capture panics\n2. Write daemon-error file with stack trace on panic\n3. Prefer return over os.Exit where possible (so defers run)\n4. In stopDaemon forced-kill path, also remove stale socket if present\n\nThis ensures better diagnostics and cleaner state after crashes.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T16:42:12.733219-08:00","updated_at":"2025-11-07T22:07:17.347728-08:00","closed_at":"2025-11-07T21:17:15.94117-08:00","source_repo":".","dependencies":[{"issue_id":"bd-vcg5","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.733889-08:00","created_by":"daemon"}]} -{"id":"bd-vxdr","content_hash":"d188358987c7a7d444f9144a4a6cc5164eccd35b16325edba51dad104ab2a7f2","title":"Investigate database pollution - issue count anomalies","description":"Multiple repos showing inflated issue counts suggesting cross-repo pollution:\n- ~/src/dave/beads: 895 issues (675 open) - clearly polluted\n- ~/src/stevey/src/beads: 280 issues (expected ~209-220) - possibly polluted\n\nNeed to investigate:\n1. Source of pollution (multi-repo sync issues?)\n2. How many duplicate/foreign issues exist\n3. Whether recent sync operations caused cross-contamination\n4. How to clean up and prevent future pollution","notes":"Investigation findings:\n\n**Root cause identified:**\n- NOT cross-repo contamination\n- NOT automated test leakage (tests properly use t.TempDir())\n- Manual testing during template feature development (Nov 2-4)\n- Commit ba325a2: \"test issues were accidentally committed during template feature development\"\n\n**Database growth timeline:**\n- Nov 3: 19 issues (baseline)\n- Nov 2-5: +244 issues (massive development spike)\n- Nov 6-7: +40 issues (continued growth)\n- Current: 291 issues β†’ 270 after cleanup\n\n**Test pollution breakdown:**\n- 21 issues matching \"Test \" prefix pattern\n- Most created Nov 2-5 during feature development\n- Pollution from manual `./bd create \"Test issue\"` commands in production workspace\n- All automated tests properly isolated with t.TempDir()\n\n**Cleanup completed:**\n- Ran scripts/cleanup-test-pollution.sh successfully\n- Removed 21 test issues\n- Database reduced from 291 β†’ 270 issues (7.2% cleanup)\n- JSONL synced to git\n\n**Prevention strategy:**\n- Filed follow-up issue for prevention mechanisms\n- Script can be deleted once prevention is in place\n- Tests are already properly isolated - no code changes needed there","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-06T22:34:40.137483-08:00","updated_at":"2025-11-07T16:07:28.274136-08:00","closed_at":"2025-11-07T16:04:02.199807-08:00","source_repo":"."} -{"id":"bd-wcl","content_hash":"c08d62ce3627a49126c63f6a630a08c1666e5b1b8d9148ae0c72d7d06611b2a9","title":"Document CLI + hooks as recommended approach over MCP","description":"Update documentation to position CLI + bd prime hooks as the primary recommended approach over MCP server, explaining why minimizing context matters even with large context windows (compute cost, energy, environment, latency).","design":"## Goals\n\nPosition CLI + `bd prime` hooks as the **primary recommended approach** for AI agent integration, with MCP server as a legacy/fallback option.\n\nExplore **hybrid mode** - if certain commands benefit from MCP (UX/DX advantages like no approval prompts), minimize MCP surface area to only those commands.\n\nThis requires production validation first - only update docs after CLI mode is proven reliable.\n\n## Why Minimize Context (Even With Large Windows)\n\n**Context window size β‰  free resource**\n\nLarge context windows (100k+, 200k+) don't mean we should fill them wastefully. Every token in context has real costs:\n\n### Compute Cost\n- **Processing overhead**: Larger context = more GPU/CPU cycles per request\n- **Memory usage**: 10.5k tokens consume significant RAM/VRAM\n- **Scaling impact**: Multiplied across all users, all sessions, all requests\n\n### Energy \u0026 Environment\n- **Electricity**: More compute = more power consumption\n- **Carbon footprint**: Data centers running on grid power (not all renewable)\n- **Sustainability**: Unnecessary token usage contributes to AI's environmental impact\n- **Responsibility**: Efficient tools are better for the planet\n\n### User Experience\n- **Latency**: Larger context = slower processing (noticeable at 10k+ tokens)\n- **Cost**: Many AI services charge per token (input + output)\n- **Rate limits**: Context counts against API quotas\n\n### Engineering Excellence\n- **Efficiency**: Good engineering minimizes resource usage\n- **Scalability**: Efficient tools scale better\n- **Best practices**: Optimize for the common case\n\n**The comparison:**\n\n| Approach | Standing Context | Efficiency | User Cost | Environmental Impact |\n|----------|-----------------|------------|-----------|---------------------|\n| **CLI + hooks** | ~1-2k tokens | 80-90% reduction | Lower | Sustainable βœ“ |\n| **MCP minimal** | ~2-4k tokens | 60-80% reduction | Medium | Better βœ“ |\n| **MCP full** | ~10.5k tokens | Baseline | Higher | Wasteful βœ— |\n\n**Functional equivalence:**\n- CLI via Bash tool works just as well as MCP native calls\n- Same features, same reliability\n- No downside except initial learning curve\n\n## Hybrid Mode: Minimal MCP Surface Area\n\n**Philosophy:** MCP server doesn't have to expose everything.\n\nIf certain commands have legitimate UX/DX benefits from MCP (e.g., no approval prompts, cleaner syntax), we can expose ONLY those commands via MCP while using CLI for everything else.\n\n### Potential MCP-Only Candidates (TBD)\n\nCommands that might benefit from MCP native calls:\n- `ready` - frequently checked, no side effects, approval prompt annoying\n- `show` - read-only, frequently used, approval slows workflow\n- `list` - read-only, no risk, approval adds friction\n\nCommands that work fine via CLI:\n- `create` - complex parameters, benefits from explicit confirmation\n- `update` - state changes, good to see command explicitly\n- `close` - state changes, explicit is better\n- `dep` - relationships, good to see what's being linked\n- `sync` - git operations, definitely want visibility\n\n### Token Budget\n\n**Full MCP** (current): ~10.5k tokens\n- All ~20+ bd commands exposed\n- All parameter schemas\n- All descriptions and examples\n\n**Minimal MCP** (proposed): ~2-4k tokens\n- 3-5 high-frequency read commands only\n- Simplified schemas\n- Minimal descriptions\n- Everything else via CLI\n\n**Pure CLI**: ~1-2k tokens (only on SessionStart/PreCompact)\n- No MCP tools loaded\n- All commands via Bash\n\n### Investigation Required\n\nBefore implementing hybrid mode, validate:\n\n1. **Do MCP calls actually skip approval prompts?**\n - Test with Claude Code approval settings\n - Compare MCP tool calls vs Bash tool calls\n - Measure UX difference in real usage\n\n2. **What's the actual token breakdown per command?**\n - Measure individual command schemas\n - Calculate token savings for minimal vs full\n\n3. **Is approval prompt the only benefit?**\n - Are there other UX advantages to MCP?\n - Does native syntax actually improve experience?\n - User testing with both approaches\n\n4. **Can we dynamically load MCP tools?**\n - Only load MCP when certain commands needed?\n - Hot-swap between CLI and MCP?\n - Probably not - MCP loads at startup\n\n### Hybrid Mode Documentation (If Validated)\n\n```markdown\n## Choosing Your Integration Approach\n\nBeads supports three AI agent integration approaches:\n\n### CLI + Hooks (Recommended - Most Efficient)\n\n**Setup:** `bd setup claude`\n\nUses Claude Code hooks to inject workflow context via `bd prime` command. Agent uses bd via Bash tool.\n\n**Tokens:** ~1-2k (on SessionStart/PreCompact only)\n\n**Pros:**\n- Maximum efficiency (80-90% reduction vs full MCP)\n- Lowest compute/energy usage\n- Same functionality as MCP\n\n**Cons:**\n- Bash tool calls may require approval prompts\n- Slightly more verbose in conversation\n\n### Minimal MCP + Hooks (Balanced)\n\n**Setup:** Install minimal MCP server (read-only commands) + `bd setup claude`\n\nExposes only high-frequency read commands via MCP (ready, show, list). Everything else via CLI.\n\n**Tokens:** ~2-4k MCP + ~1-2k hooks\n\n**Pros:**\n- 60-80% reduction vs full MCP\n- No approval prompts for common queries\n- Cleaner syntax for frequent operations\n- Still efficient\n\n**Cons:**\n- Requires MCP server (additional setup)\n- Mixed interface (some MCP, some CLI)\n\n### Full MCP + Hooks (Legacy)\n\n**Setup:** Install full MCP server + `bd setup claude`\n\n**Tokens:** ~10.5k MCP + hooks\n\n**Pros:**\n- All commands as native function calls\n- Consistent interface\n\n**Cons:**\n- Highest token usage (worst for compute/energy/cost)\n- Slowest processing\n- Less sustainable\n\n### Recommendation\n\n1. **Start with CLI + hooks** - most efficient, works great\n2. **Try minimal MCP** if approval prompts become annoying\n3. **Avoid full MCP** - wasteful with no significant benefit\n```\n\n## Production Validation Checklist\n\nBefore making these documentation changes, validate CLI approach works reliably:\n\n### Phase 1: Pure CLI Validation\n- [ ] `bd prime` implemented and tested\n- [ ] Hooks installed and working in Claude Code\n- [ ] Real-world usage by at least 2-3 developers for 1+ weeks\n- [ ] No significant usability issues reported\n- [ ] Agent successfully uses bd via Bash tool\n- [ ] Document which commands (if any) have approval prompt issues\n\n### Phase 2: Hybrid Mode Investigation (Optional)\n- [ ] Test if MCP calls skip approval prompts vs Bash calls\n- [ ] Measure token cost per MCP command\n- [ ] Identify minimal set of commands worth exposing via MCP\n- [ ] Build minimal MCP server variant\n- [ ] Validate token savings (should be 60-80% vs full MCP)\n- [ ] User testing shows actual UX improvement\n\n### Phase 3: Documentation Update\n- [ ] Update based on validation results\n- [ ] Include measured token counts (not estimates)\n- [ ] Provide clear migration paths\n- [ ] Update `bd doctor` recommendations\n\n## Migration Guide (Optional)\n\nFor users currently using MCP:\n\n```markdown\n### Migrating from Full MCP to CLI + Hooks\n\nAlready using full MCP server? You can switch to the more efficient CLI approach:\n\n1. Install hooks: `bd setup claude`\n2. Test it works (hooks inject context, agent uses Bash tool)\n3. Remove MCP server from `~/.claude/settings.json`\n4. Restart Claude Code\n\nYou'll get the same functionality with 80-90% less token usage.\n\n### Migrating to Minimal MCP (If Available)\n\nIf you find approval prompts annoying for certain commands:\n\n1. Replace full MCP with minimal MCP in `~/.claude/settings.json`\n2. Restart Claude Code\n3. Verify high-frequency commands (ready, show, list) work via MCP\n4. Everything else automatically uses CLI\n\nYou'll get 60-80% token reduction vs full MCP while keeping the UX benefits.\n```\n\n## Files to Update\n\n- `README.md` - Add recommendation in AI Integration section\n- `AGENTS.md` - Add \"Choosing Your Integration Approach\" section early\n- `QUICKSTART.md` - Update AI integration section\n- `docs/` - Any other AI integration docs if they exist\n- `mcp-server/` - Create minimal variant if hybrid validated\n\n## Future: Update `bd init`\n\nOnce validated, update `bd init` to:\n- Default to recommending `bd setup claude` (hooks only)\n- Mention minimal MCP as option for UX improvement\n- Detect existing full MCP and suggest migration\n- Provide token usage estimates for each approach\n\n## MCP Server Architecture Note\n\n**Key insight:** MCP server doesn't have to expose all bd functionality.\n\nCurrent design exposes ~20+ commands (all bd subcommands). This is over-engineered.\n\n**Better design:**\n- **Minimal MCP**: 3-5 read-only commands (~2-4k tokens)\n- **CLI**: Everything else via Bash tool\n- **Hooks**: Context injection via `bd prime`\n\nThis achieves best of both worlds:\n- Low token usage (efficient)\n- No approval prompts for common queries (UX)\n- Explicit visibility for state changes (safety)\n\nIf validation shows NO meaningful benefit to MCP (even minimal), skip hybrid mode entirely and recommend pure CLI.","acceptance_criteria":"- Documentation explains CLI + hooks as recommended approach\n- Explains why context size matters (compute/energy/cost/latency)\n- Token comparison table shows 80-90% reduction\n- Migration guide for existing MCP users\n- Only deployed AFTER production validation\n- Clear that both approaches are supported","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-12T00:15:25.923025-08:00","updated_at":"2025-11-12T00:18:16.786857-08:00","source_repo":"."} -{"id":"bd-we4p","content_hash":"0e3248d31a6524c7a665960682cf2b159449fa31f5427771796dce8639059faf","title":"Cache getMultiRepoJSONLPaths() result during sync to avoid redundant calls","description":"From bd-xo6b code review: getMultiRepoJSONLPaths() is called 3x per sync cycle.\n\n**Current behavior:**\ndaemon_sync.go calls getMultiRepoJSONLPaths() three times per sync:\n- Line 505: Snapshot capture before pull\n- Line 575: Merge/prune after pull\n- Line 613: Base snapshot update after import\n\n**Cost per call:**\n- Config lookup (likely cached, but still overhead)\n- Path construction: O(N) where N = number of repos\n- String allocations: (N + 1) Γ— filepath.Join() calls\n\n**Total per sync:** 3N path constructions + 3 config lookups + 3 slice allocations\n\n**Impact:**\n- For N=3 repos: Negligible (\u003c 1ms)\n- For N=10 repos: Still minimal\n- For N=100+ repos: Wasteful\n\n**Solution:**\nCall once at sync start, reuse result:\n\n```go\nfunc createSyncFunc(...) func() {\n return func() {\n // ... existing setup ...\n \n // Call once at start\n multiRepoPaths := getMultiRepoJSONLPaths()\n \n // Snapshot capture\n if multiRepoPaths != nil {\n for _, path := range multiRepoPaths {\n if err := captureLeftSnapshot(path); err != nil { ... }\n }\n }\n \n // ... later ...\n \n // Merge/prune - reuse same paths\n if multiRepoPaths != nil {\n for _, path := range multiRepoPaths { ... }\n }\n \n // ... later ...\n \n // Base snapshot update - reuse same paths\n if multiRepoPaths != nil {\n for _, path := range multiRepoPaths { ... }\n }\n }\n}\n```\n\n**Files:**\n- cmd/bd/daemon_sync.go:449-636 (createSyncFunc)\n\n**Note:** This is a performance optimization, not a correctness fix. Low priority unless multi-repo usage scales significantly.","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-11-06T19:31:32.128674-08:00","updated_at":"2025-11-06T19:40:50.871176-08:00","closed_at":"2025-11-06T19:40:50.871176-08:00","source_repo":".","dependencies":[{"issue_id":"bd-we4p","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.39754-08:00","created_by":"daemon"}]} -{"id":"bd-web8","content_hash":"096ecdfa8a6013dcf48d5d1672f0897bee74da6161c105e1a1806ab8d1c51d3f","title":"Fix Windows test failures - metadata keys contain colons from absolute paths","description":"","status":"closed","priority":0,"issue_type":"bug","assignee":"claude","created_at":"2025-11-22T10:56:05.537802-08:00","updated_at":"2025-11-22T10:59:13.74478-08:00","closed_at":"2025-11-22T10:59:13.74478-08:00","source_repo":"."} -{"id":"bd-wfmw","content_hash":"21706f1701be9fb51fa9e17d1dded6343bc2585e4bdb608239a20c5853d00220","title":"Integration Layer Implementation","description":"Build the adapter layer that makes Agent Mail optional and non-intrusive.","notes":"Progress: bd-m9th (Python adapter library) completed with full test coverage. Next: bd-fzbg (update python-agent example with Agent Mail integration).","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-07T22:42:09.356429-08:00","updated_at":"2025-11-08T00:20:30.888756-08:00","closed_at":"2025-11-08T00:20:30.888756-08:00","source_repo":".","dependencies":[{"issue_id":"bd-wfmw","depends_on_id":"bd-spmx","type":"blocks","created_at":"2025-11-07T22:42:09.357488-08:00","created_by":"daemon"}]} -{"id":"bd-wgu4","content_hash":"31cf5cc105fee5de26f4c2756b8368c90b18eb5f65c656eb0d90f96b23daf21d","title":"Standardize daemon detection: use tryDaemonLock probe before RPC","description":"Before attempting RPC connection, call tryDaemonLock() to check if lock is held:\n- If lock NOT held: skip RPC attempt (no daemon running)\n- If lock IS held: proceed with RPC + short timeout\n\nThis is extremely cheap and eliminates unnecessary connection attempts.\n\nApply across all client entry points that probe for daemon.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T16:42:12.709802-08:00","updated_at":"2025-11-07T20:15:23.282181-08:00","closed_at":"2025-11-07T20:15:23.282181-08:00","source_repo":".","dependencies":[{"issue_id":"bd-wgu4","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.710564-08:00","created_by":"daemon"}]} -{"id":"bd-woro","content_hash":"c638f71927d96ea8e8f8aeeb9f8bcd236241124fbaf1589d2b62977b64db3ebb","title":"Separate canonical BD_GUIDE.md from AGENTS.md","description":"Create architectural separation between bd-specific instructions and project-specific instructions.\n\n## Problem\nCurrently AGENTS.md mixes:\n- bd tool documentation (changes with bd upgrades)\n- Project-specific workflow (stable, manually maintained)\n\nThis makes it hard to update bd instructions without touching project docs.\n\n## Solution\n1. Generate .beads/BD_GUIDE.md from 'bd onboard' output\n2. Mark it as auto-generated (never manually edit)\n3. Version-stamp header with bd version\n4. AGENTS.md references it instead of duplicating content\n5. Auto-update BD_GUIDE.md when bd version changes\n\n## Implementation\n- Add 'bd onboard --output .beads/BD_GUIDE.md' option\n- Detect version changes and offer to regenerate\n- Add header: '\u003c!-- Auto-generated by bd v0.24.2 - DO NOT EDIT --\u003e'\n- Update AGENTS.md to reference BD_GUIDE.md\n\n## Benefits\n- Clear separation of concerns\n- Deterministic updates (no agent LLM involved)\n- Git-trackable diffs show exactly what changed\n- Progressive disclosure (agents read when needed)\n\n## Acceptance Criteria\n- BD_GUIDE.md auto-generated and version-stamped\n- AGENTS.md references it appropriately\n- Upgrade workflow auto-updates BD_GUIDE.md\n- Git diffs clearly show bd instruction changes\n","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-23T16:21:55.451925-08:00","updated_at":"2025-11-23T16:21:55.451925-08:00","source_repo":".","dependencies":[{"issue_id":"bd-woro","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:55.453758-08:00","created_by":"daemon"}]} -{"id":"bd-wpkz","content_hash":"58003aaff85c85ba5c314fb5b253e0b79094484059a8fecedb9474ea4f984458","title":"Run tests to ensure refactoring didn't break anything","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:17.264759-08:00","updated_at":"2025-11-23T18:15:22.990153-08:00","closed_at":"2025-11-23T18:15:22.990153-08:00","source_repo":".","dependencies":[{"issue_id":"bd-wpkz","depends_on_id":"bd-9csf","type":"blocks","created_at":"2025-11-23T18:08:30.928086-08:00","created_by":"daemon"},{"issue_id":"bd-wpkz","depends_on_id":"bd-wrfz","type":"blocks","created_at":"2025-11-23T18:08:31.009873-08:00","created_by":"daemon"},{"issue_id":"bd-wpkz","depends_on_id":"bd-x2ba","type":"blocks","created_at":"2025-11-23T18:08:31.080663-08:00","created_by":"daemon"},{"issue_id":"bd-wpkz","depends_on_id":"bd-t596","type":"blocks","created_at":"2025-11-23T18:08:31.153866-08:00","created_by":"daemon"}]} -{"id":"bd-wrfz","content_hash":"a03a18ee69cedc5e7e9c7553d27168fd1935b8d77c863b4888a2b73fec9531bf","title":"Create queries.go with core issue CRUD methods","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:13.46714-08:00","updated_at":"2025-11-23T18:12:55.233765-08:00","closed_at":"2025-11-23T18:12:55.233765-08:00","source_repo":"."} -{"id":"bd-wta","content_hash":"eee40bbe4e00af632ad46e1461a25e4b0e5508bea115422aea0772381eec0d84","title":"Add performance benchmarks for multi-repo hydration","description":"The contributor-workflow-analysis.md asserts sub-second queries (line 702) and describes smart caching via file mtime tracking (Decision #4, lines 584-618), but doesn't provide concrete performance benchmarks.\n\nVC's requirement (from VC feedback section):\n- Executor polls GetReadyWork() every 5-10 seconds\n- Queries must be sub-second (ideally \u003c100ms)\n- Smart caching must avoid re-parsing JSONLs on every query\n\nSuggested performance targets to validate:\n- File stat overhead: \u003c1ms per repo\n- Hydration (when needed): \u003c500ms for typical JSONL (\u003c25k)\n- Query (from cache): \u003c10ms\n- Total GetReadyWork(): \u003c100ms (VC's requirement)\n\nAlso test at scale:\n- N=1 repo (baseline)\n- N=3 repos (typical)\n- N=10 repos (edge case)\n\nThese benchmarks are critical for library consumers like VC that run automated polling loops.","acceptance_criteria":"- Performance benchmark suite created for multi-repo hydration\n- Benchmarks cover file stat, hydration, and query times\n- Tests at N=1, N=3, N=10 repo scales\n- Results documented in contributor-workflow-analysis.md\n- Performance targets met or issues filed for optimization","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:39.331528-08:00","updated_at":"2025-11-05T14:17:15.079226-08:00","closed_at":"2025-11-05T14:17:15.079226-08:00","source_repo":"."} -{"id":"bd-wv9l","content_hash":"20e7b00ef310100af01a9bb27a074dd3faa7183ee48d04916d342c7e49476464","title":"Code Review Sweep: thorough","description":"Perform thorough code review sweep based on accumulated activity.\n\n**AI Reasoning:**\nSignificant code activity with 7608 lines added and 120 files changed indicates substantial modifications. Multiple high-churn areas (cmd/bd, internal/rpc) suggest potential for subtle issues and emerging patterns that warrant review.\n\n**Scope:** thorough\n**Target Areas:** cmd/bd, internal/rpc, .beads\n**Estimated Files:** 12\n**Estimated Cost:** $5\n\n**Task:**\nReview files for non-obvious issues that agents miss during focused work:\n- Inefficiencies (algorithmic, resource usage)\n- Subtle bugs (race conditions, off-by-one, copy-paste)\n- Poor patterns (coupling, complexity, duplication)\n- Missing best practices (error handling, docs, tests)\n- Unnamed anti-patterns\n\nFile discovered issues with detailed reasoning and suggestions.","acceptance_criteria":"- Reviewed target files for code quality issues\n- Filed discovered issues with detailed reasoning\n- Completed sweep according to scope criteria","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T23:23:16.056392-08:00","updated_at":"2025-11-21T23:23:16.056392-08:00","source_repo":".","labels":["code-review-sweep","review-area:.beads","review-area:cmd/bd","review-area:internal/rpc"]} -{"id":"bd-ww0g","content_hash":"973e5e6eb58975fcbe80f804b69a900cde824af4b51243737ef5fca404d0b1c1","title":"MCP server: \"No workspace set\" and \"chunk longer than limit\" errors","description":"Two related errors reported in beads-mcp v0.21:\n\n**Error 1: \"No workspace set\" after successful set_context**\n```\nβœ“ Set beads context\nβœ— list\n Error calling tool 'list': No workspace set. Either provide workspace_root\n parameter or call set_context() first.\n```\n\nHypothesis: Environment variable persistence issue between MCP tool calls, or ContextVar not being set correctly by @with_workspace decorator.\n\n**Error 2: \"Separator is found, but chunk is longer than limit\"**\n```\nβœ— list\n Error calling tool 'list': Separator is found, but chunk is longer than limit\n```\n\nHypothesis: MCP protocol output size limit exceeded. Large issue databases may produce JSON output that exceeds MCP stdio buffer limits.\n\nPlatform: Fedora 43, using copilot-cli with Sonnet 4.5\n\nWorkaround: CLI works fine (`bd list --status open --json`)","notes":"## Fixes Implemented\n\n**Issue 1: \"No workspace set\" after successful set_context** βœ… FIXED\n\nRoot cause: os.environ doesn't persist across MCP tool calls. When set_context() set BEADS_WORKING_DIR in os.environ, that change was lost on the next tool call.\n\nSolution:\n- Added module-level _workspace_context dict for persistent storage (server.py:51)\n- Modified set_context() to store in both persistent dict and os.environ (server.py:265-287)\n- Modified with_workspace() decorator to check persistent context first (server.py:129-133)\n- Updated where_am_i() to check persistent context (server.py:302-330)\n\n**Issue 2: \"chunk longer than limit\"** βœ… FIXED\n\nRoot cause: MCP stdio protocol has buffer limits. Large issue lists with full dependencies/dependents exceed this.\n\nSolution:\n- Reduced default list limit from 50 to 20 (server.py:356, models.py:122)\n- Reduced max list limit from 1000 to 100 (models.py:122)\n- Strip dependencies/dependents from list() and ready() responses (server.py:343-350, 368-373)\n- Full dependency details still available via show() command\n\n## Testing\n\nβœ… Python syntax validated with py_compile\nβœ… Changes are backward compatible\nβœ… Persistent context falls back to os.environ for compatibility\n\nUsers should now be able to call set_context() once and have it persist across all subsequent tool calls. Large databases will no longer cause buffer overflow errors.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T14:32:18.315155-08:00","updated_at":"2025-11-07T21:02:55.470937-08:00","closed_at":"2025-11-07T16:53:46.929942-08:00","source_repo":"."} -{"id":"bd-x2ba","content_hash":"a238eea6a86e16961fcf1b0c2d707359aec731f0857b75f14187f52286cf8624","title":"Create config.go with config and metadata methods","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:14.746163-08:00","updated_at":"2025-11-23T18:13:11.540896-08:00","closed_at":"2025-11-23T18:13:11.540896-08:00","source_repo":"."} -{"id":"bd-x47","content_hash":"e363d887fa6693c1c748d78ea9cdaaa97606889d910f318fbd29584576da57e9","title":"Add guidance for self-hosting projects","description":"The contributor-workflow-analysis.md is optimized for OSS contributors making PRs to upstream projects. However, it doesn't address projects like VC that use beads for their own development (self-hosting).\n\nSelf-hosting projects differ from OSS contributors:\n- No upstream/downstream distinction (they ARE the project)\n- May run automated executors (not just humans)\n- In bootstrap/early phase (stability matters)\n- Single team/owner (not multiple contributors with permissions)\n\nGuidance needed on:\n- When self-hosting projects should stay single-repo (default, recommended)\n- When they should adopt multi-repo (team planning, multi-phase dev)\n- How automated executors should handle multi-repo (if at all)\n- Special considerations for projects in bootstrap phase\n\nExamples of self-hosting projects: VC (building itself with beads), internal tools, pet projects","acceptance_criteria":"- Section added: 'For Projects Using Beads for Self-Hosting'\n- Clear guidance on when to stay single-repo vs adopt multi-repo\n- Recommendations for automated executor behavior with multi-repo\n- Bootstrap phase considerations documented","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:27.805341-08:00","updated_at":"2025-11-05T14:16:34.69662-08:00","closed_at":"2025-11-05T14:16:34.69662-08:00","source_repo":"."} -{"id":"bd-xo6b","content_hash":"a8f6100ae8d6569c75565d5a1aacbc0e55806fab917399ab473fb212fa694b80","title":"Review multi-repo deletion tracking implementation","description":"Thoroughly review the multi-repo deletion tracking fix (bd-4oob):\n\nFiles changed:\n- cmd/bd/deletion_tracking.go: Added getMultiRepoJSONLPaths() helper\n- cmd/bd/daemon_sync.go: Updated snapshot capture/update logic for multi-repo\n- cmd/bd/deletion_tracking_test.go: Added 2 new tests (287 lines)\n\nReview focus areas:\n1. Correctness: Does getMultiRepoJSONLPaths() handle all edge cases?\n2. Performance: Calling getMultiRepoJSONLPaths() 3x per sync (snapshot capture, merge, base update) - should we cache?\n3. Error handling: What if some repos fail snapshot operations but others succeed?\n4. Race conditions: Multiple daemons in different repos?\n5. Test coverage: Are TestMultiRepoDeletionTracking and TestMultiRepoSnapshotIsolation sufficient?\n6. Path handling: Absolute vs relative paths, tilde expansion\n\nThis is fresh code - needs careful review before considering deletion tracking production-ready.","notes":"Code review completed. Overall assessment: Core deletion tracking logic is sound, but error handling and path handling issues make this not yet production-ready for multi-repo scenarios.\n\nKey findings:\n\nCRITICAL ISSUES (Priority 1):\n1. Inconsistent error handling in daemon_sync.go - snapshot/merge fail hard but base update warns. Can leave DB in inconsistent state with no rollback. See bd-sjmr.\n2. No path normalization in getMultiRepoJSONLPaths() - tilde expansion, relative paths, duplicates not handled. See bd-iye7.\n\nSHOULD FIX (Priority 2):\n3. Missing test coverage for edge cases - empty paths, duplicates, partial failures. See bd-kdoh.\n4. Performance - getMultiRepoJSONLPaths() called 3x per sync (minor issue). See bd-we4p.\n\nWHAT WORKS WELL:\n- Atomic file operations with PID-based temp files\n- Good snapshot isolation between repos\n- Race condition protection via exclusive locks\n- Solid test coverage for happy path scenarios\n\nVERDICT: Address bd-iye7 and bd-sjmr before considering deletion tracking production-ready for multi-repo mode.\n\nDetailed review notes available in conversation history.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-06T19:23:52.402949-08:00","updated_at":"2025-11-06T19:32:34.160341-08:00","closed_at":"2025-11-06T19:32:34.160341-08:00","source_repo":".","dependencies":[{"issue_id":"bd-xo6b","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T19:23:52.403723-08:00","created_by":"daemon"}]} -{"id":"bd-xwo","content_hash":"48264aedbfd8cd9ea8ab6ca37882497be431f2827004554058645b610adc3009","title":"Fix validatePreExport to use content hash instead of mtime","description":"validatePreExport() in integrity.go:70 still uses isJSONLNewer() (mtime-based), creating inconsistent behavior. Auto-import correctly uses hasJSONLChanged() (hash-based) but export validation still uses the old mtime approach. This can cause false positive blocks after git operations.\n\nFix: Replace isJSONLNewer() call with hasJSONLChanged() in validatePreExport().\n\nImpact: Without this fix, the bd-khnb solution is incomplete - we prevent resurrection but still have export blocking issues.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T21:31:03.183164-05:00","updated_at":"2025-11-20T21:34:00.200803-05:00","closed_at":"2025-11-20T21:34:00.200803-05:00","source_repo":".","dependencies":[{"issue_id":"bd-xwo","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:03.184049-05:00","created_by":"daemon"}]} -{"id":"bd-xzrv","content_hash":"45b45aaa47b9fc254ce74750b92f5527862672d9826c7ad59e006bdb1bc9939f","title":"Write Agent Mail integration guide","description":"Comprehensive guide for setting up and using Agent Mail with Beads.\n\nAcceptance Criteria:\n- Installation instructions\n- Configuration (environment variables)\n- Architecture diagram\n- Benefits and tradeoffs\n- When to use vs not use\n- Troubleshooting section\n- Migration from git-only mode\n\nFile: docs/AGENT_MAIL.md\n\nSections:\n- Quick start\n- How it works\n- Integration points\n- Graceful degradation\n- Multi-machine deployment\n- FAQ","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:51.231066-08:00","updated_at":"2025-11-08T00:40:38.798162-08:00","closed_at":"2025-11-08T00:40:38.798162-08:00","source_repo":".","dependencies":[{"issue_id":"bd-xzrv","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:42:51.232246-08:00","created_by":"daemon"}]} -{"id":"bd-y6d","content_hash":"d13fc9682bf8abee565cf5724c32c56ead5c080cf257ad604b0a3d508a01a4b8","title":"Refactor create_test.go to use shared DB setup","description":"Convert TestCreate_* functions to use test suites with shared database setup.\n\nExample transformation:\n- Before: 10 separate tests, each with newTestStore() \n- After: 1 TestCreate() with 10 t.Run() subtests sharing one DB\n\nEstimated speedup: 10x faster (1 DB setup instead of 10)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T11:48:56.858213-05:00","updated_at":"2025-11-21T15:15:31.315407-05:00","closed_at":"2025-11-21T15:15:31.315407-05:00","source_repo":".","dependencies":[{"issue_id":"bd-y6d","depends_on_id":"bd-1rh","type":"blocks","created_at":"2025-11-21T11:49:09.660182-05:00","created_by":"daemon"},{"issue_id":"bd-y6d","depends_on_id":"bd-c49","type":"blocks","created_at":"2025-11-21T11:49:26.410452-05:00","created_by":"daemon"}]} -{"id":"bd-yb8","content_hash":"9579eb6536ba3a6fe6c62e7275f467c6926b08e78861a77869878849fb2f3b17","title":"Propagate context through command handlers","description":"Thread context from signal-aware parent through all command handlers.\n\n## Context\nPart of context propagation work. Builds on bd-rtp (signal-aware contexts).\n\n## Current State\nMany command handlers create their own context.Background() locally instead of receiving context from parent.\n\n## Implementation\n1. Add context parameter to command handler functions\n2. Pass context from cobra command Run/RunE closures\n3. Update all storage operations to use propagated context\n\n## Example Pattern\n```go\n// Before\nRun: func(cmd *cobra.Command, args []string) {\n ctx := context.Background()\n store.GetIssues(ctx, ...)\n}\n\n// After \nRun: func(cmd *cobra.Command, args []string) {\n // ctx comes from parent signal-aware context\n store.GetIssues(ctx, ...)\n}\n```\n\n## Files to Update\n- All cmd/bd/*.go command handlers\n- Ensure context flows from main -\u003e cobra -\u003e handlers -\u003e storage\n\n## Benefits\n- Commands respect cancellation signals\n- Consistent context handling\n- Enables timeouts and deadlines\n\n## Acceptance Criteria\n- [ ] All command handlers use propagated context\n- [ ] No new context.Background() calls in command handlers\n- [ ] Context flows from signal handler to storage layer","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-20T21:27:02.854242-05:00","updated_at":"2025-11-20T21:37:32.44525-05:00","closed_at":"2025-11-20T21:37:32.44525-05:00","source_repo":".","dependencies":[{"issue_id":"bd-yb8","depends_on_id":"bd-rtp","type":"blocks","created_at":"2025-11-20T21:27:02.854904-05:00","created_by":"daemon"}]} -{"id":"bd-ybv5","content_hash":"52f6d2143a3e9d63937e7dee2cfb4055740132d3c0831c3e948210179336820f","title":"Refactor AGENTS.md to use external references","description":"Suggestion to use external references (e.g., \"ALWAYS REFER TO ./beads/prompt.md\") instead of including all instructions directly within AGENTS.md.\nReasons:\n1. Agents can follow external references.\n2. Prevents context pollution/stuffing in AGENTS.md as more tools append instructions.\n","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-20T18:55:53.259144-05:00","updated_at":"2025-11-20T18:55:53.259144-05:00","source_repo":"."} -{"id":"bd-ye0d","content_hash":"40962ef4e144b58167a07ae13458b40cedff3f3549fccab3a172ca908cd754bc","title":"troubleshoot GH#278 daemon exits every few secs","description":"","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-13T06:27:23.39509215-07:00","updated_at":"2025-11-13T06:27:23.39509215-07:00","source_repo":"."} -{"id":"bd-yek6","content_hash":"f155913af8c58c0a7ea3da6a7d9e232e8cb29c3825f2d6f272a5417a449692a9","title":"CLI tests (cli_fast_test.go) are slow and should be integration tests","description":"The TestCLI_* tests in cmd/bd/cli_fast_test.go are taking 4-5 seconds each (40+ seconds total), making them the slowest part of the fast test suite.\n\nCurrent timings:\n- TestCLI_Import: 4.73s\n- TestCLI_Blocked: 4.33s \n- TestCLI_DepTree: 4.15s\n- TestCLI_Close: 3.59s\n- TestCLI_DepAdd: 3.50s\n- etc.\n\nThese tests compile the bd binary once in init(), but then execute it multiple times per test with filesystem operations. Despite being named \"fast\", they're actually end-to-end CLI integration tests.\n\nOptions:\n1. Tag with //go:build integration (move to integration suite)\n2. Optimize: Use in-memory databases, reduce exec calls, better parallelization\n3. Keep as-is but understand they're the baseline for \"fast\" tests\n\nTotal test suite currently: 13.8s (cmd/bd alone is 12.8s, and most of that is these CLI tests)","notes":"Fixed by reusing existing bd binary from repo root instead of rebuilding.\n\nBefore: 15+ minutes (rebuilding binary for every test package)\nAfter: ~12 seconds (reuses pre-built binary)\n\nThe init() function now checks for ../../bd first before falling back to building. This means `go build \u0026\u0026 go test` is now fast.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T20:19:12.822543-08:00","updated_at":"2025-11-05T20:31:19.321787-08:00","closed_at":"2025-11-05T20:31:19.321787-08:00","source_repo":"."} -{"id":"bd-ykd9","content_hash":"f1446ecf58b117dae936c32d30370b5a42a2c081ffae6ce749d87300a893fa72","title":"Add bd doctor --fix flag to automatically repair issues","description":"Implement a --fix flag for bd doctor that can automatically repair detected issues.\n\nRequirements:\n- Add --fix flag to bd doctor command\n- Show all fixable issues and prompt for confirmation before applying fixes\n- Organize fix implementations under doctor/fix/\u003ctype_of_fix\u003e.go\n- Each fix type should have its own file (e.g., doctor/fix/hooks.go, doctor/fix/sync.go)\n- Display what will be fixed and ask user to confirm (Y/n) before proceeding\n- Support fixing issues like:\n - Missing or broken git hooks\n - Sync problems with remote\n - File permission issues\n - Any other auto-repairable issues doctor detects\n\nImplementation notes:\n- Maintain separation between detection (existing doctor code) and repair (new fix code)\n- Each fix should be idempotent and safe to run multiple times\n- Provide clear output about what was fixed\n- Log any fixes that fail with actionable error messages","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-14T18:17:48.411264-08:00","updated_at":"2025-11-14T18:17:58.88609-08:00","source_repo":"."} -{"id":"bd-ymj","content_hash":"5318552ae22d95bf45f13c6e803ca31170cc31172e9bd107f450e3ee12585564","title":"Export doesn't update last_import_hash metadata causing perpetual 'JSONL content has changed' errors","description":"After a successful export, the daemon doesn't update last_import_hash or last_import_mtime metadata. This causes hasJSONLChanged to return true on the next export attempt, blocking with 'refusing to export: JSONL content has changed since last import'.\n\nRelated to GH #334.\n\nScenario:\n1. Daemon exports successfully β†’ JSONL updated, hash changes\n2. Metadata NOT updated (last_import_hash still points to old hash)\n3. Next mutation triggers export\n4. validatePreExport calls hasJSONLChanged\n5. hasJSONLChanged sees current JSONL hash != last_import_hash\n6. Export blocked with 'JSONL content has changed since last import'\n7. Issue stuck: can't export, can't make progress\n\nThis creates a catch-22 where the system thinks JSONL changed externally when it was the daemon itself that changed it.\n\nCurrent behavior:\n- Import updates metadata (import.go:310-336)\n- Export does NOT update metadata (daemon_sync.go:307)\n- Result: metadata becomes stale after every export","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:05:34.871333-05:00","updated_at":"2025-11-23T18:05:13.762931-08:00","closed_at":"2025-11-21T15:09:04.016651-05:00","source_repo":".","labels":["bug","daemon","export","metadata"],"dependencies":[{"issue_id":"bd-ymj","depends_on_id":"bd-dvd","type":"related","created_at":"2025-11-21T10:06:11.462508-05:00","created_by":"daemon"}]} -{"id":"bd-yuf7","content_hash":"97e18d89914d698df5ec673d40ff980a87a29e1435a887ec2b5dd77d7d412a79","title":"bd config set succeeds but doesn't persist to config.toml","description":"Commands like `bd config set daemon.auto_push true` return \"Set daemon.auto_push = true\" but the config file is never created and `bd info --json | jq '.config'` returns null.\n\n**Steps to reproduce:**\n1. Run `bd config set daemon.auto_push true`\n2. See success message: \"Set daemon.auto_push = true\"\n3. Check `cat .beads/config.toml` β†’ file doesn't exist\n4. Check `bd info --json | jq '.config'` β†’ returns null\n\n**Expected:**\n- .beads/config.toml should be created with the setting\n- bd info should show the config value\n\n**Impact:**\nUsers can't enable auto-push/auto-commit via CLI as documented in AGENTS.md","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T01:14:58.726198-08:00","updated_at":"2025-11-08T01:17:41.377912-08:00","closed_at":"2025-11-08T01:17:41.377912-08:00","source_repo":"."} -{"id":"bd-yvlc","content_hash":"7447f9c24de76b56a3e753619c20571c3ca4ec0fb69a12b917def9d9580b1854","title":"URGENT: main branch has failing tests (syncbranch migration error)","description":"The main branch has failing tests that are blocking CI for all PRs.\n\n## Problem\nAll syncbranch_test.go tests failing with:\n\"migration external_ref_column failed: failed to create index on external_ref: sqlite3: SQL logic error: no such table: main.issues\"\n\n## Evidence\n- Last 5 CI runs on main: ALL FAILED\n- Tests fail locally on current main (bd6dca5)\n- Affects: TestGet, TestSet, TestUnset in internal/syncbranch\n\n## Impact\n- Blocking all PR merges\n- CI shows red for all branches\n- Can't trust test results\n\n## Root Cause\nMigration order issue - trying to create index on external_ref column before the issues table exists, or before the external_ref column is added to the issues table.\n\n## Quick Fix Needed\nNeed to investigate migration order in internal/storage/sqlite/migrations.go and ensure:\n1. issues table is created first\n2. external_ref column is added to issues table\n3. THEN index on external_ref is created\n\nThis is CRITICAL - main should never have breaking tests.","design":"Investigation steps:\n1. Check internal/storage/sqlite/migrations.go\n2. Verify migration order and dependencies\n3. Look at external_ref_column migration specifically\n4. Ensure proper table/column creation before index\n5. Test fix locally with fresh database\n6. Push fix to main\n7. Verify CI passes","acceptance_criteria":"- All tests pass on main branch\n- CI is green\n- syncbranch_test.go tests all passing","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-11-15T12:25:31.51688-08:00","updated_at":"2025-11-15T12:43:11.489612-08:00","closed_at":"2025-11-15T12:43:11.489612-08:00","source_repo":"."} -{"id":"bd-yxy","content_hash":"690b6c0348a09a625425c83cd076dce7e1d3c050aae32624047336b9c416eeb2","title":"Add command injection prevention tests for git rm in merge command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/merge.go:121, exec.Command is called with variable fullPath, flagged by gosec G204 for potential command injection.\n\nAdd tests covering:\n- File paths with shell metacharacters (;, |, \u0026, $, etc.)\n- Paths with spaces and special characters\n- Paths attempting command injection (e.g., 'file; rm -rf /')\n- Validation that fullPath is properly sanitized\n- Only valid git-tracked files can be removed\n\nThis is a critical security path preventing arbitrary command execution.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-21T10:25:33.531631-05:00","updated_at":"2025-11-23T16:05:29.741791-08:00","closed_at":"2025-11-21T19:31:21.853136-05:00","source_repo":".","labels":["discovered:supervisor"],"dependencies":[{"issue_id":"bd-yxy","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.533126-05:00","created_by":"ai-supervisor"}]} -{"id":"bd-z0yn","content_hash":"d642aa388f336290811fa0a5f8f7a546f676ca9727f0d21072300219bccf037b","title":"Channel isolation test - beads","description":"","notes":"Resetting stale in_progress status from old executor run (13 days old)","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-08T04:21:17.327983-08:00","updated_at":"2025-11-21T14:38:35.459782-05:00","source_repo":"."} -{"id":"bd-z3s3","content_hash":"24d99dc1a9a5f35af962137f5709d4b0f1b6a9ec91511c30a2517d790640cce8","title":"Create deployment scripts for GCP","description":"Automated provisioning scripts for GCP Compute Engine deployment.\n\nAcceptance Criteria:\n- Terraform/gcloud scripts\n- Static IP allocation\n- Firewall rules\n- NGINX reverse proxy config\n- TLS setup (Let's Encrypt)\n- Systemd service file\n\nFile: deployment/agent-mail/gcp/","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.294839-08:00","updated_at":"2025-11-07T22:43:43.294839-08:00","source_repo":".","dependencies":[{"issue_id":"bd-z3s3","depends_on_id":"bd-9li4","type":"blocks","created_at":"2025-11-07T23:04:27.982336-08:00","created_by":"daemon"}]} -{"id":"bd-z528","content_hash":"3f332e9997d2b7eb0af23885820df5f607fe08671a2615cadec941bbe7d36f68","title":"Prevent test pollution in production database","description":"The bd-vxdr cleanup revealed test issues were created during manual testing in the production workspace (Nov 2-4, template feature development).\n\n**Root cause:** Manual testing with `./bd create \"Test issue\"` pollutes the production .beads database.\n\n**Prevention strategies:**\n1. Use TEST_DB environment variable for manual testing\n2. Add warning when creating issues with \"Test\" prefix\n3. Improve developer docs about testing workflow\n4. Consider adding `bd test-mode` command for isolated testing","notes":"**Implementation completed:**\n\n1. βœ… Added warning when creating issues with \"Test\" prefix in production database\n - Shows yellow warning with ⚠ symbol\n - Suggests using BEADS_DB for isolated testing\n - Warning appears in create.go after title validation\n\n2. βœ… Documented BEADS_DB testing workflow in AGENTS.md\n - Added \"Testing Workflow\" section in Development Guidelines\n - Includes manual testing examples with BEADS_DB\n - Includes automated testing examples with t.TempDir()\n - Clear warning about not polluting production database\n\n3. ⚠️ Decided against bd test-mode command\n - BEADS_DB already provides simple, flexible isolation\n - Additional command would add complexity without much benefit\n - Current approach follows Unix philosophy (env vars for config)\n\n**Files modified:**\n- cmd/bd/create.go - Added Test prefix warning\n- AGENTS.md - Added Testing Workflow section\n\n**Testing:**\n- Verified warning appears when creating \"Test\" prefix issues\n- Verified BEADS_DB isolation works correctly\n- Built successfully with `go build`","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T16:07:28.255289-08:00","updated_at":"2025-11-07T23:18:08.386514-08:00","closed_at":"2025-11-07T22:43:28.669908-08:00","source_repo":"."} -{"id":"bd-zbq2","content_hash":"56dfd7f2c09dafd232a1ae26063744c89a1ba317e50a3429ec19b73ee1402993","title":"bd export should verify JSONL line count matches database count","description":"After export completes, bd should verify that the JSONL file line count matches the number of issues exported. This would catch silent failures where the export appears to succeed but doesn't actually write all issues.\n\nReal-world scenario from VC project:\n- Ran direct SQL DELETE to remove 240 issues \n- Ran 'bd export -o .beads/issues.jsonl'\n- No error shown, appeared to succeed\n- But JSONL file was not updated (still had old line count)\n- Later session found all 240 issues still in JSONL\n- Had to repeat the cleanup\n\nIf export had verified line count, it would have immediately shown:\n Error: Export verification failed\n Expected: 276 issues\n JSONL file: 516 lines\n Mismatch indicates export failed to write all issues\n\nThis is especially important because:\n1. JSONL is source of truth in git\n2. Silent export failures cause data inconsistency\n3. Users assume export succeeded if no error shown\n4. The verification is cheap (just count lines)\n\nImplementation:\n- After writing JSONL, count lines in file\n- Compare to len(exportedIDs)\n- If mismatch, remove temp file and return error\n- Show clear error message with both counts","design":"In cmd/bd/export.go, after atomic rename (line ~301):\n\n1. Count lines in final JSONL file:\n - Read file and count newlines\n - Or reuse countIssuesInJSONL() helper (already exists)\n\n2. Compare to len(exportedIDs)\n\n3. If mismatch:\n - Log error with both counts\n - Optionally: remove the bad JSONL file (or leave for debugging?)\n - Return error (exit 1)\n\n4. Consider adding --skip-verify flag for edge cases\n\nEdge cases:\n- Partial line writes (corrupted file)\n- File system issues\n- Race conditions (another process modifying JSONL during export)\n\nThe countIssuesInJSONL() function already exists at line 20, can reuse it.","acceptance_criteria":"1. bd export verifies JSONL line count after write\n2. Clear error shown if mismatch detected\n3. Test case that simulates partial write failure\n4. Does not affect export performance significantly (line counting is fast)","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-05T14:24:56.278249-08:00","updated_at":"2025-11-05T15:09:41.636141-08:00","closed_at":"2025-11-05T14:31:24.494885-08:00","source_repo":"."} -{"id":"bd-zi1v","content_hash":"6b07bd91f55d69f556fb43d7a590896393190f42a9f0afe6b9140a1b81fde815","title":"Test Agent Mail server failure scenarios","description":"Verify graceful degradation across various failure modes.\n\nTest Cases:\n- Server never started\n- Server crashes during operation\n- Network partition (timeout)\n- Server returns 500 error\n- Invalid bearer token\n- SQLite corruption\n\nAcceptance Criteria:\n- Agents continue working in all scenarios\n- Clear log messages about degradation\n- No crashes or data loss\n- Beads JSONL remains consistent\n\nFile: tests/integration/test_mail_failures.py","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:43:21.41983-08:00","updated_at":"2025-11-08T01:49:13.742653-08:00","closed_at":"2025-11-08T01:49:13.742653-08:00","source_repo":".","dependencies":[{"issue_id":"bd-zi1v","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:43:21.420725-08:00","created_by":"daemon"}]} -{"id":"bd-zj8e","content_hash":"655c761aaf4d5b0c9edfba7d96d23e608de94760148715667738d35c2033e110","title":"Performance Testing Documentation","description":"Create docs/performance-testing.md documenting the performance testing framework.\n\nSections:\n1. Overview - What the framework does, goals\n2. Running Benchmarks\n - make bench command\n - Running specific benchmarks\n - Interpreting output (ns/op, allocs/op)\n3. Profiling and Analysis\n - Viewing CPU profiles with pprof\n - Reading flamegraphs\n - Memory profiling\n - Finding hotspots\n4. User Diagnostics\n - bd doctor --perf usage\n - Sharing profiles with bug reports\n - Understanding the report output\n5. Comparing Performance\n - Using benchstat for before/after comparisons\n - Detecting regressions\n6. Tips for Optimization\n - Common patterns\n - When to profile vs benchmark\n\nStyle:\n- Concise, practical examples\n- Screenshots/examples of pprof output\n- Clear command-line examples\n- Focus on workflow, not theory","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-13T22:23:38.99897-08:00","updated_at":"2025-11-13T22:23:38.99897-08:00","source_repo":"."} -{"id":"bd-zkl","content_hash":"27227f7f9b8b03d312d483686711551bcf227c263f935d94d1a8f2c377969d2e","title":"Add tests for daemon vs non-daemon parity in list filters","description":"After bd-o43 RPC integration, we need tests to verify daemon mode behaves identically to direct mode for all new filter flags.\n\nTest coverage needed:\n- Pattern matching: --title-contains, --desc-contains, --notes-contains\n- Date ranges: all 6 date filter flags (created/updated/closed after/before)\n- Empty/null checks: --empty-description, --no-assignee, --no-labels\n- Priority ranges: --priority-min, --priority-max\n- Status normalization: --status all vs no status flag\n- Date parsing: YYYY-MM-DD, RFC3339, and error cases\n- Backward compat: deprecated --label flag still works\n\nOracle review findings (bd-o43):\n- Date parsing should support multiple formats\n- Status 'all' should be treated as unset\n- NoLabels field was missing from RPC protocol\n- Error messages should be clear and actionable\n\nTest approach:\n- Create RPC integration tests in internal/rpc/server_issues_epics_test.go\n- Compare daemon client.List() vs direct store.SearchIssues() for same filters\n- Verify error messages match between modes\n- Test with real daemon instance, not just unit tests","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T00:43:53.369457-08:00","updated_at":"2025-11-05T00:55:31.318526-08:00","closed_at":"2025-11-05T00:55:31.318526-08:00","source_repo":".","dependencies":[{"issue_id":"bd-zkl","depends_on_id":"bd-o43","type":"discovered-from","created_at":"2025-11-05T00:43:53.371274-08:00","created_by":"daemon"}]} -{"id":"bd-znyw","content_hash":"3e4935c28a51eb4e1bd4ef28f0024aca16509c5f42009f72a71ffe7b8e07d0eb","title":"Change default JSONL filename from beads.jsonl back to issues.jsonl throughout codebase","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-21T23:27:07.137649-08:00","updated_at":"2025-11-21T23:34:05.029974-08:00","closed_at":"2025-11-21T23:34:05.029974-08:00","source_repo":"."} -{"id":"bd-zo7o","content_hash":"91c443d3b156b374a4d2359ca34bfdf53acbe377e8988eed17123b9400657539","title":"Create multi-agent race condition test","description":"Automated test that runs 2+ agents simultaneously to verify collision prevention.\n\nAcceptance Criteria:\n- Script spawns 2 agents in parallel\n- Both try to claim same issue\n- Only one succeeds (via reservation)\n- Other agent skips to different work\n- Verify in JSONL that no duplicate claims\n- Test with Agent Mail enabled/disabled\n\nFile: tests/integration/test_agent_race.py\n\nSuccess Metric: Zero duplicate claims with Agent Mail, collisions without it","status":"closed","priority":0,"issue_type":"task","created_at":"2025-11-07T22:43:21.360663-08:00","updated_at":"2025-11-08T00:34:14.40119-08:00","closed_at":"2025-11-08T00:34:14.40119-08:00","source_repo":".","dependencies":[{"issue_id":"bd-zo7o","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:43:21.361571-08:00","created_by":"daemon"}]} -{"id":"bd-zpnq","content_hash":"e96e651c806b522dfc4dfffe17f44e75a5a690bd6fcfe4c6471920e4a715103e","title":"Daemons don't exit when parent process dies, causing accumulation and race conditions","description":"Multiple daemon processes accumulate over time because daemons don't automatically stop when their parent process (e.g., coding agent) is killed. This causes:\n\n1. Race conditions: 8+ daemons watching same .beads/beads.db, each with own 30s debounce timer\n2. Git conflicts: Multiple daemons racing to commit/push .beads/issues.jsonl\n3. Resource waste: Orphaned daemons from sessions days/hours old still running\n\nExample: User had 8 daemons from multiple sessions (12:37AM, 7:20PM, 7:22PM, 7:47PM, 9:19PM yesterday + 9:54AM, 10:55AM today).\n\nSolutions to consider:\n1. Track parent PID and exit when parent dies\n2. Use single global daemon instead of per-session\n3. Document manual cleanup: pkill -f \"bd daemon\"\n4. Add daemon lifecycle management (auto-cleanup of stale daemons)","notes":"Implementation complete:\n\n1. Added ParentPID field to DaemonLockInfo struct (stored in daemon.lock JSON)\n2. Daemon now tracks parent PID via os.Getppid() at startup\n3. Both event loops (polling and event-driven) check parent process every 10 seconds\n4. Daemon gracefully exits if parent process dies (detected via isProcessRunning check)\n5. Handles edge cases:\n - ParentPID=0: Older daemons without tracking (ignored)\n - ParentPID=1: Adopted by init means parent died (exits)\n - Otherwise checks if parent process is still running\n\nThe fix prevents daemon accumulation by ensuring orphaned daemons automatically exit within 10 seconds of parent death.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T18:48:41.65456-08:00","updated_at":"2025-11-07T18:53:26.382573-08:00","closed_at":"2025-11-07T18:53:26.382573-08:00","source_repo":"."} -{"id":"bd-zqmb","content_hash":"252347e3b30b33a1d0529e9d4e3c4c5402f5e32449967f704b7fc9ec09f02c0d","title":"Fix goroutine leak in daemon restart","description":"Fire-and-forget goroutine in daemon restart leaks on every restart.\n\nLocation: cmd/bd/daemons.go:251\n\nProblem:\ngo func() { _ = daemonCmd.Wait() }()\n\n- Spawns goroutine without timeout or cancellation\n- If daemon command never completes, goroutine leaks forever\n- Each daemon restart leaks one more goroutine\n\nSolution: Add timeout and cleanup:\ngo func() {\n done := make(chan struct{})\n go func() {\n _ = daemonCmd.Wait()\n close(done)\n }()\n \n select {\n case \u003c-done:\n // Exited normally\n case \u003c-time.After(10 * time.Second):\n // Timeout - daemon should have forked by now\n _ = daemonCmd.Process.Kill()\n }\n}()\n\nImpact: Goroutine leak on every daemon restart\n\nEffort: 2 hours","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:52:01.897215-08:00","updated_at":"2025-11-16T15:04:00.497517-08:00","closed_at":"2025-11-16T15:04:00.497517-08:00","source_repo":"."} -{"id":"bd-zwpw","content_hash":"f08173f44c8454bf15b265aa9d3242004e7ee2bc25867b02676746154a9cc6fe","title":"Test dependency child","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T11:23:05.998311-08:00","updated_at":"2025-11-05T11:23:30.389454-08:00","closed_at":"2025-11-05T11:23:30.389454-08:00","source_repo":".","dependencies":[{"issue_id":"bd-zwpw","depends_on_id":"bd-k0j9","type":"blocks","created_at":"2025-11-05T11:23:05.998981-08:00","created_by":"daemon"}]} -{"id":"bd-zwtq","content_hash":"59236b5c5c330b4cc7cc1a7ed02ddfbec0a0d19b85cf81af58e2e8eec8b5836e","title":"Run bd doctor at end of bd init to verify setup","description":"Run bd doctor diagnostics at end of bd init (after line 398 in init.go). If issues found, warn user immediately: '⚠ Setup incomplete. Run bd doctor --fix to complete setup.' Catches configuration problems before user encounters them in normal workflow.","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-21T23:16:09.596778-08:00","updated_at":"2025-11-21T23:16:27.781976-08:00","source_repo":".","dependencies":[{"issue_id":"bd-zwtq","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:09.597617-08:00","created_by":"daemon"}]} +{"id":"bd-z528","title":"Prevent test pollution in production database","description":"The bd-vxdr cleanup revealed test issues were created during manual testing in the production workspace (Nov 2-4, template feature development).\n\n**Root cause:** Manual testing with `./bd create \"Test issue\"` pollutes the production .beads database.\n\n**Prevention strategies:**\n1. Use TEST_DB environment variable for manual testing\n2. Add warning when creating issues with \"Test\" prefix\n3. Improve developer docs about testing workflow\n4. Consider adding `bd test-mode` command for isolated testing","notes":"**Implementation completed:**\n\n1. βœ… Added warning when creating issues with \"Test\" prefix in production database\n - Shows yellow warning with ⚠ symbol\n - Suggests using BEADS_DB for isolated testing\n - Warning appears in create.go after title validation\n\n2. βœ… Documented BEADS_DB testing workflow in AGENTS.md\n - Added \"Testing Workflow\" section in Development Guidelines\n - Includes manual testing examples with BEADS_DB\n - Includes automated testing examples with t.TempDir()\n - Clear warning about not polluting production database\n\n3. ⚠️ Decided against bd test-mode command\n - BEADS_DB already provides simple, flexible isolation\n - Additional command would add complexity without much benefit\n - Current approach follows Unix philosophy (env vars for config)\n\n**Files modified:**\n- cmd/bd/create.go - Added Test prefix warning\n- AGENTS.md - Added Testing Workflow section\n\n**Testing:**\n- Verified warning appears when creating \"Test\" prefix issues\n- Verified BEADS_DB isolation works correctly\n- Built successfully with `go build`","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T16:07:28.255289-08:00","updated_at":"2025-11-07T23:18:08.386514-08:00","closed_at":"2025-11-07T22:43:28.669908-08:00"} +{"id":"bd-dvd","title":"GetNextChildID doesn't attempt parent resurrection from JSONL history","description":"When creating a child issue with --parent flag, GetNextChildID fails immediately if parent doesn't exist in DB, without attempting to resurrect it from JSONL history. This breaks the intended resurrection workflow and causes 'parent issue X does not exist' errors even when the parent exists in JSONL.\n\nRelated to GH #334 and #278.\n\nCurrent behavior:\n- GetNextChildID checks if parent exists in DB\n- If not found, returns error immediately\n- No resurrection attempt\n\nExpected behavior:\n- GetNextChildID should call TryResurrectParent before failing\n- Parent should be restored as tombstone if found in JSONL history\n- Child creation should succeed if resurrection succeeds\n\nImpact: Users cannot create child issues for parents that were deleted but exist in JSONL history.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:02:51.496365-05:00","updated_at":"2025-11-23T18:06:29.860124-08:00","closed_at":"2025-11-21T15:09:02.731171-05:00"} +{"id":"bd-c13f","title":"Add unit tests for parent resurrection","description":"Test resurrection with deleted parent (should succeed), resurrection with never-existed parent (should fail gracefully), multi-level resurrection (bd-abc.1.2 with both parents missing). Verify tombstone creation and is_tombstone flag.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.325335-08:00","updated_at":"2025-11-05T00:08:42.813728-08:00","closed_at":"2025-11-05T00:08:42.813731-08:00"} +{"id":"bd-na8r","title":"Improve AGENTS.md instructions for issue creation with descriptions","description":"## Solution: Better documentation\n\nUpdate AGENTS.md to emphasize including descriptions when creating issues.\n\n## Current State\n\nAGENTS.md line 176 shows:\n```bash\nbd create \"Issue title\" -t bug|feature|task -p 0-4 --json\n```\n\nAnd line 223-226 shows discovered-from example without description.\n\n## Proposed Changes\n\n### 1. Update all bd create examples to include --description\n\n```bash\nbd create \"Issue title\" --description=\"Detailed context\" -t bug -p 1 --json\n```\n\n### 2. Add explicit guidance in Issue Tracking section\n\nAdd after line 218 (Workflow section):\n\n\u003e **IMPORTANT: Always include descriptions when creating issues**\n\u003e \n\u003e Issues without descriptions lack context for future work. When creating issues, always include:\n\u003e - **Why** the issue exists (problem statement)\n\u003e - **What** needs to be done (scope)\n\u003e - **How** you discovered it (if applicable)\n\u003e\n\u003e Good: `bd create \"Fix auth bug\" --description=\"Login fails with 500 error when password contains special chars. Found during GH#123 work.\" -t bug -p 1`\n\u003e Bad: `bd create \"Fix auth bug\" -t bug -p 1`\n\n### 3. Update MCP tool docstring\n\nIn integrations/beads-mcp/src/beads_mcp/tools.py:363-367, change:\n```python\n\"\"\"Create a new issue.\n\nUse this when you discover new work during your session.\nLink it back with beads_add_dependency using 'discovered-from' type.\n\"\"\"\n```\n\nTo:\n```python\n\"\"\"Create a new issue.\n\nIMPORTANT: Always provide a meaningful description with context about:\n- Why this issue exists (problem/need)\n- What needs to be done\n- How you discovered it (if applicable)\n\nUse this when you discover new work during your session.\nLink it back with beads_add_dependency using 'discovered-from' type.\n\"\"\"\n```\n\n## Files to modify\n\n- AGENTS.md (lines 176, 218-226, throughout examples)\n- integrations/beads-mcp/src/beads_mcp/tools.py (line 363-367)\n- .github/copilot-instructions.md (if it has similar examples)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T14:01:00.079205-08:00","updated_at":"2025-11-23T14:04:03.191822-08:00","closed_at":"2025-11-23T14:04:03.191822-08:00","dependencies":[{"issue_id":"bd-na8r","depends_on_id":"bd-0tr0","type":"discovered-from","created_at":"2025-11-23T14:01:00.080937-08:00","created_by":"daemon"}]} +{"id":"bd-zqmb","title":"Fix goroutine leak in daemon restart","description":"Fire-and-forget goroutine in daemon restart leaks on every restart.\n\nLocation: cmd/bd/daemons.go:251\n\nProblem:\ngo func() { _ = daemonCmd.Wait() }()\n\n- Spawns goroutine without timeout or cancellation\n- If daemon command never completes, goroutine leaks forever\n- Each daemon restart leaks one more goroutine\n\nSolution: Add timeout and cleanup:\ngo func() {\n done := make(chan struct{})\n go func() {\n _ = daemonCmd.Wait()\n close(done)\n }()\n \n select {\n case \u003c-done:\n // Exited normally\n case \u003c-time.After(10 * time.Second):\n // Timeout - daemon should have forked by now\n _ = daemonCmd.Process.Kill()\n }\n}()\n\nImpact: Goroutine leak on every daemon restart\n\nEffort: 2 hours","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:52:01.897215-08:00","updated_at":"2025-11-16T15:04:00.497517-08:00","closed_at":"2025-11-16T15:04:00.497517-08:00"} +{"id":"bd-la9d","title":"Blocking issue","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.758706-05:00","updated_at":"2025-11-20T19:43:48.758706-05:00","closed_at":"2025-11-07T21:55:09.43148-08:00"} +{"id":"bd-f0d9bcf2","title":"Batch test 1","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:01.795728-07:00","updated_at":"2025-10-31T12:00:43.184078-07:00","closed_at":"2025-10-31T12:00:43.184078-07:00"} +{"id":"bd-35c7","title":"Add label-based filtering to bd ready command","description":"Allow filtering ready work by labels to help organize work by sprint, week, or category.\n\nExample usage:\n bd ready --label week1-2\n bd ready --label frontend,high-priority\n\nThis helps teams organize work into batches and makes it easier for agents to focus on specific categories of work.\n\nImplementation notes:\n- Add --label flag to ready command\n- Support comma-separated labels (AND logic)\n- Should work with existing ready work logic (unblocked issues)","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-03T18:10:18.976536-08:00","updated_at":"2025-11-03T22:27:30.614911-08:00","closed_at":"2025-11-03T22:27:30.614911-08:00"} +{"id":"bd-r79z","title":"GH#245: Windows MCP subprocess timeout for git rev-parse","description":"User reports git detection timing out on Windows in MCP server, but CLI works fine.\n\nPath: C:\\Users\\chris\\Documents\\DEV_R\\quarto-cli\nError: Git repository detection timed out after 5s\nWorks fine in CLI: `git rev-parse --show-toplevel` succeeds\n\nHypothesis: subprocess.run() with asyncio.to_thread() may have Windows-specific issues or the MCP runtime environment may not have proper PATH/git access.\n\nPotential fixes:\n1. Add subprocess shell=True on Windows\n2. Increase timeout further for Windows\n3. Add better error logging to capture subprocess stderr\n4. Skip git resolution entirely on timeout and just use provided path","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T16:31:37.531223-08:00","updated_at":"2025-11-07T19:00:44.358543-08:00","closed_at":"2025-11-07T19:00:44.358543-08:00"} +{"id":"bd-u4sb","title":"bd doctor should validate metadata.json version tracking","description":"bd doctor should check that metadata.json has the LastBdVersion field and that it's valid.\n\nChecks to add:\n- metadata.json exists and is valid JSON\n- LastBdVersion field is present\n- LastBdVersion is a valid semver-like string (or empty on first run)\n- Optionally warn if LastBdVersion is very old (\u003e 10 versions behind)\n\nThis helps ensure version tracking (bd-loka) is working correctly.\n\nRelated: bd-loka","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-23T17:19:08.140971-08:00","updated_at":"2025-11-23T17:27:54.857447-08:00","closed_at":"2025-11-23T17:27:54.857447-08:00"} +{"id":"bd-90v","title":"bd prime: AI context loading and Claude Code integration","description":"Implement `bd prime` command and Claude Code hooks for context recovery. Hooks work with BOTH MCP server and CLI approaches - they solve the context memory problem (keeping bd workflow fresh after compaction) not the tool access problem (MCP vs CLI).","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-11T23:31:12.119012-08:00","updated_at":"2025-11-12T00:11:07.743189-08:00"} +{"id":"bd-cbed9619.1","title":"Fix multi-round convergence for N-way collisions","description":"## Problem\n\nN-way collision resolution is working (IDs get remapped correctly), but clones don't fully converge after a single final pull. Each clone is missing some issues that other clones have.\n\nFrom TestFiveCloneCollision results:\n- Clone A has: A, B\n- Clone B has: A, B \n- Clone C has: A, B, C\n- Clone D has: A, B, C, D\n- Clone E has: A, B, C, E\n\n**Expected**: All clones should have A, B, C, D, E after final pull.\n\n## Root Cause\n\nThe current sync workflow does:\n1. Each clone syncs in order (resolving collisions locally)\n2. Final pull to get all changes\n\nBut the final pull itself may need import with collision resolution, which creates new commits. These new commits aren't propagated to other clones, so they remain incomplete.\n\n## Proposed Solution\n\n**Option 1: Multi-round final sync**\n- After final pull, do additional sync rounds until all clones converge\n- Check convergence by comparing issue counts or content hashes\n- Maximum N rounds for N clones\n\n**Option 2: Iterative pull-import-push**\n- Each clone: pull β†’ import with --resolve-collisions β†’ push\n- Repeat until no new changes\n- Guaranteed convergence but may create commit spam\n\n**Option 3: Fix auto-import to be truly idempotent**\n- Ensure importing same JSONL multiple times produces no new commits\n- May require smarter content-based deduplication\n\n## Acceptance Criteria\n\n- TestFiveCloneCollision passes without t.Skip\n- All N clones have all N issues after convergence\n- Convergence happens in bounded rounds (≀ N)\n- No data loss or duplication\n- Works for arbitrary N (tested with 5, 10 clones)\n\n## Impact\n\nThis is the final blocker for bd-cbed9619 epic completion.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T21:22:21.486109-07:00","updated_at":"2025-10-30T17:12:58.180996-07:00","closed_at":"2025-10-29T11:02:40.756891-07:00"} +{"id":"bd-5iv","title":"Test Epic","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-03T20:15:03.864229-08:00","updated_at":"2025-11-05T00:25:06.538749-08:00","closed_at":"2025-11-05T00:25:06.538749-08:00"} +{"id":"bd-6uix","title":"Message System Improvements","description":"Consolidate improvements to the bd message command including core functionality (message reading), reliability (timeouts), validation, and code quality refactoring","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-08T12:55:47.907771-08:00","updated_at":"2025-11-08T12:59:05.802367-08:00","closed_at":"2025-11-08T12:59:05.802367-08:00"} +{"id":"bd-cc03","title":"Build Node.js CLI wrapper for WASM","description":"Create npm package that wraps bd.wasm. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Set up npm package structure (package.json)\n- [ ] Implement CLI argument parsing\n- [ ] Load and execute WASM module\n- [ ] Handle stdout/stderr correctly\n- [ ] Support --json flag for all commands\n- [ ] Add bd-wasm bin script\n\n## Success Criteria\n- bd-wasm ready --json works identically to bd\n- All core commands supported","status":"closed","issue_type":"task","created_at":"2025-11-02T18:33:31.310268-08:00","updated_at":"2025-11-05T00:55:48.758194-08:00","closed_at":"2025-11-05T00:55:48.758198-08:00","dependencies":[{"issue_id":"bd-cc03","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.311017-08:00","created_by":"daemon"}]} +{"id":"bd-ykd9","title":"Add bd doctor --fix flag to automatically repair issues","description":"Implement a --fix flag for bd doctor that can automatically repair detected issues.\n\nRequirements:\n- Add --fix flag to bd doctor command\n- Show all fixable issues and prompt for confirmation before applying fixes\n- Organize fix implementations under doctor/fix/\u003ctype_of_fix\u003e.go\n- Each fix type should have its own file (e.g., doctor/fix/hooks.go, doctor/fix/sync.go)\n- Display what will be fixed and ask user to confirm (Y/n) before proceeding\n- Support fixing issues like:\n - Missing or broken git hooks\n - Sync problems with remote\n - File permission issues\n - Any other auto-repairable issues doctor detects\n\nImplementation notes:\n- Maintain separation between detection (existing doctor code) and repair (new fix code)\n- Each fix should be idempotent and safe to run multiple times\n- Provide clear output about what was fixed\n- Log any fixes that fail with actionable error messages","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-14T18:17:48.411264-08:00","updated_at":"2025-11-14T18:17:58.88609-08:00"} +{"id":"bd-2b34","title":"Refactor cmd/bd/daemon.go for testability and maintainability","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-31T22:28:19.689943-07:00","updated_at":"2025-11-01T19:20:28.102841-07:00","closed_at":"2025-11-01T19:20:28.102847-07:00"} +{"id":"bd-5b40a0bf","title":"Batch test 5","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:02.136118-07:00","updated_at":"2025-10-31T12:00:43.181513-07:00","closed_at":"2025-10-31T12:00:43.181513-07:00"} +{"id":"bd-2o2","title":"Add cancellation and timeout tests","description":"Add comprehensive tests for context cancellation and timeout behavior.\n\n## Context\nPart of context propagation work. Validates that bd-rtp and bd-yb8 work correctly.\n\n## Test Coverage Needed\n\n### 1. Cancellation Tests\n- [ ] Import operation cancelled mid-stream\n- [ ] Export operation cancelled mid-stream \n- [ ] Database query cancelled during long operation\n- [ ] No corruption after cancellation\n- [ ] Proper cleanup (defers execute, connections closed)\n\n### 2. Timeout Tests\n- [ ] Operations respect context deadlines\n- [ ] Appropriate error messages on timeout\n- [ ] State remains consistent after timeout\n\n### 3. Signal Handling Tests\n- [ ] SIGINT (Ctrl+C) triggers cancellation\n- [ ] SIGTERM triggers graceful shutdown\n- [ ] Multiple signals handled correctly\n\n## Implementation Approach\n```go\nfunc TestImportCancellation(t *testing.T) {\n ctx, cancel := context.WithCancel(context.Background())\n \n // Start import in goroutine\n go func() {\n err := runImport(ctx, largeFile)\n assert.Error(err, context.Canceled)\n }()\n \n // Cancel after short delay\n time.Sleep(100 * time.Millisecond)\n cancel()\n \n // Verify database integrity\n assertDatabaseConsistent(t, store)\n}\n```\n\n## Files to Create/Update\n- cmd/bd/import_test.go - cancellation tests\n- cmd/bd/export_test.go - cancellation tests\n- internal/storage/sqlite/*_test.go - context timeout tests\n\n## Acceptance Criteria\n- [ ] All critical operations have cancellation tests\n- [ ] Tests verify database integrity after cancellation\n- [ ] Signal handling tested (if feasible)\n- [ ] Test coverage \u003e80% for context paths","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:27:22.854636-05:00","updated_at":"2025-11-20T21:40:25.882758-05:00","closed_at":"2025-11-20T21:40:25.882758-05:00","dependencies":[{"issue_id":"bd-2o2","depends_on_id":"bd-yb8","type":"blocks","created_at":"2025-11-20T21:27:22.855574-05:00","created_by":"daemon"}]} +{"id":"bd-6049","title":"bd doctor --json flag not working","description":"The --json flag on bd doctor command doesn't produce JSON output. It continues to show human-readable output instead. The flag is registered locally on doctorCmd but the code uses the global jsonOutput variable set by PersistentPreRun. Need to investigate why the flag isn't being honored.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-02T17:08:18.170428-08:00","updated_at":"2025-11-02T18:41:01.376783-08:00","closed_at":"2025-11-02T18:41:01.376786-08:00"} +{"id":"bd-3e9ddc31","title":"Replace getStorageForRequest with Direct Access","description":"Replace all getStorageForRequest(req) calls with s.storage","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T23:20:10.393759-07:00","updated_at":"2025-10-30T17:12:58.21613-07:00","closed_at":"2025-10-28T14:08:38.06721-07:00"} +{"id":"bd-44d0","title":"WASM port of bd for Claude Code Web sandboxes","description":"Enable beads to work in Claude Code Web sandboxes by compiling bd to WebAssembly.\n\n## Problem\nClaude Code Web sandboxes cannot install bd CLI due to network restrictions:\n- GitHub releases return 403\n- go install fails with DNS errors\n- Binary cannot be downloaded\n\n## Solution\nCompile bd Go codebase to WASM, publish to npm as drop-in replacement.\n\n## Technical Approach\n- Use GOOS=js GOARCH=wasm to compile bd\n- modernc.org/sqlite already supports js/wasm target\n- Publish to npm as bd-wasm package\n- Full feature parity with bd CLI\n\n## Success Criteria\n- bd-wasm installs via npm in web sandbox\n- All core bd commands work identically\n- JSONL output matches native bd\n- Performance within 2x of native","notes":"WASM port abandoned - Claude Code Web has full VMs not browser restrictions. Better: npm + native binary","status":"closed","issue_type":"epic","created_at":"2025-11-02T18:32:27.660794-08:00","updated_at":"2025-11-02T23:36:38.679515-08:00","closed_at":"2025-11-02T23:36:38.679515-08:00"} +{"id":"bd-19er","title":"Create backup and restore procedures","description":"Disaster recovery procedures for Agent Mail data.\n\nAcceptance Criteria:\n- Automated daily snapshots (GCP persistent disk)\n- SQLite backup script\n- Git repository backup\n- Restore procedure documentation\n- Test restore from backup\n\nFile: deployment/agent-mail/backup.sh","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.417403-08:00","updated_at":"2025-11-07T22:43:43.417403-08:00","dependencies":[{"issue_id":"bd-19er","depends_on_id":"bd-z3s3","type":"blocks","created_at":"2025-11-07T23:04:28.122501-08:00","created_by":"daemon"}]} +{"id":"bd-8b65","title":"Add depth-based batch creation in upsertIssues","description":"Replace single batch creation with depth-level batching (max depth 3). Create issues at depth 0, then 1, then 2, then 3. Prevents parent validation errors when importing hierarchical issues in same batch. File: internal/importer/importer.go:534-546","status":"closed","issue_type":"task","created_at":"2025-11-04T12:31:42.267746-08:00","updated_at":"2025-11-05T00:08:42.813239-08:00","closed_at":"2025-11-05T00:08:42.813246-08:00"} +{"id":"bd-0kz8","title":"Fix default .beads/.gitignore to ignore merge artifacts (GH #274)","description":"Updated the default .gitignore template created by `bd init` to properly ignore merge artifacts and fix overly broad patterns.\n\nChanges:\n- Added `*.db?*` pattern for database files with query strings\n- Added explicit patterns for merge artifacts: beads.{base,left,right}.{jsonl,meta.json}\n- Changed `!*.jsonl` to `!issues.jsonl` to avoid including merge artifact JSONL files\n\nThis fixes GitHub issue #274 reported by rscorer.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-09T11:23:25.595551-08:00","updated_at":"2025-11-09T11:23:28.780095-08:00","closed_at":"2025-11-09T11:23:28.780095-08:00"} +{"id":"bd-hw3c","title":"Fix GH #227: bd edit broken pipe errors","description":"bd edit command gets \"broken pipe\" errors when using daemon mode because editing can take minutes and the daemon connection times out.\n\nSolution: Force bd edit to always use direct mode (--no-daemon) since it's human-only and interactive.\n\nFixed by checking cmd.Name() == \"edit\" in main.go PersistentPreRun and setting noDaemon = true.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-05T14:36:04.289431-08:00","updated_at":"2025-11-05T14:36:08.103964-08:00","closed_at":"2025-11-05T14:36:08.103964-08:00"} +{"id":"bd-yek6","title":"CLI tests (cli_fast_test.go) are slow and should be integration tests","description":"The TestCLI_* tests in cmd/bd/cli_fast_test.go are taking 4-5 seconds each (40+ seconds total), making them the slowest part of the fast test suite.\n\nCurrent timings:\n- TestCLI_Import: 4.73s\n- TestCLI_Blocked: 4.33s \n- TestCLI_DepTree: 4.15s\n- TestCLI_Close: 3.59s\n- TestCLI_DepAdd: 3.50s\n- etc.\n\nThese tests compile the bd binary once in init(), but then execute it multiple times per test with filesystem operations. Despite being named \"fast\", they're actually end-to-end CLI integration tests.\n\nOptions:\n1. Tag with //go:build integration (move to integration suite)\n2. Optimize: Use in-memory databases, reduce exec calls, better parallelization\n3. Keep as-is but understand they're the baseline for \"fast\" tests\n\nTotal test suite currently: 13.8s (cmd/bd alone is 12.8s, and most of that is these CLI tests)","notes":"Fixed by reusing existing bd binary from repo root instead of rebuilding.\n\nBefore: 15+ minutes (rebuilding binary for every test package)\nAfter: ~12 seconds (reuses pre-built binary)\n\nThe init() function now checks for ../../bd first before falling back to building. This means `go build \u0026\u0026 go test` is now fast.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T20:19:12.822543-08:00","updated_at":"2025-11-05T20:31:19.321787-08:00","closed_at":"2025-11-05T20:31:19.321787-08:00"} +{"id":"bd-by3x","title":"Windows binaries lack SQLite support (GH #253)","description":"Windows users installing via install.ps1 get \"sql: unknown driver sqlite\" error. Root cause: GoReleaser was building with CGO_ENABLED=0, which excludes SQLite driver.\n\nFixed by:\n1. Enabling CGO in .goreleaser.yml\n2. Installing MinGW cross-compiler in release workflow\n3. Splitting builds per platform to set correct CC for Windows\n\nNeeds new release to fix for users.","status":"closed","issue_type":"bug","created_at":"2025-11-07T15:54:13.134815-08:00","updated_at":"2025-11-07T15:55:07.024156-08:00","closed_at":"2025-11-07T15:55:07.024156-08:00"} +{"id":"bd-xzrv","title":"Write Agent Mail integration guide","description":"Comprehensive guide for setting up and using Agent Mail with Beads.\n\nAcceptance Criteria:\n- Installation instructions\n- Configuration (environment variables)\n- Architecture diagram\n- Benefits and tradeoffs\n- When to use vs not use\n- Troubleshooting section\n- Migration from git-only mode\n\nFile: docs/AGENT_MAIL.md\n\nSections:\n- Quick start\n- How it works\n- Integration points\n- Graceful degradation\n- Multi-machine deployment\n- FAQ","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:51.231066-08:00","updated_at":"2025-11-08T00:40:38.798162-08:00","closed_at":"2025-11-08T00:40:38.798162-08:00","dependencies":[{"issue_id":"bd-xzrv","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:42:51.232246-08:00","created_by":"daemon"}]} +{"id":"bd-5f483051","title":"Implement bd resolve-conflicts (git merge conflicts in JSONL)","description":"Automatically detect and resolve git merge conflicts in .beads/issues.jsonl file.\n\nFeatures:\n- Detect conflict markers in JSONL\n- Parse conflicting issues from HEAD and BASE\n- Provide mechanical resolution (remap duplicate IDs)\n- Support AI-assisted resolution (requires internal/ai package)\n\nSee repair_commands.md lines 125-353 for design.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T19:37:55.722827-07:00","updated_at":"2025-11-06T19:36:13.970903-08:00","closed_at":"2025-11-06T19:26:45.397628-08:00"} +{"id":"bd-ktng","title":"Optimize CLI test suite - eliminate redundant git init calls","description":"Current: Each of 13 CLI tests calls git init (31s total). Solution: Use single test binary built once in init(), skip git operations where possible, or use mock filesystem.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-04T11:23:13.660276-08:00","updated_at":"2025-11-04T11:23:13.660276-08:00","dependencies":[{"issue_id":"bd-ktng","depends_on_id":"bd-l5gq","type":"discovered-from","created_at":"2025-11-04T11:23:13.662102-08:00","created_by":"daemon"}]} +{"id":"bd-bgca","title":"Latency test manual","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-08T00:04:25.028223-08:00","updated_at":"2025-11-08T00:06:46.169654-08:00","closed_at":"2025-11-08T00:06:46.169654-08:00"} +{"id":"bd-4oqu.2","title":"Test child daemon mode","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T13:01:06.642305-08:00","updated_at":"2025-11-05T13:01:11.669369-08:00","closed_at":"2025-11-05T13:01:11.669369-08:00"} +{"id":"bd-a40f374f","title":"bd validate - Comprehensive health check","description":"Run all validation checks in one command.\n\nChecks:\n- Duplicates\n- Orphaned dependencies\n- Test pollution\n- Git conflicts\n\nSupports --fix-all for auto-repair.\n\nDepends on bd-cbed9619.1, bd-0dcea000, bd-31aab707, bd-9826b69a.\n\nFiles: cmd/bd/validate.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T12:40:11.708313-05:00","updated_at":"2025-11-20T12:40:11.708313-05:00","closed_at":"2025-10-29T20:02:15.318966-07:00"} +{"id":"bd-81abb639","title":"Investigate jujutsu VCS as potential solution for conflict-free merging","description":"## Context\nCurrent N-way collision resolution struggles with Git line-based merge model. When 5+ clones create issues with same ID, Git merge conflicts require manual resolution, and our collision resolver can fail during convergence rounds.\n\n## Research Question\nCould jujutsu (jj) provide better conflict handling for JSONL files?\n\n## Jujutsu Overview\n- Next-gen VCS built on libgit2\n- Designed to handle conflicts as first-class citizens\n- Supports conflict-free replicated data types (CRDTs) in some scenarios\n- Better handling of concurrent edits\n- Can work with Git repos (compatible with existing infrastructure)\n\n## Investigation Tasks\n1. JSONL Merge Behavior - How does jj handle line-by-line JSONL conflicts?\n2. Integration Feasibility - Can beads use jj as backend while maintaining Git compatibility?\n3. Conflict Resolution Model - Does jj conflict model map to our collision resolution?\n4. Operational Transform Support - Does jj implement operational transforms?\n\n## Deliverables\n1. Technical report on jj merge algorithm for JSONL\n2. Proof-of-concept: 5-clone collision test using jj instead of Git\n3. Performance comparison: Git vs jj for beads workload\n4. Recommendation: Adopt, experiment further, or abandon\n\n## References\n- https://github.com/martinvonz/jj\n- Related to bd-e6d71828, bd-7a2b58fc","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T20:02:47.953008-07:00","updated_at":"2025-10-30T17:12:58.19464-07:00","closed_at":"2025-10-29T20:47:52.910985-07:00"} +{"id":"bd-0702","title":"Consolidate ID generation and validation into ids.go","description":"Extract ID logic into ids.go: ValidateIssueIDPrefix, GenerateIssueID, EnsureIDs. Move GetAdaptiveIDLength here. Unify single and bulk ID generation flows.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.877886-07:00","updated_at":"2025-11-02T15:28:11.996618-08:00","closed_at":"2025-11-02T15:28:11.996624-08:00"} +{"id":"bd-g5p7","title":"Extract duplicated validation logic from CLI commands","description":"~150 lines of identical validation logic duplicated between cmd_create.go and cmd_update.go\n\nDuplication found:\n- validateBeadFields(): 2 identical copies (50+ lines each) \n- parseTimeWithDefault(): 2 identical copies (30 lines each)\n- Flag definitions: 15+ duplicate registrations\n\nSolution: Extract to shared packages:\n- internal/validation/bead.go - Centralized validation\n- internal/utils/time.go - Consolidate time parsing (already exists)\n- cmd/bd/flags.go - Shared flag registration\n\nImpact: Changes require touching 2+ files; high risk of inconsistency; steep learning curve\n\nEffort: 4-6 hours","status":"closed","issue_type":"task","created_at":"2025-11-16T14:51:10.159953-08:00","updated_at":"2025-11-21T10:59:00.408364-05:00","closed_at":"2025-11-20T20:39:34.426726-05:00"} +{"id":"bd-ce37850f","title":"Add embedding generation for duplicate detection","description":"Use embeddings for scalable duplicate detection.\n\nModel: text-embedding-3-small (OpenAI) or all-MiniLM-L6-v2 (local)\nStorage: SQLite vector extension or in-memory\nCost: ~/bin/bash.0002 per 100 issues\n\nMuch cheaper than LLM comparisons for large databases.\n\nFiles: internal/embeddings/ (new package)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T14:48:29.072913-07:00","updated_at":"2025-11-06T19:36:13.972562-08:00","closed_at":"2025-11-06T19:27:25.234801-08:00"} +{"id":"bd-yxy","title":"Add command injection prevention tests for git rm in merge command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/merge.go:121, exec.Command is called with variable fullPath, flagged by gosec G204 for potential command injection.\n\nAdd tests covering:\n- File paths with shell metacharacters (;, |, \u0026, $, etc.)\n- Paths with spaces and special characters\n- Paths attempting command injection (e.g., 'file; rm -rf /')\n- Validation that fullPath is properly sanitized\n- Only valid git-tracked files can be removed\n\nThis is a critical security path preventing arbitrary command execution.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","issue_type":"task","created_at":"2025-11-21T10:25:33.531631-05:00","updated_at":"2025-11-23T18:06:29.858965-08:00","closed_at":"2025-11-21T19:31:21.853136-05:00","dependencies":[{"issue_id":"bd-yxy","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.533126-05:00","created_by":"ai-supervisor"}]} +{"id":"bd-149","title":"Auth tokens expire too quickly","description":"## Summary\n\n[Brief description of the bug]\n\n## Steps to Reproduce\n\n1. Step 1\n2. Step 2\n3. Step 3\n\n## Expected Behavior\n\n[What should happen]\n\n## Actual Behavior\n\n[What actually happens]\n\n## Environment\n\n- OS: [e.g., macOS 15.7.1]\n- Version: [e.g., bd 0.20.1]\n- Additional context: [any relevant details]\n\n## Additional Context\n\n[Screenshots, logs, or other relevant information]\n","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-03T19:54:10.671488-08:00","updated_at":"2025-11-05T00:25:06.427601-08:00","closed_at":"2025-11-05T00:25:06.427601-08:00"} +{"id":"bd-4h3","title":"Add test coverage for internal/git package","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:23.497486-05:00","updated_at":"2025-11-20T21:21:23.497486-05:00","dependencies":[{"issue_id":"bd-4h3","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.277639-05:00","created_by":"daemon"}]} +{"id":"bd-n25","title":"Speed up main_test.go - tests hang indefinitely due to nil rootCtx","description":"## Problem\n\nmain_test.go tests are hanging indefinitely, making them unusable and blocking development.\n\n## Root Cause\n\nTests that call flushToJSONL() or autoImportIfNewer() hang forever because:\n- rootCtx is nil in test environment (defined in cmd/bd/main.go:67)\n- flushToJSONL() uses rootCtx for DB operations (autoflush.go:503)\n- When rootCtx is nil, DB calls timeout/hang indefinitely\n\n## Affected Tests (10+)\n\n- TestAutoFlushOnExit\n- TestAutoFlushJSONLContent \n- TestAutoFlushErrorHandling\n- TestAutoImportIfNewer\n- TestAutoImportDisabled\n- TestAutoImportWithUpdate\n- TestAutoImportNoUpdate\n- TestAutoImportMergeConflict\n- TestAutoImportConflictMarkerFalsePositive\n- TestAutoImportClosedAtInvariant\n\n## Proof\n\n```bash\n# Before fix: TestAutoFlushJSONLContent HANGS (killed after 2+ min)\n# After adding rootCtx init: Completes in 0.04s\n# Speedup: ∞ β†’ 0.04s\n```\n\n## Solution\n\nSee MAIN_TEST_OPTIMIZATION_PLAN.md for complete fix plan.\n\n**Quick Fix (5 min)**: Add to each hanging test:\n```go\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\noldRootCtx := rootCtx\nrootCtx = ctx\ndefer func() { rootCtx = oldRootCtx }()\n```\n\n**Full Optimization (40 min total)**:\n1. Fix rootCtx (5 min) - unblocks tests\n2. Reduce sleep durations 10x (2 min) - saves ~280ms\n3. Use in-memory DBs (10 min) - saves ~1s\n4. Share test fixtures (15 min) - saves ~1.2s\n5. Fix skipped debounce test (5 min)\n\n## Expected Results\n\n- Tests go from hanging β†’ \u003c5s total runtime\n- Keep critical integration test coverage\n- Tests caught real bugs: bd-270, bd-206, bd-160\n\n## Files\n\n- Analysis: MAIN_TEST_REFACTOR_NOTES.md\n- Solution: MAIN_TEST_OPTIMIZATION_PLAN.md\n- Tests: cmd/bd/main_test.go (18 tests, 1322 LOC)\n\n## Priority\n\nP1 - Blocking development, tests unusable in current state","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T18:27:48.942814-05:00","updated_at":"2025-11-21T18:44:21.944901-05:00","closed_at":"2025-11-21T18:44:21.944901-05:00"} +{"id":"bd-ymj","title":"Export doesn't update last_import_hash metadata causing perpetual 'JSONL content has changed' errors","description":"After a successful export, the daemon doesn't update last_import_hash or last_import_mtime metadata. This causes hasJSONLChanged to return true on the next export attempt, blocking with 'refusing to export: JSONL content has changed since last import'.\n\nRelated to GH #334.\n\nScenario:\n1. Daemon exports successfully β†’ JSONL updated, hash changes\n2. Metadata NOT updated (last_import_hash still points to old hash)\n3. Next mutation triggers export\n4. validatePreExport calls hasJSONLChanged\n5. hasJSONLChanged sees current JSONL hash != last_import_hash\n6. Export blocked with 'JSONL content has changed since last import'\n7. Issue stuck: can't export, can't make progress\n\nThis creates a catch-22 where the system thinks JSONL changed externally when it was the daemon itself that changed it.\n\nCurrent behavior:\n- Import updates metadata (import.go:310-336)\n- Export does NOT update metadata (daemon_sync.go:307)\n- Result: metadata becomes stale after every export","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:05:34.871333-05:00","updated_at":"2025-11-23T18:06:29.856397-08:00","closed_at":"2025-11-21T15:09:04.016651-05:00","dependencies":[{"issue_id":"bd-ymj","depends_on_id":"bd-dvd","type":"related","created_at":"2025-11-21T10:06:11.462508-05:00","created_by":"daemon"}]} +{"id":"bd-d4i","title":"Create tip system infrastructure for contextual hints","description":"Implement a tip/hint system that shows helpful contextual messages after successful commands. This is different from the existing error-path \"Hint:\" messages - tips appear on success paths to educate users about features they might not know about.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:29:15.693956-08:00","updated_at":"2025-11-11T23:49:50.812933-08:00"} +{"id":"bd-htfk","title":"Measure notification latency vs git sync","description":"Benchmark end-to-end latency for status updates to propagate between agents using both methods.\n\nAcceptance Criteria:\n- Measure git sync latency (commit β†’ push β†’ pull β†’ import)\n- Measure Agent Mail latency (send_message β†’ fetch_inbox)\n- Document latency distribution (p50, p95, p99)\n- Verify \u003c100ms claim for Agent Mail\n- Compare against 1-5s baseline for git\n\nSuccess Metric: Agent Mail latency \u003c 100ms, git sync latency \u003e 1000ms","notes":"Latency benchmark completed. Results documented in latency_results.md:\n- Git sync: 2000-5000ms (full cycle with network)\n- Agent Mail: \u003c100ms (HTTP API round-trip)\n- Confirms 20-50x latency reduction claim","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:00.031959-08:00","updated_at":"2025-11-08T00:05:02.04159-08:00","closed_at":"2025-11-08T00:05:02.04159-08:00","dependencies":[{"issue_id":"bd-htfk","depends_on_id":"bd-muls","type":"blocks","created_at":"2025-11-07T23:03:52.969505-08:00","created_by":"daemon"},{"issue_id":"bd-htfk","depends_on_id":"bd-spmx","type":"parent-child","created_at":"2025-11-08T00:02:47.918425-08:00","created_by":"daemon"}]} +{"id":"bd-eef03e0a","title":"Stress test: event storm handling","description":"Simulate 100+ rapid JSONL writes. Verify debouncer batches to single import. Verify no data loss. Test daemon stability.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.138725-07:00","updated_at":"2025-10-31T19:18:50.682925-07:00","closed_at":"2025-10-31T19:18:50.682925-07:00"} +{"id":"bd-iq7n","title":"Audit and fix JSONL filename mismatches across all repo clones","description":"## Problem\n\nMultiple clones of repos are configured with different JSONL filenames (issues.jsonl vs beads.jsonl), causing:\n1. JSONL files to be resurrected after deletion (one clone pushes issues.jsonl, another pushes beads.jsonl)\n2. Agents unable to see issues filed by other agents after sync\n3. Merge conflicts and data inconsistencies\n\n## Root Cause\n\nWhen repos were \"bd doctored\" or initialized at different times, some got issues.jsonl (old default) and others got beads.jsonl (Beads repo specific). These clones push their respective files, creating duplicates.\n\n## Task\n\nScan all repo clones under ~/src/ (1-2 levels deep) and standardize their JSONL configuration.\n\n### Step 1: Find all beads-enabled repos\n\n```bash\n# Find all directories named 'beads' at levels 1-2 under ~/src/\nfind ~/src -maxdepth 2 -type d -name beads\n```\n\n### Step 2: For each repo found, check configuration\n\nFor each directory from Step 1, check:\n- Does `.beads/metadata.json` exist?\n- What is the `jsonl_export` value?\n- What JSONL files actually exist in `.beads/`?\n- Are there multiple JSONL files (problem!)?\n\n### Step 3: Create audit report\n\nGenerate a report showing:\n```\nRepo Path | Config | Actual Files | Status\n----------------------------------- | ------------- | ---------------------- | --------\n~/src/beads | beads.jsonl | beads.jsonl | OK\n~/src/dave/beads | issues.jsonl | issues.jsonl | MISMATCH\n~/src/emma/beads | issues.jsonl | issues.jsonl, beads.jsonl | DUPLICATE!\n```\n\n### Step 4: Determine canonical name for each repo\n\nFor repos that are the SAME git repository (check `git remote -v`):\n- Group them together\n- Determine which JSONL filename should be canonical (majority wins, or beads.jsonl for the beads repo itself)\n- List which clones need to be updated\n\n### Step 5: Generate fix script\n\nCreate a script that for each mismatched clone:\n1. Updates `.beads/metadata.json` to use the canonical name\n2. If JSONL file needs renaming: `git mv .beads/old.jsonl .beads/new.jsonl`\n3. Removes any duplicate JSONL files: `git rm .beads/duplicate.jsonl`\n4. Commits the change\n5. Syncs: `bd sync`\n\n### Expected Output\n\n1. Audit report showing all repos and their config status\n2. List of repos grouped by git remote (same repository)\n3. Fix script or manual instructions for standardizing each repo\n4. Verification that after fixes, all clones of the same repo use the same JSONL filename\n\n### Edge Cases\n\n- Handle repos without metadata.json (use default discovery)\n- Handle repos with no git remote (standalone/local)\n- Handle repos that are not git repositories\n- Don't modify repos with uncommitted changes (warn instead)\n\n### Success Criteria\n\n- All clones of the same git repository use the same JSONL filename\n- No duplicate JSONL files in any repo\n- All configurations documented in metadata.json\n- bd doctor passes on all repos","status":"open","issue_type":"task","created_at":"2025-11-21T23:58:35.044762-08:00","updated_at":"2025-11-21T23:58:35.044762-08:00"} +{"id":"bd-dxdn","title":"bd ready taking 5 seconds with 132 issues (89 closed)","description":"User reports bd ready is annoyingly slow on M2 Mac - 5 seconds for 132 issues (89 closed). Started noticing after hash-based IDs update. Need to investigate performance regression. Reported in GH #243.","notes":"Root cause identified: Not a query performance issue, but stale daemon locks causing 5s timeout delays.\n\nFixed in bd-ndyz (closed) via 5 sub-issues:\n- bd-expt: Fast-fail socket checks (200ms timeout)\n- bd-wgu4: Lock probe before RPC attempts\n- bd-1mzt: Self-heal stale artifacts\n- bd-vcg5: Panic recovery + socket cleanup\n- bd-j7e2: RPC diagnostics (BD_RPC_DEBUG)\n\nAll fixes merged. Ready for v0.22.2 release.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T00:26:30.359512-08:00","updated_at":"2025-11-08T13:17:08.766029-08:00","closed_at":"2025-11-08T02:35:47.956638-08:00"} +{"id":"bd-1yi5","title":"Use -short flag in CI for PR checks","description":"Update CI configuration to use -short flag for PR checks, run full tests nightly.\n\nThe slow tests already support testing.Short() and will be skipped.\n\nExpected savings: ~20 seconds for PR checks (fast tests only)\n\nImplementation:\n- Update .github/workflows/ci.yml to add -short flag for PR tests\n- Create/update nightly workflow for full test runs\n- Update README/docs about test strategy\n\nFile: .github/workflows/ci.yml:30","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T01:24:17.279618-08:00","updated_at":"2025-11-04T10:25:10.616119-08:00","closed_at":"2025-11-04T10:25:10.616119-08:00","dependencies":[{"issue_id":"bd-1yi5","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:17.280453-08:00","created_by":"daemon"}]} +{"id":"bd-it3x","title":"Issue with labels","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T19:07:18.388873-08:00","updated_at":"2025-11-07T22:07:17.346541-08:00","closed_at":"2025-11-07T21:55:09.429989-08:00"} +{"id":"bd-f8b764c9.13","title":"Add bd alias command for manual alias control","description":"Add command for users to manually view and reassign aliases.\n\n## Command: bd alias\n\n### Subcommands\n\n#### 1. bd alias list\nShow all alias mappings:\n```bash\n$ bd alias list\n#1 β†’ bd-af78e9a2 Fix authentication bug\n#2 β†’ bd-e5f6a7b8 Add logging to daemon\n#42 β†’ bd-1a2b3c4d Investigate jujutsu integration\n#100 β†’ bd-9a8b7c6d (reassigned after conflict)\n```\n\n#### 2. bd alias set \u003calias\u003e \u003chash-id\u003e\nManually assign alias to specific issue:\n```bash\n$ bd alias set 42 bd-1a2b3c4d\nβœ“ Assigned alias #42 to bd-1a2b3c4d\n\n$ bd alias set 1 bd-af78e9a2\nβœ— Error: Alias #1 already assigned to bd-e5f6a7b8\nUse --force to override\n```\n\n#### 3. bd alias compact\nRenumber all aliases to fill gaps:\n```bash\n$ bd alias compact [--dry-run]\n\nCurrent aliases: #1, #2, #5, #7, #100, #101\nAfter compacting: #1, #2, #3, #4, #5, #6\n\nRenumbering:\n #5 β†’ #3\n #7 β†’ #4\n #100 β†’ #5\n #101 β†’ #6\n\nApply changes? [y/N]\n```\n\n#### 4. bd alias reset\nRegenerate all aliases (sequential from 1):\n```bash\n$ bd alias reset [--sort-by=priority|created|id]\n\nWARNING: This will reassign ALL aliases. Continue? [y/N]\n\nReassigning 150 issues by priority:\n bd-a1b2c3d4 β†’ #1 (P0: Critical security bug)\n bd-e5f6a7b8 β†’ #2 (P0: Data loss fix)\n bd-1a2b3c4d β†’ #3 (P1: Jujutsu integration)\n ...\n```\n\n#### 5. bd alias find \u003chash-id\u003e\nLook up alias for hash ID:\n```bash\n$ bd alias find bd-af78e9a2\n#1\n\n$ bd alias find bd-nonexistent\nβœ— Error: Issue not found\n```\n\n## Use Cases\n\n### 1. Keep Important Issues Low-Numbered\n```bash\n# After closing many P0 issues, compact to free low numbers\nbd alias compact\n\n# Or manually set\nbd alias set 1 bd-\u003ccritical-bug-hash\u003e\n```\n\n### 2. Consistent Aliases Across Clones\n```bash\n# After migration, coordinator assigns canonical aliases\nbd alias reset --sort-by=id\ngit add .beads/aliases.jsonl\ngit commit -m \"Canonical alias assignments\"\ngit push\n\n# Other clones pull and adopt\ngit pull\nbd import # Alias conflicts resolved automatically\n```\n\n### 3. Debug Alias Conflicts\n```bash\n# See which aliases were reassigned\nbd alias list | grep \"#100\"\n```\n\n## Flags\n\n### Global\n- `--dry-run`: Preview changes without applying\n- `--force`: Override existing alias assignments\n\n### bd alias reset\n- `--sort-by=priority`: Assign by priority (P0 first)\n- `--sort-by=created`: Assign by creation time (oldest first)\n- `--sort-by=id`: Assign by hash ID (lexicographic)\n\n## Implementation\n\nFile: cmd/bd/alias.go\n```go\nfunc aliasListCmd() *cobra.Command {\n return \u0026cobra.Command{\n Use: \"list\",\n Short: \"List all alias mappings\",\n Run: func(cmd *cobra.Command, args []string) {\n aliases := storage.GetAllAliases()\n for _, a := range aliases {\n fmt.Printf(\"#%-4d β†’ %s %s\\n\", \n a.Alias, a.IssueID, a.Title)\n }\n },\n }\n}\n\nfunc aliasSetCmd() *cobra.Command {\n return \u0026cobra.Command{\n Use: \"set \u003calias\u003e \u003chash-id\u003e\",\n Short: \"Manually assign alias to issue\",\n Args: cobra.ExactArgs(2),\n Run: func(cmd *cobra.Command, args []string) {\n alias, _ := strconv.Atoi(args[0])\n hashID := args[1]\n \n force, _ := cmd.Flags().GetBool(\"force\")\n if err := storage.SetAlias(alias, hashID, force); err != nil {\n fmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n os.Exit(1)\n }\n fmt.Printf(\"βœ“ Assigned alias #%d to %s\\n\", alias, hashID)\n },\n }\n}\n```\n\n## Files to Create\n- cmd/bd/alias.go\n\n## Testing\n- Test alias list output\n- Test alias set with/without force\n- Test alias compact removes gaps\n- Test alias reset with different sort orders\n- Test alias find lookup","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T21:26:53.751795-07:00","updated_at":"2025-10-31T12:32:32.611358-07:00","closed_at":"2025-10-31T12:32:32.611358-07:00","dependencies":[{"issue_id":"bd-f8b764c9.13","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:26:53.753259-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.13","depends_on_id":"bd-f8b764c9.7","type":"blocks","created_at":"2025-10-29T21:26:53.753733-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.13","depends_on_id":"bd-f8b764c9.6","type":"blocks","created_at":"2025-10-29T21:26:53.754112-07:00","created_by":"stevey"}]} +{"id":"bd-5a90","title":"Test parent issue","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-02T11:50:35.85367-08:00","updated_at":"2025-11-02T11:50:35.85367-08:00"} +{"id":"bd-caa9","title":"Migration tool for existing users","description":"Ensure smooth migration for existing users to separate branch workflow.\n\nTasks:\n- Add bd migrate --separate-branch command\n- Detect existing repos, migrate cleanly\n- Preserve git history\n- Add rollback mechanism\n- Test migration on beads' own repo (dogfooding)\n- Communication plan (GitHub discussion, docs)\n- Version compatibility checks\n\nEstimated effort: 2-3 days","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.627388-08:00","updated_at":"2025-11-04T12:36:53.789201-08:00","closed_at":"2025-11-04T12:36:53.789201-08:00","dependencies":[{"issue_id":"bd-caa9","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.382619-08:00","created_by":"stevey"}]} +{"id":"bd-e8be4224","title":"Batch test 3","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:01.964091-07:00","updated_at":"2025-10-31T12:00:43.183212-07:00","closed_at":"2025-10-31T12:00:43.183212-07:00"} +{"id":"bd-5qim","title":"Optimize GetReadyWork performance - 752ms on 10K database (target: \u003c50ms)","notes":"# Performance Analysis (10K Issue Database)\n\nAnalyzed using CPU profiles from benchmark suite on Apple M2 Pro.\n\n## Operation Performance\n\n| Operation | Time | Allocations | Memory |\n|----------------------------------|---------|-------------|--------|\n| bd ready (GetReadyWork) | ~752ms | 167,466 | 16MB |\n| bd list (SearchIssues no filter) | ~11.6ms | 89,214 | 5.8MB |\n| bd list (SearchIssues filtered) | ~9.2ms | 62,365 | 3.5MB |\n| bd create (CreateIssue) | ~2.6ms | 146 | 8.6KB |\n| bd update (UpdateIssue) | ~0.32ms | 364 | 15KB |\n| bd close (UpdateIssue) | ~0.32ms | 364 | 15KB |\n\n**Target: \u003c50ms for all operations on 10K database**\n\n**Current issue: GetReadyWork is 15x over target (752ms vs 50ms)**\n\n## Root Cause\n\nGetReadyWork (internal/storage/sqlite/ready.go:90-128) uses recursive CTE to propagate blocking:\n- 65x slower than SearchIssues\n- Recalculates entire blocked issue tree on every call\n- Algorithm:\n 1. Find directly blocked issues via 'blocks' dependencies\n 2. Recursively propagate blockage to descendants (max depth: 50)\n 3. Exclude all blocked issues from results\n\n## CPU Profile Analysis\n\n- Database syscalls (pthread_cond_signal, syscall6): ~75%\n- SQLite engine overhead: inherent to recursive CTE\n- Application code (query construction): \u003c1%\n\n**Bottleneck is the recursive CTE query execution, not application code.**\n\n## Optimization Recommendations\n\n### High Impact (Likely to achieve \u003c50ms target)\n\n1. **Cache blocked issue calculation**\n - Add `blocked_issues` table updated on dependency changes\n - Trade write complexity for read speed (ready called \u003e\u003e dependency changes)\n - Eliminates recursive CTE on every read\n\n2. **Add/verify database indexes**\n ```sql\n CREATE INDEX IF NOT EXISTS idx_dependencies_blocked \n ON dependencies(issue_id, type, depends_on_id);\n CREATE INDEX IF NOT EXISTS idx_issues_status \n ON issues(status);\n ```\n\n### Medium Impact\n\n3. **Reduce allocations** (167K allocations for GetReadyWork)\n - Profile `scanIssues()` for object pooling opportunities\n - Reuse slice capacity for repeated calls\n\n### Low Impact (Not recommended)\n- Query optimization for CRUD operations (already \u003c3ms)\n- Connection pooling tuning (not showing in profiles)\n\n## Verification\n\nRun benchmarks to validate optimization:\n```bash\nmake bench-quick\ngo tool pprof -http=:8080 internal/storage/sqlite/bench-cpu-*.prof\n```\n\nProfile files automatically generated in `internal/storage/sqlite/`.","status":"open","issue_type":"bug","created_at":"2025-11-14T09:02:46.507526-08:00","updated_at":"2025-11-14T09:03:44.073236-08:00"} +{"id":"bd-c3ei","title":"Migration guide documentation","description":"Write comprehensive migration guide covering: OSS contributor workflow, team workflow, multi-phase development, multiple personas. Include step-by-step instructions, troubleshooting, and backward compatibility notes.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:29.84662-08:00","updated_at":"2025-11-05T18:12:30.907835-08:00","closed_at":"2025-11-05T18:12:30.907835-08:00","dependencies":[{"issue_id":"bd-c3ei","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.028291-08:00","created_by":"daemon"}]} +{"id":"bd-wta","title":"Add performance benchmarks for multi-repo hydration","description":"The contributor-workflow-analysis.md asserts sub-second queries (line 702) and describes smart caching via file mtime tracking (Decision #4, lines 584-618), but doesn't provide concrete performance benchmarks.\n\nVC's requirement (from VC feedback section):\n- Executor polls GetReadyWork() every 5-10 seconds\n- Queries must be sub-second (ideally \u003c100ms)\n- Smart caching must avoid re-parsing JSONLs on every query\n\nSuggested performance targets to validate:\n- File stat overhead: \u003c1ms per repo\n- Hydration (when needed): \u003c500ms for typical JSONL (\u003c25k)\n- Query (from cache): \u003c10ms\n- Total GetReadyWork(): \u003c100ms (VC's requirement)\n\nAlso test at scale:\n- N=1 repo (baseline)\n- N=3 repos (typical)\n- N=10 repos (edge case)\n\nThese benchmarks are critical for library consumers like VC that run automated polling loops.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:39.331528-08:00","updated_at":"2025-11-05T14:17:15.079226-08:00","closed_at":"2025-11-05T14:17:15.079226-08:00"} +{"id":"bd-7e0d6660","title":"Handle unchecked errors (errcheck - 683 issues)","description":"683 unchecked error returns, mostly in tests (Close, Rollback, RemoveAll). Many already excluded in config but still showing up.","notes":"Fixed all errcheck warnings in production code:\n- Enabled errcheck linter (was disabled)\n- Set tests: false in .golangci.yml to focus on production code\n- Fixed 27 total errors in production code using Oracle guidance:\n * Database patterns: defer func() { _ = rows.Close() }() and defer func() { _ = tx.Rollback() }()\n * Best-effort closers: _ = store.Close(), _ = client.Close()\n * Proper error handling for file writes, fmt.Scanln(), os.Remove()\n- All tests pass\n- Only 2 \"unused\" linter warnings remain (not errcheck)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-27T23:20:10.392336-07:00","updated_at":"2025-10-30T17:12:58.215288-07:00","closed_at":"2025-10-27T23:05:31.945328-07:00"} +{"id":"bd-36870264","title":"Enforce daemon singleton per workspace with file locking","description":"Agent in ~/src/wyvern discovered 4 simultaneous daemon processes running, causing infinite directory recursion (.beads/.beads/.beads/...). Each daemon used relative paths and created nested .beads/ directories.\n\nRoot cause: No singleton enforcement. Multiple `bd daemon` processes can start in same workspace.\n\nExpected: One daemon per workspace (each workspace = separate .beads/ dir with bd.sock)\nActual: Multiple daemons can run simultaneously in same workspace\n\nNote: Separate git clones = separate workspaces = separate daemons (correct). Git worktrees share .beads/ and have known limitations (documented, use --no-daemon).","notes":"## Fix Summary\n\nSuccessfully prevented the nested .beads/.beads/ recursion bug by implementing two safeguards:\n\n1. **Path Canonicalization in FindDatabasePath()** (beads.go):\n - Added filepath.Abs() + filepath.EvalSymlinks() to normalize all database paths\n - Prevents relative path edge cases that create nested directories\n - Ensures all daemons see the same canonical path\n\n2. **Nested Directory Detection** (daemon_lifecycle.go):\n - Added explicit check for \".beads/.beads\" pattern in setupDaemonLock()\n - Fails fast with clear error message if nested structure detected\n - Provides user hints about proper usage\n\n## Root Cause\n\nThe daemon lock (added Oct 22, 2025) correctly prevents simultaneous daemons in the SAME workspace. However, when BEADS_DB used a relative path (e.g., \".beads/beads.db\") from inside the .beads directory, FindDatabasePath() would resolve it to a nested path creating a separate workspace:\n- First daemon: /workspace/.beads/beads.db\n- Second daemon from .beads/: /workspace/.beads/.beads/beads.db ← Different lock file!\n\n## Testing\n\nAll acceptance criteria passed:\nβœ… 1. Second daemon start fails with \"daemon already running\" error\nβœ… 2. Killing daemon releases lock, new daemon can start \nβœ… 3. No infinite .beads/ recursion possible (tested nested BEADS_DB path)\nβœ… 4. Works with auto-start mechanism\n\nThe fix addresses the edge case while maintaining the existing lock mechanism's correctness.","status":"closed","issue_type":"bug","created_at":"2025-10-25T23:13:12.269549-07:00","updated_at":"2025-11-01T19:46:06.230339-07:00","closed_at":"2025-11-01T19:46:06.230339-07:00"} +{"id":"bd-e2e6","title":"Implement postinstall script for binary download","description":"Create npm/scripts/postinstall.js that downloads platform-specific binaries:\n\n## Platform detection\n- Detect os.platform() and os.arch()\n- Map to GitHub release asset names:\n - linux-amd64 β†’ bd-linux-amd64\n - linux-arm64 β†’ bd-linux-arm64\n - darwin-amd64 β†’ bd-darwin-amd64\n - darwin-arm64 β†’ bd-darwin-arm64\n - win32-x64 β†’ bd-windows-amd64.exe\n\n## Download logic\n- Fetch from GitHub releases: https://github.com/steveyegge/beads/releases/latest/download/${asset}\n- Save to npm/bin/bd (or bd.exe on Windows)\n- Set executable permissions (chmod +x)\n- Handle errors gracefully with helpful messages\n\n## Error handling\n- Check for unsupported platforms\n- Retry on network failures\n- Provide manual download instructions if automated fails\n- Skip download if binary already exists (for local development)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:39:56.652829-08:00","updated_at":"2025-11-03T10:31:45.382215-08:00","closed_at":"2025-11-03T10:31:45.382215-08:00","dependencies":[{"issue_id":"bd-e2e6","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.94671-08:00","created_by":"daemon"}]} +{"id":"bd-c01f","title":"Implement bd stale command to find abandoned/forgotten issues","description":"Add bd stale command to surface issues that haven't been updated recently and may need attention.\n\nUse cases:\n- In-progress issues with no recent activity (may be abandoned)\n- Open issues that have been forgotten\n- Issues that might be outdated or no longer relevant\n\nQuery logic should find non-closed issues where updated_at exceeds a time threshold.\n\nShould support:\n- --days N flag (default 30-90 days)\n- --status filter (e.g., only in_progress)\n- --json output for automation\n\nReferences GitHub issue #184 where user expected this command to exist.","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-31T22:48:46.85435-07:00","updated_at":"2025-10-31T22:54:33.704492-07:00","closed_at":"2025-10-31T22:54:33.704492-07:00"} +{"id":"bd-tne","title":"Add Claude setup tip with dynamic priority","description":"Add a predefined tip that suggests running `bd setup claude` when Claude Code is detected but not configured. This tip should have higher priority (shown more frequently) until the setup is complete.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-11T23:29:29.871324-08:00","updated_at":"2025-11-11T23:50:29.756454-08:00","dependencies":[{"issue_id":"bd-tne","depends_on_id":"bd-d4i","type":"blocks","created_at":"2025-11-11T23:29:29.872081-08:00","created_by":"daemon"},{"issue_id":"bd-tne","depends_on_id":"bd-br8","type":"blocks","created_at":"2025-11-11T23:29:29.87252-08:00","created_by":"daemon"}]} +{"id":"bd-9v7l","title":"bd status \"Recent Activity\" is misleading - should use git history","description":"## Problem\n\n`bd status` shows \"Recent Activity (last 7 days)\" but the numbers are wrong. It only looks at database timestamps, not git history. Says \"141 issues closed in last 7 days\" when thousands have actually come and go.\n\n## Issues\n\n1. Only queries database timestamps, not git history\n2. 7 days is too long a window\n3. Numbers don't reflect actual activity in JSONL git history\n\n## Proposed Fix\n\nEither:\n- Query git history of `.beads/beads.jsonl` to get actual activity (last 24-48 hours)\n- Remove \"Recent Activity\" section entirely if not useful\n- Make time window configurable and default to 24h\n\n## Example Output (Current)\n```\nRecent Activity (last 7 days):\nIssues Created: 174\nIssues Closed: 141\nIssues Updated: 37\n```\nThis is misleading when thousands of issues have actually cycled through.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-05T01:03:00.234813-08:00","updated_at":"2025-11-06T18:47:42.682987-08:00","closed_at":"2025-11-06T18:47:42.682987-08:00"} +{"id":"bd-374e","title":"WASM integration testing","description":"Comprehensive testing of WASM build. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Unit tests for WASM module\n- [ ] Integration tests with real JSONL files\n- [ ] Test all bd commands for parity\n- [ ] Performance benchmarks\n- [ ] Test in actual Claude Code Web sandbox\n- [ ] Document any limitations\n\n## Test Coverage Target\n- \u003e90% of bd CLI commands work identically","status":"closed","issue_type":"task","created_at":"2025-11-02T18:33:31.342184-08:00","updated_at":"2025-11-05T00:55:48.756994-08:00","closed_at":"2025-11-05T00:55:48.756996-08:00","dependencies":[{"issue_id":"bd-374e","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.342928-08:00","created_by":"daemon"}]} +{"id":"bd-spmx","title":"Investigation \u0026 Proof of Concept","description":"Validate that MCP Agent Mail works as expected and delivers promised benefits before committing to full integration.","notes":"POC completed successfully:\nβœ… bd-muls: Server installed and tested\nβœ… bd-27xm: MCP tool execution issues resolved\nβœ… [deleted:bd-6hji]: File reservation collision prevention validated\nβœ… bd-htfk: Latency benchmarking shows 20-50x improvement\nβœ… bd-pmuu: ADR 002 created documenting integration decision\n\nResults validate Agent Mail benefits:\n- Collision prevention works (exclusive file reservations)\n- Latency: \u003c100ms (vs 2000-5000ms git sync)\n- Lightweight deployment (\u003c50MB memory)\n- Optional/non-intrusive integration approach validated\n\nNext: bd-wfmw (Integration Layer Implementation)","status":"closed","issue_type":"epic","created_at":"2025-11-07T22:41:37.13757-08:00","updated_at":"2025-11-08T03:12:04.154114-08:00","closed_at":"2025-11-08T00:06:20.731732-08:00"} +{"id":"bd-0do3","title":"Test issue 0","status":"closed","issue_type":"task","created_at":"2025-11-07T19:00:15.156832-08:00","updated_at":"2025-11-07T22:07:17.340826-08:00","closed_at":"2025-11-07T21:55:09.425092-08:00"} +{"id":"bd-3","title":"Investigate and upgrade to modernc.org/sqlite 1.39.1+","description":"We had to pin modernc.org/sqlite to v1.38.2 due to a FOREIGN KEY constraint regression in v1.39.1 (SQLite 3.50.4).\n\n**Issue:** [deleted:bd-47], GH #144\n\n**Symptom:** CloseIssue fails with \"FOREIGN KEY constraint failed (787)\" when called via MCP/daemon, but works fine via CLI.\n\n**Root Cause:** Unknown - likely stricter FK enforcement in SQLite 3.50.4 or modernc.org wrapper changes.\n\n**Workaround:** Pinned to v1.38.2 (SQLite 3.49.x)\n\n**TODO:**\n1. Monitor modernc.org/sqlite releases for fixes\n2. Check SQLite 3.50.5+ changelogs for FK-related fixes\n3. Investigate why daemon mode fails but CLI succeeds (connection reuse? transaction isolation?)\n4. Consider filing upstream issue with reproducible test case\n5. Upgrade when safe","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T09:43:47.856354-08:00","updated_at":"2025-11-07T15:06:26.240131-08:00","closed_at":"2025-11-07T15:06:26.240131-08:00"} +{"id":"bd-aewm","title":"bd-hv01: Missing cleanup of .merged temp file on failure","description":"Problem: deletion_tracking.go:49 creates tmpMerged file but does not clean up on failure, causing disk space leak and potential interference with subsequent syncs.\n\nFix: Add defer os.Remove(tmpMerged) after creating temp file path.\n\nFiles: cmd/bd/deletion_tracking.go:38-89","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-06T18:16:24.326719-08:00","updated_at":"2025-11-06T18:46:55.924379-08:00","closed_at":"2025-11-06T18:46:55.924379-08:00","dependencies":[{"issue_id":"bd-aewm","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.061462-08:00","created_by":"daemon"}]} +{"id":"bd-4aao","title":"Fix failing integration tests in beads-mcp","description":"The `beads-mcp` test suite has failures in `tests/test_bd_client_integration.py` (assertion error in `test_init_creates_beads_directory`) and errors in `tests/test_worktree_separate_dbs.py` (setup failures finding database). These need to be investigated and fixed to ensure a reliable CI baseline.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:53:28.4803-05:00","updated_at":"2025-11-20T18:53:28.4803-05:00"} +{"id":"bd-6ed8","title":"Fixture Generator for Realistic Test Data","description":"Create internal/testutil/fixtures/fixtures.go with functions to generate realistic test data at scale.\n\nFunctions:\n- LargeSQLite(storage) - 10K issues, native SQLite\n- XLargeSQLite(storage) - 20K issues, native SQLite \n- LargeFromJSONL(storage) - 10K issues imported from JSONL\n- XLargeFromJSONL(storage) - 20K issues imported from JSONL\n\nData characteristics:\n- Epic hierarchies (depth 4): Epic β†’ Feature β†’ Task β†’ Subtask\n- Cross-linked dependencies (tasks blocking across epics)\n- Realistic status/priority/label distribution\n- Representative assignees and temporal data\n\nImplementation:\n- Single file: internal/testutil/fixtures/fixtures.go\n- No config structs, simple direct functions\n- Seeded RNG for reproducibility\n- Reusable by both benchmarks and tests","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:22:28.233977-08:00","updated_at":"2025-11-13T22:40:19.485552-08:00","closed_at":"2025-11-13T22:40:19.485552-08:00","dependencies":[{"issue_id":"bd-6ed8","depends_on_id":"bd-3tfh","type":"blocks","created_at":"2025-11-13T22:23:58.120794-08:00","created_by":"daemon"},{"issue_id":"bd-6ed8","depends_on_id":"bd-m62x","type":"blocks","created_at":"2025-11-13T22:24:02.598071-08:00","created_by":"daemon"}]} +{"id":"bd-1863608e","title":"Add TestNWayCollision for 5+ clones","description":"## Overview\nAdd comprehensive tests for N-way (5+) collision resolution to verify the solution scales beyond 3 clones.\n\n## Purpose\nWhile TestThreeCloneCollision validates the basic N-way case, we need to verify:\n1. Solution scales to arbitrary N\n2. Performance is acceptable with more clones\n3. Convergence time is bounded\n4. No edge cases in larger collision groups\n\n## Implementation Tasks\n\n### 1. Create TestFiveCloneCollision\nFile: beads_twoclone_test.go (or new beads_nway_test.go)\n\n```go\nfunc TestFiveCloneCollision(t *testing.T) {\n // Test with 5 clones creating same ID with different content\n // Verify all 5 clones converge after sync rounds\n \n t.Run(\"SequentialSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"A\", \"B\", \"C\", \"D\", \"E\")\n })\n \n t.Run(\"ReverseSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"E\", \"D\", \"C\", \"B\", \"A\")\n })\n \n t.Run(\"RandomSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"C\", \"A\", \"E\", \"B\", \"D\")\n })\n}\n```\n\n### 2. Implement generalized testNCloneCollision\nGeneralize the 3-clone test to handle arbitrary N:\n\n```go\nfunc testNCloneCollision(t *testing.T, numClones int, syncOrder ...string) {\n t.Helper()\n \n if len(syncOrder) != numClones {\n t.Fatalf(\"syncOrder length (%d) must match numClones (%d)\", \n len(syncOrder), numClones)\n }\n \n tmpDir := t.TempDir()\n \n // Setup remote and N clones\n remoteDir := setupBareRepo(t, tmpDir)\n cloneDirs := make(map[string]string)\n \n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n cloneDirs[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates issue with same ID but different content\n for name, dir := range cloneDirs {\n createIssue(t, dir, fmt.Sprintf(\"Issue from clone %s\", name))\n }\n \n // Sync in specified order\n for _, name := range syncOrder {\n syncClone(t, cloneDirs[name], name)\n }\n \n // Final pull for convergence\n for name, dir := range cloneDirs {\n finalPull(t, dir, name)\n }\n \n // Verify all clones have all N issues\n expectedTitles := make(map[string]bool)\n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n expectedTitles[fmt.Sprintf(\"Issue from clone %s\", name)] = true\n }\n \n for name, dir := range cloneDirs {\n titles := getTitles(t, dir)\n if !compareTitleSets(titles, expectedTitles) {\n t.Errorf(\"Clone %s missing issues: expected %v, got %v\", \n name, expectedTitles, titles)\n }\n }\n \n t.Log(\"βœ“ All\", numClones, \"clones converged successfully\")\n}\n```\n\n### 3. Add performance benchmarks\nTest convergence time and memory usage:\n\n```go\nfunc BenchmarkNWayCollision(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n // Run N-way collision and measure time\n testNCloneCollisionBench(b, n)\n }\n })\n }\n}\n```\n\n### 4. Add convergence time tests\nVerify bounded convergence:\n\n```go\nfunc TestConvergenceTime(t *testing.T) {\n // Test that convergence happens within expected rounds\n // For N clones, should converge in at most N-1 sync rounds\n \n for n := 3; n \u003c= 10; n++ {\n t.Run(fmt.Sprintf(\"N=%d\", n), func(t *testing.T) {\n rounds := measureConvergenceRounds(t, n)\n maxExpected := n - 1\n if rounds \u003e maxExpected {\n t.Errorf(\"Convergence took %d rounds, expected ≀ %d\", \n rounds, maxExpected)\n }\n })\n }\n}\n```\n\n### 5. Add edge case tests\nTest boundary conditions:\n- All N clones have identical content (dedup works)\n- N-1 clones have same content, 1 differs\n- All N clones have unique content\n- Mix of collisions and non-collisions\n\n## Acceptance Criteria\n- TestFiveCloneCollision passes with all sync orders\n- All 5 clones converge to identical content\n- Performance is acceptable (\u003c 5 seconds for 5 clones)\n- Convergence time is bounded (≀ N-1 rounds)\n- Edge cases handled correctly\n- Benchmarks show scalability to 10+ clones\n\n## Files to Create/Modify\n- beads_twoclone_test.go or beads_nway_test.go\n- Add helper functions for N-clone setup\n\n## Testing Strategy\n\n### Test Matrix\n| N Clones | Sync Orders | Expected Result |\n|----------|-------------|-----------------|\n| 3 | Aβ†’Bβ†’C | Pass |\n| 3 | Cβ†’Bβ†’A | Pass |\n| 5 | Aβ†’Bβ†’Cβ†’Dβ†’E | Pass |\n| 5 | Eβ†’Dβ†’Cβ†’Bβ†’A | Pass |\n| 5 | Random | Pass |\n| 10 | Sequential | Pass |\n\n### Performance Targets\n- 3 clones: \u003c 2 seconds\n- 5 clones: \u003c 5 seconds\n- 10 clones: \u003c 15 seconds\n\n## Dependencies\n- Requires bd-cbed9619.5, bd-cbed9619.4, bd-0dcea000, bd-4d7fca8a to be completed\n- TestThreeCloneCollision must pass first\n\n## Success Metrics\n- All tests pass for N ∈ {3, 5, 10}\n- Convergence time scales linearly (O(N))\n- Memory usage reasonable (\u003c 100MB for 10 clones)\n- No data corruption or loss in any scenario","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T20:02:47.954306-07:00","updated_at":"2025-10-30T17:12:58.182217-07:00","closed_at":"2025-10-28T20:47:28.317007-07:00"} +{"id":"bd-c825f867","title":"Add docs/architecture/event_driven.md","description":"Copy event_driven_daemon.md into docs/ folder. Add to documentation index.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T16:20:02.431399-07:00","updated_at":"2025-11-08T01:58:15.282811-08:00","closed_at":"2025-11-08T00:51:06.826771-08:00"} +{"id":"bd-j7e2","title":"RPC diagnostics: BD_RPC_DEBUG timing logs","description":"Add lightweight diagnostic logging for RPC connection attempts:\n- BD_RPC_DEBUG=1 prints to stderr:\n - Socket path being dialed\n - Socket exists check result \n - Dial start/stop time\n - Connection outcome\n- Improve bd daemon --status messaging when lock not held\n\nThis helps field triage of connection issues without verbose daemon logs.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-07T16:42:12.772364-08:00","updated_at":"2025-11-07T22:07:17.346817-08:00","closed_at":"2025-11-07T21:29:32.243458-08:00","dependencies":[{"issue_id":"bd-j7e2","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.773714-08:00","created_by":"daemon"}]} +{"id":"bd-62a0","title":"Create WASM build infrastructure (Makefile, scripts)","description":"Set up build tooling for WASM compilation:\n- Add GOOS=js GOARCH=wasm build target\n- Copy wasm_exec.js from Go distribution\n- Create wrapper script for Node.js execution\n- Add build task to Makefile or build script","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.286826-08:00","updated_at":"2025-11-02T22:23:49.376789-08:00","closed_at":"2025-11-02T22:23:49.376789-08:00","dependencies":[{"issue_id":"bd-62a0","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.423064-08:00","created_by":"stevey"}]} +{"id":"bd-kdoh","title":"Add tests for getMultiRepoJSONLPaths() edge cases","description":"From bd-xo6b code review: Missing test coverage for getMultiRepoJSONLPaths() edge cases.\n\nCurrent test gaps:\n- No tests for empty paths in config\n- No tests for duplicate paths\n- No tests for tilde expansion\n- No tests for relative paths\n- No tests for symlinks\n- No tests for paths with spaces\n- No tests for invalid/non-existent paths\n\nTest cases needed:\n\n1. Empty path handling:\n Primary = empty, Additional = [empty]\n Expected: Should either use . as default or error gracefully\n\n2. Duplicate detection:\n Primary = ., Additional = [., ./]\n Expected: Should return unique paths only\n\n3. Path normalization:\n Primary = ~/repos/main, Additional = [../other, ./foo/../bar]\n Expected: Should expand to absolute canonical paths\n\n4. Partial failure scenarios:\n What if snapshot capture succeeds for repos 1-2 but fails on repo 3?\n Test that system does not end up in inconsistent state\n\nFiles:\n- cmd/bd/deletion_tracking_test.go (add new tests)\n\nDependencies:\nDepends on fixing getMultiRepoJSONLPaths() path normalization first.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T19:31:52.921241-08:00","updated_at":"2025-11-06T20:06:49.220334-08:00","closed_at":"2025-11-06T19:53:34.515411-08:00","dependencies":[{"issue_id":"bd-kdoh","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.353459-08:00","created_by":"daemon"},{"issue_id":"bd-kdoh","depends_on_id":"bd-iye7","type":"blocks","created_at":"2025-11-06T19:32:13.688686-08:00","created_by":"daemon"}]} +{"id":"bd-gpe7","title":"Tests take too long - unacceptable for project size","description":"## Problem\n\nRunning `go test ./internal/importer/... -v` takes an unacceptably long time (minutes). For a project this size, tests should complete in seconds.\n\n## Impact\n\n- Slows down development iteration\n- AI agents waste time waiting for tests\n- Blocks rapid bug fixes and validation\n- Poor developer experience\n\n## Investigation Needed\n\n- Profile which tests are slow\n- Check for unnecessary sleeps, timeouts, or integration tests\n- Look for tests that could be parallelized\n- Consider splitting unit vs integration tests\n\n## Goal\n\nTest suite for a single package should complete in \u003c5 seconds, ideally \u003c2 seconds.","notes":"## Optimizations Applied\n\n1. **Added t.Parallel() to CLI tests** (13 tests) - allows concurrent execution\n2. **Removed unnecessary 200ms sleep** in daemon_autoimport_test.go - Execute() forces auto-import synchronously\n3. **Reduced filesystem settle wait** from 100ms β†’ 50ms on non-Windows platforms\n4. **Optimized debouncer test sleeps** (9 reductions):\n - Before debounce waits: 30ms β†’ 20ms, 20ms β†’ 10ms\n - After debounce waits: 40ms β†’ 35ms, 30ms β†’ 35ms, etc.\n - Thread safety test: 100ms β†’ 70ms\n - Sequential cycles: 50ms β†’ 40ms (3x)\n - Cancel tests: 70-80ms β†’ 60ms\n\n## Results\n\n### cmd/bd package (main improvement target):\n- **Before**: 5+ minutes (timeout)\n- **After**: ~18-20 seconds\n- **Speedup**: ~15-18x faster\n\n### internal/importer package:\n- **After**: \u003c1 second (0.9s)\n\n### Full test suite (with `-short` flag):\n- Most packages complete in \u003c2s\n- Total runtime constrained by sequential integration tests\n\n## Known Issues\n\n- TestConcurrentExternalRefImports hangs due to :memory: connection pool issue (bd-b121)\n- Some sync_branch tests may need sequential execution (git worktree conflicts)","status":"closed","issue_type":"bug","created_at":"2025-11-05T00:54:47.784504-08:00","updated_at":"2025-11-05T01:41:57.544395-08:00","closed_at":"2025-11-05T01:41:57.544395-08:00"} +{"id":"bd-wfmw","title":"Integration Layer Implementation","description":"Build the adapter layer that makes Agent Mail optional and non-intrusive.","notes":"Progress: bd-m9th (Python adapter library) completed with full test coverage. Next: bd-fzbg (update python-agent example with Agent Mail integration).","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-07T22:42:09.356429-08:00","updated_at":"2025-11-08T00:20:30.888756-08:00","closed_at":"2025-11-08T00:20:30.888756-08:00","dependencies":[{"issue_id":"bd-wfmw","depends_on_id":"bd-spmx","type":"blocks","created_at":"2025-11-07T22:42:09.357488-08:00","created_by":"daemon"}]} +{"id":"bd-3d844c58","title":"Implement content-hash based collision resolution for deterministic convergence","description":"The current collision resolution uses creation timestamps to decide which issue to keep vs. remap. This is non-deterministic when two clones create issues at nearly the same time.\n\nRoot cause of bd-71107098:\n- Clone A creates test-1=\"Issue from clone A\" at T0\n- Clone B creates test-1=\"Issue from clone B\" at T0+30ms\n- Clone B syncs first, remaps Clone A's to test-2\n- Clone A syncs second, sees collision, remaps Clone B's to test-2\n- Result: titles are swapped between clones\n\nSolution:\n- Use content-based hashing (title + description + priority + type)\n- Deterministic winner: always keep issue with lower hash\n- Same collision on different clones produces same result (idempotent)\n\nImplementation:\n- Modify ScoreCollisions in internal/storage/sqlite/collision.go\n- Replace timestamp-based scoring with content hash comparison\n- Ensure hash function is stable across platforms","status":"closed","issue_type":"task","created_at":"2025-10-28T17:04:06.145646-07:00","updated_at":"2025-10-30T17:12:58.225476-07:00","closed_at":"2025-10-28T19:20:09.943023-07:00","dependencies":[{"issue_id":"bd-3d844c58","depends_on_id":"bd-71107098","type":"blocks","created_at":"2025-10-31T19:38:09.203365-07:00","created_by":"stevey"}]} +{"id":"bd-8wa","title":"Code Review Sweep: thorough","description":"Perform thorough code review sweep based on accumulated activity.\n\n**AI Reasoning:**\nSignificant code volume added (150,273 lines) across multiple critical areas, including cmd/bd, internal/storage/sqlite, and internal/rpc. High file change count (616) indicates substantial refactoring or new functionality. The metrics suggest potential for subtle architectural or implementation issues that warrant review.\n\n**Scope:** thorough\n**Target Areas:** cmd/bd, internal/storage/sqlite, internal/rpc\n**Estimated Files:** 12\n**Estimated Cost:** $5\n\n**Task:**\nReview files for non-obvious issues that agents miss during focused work:\n- Inefficiencies (algorithmic, resource usage)\n- Subtle bugs (race conditions, off-by-one, copy-paste)\n- Poor patterns (coupling, complexity, duplication)\n- Missing best practices (error handling, docs, tests)\n- Unnamed anti-patterns\n\nFile discovered issues with detailed reasoning and suggestions.","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T10:25:37.081296-05:00","updated_at":"2025-11-21T10:25:37.081296-05:00"} +{"id":"bd-n4td","title":"Add warning when staleness check errors","description":"## Problem\n\nWhen ensureDatabaseFresh() calls CheckStaleness() and it errors (corrupted metadata, permission issues, etc.), we silently proceed with potentially stale data.\n\n**Location:** cmd/bd/staleness.go:27-32\n\n**Scenarios:**\n- Corrupted metadata table\n- Database locked by another process \n- Permission issues reading JSONL file\n- Invalid last_import_time format in DB\n\n## Current Code\n\n```go\nisStale, err := autoimport.CheckStaleness(ctx, store, dbPath)\nif err \\!= nil {\n // If we can't determine staleness, allow operation to proceed\n // (better to show potentially stale data than block user)\n return nil\n}\n```\n\n## Fix\n\n```go\nisStale, err := autoimport.CheckStaleness(ctx, store, dbPath)\nif err \\!= nil {\n fmt.Fprintf(os.Stderr, \"Warning: Could not verify database freshness: %v\\n\", err)\n fmt.Fprintf(os.Stderr, \"Proceeding anyway. Data may be stale.\\n\\n\")\n return nil\n}\n```\n\n## Impact\nMedium - users should know when staleness check fails\n\n## Effort\nEasy - 5 minutes","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:16:34.889997-05:00","updated_at":"2025-11-20T20:16:34.889997-05:00","dependencies":[{"issue_id":"bd-n4td","depends_on_id":"bd-2q6d","type":"blocks","created_at":"2025-11-20T20:18:20.154723-05:00","created_by":"stevey"}]} +{"id":"bd-df190564","title":"bd repair-deps - Orphaned dependency cleaner","description":"Find and fix orphaned dependency references.\n\nImplementation:\n- Scan all issues for dependencies pointing to non-existent issues\n- Report orphaned refs\n- Auto-fix with --fix flag\n- Interactive mode with --interactive\n\nFiles: cmd/bd/repair_deps.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.852745-07:00","updated_at":"2025-10-31T18:24:19.418221-07:00","closed_at":"2025-10-31T18:24:19.418221-07:00"} +{"id":"bd-qs4p","title":"bd import fails on duplicate external_ref with no resolution options","description":"When JSONL contains duplicate external_ref values (e.g., two issues both have external_ref='BS-170'), bd import fails entirely with no resolution options.\n\nUser must manually edit JSONL to remove duplicates, which is error-prone.\n\nExample error:\n```\nbatch import contains duplicate external_ref values:\nexternal_ref 'BS-170' appears in issues: [opal-39 opal-43]\n```\n\nShould handle this similar to duplicate issue detection - offer to merge, pick one, or clear duplicates.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T10:53:41.906165-08:00","updated_at":"2025-11-06T11:03:16.975041-08:00","closed_at":"2025-11-06T11:03:16.975041-08:00"} +{"id":"bd-72w","title":"Q4 Platform Improvements","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-03T19:54:03.794244-08:00","updated_at":"2025-11-05T00:25:06.51152-08:00","closed_at":"2025-11-05T00:25:06.51152-08:00"} +{"id":"bd-wcl","title":"Document CLI + hooks as recommended approach over MCP","description":"Update documentation to position CLI + bd prime hooks as the primary recommended approach over MCP server, explaining why minimizing context matters even with large context windows (compute cost, energy, environment, latency).","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-12T00:15:25.923025-08:00","updated_at":"2025-11-12T00:18:16.786857-08:00"} +{"id":"bd-fd8753d9","title":"Document bd edit command and verify MCP exclusion","description":"Follow-up from PR #152:\n1. Add \"bd edit\" to AGENTS.md with \"Humans only\" note\n2. Verify MCP server doesn't expose bd edit command\n3. Consider adding test for command registration","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-26T13:23:47.982295-07:00","updated_at":"2025-11-06T20:06:49.219828-08:00","closed_at":"2025-11-06T19:41:08.675575-08:00"} +{"id":"bd-8a39","title":"Fix Windows-specific test failures in CI","description":"Several tests are failing on Windows but passing on Linux:\n\n**Failing tests:**\n- TestFindDatabasePathEnvVar\n- TestHashIDs_MultiCloneConverge\n- TestHashIDs_IdenticalContentDedup\n- TestDatabaseReinitialization (all 5 subtests):\n - fresh_clone_auto_import\n - database_removal_scenario\n - legacy_filename_support\n - precedence_test\n - init_safety_check\n- TestFindBeadsDir_NotFound\n- TestMetricsSnapshot/uptime (in internal/rpc)\n\n**CI Run:** https://github.com/steveyegge/beads/actions/runs/19015638968\n\nThese are likely path separator or filesystem behavior differences between Windows and Linux.","notes":"Fixed all Windows path issues:\n1. TestFindDatabasePathEnvVar - expects canonicalized paths βœ…\n2. TestHashIDs tests - use platform-specific bd.exe command βœ… \n3. TestMetricsSnapshot/uptime - enforce minimum 1 second uptime βœ…\n4. TestFindBeadsDir_NotFound - allow finding .beads in parent dirs βœ…\n5. TestDatabaseReinitialization - fix git path conversion on Windows (git returns /c/Users/... but filepath needs C:\\Users\\...) βœ…\n\nCI run in progress to verify all fixes.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-02T09:29:37.274103-08:00","updated_at":"2025-11-02T12:32:00.158713-08:00","closed_at":"2025-11-02T12:32:00.158716-08:00","dependencies":[{"issue_id":"bd-8a39","depends_on_id":"bd-1231","type":"blocks","created_at":"2025-11-02T09:29:37.276579-08:00","created_by":"stevey"}]} +{"id":"bd-lln","title":"Add tests for performFlush error handling in FlushManager","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/flush_manager.go:269, the performFlush method is flagged by unparam as always returning nil, indicating the error return value is never used.\n\nAdd tests to determine:\n- Whether performFlush can actually return errors in failure scenarios\n- If error return is needed, add tests for error cases (disk full, permission denied, etc.)\n- If error return is not needed, refactor to remove unused return value\n- Test full export vs incremental export error handling\n\nThis ensures proper error handling in the flush mechanism and removes dead code if the return value is unnecessary.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:33.533653-05:00","updated_at":"2025-11-23T18:06:29.861578-08:00","closed_at":"2025-11-21T19:31:21.876949-05:00","dependencies":[{"issue_id":"bd-lln","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.534913-05:00","created_by":"ai-supervisor"}]} +{"id":"bd-08fd","title":"Test child issue","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-02T11:50:40.640901-08:00","updated_at":"2025-11-02T11:50:47.309652-08:00","closed_at":"2025-11-02T11:50:47.309652-08:00","dependencies":[{"issue_id":"bd-08fd","depends_on_id":"bd-ce75","type":"blocks","created_at":"2025-11-02T11:50:40.642073-08:00","created_by":"stevey"}]} +{"id":"bd-f8b764c9.9","title":"Implement hash ID generation in CreateIssue","description":"Replace sequential ID generation with hash-based IDs in CreateIssue function.\n\n## Current Behavior (internal/storage/sqlite/sqlite.go)\n```go\nfunc (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue) error {\n // ID comes from auto-increment counter\n // Collisions possible across clones\n}\n```\n\n## New Behavior\n```go\nfunc (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue) error {\n // Generate hash ID if not provided\n if issue.ID == \"\" {\n issue.ID = idgen.GenerateHashID(\n issue.Title,\n issue.Description,\n time.Now(),\n s.workspaceID,\n )\n }\n \n // Assign next alias\n issue.Alias = s.getNextAlias()\n \n // Insert with hash ID + alias\n // ...\n}\n```\n\n## Workspace ID Generation\nAdd to database initialization:\n```go\n// Generate stable workspace ID (persisted in .beads/workspace_id)\nworkspaceID := getOrCreateWorkspaceID()\n```\n\nOptions for workspace ID:\n1. Hostname + random suffix\n2. UUID (random)\n3. Git remote URL hash (deterministic per repo)\n\nRecommended: Option 3 (git remote hash) for reproducibility\n\n## Hash Collision Detection\n```go\n// On insert, check for collision (unlikely but possible)\nexisting, err := s.GetIssue(ctx, issue.ID)\nif err == nil {\n // Hash collision! Add random suffix and retry\n issue.ID = issue.ID + \"-\" + randomSuffix(4)\n}\n```\n\n## Files to Create/Modify\n- internal/types/id_generator.go (new)\n- internal/storage/sqlite/sqlite.go (CreateIssue)\n- internal/storage/sqlite/workspace.go (new - workspace ID management)\n- .beads/workspace_id (new file, git-ignored)\n\n## Testing\n- Test hash ID generation is deterministic\n- Test collision detection and retry\n- Test workspace ID persistence\n- Benchmark: hash generation performance (\u003c1ΞΌs)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:29.412237-07:00","updated_at":"2025-10-31T12:32:32.610403-07:00","closed_at":"2025-10-31T12:32:32.610403-07:00","dependencies":[{"issue_id":"bd-f8b764c9.9","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:29.413417-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.9","depends_on_id":"bd-f8b764c9.11","type":"blocks","created_at":"2025-10-29T21:24:29.413823-07:00","created_by":"stevey"}]} +{"id":"bd-6c68","title":"bd info shows 'auto_start_disabled' even when daemon is crashed/missing","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:08:03.385681-07:00","updated_at":"2025-11-01T19:13:43.819004-07:00","closed_at":"2025-11-01T19:13:43.819004-07:00","dependencies":[{"issue_id":"bd-6c68","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:03.387045-07:00","created_by":"stevey"}]} +{"id":"bd-f8b764c9","title":"Hash-based IDs with aliasing system","description":"Replace sequential auto-increment IDs (bd-1c63eb84, bd-9063acda) with content-hash based IDs (bd-af78e9a2) plus human-friendly aliases (#1, #2).\n\n## Motivation\nCurrent sequential IDs cause collision problems when multiple clones work offline:\n- Non-deterministic convergence in N-way scenarios (bd-cbed9619.1, bd-e6d71828)\n- Complex collision resolution logic (~2,100 LOC)\n- UNIQUE constraint violations during import\n- Requires coordination between workers\n\nHash-based IDs eliminate collisions entirely while aliases preserve human readability.\n\n## Benefits\n- βœ… Collision-free distributed ID generation\n- βœ… Eliminates ~2,100 LOC of collision handling code\n- βœ… Better git merge behavior (different IDs = different JSONL lines)\n- βœ… True offline-first workflows\n- βœ… Simpler auto-import (no remapping needed)\n- βœ… Enables parallel CI/CD workers without coordination\n\n## Design\n- Canonical ID: bd-af78e9a2 (8-char SHA256 prefix of title+desc+timestamp+creator)\n- Alias: #42 (auto-increment per workspace, mutable, display-only)\n- CLI accepts both: bd show bd-af78e9a2 OR bd show #42\n- JSONL stores hash IDs only (aliases reconstructed on import)\n- Alias conflicts resolved via content-hash ordering (deterministic)\n\n## Breaking Change\nThis is a v2.0 feature requiring migration. Provide bd migrate --hash-ids tool.\n\n## Timeline\n~9 weeks (Phase 1: Hash IDs 4w, Phase 2: Aliases 3w, Phase 3: Testing 2w)\n\n## Dependencies\nShould complete after bd-7c5915ae (cleanup validation) and before bd-710a4916 (CRDT).","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-29T21:23:49.592315-07:00","updated_at":"2025-10-31T12:32:32.6038-07:00","closed_at":"2025-10-31T12:32:32.6038-07:00"} +{"id":"bd-ng56","title":"bd-hv01: Three full JSONL reads on every sync (performance)","description":"Problem: computeAcceptedDeletions reads three JSONL files completely into memory (base, left, merged). For 1000 issues at 1KB each, this is 3MB read and 3000 JSON parse operations.\n\nImpact: Acceptable now (~20-35ms overhead) but will be slow for large repos (10k+ issues).\n\nPossible optimizations: single-pass streaming, memory-mapped files, binary format, incremental snapshots.\n\nFiles: cmd/bd/deletion_tracking.go:101-208","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-06T18:16:25.653076-08:00","updated_at":"2025-11-06T20:06:49.220818-08:00","closed_at":"2025-11-06T19:41:04.67733-08:00","dependencies":[{"issue_id":"bd-ng56","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.148149-08:00","created_by":"daemon"}]} +{"id":"bd-da96-baseline-lint","title":"Baseline quality gate failure: lint","description":"The lint quality gate is failing on the baseline (main branch).\n\nThis blocks the executor from claiming work until fixed.\n\nError: golangci-lint failed: exit status 1\n\nOutput:\n```\ncmd/bd/search.go:39:12: Error return value of `cmd.Help` is not checked (errcheck)\n\t\t\tcmd.Help()\n\t\t\t ^\ncmd/bd/clean.go:118:15: G304: Potential file inclusion via variable (gosec)\n\tfile, err := os.Open(gitignorePath)\n\t ^\ncmd/bd/doctor/gitignore.go:98:12: G306: Expect WriteFile permissions to be 0600 or less (gosec)\n\tif err := os.WriteFile(gitignorePath, []byte(GitignoreTemplate), 0644); err != nil {\n\t ^\ncmd/bd/merge.go:121:16: G204: Subprocess launched with variable (gosec)\n\t\t\tgitRmCmd := exec.Command(\"git\", \"rm\", \"-f\", \"--quiet\", fullPath)\n\t\t\t ^\ncmd/bd/doctor.go:167:20: `cancelled` is a misspelling of `canceled` (misspell)\n\t\tfmt.Println(\"Fix cancelled.\")\n\t\t ^\ncmd/bd/flush_manager.go:139:42: `cancelling` is a misspelling of `canceling` (misspell)\n\t\t// Send shutdown request FIRST (before cancelling context)\n\t\t ^\ncmd/bd/flush_manager.go:261:15: `cancelled` is a misspelling of `canceled` (misspell)\n\t\t\t// Context cancelled (shouldn't normally happen)\n\t\t\t ^\ncmd/bd/flush_manager.go:269:55: (*FlushManager).performFlush - result 0 (error) is always nil (unparam)\nfunc (fm *FlushManager) performFlush(fullExport bool) error {\n ^\n8 issues:\n* errcheck: 1\n* gosec: 3\n* misspell: 3\n* unparam: 1\n\n```","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:17:25.963791-05:00","updated_at":"2025-11-21T10:25:33.537845-05:00","closed_at":"2025-11-21T10:25:33.53596-05:00"} +{"id":"bd-q13h","title":"Makefile Integration for Benchmarks","description":"Add a single 'bench' target to the Makefile for running performance benchmarks.\n\nTarget:\n.PHONY: bench\n\nbench:\n\tgo test -bench=. -benchtime=3s -tags=bench \\\n\t\t-cpuprofile=cpu.prof -memprofile=mem.prof \\\n\t\t./internal/storage/sqlite/\n\t@echo \"\"\n\t@echo \"Profiles generated. View flamegraph:\"\n\t@echo \" go tool pprof -http=:8080 cpu.prof\"\n\nFeatures:\n- Single simple target, no complexity\n- Always generates CPU and memory profiles\n- Clear output on how to view results\n- 3 second benchmark time for reliable results\n- Uses bench build tag for heavy benchmarks\n\nUsage:\n make bench # Run all benchmarks\n go test -bench=BenchmarkGetReadyWork... # Run specific benchmark","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-13T22:23:25.922916-08:00","updated_at":"2025-11-14T08:55:17.620824-08:00","closed_at":"2025-11-14T08:55:17.620824-08:00","dependencies":[{"issue_id":"bd-q13h","depends_on_id":"bd-zj8e","type":"blocks","created_at":"2025-11-13T22:24:06.371947-08:00","created_by":"daemon"}]} +{"id":"bd-4ff2","title":"Fix CI failures before 0.21.3 release","description":"CI is failing on multiple jobs:\n1. Nix flake: Tests fail due to missing git in build environment\n2. Windows tests: Need to check what's failing\n3. Linux tests: Need to check what's failing\n4. Linter errors: Many unchecked errors need fixing\n\nNeed to fix before tagging v0.21.3 release.","notes":"Fixed linter errors (errcheck, misspell), Nix flake git dependency, and import database discovery bug. Tests still failing - need to investigate further.","status":"closed","issue_type":"bug","created_at":"2025-11-01T23:52:09.244763-07:00","updated_at":"2025-11-02T12:32:57.748324-08:00","closed_at":"2025-11-02T12:32:57.748329-08:00"} +{"id":"bd-9f20","title":"DetectCycles SQL query has bug preventing cycle detection","description":"The DetectCycles function's SQL query has a bug in the LIKE filter that prevents it from detecting cycles.\n\nCurrent code (line 571):\n```sql\nAND p.path NOT LIKE '%' || d.depends_on_id || 'β†’%'\n```\n\nThis prevents ANY revisit to nodes, including returning to the start node to complete a cycle.\n\nFix:\n```sql\nAND (d.depends_on_id = p.start_id OR p.path NOT LIKE '%' || d.depends_on_id || 'β†’%')\n```\n\nThis allows revisiting the start node (to detect the cycle) while still preventing intermediate node revisits.\n\nImpact: Currently DetectCycles cannot detect any cycles, but this hasn't been noticed because AddDependency prevents cycles from being created. The function would only matter if cycles were manually inserted into the database.","status":"closed","priority":3,"issue_type":"bug","created_at":"2025-11-01T22:50:32.552763-07:00","updated_at":"2025-11-01T22:52:02.247443-07:00","closed_at":"2025-11-01T22:52:02.247443-07:00"} +{"id":"bd-g3ey","title":"bd sync --import-only doesn't update DB mtime causing bd doctor false warning","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T15:18:16.761052+01:00","updated_at":"2025-11-08T15:58:37.147425-08:00","closed_at":"2025-11-08T13:12:01.718252-08:00"} +{"id":"bd-tuqd","title":"bd init overwrites existing git hooks without detection or chaining","description":"GH #254: bd init silently overwrites existing git hooks (like pre-commit framework) without detecting them, backing them up, or offering to chain. This breaks workflows and can result in committed code with failing tests.\n\nFix: Detect existing hooks, prompt user with options to chain/overwrite/skip.","status":"closed","issue_type":"bug","created_at":"2025-11-07T15:51:17.582882-08:00","updated_at":"2025-11-07T15:55:01.330531-08:00","closed_at":"2025-11-07T15:55:01.330531-08:00"} +{"id":"bd-ar2.8","title":"Add edge case tests for export metadata updates","description":"## Current Coverage\nTestExportUpdatesMetadata tests basic happy path only.\n\n## Missing Test Cases\n\n### 1. Multi-Repo Mode\n- Export with multi-repo configuration\n- Verify metadata updated for ALL JSONL files\n- Critical gap (related to bd-ar2.2)\n\n### 2. computeJSONLHash Failure\n- JSONL file deleted/inaccessible after export\n- Should log warning, not crash\n- Verify behavior on next export\n\n### 3. SetMetadata Failures\n- Database write-protected\n- Disk full\n- Should log warnings, continue\n\n### 4. os.Stat Failure\n- JSONL file deleted after export, before stat\n- Should handle gracefully (mtime just not updated)\n\n### 5. Concurrent Exports\n- Two daemon instances export simultaneously\n- Verify metadata doesn't get corrupted\n- Race condition test\n\n### 6. Clock Skew\n- System time goes backward between exports\n- Verify mtime handling still works\n\n### 7. Partial Export Failure\n- Multi-repo mode: some exports succeed, some fail\n- What metadata should be updated?\n\n### 8. Large JSONL Files\n- Performance test with large files (10k+ issues)\n- Verify hash computation doesn't timeout\n\n## Files\n- cmd/bd/daemon_sync_test.go\n\n## Implementation Priority\n1. Multi-repo test (P1 - related to critical issue)\n2. Failure handling tests (P2)\n3. Performance/edge cases (P3)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:25:59.526543-05:00","updated_at":"2025-11-22T17:48:48.071281-08:00","closed_at":"2025-11-21T14:39:53.143561-05:00","dependencies":[{"issue_id":"bd-ar2.8","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:59.527032-05:00","created_by":"daemon"}]} +{"id":"bd-cdf7","title":"Add tests for DetectCycles to improve coverage from 29.6%","description":"DetectCycles currently has 29.6% coverage. Need comprehensive tests for:\n- Simple cycles (A-\u003eB-\u003eA)\n- Complex multi-node cycles\n- Acyclic graphs (should not detect cycles)\n- Self-loops\n- Multiple independent cycles\n- Edge cases (empty graph, single node)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-01T22:40:58.977156-07:00","updated_at":"2025-11-01T22:52:02.243223-07:00","closed_at":"2025-11-01T22:52:02.243223-07:00"} +{"id":"bd-nemp","title":"Measure git operation reduction","description":"Quantify the reduction in git operations (pulls, commits, pushes) when using Agent Mail for coordination.\n\nAcceptance Criteria:\n- Baseline: count git ops for 10 issues without Agent Mail\n- With Agent Mail: count git ops for 10 issues\n- Document reduction percentage\n- Verify 70-80% reduction claim\n- Measure impact on .git directory size growth\n\nSuccess Metric: β‰₯70% reduction in git operations","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:00.157334-08:00","updated_at":"2025-11-08T00:20:30.691721-08:00","closed_at":"2025-11-08T00:20:30.691721-08:00","dependencies":[{"issue_id":"bd-nemp","depends_on_id":"bd-6hji","type":"blocks","created_at":"2025-11-07T23:03:53.131532-08:00","created_by":"daemon"},{"issue_id":"bd-nemp","depends_on_id":"bd-htfk","type":"blocks","created_at":"2025-11-07T23:03:53.200321-08:00","created_by":"daemon"}]} +{"id":"bd-buol","title":"Invert control for compact: provide tools for agent-driven compaction","description":"Currently compact requires Anthropic API key because bd calls the AI directly. This is backwards - we should provide tools (like all other bd commands) that let an AI agent perform the compaction. The agent decides what to keep/merge, not bd. Related to GH #243 complaint about API key requirement.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-07T00:27:28.498069-08:00","updated_at":"2025-11-07T23:18:08.38606-08:00","closed_at":"2025-11-07T23:08:51.67473-08:00"} +{"id":"bd-aysr","title":"Test numeric 1","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T12:58:41.498034-08:00","updated_at":"2025-11-05T12:58:44.73082-08:00","closed_at":"2025-11-05T12:58:44.73082-08:00"} +{"id":"bd-1vup","title":"Test FK constraint via close","status":"closed","priority":4,"issue_type":"task","created_at":"2025-11-07T15:06:10.324045-08:00","updated_at":"2025-11-07T15:06:14.289835-08:00","closed_at":"2025-11-07T15:06:14.289835-08:00"} +{"id":"bd-502e","title":"Add comprehensive tests for sync branch daemon logic","description":"The daemon sync branch functionality (bd-6545) was implemented but needs proper end-to-end testing.\n\nCurrent implementation:\n- daemon_sync_branch.go has syncBranchCommitAndPush() and syncBranchPull()\n- daemon_sync.go has been updated to use these functions when sync.branch is configured\n- All daemon tests pass, but no specific tests for sync branch behavior\n\nTesting needed:\n- Test that daemon commits to sync branch when sync.branch is configured\n- Test that daemon commits to current branch when sync.branch is NOT configured (backward compatibility)\n- Test that daemon pulls from sync branch and syncs JSONL back to main repo\n- Test worktree creation and health checks during daemon operations\n- Test error handling (missing branch, worktree corruption, etc.)\n\nKey challenge: Tests need to run in the context of the git repo (getGitRoot() uses current working directory), so test setup needs to properly change directory or mock the git root detection.\n\nReference existing daemon tests in daemon_test.go and daemon_autoimport_test.go for patterns.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:59:13.341491-08:00","updated_at":"2025-11-02T16:39:53.278313-08:00","closed_at":"2025-11-02T16:39:53.278313-08:00","dependencies":[{"issue_id":"bd-502e","depends_on_id":"bd-6545","type":"parent-child","created_at":"2025-11-02T15:59:13.342331-08:00","created_by":"daemon"}]} +{"id":"bd-kazt","title":"Add tests for 3-way merge scenarios","description":"Comprehensive test coverage for merge logic.\n\n**Test cases**:\n- Simple field updates (left vs right)\n- Dependency merging (union + dedup)\n- Timestamp handling (max wins)\n- Deletion detection (deleted in one, modified in other)\n- Conflict generation (incompatible changes)\n- Issue resurrection prevention (bd-hv01 regression test)\n\n**Files**:\n- `internal/merge/merge_test.go`\n- `cmd/bd/merge_test.go`","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.472275-08:00","updated_at":"2025-11-06T15:52:41.863426-08:00","closed_at":"2025-11-06T15:52:41.863426-08:00","dependencies":[{"issue_id":"bd-kazt","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.740517-08:00","created_by":"daemon"},{"issue_id":"bd-kazt","depends_on_id":"bd-oif6","type":"blocks","created_at":"2025-11-05T18:42:35.469582-08:00","created_by":"daemon"}]} +{"id":"bd-8zpg","title":"Add tests for bd init --contributor wizard","description":"Write integration tests for the contributor wizard:\n- Test fork detection logic\n- Test planning repo creation\n- Test config setup\n- Test with/without upstream remote\n- Test with SSH vs HTTPS origins","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:58:18.171851-08:00","updated_at":"2025-11-06T18:19:16.232739-08:00","closed_at":"2025-11-06T16:14:06.341689-08:00"} +{"id":"bd-7eed","title":"Remove obsolete stale.go command (executor tables never implemented)","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-10-31T21:27:05.555369-07:00","updated_at":"2025-10-31T21:27:11.427631-07:00","closed_at":"2025-10-31T21:27:11.427631-07:00"} +{"id":"bd-307","title":"Multi-repo hydration layer","description":"Build core infrastructure to hydrate database from N repos (Nβ‰₯1), with smart caching via file mtime tracking and routing writes to correct JSONL based on source_repo metadata.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:30.655765-08:00","updated_at":"2025-11-05T00:08:42.811877-08:00","closed_at":"2025-11-05T00:08:42.811879-08:00","dependencies":[{"issue_id":"bd-307","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.823652-08:00","created_by":"daemon"}]} +{"id":"bd-kla1","title":"Add bd init --contributor wizard","description":"Interactive wizard for OSS contributor setup. Guides user through: fork workflow setup, separate planning repo configuration, auto-detection of fork relationships, examples of common OSS workflows.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:29.958409-08:00","updated_at":"2025-11-05T19:27:33.07529-08:00","closed_at":"2025-11-05T18:53:51.267625-08:00","dependencies":[{"issue_id":"bd-kla1","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.120064-08:00","created_by":"daemon"}]} +{"id":"bd-cb64c226.6","title":"Verify MCP Server Compatibility","description":"Ensure MCP server works with cache-free daemon","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:56:03.241615-07:00","updated_at":"2025-10-30T17:12:58.213372-07:00","closed_at":"2025-10-28T14:08:38.059615-07:00"} +{"id":"bd-ar2","title":"Code review follow-up for bd-dvd and bd-ymj fixes","description":"Track improvements and issues identified during code review of parent resurrection (bd-dvd) and export metadata (bd-ymj) bug fixes.\n\n## Context\nCode review identified several areas for improvement:\n- Code duplication in metadata updates\n- Missing multi-repo support\n- Test coverage gaps\n- Potential race conditions\n\n## Related Issues\nOriginal bugs fixed: bd-dvd, bd-ymj\n\n## Goals\n- Eliminate code duplication\n- Add multi-repo support where needed\n- Improve test coverage\n- Address edge cases","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-21T10:24:05.78635-05:00","updated_at":"2025-11-22T17:48:48.067797-08:00","closed_at":"2025-11-21T15:04:48.692231-05:00"} +{"id":"bd-ef85","title":"Add --json flags to all bd commands for agent-friendly output","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-10-31T22:39:45.312496-07:00","updated_at":"2025-10-31T22:39:50.157022-07:00","closed_at":"2025-10-31T22:39:50.157022-07:00"} +{"id":"bd-yuf7","title":"bd config set succeeds but doesn't persist to config.toml","description":"Commands like `bd config set daemon.auto_push true` return \"Set daemon.auto_push = true\" but the config file is never created and `bd info --json | jq '.config'` returns null.\n\n**Steps to reproduce:**\n1. Run `bd config set daemon.auto_push true`\n2. See success message: \"Set daemon.auto_push = true\"\n3. Check `cat .beads/config.toml` β†’ file doesn't exist\n4. Check `bd info --json | jq '.config'` β†’ returns null\n\n**Expected:**\n- .beads/config.toml should be created with the setting\n- bd info should show the config value\n\n**Impact:**\nUsers can't enable auto-push/auto-commit via CLI as documented in AGENTS.md","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T01:14:58.726198-08:00","updated_at":"2025-11-08T01:17:41.377912-08:00","closed_at":"2025-11-08T01:17:41.377912-08:00"} +{"id":"bd-f8b764c9.2","title":"Update MCP server for hash IDs","description":"Update beads-mcp server to support hash IDs and aliases.\n\n## Changes Needed\n\n### 1. MCP Function Signatures (No Change)\nFunctions already use issue IDs as strings, so they work with hash IDs:\n\n```python\n# These already work!\nbeads_show(issue_id: str) # Accepts bd-af78e9a2 or #42\nbeads_update(issue_id: str, ...) # Accepts both formats\nbeads_close(issue_ids: List[str]) # Accepts both formats\n```\n\n### 2. Add Alias Resolution Helper\nFile: integrations/beads-mcp/src/beads_mcp/server.py\n\n```python\ndef resolve_issue_id(issue_id: str) -\u003e str:\n \"\"\"Resolve alias to hash ID if needed.\"\"\"\n # Hash ID: pass through\n if issue_id.startswith('bd-') and len(issue_id) == 11:\n return issue_id\n \n # Alias: #42 or 42\n alias_str = issue_id.lstrip('#')\n try:\n alias = int(alias_str)\n # Call bd to resolve\n result = subprocess.run(\n ['bd', 'alias', 'find', f'bd-{alias}'],\n capture_output=True, text=True\n )\n if result.returncode == 0:\n return result.stdout.strip()\n except ValueError:\n pass\n \n # Invalid format\n raise ValueError(f\"Invalid issue ID: {issue_id}\")\n```\n\n### 3. Update Response Formatting\nShow aliases in responses:\n\n```python\n@server.call_tool()\nasync def beads_show(issue_id: str) -\u003e List[TextContent]:\n resolved_id = resolve_issue_id(issue_id)\n \n result = subprocess.run(['bd', 'show', resolved_id], ...)\n \n # Parse response and add alias info\n # Format: \"bd-af78e9a2 (alias: #42)\"\n ...\n```\n\n### 4. Add beads_alias_* Functions\n\n```python\n@server.call_tool()\nasync def beads_alias_list() -\u003e List[TextContent]:\n \"\"\"List all alias mappings.\"\"\"\n result = subprocess.run(['bd', 'alias', 'list'], ...)\n return [TextContent(type=\"text\", text=result.stdout)]\n\n@server.call_tool()\nasync def beads_alias_set(alias: int, issue_id: str) -\u003e List[TextContent]:\n \"\"\"Manually assign alias to issue.\"\"\"\n result = subprocess.run(['bd', 'alias', 'set', str(alias), issue_id], ...)\n return [TextContent(type=\"text\", text=result.stdout)]\n\n@server.call_tool()\nasync def beads_alias_compact() -\u003e List[TextContent]:\n \"\"\"Compact aliases to fill gaps.\"\"\"\n result = subprocess.run(['bd', 'alias', 'compact'], ...)\n return [TextContent(type=\"text\", text=result.stdout)]\n```\n\n### 5. Update Documentation\nFile: integrations/beads-mcp/README.md\n\n```markdown\n## Issue IDs (v2.0+)\n\nThe MCP server accepts both hash IDs and aliases:\n\n```python\n# Using hash IDs\nawait beads_show(issue_id=\"bd-af78e9a2\")\n\n# Using aliases\nawait beads_show(issue_id=\"#42\")\nawait beads_show(issue_id=\"42\") # Shorthand\n```\n\n## Alias Management\n\nNew functions for alias control:\n\n- `beads_alias_list()` - List all alias mappings\n- `beads_alias_set(alias, issue_id)` - Manually assign alias\n- `beads_alias_compact()` - Compact aliases to fill gaps\n\n## Migration\n\nAfter migrating to hash IDs:\n1. Update beads-mcp: `pip install --upgrade beads-mcp`\n2. Restart MCP server\n3. All existing workflows continue to work\n```\n\n### 6. Version Compatibility\nDetect and handle both v1.x and v2.0 formats:\n\n```python\ndef detect_beads_version() -\u003e str:\n \"\"\"Detect if beads is using sequential or hash IDs.\"\"\"\n result = subprocess.run(['bd', 'list', '-n', '1'], ...)\n first_id = parse_first_issue_id(result.stdout)\n \n if first_id.startswith('bd-') and len(first_id) \u003e 11:\n return '2.0' # Hash ID\n else:\n return '1.x' # Sequential ID\n\n# On startup\nbeads_version = detect_beads_version()\nlogger.info(f\"Detected beads version: {beads_version}\")\n```\n\n## Testing\n\n### Unit Tests\nFile: integrations/beads-mcp/tests/test_hash_ids.py\n\n```python\ndef test_resolve_hash_id():\n \"\"\"Hash IDs pass through unchanged.\"\"\"\n assert resolve_issue_id(\"bd-af78e9a2\") == \"bd-af78e9a2\"\n\ndef test_resolve_alias():\n \"\"\"Aliases resolve to hash IDs.\"\"\"\n # Mock bd alias find command\n assert resolve_issue_id(\"#42\") == \"bd-af78e9a2\"\n assert resolve_issue_id(\"42\") == \"bd-af78e9a2\"\n\ndef test_invalid_id():\n \"\"\"Invalid IDs raise ValueError.\"\"\"\n with pytest.raises(ValueError):\n resolve_issue_id(\"invalid\")\n```\n\n### Integration Tests\n```python\nasync def test_show_with_hash_id(mcp_server):\n result = await mcp_server.beads_show(issue_id=\"bd-af78e9a2\")\n assert \"bd-af78e9a2\" in result[0].text\n\nasync def test_show_with_alias(mcp_server):\n result = await mcp_server.beads_show(issue_id=\"#42\")\n assert \"bd-af78e9a2\" in result[0].text # Resolved\n```\n\n## Backward Compatibility\nThe MCP server should work with both:\n- Beads v1.x (sequential IDs)\n- Beads v2.0+ (hash IDs)\n\nDetection happens at runtime based on issue ID format.\n\n## Files to Modify\n- integrations/beads-mcp/src/beads_mcp/server.py\n- integrations/beads-mcp/README.md\n- integrations/beads-mcp/tests/test_hash_ids.py (new)\n- integrations/beads-mcp/pyproject.toml (bump version)\n\n## Deployment\n```bash\ncd integrations/beads-mcp\n# Bump version to 2.0.0\npoetry version 2.0.0\n# Publish to PyPI\npoetry publish --build\n```","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:28:45.256074-07:00","updated_at":"2025-10-31T12:32:32.60786-07:00","closed_at":"2025-10-31T12:32:32.60786-07:00","dependencies":[{"issue_id":"bd-f8b764c9.2","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:28:45.257315-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.2","depends_on_id":"bd-f8b764c9.7","type":"blocks","created_at":"2025-10-29T21:28:45.258057-07:00","created_by":"stevey"}]} +{"id":"bd-58c0","title":"Fix transaction conflict in TryResurrectParent","description":"Integration test TestImportWithDeletedParent fails with 'database is locked' error when resurrection happens inside CreateIssue.\n\nRoot cause: TryResurrectParent calls conn.Get() and insertIssue() which conflicts with existing transaction in CreateIssue.\n\nError: failed to create tombstone for parent bd-parent: failed to insert issue: sqlite3: database is locked\n\nSolution: Refactor resurrection to accept optional transaction parameter, use existing transaction when available instead of creating new connection.\n\nImpact: Blocks resurrection from working in CreateIssue flow, only works in EnsureIDs (which may not have active transaction).","status":"closed","issue_type":"bug","created_at":"2025-11-04T16:32:20.981027-08:00","updated_at":"2025-11-04T17:00:44.258881-08:00","closed_at":"2025-11-04T17:00:44.258881-08:00","dependencies":[{"issue_id":"bd-58c0","depends_on_id":"bd-d19a","type":"discovered-from","created_at":"2025-11-04T16:32:20.981969-08:00","created_by":"daemon"}]} +{"id":"bd-32nm","title":"Auto-configure git merge driver during `bd init`","description":"Enhance `bd init` to optionally set up beads-merge as git merge driver.\n\n**Tasks**:\n- Prompt user to install git merge driver\n- Configure `.git/config`: `merge.beads.driver \"bd merge %A %O %L %R\"`\n- Create/update `.gitattributes`: `.beads/beads.jsonl merge=beads`\n- Add `--skip-merge-driver` flag for non-interactive use\n- Update AGENTS.md onboarding section\n\n**Files**:\n- `cmd/bd/init.go`\n- `.gitattributes` template","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.447682-08:00","updated_at":"2025-11-05T19:27:18.370494-08:00","closed_at":"2025-11-05T19:27:18.370494-08:00","dependencies":[{"issue_id":"bd-32nm","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.723517-08:00","created_by":"daemon"},{"issue_id":"bd-32nm","depends_on_id":"bd-omx1","type":"blocks","created_at":"2025-11-05T18:42:35.453823-08:00","created_by":"daemon"}]} +{"id":"bd-iye7","title":"Add path normalization to getMultiRepoJSONLPaths()","description":"From bd-xo6b code review: getMultiRepoJSONLPaths() does not handle non-standard paths correctly.\n\nProblems:\n- No tilde expansion: ~/repos/foo treated as literal path\n- No absolute path conversion: ../other-repo breaks if working directory changes\n- No duplicate detection: If Primary=. and Additional=[.], same JSONL processed twice\n- No empty string handling: Empty paths create invalid /.beads/issues.jsonl\n\nImpact:\nConfig with tilde or relative paths will fail\n\nFix needed:\n1. Use filepath.Abs() for all paths\n2. Add tilde expansion via os.UserHomeDir()\n3. Deduplicate paths (use map to track seen paths)\n4. Filter out empty strings\n5. Validate paths exist and are readable\n\nFiles:\n- cmd/bd/deletion_tracking.go:333-358 (getMultiRepoJSONLPaths function)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T19:31:51.882743-08:00","updated_at":"2025-11-06T19:35:41.246311-08:00","closed_at":"2025-11-06T19:35:41.246311-08:00","dependencies":[{"issue_id":"bd-iye7","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.267906-08:00","created_by":"daemon"}]} +{"id":"bd-f8b764c9.12","title":"Update documentation for hash IDs and aliases","description":"Update all documentation to explain hash-based IDs and aliasing system.\n\n## Files to Update\n\n### 1. README.md\nAdd section explaining hash IDs:\n```markdown\n## Issue IDs\n\nBeads uses **hash-based IDs** for collision-free distributed issue tracking:\n\n- **Hash ID**: `bd-af78e9a2` (8-char SHA256 prefix, immutable, globally unique)\n- **Alias**: `#42` (sequential number, mutable, human-friendly)\n\n### Using IDs\n```bash\nbd show bd-af78e9a2 # Use hash ID\nbd show #42 # Use alias\nbd show 42 # Use alias (shorthand)\n```\n\n### Why Hash IDs?\n- **Collision-free**: Work offline without ID conflicts\n- **Distributed**: No coordination needed between clones\n- **Git-friendly**: Different IDs = different JSONL lines, fewer merge conflicts\n\n### Aliases\nAliases are workspace-local shortcuts for hash IDs. They're:\n- Automatically assigned on issue creation\n- Reassigned deterministically on sync (if conflicts)\n- Can be manually controlled with `bd alias` commands\n```\n\n### 2. AGENTS.md\nUpdate agent workflow:\n```markdown\n## Hash-Based IDs (v2.0+)\n\nBeads v2.0 uses hash-based IDs to eliminate collision problems:\n\n**When creating issues**:\n```bash\nbd create \"Fix bug\" -p 1\n# β†’ Creates bd-af78e9a2 with alias #1\n```\n\n**When referencing issues**:\n- In text: Use hash IDs (stable): \"See bd-af78e9a2 for details\"\n- In CLI: Use aliases (readable): `bd update #42 --status done`\n\n**After sync**:\n- Alias conflicts resolved automatically (content-hash ordering)\n- No ID collisions possible\n- No remapping needed\n\n**Migration from v1.x**:\n```bash\nbd migrate --hash-ids # One-time migration\n```\n```\n\n### 3. QUICKSTART.md (if exists)\nShow alias usage in examples:\n```bash\n# Create issue (gets hash ID + alias)\nbd create \"Fix authentication bug\" -p 1\n# β†’ Created bd-af78e9a2 (alias: #1)\n\n# Reference by alias\nbd show #1\nbd update #1 --status in_progress\nbd close #1 --reason \"Fixed\"\n```\n\n### 4. ADVANCED.md\nAdd section on hash ID internals:\n```markdown\n## Hash ID Generation\n\nHash IDs are generated deterministically:\n\n```go\nSHA256(title || description || timestamp || workspace_id)[:8]\n```\n\n**Collision probability**:\n- 8 hex chars = 2^32 space = ~4 billion IDs\n- Birthday paradox: 50% collision probability at ~65,000 issues\n- For typical projects (\u003c10,000 issues), collision risk is negligible\n\n**Collision detection**:\nIf a hash collision occurs (extremely rare), beads:\n1. Detects on insert (UNIQUE constraint)\n2. Appends random suffix: `bd-af78e9a2-a1b2`\n3. Retries insert\n\n## Alias Conflict Resolution\n\nWhen multiple clones assign same alias to different issues:\n\n**Strategy**: Content-hash ordering (deterministic)\n- Sort conflicting issue IDs lexicographically\n- Lowest hash ID keeps the alias\n- Others reassigned to next available aliases\n\n**Example**:\n```\nClone A: Assigns #42 to bd-a1b2c3d4\nClone B: Assigns #42 to bd-e5f6a7b8\nAfter sync: bd-a1b2c3d4 keeps #42 (lower hash)\n bd-e5f6a7b8 gets #100 (next available)\n```\n```\n\n### 5. MIGRATION.md (new file)\n```markdown\n# Migrating to Hash-Based IDs (v2.0)\n\n## Overview\nBeads v2.0 introduces hash-based IDs to eliminate collision problems. This is a **breaking change** requiring migration.\n\n## Migration Steps\n\n### 1. Backup\n```bash\ncp -r .beads .beads.backup\ngit commit -am \"Pre-migration backup\"\n```\n\n### 2. Run Migration\n```bash\n# Dry run first\nbd migrate --hash-ids --dry-run\n\n# Apply migration\nbd migrate --hash-ids\n```\n\n### 3. Commit Changes\n```bash\ngit add .beads/issues.jsonl\ngit commit -m \"Migrate to hash-based IDs (v2.0)\"\ngit push origin main\n```\n\n### 4. Coordinate with Collaborators\nAll clones must migrate before syncing:\n1. Notify team: \"Migrating to v2.0 on [date]\"\n2. All collaborators pull latest\n3. All run `bd migrate --hash-ids`\n4. All push changes\n5. Resume normal work\n\n## Rollback\n```bash\n# Restore backup\nmv .beads.backup .beads\nbd export # Regenerate JSONL\ngit checkout .beads/issues.jsonl\n```\n\n## FAQ\n\n**Q: Can I mix v1.x and v2.0 clones?**\nA: No. All clones must be on same version.\n\n**Q: Will my old issue IDs work?**\nA: No, but aliases preserve the numbers: bd-1c63eb84 β†’ #1\n\n**Q: What happens to links like \"see bd-cb64c226.3\"?**\nA: Migration updates all text references automatically.\n```\n\n### 6. CHANGELOG.md\n```markdown\n## v2.0.0 (YYYY-MM-DD)\n\n### Breaking Changes\n- **Hash-based IDs**: Issues now use collision-free hash IDs (bd-af78e9a2)\n instead of sequential IDs (bd-1c63eb84, bd-9063acda)\n- **Aliasing system**: Human-friendly aliases (#42) for hash IDs\n- **Migration required**: Run `bd migrate --hash-ids` to convert v1.x databases\n\n### Added\n- `bd alias` command for manual alias control\n- `bd migrate --hash-ids` migration tool\n- Alias conflict resolution (deterministic, content-hash ordering)\n\n### Removed\n- ID collision detection and resolution (~2,100 LOC)\n- `bd import --resolve-collisions` flag (no longer needed)\n\n### Benefits\n- βœ… Zero ID collisions in distributed workflows\n- βœ… Simpler codebase (-1,350 net LOC)\n- βœ… Better git merge behavior\n- βœ… True offline-first operation\n```\n\n## Testing\n- Build docs locally (if using doc generator)\n- Check all links work\n- Verify examples are correct\n- Spellcheck\n\n## Files to Create/Modify\n- README.md (hash ID section)\n- AGENTS.md (workflow updates)\n- ADVANCED.md (internals)\n- MIGRATION.md (new)\n- CHANGELOG.md (v2.0 entry)\n- docs/ (any other docs)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T21:28:10.979971-07:00","updated_at":"2025-10-31T12:32:32.611114-07:00","closed_at":"2025-10-31T12:32:32.611114-07:00","dependencies":[{"issue_id":"bd-f8b764c9.12","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:28:10.981344-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.12","depends_on_id":"bd-f8b764c9.4","type":"blocks","created_at":"2025-10-29T21:28:10.981767-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.12","depends_on_id":"bd-f8b764c9.13","type":"blocks","created_at":"2025-10-29T21:28:10.982167-07:00","created_by":"stevey"}]} +{"id":"bd-8788","title":"Fix monitor-webui status filter","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-21T11:54:18.982820303-07:00","updated_at":"2025-11-21T11:54:36.091639066-07:00","closed_at":"2025-11-21T11:54:36.091639066-07:00"} +{"id":"bd-au0.9","title":"Review and document rarely-used commands","description":"Document use cases or consider deprecation for infrequently-used commands.\n\n**Commands to review:**\n1. bd rename-prefix - How often is this used? Document use cases\n2. bd detect-pollution - Consider integrating into bd validate\n3. bd migrate-hash-ids - One-time migration, keep but document as legacy\n\n**For each command:**\n- Document typical use cases\n- Add examples to help text\n- Consider if it should be a subcommand instead\n- Add deprecation warning if appropriate\n\n**Not changing:**\n- duplicates βœ“ (useful for data quality)\n- repair-deps βœ“ (useful for fixing broken refs)\n- restore βœ“ (critical for compacted issues)\n- compact βœ“ (performance feature)\n\n**Deliverable:**\n- Updated help text\n- Documentation in ADVANCED.md\n- Deprecation plan if needed","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-21T21:08:05.588275-05:00","updated_at":"2025-11-21T21:08:05.588275-05:00","dependencies":[{"issue_id":"bd-au0.9","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:08:05.59003-05:00","created_by":"daemon"}]} +{"id":"bd-5ibn","title":"Latency test 1","notes":"Resetting stale in_progress status from old executor run (yesterday)","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-20T12:16:30.703754-05:00","updated_at":"2025-11-21T14:38:35.458351-05:00"} +{"id":"bd-1022","title":"Use external_ref as primary matching key for import updates","description":"Enable re-syncing from external systems (Jira, GitHub, Linear) by using external_ref as the primary matching key during imports. Currently imports treat any content change as a collision, making it impossible to sync updates from external systems without creating duplicates.\n\nSee GH #142 for detailed proposal and implementation plan.\n\nKey changes needed:\n1. Add findByExternalRef() query function\n2. Update DetectCollisions() to match by external_ref first\n3. Update import_shared.go to update existing issues when external_ref matches\n4. Add index on external_ref for performance\n5. Preserve local issues (no external_ref) from being overwritten\n\nThis enables hybrid workflows: import external backlog, break down with local tasks, re-sync anytime.","notes":"## Code Review Complete βœ…\n\n**Overall Assessment**: EXCELLENT - Production ready\n\n### Implementation Quality\n- βœ“ Clean architecture with proper interface extension\n- βœ“ Dual backend support (SQLite + Memory)\n- βœ“ Smart matching priority: external_ref β†’ ID β†’ content hash\n- βœ“ O(1) lookups with database index\n- βœ“ Timestamp-based conflict resolution\n- βœ“ Comprehensive test coverage (11 test cases)\n\n### Follow-up Issues Filed\nHigh Priority (P2):\n- bd-897a: Add UNIQUE constraint on external_ref column\n- bd-7315: Add validation for duplicate external_ref in batch imports\n\nMedium Priority (P3):\n- bd-f9a1: Add index usage verification test\n- bd-3f6a: Add concurrent import race condition tests\n\nLow Priority (P4):\n- bd-e166: Improve timestamp comparison readability\n- bd-9e23: Optimize Memory backend with index\n- bd-537e: Add external_ref change tracking\n- bd-df11: Add import metrics\n- bd-9f4a: Document external_ref in content hash\n\n### Key Features\nβœ… External systems (Jira, GitHub, Linear) can re-sync without duplicates\nβœ… Hybrid workflows: import external backlog, add local tasks, re-sync anytime\nβœ… Local issues protected from being overwritten\nβœ… Timestamp checking ensures only newer updates applied\nβœ… Performance optimized with database index\n\n**Confidence Level**: 95% - Ship it! πŸš€","status":"closed","issue_type":"feature","created_at":"2025-11-02T14:55:56.355813-08:00","updated_at":"2025-11-02T15:34:56.634126-08:00","closed_at":"2025-11-02T15:27:44.810375-08:00"} +{"id":"bd-e652","title":"bd doctor doesn't detect version mismatches or stale daemons","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:07:56.957214-07:00","updated_at":"2025-11-01T17:05:36.615761-07:00","closed_at":"2025-11-01T17:05:36.615761-07:00","dependencies":[{"issue_id":"bd-e652","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:07:56.958708-07:00","created_by":"stevey"}]} +{"id":"bd-qqvw","title":"Vendor and integrate beads-merge tool","description":"Incorporate @neongreen's beads-merge 3-way merge tool into bd to solve:\n- Multi-workspace deletion sync (bd-hv01)\n- Git merge conflicts in JSONL\n- Field-level intelligent merging\n\n**Repository**: https://github.com/neongreen/mono/tree/main/beads-merge\n\n**Integration approach**: Vendor the Go code with attribution, pending @neongreen's approval (GitHub issue #240)\n\n**Benefits**:\n- Prevents deletion resurrection bug\n- Smart dependency merging (union + dedup)\n- Timestamp handling (max wins)\n- Detects deleted-vs-modified conflicts\n- Works as git merge driver\n\n**Acceptance criteria**:\n- beads-merge code vendored into bd codebase\n- Available as `bd merge` command\n- Git merge driver setup during `bd init`\n- Tests verify 3-way merge logic\n- Documentation updated\n- @neongreen credited","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-05T18:41:59.500359-08:00","updated_at":"2025-11-06T18:19:16.234208-08:00","closed_at":"2025-11-06T15:40:24.796921-08:00"} +{"id":"bd-69bce74a","title":"Platform tests: Linux, macOS, Windows","description":"Test event-driven mode on all platforms. Verify inotify (Linux), FSEvents (macOS), ReadDirectoryChangesW (Windows). Test fallback behavior on each.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.85636-07:00","updated_at":"2025-10-30T17:12:58.193697-07:00","closed_at":"2025-10-29T15:33:22.149551-07:00"} +{"id":"bd-4ec8","title":"Widespread double JSON encoding bug in daemon mode RPC calls","description":"Multiple CLI commands had the same double JSON encoding bug found in bd-1048. All commands that called ResolveID via RPC used string(resp.Data) instead of properly unmarshaling the JSON response. This caused IDs to retain JSON quotes (\"bd-1048\" instead of bd-1048), which then got double-encoded when passed to subsequent RPC calls.\n\nAffected commands:\n- bd show (3 instances)\n- bd dep add/remove/tree (5 instances)\n- bd label add/remove/list (3 instances)\n- bd reopen (1 instance)\n\nRoot cause: resp.Data is json.RawMessage (already JSON-encoded), so string() conversion preserves quotes.\n\nFix: Replace all string(resp.Data) with json.Unmarshal(resp.Data, \u0026id) for proper deserialization.\n\nAll commands now tested and working correctly with daemon mode.","status":"open","issue_type":"bug","created_at":"2025-11-02T22:33:01.632691-08:00","updated_at":"2025-11-02T22:33:01.632691-08:00"} +{"id":"bd-6cxz","title":"Fix MCP tools failing to load in Claude Code (GH#346)","description":"Fix FastMCP schema generation bug by refactoring `Issue` model to avoid recursion.\n \n - Refactored `Issue` in `models.py` to use `LinkedIssue` for dependencies/dependents.\n - Restored missing `Mail*` models to `models.py`.\n - Fixed `tests/test_mail.py` mock assertion.\n \n Fixes GH#346.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T18:53:40.229801-05:00","updated_at":"2025-11-20T18:53:44.280296-05:00","closed_at":"2025-11-20T18:53:44.280296-05:00"} +{"id":"bd-azqv","title":"Ready issue","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:04:22.247039-08:00","updated_at":"2025-11-07T22:07:17.344986-08:00","closed_at":"2025-11-07T21:55:09.429024-08:00"} +{"id":"bd-0qeg","title":"Fix bd doctor hash ID detection for short all-numeric hashes","description":"bd doctor incorrectly flags hash-based IDs as sequential when they are short (3-4 chars) and all-numeric (e.g., pf-158).\n\nRoot cause: isHashID() in cmd/bd/migrate_hash_ids.go:328-358 uses faulty heuristic:\n- For IDs \u003c 5 chars, only returns true if contains letters\n- But base36 hash IDs can be 3+ chars and all-numeric (MinLength: 3)\n- Example: pf-158 is valid hash ID but flagged as sequential\n\nFix: Check multiple IDs (10-20 samples) instead of single-ID pattern matching:\n- Sample IDs across database \n- Check majority pattern (sequential vs hash format)\n- Sequential: 1-4 digits (bd-1, bd-2...)\n- Hash: 3-8 chars base36 (pf-158, pf-3s9...)\n\nImpact: False positive warnings in bd doctor output","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T13:45:20.733761-08:00","updated_at":"2025-11-16T14:27:48.143485-08:00","closed_at":"2025-11-16T14:27:48.143485-08:00"} +{"id":"bd-wpkz","title":"Run tests to ensure refactoring didn't break anything","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:17.264759-08:00","updated_at":"2025-11-23T18:15:22.990153-08:00","closed_at":"2025-11-23T18:15:22.990153-08:00","dependencies":[{"issue_id":"bd-wpkz","depends_on_id":"bd-9csf","type":"blocks","created_at":"2025-11-23T18:08:30.928086-08:00","created_by":"daemon"},{"issue_id":"bd-wpkz","depends_on_id":"bd-wrfz","type":"blocks","created_at":"2025-11-23T18:08:31.009873-08:00","created_by":"daemon"},{"issue_id":"bd-wpkz","depends_on_id":"bd-x2ba","type":"blocks","created_at":"2025-11-23T18:08:31.080663-08:00","created_by":"daemon"},{"issue_id":"bd-wpkz","depends_on_id":"bd-t596","type":"blocks","created_at":"2025-11-23T18:08:31.153866-08:00","created_by":"daemon"}]} +{"id":"bd-69fbe98e","title":"Implement \"bd daemons logs\" subcommand","description":"Add command to view daemon logs for a specific workspace. Requires daemon logging to file (may need separate issue for log infrastructure).","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-26T19:41:11.099659-07:00","updated_at":"2025-11-06T20:06:49.218369-08:00","closed_at":"2025-11-06T19:53:45.855798-08:00"} +{"id":"bd-0e1f2b1b","title":"Event-driven daemon architecture","description":"Replace 5-second polling sync loop with event-driven architecture that reacts instantly to changes. Eliminates stale data issues while reducing CPU ~60%. Key components: FileWatcher (fsnotify), Debouncer (500ms), RPC mutation events, optional git hooks. Target latency: \u003c500ms (vs 5000ms). See event_driven_daemon.md for full design.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T16:20:02.430479-07:00","updated_at":"2025-10-30T17:12:58.221424-07:00","closed_at":"2025-10-28T16:30:26.631191-07:00"} +{"id":"bd-m7ge","title":"Add .beads/README.md during 'bd init' for project documentation and promotion","description":"When 'bd init' is run, automatically generate a .beads/README.md file that:\n\n1. Briefly explains what Beads is (AI-native issue tracking that lives in your repo)\n2. Links to the main repository: https://github.com/steveyegge/beads\n3. Provides a quick reference of essential commands:\n - bd create: Create new issues\n - bd list: View all issues\n - bd update: Modify issue status/details\n - bd show: View issue details\n - bd sync: Sync with git remote\n4. Highlights key benefits for AI coding agents and developers\n5. Encourages developers to try it out\n\nThe README should be enthusiastic and compelling to get open source contributors excited about using Beads for their AI-assisted development workflows.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-16T22:32:50.478681-08:00","updated_at":"2025-11-16T22:32:58.492868-08:00"} +{"id":"bd-2b34.7","title":"Add tests for daemon config module","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.373684-07:00","updated_at":"2025-11-01T21:21:42.431252-07:00","closed_at":"2025-11-01T21:21:42.431252-07:00"} +{"id":"bd-ar2.4","title":"Use TryResurrectParentChain instead of TryResurrectParent in GetNextChildID","description":"## Context\nCurrent bd-dvd fix uses TryResurrectParent, which only resurrects the immediate parent. For deeply nested hierarchies, this might not be sufficient.\n\n## Example Scenario\nCreating child with parent \"bd-abc.1.2\" where:\n- bd-abc exists in DB\n- bd-abc.1 was deleted (missing from DB, exists in JSONL)\n- bd-abc.1.2 was deleted (missing from DB, exists in JSONL)\n\nCurrent fix: Only tries to resurrect \"bd-abc.1.2\", fails because its parent \"bd-abc.1\" is missing.\n\n## Solution\nReplace TryResurrectParent with TryResurrectParentChain:\n\n```go\nif count == 0 {\n // Try to resurrect entire parent chain from JSONL history (bd-dvd fix)\n // This handles deeply nested hierarchies where intermediate parents are also missing\n resurrected, err := s.TryResurrectParentChain(ctx, parentID)\n if err != nil {\n return \"\", fmt.Errorf(\"failed to resurrect parent chain for %s: %w\", parentID, err)\n }\n if !resurrected {\n return \"\", fmt.Errorf(\"parent issue %s does not exist and could not be resurrected from JSONL history\", parentID)\n }\n}\n```\n\n## Investigation\n- Check if this scenario actually happens in practice\n- TryResurrectParentChain already exists (resurrection.go:174-209)\n- May be overkill if users always create parents before children\n\n## Files\n- internal/storage/sqlite/hash_ids.go\n\n## Testing\nAdd test case for deeply nested resurrection","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:01.376071-05:00","updated_at":"2025-11-22T17:48:48.069262-08:00","closed_at":"2025-11-21T11:40:47.682699-05:00","dependencies":[{"issue_id":"bd-ar2.4","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:01.376561-05:00","created_by":"daemon"}]} +{"id":"bd-1f4086c5.1","title":"Integration test: mutation to export latency","description":"Measure time from bd create to JSONL update. Verify \u003c500ms latency. Test with multiple rapid mutations to verify batching.","notes":"Test added to daemon_test.go as TestMutationToExportLatency().\n\nCurrently skipped with note that it should be enabled once bd-146 (event-driven daemon) is fully implemented and enabled by default.\n\nThe test structure is complete:\n1. Sets up test environment with fast debounce (500ms)\n2. SingleMutationLatency: measures latency from mutation to JSONL update\n3. RapidMutationBatching: verifies multiple mutations batch into single export\n\nOnce event-driven mode is default, remove the t.Skip() line and the test will validate \u003c500ms latency.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.103759-07:00","updated_at":"2025-10-30T17:12:58.195867-07:00","closed_at":"2025-10-29T14:19:19.808139-07:00","dependencies":[{"issue_id":"bd-1f4086c5.1","depends_on_id":"bd-1f4086c5","type":"parent-child","created_at":"2025-10-29T20:49:49.107244-07:00","created_by":"import-remap"}]} +{"id":"bd-p3b0","title":"Code review bd-loka implementation","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T17:10:11.237786-08:00","updated_at":"2025-11-23T17:16:12.294528-08:00","closed_at":"2025-11-23T17:16:12.294528-08:00"} +{"id":"bd-dow9","title":"Improve CheckStaleness error handling","description":"## Problem\n\nCheckStaleness returns 'false' (not stale) for multiple error conditions instead of returning errors. This masks problems.\n\n**Location:** internal/autoimport/autoimport.go:253-285\n\n## Edge Cases That Return False\n\n1. **Invalid last_import_time format** (line 259-262)\n - Corrupted metadata returns 'not stale'\n - Could show stale data\n\n2. **No JSONL file found** (line 267-277)\n - If glob fails, falls back to 'issues.jsonl'\n - If that's empty, returns 'not stale'\n\n3. **JSONL stat fails** (line 279-282)\n - Permission denied, file missing\n - Returns 'not stale' even though can't verify\n\n## Current Code\n\n```go\nlastImportTime, err := time.Parse(time.RFC3339, lastImportStr)\nif err \\!= nil {\n return false, nil // ← Should return error\n}\n\n// ...\n\nif jsonlPath == \"\" {\n return false, nil // ← Should return error\n}\n\nstat, err := os.Stat(jsonlPath)\nif err \\!= nil {\n return false, nil // ← Should return error\n}\n```\n\n## Fix\n\n```go\nlastImportTime, err := time.Parse(time.RFC3339, lastImportStr)\nif err \\!= nil {\n return false, fmt.Errorf(\"corrupted last_import_time: %w\", err)\n}\n\n// ...\n\nif jsonlPath == \"\" {\n return false, fmt.Errorf(\"no JSONL file found\")\n}\n\nstat, err := os.Stat(jsonlPath)\nif err \\!= nil {\n return false, fmt.Errorf(\"cannot stat JSONL: %w\", err)\n}\n```\n\n## Impact\nMedium - edge cases are rare but should be handled\n\n## Effort \n30 minutes - requires updating callers in RPC server\n\n## Dependencies\nRequires: bd-n4td (warning on errors)","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:16:45.658965-05:00","updated_at":"2025-11-20T20:16:45.658965-05:00"} +{"id":"bd-ola6","title":"Implement transaction retry logic for SQLITE_BUSY","description":"BEGIN IMMEDIATE fails immediately on SQLITE_BUSY instead of retrying with exponential backoff.\n\nLocation: internal/storage/sqlite/sqlite.go:223-225\n\nProblem:\n- Under concurrent write load, BEGIN IMMEDIATE can fail with SQLITE_BUSY\n- Current implementation fails immediately instead of retrying\n- Results in spurious failures under normal concurrent usage\n\nSolution: Implement exponential backoff retry:\n- Retry up to N times (e.g., 5)\n- Backoff: 10ms, 20ms, 40ms, 80ms, 160ms\n- Check for context cancellation between retries\n- Only retry on SQLITE_BUSY/database locked errors\n\nImpact: Spurious failures under concurrent write load\n\nEffort: 3 hours","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-16T14:51:31.247147-08:00","updated_at":"2025-11-16T14:51:31.247147-08:00"} +{"id":"bd-710a4916","title":"CRDT-based architecture for guaranteed convergence (v2.0)","description":"## Vision\nRedesign beads around Conflict-Free Replicated Data Types (CRDTs) to provide mathematical guarantees for N-way collision resolution at arbitrary scale.\n\n## Current Limitations\n- Content-hash based collision resolution fails at 5+ clones\n- Non-deterministic convergence in multi-round scenarios\n- UNIQUE constraint violations during rename operations\n- No formal proof of convergence properties\n\n## CRDT Benefits\n- Provably convergent (Strong Eventual Consistency)\n- Commutative/Associative/Idempotent operations\n- No coordination required between clones\n- Scales to 100+ concurrent workers\n- Well-understood mathematical foundations\n\n## Proposed Architecture\n\n### 1. UUID-Based IDs\nReplace sequential IDs with UUIDs:\n- Current: bd-1c63eb84, bd-9063acda, bd-4d80b7b1\n- CRDT: bd-a1b2c3d4-e5f6-7890-abcd-ef1234567890\n- Human aliases maintained separately: #42 maps to UUID\n\n### 2. Last-Write-Wins (LWW) Elements\nEach field becomes an LWW register:\n- title: (timestamp, clone_id, value)\n- status: (timestamp, clone_id, value)\n- Deterministic conflict resolution via Lamport timestamp + clone_id tiebreaker\n\n### 3. Operation Log\nTrack all operations as CRDT ops:\n- CREATE(uuid, timestamp, clone_id, fields)\n- UPDATE(uuid, field, timestamp, clone_id, value)\n- DELETE(uuid, timestamp, clone_id) - tombstone, not hard delete\n\n### 4. Sync as Merge\nSyncing becomes merging two CRDT states:\n- No merge conflicts possible\n- Deterministic merge function\n- Guaranteed convergence\n\n## Implementation Phases\n\n### Phase 1: Research \u0026 Design (4 weeks)\n- Study existing CRDT implementations (Automerge, Yjs, Loro)\n- Design schema for CRDT-based issue tracking\n- Prototype LWW-based Issue CRDT\n- Benchmark performance vs current system\n\n### Phase 2: Parallel Implementation (6 weeks)\n- Implement CRDT storage layer alongside SQLite\n- Build conversion tools: SQLite ↔ CRDT\n- Maintain backward compatibility with v1.x format\n- Migration path for existing databases\n\n### Phase 3: Testing \u0026 Validation (4 weeks)\n- Formal verification of convergence properties\n- Stress testing with 100+ clone scenario\n- Performance profiling and optimization\n- Documentation and examples\n\n### Phase 4: Migration \u0026 Rollout (4 weeks)\n- Release v2.0-beta with CRDT backend\n- Gradual migration from v1.x\n- Monitoring and bug fixes\n- Final v2.0 release\n\n## Risks \u0026 Mitigations\n\n**Risk 1: Performance overhead**\n- Mitigation: Benchmark early, optimize hot paths\n- CRDTs can be slower than append-only logs\n- May need compaction strategy\n\n**Risk 2: Storage bloat**\n- Mitigation: Implement operation log compaction\n- Tombstone garbage collection for deleted issues\n- Periodic snapshots to reduce log size\n\n**Risk 3: Breaking changes**\n- Mitigation: Maintain v1.x compatibility layer\n- Gradual migration tools\n- Dual-mode operation during transition\n\n**Risk 4: Complexity**\n- Mitigation: Use battle-tested CRDT libraries\n- Comprehensive documentation\n- Clear migration guide\n\n## Success Criteria\n- 100-clone collision test passes without failures\n- Formal proof of convergence properties\n- Performance within 2x of current system\n- Zero manual conflict resolution required\n- Backward compatible with v1.x databases\n\n## Timeline\n18-20 weeks total (4-5 months)\n\n## References\n- Automerge: https://automerge.org\n- Yjs: https://docs.yjs.dev\n- Loro: https://loro.dev\n- CRDT theory: Shapiro et al, A comprehensive study of CRDTs\n- Related issues: bd-e6d71828, bd-7a2b58fc,-1","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-10-29T10:23:57.978339-07:00","updated_at":"2025-11-08T01:58:15.280264-08:00","closed_at":"2025-11-08T00:54:51.171319-08:00"} +{"id":"bd-6214875c","title":"Split internal/rpc/server.go into focused modules","description":"The file `internal/rpc/server.go` is 2,273 lines with 50+ methods, making it difficult to navigate and prone to merge conflicts. Split into 8 focused files with clear responsibilities.\n\nCurrent structure: Single 2,273-line file with:\n- Connection handling\n- Request routing\n- All 40+ RPC method implementations\n- Storage caching\n- Health checks \u0026 metrics\n- Cleanup loops\n\nTarget structure:\n```\ninternal/rpc/\nβ”œβ”€β”€ server.go # Core server, connection handling (~300 lines)\nβ”œβ”€β”€ methods_issue.go # Issue operations (~400 lines)\nβ”œβ”€β”€ methods_deps.go # Dependency operations (~200 lines)\nβ”œβ”€β”€ methods_labels.go # Label operations (~150 lines)\nβ”œβ”€β”€ methods_ready.go # Ready work queries (~150 lines)\nβ”œβ”€β”€ methods_compact.go # Compaction operations (~200 lines)\nβ”œβ”€β”€ methods_comments.go # Comment operations (~150 lines)\nβ”œβ”€β”€ storage_cache.go # Storage caching logic (~300 lines)\n└── health.go # Health \u0026 metrics (~200 lines)\n```\n\nMigration strategy:\n1. Create new files with appropriate methods\n2. Keep `server.go` as main file with core server logic\n3. Test incrementally after each file split\n4. Final verification with full test suite","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T14:21:37.51524-07:00","updated_at":"2025-10-30T17:12:58.2179-07:00","closed_at":"2025-10-28T14:11:04.399811-07:00"} +{"id":"bd-muls","title":"Install and test MCP Agent Mail locally","description":"Install MCP Agent Mail on a single development machine and verify basic functionality.\n\nAcceptance Criteria:\n- Server installed via one-line installer\n- Server running on port 8765\n- Can register a project via HTTP\n- Can register an agent identity\n- Web UI accessible at /mail","notes":"Tested local installation. Server runs on port 8765, web UI works. MCP API tool execution has errors - needs debugging. See /tmp/bd-muls-report.md for details.","status":"closed","issue_type":"task","created_at":"2025-11-07T22:41:59.896735-08:00","updated_at":"2025-11-07T23:14:59.1182-08:00","closed_at":"2025-11-07T23:14:59.1182-08:00"} +{"id":"bd-0d9c","title":"YABB: Spurious issue updates during normal operations","description":"Issue bd-627d was updated during config refactoring session without any actual changes to it. Only timestamps and content_hash changed.\n\nObserved: Running various bd commands (list, create, etc.) caused bd-627d updated_at to change from 14:14 to 14:31.\n\nExpected: Issues should only be updated when explicitly modified.\n\nThis causes:\n- Dirty JSONL after every session\n- False conflicts in git\n- Confusing git history\n\nLikely culprit: Daemon auto-import/export cycle or database migration touching all issues.","notes":"Investigated thoroughly - unable to reproduce. The import logic has IssueDataChanged() checks before calling UpdateIssue (importer/importer.go:458). All tests pass. May have been fixed by recent refactorings. Closing as cannot reproduce - please reopen with specific repro steps if it occurs again.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-02T14:36:31.023552-08:00","updated_at":"2025-11-02T16:27:39.023535-08:00","closed_at":"2025-11-02T16:27:39.023539-08:00"} +{"id":"bd-3f80d9e0","title":"Improve internal/daemon test coverage (currently 22.5%)","description":"Daemon functionality needs better coverage:\n- Auto-start behavior\n- Lock file management\n- Discovery mechanisms\n- Connection handling\n- Error recovery\n\nCurrent coverage: 58.3% (improved from 22.5% as of Nov 2025)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:30.832728-07:00","updated_at":"2025-11-20T12:40:11.70644-05:00","closed_at":"2025-11-15T14:13:47.303529-08:00"} +{"id":"bd-9063acda","title":"Clean up linter errors (914 total issues)","description":"The codebase has 914 linter issues reported by golangci-lint. While many are documented as baseline in LINTING.md, we should clean these up systematically to improve code quality and maintainability.","notes":"Reduced from 56 to 41 issues locally, then to 0 issues.\n\n**Fixed in commits:**\n- c2c7eda: Fixed 15 actual errors (dupl, gosec, revive, staticcheck, unparam)\n- 963181d: Configured exclusions to get to 0 issues locally\n\n**Current status:**\n- βœ… Local: golangci-lint reports 0 issues\n- ❌ CI: Still failing (see [deleted:bd-cb64c226.1])\n\n**Problem:**\nConfig v2 format or golangci-lint-action@v8 compatibility issue causing CI to fail despite local success.\n\n**Next:** Debug [deleted:bd-cb64c226.1] to fix CI/local discrepancy","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-24T01:01:12.997982-07:00","updated_at":"2025-11-04T11:10:23.532431-08:00","closed_at":"2025-11-04T11:10:23.532433-08:00"} +{"id":"bd-8rd","title":"Migration and onboarding for multi-repo","description":"Create migration tools, wizards, and documentation to help users adopt multi-repo workflow, with special focus on OSS contributor onboarding and team adoption scenarios.","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-04T11:22:13.491033-08:00","updated_at":"2025-11-07T16:08:24.951261-08:00","closed_at":"2025-11-07T16:03:09.75064-08:00","dependencies":[{"issue_id":"bd-8rd","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.858002-08:00","created_by":"daemon"}]} +{"id":"bd-wv9l","title":"Code Review Sweep: thorough","description":"Perform thorough code review sweep based on accumulated activity.\n\n**AI Reasoning:**\nSignificant code activity with 7608 lines added and 120 files changed indicates substantial modifications. Multiple high-churn areas (cmd/bd, internal/rpc) suggest potential for subtle issues and emerging patterns that warrant review.\n\n**Scope:** thorough\n**Target Areas:** cmd/bd, internal/rpc, .beads\n**Estimated Files:** 12\n**Estimated Cost:** $5\n\n**Task:**\nReview files for non-obvious issues that agents miss during focused work:\n- Inefficiencies (algorithmic, resource usage)\n- Subtle bugs (race conditions, off-by-one, copy-paste)\n- Poor patterns (coupling, complexity, duplication)\n- Missing best practices (error handling, docs, tests)\n- Unnamed anti-patterns\n\nFile discovered issues with detailed reasoning and suggestions.","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T23:23:16.056392-08:00","updated_at":"2025-11-21T23:23:16.056392-08:00"} +{"id":"bd-iov0","title":"Document -short flag in testing guide","description":"Add documentation about the -short flag and how it's used to skip slow tests. Should explain that developers can run 'go test -short ./...' for fast iteration and 'go test ./...' for full coverage.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-06T17:30:49.618187-08:00","updated_at":"2025-11-06T20:06:49.220061-08:00","closed_at":"2025-11-06T19:41:08.643188-08:00"} +{"id":"bd-05a1","title":"Isolate RPC server startup into rpc_server.go","description":"Create internal/daemonrunner/rpc_server.go with StartRPC function. Move startRPCServer logic here and return typed handle.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.876839-07:00","updated_at":"2025-11-02T12:32:00.158054-08:00","closed_at":"2025-11-02T12:32:00.158057-08:00"} +{"id":"bd-xo6b","title":"Review multi-repo deletion tracking implementation","description":"Thoroughly review the multi-repo deletion tracking fix (bd-4oob):\n\nFiles changed:\n- cmd/bd/deletion_tracking.go: Added getMultiRepoJSONLPaths() helper\n- cmd/bd/daemon_sync.go: Updated snapshot capture/update logic for multi-repo\n- cmd/bd/deletion_tracking_test.go: Added 2 new tests (287 lines)\n\nReview focus areas:\n1. Correctness: Does getMultiRepoJSONLPaths() handle all edge cases?\n2. Performance: Calling getMultiRepoJSONLPaths() 3x per sync (snapshot capture, merge, base update) - should we cache?\n3. Error handling: What if some repos fail snapshot operations but others succeed?\n4. Race conditions: Multiple daemons in different repos?\n5. Test coverage: Are TestMultiRepoDeletionTracking and TestMultiRepoSnapshotIsolation sufficient?\n6. Path handling: Absolute vs relative paths, tilde expansion\n\nThis is fresh code - needs careful review before considering deletion tracking production-ready.","notes":"Code review completed. Overall assessment: Core deletion tracking logic is sound, but error handling and path handling issues make this not yet production-ready for multi-repo scenarios.\n\nKey findings:\n\nCRITICAL ISSUES (Priority 1):\n1. Inconsistent error handling in daemon_sync.go - snapshot/merge fail hard but base update warns. Can leave DB in inconsistent state with no rollback. See bd-sjmr.\n2. No path normalization in getMultiRepoJSONLPaths() - tilde expansion, relative paths, duplicates not handled. See bd-iye7.\n\nSHOULD FIX (Priority 2):\n3. Missing test coverage for edge cases - empty paths, duplicates, partial failures. See bd-kdoh.\n4. Performance - getMultiRepoJSONLPaths() called 3x per sync (minor issue). See bd-we4p.\n\nWHAT WORKS WELL:\n- Atomic file operations with PID-based temp files\n- Good snapshot isolation between repos\n- Race condition protection via exclusive locks\n- Solid test coverage for happy path scenarios\n\nVERDICT: Address bd-iye7 and bd-sjmr before considering deletion tracking production-ready for multi-repo mode.\n\nDetailed review notes available in conversation history.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-06T19:23:52.402949-08:00","updated_at":"2025-11-06T19:32:34.160341-08:00","closed_at":"2025-11-06T19:32:34.160341-08:00","dependencies":[{"issue_id":"bd-xo6b","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T19:23:52.403723-08:00","created_by":"daemon"}]} +{"id":"bd-rbxi","title":"bd-hv01: Deletion tracking production readiness","description":"Epic to track all improvements and fixes needed to make the deletion tracking implementation ([deleted:bd-hv01]) production-ready.\n\nThe core 3-way merge algorithm is sound, but there are critical issues around atomicity, error handling, and edge cases that need to be addressed before this can be safely used in production.\n\nCritical path (P1):\n- Non-atomic snapshot operations\n- Brittle JSON string comparison\n- Silent partial deletion failures\n- Race conditions in concurrent scenarios\n\nFollow-up work (P2-P3):\n- Test coverage for edge cases and multi-repo mode\n- Performance optimizations\n- Code refactoring and observability\n\nRelated commit: 708a81c","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-06T18:18:24.315646-08:00","updated_at":"2025-11-08T03:12:04.15385-08:00","closed_at":"2025-11-08T02:19:19.780741-08:00"} +{"id":"bd-loka.4","title":"Add upgrade notification system to bd ready/list","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:31.227711-08:00","updated_at":"2025-11-23T17:06:31.830726-08:00","closed_at":"2025-11-23T17:06:31.830726-08:00","dependencies":[{"issue_id":"bd-loka.4","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:31.228284-08:00","created_by":"daemon"}]} +{"id":"bd-ts0c","title":"Merge PR #300: gitignore upgrade feature","description":"PR #300 is ready to merge but has rebase conflicts with main.\n\n**Context:**\n- PR implements 3 mechanisms for .beads/.gitignore upgrade (bd doctor --fix, daemon auto-upgrade, bd init idempotent)\n- Conflicts resolved locally but diverged branches make push difficult\n- All fixes applied: removed merge artifact, applied new gitignore template\n- Clean scope: only 6 files changed (+194/-42)\n\n**Next steps:**\n1. Option A: Merge via GitHub UI (resolve conflicts in web interface)\n2. Option B: Fresh rebase on main and force push\n3. Verify CI passes\n4. Squash and merge\n\nPR URL: https://github.com/steveyegge/beads/pull/300\nFixes: #274","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-12T11:56:22.778982-08:00","updated_at":"2025-11-12T12:46:36.550488-08:00","closed_at":"2025-11-12T12:46:36.550488-08:00"} +{"id":"bd-7c5915ae","title":"Run final validation and cleanup checks","description":"Final validation pass to ensure all cleanup objectives met and no regressions introduced.\n\nValidation checklist:\n1. Dead code verification: `go run golang.org/x/tools/cmd/deadcode@latest -test ./...`\n2. Test coverage: `go test -cover ./...`\n3. Build verification: `go build ./cmd/bd/`\n4. Linting: `golangci-lint run`\n5. Integration tests\n6. Metrics verification\n7. Git clean check\n\nFinal metrics to report:\n- LOC removed: ~____\n- Files deleted: ____\n- Files created: ____\n- Test coverage: ____%\n- Build time: ____ (before/after)\n- Test run time: ____ (before/after)\n\nImpact: Confirms all cleanup objectives achieved successfully","notes":"## Validation Results (Oct 31, 2025)\n\n**Dead Code:** βœ… Removed 5 unreachable functions (~200 LOC)\n- computeIssueContentHash, shouldSkipExport (autoflush.go)\n- addDependencyUnchecked, removeDependencyIfExists (dependencies.go)\n- isUniqueConstraintError (util.go)\n\n**Tests:** βœ… All pass\n**Coverage:** \n- Main package: 39.6%\n- cmd/bd: 19.5%\n- internal/daemon: 37.8%\n- internal/storage/sqlite: 58.1%\n- internal/rpc: 58.6%\n\n**Build:** βœ… Clean (24.5 MB binary)\n**Linting:** 247 issues (mostly errcheck on defer/Close statements)\n**Integration Tests:** βœ… All pass\n**Metrics:** 55,622 LOC across 200 Go files\n**Git:** 3 files modified (dead code removal)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.131575-07:00","updated_at":"2025-10-31T15:12:01.955668-07:00","closed_at":"2025-10-31T15:12:01.955668-07:00","dependencies":[{"issue_id":"bd-7c5915ae","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-31T19:38:09.176473-07:00","created_by":"stevey"}]} +{"id":"bd-u3t","title":"Phase 2: Implement sandbox auto-detection for GH #353","description":"Implement automatic sandbox detection to improve UX for users in sandboxed environments (e.g., Codex).\n\n**Tasks:**\n1. Implement sandbox detection heuristic using syscall.Kill permission checks\n2. Auto-enable --sandbox mode when sandbox is detected\n3. Display informative message when sandbox is detected\n\n**Implementation:**\n- Add isSandboxed() function in cmd/bd/main.go\n- Auto-set sandboxMode = true in PersistentPreRun when detected\n- Show: 'ℹ️ Sandbox detected, using direct mode'\n\n**References:**\n- docs/GH353_INVESTIGATION.md (Solution 3, lines 120-160)\n- Depends on: Phase 1 (bd-???)\n\n**Acceptance Criteria:**\n- Codex users don't need to manually specify --sandbox\n- No false positives in normal environments\n- Clear messaging when auto-detection triggers","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T18:51:57.254358-05:00","updated_at":"2025-11-22T17:48:48.074198-08:00","closed_at":"2025-11-21T19:28:24.467713-05:00"} +{"id":"bd-lm2q","title":"Fix `bd sync` failure due to daemon auto-export timestamp skew","description":"`bd sync` fails with false-positive \"JSONL is newer than database\" after daemon auto-export.\nRoot Cause: Daemon exports local changes to JSONL, updating its timestamp. `bd sync` sees JSONL.mtime \u003e DB.mtime and assumes external changes, blocking export.\nProposed Fixes:\n1. `bd sync` auto-imports if timestamp matches but content differs (or just auto-imports).\n2. Content-based comparison instead of timestamp only.\n","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T18:56:16.876685-05:00","updated_at":"2025-11-20T21:38:32.758418-05:00","closed_at":"2025-11-20T20:54:39.512574-05:00"} +{"id":"bd-znyw","title":"Change default JSONL filename from beads.jsonl back to issues.jsonl throughout codebase","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-21T23:27:07.137649-08:00","updated_at":"2025-11-21T23:34:05.029974-08:00","closed_at":"2025-11-21T23:34:05.029974-08:00"} +{"id":"bd-4d80b7b1","title":"Investigate and upgrade to modernc.org/sqlite 1.39.1+","description":"We had to pin modernc.org/sqlite to v1.38.2 due to a FOREIGN KEY constraint regression in v1.39.1 (SQLite 3.50.4).\n\n**Issue:** [deleted:bd-cb64c226.2], GH #144\n\n**Symptom:** CloseIssue fails with \"FOREIGN KEY constraint failed (787)\" when called via MCP/daemon, but works fine via CLI.\n\n**Root Cause:** Unknown - likely stricter FK enforcement in SQLite 3.50.4 or modernc.org wrapper changes.\n\n**Workaround:** Pinned to v1.38.2 (SQLite 3.49.x)\n\n**TODO:**\n1. Monitor modernc.org/sqlite releases for fixes\n2. Check SQLite 3.50.5+ changelogs for FK-related fixes\n3. Investigate why daemon mode fails but CLI succeeds (connection reuse? transaction isolation?)\n4. Consider filing upstream issue with reproducible test case\n5. Upgrade when safe","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-24T11:49:12.836292-07:00","updated_at":"2025-11-07T14:55:51.908404-08:00","closed_at":"2025-11-07T14:55:51.908404-08:00"} +{"id":"bd-46381404","title":"Test database naming","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T18:27:28.309676-07:00","updated_at":"2025-10-31T12:00:43.185201-07:00","closed_at":"2025-10-31T12:00:43.185201-07:00"} +{"id":"bd-ar2.5","title":"Add error handling guidance for export metadata update failures","description":"## Problem\nThe bd-ymj fix treats all metadata update failures as warnings:\n\n```go\nif err := store.SetMetadata(ctx, \"last_import_hash\", currentHash); err != nil {\n log.log(\"Warning: failed to update last_import_hash: %v\", err)\n}\n```\n\nBut if metadata updates fail, the NEXT export will fail with \"JSONL content has changed since last import\".\n\n## Questions\n1. Should metadata failures be critical (return error)?\n2. Should we implement retry logic?\n3. Is warning acceptable (safe, just requires import before next export)?\n\n## Current Behavior\n- Metadata failure is silent (only logged)\n- User won't know until next export fails\n- Next export requires import first (safe but annoying)\n\n## Recommendation\nAdd clear comment explaining the trade-off:\n\n```go\n// Note: Metadata update failures are treated as warnings, not errors.\n// This is acceptable because the worst case is the next export will\n// require an import first, which is safe and prevents data loss.\n// Alternative: Make this critical and fail the export if metadata\n// updates fail (but this makes exports more fragile).\nif err := store.SetMetadata(ctx, \"last_import_hash\", currentHash); err != nil {\n log.log(\"Warning: failed to update last_import_hash: %v\", err)\n log.log(\"Next export may require running 'bd import' first\")\n}\n```\n\n## Files\n- cmd/bd/daemon_sync.go\n\n## Decision Needed\nChoose approach based on failure mode preferences","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:16.52788-05:00","updated_at":"2025-11-22T17:48:48.06977-08:00","closed_at":"2025-11-21T11:40:47.684741-05:00","dependencies":[{"issue_id":"bd-ar2.5","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:16.528351-05:00","created_by":"daemon"}]} +{"id":"bd-bwk2","title":"Centralize error handling patterns in storage layer","description":"80+ instances of inconsistent error handling across sqlite.go with mix of %w, %v, and no wrapping.\n\nLocation: internal/storage/sqlite/sqlite.go (throughout)\n\nProblem:\n- Some use fmt.Errorf(\"op failed: %w\", err) - correct wrapping\n- Some use fmt.Errorf(\"op failed: %v\", err) - loses error chain\n- Some return err directly - no context\n- Hard to debug production issues\n- Can't distinguish error types\n\nSolution: Create internal/storage/sqlite/errors.go:\n- Define sentinel errors (ErrNotFound, ErrInvalidID, etc.)\n- Create wrapDBError(op string, err error) helper\n- Convert sql.ErrNoRows to ErrNotFound\n- Always wrap with operation context\n\nImpact: Lost error context; inconsistent messages; hard to debug\n\nEffort: 5-7 hours","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-16T14:51:54.974909-08:00","updated_at":"2025-11-16T14:51:54.974909-08:00"} +{"id":"bd-be7a","title":"Create npm package structure with package.json","description":"Set up initial npm package structure for @beads/bd:\n\n## Files to create\n- npm/package.json - Package metadata, dependencies, scripts\n- npm/bin/bd - CLI wrapper script that invokes native binary\n- npm/.gitignore - Ignore downloaded binaries\n- npm/README.md - Installation and usage instructions\n\n## package.json structure\n- Name: @beads/bd (scoped package)\n- Main: index.js (exports binary path)\n- Bin: bin/bd (CLI entry point)\n- Scripts: postinstall (download binary)\n- Keywords: issue-tracker, cli, beads, bd\n- License: MIT\n\n## Bin wrapper\nSimple Node.js script that:\n- Spawns native binary with child_process.spawn\n- Passes through all arguments and stdio\n- Exits with binary's exit code","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:39:47.416779-08:00","updated_at":"2025-11-03T10:31:45.381258-08:00","closed_at":"2025-11-03T10:31:45.381258-08:00","dependencies":[{"issue_id":"bd-be7a","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.923859-08:00","created_by":"daemon"}]} +{"id":"bd-vcg5","title":"Daemon crash recovery: panic handler + socket cleanup","description":"Improve daemon cleanup on unexpected exit:\n1. Add top-level recover() in runDaemonLoop to capture panics\n2. Write daemon-error file with stack trace on panic\n3. Prefer return over os.Exit where possible (so defers run)\n4. In stopDaemon forced-kill path, also remove stale socket if present\n\nThis ensures better diagnostics and cleaner state after crashes.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T16:42:12.733219-08:00","updated_at":"2025-11-07T22:07:17.347728-08:00","closed_at":"2025-11-07T21:17:15.94117-08:00","dependencies":[{"issue_id":"bd-vcg5","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.733889-08:00","created_by":"daemon"}]} +{"id":"bd-ar2.2","title":"Add multi-repo support to export metadata updates","description":"## Problem\nThe bd-ymj fix only updates metadata for the main jsonlPath, but the codebase supports multi-repo mode where exports write to multiple JSONL files.\n\nOther daemon_sync operations handle multi-repo correctly:\n- Lines 509-518: Snapshots captured for all multi-repo paths\n- Lines 578-587: Deletions applied for all multi-repo paths\n\nBut metadata updates are missing!\n\n## Investigation Needed\nMetadata is stored globally in database (`last_import_hash`, `last_import_mtime`), but multi-repo has per-repo JSONL files. Current schema may not support tracking multiple JSONL files.\n\nOptions:\n1. Store metadata per-repo (new schema)\n2. Store combined hash of all repos\n3. Document that multi-repo doesn't need this metadata (why?)\n\n## Solution (if needed)\n```go\n// After export\nif multiRepoPaths := getMultiRepoJSONLPaths(); multiRepoPaths != nil {\n // Multi-repo mode: update metadata for each JSONL\n for _, path := range multiRepoPaths {\n updateExportMetadata(exportCtx, store, path, log)\n }\n} else {\n // Single-repo mode: update metadata for main JSONL\n updateExportMetadata(exportCtx, store, jsonlPath, log)\n}\n```\n\n## Files\n- cmd/bd/daemon_sync.go (createExportFunc, createSyncFunc)\n- Possibly: internal/storage/sqlite/metadata.go (schema changes)\n\n## Related\nDepends on bd-ar2.1 (extract helper function first)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:24:32.482102-05:00","updated_at":"2025-11-22T17:48:48.068263-08:00","closed_at":"2025-11-21T11:07:17.124957-05:00","dependencies":[{"issue_id":"bd-ar2.2","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:24:32.482559-05:00","created_by":"daemon"}]} +{"id":"bd-e16b","title":"Replace BEADS_DB with BEADS_DIR environment variable","description":"Implement BEADS_DIR as a replacement for BEADS_DB to point to the .beads directory instead of the database file directly.\n\nRationale:\n- With --no-db mode, there's no .db file to point to\n- The .beads directory is the logical unit (contains config.yaml, db files, jsonl files)\n- More intuitive: point to the beads directory not the database file\n\nImplementation:\n1. Add BEADS_DIR environment variable support\n2. Maintain backward compatibility with BEADS_DB\n3. Priority order: BEADS_DIR \u003e BEADS_DB \u003e auto-discovery\n4. If BEADS_DIR is set, look for config.yaml in that directory to find actual database path\n5. Update documentation and migration guide\n\nFiles to modify:\n- beads.go (FindDatabasePath function)\n- cmd/bd/main.go (initialization)\n- Documentation (CLI_REFERENCE.md, TROUBLESHOOTING.md, etc.)\n- MCP integration (integrations/beads-mcp/src/beads_mcp/config.py)\n\nTesting:\n- Ensure BEADS_DB still works (backward compatibility)\n- Test BEADS_DIR with both db and --no-db modes\n- Test priority order when both are set\n- Update integration tests\n\nRelated to GitHub issue #179","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-02T18:19:26.131948-08:00","updated_at":"2025-11-02T18:27:14.545162-08:00","closed_at":"2025-11-02T18:27:14.545162-08:00"} +{"id":"bd-fb05","title":"Refactor sqlite.go into focused modules","description":"Split sqlite.go (2,298 lines) into focused modules: migrations.go, ids.go, issues.go, events.go, dirty.go, db.go. This will improve maintainability and reduce cognitive load.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-01T11:41:14.805895-07:00","updated_at":"2025-11-01T22:30:09.833675-07:00","closed_at":"2025-11-01T22:30:09.833675-07:00"} +{"id":"bd-1pj6","title":"Proposal: Custom status states via config","description":"Proposal to add 'custom status states' via `bd config`.\nUsers could define an optional issue status enum (e.g., awaiting_review, review_in_progress) in the config.\nThis would enable multi-step pipelines to process issues where each step correlates to a specific status.\n\nExamples:\n- awaiting_verification\n- awaiting_docs\n- awaiting_testing\n","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-20T18:55:48.670499-05:00","updated_at":"2025-11-20T18:55:48.670499-05:00"} +{"id":"bd-d355a07d","title":"Import validation falsely reports data loss on collision resolution","description":"## Problem\n\nPost-import validation reports 'data loss detected!' when import count reduces due to legitimate collision resolution.\n\n## Example\n\n```\nImport complete: 1 created, 8 updated, 142 unchanged, 19 skipped, 1 issues remapped\nPost-import validation failed: import reduced issue count: 165 β†’ 164 (data loss detected!)\n```\n\nThis was actually successful collision resolution (bd-70419816 duplicated β†’ remapped to-70419816), not data loss.\n\n## Impact\n\n- False alarms waste investigation time\n- Undermines confidence in import validation\n- Confuses users/agents about sync health\n\n## Solution\n\nImprove validation to distinguish:\n- Collision-resolution merges (expected count reduction)\n- Actual data loss (unexpected disappearance)\n\nTrack remapped issue count and adjust expected post-import count accordingly.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-29T23:15:00.815227-07:00","updated_at":"2025-11-08T01:58:15.283088-08:00","closed_at":"2025-11-08T00:33:04.659308-08:00"} +{"id":"bd-lwnt","title":"Test P1 priority","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T12:58:38.074112-08:00","updated_at":"2025-11-05T12:58:44.711763-08:00","closed_at":"2025-11-05T12:58:44.711763-08:00"} +{"id":"bd-c4rq","title":"Refactor: Move staleness check inside daemon branch","description":"## Problem\n\nCurrently ensureDatabaseFresh() is called before the daemon mode check, but it checks daemonClient != nil internally and returns early. This is redundant.\n\n**Location:** All read commands (list.go:196, show.go:27, ready.go:102, status.go:80, etc.)\n\n## Current Pattern\n\nCall happens before daemon check, function checks daemonClient internally.\n\n## Better Pattern\n\nMove staleness check to direct mode branch only, after daemon check.\n\n## Impact\nLow - minor performance improvement (avoids one function call per command in daemon mode)\n\n## Effort\nMedium - requires refactoring 8 command files\n\n## Priority\nLow - can defer to future cleanup PR","status":"open","priority":3,"issue_type":"chore","created_at":"2025-11-20T20:17:45.119583-05:00","updated_at":"2025-11-20T20:17:45.119583-05:00"} +{"id":"bd-736d","title":"Refactor path canonicalization into helper function","description":"The path canonicalization logic (filepath.Abs + EvalSymlinks) is duplicated in 3 places:\n- beads.go:131-137 (BEADS_DIR handling)\n- cmd/bd/main.go:446-451 (--no-db cleanup)\n- cmd/bd/nodb.go:26-31 (--no-db initialization)\n\nRefactoring suggestion:\nExtract to a helper function like:\n func canonicalizePath(path string) string\n\nThis would:\n- Reduce code duplication\n- Make the logic easier to maintain\n- Ensure consistent behavior across all path handling\n\nRelated to bd-e16b implementation.","status":"open","priority":3,"issue_type":"chore","created_at":"2025-11-02T18:33:47.727443-08:00","updated_at":"2025-11-02T18:33:47.727443-08:00"} +{"id":"bd-dcd6f14b","title":"Batch test 4","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:02.053523-07:00","updated_at":"2025-10-31T12:00:43.182861-07:00","closed_at":"2025-10-31T12:00:43.182861-07:00"} +{"id":"bd-ybv5","title":"Refactor AGENTS.md to use external references","description":"Suggestion to use external references (e.g., \"ALWAYS REFER TO ./beads/prompt.md\") instead of including all instructions directly within AGENTS.md.\nReasons:\n1. Agents can follow external references.\n2. Prevents context pollution/stuffing in AGENTS.md as more tools append instructions.\n","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-20T18:55:53.259144-05:00","updated_at":"2025-11-20T18:55:53.259144-05:00"} +{"id":"bd-763c","title":"~/src/beads daemon has 'sql: database is closed' errors - zombie daemon","status":"closed","issue_type":"bug","created_at":"2025-10-31T21:08:03.388007-07:00","updated_at":"2025-10-31T21:52:04.214274-07:00","closed_at":"2025-10-31T21:52:04.214274-07:00","dependencies":[{"issue_id":"bd-763c","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:03.388716-07:00","created_by":"stevey"}]} +{"id":"bd-1fkr","title":"bd-hv01: Storage backend extensibility broken by type assertion","description":"Problem: deletion_tracking.go:69-82 uses type assertion for DeleteIssue which breaks if someone adds a new storage backend.\n\nFix: Check capability before starting merge or add DeleteIssue to Storage interface.\n\nFiles: cmd/bd/deletion_tracking.go:69-82, internal/storage/storage.go","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T18:16:20.770662-08:00","updated_at":"2025-11-06T18:55:08.666253-08:00","closed_at":"2025-11-06T18:55:08.666253-08:00","dependencies":[{"issue_id":"bd-1fkr","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.925961-08:00","created_by":"daemon"}]} +{"id":"bd-7c831c51","title":"Run final validation and cleanup checks","description":"Final validation pass to ensure all cleanup objectives met and no regressions introduced.\n\nValidation checklist:\n1. Dead code verification: `go run golang.org/x/tools/cmd/deadcode@latest -test ./...`\n2. Test coverage: `go test -cover ./...`\n3. Build verification: `go build ./cmd/bd/`\n4. Linting: `golangci-lint run`\n5. Integration tests\n6. Metrics verification\n7. Git clean check\n\nFinal metrics to report:\n- LOC removed: ~____\n- Files deleted: ____\n- Files created: ____\n- Test coverage: ____%\n- Build time: ____ (before/after)\n- Test run time: ____ (before/after)\n\nImpact: Confirms all cleanup objectives achieved successfully","notes":"## Validation Results\n\n**Dead Code:** βœ… Found and removed 1 unreachable function (`DroppedEventsCount`) \n**Tests:** βœ… All pass \n**Coverage:** \n- Main: 39.6%\n- cmd/bd: 20.2%\n- Created follow-up issues (bd-85487065 through bd-bc2c6191) to improve coverage\n \n**Build:** βœ… Clean \n**Linting:** 73 issues (up from 34 baseline) \n- Increase due to unused functions from refactoring\n- Need cleanup in separate issue\n \n**Integration Tests:** βœ… All pass \n**Metrics:** 56,464 LOC across 193 Go files \n**Git:** 2 files modified (deadcode fix + auto-synced JSONL)\n\n## Follow-up Issues Created\n- bd-85487065: Add tests for internal/autoimport (0% coverage)\n- bd-0dcea000: Add tests for internal/importer (0% coverage)\n- bd-4d7fca8a: Add tests for internal/utils (0% coverage)\n- bd-6221bdcd: Improve cmd/bd coverage (20.2% -\u003e target higher)\n- bd-bc2c6191: Improve internal/daemon coverage (22.5% -\u003e target higher)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:02:47.956276-07:00","updated_at":"2025-10-30T17:12:58.193468-07:00","closed_at":"2025-10-29T14:19:35.095553-07:00"} +{"id":"bd-biwp","title":"Support local-only git repos without remote origin","description":"Daemon crashes when working with local git repos that don't have origin remote configured. Should gracefully degrade to local-only mode: skip git pull/push operations but maintain daemon features (RPC server, auto-flush, JSONL export).","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-09T16:09:50.677769-08:00","updated_at":"2025-11-09T16:16:56.588548-08:00","closed_at":"2025-11-09T16:16:56.588548-08:00"} +{"id":"bd-f8b764c9.10","title":"Add alias field to database schema","description":"Extend database schema to support human-friendly aliases alongside hash IDs.\n\n## Database Changes\n\n### 1. Add alias column to issues table\n```sql\nALTER TABLE issues ADD COLUMN alias INTEGER UNIQUE;\nCREATE INDEX idx_issues_alias ON issues(alias);\n```\n\n### 2. Add alias counter table\n```sql\nCREATE TABLE alias_counter (\n id INTEGER PRIMARY KEY CHECK (id = 1),\n next_alias INTEGER NOT NULL DEFAULT 1\n);\nINSERT INTO alias_counter (id, next_alias) VALUES (1, 1);\n```\n\n### 3. Add alias conflict tracking (for multi-clone scenarios)\n```sql\nCREATE TABLE alias_history (\n issue_id TEXT NOT NULL,\n alias INTEGER NOT NULL,\n assigned_at TIMESTAMP NOT NULL,\n workspace_id TEXT NOT NULL,\n PRIMARY KEY (issue_id, alias)\n);\n```\n\n## API Changes\n\n### CreateIssue\n- Generate hash ID\n- Assign next available alias\n- Store both in database\n\n### ResolveAliasConflicts (new function)\n- Detect conflicting alias assignments after import\n- Apply resolution strategy (content-hash ordering)\n- Reassign losers to next available aliases\n\n## Migration Path\n```bash\nbd migrate --add-aliases # Adds columns, assigns aliases to existing issues\n```\n\n## Files to Modify\n- internal/storage/sqlite/schema.go\n- internal/storage/sqlite/sqlite.go (CreateIssue, GetIssue)\n- internal/storage/sqlite/aliases.go (new file for alias logic)\n- internal/storage/sqlite/migrations.go\n\n## Testing\n- Test alias auto-assignment on create\n- Test alias uniqueness constraint\n- Test alias lookup performance\n- Test alias conflict resolution","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:13.968241-07:00","updated_at":"2025-10-31T12:32:32.610663-07:00","closed_at":"2025-10-31T12:32:32.610663-07:00","dependencies":[{"issue_id":"bd-f8b764c9.10","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:13.96959-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.10","depends_on_id":"bd-f8b764c9.11","type":"blocks","created_at":"2025-10-29T21:29:45.952824-07:00","created_by":"stevey"}]} +{"id":"bd-b501fcc1","title":"Unit tests for Debouncer","description":"Test debouncer batches multiple triggers into single action. Test timer reset on subsequent triggers. Test cancel during wait. Test thread safety.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.86146-07:00","updated_at":"2025-10-31T17:54:06.880513-07:00","closed_at":"2025-10-31T17:54:06.880513-07:00"} +{"id":"bd-6sd1","title":"Issue to close","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T19:00:16.547698-08:00","updated_at":"2025-11-07T19:00:16.570826-08:00","closed_at":"2025-11-07T19:00:16.570826-08:00"} +{"id":"bd-tmdx","title":"Investigate database pollution - unexpected issue count increases","description":"Two repositories showing unexpected issue counts:\n- ~/src/beads: 280 issues (expected ~209-220)\n- ~/src/dave/beads: 895 issues (675 open, 149 closed)\n\nThis suggests database pollution - issues from one repository leaking into another. Need to investigate:\n1. Run bd detect-pollution on both repos\n2. Check for cross-repo contamination\n3. Identify source of pollution (daemon? multi-repo config? import issues?)\n4. Clean up polluted databases\n5. Prevent future pollution","status":"closed","issue_type":"bug","created_at":"2025-11-06T22:50:16.957689-08:00","updated_at":"2025-11-07T00:05:38.994405-08:00","closed_at":"2025-11-07T00:05:38.994405-08:00"} +{"id":"bd-chsc","title":"Test lowercase p0","status":"closed","issue_type":"task","created_at":"2025-11-05T12:58:41.457875-08:00","updated_at":"2025-11-05T12:58:44.721486-08:00","closed_at":"2025-11-05T12:58:44.721486-08:00"} +{"id":"bd-cb2f","title":"Week 1 task","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-03T19:11:59.358093-08:00","updated_at":"2025-11-03T19:11:59.358093-08:00"} +{"id":"bd-d9e0","title":"Extract validation functions to validators.go","description":"Move validatePriority, validateStatus, validateIssueType, validateTitle, validateEstimatedMinutes, validateFieldUpdate to validators.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.915909-07:00","updated_at":"2025-11-02T12:32:00.159298-08:00","closed_at":"2025-11-02T12:32:00.1593-08:00"} +{"id":"bd-fb95094c.7","title":"Extract SQLite migrations into separate files","description":"The file `internal/storage/sqlite/sqlite.go` is 2,136 lines and contains 11 sequential migrations alongside core storage logic. Extract migrations into a versioned system.\n\nCurrent issues:\n- 11 migration functions mixed with core logic\n- Hard to see migration history\n- Sequential migrations slow database open\n- No clear migration versioning\n\nMigration functions to extract:\n- `migrateDirtyIssuesTable()`\n- `migrateIssueCountersTable()`\n- `migrateExternalRefColumn()`\n- `migrateCompositeIndexes()`\n- `migrateClosedAtConstraint()`\n- `migrateCompactionColumns()`\n- `migrateSnapshotsTable()`\n- `migrateCompactionConfig()`\n- `migrateCompactedAtCommitColumn()`\n- `migrateExportHashesTable()`\n- Plus 1 more (11 total)\n\nTarget structure:\n```\ninternal/storage/sqlite/\nβ”œβ”€β”€ sqlite.go # Core storage (~800 lines)\nβ”œβ”€β”€ schema.go # Table definitions (~200 lines)\nβ”œβ”€β”€ migrations.go # Migration orchestration (~200 lines)\n└── migrations/ # Individual migrations\n β”œβ”€β”€ 001_initial_schema.go\n β”œβ”€β”€ 002_dirty_issues.go\n β”œβ”€β”€ 003_issue_counters.go\n [... through 011_export_hashes.go]\n```\n\nBenefits:\n- Clear migration history\n- Each migration self-contained\n- Easier to review migration changes in PRs\n- Future migrations easier to add","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:30:47.870671-07:00","updated_at":"2025-11-06T20:05:05.01308-08:00","closed_at":"2025-11-06T20:05:05.01308-08:00","dependencies":[{"issue_id":"bd-fb95094c.7","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:47.875564-07:00","created_by":"daemon"}]} +{"id":"bd-eqjc","title":"bd init creates nested .beads directories","description":"bd init sometimes creates .beads/.beads/ nested directories, which should never happen. This occurs fairly often and can cause confusion about which .beads directory is active. Need to add validation to detect if already inside a .beads directory and either error or use the parent .beads location.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T22:21:22.948727-08:00","updated_at":"2025-11-06T22:22:41.04958-08:00","closed_at":"2025-11-06T22:22:41.04958-08:00"} +{"id":"bd-71ky","title":"Fix bd --version and bd completion to work without database","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T02:06:00.78393-08:00","updated_at":"2025-11-08T02:06:11.452474-08:00","closed_at":"2025-11-08T02:06:11.452474-08:00"} +{"id":"bd-r1pf","title":"Test label","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-06T20:16:20.609492-08:00","updated_at":"2025-11-06T20:16:34.973855-08:00","closed_at":"2025-11-06T20:16:34.973855-08:00"} +{"id":"bd-h4hc","title":"Test child issue","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T13:00:42.368282-08:00","updated_at":"2025-11-05T13:01:11.64526-08:00","closed_at":"2025-11-05T13:01:11.64526-08:00"} +{"id":"bd-d33c","title":"Separate process/lock/PID concerns into process.go","description":"Create internal/daemonrunner/process.go with: acquireDaemonLock, PID file read/write, stopDaemon, isDaemonRunning, getPIDFilePath, socket path helpers, version check.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.871122-07:00","updated_at":"2025-11-01T23:43:55.66159-07:00","closed_at":"2025-11-01T23:43:55.66159-07:00"} +{"id":"bd-9cdc","title":"Update docs for import bug fix","description":"Update AGENTS.md, README.md, TROUBLESHOOTING.md with import.orphan_handling config documentation. Document resurrection behavior, tombstones, config modes. Add troubleshooting section for import failures with deleted parents.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-04T12:32:30.770415-08:00","updated_at":"2025-11-04T12:32:30.770415-08:00"} +{"id":"bd-s1xn","title":"bd message: Refactor duplicated error messages","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T12:54:27.624981-08:00","updated_at":"2025-11-08T12:58:59.542795-08:00","closed_at":"2025-11-08T12:58:59.542795-08:00","dependencies":[{"issue_id":"bd-s1xn","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.96063-08:00","created_by":"daemon"}]} +{"id":"bd-90a5","title":"Extract hash ID generation functions to hash_ids.go","description":"Move generateHashID, getNextChildNumber, GetNextChildID to hash_ids.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.890883-07:00","updated_at":"2025-11-02T12:32:00.159056-08:00","closed_at":"2025-11-02T12:32:00.159058-08:00"} +{"id":"bd-fb95094c.9","title":"Remove unreachable RPC methods","description":"Several RPC server and client methods are unreachable and should be removed:\n\nServer methods (internal/rpc/server.go):\n- `Server.GetLastImportTime` (line 2116)\n- `Server.SetLastImportTime` (line 2123)\n- `Server.findJSONLPath` (line 2255)\n\nClient methods (internal/rpc/client.go):\n- `Client.Import` (line 311) - RPC import not used (daemon uses autoimport)\n\nEvidence:\n```bash\ngo run golang.org/x/tools/cmd/deadcode@latest -test ./...\n```\n\nImpact: Removes ~80 LOC of unused RPC code","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T19:43:48.758109-05:00","updated_at":"2025-11-23T14:14:13.335441-08:00","closed_at":"2025-11-07T10:55:55.984293-08:00","dependencies":[{"issue_id":"bd-fb95094c.9","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:19.965239-07:00","created_by":"daemon"}]} +{"id":"bd-fkdw","title":"Update bash-agent example with Agent Mail integration","description":"Add Agent Mail integration to examples/bash-agent/agent.sh using curl for HTTP calls.\n\nAcceptance Criteria:\n- Health check function using curl\n- Reserve issue before claiming\n- Send notifications on status change\n- Release on completion\n- Graceful degradation if curl fails\n- No bash errors when Agent Mail unavailable\n\nFile: examples/bash-agent/agent.sh","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-07T22:42:28.722048-08:00","updated_at":"2025-11-08T01:09:25.900138-08:00","closed_at":"2025-11-08T01:09:25.900138-08:00","dependencies":[{"issue_id":"bd-fkdw","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T23:04:01.398259-08:00","created_by":"daemon"}]} +{"id":"bd-1ls","title":"Override test","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-03T20:15:10.01471-08:00","updated_at":"2025-11-03T22:07:10.946574-08:00","closed_at":"2025-11-03T22:07:10.946574-08:00"} +{"id":"bd-6z7l","title":"Auto-detect scenarios and prompt users","description":"Detect when user is in fork/contributor scenario and prompt with helpful suggestions. Check: git remote relationships, existing .beads config, repo ownership. Suggest appropriate wizard.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:04:30.070695-08:00","updated_at":"2025-11-05T19:27:33.074733-08:00","closed_at":"2025-11-05T18:57:03.315476-08:00","dependencies":[{"issue_id":"bd-6z7l","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.205478-08:00","created_by":"daemon"}]} +{"id":"bd-2997","title":"bd-hv01: No snapshot versioning or timestamps causes stale data usage","description":"Problem: If sync is interrupted (crash, kill -9, power loss), stale snapshots persist indefinitely. Next sync uses stale data leading to incorrect deletions.\n\nFix: Add metadata to snapshots with timestamp, version, and commit SHA. Validate snapshots are recent (\u003c 1 hour old), from compatible version, and from expected git commit.\n\nFiles: cmd/bd/deletion_tracking.go (all snapshot functions)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T18:16:21.816748-08:00","updated_at":"2025-11-06T19:34:51.677442-08:00","closed_at":"2025-11-06T19:34:51.677442-08:00","dependencies":[{"issue_id":"bd-2997","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.968471-08:00","created_by":"daemon"}]} +{"id":"bd-zj8e","title":"Performance Testing Documentation","description":"Create docs/performance-testing.md documenting the performance testing framework.\n\nSections:\n1. Overview - What the framework does, goals\n2. Running Benchmarks\n - make bench command\n - Running specific benchmarks\n - Interpreting output (ns/op, allocs/op)\n3. Profiling and Analysis\n - Viewing CPU profiles with pprof\n - Reading flamegraphs\n - Memory profiling\n - Finding hotspots\n4. User Diagnostics\n - bd doctor --perf usage\n - Sharing profiles with bug reports\n - Understanding the report output\n5. Comparing Performance\n - Using benchstat for before/after comparisons\n - Detecting regressions\n6. Tips for Optimization\n - Common patterns\n - When to profile vs benchmark\n\nStyle:\n- Concise, practical examples\n- Screenshots/examples of pprof output\n- Clear command-line examples\n- Focus on workflow, not theory","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-13T22:23:38.99897-08:00","updated_at":"2025-11-13T22:23:38.99897-08:00"} +{"id":"bd-d4ec5a82","title":"Add MCP functions for repair commands","description":"Add repair commands to beads-mcp for agent access:\n- beads_resolve_conflicts()\n- beads_find_duplicates()\n- beads_detect_pollution()\n- beads_validate()\n\nFiles: integrations/beads-mcp/src/beads_mcp/server.py","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T14:48:29.071495-07:00","updated_at":"2025-11-06T19:36:13.972786-08:00","closed_at":"2025-11-06T19:27:19.170894-08:00"} +{"id":"bd-k58","title":"Proposal workflow (propose/withdraw/accept)","description":"Implement commands and state machine for moving issues between personal planning repos and canonical upstream repos, enabling contributors to propose work without polluting PRs.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:41.113647-08:00","updated_at":"2025-11-05T00:08:42.814698-08:00","closed_at":"2025-11-05T00:08:42.814699-08:00","dependencies":[{"issue_id":"bd-k58","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.811261-08:00","created_by":"daemon"}]} +{"id":"bd-3ee2c7e9","title":"Add \"bd daemons\" command for multi-daemon management","description":"Add a new \"bd daemons\" command with subcommands to manage daemon processes across all beads repositories/worktrees. Should show all running daemons with metadata (version, workspace, uptime, last sync), allow stopping/restarting individual daemons, auto-clean stale processes, view logs, and show exclusive lock status.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-26T16:53:40.970042-07:00","updated_at":"2025-11-02T17:12:34.621017-08:00","closed_at":"2025-11-02T17:12:34.62102-08:00"} +{"id":"bd-2e80","title":"Document shared memory test isolation pattern in test_helpers.go","description":"Tests were failing because :memory: creates a shared database across all tests. The fix is to use \"file::memory:?mode=memory\u0026cache=private\" for test isolation.\n\nShould document this pattern in test_helpers.go and potentially update newTestStore to use private memory by default.","status":"closed","priority":3,"issue_type":"chore","created_at":"2025-11-01T22:40:58.993496-07:00","updated_at":"2025-11-02T16:27:39.02423-08:00","closed_at":"2025-11-02T16:27:39.024233-08:00"} +{"id":"bd-we4p","title":"Cache getMultiRepoJSONLPaths() result during sync to avoid redundant calls","description":"From bd-xo6b code review: getMultiRepoJSONLPaths() is called 3x per sync cycle.\n\n**Current behavior:**\ndaemon_sync.go calls getMultiRepoJSONLPaths() three times per sync:\n- Line 505: Snapshot capture before pull\n- Line 575: Merge/prune after pull\n- Line 613: Base snapshot update after import\n\n**Cost per call:**\n- Config lookup (likely cached, but still overhead)\n- Path construction: O(N) where N = number of repos\n- String allocations: (N + 1) Γ— filepath.Join() calls\n\n**Total per sync:** 3N path constructions + 3 config lookups + 3 slice allocations\n\n**Impact:**\n- For N=3 repos: Negligible (\u003c 1ms)\n- For N=10 repos: Still minimal\n- For N=100+ repos: Wasteful\n\n**Solution:**\nCall once at sync start, reuse result:\n\n```go\nfunc createSyncFunc(...) func() {\n return func() {\n // ... existing setup ...\n \n // Call once at start\n multiRepoPaths := getMultiRepoJSONLPaths()\n \n // Snapshot capture\n if multiRepoPaths != nil {\n for _, path := range multiRepoPaths {\n if err := captureLeftSnapshot(path); err != nil { ... }\n }\n }\n \n // ... later ...\n \n // Merge/prune - reuse same paths\n if multiRepoPaths != nil {\n for _, path := range multiRepoPaths { ... }\n }\n \n // ... later ...\n \n // Base snapshot update - reuse same paths\n if multiRepoPaths != nil {\n for _, path := range multiRepoPaths { ... }\n }\n }\n}\n```\n\n**Files:**\n- cmd/bd/daemon_sync.go:449-636 (createSyncFunc)\n\n**Note:** This is a performance optimization, not a correctness fix. Low priority unless multi-repo usage scales significantly.","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-11-06T19:31:32.128674-08:00","updated_at":"2025-11-06T19:40:50.871176-08:00","closed_at":"2025-11-06T19:40:50.871176-08:00","dependencies":[{"issue_id":"bd-we4p","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.39754-08:00","created_by":"daemon"}]} +{"id":"bd-6221bdcd","title":"Optimize cmd/bd test suite performance (currently 30+ minutes)","description":"CLI test suite is extremely slow (~30+ minutes for full run). Tests are poorly designed and need performance optimization before expanding coverage.\n\nCurrent coverage: 24.8% (improved from 20.2%)\n\n**Problem**: Tests take far too long to run, making development iteration painful.\n\n**Priority**: Fix test performance FIRST, then consider increasing coverage.\n\n**Investigation needed**:\n- Profile test execution to identify bottlenecks\n- Look for redundant git operations, database initialization, or daemon operations\n- Identify opportunities for test parallelization\n- Consider mocking or using in-memory databases where appropriate\n- Review test design patterns\n\n**Related**: bd-ktng mentions 13 CLI tests with redundant git init calls (31s total)\n\n**Goal**: Get full test suite under 1-2 minutes before adding more tests.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T14:06:27.951656-07:00","updated_at":"2025-11-08T22:42:08.862178-08:00","closed_at":"2025-11-08T22:41:05.766749-08:00","dependencies":[{"issue_id":"bd-6221bdcd","depends_on_id":"bd-4d7fca8a","type":"blocks","created_at":"2025-10-29T19:52:05.532391-07:00","created_by":"import-remap"}]} +{"id":"bd-hsl3","title":"Updated title","status":"closed","issue_type":"feature","created_at":"2025-11-07T19:07:12.92354-08:00","updated_at":"2025-11-07T22:07:17.346243-08:00","closed_at":"2025-11-07T21:57:59.911411-08:00"} +{"id":"bd-4b6u","title":"Update docs with multi-repo patterns","description":"Update AGENTS.md, README.md, QUICKSTART.md with multi-repo patterns. Document: config options, routing behavior, backward compatibility, troubleshooting, best practices.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:04:30.18358-08:00","updated_at":"2025-11-06T19:53:04.721589-08:00","closed_at":"2025-11-06T19:53:04.721589-08:00","dependencies":[{"issue_id":"bd-4b6u","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.297009-08:00","created_by":"daemon"}]} +{"id":"bd-6mjj","title":"Split test suites: fast vs. integration","description":"Reorganize tests into separate packages/files for fast unit tests vs slow integration tests.\n\nBenefits:\n- Clear separation of concerns\n- Easier to run just fast tests during development\n- Can parallelize CI jobs better\n\nFiles to organize:\n- beads_hash_multiclone_test.go (slow integration tests)\n- beads_integration_test.go (medium-speed integration tests)\n- Other test files (fast unit tests)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-04T01:24:21.040347-08:00","updated_at":"2025-11-04T10:38:12.408674-08:00","closed_at":"2025-11-04T10:38:12.408674-08:00","dependencies":[{"issue_id":"bd-6mjj","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:21.041228-08:00","created_by":"daemon"}]} +{"id":"bd-c947dd1b","title":"Remove Daemon Storage Cache","description":"The daemon's multi-repo storage cache is the root cause of stale data bugs. Since global daemon is deprecated, we only ever serve one repository, making the cache unnecessary complexity. This epic removes the cache entirely for simpler, more reliable direct storage access.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T10:50:15.126939-07:00","updated_at":"2025-10-30T17:12:58.21743-07:00","closed_at":"2025-10-28T10:49:53.612049-07:00"} +{"id":"bd-3b7f","title":"Add tests for extracted modules","description":"Create tests for migrations.go, hash_ids.go, batch_ops.go, and validators.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.88933-07:00","updated_at":"2025-11-01T23:00:37.751004-07:00","closed_at":"2025-11-01T23:00:37.751004-07:00"} +{"id":"bd-gart","title":"Debug test 2","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-08T00:04:35.317835-08:00","updated_at":"2025-11-08T00:06:46.18875-08:00","closed_at":"2025-11-08T00:06:46.18875-08:00"} +{"id":"bd-7da9437e","title":"Latency test","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:28:52.729923-07:00","updated_at":"2025-10-31T12:00:43.184758-07:00","closed_at":"2025-10-31T12:00:43.184758-07:00"} +{"id":"bd-rb75","title":"Clean up merge conflict artifacts in .beads directory","description":"After resolving merge conflicts in .beads/beads.jsonl, leftover artifacts remain as untracked files:\n- .beads/beads.base.jsonl\n- .beads/beads.left.jsonl\n\nThese appear to be temporary files created during merge conflict resolution.\n\nOptions to fix:\n1. Add these patterns to .beads/.gitignore automatically\n2. Clean up these files after successful merge resolution\n3. Document that users should delete them manually\n4. Add a check in 'bd sync' or 'bd doctor' to detect and remove stale merge artifacts\n\nPreferred solution: Add *.base.jsonl and *.left.jsonl patterns to .beads/.gitignore during 'bd init', and optionally clean them up automatically after successful import.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-06T19:09:16.114274-08:00","updated_at":"2025-11-06T19:13:44.630402-08:00","closed_at":"2025-11-06T19:13:44.630402-08:00"} +{"id":"bd-jgxi","title":"Auto-migrate database on CLI version bump","description":"When CLI is upgraded (e.g., 0.24.0 β†’ 0.24.1), database version becomes stale. Add auto-migration in PersistentPreRun or daemon startup. Check dbVersion != CLIVersion and run bd migrate automatically. Fixes recurring UX issue where bd doctor shows version mismatch after every CLI upgrade.","status":"closed","issue_type":"feature","created_at":"2025-11-21T23:16:09.004619-08:00","updated_at":"2025-11-23T18:15:29.90187-08:00","closed_at":"2025-11-23T18:09:31.399945-08:00","dependencies":[{"issue_id":"bd-jgxi","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:09.005513-08:00","created_by":"daemon"}]} +{"id":"bd-5ots","title":"SearchIssues N+1 query causes context timeout with GetLabels","description":"scanIssues() calls GetLabels in a loop for every issue, causing N+1 queries and context deadline exceeded errors when used with short timeouts or in-memory databases. This is especially problematic since SearchIssues already supports label filtering via SQL WHERE clauses.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-05T19:12:02.245879-08:00","updated_at":"2025-11-05T19:22:11.668682-08:00","closed_at":"2025-11-05T19:22:11.668682-08:00"} +{"id":"bd-77gm","title":"Import reports misleading '0 created, 0 updated' when actually importing all issues","description":"When running 'bd import' on a fresh database (no existing issues), the command reports 'Import complete: 0 created, 0 updated' even though it successfully imported all issues from the JSONL file.\n\n**Steps to reproduce:**\n1. Delete .beads/beads.db\n2. Run: bd import .beads/issues.jsonl\n3. Observe output: 'Import complete: 0 created, 0 updated'\n4. Run: bd list\n5. Confirm: All issues are actually present in the database\n\n**Expected behavior:**\nReport the actual number of issues imported, e.g., 'Import complete: 523 created, 0 updated'\n\n**Actual behavior:**\n'Import complete: 0 created, 0 updated' (misleading - makes user think import failed)\n\n**Impact:**\n- Users think import failed when it succeeded\n- Confusing during database sync operations (e.g., after git pull)\n- Makes debugging harder (can't tell if import actually worked)\n\n**Context:**\nDiscovered during VC session when syncing database after git pull. The misleading message caused confusion about whether the database was properly synced with the canonical JSONL file.","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-09T16:20:13.191156-08:00","updated_at":"2025-11-09T16:20:13.191156-08:00"} +{"id":"bd-64c05d00.3","title":"Add TestThreeCloneCollision for regression protection","description":"Add a 3-clone collision test to document behavior and provide regression protection.\n\nPurpose:\n- Verify content convergence regardless of sync order\n- Document the ID non-determinism behavior (IDs may be assigned differently based on sync order)\n- Provide regression protection for multi-way collisions\n\nTest design:\n- 3 clones create same ID with different content\n- Test two different sync orders (Aβ†’Bβ†’C vs Cβ†’Aβ†’B)\n- Assert content sets match (ignore specific ID assignments)\n- Add comment explaining ID non-determinism is expected behavior\n\nKnown limitation:\n- Content always converges correctly (all issues present with correct titles)\n- Numeric ID assignments (test-2 vs test-3) depend on sync order\n- This is acceptable if content convergence is the primary goal","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T17:59:05.941735-07:00","updated_at":"2025-10-30T17:12:58.227089-07:00","closed_at":"2025-10-28T18:09:12.717604-07:00","dependencies":[{"issue_id":"bd-64c05d00.3","depends_on_id":"bd-64c05d00","type":"parent-child","created_at":"2025-10-28T17:59:05.942783-07:00","created_by":"stevey"}]} +{"id":"bd-28db","title":"Add 'bd status' command for issue database overview","description":"Implement a bd status command that provides a quick snapshot of the issue database state, similar to how git status shows working tree state.\n\nExpected output: Show summary including counts by state (open, in-progress, blocked, closed), recent activity (last 7 days), and quick overview without needing multiple queries.\n\nExample output showing issue counts, recent activity stats, and pointer to bd list for details.\n\nProposed options: --all (show all issues), --assigned (show issues assigned to current user), --json (JSON format output)\n\nUse cases: Quick project health check, onboarding for new contributors, integration with shell prompts or CI/CD, daily standup reference","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-02T17:25:59.203549-08:00","updated_at":"2025-11-02T17:25:59.203549-08:00"} +{"id":"bd-2d5r","title":"Fix silent error handling in RPC response writing","description":"Marshal and write errors silently ignored in writeResponse, can send partial JSON and hang clients.\n\nLocation: internal/rpc/server_lifecycle_conn.go:228-232\n\nProblem:\n- json.Marshal error ignored - cyclic reference sends corrupt JSON\n- Write error ignored - connection closed, no indication to caller \n- WriteByte error ignored - client hangs waiting for newline\n- Flush error ignored - partial data buffered\n\nCurrent code:\nfunc (s *Server) writeResponse(writer *bufio.Writer, resp Response) {\n data, _ := json.Marshal(resp) // Ignored!\n _, _ = writer.Write(data) // Ignored!\n _ = writer.WriteByte('\\n') // Ignored!\n _ = writer.Flush() // Ignored!\n}\n\nSolution: Return errors, handle in caller, close connection on error\n\nImpact: Client hangs waiting for response; corrupt JSON sent\n\nEffort: 1 hour","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:51:47.002242-08:00","updated_at":"2025-11-16T15:04:00.481507-08:00","closed_at":"2025-11-16T15:04:00.481507-08:00"} +{"id":"bd-7324","title":"Add is_tombstone flag to schema","description":"Optionally add is_tombstone boolean field to issues table. Marks resurrected parents that were deleted. Allows distinguishing tombstones from normal deleted issues. Update schema.go and create migration.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:31:59.745076-08:00","updated_at":"2025-11-05T00:44:27.947578-08:00","closed_at":"2025-11-05T00:44:27.947584-08:00"} +{"id":"bd-expt","title":"RPC fast-fail: stat socket before dial, cap timeouts to 200ms","description":"Eliminate 5s delay when daemon socket is missing by:\n1. Add os.Stat(socketPath) check before dialing in TryConnect\n2. Return (nil, nil) immediately if socket doesn't exist\n3. Set default dial timeout to 200ms in TryConnect\n4. Keep TryConnectWithTimeout for explicit health/status checks (1-2s)\n\nThis prevents clients from waiting through full timeout when no daemon is running.","status":"closed","issue_type":"task","created_at":"2025-11-07T16:42:12.688526-08:00","updated_at":"2025-11-07T22:07:17.345918-08:00","closed_at":"2025-11-07T21:04:21.671436-08:00","dependencies":[{"issue_id":"bd-expt","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.689284-08:00","created_by":"daemon"}]} +{"id":"bd-5e1f","title":"Issue with desc","description":"This is a description","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-31T21:41:11.128718-07:00","updated_at":"2025-11-04T11:10:23.531094-08:00","closed_at":"2025-11-04T11:10:23.531097-08:00"} +{"id":"bd-9bsx","title":"Recurring dirty state after merge conflicts - bd sync keeps failing","description":"## Problem\n\n`bd sync` consistently fails with merge conflicts in `.beads/beads.jsonl`, creating a loop:\n1. User runs `bd sync`\n2. Git merge conflict occurs\n3. User resolves with `git checkout --theirs` (takes remote)\n4. Daemon auto-exports database state (which has local changes)\n5. JSONL becomes dirty again immediately\n6. Repeat\n\nThis has been happening for **weeks** and is extremely frustrating.\n\n## Root Cause\n\nThe recommended conflict resolution (`git checkout --theirs`) throws away local database state (comments, dependencies, closed issues). The daemon then immediately re-exports, creating a dirty state.\n\n## Current Workaround\n\nManual `bd export -o .beads/beads.jsonl \u0026\u0026 git add \u0026\u0026 git commit \u0026\u0026 git push` after every failed sync.\n\n## Example Session\n\n```bash\n$ bd sync\nCONFLICT (content): Merge conflict in .beads/beads.jsonl\n\n$ git checkout --theirs .beads/beads.jsonl \u0026\u0026 bd import \u0026\u0026 git add \u0026\u0026 git commit \u0026\u0026 git push\n# Pushed successfully\n\n$ git status\nmodified: .beads/beads.jsonl # DIRTY AGAIN!\n```\n\n## Lost Data in Recent Session\n\n- bd-ry1u closure (lost in merge)\n- Comments on bd-08fd, bd-23a8, bd-6049, bd-87a0 (lost)\n- Dependencies that existed only in local DB\n\n## Potential Solutions\n\n1. **Use beads-merge tool** - Implement proper 3-way JSONL merge (bd-bzfy)\n2. **Smarter conflict resolution** - Detect when `--theirs` will lose data, warn user\n3. **Sync validation** - Check if JSONL == DB after merge, re-export if needed\n4. **Daemon awareness** - Pause auto-export during merge resolution\n5. **Transaction log** - Replay local changes after merge instead of losing them\n\n## Related Issues\n\n- bd-bzfy (beads-merge integration)\n- Possibly related to daemon auto-export behavior","notes":"## Solution Implemented\n\nFixed the recurring dirty state after merge conflicts by adding **sync validation** before re-exporting.\n\n### Root Cause\nLines 217-237 in `sync.go` unconditionally re-exported DB to JSONL after every import, even when they were already in sync. This created an infinite loop:\n1. User runs `bd sync` which pulls and imports remote JSONL\n2. Sync unconditionally re-exports DB (which has local changes)\n3. JSONL becomes dirty immediately\n4. Repeat\n\n### Fix\nAdded `dbNeedsExport()` function in `integrity.go` that checks:\n- If JSONL exists\n- If DB modification time is newer than JSONL\n- If DB and JSONL issue counts match\n\nNow `bd sync` only re-exports if DB actually has changes that differ from JSONL.\n\n### Changes\n- Added `dbNeedsExport()` in `cmd/bd/integrity.go` (lines 228-271)\n- Updated `sync.go` lines 217-251 to check before re-exporting\n- Added comprehensive tests in `cmd/bd/sync_merge_test.go`\n\n### Testing\nAll tests pass including 4 new tests:\n- `TestDBNeedsExport_InSync` - Verifies no export when synced\n- `TestDBNeedsExport_DBNewer` - Detects DB modifications\n- `TestDBNeedsExport_CountMismatch` - Catches divergence\n- `TestDBNeedsExport_NoJSONL` - Handles missing JSONL\n\nThis prevents the weeks-long frustration of merge conflicts causing infinite dirty loops.","status":"closed","issue_type":"bug","created_at":"2025-11-05T17:52:14.776063-08:00","updated_at":"2025-11-05T17:58:35.611942-08:00","closed_at":"2025-11-05T17:58:35.611942-08:00"} +{"id":"bd-loka","title":"Add built-in version tracking to bd","description":"Enhance bd to automatically track its own version in metadata.json and detect upgrades.\n\n## Features to Implement\n1. Auto-update metadata.json with 'last_bd_version' field on every bd command\n2. Add 'bd upgrade status' - check if version changed since last run\n3. Add 'bd upgrade review' - show what's new since last-seen version (not just last 3)\n4. Add 'bd upgrade ack' - mark current version as acknowledged\n5. Smart detection output when version changes (show hint on bd ready, bd list, etc.)\n\n## Implementation Details\n- Store last_bd_version in metadata.json\n- Store last_version_check timestamp\n- Compare on every bd command (cached check, low overhead)\n- Only show notification once per session until ack'd\n\n## Example Output\n```\n$ bd ready\nπŸ”„ bd upgraded from v0.23.0 to v0.24.2 since last use\nπŸ’‘ Run 'bd upgrade review' to see what changed\n\nReady work: 5 issues\n...\n```\n\n## Acceptance Criteria\n- Version automatically tracked in metadata.json\n- Upgrade detection works across sessions\n- New bd upgrade subcommands functional\n- Non-intrusive notifications (show once, then quiet)\n","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-23T16:21:53.951611-08:00","updated_at":"2025-11-23T17:06:34.003365-08:00","closed_at":"2025-11-23T17:06:34.003365-08:00","dependencies":[{"issue_id":"bd-loka","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:53.952998-08:00","created_by":"daemon"}]} +{"id":"bd-1ezg","title":"Investigate bd export/import sync issue - database and JSONL out of sync","description":"Observed in VC repo: database has 1137 issues but beads.jsonl only has 309. Running 'bd export -o .beads/issues.jsonl' doesn't update the file. Running 'bd import' hangs indefinitely.\n\nReproduction context:\n- VC repo: 1137 issues in DB, 309 in JSONL\n- Created 4 new issues with bd create\n- bd export didn't write them to JSONL\n- bd import hung (possibly daemon lock conflict?)\n\nNeed to investigate:\n1. Why export doesn't update JSONL when DB has more issues\n2. Why import hangs\n3. Daemon lock interaction with export/import\n4. File path handling (issues.jsonl vs beads.jsonl)","notes":"## Root Cause Analysis\n\nThe issue was NOT about file path handling or export failing to update JSONL. The actual problem was:\n\n**Import/Export hanging when daemon is running** due to SQLite lock contention:\n\n1. When daemon is connected, `PersistentPreRun` in main.go returns early without initializing the `store` variable\n2. Import/Export commands then tried to open the database directly with `sqlite.New(dbPath)` \n3. This blocked waiting for the database lock that the daemon already holds β†’ **HANGS INDEFINITELY**\n\n## Solution Implemented\n\nModified both import.go and export.go to:\n1. Detect when `daemonClient` is connected\n2. Explicitly close the daemon connection before opening direct SQLite access\n3. Added debug logging to help diagnose similar issues\n\nThis ensures import/export commands always run in direct mode, avoiding lock contention.\n\n## File Path Handling\n\nThe file path confusion (issues.jsonl vs beads.jsonl) was a red herring. The code uses `filepath.Glob(\"*.jsonl\")` which correctly finds ANY `.jsonl` file in `.beads/` directory, so both filenames work.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T19:00:55.78797-08:00","updated_at":"2025-11-06T19:07:15.077983-08:00","closed_at":"2025-11-06T19:07:15.077983-08:00"} +{"id":"bd-3852","title":"Add orphan detection migration","description":"Create migration to detect orphaned children in existing databases. Query: SELECT id FROM issues WHERE id LIKE '%.%' AND substr(id, 1, instr(id || '.', '.') - 1) NOT IN (SELECT id FROM issues). Log results, let user decide action (delete orphans or convert to top-level).","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-04T12:32:30.727044-08:00","updated_at":"2025-11-04T12:32:30.727044-08:00"} +{"id":"bd-fb95094c.4","title":"Audit and consolidate collision test coverage","description":"The codebase has 2,019 LOC of collision detection tests across 3 files. Run coverage analysis to identify redundant test cases and consolidate.\n\nTest files:\n- `cmd/bd/import_collision_test.go` - 974 LOC\n- `cmd/bd/autoimport_collision_test.go` - 750 LOC\n- `cmd/bd/import_collision_regression_test.go` - 295 LOC\n\nTotal: 2,019 LOC of collision tests\n\nAnalysis steps:\n1. Run coverage analysis\n2. Identify redundant tests\n3. Document findings\n\nConsolidation strategy:\n- Keep regression tests for critical bugs\n- Merge overlapping table-driven tests\n- Remove redundant edge case tests covered elsewhere\n- Ensure all collision scenarios still tested\n\nExpected outcome: Reduce to ~1,200 LOC (save ~800 lines) while maintaining coverage\n\nImpact: Faster test runs, easier maintenance, clearer test intent","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:32:00.130855-07:00","updated_at":"2025-11-08T01:58:15.283373-08:00","closed_at":"2025-11-07T23:27:41.970013-08:00","dependencies":[{"issue_id":"bd-fb95094c.4","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:32:00.132251-07:00","created_by":"daemon"}]} +{"id":"bd-fsb1","title":"Test issue","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T11:21:51.383077-08:00","updated_at":"2025-11-05T11:21:56.888913-08:00","closed_at":"2025-11-05T11:21:56.888913-08:00"} +{"id":"bd-b7d2","title":"Add sync.branch configuration","description":"Add configuration layer to support sync.branch setting via config file, environment variable, or CLI flag.\n\nTasks:\n- Add sync.branch field to config schema\n- Add BEADS_SYNC_BRANCH environment variable\n- Add --branch flag to bd init\n- Add bd config get/set sync.branch commands\n- Validation (branch name format, conflicts)\n- Config migration for existing users\n\nEstimated effort: 1-2 days","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.560141-08:00","updated_at":"2025-11-04T11:10:23.533911-08:00","closed_at":"2025-11-04T11:10:23.533913-08:00","dependencies":[{"issue_id":"bd-b7d2","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.356847-08:00","created_by":"stevey"}]} +{"id":"bd-3tfh","title":"Benchmark Helper Functions","description":"Extend existing benchmark helpers in internal/storage/sqlite/bench_helpers_test.go (or create if organizing separately).\n\nExisting helper (in compact_bench_test.go):\n- setupBenchDB(tb) - Creates temp SQLite database with basic config\n * Used by compact and cycle benchmarks\n * Returns (*SQLiteStorage, cleanup func())\n\nNew helpers to add:\n- setupLargeBenchDB(b *testing.B) storage.Storage\n * Creates 10K issue database using LargeSQLite fixture\n * Returns configured storage instance\n \n- setupXLargeBenchDB(b *testing.B) storage.Storage\n * Creates 20K issue database using XLargeSQLite fixture\n * Returns configured storage instance\n\nImplementation options:\n1. Add to existing compact_bench_test.go (co-located with setupBenchDB)\n2. Create new bench_helpers_test.go for organization\n\nBoth approaches:\n- Build tag: //go:build bench\n- Uses fixture generator from internal/testutil/fixtures\n- Follows existing setupBenchDB() pattern\n- Handles database cleanup\n\nThese helpers reduce duplication across new benchmark functions and provide consistent large-scale database setup.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:22:55.694834-08:00","updated_at":"2025-11-13T23:13:41.244758-08:00","closed_at":"2025-11-13T23:13:41.244758-08:00","dependencies":[{"issue_id":"bd-3tfh","depends_on_id":"bd-m62x","type":"blocks","created_at":"2025-11-13T22:24:02.632994-08:00","created_by":"daemon"}]} +{"id":"bd-qq2i","title":"Add 'bd message send' command for Agent Mail messaging","description":"Agent Mail server supports messaging between agents, but bd CLI only uses it for file reservations. Add commands for inter-agent messaging.\n\n## Background\n- Agent Mail server running at http://127.0.0.1:8765\n- 12 workspaces configured across 3 channels (beads.dev, vc.dev, wyvern.dev)\n- Current integration: file reservations only\n- Gap: no way to send messages from bd CLI\n\n## Proposed Commands\n\n```bash\n# Send message to another agent\nbd message send \u003cto-agent\u003e \u003cmessage\u003e [options]\n --subject \u003csubject\u003e\n --thread-id \u003cthread-id\u003e # Optional - group related messages\n --project-id \u003cproject\u003e # Defaults to BEADS_PROJECT_ID\n\n# List inbox messages\nbd message inbox [options]\n --limit \u003cN\u003e\n --unread-only\n\n# Read specific message\nbd message read \u003cmessage-id\u003e\n\n# Mark message as acknowledged\nbd message ack \u003cmessage-id\u003e\n```\n\n## Example Usage\n\n```bash\n# Send message to agent in same channel\nbd message send cino-beads-stevey-macbook \"Working on bd-z0yn, need your review\" \\\n --subject \"Review request\" \\\n --thread-id bd-z0yn\n\n# Check inbox\nbd message inbox --unread-only\n\n# Read and acknowledge\nbd message read msg-abc123\nbd message ack msg-abc123\n```\n\n## Design Notes\n- Use same env vars (BEADS_AGENT_MAIL_URL, BEADS_AGENT_NAME, BEADS_PROJECT_ID)\n- Graceful degradation if Agent Mail unavailable\n- JSON output support for all commands\n- Consider integrating with bd update/close (auto-notify on status changes)\n\n## References\n- Agent Mail README: ~/src/mcp_agent_mail/README.md\n- Beads integration docs: docs/AGENT_MAIL.md","notes":"## Implementation Summary\n\nAdded four new commands to bd CLI for Agent Mail messaging:\n\n1. `bd message send \u003cto-agent\u003e \u003cmessage\u003e` - Send messages to other agents\n - Flags: --subject, --thread-id, --importance, --ack-required\n - Supports markdown content\n - Thread conversations by issue ID\n\n2. `bd message inbox` - List inbox messages\n - Flags: --limit, --unread-only, --urgent-only, --json\n - Shows subject, sender, age, importance\n - Highlights unread and ACK-required messages\n\n3. `bd message read \u003cmessage-id\u003e` - Read and mark message as read\n - Automatically marks message as read\n - Shows message content\n\n4. `bd message ack \u003cmessage-id\u003e` - Acknowledge a message\n - Marks message as acknowledged\n - Also marks as read if not already\n\n## Implementation Details\n\n- Uses JSON-RPC over HTTP to communicate with Agent Mail server\n- Configuration via environment variables (BEADS_AGENT_MAIL_URL, BEADS_AGENT_NAME, BEADS_PROJECT_ID)\n- Graceful error messages when Agent Mail not configured\n- Full JSON output support for programmatic use\n- Follows same patterns as existing bd commands\n\n## Documentation\n\nUpdated:\n- docs/AGENT_MAIL.md - Added \"Messaging Commands\" section with examples and best practices\n- README.md - Added \"Messaging (Agent Mail)\" section in Usage\n\n## Testing\n\n- Compiles successfully\n- Help output works correctly\n- Ready for integration testing with Agent Mail server","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-08T12:44:03.547806-08:00","updated_at":"2025-11-08T12:49:02.436927-08:00","closed_at":"2025-11-08T12:49:02.436927-08:00"} +{"id":"bd-jjua","title":"Auto-invoke 3-way merge for JSONL conflicts","description":"Currently when git pull encounters merge conflicts in .beads/issues.jsonl, the post-merge hook fails with an error message pointing users to manual resolution or the beads-merge tool.\n\nThis is a poor user experience - the conflict detection is working, but we should automatically invoke the advanced 3-way merging instead of just telling users about it.\n\n**Current behavior:**\n- Detect conflict markers in JSONL\n- Display error with manual resolution options\n- Exit with failure\n\n**Desired behavior:**\n- Detect conflict markers in JSONL\n- Automatically invoke beads-merge 3-way merge\n- Only fail if automatic merge cannot resolve the conflicts\n\n**Reference:**\n- beads-merge tool: https://github.com/neongreen/mono/tree/main/beads-merge\n- Error occurs in post-merge hook during bd sync after git pull","status":"closed","issue_type":"bug","created_at":"2025-11-08T03:09:18.258708-08:00","updated_at":"2025-11-08T03:15:55.529652-08:00","closed_at":"2025-11-08T03:15:55.529652-08:00"} +{"id":"bd-cb64c226.13","title":"Audit Current Cache Usage","description":"Understand exactly what code depends on the storage cache","notes":"AUDIT COMPLETE\n\ngetStorageForRequest() callers: 17 production + 11 test\n- server_issues_epics.go: 8 calls\n- server_labels_deps_comments.go: 4 calls \n- server_export_import_auto.go: 2 calls\n- server_compact.go: 2 calls\n- server_routing_validation_diagnostics.go: 1 call\n- server_eviction_test.go: 11 calls (DELETE entire file)\n\nPattern everywhere: store, err := s.getStorageForRequest(req) β†’ store := s.storage\n\nreq.Cwd usage: Only for multi-repo routing. Local daemon always serves 1 repo, so routing is unused.\n\nMCP server: Uses separate daemons per repo (no req.Cwd usage found). NOT affected by cache removal.\n\nCache env vars to deprecate:\n- BEADS_DAEMON_MAX_CACHE_SIZE (used in server_core.go:63)\n- BEADS_DAEMON_CACHE_TTL (used in server_core.go:72)\n- BEADS_DAEMON_MEMORY_THRESHOLD_MB (used in server_cache_storage.go:47)\n\nServer struct fields to remove:\n- storageCache, cacheMu, maxCacheSize, cacheTTL, cleanupTicker, cacheHits, cacheMisses\n\nTests to delete:\n- server_eviction_test.go (entire file - 9 tests)\n- limits_test.go cache assertions\n\nSpecial consideration: ValidateDatabase endpoint uses findDatabaseForCwd() outside cache. Verify if used, then remove or inline.\n\nSafe to proceed with removal - cache always had 1 entry in local daemon model.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:19.3723-07:00","updated_at":"2025-10-30T17:12:58.211563-07:00","closed_at":"2025-10-28T14:08:38.060291-07:00"} +{"id":"bd-4oqu","title":"Test parent issue","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-05T13:00:39.737739-08:00","updated_at":"2025-11-05T13:01:11.635711-08:00","closed_at":"2025-11-05T13:01:11.635711-08:00"} +{"id":"bd-bvo2","title":"Issue 2","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.755403-05:00","updated_at":"2025-11-20T19:43:48.755403-05:00","closed_at":"2025-11-07T21:55:09.429328-08:00"} +{"id":"bd-nl8z","title":"Documentation","description":"Complete documentation for Agent Mail integration to enable adoption.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-07T22:42:37.969636-08:00","updated_at":"2025-11-08T03:09:48.253476-08:00","closed_at":"2025-11-08T02:34:57.887891-08:00","dependencies":[{"issue_id":"bd-nl8z","depends_on_id":"bd-wfmw","type":"blocks","created_at":"2025-11-07T22:42:37.970621-08:00","created_by":"daemon"}]} +{"id":"bd-9li4","title":"Create Docker image for Agent Mail","description":"Containerize Agent Mail server for easy deployment.\n\nAcceptance Criteria:\n- Dockerfile with Python 3.14\n- Health check endpoint\n- Volume mount for storage\n- Environment variable configuration\n- Multi-arch builds (amd64, arm64)\n\nFile: deployment/agent-mail/Dockerfile","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.231964-08:00","updated_at":"2025-11-07T22:43:43.231964-08:00"} +{"id":"bd-581b80b3","title":"bd find-duplicates - AI-powered duplicate detection","description":"Find semantically duplicate issues.\n\nApproaches:\n1. Mechanical: Exact title/description matching\n2. Embeddings: Cosine similarity (cheap, scalable)\n3. AI: LLM-based semantic comparison (expensive, accurate)\n\nUses embeddings by default for \u003e100 issues.\n\nFiles: cmd/bd/find_duplicates.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.126801-07:00","updated_at":"2025-10-30T17:12:58.218673-07:00"} +{"id":"bd-hwmp","title":"Document bd info --whats-new in AGENTS.md","description":"Add prominent documentation about bd info --whats-new to help agents discover upgrade changes.\n\n## Changes Needed\n1. Add to 'What's New' section (line 13-28): Emphasize running bd info --whats-new after upgrades\n2. Add to 'Pro Tips for Agents' section (line 474-486): Include version check in session startup routine\n3. Document the bd hooks install command for keeping hooks in sync\n\n## Implementation\n- Update AGENTS.md with clear examples\n- Show both human-readable and --json output options\n- Link to the discussion #239 as motivation\n\n## Acceptance Criteria\n- Agents know to run bd info --whats-new after upgrades\n- Clear guidance on when/why to use it\n- Examples showing both output formats\n","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T16:21:50.533017-08:00","updated_at":"2025-11-23T16:27:43.543439-08:00","closed_at":"2025-11-23T16:27:43.543439-08:00","dependencies":[{"issue_id":"bd-hwmp","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:50.533861-08:00","created_by":"daemon"}]} +{"id":"bd-au0.10","title":"Add global verbosity flags (--verbose, --quiet)","description":"Add consistent verbosity controls across all commands.\n\n**Current state:**\n- bd init has --quiet flag\n- No other commands have verbosity controls\n- Debug output controlled by BD_VERBOSE env var\n\n**Proposal:**\nAdd persistent flags:\n- --verbose / -v: Enable debug output\n- --quiet / -q: Suppress non-essential output\n\n**Implementation:**\n- Add to rootCmd.PersistentFlags()\n- Replace BD_VERBOSE checks with flag checks\n- Standardize output levels:\n * Quiet: Errors only\n * Normal: Errors + success messages\n * Verbose: Errors + success + debug info\n\n**Files to modify:**\n- cmd/bd/main.go (add flags)\n- internal/debug/debug.go (respect flags)\n- Update all commands to respect quiet mode\n\n**Testing:**\n- Verify --verbose shows debug output\n- Verify --quiet suppresses normal output\n- Ensure errors always show regardless of mode","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-21T21:08:21.600209-05:00","updated_at":"2025-11-21T21:08:21.600209-05:00","dependencies":[{"issue_id":"bd-au0.10","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:08:21.602557-05:00","created_by":"daemon"}]} +{"id":"bd-x2ba","title":"Create config.go with config and metadata methods","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:14.746163-08:00","updated_at":"2025-11-23T18:13:11.540896-08:00","closed_at":"2025-11-23T18:13:11.540896-08:00"} +{"id":"bd-11e0","title":"Database import silently fails when daemon version != CLI version","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:08:09.096749-07:00","updated_at":"2025-11-01T19:29:35.267817-07:00","closed_at":"2025-11-01T19:29:35.267817-07:00"} +{"id":"bd-b4b0","title":"Implement fs bridge layer for WASM (Go syscall/js to Node.js fs)","description":"Go's os package in WASM returns 'not implemented on js' for mkdir and other file operations. Need to create a bridge layer that:\n\n1. Detects WASM environment (GOOS=js)\n2. Uses syscall/js to call Node.js fs module functions\n3. Implements wrappers for:\n - os.MkdirAll\n - os.ReadFile / os.WriteFile\n - os.Open / os.Create\n - os.Stat / os.Lstat\n - filepath operations\n \nApproach:\n- Create internal/wasm/fs_bridge.go with //go:build js \u0026\u0026 wasm\n- Export Node.js fs functions to Go using global.readFileSync, global.writeFileSync, etc.\n- Wrap in Go API that matches os package signatures\n- Update beads.go and storage layer to use bridge when in WASM\n\nThis unblocks bd-4462 (basic WASM testing) and [deleted:bd-5bbf] (feature parity testing).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T22:22:42.796412-08:00","updated_at":"2025-11-03T22:16:38.855334-08:00","closed_at":"2025-11-02T22:47:49.586218-08:00","dependencies":[{"issue_id":"bd-b4b0","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.585675-08:00","created_by":"stevey"}]} +{"id":"bd-5dae5504","title":"Export deduplication breaks when JSONL and export_hashes table diverge","description":"## Problem\n\nThe export deduplication feature (timestamp-only skipping) breaks when the JSONL file and export_hashes table get out of sync, causing exports to skip issues that aren't actually in the file.\n\n## Symptoms\n\n- `bd export` reports \"Skipped 128 issue(s) with timestamp-only changes\"\n- JSONL file only has 38 lines but DB has 149 issues\n- export_hashes table has 149 entries\n- Auto-import doesn't trigger (hash matches despite missing data)\n- Two repos on same commit show different issue counts\n\n## Root Cause\n\nshouldSkipExport() in autoflush.go compares current issue hash with stored export_hashes entry. If they match, it skips export assuming the issue is already in the JSONL.\n\nThis assumption fails when:\n1. Git operations (pull, reset, checkout) change JSONL without clearing export_hashes\n2. Manual JSONL edits or corruption\n3. Import operations that modify DB but don't update export_hashes\n4. Partial exports that update export_hashes but don't complete\n\n## Impact\n\n- **Critical data loss risk**: Issues appear to be tracked but aren't persisted to git\n- Breaks multi-repo sync (root cause of today's debugging session)\n- Auto-import fails to detect staleness (hash matches despite missing data)\n- Silent data corruption (no error messages, just missing issues)\n\n## Reproduction\n\n1. Have DB with 149 issues, all in export_hashes table\n2. Truncate JSONL to 38 lines (simulate git reset or corruption)\n3. Run `bd export` - it skips 128 issues\n4. JSONL still has only 38 lines but export thinks it succeeded\n\n## Current Workaround\n\n```bash\nsqlite3 .beads/beads.db \"DELETE FROM export_hashes\"\nbd export -o .beads/beads.jsonl\n```\n\n## Proposed Solutions\n\n**Option 1: Verify JSONL integrity before skipping**\n- Count lines in JSONL, compare with export_hashes count\n- If mismatch, clear export_hashes and force full export\n- Safe but adds I/O overhead\n\n**Option 2: Hash-based JSONL validation**\n- Store hash of entire JSONL file in metadata\n- Before export, check if JSONL hash matches\n- If mismatch, clear export_hashes\n- More efficient, detects any JSONL corruption\n\n**Option 3: Disable timestamp-only deduplication**\n- Remove the feature entirely\n- Always export all issues\n- Simplest and safest, but creates larger git commits\n\n**Option 4: Clear export_hashes on git operations**\n- Add post-merge hook to clear export_hashes\n- Clear on any import operation\n- Defensive approach but may over-clear\n\n## Recommended Fix\n\nCombination of Options 2 + 4:\n1. Store JSONL file hash in metadata after export\n2. Check hash before export, clear export_hashes if mismatch \n3. Clear export_hashes on import operations\n4. Add `bd validate` check for JSONL/export_hashes sync\n\n## Files Involved\n\n- cmd/bd/autoflush.go (shouldSkipExport)\n- cmd/bd/export.go (export with deduplication)\n- internal/storage/sqlite/metadata.go (export_hashes table)","notes":"## Recovery Session (2025-10-29 21:30)\n\n### What Happened\n- Created 14 new hash ID issues (bd-f8b764c9 through bd-f8b764c9.1) \n- bd sync appeared to succeed\n- Canonical repo (~/src/beads): 162 issues in DB + JSONL βœ“\n- Secondary repo (fred/beads): Only 145 issues vs 162 in canonical βœ—\n- Both repos on same git commit but different issue counts!\n\n### Bug Manifestation During Recovery\n\n1. **Initial state**: fred/beads had 145 issues, 145 lines in JSONL, 145 export_hashes entries\n\n2. **After git reset --hard origin/main**: \n - JSONL: 162 lines (from git)\n - DB: 150 issues (auto-import partially worked)\n - Auto-import failed with UNIQUE constraint error\n\n3. **After manual import --resolve-collisions**:\n - DB: 160 issues\n - JSONL: Still 162 lines\n - export_hashes: 159 entries\n\n4. **After bd export**: \n - **JSONL reduced to 17 lines!** ← The bug in action\n - export_hashes: 159 entries (skipped exporting 142 issues)\n - Silent data loss - no error message\n\n5. **After clearing export_hashes and re-export**:\n - JSONL: 159 lines (missing 3 issues still)\n - DB: 159 issues\n - Still diverged from canonical\n\n### The Bug Loop\nOnce export_hashes and JSONL diverge:\n- Export skips issues already in export_hashes\n- But those issues aren't actually in JSONL\n- This creates corrupt JSONL with missing issues\n- Auto-import can't detect the problem (file hash matches what was exported)\n- Data is lost with no error messages\n\n### Recovery Solution\nCouldn't break the loop with export alone. Had to:\n1. Copy .beads/beads.db from canonical repo\n2. Clear export_hashes\n3. Full re-export\n4. Finally converged to 162 issues\n\n### Key Learnings\n\n1. **The bug is worse than we thought**: It can create corrupt exports (17 lines instead of 162!)\n\n2. **Auto-import can't save you**: Once export is corrupt, auto-import just imports the corrupt data\n\n3. **Silent failure**: No warnings, no errors, just missing issues\n\n4. **Git operations trigger it**: git reset, git pull, etc. change JSONL without clearing export_hashes\n\n5. **Import operations populate export_hashes**: Even manual imports update export_hashes, setting up future export failures\n\n### Immediate Action Required\n\n**DISABLE EXPORT DEDUPLICATION NOW**\n\nThis feature is fundamentally broken and causes data loss. Should be disabled until properly fixed.\n\nQuick fix options:\n- Set environment variable to disable feature\n- Comment out shouldSkipExport check\n- Always clear export_hashes before export\n- Add validation that DB count == JSONL line count before allowing export\n\n### Long-term Fix\n\nNeed Option 2 + 4 from proposed solutions:\n1. Store JSONL file hash after every successful export\n2. Before export, verify JSONL hash matches expected\n3. If mismatch, log WARNING and clear export_hashes\n4. Clear export_hashes on every import operation\n5. Add git post-merge hook to clear export_hashes\n6. Add `bd validate` command to detect divergence\n","status":"closed","issue_type":"bug","created_at":"2025-10-29T23:05:13.959435-07:00","updated_at":"2025-10-30T17:12:58.207148-07:00","closed_at":"2025-10-29T21:57:03.06641-07:00"} +{"id":"bd-2ifg","title":"bd-hv01: Silent partial deletion failures cause DB inconsistency","description":"Problem: deletion_tracking.go:76-77 logs deletion errors as warnings but continues. If deletion fails midway (database locked, disk full), some issues delete but others don't. System thinks all deletions succeeded.\n\nImpact: Database diverges from JSONL, silent corruption, issues may resurrect on next sync.\n\nFix: Collect errors and fail the operation:\nvar deletionErrors []error\nfor _, id := range acceptedDeletions {\n if err := d.DeleteIssue(ctx, id); err != nil {\n deletionErrors = append(deletionErrors, fmt.Errorf(\"issue %s: %w\", id, err))\n }\n}\nif len(deletionErrors) \u003e 0 {\n return false, fmt.Errorf(\"deletion failures: %v\", deletionErrors)\n}\n\nFiles: cmd/bd/deletion_tracking.go:73-82","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:16:19.465137-08:00","updated_at":"2025-11-06T18:46:55.901973-08:00","closed_at":"2025-11-06T18:46:55.901973-08:00","dependencies":[{"issue_id":"bd-2ifg","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.833477-08:00","created_by":"daemon"}]} +{"id":"bd-4ba5908b","title":"Implement content-hash based collision resolution for deterministic convergence","description":"The current collision resolution uses creation timestamps to decide which issue to keep vs. remap. This is non-deterministic when two clones create issues at nearly the same time.\n\nRoot cause of bd-71107098:\n- Clone A creates test-1=\"Issue from clone A\" at T0\n- Clone B creates test-1=\"Issue from clone B\" at T0+30ms\n- Clone B syncs first, remaps Clone A's to test-2\n- Clone A syncs second, sees collision, remaps Clone B's to test-2\n- Result: titles are swapped between clones\n\nSolution:\n- Use content-based hashing (title + description + priority + type)\n- Deterministic winner: always keep issue with lower hash\n- Same collision on different clones produces same result (idempotent)\n\nImplementation:\n- Modify ScoreCollisions in internal/storage/sqlite/collision.go\n- Replace timestamp-based scoring with content hash comparison\n- Ensure hash function is stable across platforms","notes":"Rename detection successfully implemented and tested!\n\n**What was implemented:**\n1. Content-hash based rename detection in DetectCollisions\n2. When importing JSONL, if an issue has different ID but same content as DB issue, treat as rename\n3. Delete old ID and accept new ID from JSONL\n4. Added post-import re-export in sync command to flush rename changes\n5. Added post-import commit to capture rename changes\n\n**Test results:**\nTestTwoCloneCollision now shows full convergence:\n- Clone A: test-2=\"Issue from clone A\", test-1=\"Issue from clone B\"\n- Clone B: test-1=\"Issue from clone B\", test-2=\"Issue from clone A\"\n\nBoth clones have **identical content** (titles match IDs correctly). Only timestamps differ (expected).\n\n**What remains:**\n- Test still expects exact JSON match including timestamps\n- Could normalize timestamp comparison, but content convergence is the critical success metric\n- The two-clone collision workflow now works without data corruption!","status":"closed","issue_type":"task","created_at":"2025-10-28T17:04:11.530026-07:00","updated_at":"2025-10-30T17:12:58.225987-07:00","closed_at":"2025-10-28T17:18:27.777019-07:00","dependencies":[{"issue_id":"bd-4ba5908b","depends_on_id":"bd-71107098","type":"blocks","created_at":"2025-10-28T17:04:18.149604-07:00","created_by":"daemon"}]} +{"id":"bd-bzfy","title":"Integrate beads-merge tool by @neongreen","description":"**Context**: @neongreen built a production-ready 3-way merge tool for JSONL files that works with both Git and Jujutsu. This is superior to our planned bd resolve-conflicts because it prevents conflicts proactively instead of resolving them after the fact.\n\n**Tool**: https://github.com/neongreen/mono/tree/main/beads-merge\n\n**What it does**:\n- 3-way merge of JSONL files (base, left, right)\n- Field-level merging (titles, status, priority, etc.)\n- Smart dependency merging (union + dedup)\n- Conflict markers for unresolvable conflicts\n- Exit code 1 for conflicts (standard)\n\n**Integration options**:\n\n1. **Recommend (minimal effort)** - Document in AGENTS.md + TROUBLESHOOTING.md\n2. **Bundle binary** - Include in releases (cross-platform builds)\n3. **Port to Go** - Reimplement in bd codebase\n4. **Auto-install hook** - During bd init, offer to install merge driver\n\n**Recommendation**: Start with option 1 (document), then option 2 (bundle) once proven.\n\n**Related**: bd-5f483051 (bd resolve-conflicts - can close as superseded)","notes":"Created GitHub issue to discuss integration approach with @neongreen: https://github.com/neongreen/mono/issues/240\n\nAwaiting their preference on:\n1. Vendor with attribution (fastest)\n2. Extract as importable module (best long-term)\n3. Keep as separate tool (current state)\n\nNext: Wait for response before proceeding with integration.\n\nUPDATE 2025-11-06: @neongreen gave permission to vendor! Quote: \"I switched from beads to my own thing (tk) so I'm very happy to give beads-merge away β€” feel free to move it into the beads repo and I will point mono's readme to beads\"\n\nNext: Vendor beads-merge with full attribution","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T11:31:44.906652-08:00","updated_at":"2025-11-06T18:19:16.233387-08:00","closed_at":"2025-11-06T15:38:37.052274-08:00"} +{"id":"bd-ri6d","title":"bd message: Fix inefficient client-side filtering for --unread-only","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T12:54:28.614867-08:00","updated_at":"2025-11-08T12:58:59.551512-08:00","closed_at":"2025-11-08T12:58:59.551512-08:00","dependencies":[{"issue_id":"bd-ri6d","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:55.012455-08:00","created_by":"daemon"}]} +{"id":"bd-f8b764c9.5","title":"Delete collision resolution code","description":"Remove ~2,100 LOC of ID collision detection and resolution code (no longer needed with hash IDs).\n\n## Files to Delete Entirely\n```\ninternal/storage/sqlite/collision.go (~800 LOC)\ninternal/storage/sqlite/collision_test.go (~300 LOC)\ncmd/bd/autoimport_collision_test.go (~400 LOC)\n```\n\n## Code to Remove from Existing Files\n\n### internal/importer/importer.go\nRemove:\n- `DetectCollisions()` calls\n- `ScoreCollisions()` logic\n- `RemapCollisions()` calls\n- `handleRename()` function\n- All collision-related error handling\n\nKeep:\n- Basic import logic\n- Exact match detection (idempotent import)\n\n### beads_twoclone_test.go\nRemove:\n- `TestTwoCloneCollision` (bd-71107098)\n- `TestThreeCloneCollision` (bd-cbed9619)\n- `TestFiveCloneCollision` (bd-a40f374f)\n- All N-way collision tests\n\n### cmd/bd/import.go\nRemove:\n- `--resolve-collisions` flag\n- `--dry-run` collision preview\n- Collision reporting\n\n## Issues Closed by This Change\n- bd-71107098: Add test for symmetric collision\n--89: Content-hash collision resolution\n- bd-cbed9619: N-way collision resolution epic\n- bd-cbed9619.5: Add ScoreCollisions (already done but now unnecessary)\n- bd-cbed9619.4: Make DetectCollisions read-only\n- bd-cbed9619.3: ResolveNWayCollisions function\n- bd-cbed9619.2: Multi-round import convergence\n- bd-cbed9619.1: Multi-round convergence for N-way collisions\n- bd-e6d71828: Transaction + retry logic for collisions\n- bd-70419816: Test case for symmetric collision\n\n## Verification Steps\n1. `grep -r \"collision\" --include=\"*.go\"` β†’ should only find alias conflicts\n2. `go test ./...` β†’ all tests pass\n3. `go build ./cmd/bd` β†’ clean build\n4. Check LOC reduction: `git diff --stat`\n\n## Expected Metrics\n- **Files deleted**: 3\n- **LOC removed**: ~2,100\n- **Test coverage**: Should increase (less untested code)\n- **Binary size**: Slightly smaller\n\n## Caution\nDo NOT delete:\n- Alias conflict resolution (new code in bd-f8b764c9.6)\n- Duplicate detection (bd-581b80b3, bd-149) - different from ID collisions\n- Merge conflict resolution (bd-7e7ddffa.1, bd-5f483051) - git conflicts, not ID collisions\n\n## Files to Modify\n- internal/importer/importer.go (remove collision handling)\n- cmd/bd/import.go (remove --resolve-collisions flag)\n- beads_twoclone_test.go (remove collision tests)\n- Delete: internal/storage/sqlite/collision.go\n- Delete: internal/storage/sqlite/collision_test.go \n- Delete: cmd/bd/autoimport_collision_test.go\n\n## Testing\n- Ensure all remaining tests pass\n- Manual test: create issue on two clones, sync β†’ no collisions\n- Verify error if somehow hash collision occurs (extremely unlikely)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:25:50.976383-07:00","updated_at":"2025-10-31T12:32:32.608942-07:00","closed_at":"2025-10-31T12:32:32.608942-07:00","dependencies":[{"issue_id":"bd-f8b764c9.5","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:25:50.977857-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.5","depends_on_id":"bd-f8b764c9.9","type":"blocks","created_at":"2025-10-29T21:25:50.978395-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.5","depends_on_id":"bd-f8b764c9.8","type":"blocks","created_at":"2025-10-29T21:25:50.978842-07:00","created_by":"stevey"}]} +{"id":"bd-5xt","title":"Log errors from timer-triggered flushes instead of discarding","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:22:06.694953-05:00","updated_at":"2025-11-21T10:59:00.406689-05:00","closed_at":"2025-11-20T21:35:53.117434-05:00"} +{"id":"bd-824","title":"Add migration guide for library consumers","description":"The contributor-workflow-analysis.md has excellent migration examples for CLI users (lines 508-549) but lacks examples for library consumers like VC that use beadsLib in Go/TypeScript code.\n\nLibrary consumers need to know:\n- Whether their existing code continues to work unchanged (backward compatibility)\n- How config.toml is automatically read (transparent hydration)\n- When and how to use explicit multi-repo configuration\n- What happens if config.toml doesn't exist (defaults)\n\nExample needed:\n```go\n// Before (v0.17.3)\nstore, err := beadsLib.NewSQLiteStorage(\".beads/vc.db\")\n\n// After (v0.18.0 with multi-repo) - still works!\nstore, err := beadsLib.NewSQLiteStorage(\".beads/vc.db\")\n// Automatically reads .beads/config.toml if present\n\n// Explicit multi-repo (if needed)\ncfg := beadsLib.Config{\n Primary: \".beads/vc.db\",\n Additional: []string{\"~/.beads-planning\"},\n}\nstore, err := beadsLib.NewStorageWithConfig(cfg)\n```","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:17.748337-08:00","updated_at":"2025-11-05T14:15:44.154675-08:00","closed_at":"2025-11-05T14:15:44.154675-08:00"} +{"id":"bd-74ee","title":"Frontend task","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-03T19:11:59.358631-08:00","updated_at":"2025-11-05T00:25:06.457813-08:00","closed_at":"2025-11-05T00:25:06.457813-08:00"} +{"id":"bd-hdt","title":"Implement auto-merge functionality in duplicates command","description":"The duplicates.go file has a TODO at line 95 to implement the performMerge function for automatic duplicate merging. Currently it just prints a warning message. This would automate the merge process instead of just suggesting commands.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-21T18:55:02.828619-05:00","updated_at":"2025-11-21T18:55:02.828619-05:00"} +{"id":"bd-pdjb","title":"Testing \u0026 Validation","description":"Ensure reliability through comprehensive testing.","notes":"Completed comprehensive Agent Mail test coverage analysis and implementation.\n\n**Test Coverage Summary:**\n- 66 total tests across 5 files\n- 51 unit tests for HTTP adapter (0.02s)\n- 15 integration tests for multi-agent scenarios (~55s total)\n\n**New Tests Added:**\nCreated `test_multi_agent_coordination.py` (4 tests, 11s) covering:\n1. Fairness: 10 agents competing for 5 issues β†’ exactly 1 claim per issue\n2. Notifications: End-to-end message delivery between agents\n3. Handoff: Clean reservation transfer from agent1 to agent2\n4. Idempotency: Double reserve/release by same agent\n\n**Coverage Quality:**\nβœ… Collision prevention (race conditions)\nβœ… Graceful degradation (7 failure modes)\nβœ… TTL/expiration behavior\nβœ… Multi-agent coordination\nβœ… JSONL consistency\nβœ… HTTP error handling\nβœ… Authorization and configuration\n\n**Intentionally Skipped:**\n- Path traversal (validated elsewhere)\n- Retry policies (nice-to-have)\n- HTTPS/TLS (out of scope)\n- Slow tests (50+ agents, soak tests)\n\nSee `tests/integration/AGENT_MAIL_TEST_COVERAGE.md` for details.\n\nAll tests pass. Agent Mail integration is well-tested and reliable for multi-agent scenarios.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-07T22:43:00.457985-08:00","updated_at":"2025-11-08T03:09:48.253758-08:00","closed_at":"2025-11-08T02:47:34.153586-08:00","dependencies":[{"issue_id":"bd-pdjb","depends_on_id":"bd-wfmw","type":"blocks","created_at":"2025-11-07T22:43:00.459403-08:00","created_by":"daemon"}]} +{"id":"bd-irq6","title":"Remove unused global daemon infrastructure (internal/daemonrunner/)","description":"The internal/daemonrunner/ package (1,468 LOC) contains the old global daemon implementation that is no longer used. We now use per-workspace daemons.\n\nDeadcode analysis shows all these functions are unreachable:\n- Daemon.Start, runGlobalDaemon, setupLock\n- validateSingleDatabase, validateSchemaVersion\n- registerDaemon, unregisterDaemon\n- validateDatabaseFingerprint\n- Full git client implementation (NewGitClient, HasUpstream, HasChanges, Commit, Push, Pull)\n- Helper functions: isGitRepo, gitHasUpstream, gitHasChanges, gitCommit\n\nThe entire package appears unused since switching to per-workspace daemon architecture.\n\nFiles to remove:\n- daemon.go (9,436 bytes)\n- git.go (3,510 bytes) \n- sync.go (6,401 bytes)\n- fingerprint.go (2,076 bytes)\n- process.go (3,332 bytes)\n- rpc.go (994 bytes)\n- config.go (486 bytes)\n- logger.go (1,579 bytes)\n- flock_*.go (platform-specific file locking)\n- signals_*.go (platform-specific signal handling)\n- All test files\n\nTotal cleanup: ~1,500 LOC","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T19:30:50.936943-08:00","updated_at":"2025-11-06T19:35:10.646498-08:00","closed_at":"2025-11-06T19:35:10.646498-08:00"} +{"id":"bd-89e2","title":"Daemon race condition: stale export overwrites recent DB changes","description":"**Symptom:**\nMerged bd-fc2d into bd-fb05 in ~/src/beads (commit ce4d756), pushed to remote. The ~/src/fred/beads daemon then exported its stale DB state and committed (8cc1bb4), reverting bd-fc2d back to \"open\" status.\n\n**Timeline:**\n1. 21:45:12 - Merge committed from ~/src/beads (ce4d756): bd-fc2d closed\n2. 21:49:42 - Daemon in ~/src/fred/beads exported stale state (8cc1bb4): bd-fc2d open again\n\n**Root cause:**\nThe fred/beads daemon had a stale database (bd-fc2d still open) and didn't auto-import the newer JSONL before exporting. When it exported, it overwrote the merge with its stale state.\n\n**Expected behavior:**\nDaemon should detect that JSONL is newer than its last export and import before exporting.\n\n**Actual behavior:**\nDaemon exported stale DB state, creating a conflicting commit that reverted upstream changes.\n\n**Impact:**\nMulti-workspace setups with daemons can silently lose changes if one daemon has stale state and exports.","status":"closed","issue_type":"bug","created_at":"2025-11-01T21:53:07.930819-07:00","updated_at":"2025-11-01T22:01:25.54126-07:00","closed_at":"2025-11-01T22:01:25.54126-07:00"} +{"id":"bd-fb95094c.6","title":"Extract normalizeLabels to shared utility package","description":"The `normalizeLabels` function appears in multiple locations with identical implementation. Extract to a shared utility package.\n\nCurrent locations:\n- `internal/rpc/server.go:37` (53 lines) - full implementation\n- `cmd/bd/list.go:50-52` - uses the server version (needs to use new shared version)\n\nFunction purpose:\n- Trims whitespace from labels\n- Removes empty strings\n- Deduplicates labels\n- Preserves order\n\nTarget structure:\n```\ninternal/util/\nβ”œβ”€β”€ strings.go # String utilities\n └── NormalizeLabels([]string) []string\n```\n\nImpact: DRY principle, single source of truth, easier to test","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:31:19.078622-07:00","updated_at":"2025-11-06T20:06:49.219555-08:00","closed_at":"2025-11-06T19:58:59.467567-08:00","dependencies":[{"issue_id":"bd-fb95094c.6","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:31:19.08015-07:00","created_by":"daemon"}]} +{"id":"bd-08e556f2","title":"Remove Cache Configuration Docs","description":"Remove documentation of deprecated cache env vars","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T10:50:15.125488-07:00","updated_at":"2025-10-30T17:12:58.216329-07:00","closed_at":"2025-10-28T10:48:20.606979-07:00"} +{"id":"bd-4f582ec8","title":"Test auto-start in fred","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-30T17:46:16.668088-07:00","updated_at":"2025-10-31T12:00:43.185723-07:00","closed_at":"2025-10-31T12:00:43.185723-07:00"} +{"id":"bd-5c4","title":"VCS-agnostic sync support","description":"Make bd sync work with multiple VCS types (git, jujutsu, mercurial, sapling) by detecting VCS per repo and using appropriate sync commands, supporting mixed-VCS multi-repo configs.","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-04T11:22:00.837527-08:00","updated_at":"2025-11-05T14:30:10.417479-08:00","closed_at":"2025-11-05T14:26:17.942832-08:00","dependencies":[{"issue_id":"bd-5c4","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:21.817849-08:00","created_by":"daemon"}]} +{"id":"bd-1ece","title":"Remove obsolete renumber.go command (hash IDs eliminated need)","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-10-31T21:27:05.559328-07:00","updated_at":"2025-10-31T21:27:11.426941-07:00","closed_at":"2025-10-31T21:27:11.426941-07:00"} +{"id":"bd-74q9","title":"Issue to reopen with reason","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T19:43:48.752747-05:00","updated_at":"2025-11-20T19:43:48.752747-05:00","closed_at":"2025-11-09T16:13:23.938513-08:00"} +{"id":"bd-4e21b5ad","title":"Add test case for symmetric collision (both clones create same ID simultaneously)","description":"TestTwoCloneCollision demonstrates the problem, but we need a simpler unit test for the collision resolver itself.\n\nTest should verify:\n- Two issues with same ID, different content\n- Content hash determines winner deterministically \n- Result is same regardless of which clone imports first\n- No title swapping occurs\n\nThis can be a simpler test than the full integration test.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T17:46:10.046999-07:00","updated_at":"2025-10-31T12:00:43.196705-07:00","closed_at":"2025-10-31T12:00:43.196705-07:00"} +{"id":"bd-1b0a","title":"Add transaction helper to replace manual COMMIT/ROLLBACK","description":"Create tx.go with withTx helper that handles transaction lifecycle. Replace manual transaction blocks in create/insert/update paths.","notes":"Refactoring complete:\n- Created withTx() helper in util.go\n- Added ExecInTransaction() as deprecated wrapper for backward compatibility\n- Refactored all manual transaction blocks to use withTx():\n - events.go: AddComment\n - dirty.go: MarkIssuesDirty, ClearDirtyIssuesByID\n - labels.go: executeLabelOperation\n - dependencies.go: AddDependency, RemoveDependency\n - compact.go: ApplyCompaction\n- All tests pass successfully","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.823323-07:00","updated_at":"2025-11-02T12:41:45.827688-08:00","closed_at":"2025-11-02T12:41:45.827688-08:00"} +{"id":"bd-fb95094c.8","title":"Remove unreachable utility functions","description":"Several small utility functions are unreachable:\n\nFiles to clean:\n1. `internal/storage/sqlite/hash.go` - `computeIssueContentHash` (line 17)\n - Check if entire file can be deleted if only contains this function\n\n2. `internal/config/config.go` - `FileUsed` (line 151)\n - Delete unused config helper\n\n3. `cmd/bd/git_sync_test.go` - `verifyIssueOpen` (line 300)\n - Delete dead test helper\n\n4. `internal/compact/haiku.go` - `HaikuClient.SummarizeTier2` (line 81)\n - Tier 2 summarization not implemented\n - Options: implement feature OR delete method\n\nImpact: Removes 50-100 LOC depending on decisions","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T19:43:48.757493-05:00","updated_at":"2025-11-23T14:14:13.334902-08:00","closed_at":"2025-11-07T10:55:55.982696-08:00","dependencies":[{"issue_id":"bd-fb95094c.8","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:19.968126-07:00","created_by":"daemon"}]} +{"id":"bd-c7eb","title":"Research Go WASM compilation and modernc.org/sqlite WASM support","description":"Investigate technical requirements for compiling bd to WASM:\n- Verify modernc.org/sqlite has working js/wasm support\n- Identify Go stdlib limitations in WASM (syscalls, file I/O, etc.)\n- Research wasm_exec.js runtime and Node.js integration\n- Document any API differences between native and WASM builds","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.284264-08:00","updated_at":"2025-11-02T22:23:49.375941-08:00","closed_at":"2025-11-02T22:23:49.375941-08:00","dependencies":[{"issue_id":"bd-c7eb","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.378673-08:00","created_by":"stevey"}]} +{"id":"bd-tru","title":"Update documentation for bd prime and Claude integration","description":"Update AGENTS.md, README.md, and QUICKSTART.md to document the new `bd prime` command, `bd setup claude` command, and tip system.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-11T23:30:22.77349-08:00","updated_at":"2025-11-11T23:45:23.242658-08:00","dependencies":[{"issue_id":"bd-tru","depends_on_id":"bd-rpn","type":"blocks","created_at":"2025-11-11T23:30:22.774216-08:00","created_by":"daemon"},{"issue_id":"bd-tru","depends_on_id":"bd-br8","type":"blocks","created_at":"2025-11-11T23:30:22.774622-08:00","created_by":"daemon"},{"issue_id":"bd-tru","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:35.277819-08:00","created_by":"daemon"}]} +{"id":"bd-3f6a","title":"Add concurrent import race condition tests","description":"Currently no tests verify behavior when multiple clones import simultaneously with external_ref matching.\n\nScenarios to test:\n1. Two clones import same external_ref update at same time\n2. Clone A imports while Clone B updates same issue\n3. Verify transaction isolation prevents corruption\n4. Document expected behavior (last-write-wins vs timestamp-based)\n\nRelated: bd-1022\nFiles: internal/importer/external_ref_test.go","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-02T15:32:11.286956-08:00","updated_at":"2025-11-02T16:11:16.127009-08:00","closed_at":"2025-11-02T16:11:16.127009-08:00"} +{"id":"bd-6bebe013","title":"Rapid 1","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.404437-07:00","updated_at":"2025-11-07T23:21:44.922966-08:00","closed_at":"2025-11-07T23:18:52.368766-08:00"} +{"id":"bd-0458","title":"Consolidate export/import/commit/push into sync.go","description":"Create internal/daemonrunner/sync.go with Syncer type. Add ExportOnce, ImportOnce, CommitAndMaybePush methods. Replace createExportFunc/createAutoImportFunc with thin closures calling Syncer.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.874539-07:00","updated_at":"2025-11-02T12:32:00.157369-08:00","closed_at":"2025-11-02T12:32:00.157375-08:00"} +{"id":"bd-8534","title":"Switch from modernc.org/sqlite to ncruces/go-sqlite3 for WASM support","description":"modernc.org/sqlite depends on modernc.org/libc which has no js/wasm support (platform-specific syscalls). Need to switch to ncruces/go-sqlite3 which wraps a WASM build of SQLite using wazero runtime.\n\nKey differences:\n- ncruces/go-sqlite3: Uses WASM build of SQLite + wazero runtime\n- modernc.org/sqlite: Pure Go translation, requires libc for syscalls\n\nThis is a prerequisite for bd-62a0 (WASM build infrastructure).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T22:14:27.627154-08:00","updated_at":"2025-11-02T22:23:49.377223-08:00","closed_at":"2025-11-02T22:23:49.377223-08:00","dependencies":[{"issue_id":"bd-8534","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.555691-08:00","created_by":"stevey"}]} +{"id":"bd-e044","title":"Add mermaid output format for bd dep tree","description":"Add visual dependency graph output using Mermaid format for better visualization of issue relationships.\n\nExample usage:\n bd dep tree --format mermaid \u003cissue-id\u003e\n bd dep tree --format mermaid bd-42 \u003e graph.md\n\nThis would output Mermaid syntax that can be rendered in GitHub, documentation sites, or Mermaid live editor.\n\nImplementation notes:\n- Add --format flag to dep tree command\n- Support 'text' (default) and 'mermaid' formats\n- Mermaid graph should show issue IDs, titles, and dependency types\n- Consider using flowchart LR or graph TD syntax","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-03T18:10:18.978383-08:00","updated_at":"2025-11-03T20:55:06.696363-08:00","closed_at":"2025-11-03T20:55:06.69637-08:00"} +{"id":"bd-khnb","title":"bd migrate --update-repo-id triggers auto-import that resurrects deleted issues","description":"**Bug:** Running `bd migrate --update-repo-id` can resurrect previously deleted issues from git history.\n\n## What Happened\n\nUser deleted 490 closed issues:\n- Deletion committed successfully (06d655a) with JSONL at 48 lines\n- Database had 48 issues after deletion\n- User ran `bd migrate --update-repo-id` to fix legacy database\n- Migration triggered daemon auto-import\n- JSONL had been restored to 538 issues (from commit 6cd3a32 - before deletion)\n- Auto-import loaded the old JSONL over the cleaned database\n- Result: 490 deleted issues resurrected\n\n## Root Cause\n\nThe auto-import logic in `cmd/bd/sync.go:130-136`:\n```go\nif isJSONLNewer(jsonlPath) {\n fmt.Println(\"β†’ JSONL is newer than database, importing first...\")\n if err := importFromJSONL(ctx, jsonlPath, renameOnImport); err != nil {\n```\n\nThis checks if JSONL mtime is newer than database and auto-imports. The problem:\n1. Git operations (pull, merge, checkout) can restore old JSONL files\n2. Restored file has recent mtime (time of git operation)\n3. Auto-import sees \"newer\" JSONL and imports it\n4. Old data overwrites current database state\n\n## Timeline\n\n- 19:59: Commit 6cd3a32 restored JSONL to 538 issues from d99222d\n- 20:22: Commit 3520321 (bd sync)\n- 20:23: Commit 06d655a deleted 490 issues β†’ JSONL now 48 lines\n- 20:23: User ran `bd migrate --update-repo-id`\n- Migration completed, daemon started\n- Daemon saw JSONL (restored earlier to 538) was \"newer\" than database\n- Auto-import resurrected 490 deleted issues\n\n## Impact\n\n- **Critical data loss bug** - user deletions can be undone silently\n- Affects any workflow that uses git branches, merges, or checkouts\n- Auto-import has no safety checks against importing older data\n- Users have no warning that old data will overwrite current state\n\n## Fix Options\n\n1. **Content-based staleness** (not mtime-based)\n - Compare JSONL content hash vs database content hash\n - Only import if content actually changed\n - Prevents re-importing old data with new mtime\n\n2. **Database timestamp check**\n - Store \"last export timestamp\" in database metadata\n - Only import JSONL if it's newer than last export\n - Prevents importing old JSONL after git operations\n\n3. **User confirmation**\n - Before auto-import, show diff of what will change\n - Require confirmation for large changes (\u003e10% issues affected)\n - Safety valve for destructive imports\n\n4. **Explicit sync mode**\n - Disable auto-import entirely\n - Require explicit `bd sync` or `bd import` commands\n - Trade convenience for safety\n\n## Recommended Solution\n\nCombination of #1 and #2:\n- Add `last_export_timestamp` to database metadata\n- Check JSONL mtime \u003e last_export_timestamp before importing\n- Add content hash check as additional safety\n- Show warning if importing would delete \u003e10 issues\n\nThis preserves auto-import convenience while preventing data loss.\n\n## Files Involved\n\n- `cmd/bd/sync.go:130-136` - Auto-import logic\n- `cmd/bd/daemon_sync.go` - Daemon export/import cycle\n- `internal/autoimport/autoimport.go` - Staleness detection\n\n## Reproduction Steps\n\n1. Create and delete some issues, commit to git\n2. Checkout an earlier commit (before deletion)\n3. Checkout back to current commit\n4. JSONL file now has recent mtime but old content\n5. Run any bd command that triggers auto-import\n6. Deleted issues are resurrected","status":"closed","issue_type":"bug","created_at":"2025-11-20T20:44:35.235807-05:00","updated_at":"2025-11-20T21:51:31.806158-05:00","closed_at":"2025-11-20T21:51:31.806158-05:00"} +{"id":"bd-fb95094c.10","title":"Consider central serialization package for JSON handling","description":"Multiple parts of the codebase handle JSON serialization of issues with slightly different approaches. Consider creating a centralized serialization package to ensure consistency.\n\nCurrent serialization locations:\n- `cmd/bd/export.go` - JSONL export (issues to file)\n- `cmd/bd/import.go` - JSONL import (file to issues)\n- `internal/rpc/protocol.go` - RPC JSON marshaling\n- `internal/storage/memory/memory.go` - In-memory marshaling\n\nPotential benefits:\n- Single source of truth for JSON format\n- Consistent field naming\n- Easier to add new fields\n- Centralized validation\n\nNote: This is marked **optional** because:\n- Current serialization mostly works\n- May not provide enough benefit to justify refactor\n- Risk of breaking compatibility\n\nDecision point: Evaluate if benefits outweigh refactoring cost\n\nImpact: TBD based on investigation - may defer to future work","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-27T20:31:19.090608-07:00","updated_at":"2025-11-23T14:14:13.333811-08:00","closed_at":"2025-11-08T18:15:54.319047-08:00","dependencies":[{"issue_id":"bd-fb95094c.10","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:31:19.092328-07:00","created_by":"daemon"}]} +{"id":"bd-ye0d","title":"troubleshoot GH#278 daemon exits every few secs","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-13T06:27:23.39509215-07:00","updated_at":"2025-11-13T06:27:23.39509215-07:00"} +{"id":"bd-au0.2","title":"Add label operations to bd update command","description":"Add --add-label and --remove-label flags to bd update.\n\n**Implementation:**\n- Add flags: --add-label, --remove-label, --set-labels\n- Support multiple labels (repeatable flags)\n- Test with daemon and direct mode\n\n**Files to modify:**\n- cmd/bd/show.go (updateCmd definition)\n- Add RPC support in internal/rpc/protocol.go and server\n\n**Testing:**\n- Add/remove single label\n- Add/remove multiple labels\n- Set labels (replace all)\n- JSON output\n- Daemon mode vs direct mode","notes":"Architecture review complete:\n- Current: separate 'bd label add/remove' commands exist\n- UpdateArgs struct in protocol.go needs new fields: AddLabels, RemoveLabels, SetLabels\n- RPC server needs label operation support in Update handler\n- CLI flags needed: --add-label, --remove-label, --set-labels (repeatable)\n- Both daemon and direct mode need implementation\n- Tests needed for all modes\n\nThis is a moderate-sized feature requiring changes across:\n1. cmd/bd/show.go (updateCmd flags and logic)\n2. internal/rpc/protocol.go (UpdateArgs struct)\n3. internal/rpc/server_issues_epics.go (Update handler)\n4. Tests for daemon/direct modes","status":"closed","issue_type":"task","created_at":"2025-11-21T21:06:23.715557-05:00","updated_at":"2025-11-23T18:06:29.859564-08:00","closed_at":"2025-11-21T22:15:19.213543-05:00","dependencies":[{"issue_id":"bd-au0.2","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:23.716044-05:00","created_by":"daemon"}]} +{"id":"bd-i6eq","title":"Review and merge open PRs","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-22T16:44:20.568499-08:00","updated_at":"2025-11-23T14:14:13.335959-08:00","closed_at":"2025-11-22T18:18:08.088054-08:00"} +{"id":"bd-eb3c","title":"UX nightmare: multiple ways daemon can fail with misleading messages","status":"closed","issue_type":"epic","created_at":"2025-10-31T21:08:09.090553-07:00","updated_at":"2025-11-01T20:27:42.79962-07:00","closed_at":"2025-11-01T20:27:42.79962-07:00"} +{"id":"bd-1rh","title":"cmd/bd test suite is absurdly slow - 279 tests taking 8+ minutes","description":"# Problem\n\nThe cmd/bd test suite is painfully slow:\n- **279 tests** in cmd/bd alone\n- Full suite takes **8+ minutes** to run\n- Even with the 16 slowest integration tests now tagged with `integration` build tag, the remaining tests still take forever\n\nThis makes the development loop unusable. We can't wait 8+ minutes every time we want to run tests.\n\n# Root Cause Analysis\n\n## 1. Sheer Volume\n279 tests is too many for a single package. Even at 0.1s per test, that's 28 seconds minimum just for cmd/bd.\n\n## 2. Each Test Creates Full Database + Temp Directories\nEvery test does heavy setup:\n- Creates temp directory (`t.TempDir()` or `os.MkdirTemp`)\n- Initializes SQLite database\n- Sets up git repo in many cases\n- Creates full storage layer\n\nExample from the tests:\n```go\nfunc setupCLITestDB(t *testing.T) string {\n tmpDir := createTempDirWithCleanup(t)\n runBDInProcess(t, tmpDir, \"init\", \"--prefix\", \"test\", \"--quiet\")\n return tmpDir\n}\n```\n\nThis happens 279 times!\n\n## 3. Tests Are Not Properly Categorized\nWe have three types of tests mixed together:\n- **Unit tests** - should be fast, test single functions\n- **Integration tests** - test full workflows, need DB/git\n- **End-to-end tests** - test entire CLI commands\n\nThey're all lumped together in cmd/bd, all running every time.\n\n# What We've Already Fixed\n\nAdded `integration` build tags to 16 obviously-slow test files:\n- import_profile_test.go (performance benchmarking tests)\n- export_mtime_test.go (tests with time.Sleep calls)\n- cli_fast_test.go (full CLI integration tests)\n- delete_test.go, import_uncommitted_test.go, sync_local_only_test.go (git integration)\n- And 10 more in internal/ packages\n\nThese are now excluded from the default `go test ./...` run.\n\n# Proposed Solutions\n\n## Option 1: Shared Test Fixtures (Quick Win)\nCreate a shared test database that multiple tests can use:\n```go\nvar testDB *sqlite.SQLiteStorage\nvar testDBOnce sync.Once\n\nfunc getSharedTestDB(t *testing.T) storage.Storage {\n testDBOnce.Do(func() {\n // Create one DB for all tests\n })\n return testDB\n}\n```\n\n**Pros**: Easy to implement, immediate speedup\n**Cons**: Tests become less isolated, harder to debug failures\n\n## Option 2: Table-Driven Tests (Medium Win)\nCollapse similar tests into table-driven tests:\n```go\nfunc TestCreate(t *testing.T) {\n tests := []struct{\n name string\n args []string\n want string\n }{\n {\"basic issue\", []string{\"create\", \"Test\"}, \"created\"},\n {\"with description\", []string{\"create\", \"Test\", \"-d\", \"desc\"}, \"created\"},\n // ... 50 more cases\n }\n \n db := setupOnce(t) // Setup once, not 50 times\n for _, tt := range tests {\n t.Run(tt.name, func(t *testing.T) {\n // test using shared db\n })\n }\n}\n```\n\n**Pros**: Dramatically reduces setup overhead, tests run in parallel\n**Cons**: Requires refactoring, tests share more state\n\n## Option 3: Split cmd/bd Tests Into Packages (Big Win)\nMove tests into focused packages:\n- `cmd/bd/internal/clitests` - CLI integration tests (mark with integration tag)\n- `cmd/bd/internal/unittests` - Fast unit tests\n- Keep only essential tests in cmd/bd\n\n**Pros**: Clean separation, easy to run just fast tests\n**Cons**: Requires significant refactoring\n\n## Option 4: Parallel Execution (Quick Win)\nAdd `t.Parallel()` to independent tests:\n```go\nfunc TestSomething(t *testing.T) {\n t.Parallel() // Run this test concurrently with others\n // ...\n}\n```\n\n**Pros**: Easy to add, can cut time in half on multi-core machines\n**Cons**: Doesn't reduce actual test work, just parallelizes it\n\n## Option 5: In-Memory Databases (Medium Win)\nUse `:memory:` SQLite databases instead of file-based:\n```go\nstore, err := sqlite.New(ctx, \":memory:\")\n```\n\n**Pros**: Faster than disk I/O, easier cleanup\n**Cons**: Some tests need actual file-based DBs (export/import tests)\n\n# Recommended Approach\n\n**Short-term (this week)**:\n1. Add `t.Parallel()` to all independent tests in cmd/bd\n2. Use `:memory:` databases where possible\n3. Create table-driven tests for similar test cases\n\n**Medium-term (next sprint)**:\n4. Split cmd/bd tests into focused packages\n5. Mark more integration tests appropriately\n\n**Long-term (backlog)**:\n6. Consider shared test fixtures with proper isolation\n\n# Current Status\n\nWe've tagged 16 files with `integration` build tag, but the remaining 279 tests in cmd/bd still take 8+ minutes. This issue tracks fixing the cmd/bd test performance specifically.\n\n# Target\n\nGet `go test ./...` (without `-short` or `-tags=integration`) down to **under 30 seconds**.\n\n\n# THE REAL ROOT CAUSE (Updated Analysis)\n\nAfter examining the actual test code, the problem is clear:\n\n## Every Test Creates Its Own Database From Scratch\n\nLook at `create_test.go`:\n```go\nfunc TestCreate_BasicIssue(t *testing.T) {\n tmpDir := t.TempDir() // ← Creates temp dir\n testDB := filepath.Join(tmpDir, \".beads\", \"beads.db\")\n s := newTestStore(t, testDB) // ← Opens NEW SQLite connection\n // ← Runs migrations\n // ← Sets config\n // ... actual test (3 lines)\n}\n\nfunc TestCreate_WithDescription(t *testing.T) {\n tmpDir := t.TempDir() // ← Creates ANOTHER temp dir\n testDB := filepath.Join(tmpDir, \".beads\", \"beads.db\")\n s := newTestStore(t, testDB) // ← Opens ANOTHER SQLite connection\n // ... actual test (3 lines)\n}\n```\n\n**This happens 279 times!**\n\n## These Tests Don't Need Isolation!\n\nMost tests are just checking:\n- \"Can I create an issue with a title?\"\n- \"Can I create an issue with a description?\"\n- \"Can I add labels?\"\n\nThey don't conflict with each other. They could all share ONE database!\n\n## The Fix: Test Suites with Shared Setup\n\nInstead of:\n```go\nfunc TestCreate_BasicIssue(t *testing.T) {\n s := newTestStore(t, t.TempDir()+\"/db\") // ← Expensive!\n // test\n}\n\nfunc TestCreate_WithDesc(t *testing.T) {\n s := newTestStore(t, t.TempDir()+\"/db\") // ← Expensive!\n // test\n}\n```\n\nDo this:\n```go\nfunc TestCreate(t *testing.T) {\n // ONE setup for all subtests\n s := newTestStore(t, t.TempDir()+\"/db\")\n \n t.Run(\"basic_issue\", func(t *testing.T) {\n t.Parallel() // Can run concurrently - tests don't conflict\n // test using shared `s`\n })\n \n t.Run(\"with_description\", func(t *testing.T) {\n t.Parallel()\n // test using shared `s`\n })\n \n // ... 50 more subtests, all using same DB\n}\n```\n\n**Result**: 50 tests β†’ 1 database setup instead of 50!\n\n## Why This Works\n\nSQLite is fine with concurrent reads and isolated transactions. These tests:\n- βœ… Create different issues (no ID conflicts)\n- βœ… Just read back what they created\n- βœ… Don't depend on database state from other tests\n\nThey SHOULD share a database!\n\n## Real Numbers\n\nCurrent:\n- 279 tests Γ— (create dir + init SQLite + migrations) = **8 minutes**\n\nAfter fix:\n- 10 test suites Γ— (create dir + init SQLite + migrations) = **30 seconds**\n- 279 subtests running in parallel using those 10 DBs = **5 seconds**\n\n**Total: ~35 seconds instead of 8 minutes!**\n\n## Implementation Plan\n\n1. **Group related tests** into suites (Create, List, Update, Delete, etc.)\n2. **One setup per suite** instead of per test\n3. **Use t.Run() for subtests** with t.Parallel()\n4. **Keep tests that actually need isolation** separate (export/import tests, git operations)\n\nThis is way better than shuffling tests into folders!","notes":"## Progress Update (2025-11-21)\n\nβœ… **Completed**:\n- Audited all 280 tests, created TEST_SUITE_AUDIT.md ([deleted:bd-c49])\n- Refactored create_test.go to shared DB pattern ([deleted:bd-y6d])\n- Proven the pattern works: 11 tests now run in 0.04s with 1 DB instead of 11\n\n❌ **Current Reality**:\n- Overall test suite: Still 8+ minutes (no meaningful change)\n- Only 1 of 76 test files refactored\n- Saved ~10 DB initializations out of 280\n\n## Acceptance Criteria (REALISTIC)\n\nThis task is NOT complete until:\n- [ ] All P1 files refactored (create βœ…, dep, stale, comments, list, ready)\n- [ ] Test suite runs in \u003c 2 minutes\n- [ ] Measured and verified actual speedup\n\n## Next Steps\n\n1. Refactor remaining 5 P1 files: dep_test.go, stale_test.go, comments_test.go, list_test.go, ready_test.go\n2. Measure actual time improvement after each file\n3. Continue with P2 files if needed to hit \u003c2min target","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-21T11:37:47.886207-05:00","updated_at":"2025-11-23T18:06:29.863425-08:00","dependencies":[{"issue_id":"bd-1rh","depends_on_id":"bd-c49","type":"blocks","created_at":"2025-11-21T11:49:26.347518-05:00","created_by":"daemon"}]} +{"id":"bd-gdzd","title":"Import fails on same-content-different-ID instead of treating as update","description":"## Problem\n\nThe importer still has rename detection (importer.go:482-500) that triggers when same content hash has different IDs. With hash IDs, this shouldn't happen, but when it does (test data, bugs, legacy data), the import fails:\n\n```\nfailed to handle rename bd-ce75 -\u003e bd-5a90: rename collision handling removed - should not occur with hash IDs\n```\n\n## Current Behavior\n\n1. Importer finds same content hash with different IDs\n2. Calls handleRename() (line 490)\n3. handleRename() errors out (line 294): \"rename collision handling removed\"\n4. Import fails\n\n## Expected Behavior\n\nSame content hash + different IDs should be treated as an **update**, not a rename:\n- Keep existing ID (already in database)\n- Update fields if incoming has newer timestamp\n- Discard incoming ID (it's wrong - hash should have generated same ID)\n\n## Impact\n\n- Import fails on legitimate edge cases (test data, data corruption)\n- Cryptic error message\n- Blocks sync operations\n\n## Fix\n\nIn handleRename() or import loop, instead of erroring:\n```go\n// Same content, different ID - treat as update\nif incoming.UpdatedAt.After(existing.UpdatedAt) {\n existing.Status = incoming.Status\n // ... copy other fields\n s.UpdateIssue(ctx, existing)\n}\nresult.Updated++\n```\n\n## Files\n- internal/importer/importer.go:271-294 (handleRename)\n- internal/importer/importer.go:482-500 (rename detection)\n\n## Repro\nImport JSONL with bd-ce75 and bd-5a90 (both \"Test parent issue\" but different content hashes).","status":"closed","issue_type":"bug","created_at":"2025-11-05T00:27:51.150233-08:00","updated_at":"2025-11-05T01:02:54.469971-08:00","closed_at":"2025-11-05T01:02:54.469979-08:00"} +{"id":"bd-6ku3","title":"Fix TestMigrateHashIDs test failure","description":"Test failure in cmd/bd/migrate_hash_ids_test.go:100 - New ID bd-09970281 for bd-1 is not a hash ID. This test is validating the hash ID migration but the generated ID doesn't match the expected format.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:52:58.114046-08:00","updated_at":"2025-11-06T19:04:58.804373-08:00","closed_at":"2025-11-06T19:04:58.804373-08:00"} +{"id":"bd-cbed9619.4","title":"Make DetectCollisions read-only (separate detection from modification)","description":"## Overview\nPhase 2: Separate collision detection from state modification to enable safe, composable collision resolution.\n\n## Current Problem\nDetectCollisions (collision.go:38-111) modifies database state during detection:\n- Line 83-86: Deletes issues when content matches but ID differs\n- This violates separation of concerns\n- Causes race conditions when processing multiple issues\n- Makes contentToDBIssue map stale after first deletion\n- Partial failures leave DB in inconsistent state\n\n## Solution\nMake DetectCollisions purely read-only. Move all modifications to a separate ApplyCollisionResolution function.\n\n## Implementation Tasks\n\n### 1. Add RenameDetail to CollisionResult\nFile: internal/storage/sqlite/collision.go\n```go\ntype CollisionResult struct {\n ExactMatches []string\n Collisions []*CollisionDetail\n NewIssues []string\n Renames []*RenameDetail // NEW\n}\n\ntype RenameDetail struct {\n OldID string // ID in database\n NewID string // ID in incoming\n Issue *types.Issue // The issue with new ID\n}\n```\n\n### 2. Remove deletion from DetectCollisions\nReplace lines 83-86:\n```go\n// OLD (DELETE THIS):\nif err := s.DeleteIssue(ctx, dbMatch.ID); err != nil {\n return nil, fmt.Errorf(\"failed to delete renamed issue...\")\n}\n\n// NEW (ADD THIS):\nresult.Renames = append(result.Renames, \u0026RenameDetail{\n OldID: dbMatch.ID,\n NewID: incoming.ID,\n Issue: incoming,\n})\ncontinue // Don't mark as NewIssue yet\n```\n\n### 3. Create ApplyCollisionResolution function\nNew function to apply all modifications atomically:\n```go\nfunc ApplyCollisionResolution(ctx context.Context, s *SQLiteStorage,\n result *CollisionResult, mapping map[string]string) error {\n \n // Phase 1: Handle renames (delete old IDs)\n for _, rename := range result.Renames {\n if err := s.DeleteIssue(ctx, rename.OldID); err != nil {\n return fmt.Errorf(\"failed to delete renamed issue %s: %w\", \n rename.OldID, err)\n }\n }\n \n // Phase 2: Create new IDs (from mapping)\n // Phase 3: Update references\n return nil\n}\n```\n\n### 4. Update callers to use two-phase approach\nFile: internal/importer/importer.go (handleCollisions)\n```go\n// Phase 1: Detect (read-only)\ncollisionResult, err := sqlite.DetectCollisions(ctx, sqliteStore, issues)\n\n// Phase 2: Resolve (compute mapping)\nmapping, err := sqlite.ResolveNWayCollisions(ctx, sqliteStore, collisionResult)\n\n// Phase 3: Apply (modify DB)\nerr = sqlite.ApplyCollisionResolution(ctx, sqliteStore, collisionResult, mapping)\n```\n\n### 5. Update tests\n- Verify DetectCollisions doesn't modify DB\n- Test ApplyCollisionResolution separately\n- Add test for rename detection without modification\n\n## Acceptance Criteria\n- DetectCollisions performs zero writes to database\n- DetectCollisions returns RenameDetail entries for content matches\n- ApplyCollisionResolution handles all modifications\n- All existing tests still pass\n- New test verifies read-only detection\n- contentToDBIssue map stays consistent throughout detection\n\n## Files to Modify\n- internal/storage/sqlite/collision.go (DetectCollisions, new function)\n- internal/importer/importer.go (handleCollisions caller)\n- internal/storage/sqlite/collision_test.go (add tests)\n\n## Testing\n- Unit test: DetectCollisions with content match doesn't delete DB issue\n- Unit test: RenameDetail correctly populated\n- Unit test: ApplyCollisionResolution applies renames\n- Integration test: Full flow still works end-to-end\n\n## Risk Mitigation\nThis is a significant refactor of core collision logic. Recommend:\n1. Add comprehensive tests before modifying\n2. Use feature flag to enable/disable new behavior\n3. Test thoroughly with TestTwoCloneCollision first","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:37:09.652326-07:00","updated_at":"2025-10-30T17:12:58.228266-07:00","closed_at":"2025-10-28T19:08:17.715416-07:00","dependencies":[{"issue_id":"bd-cbed9619.4","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.570276-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.4","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-28T18:39:28.285653-07:00","created_by":"daemon"}]} +{"id":"bd-au0.4","title":"Standardize priority flag parsing across all commands","description":"Accept both integer (0-4) and P0-P4 format in all commands.\n\n**Commands to update:**\n- bd create: Currently accepts both βœ“\n- bd update: Currently accepts both βœ“\n- bd list: Only accepts int\n- bd search: Add priority filter (missing entirely)\n\n**Implementation:**\n- Create shared priority parsing function\n- Support both formats: '0', '1', 'P0', 'P1', etc.\n- Case-insensitive ('p0', 'P0')\n\n**Files to modify:**\n- cmd/bd/list.go\n- cmd/bd/search.go\n- Add utility function in internal/util/ or internal/types/","notes":"Implementation complete!\n\nChanges made to cmd/bd/list.go:\n1. Added validation import\n2. Changed priority flag from IntP to registerPriorityFlag (line 428)\n3. Changed priority-min/max from Int to String (lines 459-460)\n4. Updated priority parsing to use ValidatePriority (lines 90-97, 230-237)\n5. Updated priority-min/max parsing to use ValidatePriority (lines 195-210)\n\nTesting verified:\nβœ“ bd list -p P0 works\nβœ“ bd list -p 0 works \nβœ“ bd list --priority-min P1 --priority-max P2 works\nβœ“ bd list --priority-min 1 --priority-max 2 works\nβœ“ Invalid priorities rejected with clear error messages\nβœ“ All tests pass\n\nBoth integer (0-4) and P-format (P0-P4) now work consistently across all priority flags in bd list.","status":"closed","issue_type":"task","created_at":"2025-11-21T21:06:51.741518-05:00","updated_at":"2025-11-21T21:56:50.522813-05:00","closed_at":"2025-11-21T21:56:50.522813-05:00","dependencies":[{"issue_id":"bd-au0.4","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:51.743218-05:00","created_by":"daemon"}]} +{"id":"bd-wgu4","title":"Standardize daemon detection: use tryDaemonLock probe before RPC","description":"Before attempting RPC connection, call tryDaemonLock() to check if lock is held:\n- If lock NOT held: skip RPC attempt (no daemon running)\n- If lock IS held: proceed with RPC + short timeout\n\nThis is extremely cheap and eliminates unnecessary connection attempts.\n\nApply across all client entry points that probe for daemon.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T16:42:12.709802-08:00","updated_at":"2025-11-07T20:15:23.282181-08:00","closed_at":"2025-11-07T20:15:23.282181-08:00","dependencies":[{"issue_id":"bd-wgu4","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.710564-08:00","created_by":"daemon"}]} +{"id":"bd-ndyz","title":"GH#243: Recurring stale daemon.lock causes 5s delays","description":"User reports daemon.lock keeps becoming stale after running Claude with beads.\n\nSymptom:\n- bd ready takes 5 seconds (exact)\n- daemon.lock exists but socket is missing\n- bd daemons killall temporarily fixes it\n- Problem recurs after using beads with AI agents\n\nUser on v0.22.0, Macbook M2, 132 issues (89 closed)\n\nHypothesis: Daemon is crashing or exiting uncleanly during agent sessions, leaving stale lock file.\n\nNeed to:\n1. Add crash logging to daemon to understand why it's exiting\n2. Improve cleanup on daemon exit (ensure lock is always removed)\n3. Add automatic stale lock detection/cleanup\n4. Consider making daemon more resilient to crashes","notes":"Oracle analysis complete. Converting to epic with 5 focused sub-issues:\n1. RPC fast-fail with socket stat + short timeouts (P0)\n2. Standardize daemon detection with lock probe (P1) \n3. Crash recovery improvements (P2)\n4. Self-heal stale artifacts (P2)\n5. Diagnostics and debugging (P3)","status":"closed","issue_type":"bug","created_at":"2025-11-07T16:32:23.576171-08:00","updated_at":"2025-11-07T22:07:17.347419-08:00","closed_at":"2025-11-07T21:29:56.009737-08:00"} +{"id":"bd-u4f5","title":"bd import silently succeeds when database matches working tree but not git HEAD","description":"**Critical**: bd import reports '0 created, 0 updated' when database matches working tree JSONL, even when working tree is ahead of git HEAD. This gives false confidence that everything is synced with the source of truth.\n\n## Reproduction\n\n1. Start with database synced to working tree .beads/issues.jsonl (376 issues)\n2. Git HEAD has older version of .beads/issues.jsonl (354 issues)\n3. Run: bd import .beads/issues.jsonl\n4. Output: 'Import complete: 0 created, 0 updated'\n\n## Problem\n\nUser expects 'bd import' after 'git pull' to sync database with committed state, but:\n- Command silently succeeds because DB already matches working tree\n- No warning that working tree has uncommitted changes\n- User falsely believes everything is synced with git\n- Violates 'JSONL in git is source of truth' principle\n\n## Expected Behavior\n\nWhen .beads/issues.jsonl differs from git HEAD, bd import should:\n1. Detect uncommitted changes: git diff --quiet HEAD .beads/issues.jsonl\n2. Warn user: 'Warning: .beads/issues.jsonl has uncommitted changes (376 lines vs 354 in HEAD)'\n3. Clarify status: 'Import complete: 0 created, 0 updated (already synced with working tree)'\n4. Recommend: 'Run git diff .beads/issues.jsonl to review uncommitted work'\n\n## Impact\n\n- Users can't trust 'bd import' status messages\n- Silent data loss risk if user assumes synced and runs git checkout\n- Breaks mental model of 'JSONL in git = source of truth'\n- Critical for VC's landing-the-plane workflow","status":"closed","issue_type":"bug","created_at":"2025-11-07T23:51:28.536822-08:00","updated_at":"2025-11-07T23:58:34.482313-08:00","closed_at":"2025-11-07T23:58:34.482313-08:00"} +{"id":"bd-f8b764c9.6","title":"Implement alias conflict resolution","description":"Handle alias conflicts when multiple clones assign same alias to different issues.\n\n## Scenario\n```\nClone A: Creates bd-a1b2c3d4, assigns alias #42\nClone B: Creates bd-e5f6a7b8, assigns alias #42\nAfter sync: Conflict! Which issue gets #42?\n```\n\n## Resolution Strategy: Content-Hash Ordering\nDeterministic, same result on all clones:\n```go\nfunc ResolveAliasConflicts(conflicts []AliasConflict) []AliasRemapping {\n for _, conflict := range conflicts {\n // Sort by hash ID (lexicographic)\n sort.Strings(conflict.IssueIDs)\n \n // Winner: lowest hash ID (arbitrary but deterministic)\n winner := conflict.IssueIDs[0]\n \n // Losers: reassign to next available aliases\n for _, loser := range conflict.IssueIDs[1:] {\n newAlias := getNextAlias()\n remappings = append(remappings, AliasRemapping{\n IssueID: loser,\n OldAlias: conflict.Alias,\n NewAlias: newAlias,\n })\n }\n }\n return remappings\n}\n```\n\n## Detection During Import\nFile: internal/importer/importer.go\n```go\nfunc handleAliasConflicts(imported []Issue, existing []Issue) error {\n // Build alias map from imported issues\n aliasMap := make(map[int][]string) // alias β†’ issue IDs\n \n for _, issue := range imported {\n aliasMap[issue.Alias] = append(aliasMap[issue.Alias], issue.ID)\n }\n \n // Check against existing aliases\n for alias, importedIDs := range aliasMap {\n existingID := storage.GetIssueIDByAlias(alias)\n if existingID != \"\" {\n // Conflict! Resolve it\n allIDs := append(importedIDs, existingID)\n conflicts = append(conflicts, AliasConflict{\n Alias: alias,\n IssueIDs: allIDs,\n })\n }\n }\n \n // Resolve and apply\n remappings := ResolveAliasConflicts(conflicts)\n applyAliasRemappings(remappings)\n}\n```\n\n## Alternative Strategies (For Future Consideration)\n\n### Priority-Based\n```go\n// Higher priority keeps alias\nif issueA.Priority \u003c issueB.Priority {\n winner = issueA\n}\n```\n\n### Timestamp-Based (Last-Write-Wins)\n```go\n// Newer issue keeps alias\nif issueA.UpdatedAt.After(issueB.UpdatedAt) {\n winner = issueA\n}\n```\n\n### Manual Resolution\n```bash\nbd resolve-aliases --manual\n# Interactive prompt for each conflict\n```\n\n## User Notification\n```bash\n$ bd sync\nβœ“ Synced 5 issues\n⚠ Alias conflicts resolved:\n - Issue bd-e5f6a7b8: alias changed from #42 to #100\n - Issue bd-9a8b7c6d: alias changed from #15 to #101\n```\n\n## Files to Create/Modify\n- internal/storage/sqlite/alias_conflicts.go (new)\n- internal/importer/importer.go (detect conflicts)\n- cmd/bd/sync.go (show conflict notifications)\n\n## Testing\n- Test two clones assign same alias to different issues\n- Test conflict resolution is deterministic (same on all clones)\n- Test loser gets new alias\n- Test winner keeps original alias\n- Test multiple conflicts resolved in one import","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:25:27.389191-07:00","updated_at":"2025-10-31T12:32:32.609245-07:00","closed_at":"2025-10-31T12:32:32.609245-07:00","dependencies":[{"issue_id":"bd-f8b764c9.6","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:25:27.390611-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.6","depends_on_id":"bd-f8b764c9.10","type":"blocks","created_at":"2025-10-29T21:25:27.391127-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.6","depends_on_id":"bd-f8b764c9.8","type":"blocks","created_at":"2025-10-29T21:25:27.39154-07:00","created_by":"stevey"}]} +{"id":"bd-4cyb","title":"Test graceful degradation when server unavailable","description":"Verify that agents continue working normally when Agent Mail server is stopped or unreachable.\n\nAcceptance Criteria:\n- Agent detects server unavailable on startup\n- Logs \"falling back to Beads-only mode\"\n- All bd commands work normally\n- Agent can claim issues (no reservations, like today)\n- Git sync operates as normal\n- No errors or crashes\n\nSuccess Metric: Zero functional difference when Agent Mail unavailable","status":"closed","issue_type":"task","created_at":"2025-11-07T22:42:00.094481-08:00","updated_at":"2025-11-08T00:20:29.841174-08:00","closed_at":"2025-11-08T00:20:29.841174-08:00","dependencies":[{"issue_id":"bd-4cyb","depends_on_id":"bd-6hji","type":"blocks","created_at":"2025-11-07T23:03:53.054449-08:00","created_by":"daemon"}]} +{"id":"bd-qhws","title":"Configure database connection pool limits for daemon mode","description":"Database connection pool not configured for file-based databases when running in daemon mode.\n\nLocation: internal/storage/sqlite/sqlite.go:108-116\n\nProblem:\n- Daemon is a long-running server handling concurrent RPC requests\n- Multiple CLI commands hit same daemon simultaneously \n- Go default: unlimited connections (MaxOpenConns=0)\n- SQLite IMMEDIATE transactions serialize on write lock\n- Can have 100+ goroutines blocked waiting, each holding connection\n- Results in connection exhaustion and 'database is locked' errors\n\nCurrent code only limits in-memory DBs:\nif isInMemory {\n db.SetMaxOpenConns(1)\n db.SetMaxIdleConns(1)\n}\n// File DBs: UNLIMITED connections!\n\nFix:\nif !isInMemory {\n maxConns := runtime.NumCPU() + 1 // 1 writer + N readers\n db.SetMaxOpenConns(maxConns)\n db.SetMaxIdleConns(2)\n db.SetConnMaxLifetime(0)\n}\n\nImpact: 'database is locked' errors under concurrent load in daemon mode\n\nNote: NOT an issue for direct CLI usage (each process isolated). Only affects daemon mode where multiple CLI commands share one database pool.\n\nEffort: 1 hour","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:51:24.579345-08:00","updated_at":"2025-11-16T15:04:00.450911-08:00","closed_at":"2025-11-16T15:04:00.450911-08:00"} +{"id":"bd-gqo","title":"Implement health checks in daemon event loop","description":"Add health checks to checkDaemonHealth() function in daemon_event_loop.go:170:\n- Database integrity check\n- Disk space check\n- Memory usage check\n\nCurrently it's just a no-op placeholder.","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-21T18:55:07.534304-05:00","updated_at":"2025-11-21T18:55:07.534304-05:00"} +{"id":"bd-b47c034e","title":"Address gosec security warnings (102 issues)","description":"Security linter warnings: file permissions (0755 should be 0750), G304 file inclusion via variable, G204 subprocess launches. Many are false positives but should be reviewed.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-25T13:47:10.719134-07:00","updated_at":"2025-11-04T11:10:23.533333-08:00","closed_at":"2025-11-04T11:10:23.533338-08:00"} +{"id":"bd-q59i","title":"User Diagnostics (bd doctor --perf)","description":"Extend cmd/bd/doctor.go to add --perf flag for user performance diagnostics.\n\nFunctionality:\n- Add --perf flag to existing bd doctor command\n- Collect system info (OS, arch, Go version, SQLite version)\n- Collect database stats (size, issue counts, dependency counts)\n- Time key operations on user's actual database:\n * bd ready\n * bd list --status=open\n * bd show \u003crandom-issue\u003e\n * bd create (with rollback)\n * Search with filters\n- Generate CPU profile automatically (timestamped filename)\n- Output simple report with platform info, timings, profile location\n\nOutput example:\n Beads Performance Diagnostics\n Platform: darwin/arm64\n Database: 8,234 issues (4,123 open)\n \n Operation Performance:\n bd ready 42ms\n bd list --status=open 15ms\n \n Profile saved: beads-perf-2025-11-13.prof\n View: go tool pprof -http=:8080 beads-perf-2025-11-13.prof\n\nImplementation:\n- Extend cmd/bd/doctor.go (~100 lines)\n- Use runtime/pprof for CPU profiling\n- Use time.Now()/time.Since() for timing\n- Rollback test operations (don't modify user's database)","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:23:11.988562-08:00","updated_at":"2025-11-13T22:45:57.26294-08:00","closed_at":"2025-11-13T22:45:57.26294-08:00","dependencies":[{"issue_id":"bd-q59i","depends_on_id":"bd-zj8e","type":"blocks","created_at":"2025-11-13T22:24:06.336236-08:00","created_by":"daemon"}]} +{"id":"bd-auf1","title":"Clean up snapshot files after successful merge","description":"After a successful 3-way merge and import during 'bd sync', the snapshot files (beads.base.jsonl, beads.left.jsonl, and their .meta.json files) are left in the .beads/ directory indefinitely.\n\nThese files are only needed temporarily during the merge process:\n- beads.base.jsonl: snapshot from last successful import\n- beads.left.jsonl: snapshot before git pull\n\nOnce the merge succeeds and the new JSONL is imported, these files serve no purpose and should be cleaned up.\n\nCurrent behavior:\n- sync.go:269 calls updateBaseSnapshot() after successful import\n- UpdateBase() updates beads.base.jsonl to the new state\n- beads.left.jsonl is never removed\n- Both files accumulate in .beads/ directory\n\nExpected behavior:\n- After successful merge and import, clean up both snapshot files\n- Only retain snapshots between sync operations (create on export, use during merge, clean up after import)\n\nThe cleanup logic exists (SnapshotManager.Cleanup()) but is only called on validation failures (deletion_tracking.go:48), not on success.\n\nDiscovered in vc project where stale snapshot files from Nov 8 merge were still present.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-08T22:39:56.460778-08:00","updated_at":"2025-11-23T14:14:13.332096-08:00","closed_at":"2025-11-08T22:47:51.96296-08:00"} +{"id":"bd-5314bddf","title":"bd detect-pollution - Test pollution detector","description":"Detect test issues that leaked into production DB.\n\nPattern matching for:\n- Titles starting with 'test', 'benchmark', 'sample'\n- Sequential numbering (test-1, test-2)\n- Generic descriptions\n- Created in rapid succession\n\nOptional AI scoring for confidence.\n\nFiles: cmd/bd/detect_pollution.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T14:48:17.466906-07:00","updated_at":"2025-11-06T19:36:13.970321-08:00","closed_at":"2025-11-06T19:27:11.75884-08:00"} +{"id":"bd-9csf","title":"Create store.go with Store struct and initialization logic","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:12.295554-08:00","updated_at":"2025-11-23T18:09:47.893126-08:00","closed_at":"2025-11-23T18:09:47.893126-08:00"} +{"id":"bd-64z4","title":"Assigned issue","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:04:24.201309-08:00","updated_at":"2025-11-07T22:07:17.344151-08:00","closed_at":"2025-11-07T21:55:09.427387-08:00"} +{"id":"bd-2q6d","title":"Beads commands operate on stale database without warning","description":"All beads read operations should validate database is in sync with JSONL before proceeding.\n\n**Current Behavior:**\n- Commands can query/read from stale database\n- Only mutation operations (like 'bd sync') check if JSONL is newer\n- User gets incorrect results without realizing database is out of sync\n\n**Expected Behavior:**\n- All beads commands should have pre-flight check for database freshness\n- If JSONL is newer than database, refuse to operate with error: \"Database out of sync. Run 'bd import' first.\"\n- Same safety check that exists for 'bd sync' should apply to ALL operations\n\n**Impact:**\n- Users make decisions based on incomplete/outdated data\n- Silent failures lead to confusion (e.g., thinking issues don't exist when they do)\n- Similar to running git commands on stale repo without being warned to pull\n\n**Example:**\n- Searched for bd-g9eu issue file: not found\n- Issue exists in .beads/issues.jsonl (in git)\n- Database was stale, but no warning was given\n- Led to incorrect conclusion that issue was already closed/deleted","notes":"## Implementation Complete\n\n**Phase 1: Created staleness check (cmd/bd/staleness.go)**\n- ensureDatabaseFresh() function checks JSONL mtime vs last_import_time\n- Returns error with helpful message when database is stale\n- Auto-skips in daemon mode (daemon has auto-import)\n\n**Phase 2: Added to all read commands**\n- list, show, ready, status, stale, info, duplicates, validate\n- Check runs before database queries in direct mode\n- Daemon mode already protected via checkAndAutoImportIfStale()\n\n**Phase 3: Code Review Findings**\nSee follow-up issues:\n- bd-XXXX: Add warning when staleness check errors\n- bd-YYYY: Improve CheckStaleness error handling\n- bd-ZZZZ: Refactor redundant daemon checks (low priority)\n\n**Testing:**\n- Build successful: go build ./cmd/bd\n- Binary works: ./bd --version\n- Ready for manual testing\n\n**Next Steps:**\n1. Test with stale database scenario\n2. Implement review improvements\n3. Close issue when tests pass","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-20T19:33:40.019297-05:00","updated_at":"2025-11-23T18:06:29.864617-08:00"} +{"id":"bd-4oob","title":"bd-hv01: Multi-repo mode not tested with deletion tracking","description":"Problem: Test suite has no coverage for multi-repo mode. ExportToMultiRepo creates multiple JSONL files but snapshot files are hardcoded to single JSONL location.\n\nImpact: Deletion tracking likely silently broken for multi-repo users, could cause data loss.\n\nFix: Add test and update snapshot logic to handle multiple JSONL files.\n\nFiles: cmd/bd/deletion_tracking_test.go, cmd/bd/deletion_tracking.go, cmd/bd/daemon_sync.go:24-34","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-06T18:16:22.965404-08:00","updated_at":"2025-11-06T19:36:13.96995-08:00","closed_at":"2025-11-06T19:20:50.382822-08:00","dependencies":[{"issue_id":"bd-4oob","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.014196-08:00","created_by":"daemon"}]} +{"id":"bd-cc4f","title":"Implement TryResurrectParent function","description":"Create internal/storage/sqlite/resurrection.go with TryResurrectParent(ctx, parentID) function. Parse JSONL history to find deleted parent, create tombstone with status=deleted and is_tombstone=true flag. Handle recursive resurrection for multi-level missing parents (bd-abc.1.2 with missing bd-abc and bd-abc.1).","status":"closed","issue_type":"task","created_at":"2025-11-04T12:31:59.61107-08:00","updated_at":"2025-11-05T00:08:42.813998-08:00","closed_at":"2025-11-05T00:08:42.814-08:00"} +{"id":"bd-ar2.1","title":"Extract duplicated metadata update code in daemon_sync.go","description":"## Problem\nThe same 22-line metadata update block appears identically in both:\n- createExportFunc (lines 309-328)\n- createSyncFunc (lines 520-539)\n\nThis violates DRY principle and makes maintenance harder.\n\n## Solution\nExtract to helper function:\n\n```go\n// updateExportMetadata updates last_import_hash and related metadata after a successful export.\n// This prevents \"JSONL content has changed since last import\" errors on subsequent exports (bd-ymj fix).\nfunc updateExportMetadata(ctx context.Context, store storage.Storage, jsonlPath string, log daemonLogger) {\n currentHash, err := computeJSONLHash(jsonlPath)\n if err != nil {\n log.log(\"Warning: failed to compute JSONL hash for metadata update: %v\", err)\n return\n }\n \n if err := store.SetMetadata(ctx, \"last_import_hash\", currentHash); err != nil {\n log.log(\"Warning: failed to update last_import_hash: %v\", err)\n }\n \n exportTime := time.Now().Format(time.RFC3339)\n if err := store.SetMetadata(ctx, \"last_import_time\", exportTime); err != nil {\n log.log(\"Warning: failed to update last_import_time: %v\", err)\n }\n \n // Store mtime for fast-path optimization\n if jsonlInfo, statErr := os.Stat(jsonlPath); statErr == nil {\n mtimeStr := fmt.Sprintf(\"%d\", jsonlInfo.ModTime().Unix())\n if err := store.SetMetadata(ctx, \"last_import_mtime\", mtimeStr); err != nil {\n log.log(\"Warning: failed to update last_import_mtime: %v\", err)\n }\n }\n}\n```\n\n## Files\n- cmd/bd/daemon_sync.go\n\n## Benefits\n- Easier maintenance\n- Single source of truth\n- Consistent behavior","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:24:18.888412-05:00","updated_at":"2025-11-21T19:15:00.119796-05:00","closed_at":"2025-11-21T11:07:09.645017-05:00","dependencies":[{"issue_id":"bd-ar2.1","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:24:18.889171-05:00","created_by":"daemon"}]} +{"id":"bd-mnap","title":"Investigate performance issues in VS Code Copilot (Windows)","description":"Beads unusable in Windows 11 VS Code Copilot chat with Sonnet 4.5.\nSummary event happens every 3-4 turns, taking 3 minutes.\nCopilot summarizes after ~125k tokens despite model supporting 1M.\nLarge context size of beads might be triggering aggressive summarization.\nNeed workaround or optimization for context size.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:56:30.124918-05:00","updated_at":"2025-11-20T18:56:30.124918-05:00"} +{"id":"bd-0a43","title":"Split monolithic sqlite.go into focused files","description":"internal/storage/sqlite/sqlite.go is 1050 lines containing initialization, 20+ CRUD methods, query building, and schema management.\n\nSplit into:\n- store.go: Store struct \u0026 initialization (150 lines)\n- bead_queries.go: Bead CRUD (300 lines)\n- work_queries.go: Work queries (200 lines) \n- stats_queries.go: Statistics (150 lines)\n- schema.go: Schema \u0026 migrations (150 lines)\n- helpers.go: Common utilities (100 lines)\n\nImpact: Impossible to understand at a glance; hard to find specific functionality; high cognitive load\n\nEffort: 6-8 hours","status":"closed","issue_type":"task","created_at":"2025-11-16T14:51:16.520465-08:00","updated_at":"2025-11-23T18:28:07.303279-08:00","closed_at":"2025-11-23T18:15:24.333304-08:00"} +{"id":"bd-9f4a","title":"Document external_ref in content hash behavior","description":"The content hash includes external_ref, which has implications that should be documented.\n\nCurrent behavior:\n- external_ref is included in content hash calculation (collision.go:158-160)\n- Changing external_ref changes content hash\n- This means: local issue β†’ add external_ref β†’ different hash\n\nImplications:\n- Local issue + external_ref addition = looks like 'new content'\n- May not match by content hash in some scenarios\n- Generally correct behavior, but subtle\n\nAction items:\n- Document in code comments\n- Add to ARCHITECTURE.md or similar\n- Add test demonstrating this behavior\n- Consider if this is desired long-term\n\nRelated: bd-1022\nFiles: internal/storage/sqlite/collision.go:158-160","status":"closed","priority":4,"issue_type":"task","created_at":"2025-11-02T15:32:47.715458-08:00","updated_at":"2025-11-08T02:24:24.685778-08:00","closed_at":"2025-11-08T02:20:01.004638-08:00"} +{"id":"bd-iou5","title":"Detect and warn about outdated git hooks","description":"Users may have outdated git hooks installed that reference removed flags (e.g., --resolve-collisions). bd should detect this and warn users to reinstall.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-06T13:59:45.778781-08:00","updated_at":"2025-11-06T15:02:16.928192-08:00","closed_at":"2025-11-06T15:02:16.928192-08:00"} +{"id":"bd-ky74","title":"Optimize cmd/bd long-mode tests by switching to in-process testing","description":"The long-mode CLI tests in cmd/bd are slow (1.4-4.4 seconds each) because they spawn full bd processes via exec.Command() for every operation.\n\nCurrent approach:\n- Each runBD() call spawns new bd process via exec.Command(testBD, args...)\n- Each process initializes Go runtime, loads SQLite, parses CLI flags\n- Tests run serially (create β†’ update β†’ show β†’ close)\n- Even with --no-daemon flag, there's significant process spawn overhead\n\nExample timing from test run:\n- TestCLI_PriorityFormats: 2.21s\n- TestCLI_Show: 2.26s\n- TestCLI_Ready: 2.29s\n- TestCLI_Import: 4.42s\n\nOptimization strategy:\n1. Convert most tests to in-process testing (call bd functions directly)\n2. Reuse test databases across related operations instead of fresh init each time\n3. Keep a few exec.Command() tests that batch multiple operations to verify the CLI path works end-to-end\n\nThis should reduce test time from ~40s to ~5s for the affected tests.","notes":"Converted all CLI tests in cli_fast_test.go to use in-process testing via rootCmd.Execute(). Created runBDInProcess() helper that:\n- Calls rootCmd.Execute() directly instead of spawning processes\n- Uses mutex to serialize execution (rootCmd/viper not thread-safe)\n- Properly cleans up global state (store, daemonClient)\n- Returns only stdout to avoid JSON parsing issues with stderr warnings\n\nPerformance results:\n- In-process tests: ~0.6s each (cached even faster)\n- exec.Command tests: ~3.7s each \n- Speedup: ~10x faster\n\nKept TestCLI_EndToEnd() that uses exec.Command for end-to-end validation of the actual binary.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T18:40:27.358821-08:00","updated_at":"2025-11-08T18:47:11.107998-08:00","closed_at":"2025-11-08T18:47:11.107998-08:00"} +{"id":"bd-fb95094c.2","title":"Delete skipped tests for \"old buggy behavior\"","description":"Three test functions are permanently skipped with comments indicating they test behavior that was fixed in GH#120. These tests will never run again and should be deleted.\n\nTest functions to remove:\n\n1. `cmd/bd/import_collision_test.go:228`\n ```go\n t.Skip(\"Test expects old buggy behavior - needs rewrite for GH#120 fix\")\n ```\n\n2. `cmd/bd/import_collision_test.go:505`\n ```go\n t.Skip(\"Test expects old buggy behavior - needs rewrite for GH#120 fix\")\n ```\n\n3. `internal/storage/sqlite/collision_test.go:919`\n ```go\n t.Skip(\"Test expects old buggy behavior - needs rewrite for GH#120 fix\")\n ```\n\nImpact: Removes ~150 LOC of permanently skipped tests","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T20:30:19.961185-07:00","updated_at":"2025-10-30T17:12:58.196387-07:00","closed_at":"2025-10-28T14:09:21.642632-07:00","dependencies":[{"issue_id":"bd-fb95094c.2","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:30:19.962815-07:00","created_by":"daemon"}]} +{"id":"bd-nqes","title":"bd-hv01: Non-atomic snapshot operations can cause data loss","description":"## Problem\nIn sync.go:146-155 and daemon_sync.go:502-505, snapshot capture failures are logged as warnings but sync continues:\n\n```go\nif err := exportToJSONL(ctx, jsonlPath); err != nil { ... }\nif err := captureLeftSnapshot(jsonlPath); err != nil {\n fmt.Fprintf(os.Stderr, \"Warning: failed to capture snapshot...\")\n}\n```\n\nIf export succeeds but snapshot capture fails, the merge uses stale snapshot data, potentially deleting wrong issues.\n\n## Impact\n- Critical data integrity issue\n- Could delete issues incorrectly during multi-workspace sync\n\n## Fix\nMake snapshot capture mandatory:\n```go\nif err := captureLeftSnapshot(jsonlPath); err != nil {\n return fmt.Errorf(\"failed to capture snapshot (required for deletion tracking): %w\", err)\n}\n```\n\n## Files Affected\n- cmd/bd/sync.go:146-155\n- cmd/bd/daemon_sync.go:502-505","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:15:33.574158-08:00","updated_at":"2025-11-06T18:46:55.874814-08:00","closed_at":"2025-11-06T18:46:55.874814-08:00","dependencies":[{"issue_id":"bd-nqes","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.749153-08:00","created_by":"daemon"}]} +{"id":"bd-q652","title":"Database pollution in ~/src/dave/vc: 895 issues vs canonical 310","description":"~/src/dave/vc/.beads/beads.db has 895 total issues (675 open, 149 closed), but canonical ~/src/vc/.beads/vc.db has only 310 issues (230 open). This is 585 extra issues - likely pollution from other repositories.\n\nNeed to:\n1. Identify which issues are polluted (use detect-pollution)\n2. Compare issue IDs between dave/vc and canonical vc databases\n3. Determine pollution source (beads repo? other repos?)\n4. Clean up polluted database\n5. Root cause: why did pollution occur?","notes":"Investigation findings so far:\n- Polluted DB (~/src/dave/vc/.beads/beads.db): 241 issues (180 open, 43 closed)\n- Canonical DB (~/src/vc/.beads/vc.db): 310 issues (230 open, 62 closed)\n- Contradiction: Polluted has FEWER issues, not more (241 \u003c 310, diff of 69)\n- Only 1 unique ID in polluted: vc-55fi\n- All source_repo fields are set to \".\" in both databases\n- Issue description claims 895 issues in polluted vs 310 canonical - numbers don't match current state\n- Possible: Pollution was already partially cleaned, or issue description refers to different database?","status":"closed","issue_type":"bug","created_at":"2025-11-07T00:07:37.999168-08:00","updated_at":"2025-11-07T00:13:32.179396-08:00","closed_at":"2025-11-07T00:13:32.179396-08:00"} +{"id":"bd-epvx","title":"Create Go adapter library (optional)","description":"For agents written in Go, provide native adapter library instead of shelling out to curl.\n\nAcceptance Criteria:\n- agentmail.Client struct\n- HTTP client with timeout/retry logic\n- Same API as Python adapter\n- Example usage in examples/go-agent/\n- Unit tests\n\nFile: pkg/agentmail/client.go\n\nNote: Lower priority - can shell out to curl initially","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-11-07T22:42:28.781577-08:00","updated_at":"2025-11-08T15:58:37.146674-08:00","closed_at":"2025-11-08T15:48:57.83973-08:00","dependencies":[{"issue_id":"bd-epvx","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T23:04:01.47471-08:00","created_by":"daemon"}]} +{"id":"bd-5b6e","title":"Add tests for helper functions (GetDirtyIssueHash, GetAllDependencyRecords, export hashes)","description":"Several utility functions have 0% coverage:\n- GetDirtyIssueHash (dirty.go)\n- GetAllDependencyRecords (dependencies.go)\n- GetExportHash, SetExportHash, ClearAllExportHashes (hash.go)\n\nThese are lower priority but should have basic coverage.","status":"open","priority":4,"issue_type":"task","created_at":"2025-11-01T22:40:58.989976-07:00","updated_at":"2025-11-01T22:40:58.989976-07:00"} +{"id":"bd-o43","title":"Add richer query capabilities to bd list","description":"Current bd list filters are limited to basic field matching (status, priority, type, assignee, label). This forces users to resort to piping through jq for common queries.\n\nMissing query capabilities:\n- Pattern matching: --title-contains, --desc-contains\n- Date ranges: --created-after, --updated-before, --closed-after\n- Empty/null checks: --empty-description, --no-assignee, --no-labels\n- Numeric ranges: --priority-min, --priority-max\n- Complex boolean logic: --and, --or operators\n- Full-text search: --search across all text fields\n- Negation: --not-status, --exclude-label\n\nExample use cases:\n- Find issues with empty descriptions\n- Find stale issues not updated in 30 days\n- Find high-priority bugs with no assignee\n- Search for keyword across title/description/notes\n\nImplementation approach:\n- Add query builder pattern to storage layer\n- Support --query DSL for complex queries\n- Keep simple flags for common cases\n- Add --json output for programmatic use","notes":"## Progress Update\n\n**Completed:**\n- βœ… Extended IssueFilter struct with new fields (pattern matching, date ranges, empty/null checks, priority ranges)\n- βœ… Updated SQLite SearchIssues implementation \n- βœ… Added CLI flags to list.go\n- βœ… Added parseTimeFlag helper\n- βœ… Comprehensive tests added - all passing\n\n**Remaining:**\n- ⚠️ RPC layer needs updating (internal/rpc/protocol.go ListArgs)\n- ⚠️ Daemon handler needs to forward new filters\n- ⚠️ End-to-end testing with daemon mode\n- πŸ“ Documentation updates\n\n**Files Modified:**\n- internal/types/types.go\n- internal/storage/sqlite/sqlite.go \n- cmd/bd/list.go\n- cmd/bd/list_test.go\n\n**Next Steps:**\n1. Update RPC protocol\n2. Update daemon handler \n3. Test with daemon mode\n4. Update docs","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-05T00:17:48.677493-08:00","updated_at":"2025-11-05T00:33:38.998433-08:00","closed_at":"2025-11-05T00:33:38.998433-08:00"} +{"id":"bd-tbz3","title":"bd init UX Improvements","description":"bd init leaves users with incomplete setup, requiring manual bd doctor --fix. Issues found: (1) git hooks not installed if user declines prompt, (2) no auto-migration when CLI is upgraded, (3) stale merge driver configs from old versions. Fix by making bd init more robust with better defaults and auto-migration.","status":"open","priority":1,"issue_type":"epic","created_at":"2025-11-21T23:16:00.333543-08:00","updated_at":"2025-11-21T23:16:37.811233-08:00"} +{"id":"bd-bc2c6191","title":"Audit Current Cache Usage","description":"Understand exactly what code depends on the storage cache","notes":"Audit complete. See CACHE_AUDIT.md for full findings.\n\nSummary:\n- Cache was already removed in commit 322ab63 (2025-10-28)\n- server_cache_storage.go deleted (~286 lines)\n- All getStorageForRequest calls replaced with s.storage\n- All environment variables removed\n- MCP multi-repo works via per-project daemon architecture\n- All tests updated and passing\n- Only stale comment in server.go needed fixing","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T23:02:43.506373-07:00","updated_at":"2025-11-06T20:06:49.218998-08:00","closed_at":"2025-11-06T19:48:30.520616-08:00"} +{"id":"bd-p65x","title":"Latency test 1","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T12:09:09.267424-05:00","updated_at":"2025-11-20T12:09:09.267424-05:00","closed_at":"2025-11-08T00:06:46.198388-08:00"} +{"id":"bd-zi1v","title":"Test Agent Mail server failure scenarios","description":"Verify graceful degradation across various failure modes.\n\nTest Cases:\n- Server never started\n- Server crashes during operation\n- Network partition (timeout)\n- Server returns 500 error\n- Invalid bearer token\n- SQLite corruption\n\nAcceptance Criteria:\n- Agents continue working in all scenarios\n- Clear log messages about degradation\n- No crashes or data loss\n- Beads JSONL remains consistent\n\nFile: tests/integration/test_mail_failures.py","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:43:21.41983-08:00","updated_at":"2025-11-08T01:49:13.742653-08:00","closed_at":"2025-11-08T01:49:13.742653-08:00","dependencies":[{"issue_id":"bd-zi1v","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:43:21.420725-08:00","created_by":"daemon"}]} +{"id":"bd-9e8d","title":"Test Issue","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T21:41:11.107393-07:00","updated_at":"2025-11-01T20:02:28.292279-07:00","closed_at":"2025-11-01T20:02:28.292279-07:00"} +{"id":"bd-5f26","title":"Refactor daemon.go into internal/daemonrunner","description":"Extract daemon runtime from daemon.go (1,565 lines) into internal/daemonrunner with focused modules: config.go, daemon.go, process.go, rpc_server.go, sync.go, git.go. Keep cobra command thin.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-01T11:41:14.821017-07:00","updated_at":"2025-11-01T21:44:44.507747-07:00","closed_at":"2025-11-01T21:44:44.507747-07:00"} +{"id":"bd-au0.6","title":"Add comprehensive filters to bd export","description":"Enhance bd export with filtering options for selective exports.\n\n**Currently only has:**\n- --status\n\n**Add filters:**\n- --label, --label-any\n- --assignee\n- --type\n- --priority, --priority-min, --priority-max\n- --created-after, --created-before\n- --updated-after, --updated-before\n\n**Use case:**\n- Export only open issues: bd export --status open\n- Export high-priority bugs: bd export --type bug --priority-max 1\n- Export recent issues: bd export --created-after 2025-01-01\n\n**Files to modify:**\n- cmd/bd/export.go\n- Reuse filter logic from list.go","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T21:07:19.431307-05:00","updated_at":"2025-11-21T21:07:19.431307-05:00","dependencies":[{"issue_id":"bd-au0.6","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:19.432983-05:00","created_by":"daemon"}]} +{"id":"bd-a9699011","title":"GH#146: No color showing in terminal for some users","description":"User reports color not working in macOS (Taho 26.0.1) with iTerm 3.6.4 and Terminal.app, despite color working elsewhere in terminal. Python rich and printf escape codes work.\n\nNeed to investigate:\n- Is NO_COLOR env var set?\n- Terminal type detection?\n- fatih/color library configuration\n- Does bd list show colors? bd ready? bd init?\n- What's the output of: echo $TERM, echo $NO_COLOR","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-24T22:26:36.22163-07:00","updated_at":"2025-11-08T01:58:15.282138-08:00","closed_at":"2025-11-08T00:54:40.47956-08:00"} +{"id":"bd-8ift","title":"Debug test","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-08T00:04:35.254385-08:00","updated_at":"2025-11-08T00:06:46.179396-08:00","closed_at":"2025-11-08T00:06:46.179396-08:00"} +{"id":"bd-ry1u","title":"Publish official devcontainer configuration","notes":"Devcontainer configuration implemented. Manual testing required in actual devcontainer environment (Codespaces or VSCode Remote Containers). All code changes complete, tests pass, linting clean.","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-05T15:02:21.783666-08:00","updated_at":"2025-11-05T17:46:42.70998-08:00","closed_at":"2025-11-05T17:46:42.70998-08:00"} +{"id":"bd-loka.2","title":"Add version tracking in PersistentPreRun","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:28.680947-08:00","updated_at":"2025-11-23T16:58:25.180851-08:00","closed_at":"2025-11-23T16:58:25.180851-08:00","dependencies":[{"issue_id":"bd-loka.2","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:28.681524-08:00","created_by":"daemon"}]} +{"id":"bd-3bg","title":"Add performance optimization to hasJSONLChanged with mtime fast-path","description":"hasJSONLChanged() reads entire JSONL file to compute SHA256 hash on every check. For large databases (50MB+), this is expensive and called frequently by daemon.\n\nOptimization: Check mtime first as fast-path. Only compute hash if mtime changed. This catches git operations (mtime changes but content doesn't) while avoiding expensive hash computation in common case (mtime unchanged = content unchanged).\n\nPerformance impact: 99% of checks will use fast path, only git operations need slow path.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T21:31:04.577264-05:00","updated_at":"2025-11-20T21:33:31.499918-05:00","closed_at":"2025-11-20T21:33:31.499918-05:00","dependencies":[{"issue_id":"bd-3bg","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:04.578768-05:00","created_by":"daemon"}]} +{"id":"bd-96142dec","title":"Add fallback to polling on watcher failure","description":"Detect fsnotify.NewWatcher() errors and log warning. Auto-switch to polling mode with 5s ticker. Add BEADS_WATCHER_FALLBACK env var to control behavior.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.428439-07:00","updated_at":"2025-10-30T17:12:58.220378-07:00","closed_at":"2025-10-28T19:23:43.595916-07:00"} +{"id":"bd-br8","title":"Implement `bd setup claude` command for Claude Code integration","description":"Create a `bd setup claude` command that installs Claude Code integration files (slash commands and hooks). This is idempotent and safe to run multiple times.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:28:59.374019-08:00","updated_at":"2025-11-12T08:51:23.281292-08:00","closed_at":"2025-11-12T08:51:23.281292-08:00","dependencies":[{"issue_id":"bd-br8","depends_on_id":"bd-rpn","type":"blocks","created_at":"2025-11-11T23:28:59.375616-08:00","created_by":"daemon"},{"issue_id":"bd-br8","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:23.762685-08:00","created_by":"daemon"}]} +{"id":"bd-5aad5a9c","title":"Add TestNWayCollision for 5+ clones","description":"## Overview\nAdd comprehensive tests for N-way (5+) collision resolution to verify the solution scales beyond 3 clones.\n\n## Purpose\nWhile TestThreeCloneCollision validates the basic N-way case, we need to verify:\n1. Solution scales to arbitrary N\n2. Performance is acceptable with more clones\n3. Convergence time is bounded\n4. No edge cases in larger collision groups\n\n## Implementation Tasks\n\n### 1. Create TestFiveCloneCollision\nFile: beads_twoclone_test.go (or new beads_nway_test.go)\n\n```go\nfunc TestFiveCloneCollision(t *testing.T) {\n // Test with 5 clones creating same ID with different content\n // Verify all 5 clones converge after sync rounds\n \n t.Run(\"SequentialSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"A\", \"B\", \"C\", \"D\", \"E\")\n })\n \n t.Run(\"ReverseSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"E\", \"D\", \"C\", \"B\", \"A\")\n })\n \n t.Run(\"RandomSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"C\", \"A\", \"E\", \"B\", \"D\")\n })\n}\n```\n\n### 2. Implement generalized testNCloneCollision\nGeneralize the 3-clone test to handle arbitrary N:\n\n```go\nfunc testNCloneCollision(t *testing.T, numClones int, syncOrder ...string) {\n t.Helper()\n \n if len(syncOrder) != numClones {\n t.Fatalf(\"syncOrder length (%d) must match numClones (%d)\", \n len(syncOrder), numClones)\n }\n \n tmpDir := t.TempDir()\n \n // Setup remote and N clones\n remoteDir := setupBareRepo(t, tmpDir)\n cloneDirs := make(map[string]string)\n \n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n cloneDirs[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates issue with same ID but different content\n for name, dir := range cloneDirs {\n createIssue(t, dir, fmt.Sprintf(\"Issue from clone %s\", name))\n }\n \n // Sync in specified order\n for _, name := range syncOrder {\n syncClone(t, cloneDirs[name], name)\n }\n \n // Final pull for convergence\n for name, dir := range cloneDirs {\n finalPull(t, dir, name)\n }\n \n // Verify all clones have all N issues\n expectedTitles := make(map[string]bool)\n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n expectedTitles[fmt.Sprintf(\"Issue from clone %s\", name)] = true\n }\n \n for name, dir := range cloneDirs {\n titles := getTitles(t, dir)\n if !compareTitleSets(titles, expectedTitles) {\n t.Errorf(\"Clone %s missing issues: expected %v, got %v\", \n name, expectedTitles, titles)\n }\n }\n \n t.Log(\"βœ“ All\", numClones, \"clones converged successfully\")\n}\n```\n\n### 3. Add performance benchmarks\nTest convergence time and memory usage:\n\n```go\nfunc BenchmarkNWayCollision(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n // Run N-way collision and measure time\n testNCloneCollisionBench(b, n)\n }\n })\n }\n}\n```\n\n### 4. Add convergence time tests\nVerify bounded convergence:\n\n```go\nfunc TestConvergenceTime(t *testing.T) {\n // Test that convergence happens within expected rounds\n // For N clones, should converge in at most N-1 sync rounds\n \n for n := 3; n \u003c= 10; n++ {\n t.Run(fmt.Sprintf(\"N=%d\", n), func(t *testing.T) {\n rounds := measureConvergenceRounds(t, n)\n maxExpected := n - 1\n if rounds \u003e maxExpected {\n t.Errorf(\"Convergence took %d rounds, expected ≀ %d\", \n rounds, maxExpected)\n }\n })\n }\n}\n```\n\n### 5. Add edge case tests\nTest boundary conditions:\n- All N clones have identical content (dedup works)\n- N-1 clones have same content, 1 differs\n- All N clones have unique content\n- Mix of collisions and non-collisions\n\n## Acceptance Criteria\n- TestFiveCloneCollision passes with all sync orders\n- All 5 clones converge to identical content\n- Performance is acceptable (\u003c 5 seconds for 5 clones)\n- Convergence time is bounded (≀ N-1 rounds)\n- Edge cases handled correctly\n- Benchmarks show scalability to 10+ clones\n\n## Files to Create/Modify\n- beads_twoclone_test.go or beads_nway_test.go\n- Add helper functions for N-clone setup\n\n## Testing Strategy\n\n### Test Matrix\n| N Clones | Sync Orders | Expected Result |\n|----------|-------------|-----------------|\n| 3 | Aβ†’Bβ†’C | Pass |\n| 3 | Cβ†’Bβ†’A | Pass |\n| 5 | Aβ†’Bβ†’Cβ†’Dβ†’E | Pass |\n| 5 | Eβ†’Dβ†’Cβ†’Bβ†’A | Pass |\n| 5 | Random | Pass |\n| 10 | Sequential | Pass |\n\n### Performance Targets\n- 3 clones: \u003c 2 seconds\n- 5 clones: \u003c 5 seconds\n- 10 clones: \u003c 15 seconds\n\n## Dependencies\n- Requires bd-cbed9619.5, bd-cbed9619.4, bd-cbed9619.3, bd-dcd6f14b to be completed\n- TestThreeCloneCollision must pass first\n\n## Success Metrics\n- All tests pass for N ∈ {3, 5, 10}\n- Convergence time scales linearly (O(N))\n- Memory usage reasonable (\u003c 100MB for 10 clones)\n- No data corruption or loss in any scenario","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T19:52:05.462747-07:00","updated_at":"2025-10-31T12:00:43.198413-07:00","closed_at":"2025-10-31T12:00:43.198413-07:00"} +{"id":"bd-ar2.11","title":"Use stable repo identifiers instead of full paths in metadata keys","description":"## Problem\nbd-ar2.2 uses full absolute paths as metadata key suffixes:\n```go\nupdateExportMetadata(exportCtx, store, path, log, path)\n// Creates: last_import_hash:/Users/stevey/src/cino/beads/repo1/.beads/issues.jsonl\n```\n\n## Issues\n1. Absolute paths differ across machines/clones\n2. Keys are very long\n3. If user moves repo or clones to different path, metadata becomes orphaned\n4. Metadata won't be portable across team members\n\n## Better Approach\nUse source_repo identifiers from multi-repo config (e.g., \".\", \"../frontend\"):\n```go\n// Get mapping of jsonl_path -\u003e source_repo identifier\nfor _, path := range multiRepoPaths {\n repoKey := getRepoKeyForPath(path) // e.g., \".\", \"../frontend\"\n updateExportMetadata(exportCtx, store, path, log, repoKey)\n}\n```\n\nThis creates stable keys like:\n- `last_import_hash:.`\n- `last_import_hash:../frontend`\n\n## Related\nDepends on bd-ar2.10 (hasJSONLChanged update)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:58:34.368544-05:00","updated_at":"2025-11-21T11:25:23.434129-05:00","closed_at":"2025-11-21T11:25:23.434129-05:00","dependencies":[{"issue_id":"bd-ar2.11","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:58:34.370273-05:00","created_by":"daemon"}]} +{"id":"bd-cjxp","title":"Bug P0","status":"closed","issue_type":"bug","created_at":"2025-11-07T19:00:22.536449-08:00","updated_at":"2025-11-07T22:07:17.345535-08:00","closed_at":"2025-11-07T21:55:09.429643-08:00"} +{"id":"bd-dd6f6d26","title":"Fix autoimport tests for content-hash collision scoring","description":"## Overview\nThree autoimport tests are failing after [deleted:bd-cbed9619.4] because they expect behavior based on the old reference-counting collision resolution, but the system now uses deterministic content-hash scoring.\n\n## Failing Tests\n1. `TestAutoImportMultipleCollisionsRemapped` - expects local versions preserved\n2. `TestAutoImportAllCollisionsRemapped` - expects local versions preserved \n3. `TestAutoImportCollisionRemapMultipleFields` - expects specific collision resolution behavior\n\n## Root Cause\nThese tests were written when ScoreCollisions used reference counting to determine which version to keep. Now it uses content-hash comparison (introduced in commit 2e87329), which produces different but deterministic results.\n\n## Example\nOld behavior: Issue with more references would be kept\nNew behavior: Issue with lexicographically lower content hash is kept\n\n## Solution\nUpdate each test to:\n1. Verify the new content-hash based behavior is correct\n2. Check that the remapped issue (not necessarily local/remote) has the expected content\n3. Ensure dependencies are preserved on the correct remapped issue\n\n## Acceptance Criteria\n- All three autoimport tests pass\n- Tests verify content-hash determinism (same collision always resolves the same way)\n- Tests check dependency preservation on remapped issues\n- Test documentation explains content-hash scoring expectations\n\n## Files to Modify\n- `cmd/bd/autoimport_collision_test.go`\n\n## Testing\nRun: `go test ./cmd/bd -run \"TestAutoImport.*Collision\" -v`","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T03:09:48.253086-08:00","updated_at":"2025-11-20T19:43:48.756262-05:00","closed_at":"2025-11-08T02:28:35.317704-08:00","dependencies":[{"issue_id":"bd-dd6f6d26","depends_on_id":"bd-cbed9619.4","type":"discovered-from","created_at":"2025-10-28T19:12:56.345276-07:00","created_by":"daemon"}]} +{"id":"bd-f282","title":"Test npm package installation locally","description":"Verify npm package works before publishing:\n\n## Local testing\n- Run npm pack in npm/ directory\n- Install tarball globally: npm install -g beads-bd-0.21.5.tgz\n- Test basic commands:\n - bd --version\n - bd init --quiet --prefix test\n - bd create \"Test issue\" -p 1 --json\n - bd list --json\n - bd sync\n\n## Test environments\n- macOS (darwin-arm64 and darwin-amd64)\n- Linux (ubuntu docker container for linux-amd64)\n- Windows (optional, if available)\n\n## Validation\n- Binary downloads during postinstall\n- All bd commands work identically to native\n- No permission issues\n- Proper error messages on failure","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:40:05.71835-08:00","updated_at":"2025-11-03T10:31:45.382577-08:00","closed_at":"2025-11-03T10:31:45.382577-08:00","dependencies":[{"issue_id":"bd-f282","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.968748-08:00","created_by":"daemon"}]} +{"id":"bd-7bd2","title":"Complete remaining sync branch daemon tests","description":"4 remaining test scenarios in daemon_sync_branch_test.go need completion:\n\n⚠️ MINOR FIXES (apply same pattern as TestSyncBranchCommitAndPush_Success):\n1. TestSyncBranchCommitAndPush_NoChanges\n - Reorder: call initMainBranch() BEFORE creating JSONL\n - Pattern: init branch β†’ create issue β†’ export JSONL β†’ test\n\n2. TestSyncBranchCommitAndPush_WorktreeHealthCheck\n - Same reordering needed\n - Verify worktree corruption detection and auto-repair\n\nπŸ”§ MORE WORK NEEDED (remote branch setup):\n3. TestSyncBranchPull_Success\n - Issue: remote doesn't have sync branch after push\n - Need to verify branch is pushed to remote correctly\n - Then test pull from clone2\n\n4. TestSyncBranchIntegration_EndToEnd\n - Full workflow: Agent A commits β†’ Agent B pulls β†’ Agent B commits β†’ Agent A pulls\n - Same remote branch issue\n\nPattern to apply (from TestSyncBranchCommitAndPush_Success):\n- Call initMainBranch(t, dir) BEFORE creating issues/JSONL\n- This ensures sync branch worktree has changes to commit\n\nAcceptance:\n- All 7 tests pass\n- go test -v -run TestSyncBranch ./cmd/bd/ succeeds","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T16:29:29.044162-08:00","updated_at":"2025-11-02T16:39:53.277529-08:00","closed_at":"2025-11-02T16:39:53.277529-08:00","dependencies":[{"issue_id":"bd-7bd2","depends_on_id":"bd-502e","type":"discovered-from","created_at":"2025-11-02T16:29:29.045104-08:00","created_by":"stevey"}]} +{"id":"bd-ar2.10","title":"Fix hasJSONLChanged to support per-repo metadata keys","description":"## Problem\nAfter bd-ar2.2, we store metadata with per-repo keys like `last_import_hash:\u003cpath\u003e`, but `hasJSONLChanged` and `validatePreExport` still only check global keys.\n\n## Impact\n- Multi-repo mode won't benefit from bd-ymj fix\n- validatePreExport will fail incorrectly or pass incorrectly\n- Metadata updates are written but never read\n\n## Location\n- cmd/bd/integrity.go:97 (hasJSONLChanged)\n- cmd/bd/integrity.go:138 (validatePreExport)\n\n## Solution\nUpdate hasJSONLChanged to accept optional keySuffix parameter:\n```go\nfunc hasJSONLChanged(ctx context.Context, store storage.Storage, jsonlPath string, keySuffix string) bool {\n // Build metadata keys with optional suffix\n hashKey := \"last_import_hash\"\n mtimeKey := \"last_import_mtime\"\n if keySuffix != \"\" {\n hashKey += \":\" + keySuffix\n mtimeKey += \":\" + keySuffix\n }\n // ... rest of function\n}\n```\n\nUpdate all callers to pass correct keySuffix.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:58:20.969689-05:00","updated_at":"2025-11-21T11:25:23.421383-05:00","closed_at":"2025-11-21T11:25:23.421383-05:00","dependencies":[{"issue_id":"bd-ar2.10","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:58:20.970624-05:00","created_by":"daemon"}]} +{"id":"bd-2ku7","title":"Test integration issue","description":"This is a real integration test","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T19:07:11.528577-08:00","updated_at":"2025-11-07T22:07:17.343154-08:00","closed_at":"2025-11-07T21:55:09.426381-08:00"} +{"id":"bd-8mfn","title":"bd message: Implement full message reading functionality","description":"The `bd message read` command is incomplete and doesn't actually fetch or display message content.\n\n**Location:** cmd/bd/message.go:413-441\n\n**Current Behavior:**\n- Only marks message as read\n- Prints placeholder text\n- Doesn't fetch message body\n\n**Expected:**\n- Fetch full message from Agent Mail resource API\n- Display sender, subject, timestamp, body\n- Consider markdown rendering\n\n**Blocker:** Core feature for message system MVP","status":"closed","issue_type":"bug","created_at":"2025-11-08T12:54:24.018957-08:00","updated_at":"2025-11-08T12:57:32.91854-08:00","closed_at":"2025-11-08T12:57:32.91854-08:00","dependencies":[{"issue_id":"bd-8mfn","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.811368-08:00","created_by":"daemon"}]} +{"id":"bd-b92a","title":"Wire config to import pipeline","description":"Connect import.orphan_handling config to importer.go and sqlite validation functions. Pass mode flag through call chain. Implement all four modes (strict/resurrect/skip/allow) with proper error messages and logging.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:08.612142-08:00","updated_at":"2025-11-05T00:44:27.949021-08:00","closed_at":"2025-11-05T00:44:27.949024-08:00"} +{"id":"bd-4ms","title":"Multi-repo contributor workflow support","description":"Implement separate repository support for OSS contributors to prevent PR pollution while maintaining git ledger and multi-clone sync. Based on contributor-workflow-analysis.md Solution #4.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:19.515776-08:00","updated_at":"2025-11-05T00:08:42.812659-08:00","closed_at":"2025-11-05T00:08:42.812662-08:00"} +{"id":"bd-f8b764c9.7","title":"CLI accepts both hash IDs and aliases","description":"Update all CLI commands to accept both hash IDs (bd-af78e9a2) and aliases (#42, or just 42).\n\n## Parsing Logic\n```go\n// internal/utils/id_parser.go\nfunc ParseIssueID(input string) (issueID string, err error) {\n // Hash ID: bd-af78e9a2\n if strings.HasPrefix(input, \"bd-\") {\n return input, nil\n }\n \n // Alias: #42 or 42\n aliasStr := strings.TrimPrefix(input, \"#\")\n alias, err := strconv.Atoi(aliasStr)\n if err != nil {\n return \"\", fmt.Errorf(\"invalid issue ID: %s\", input)\n }\n \n // Resolve alias to hash ID\n return storage.GetIssueIDByAlias(alias)\n}\n```\n\n## Commands to Update\nAll commands that accept issue IDs:\n\n### 1. bd show\n```bash\nbd show bd-af78e9a2 # Hash ID\nbd show #42 # Alias\nbd show 42 # Alias (shorthand)\nbd show bd-af78e9a2 #42 # Mixed (multiple IDs)\n```\n\n### 2. bd update\n```bash\nbd update #42 --status in_progress\nbd update bd-af78e9a2 --priority 1\n```\n\n### 3. bd close\n```bash\nbd close #42 --reason \"Done\"\n```\n\n### 4. bd dep add/tree\n```bash\nbd dep add #42 #1 --type blocks\nbd dep tree bd-af78e9a2\n```\n\n### 5. bd label add/remove\n```bash\nbd label add #42 critical\n```\n\n### 6. bd merge\n```bash\nbd merge #42 #43 --into #41\n```\n\n## Display Format\nDefault to showing aliases in output:\n```bash\n$ bd list\n#1 Fix authentication bug P1 open\n#2 Add logging to daemon P2 open \n#42 Investigate jujutsu integration P3 open\n```\n\nWith `--format=hash` flag:\n```bash\n$ bd list --format=hash\nbd-af78e9a2 Fix authentication bug P1 open\nbd-e5f6a7b8 Add logging to daemon P2 open\nbd-1a2b3c4d Investigate jujutsu integration P3 open\n```\n\n## Files to Modify\n- internal/utils/id_parser.go (new)\n- cmd/bd/show.go\n- cmd/bd/update.go\n- cmd/bd/close.go\n- cmd/bd/reopen.go\n- cmd/bd/dep.go\n- cmd/bd/label.go\n- cmd/bd/merge.go\n- cmd/bd/list.go (add --format flag)\n\n## Testing\n- Test hash ID parsing\n- Test alias parsing (#42, 42)\n- Test mixed IDs in single command\n- Test error on invalid ID\n- Test alias resolution failure","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:25:06.256317-07:00","updated_at":"2025-10-31T12:32:32.609634-07:00","closed_at":"2025-10-31T12:32:32.609634-07:00","dependencies":[{"issue_id":"bd-f8b764c9.7","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:25:06.257796-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.7","depends_on_id":"bd-f8b764c9.10","type":"blocks","created_at":"2025-10-29T21:25:06.258307-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.7","depends_on_id":"bd-f8b764c9.8","type":"blocks","created_at":"2025-10-29T21:29:45.993274-07:00","created_by":"stevey"}]} +{"id":"bd-fzbg","title":"Update python-agent example with Agent Mail integration","description":"Modify examples/python-agent/agent.py to use Agent Mail adapter at 4 integration points.\n\nAcceptance Criteria:\n- Import and initialize adapter\n- Check inbox before find_ready_work()\n- Reserve issue before claim_task()\n- Notify on status changes\n- Release reservation on complete_task()\n- Works identically when Agent Mail disabled\n- No changes required to core Beads CLI\n\nFile: examples/python-agent/agent.py","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T22:42:28.661337-08:00","updated_at":"2025-11-08T00:20:35.213902-08:00","closed_at":"2025-11-08T00:20:35.213902-08:00","dependencies":[{"issue_id":"bd-fzbg","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T23:04:01.315332-08:00","created_by":"daemon"}]} +{"id":"bd-pmuu","title":"Create architecture decision record (ADR)","description":"Document why we chose Agent Mail, alternatives considered, and tradeoffs.\n\nAcceptance Criteria:\n- Problem statement (git traffic, no locks)\n- Alternatives considered (custom RPC, Redis, etc.)\n- Why Agent Mail fits Beads\n- Integration principles (optional, graceful degradation)\n- Future considerations\n\nFile: docs/adr/002-agent-mail-integration.md","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T22:42:51.420203-08:00","updated_at":"2025-11-08T00:06:01.816892-08:00","closed_at":"2025-11-08T00:06:01.816892-08:00","dependencies":[{"issue_id":"bd-pmuu","depends_on_id":"bd-spmx","type":"parent-child","created_at":"2025-11-08T00:02:47.93119-08:00","created_by":"daemon"}]} +{"id":"bd-0fvq","title":"bd doctor should recommend bd prime migration for existing repos","description":"bd doctor should detect old beads integration patterns and recommend migrating to bd prime approach.\n\n## Current behavior\n- bd doctor checks if Claude hooks are installed globally\n- Doesn't check project-level integration (AGENTS.md, CLAUDE.md)\n- Doesn't recommend migration for repos using old patterns\n\n## Desired behavior\nbd doctor should detect and suggest:\n\n1. **Old slash command pattern detected**\n - Check for /beads:* references in AGENTS.md, CLAUDE.md\n - Suggest: These slash commands are deprecated, use bd prime hooks instead\n \n2. **No agent documentation**\n - Check if AGENTS.md or CLAUDE.md exists\n - Suggest: Run 'bd onboard' or 'bd setup claude' to document workflow\n \n3. **Old MCP-only pattern**\n - Check for instructions to use MCP tools but no bd prime hooks\n - Suggest: Add bd prime hooks for better token efficiency\n\n4. **Migration path**\n - Show: 'Run bd setup claude to add SessionStart/PreCompact hooks'\n - Show: 'Update AGENTS.md to reference bd prime instead of slash commands'\n\n## Example output\n\n⚠ Warning: Old beads integration detected in CLAUDE.md\n Found: /beads:* slash command references (deprecated)\n Recommend: Migrate to bd prime hooks for better token efficiency\n Fix: Run 'bd setup claude' and update CLAUDE.md\n\nπŸ’‘ Tip: bd prime + hooks reduces token usage by 80-99% vs slash commands\n MCP mode: ~50 tokens vs ~10.5k for full MCP scan\n CLI mode: ~1-2k tokens with automatic context recovery\n\n## Benefits\n- Helps existing repos adopt new best practices\n- Clear migration path for users\n- Better token efficiency messaging","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-12T03:20:25.567748-08:00","updated_at":"2025-11-12T03:20:25.567748-08:00"} +{"id":"bd-0088","title":"Create npm package structure for bd-wasm","description":"Set up npm package for distribution:\n- Create package.json with bd-wasm name\n- Bundle bd.wasm + wasm_exec.js\n- Create CLI wrapper (bin/bd) that invokes WASM\n- Add installation scripts if needed\n- Configure package for Claude Code Web sandbox compatibility","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.295058-08:00","updated_at":"2025-11-03T20:56:22.700641-08:00","closed_at":"2025-11-03T20:56:22.700641-08:00","dependencies":[{"issue_id":"bd-0088","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.475356-08:00","created_by":"stevey"}]} +{"id":"bd-bt6y","title":"Improve compact/daemon/merge documentation and UX","description":"Multiple documentation and UX issues encountered:\n1. \"bd compact --analyze\" fails with misleading \"requires SQLite storage\" error when daemon is running. Needs --no-daemon or better error.\n2. \"bd merge\" help text is outdated (refers to 3-way merge instead of issue merging).\n3. Daemon mode purpose isn't clear to local-only users.\n4. Compact/cleanup commands are hard to discover.\n\nProposed fixes:\n- Fix compact+daemon interaction or error message.\n- Update \"bd merge\" help text.\n- Add \"when to use daemon\" section to docs.\n- Add maintenance section to quickstart.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:55:43.637047-05:00","updated_at":"2025-11-20T18:55:43.637047-05:00"} +{"id":"bd-98c4e1fa.1","title":"Update AGENTS.md with event-driven mode","description":"Document BEADS_DAEMON_MODE env var. Explain opt-in during Phase 1. Add troubleshooting for watcher failures.","status":"open","priority":2,"issue_type":"task","created_at":"2025-10-29T23:05:13.986452-07:00","updated_at":"2025-10-31T20:36:49.381832-07:00","dependencies":[{"issue_id":"bd-98c4e1fa.1","depends_on_id":"bd-98c4e1fa","type":"parent-child","created_at":"2025-10-29T21:19:36.206187-07:00","created_by":"import-remap"},{"issue_id":"bd-98c4e1fa.1","depends_on_id":"bd-0e1f2b1b","type":"parent-child","created_at":"2025-10-31T19:38:09.131439-07:00","created_by":"stevey"}]} +{"id":"bd-897a","title":"Add UNIQUE constraint on external_ref column","description":"The external_ref column should have a UNIQUE constraint to prevent multiple issues from having the same external reference. This ensures data integrity when syncing from external systems (Jira, GitHub, Linear).\n\nCurrent behavior:\n- Multiple issues can have the same external_ref\n- GetIssueByExternalRef returns first match (non-deterministic with duplicates)\n\nProposed solution:\n- Add UNIQUE constraint to external_ref column\n- Add migration to check for and resolve existing duplicates\n- Update tests to verify constraint enforcement\n\nRelated: bd-1022","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:31:54.718005-08:00","updated_at":"2025-11-02T16:01:45.742666-08:00","closed_at":"2025-11-02T16:01:45.742666-08:00"} +{"id":"bd-7315","title":"Add validation for duplicate external_ref in batch imports","description":"Currently, if a batch import contains multiple issues with the same external_ref, the behavior is undefined. We should detect and handle this case.\n\nCurrent behavior:\n- No validation for duplicate external_ref within a batch\n- Last-write-wins or non-deterministic behavior\n\nProposed solution:\n- Detect duplicate external_ref values in incoming batch\n- Fail with clear error message OR\n- Merge duplicates intelligently (use newest timestamp)\n- Add test case for this scenario\n\nRelated: bd-1022","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:31:55.85634-08:00","updated_at":"2025-11-02T16:03:50.374552-08:00","closed_at":"2025-11-02T16:03:50.374552-08:00"} +{"id":"bd-81a","title":"Add programmatic tip injection API","description":"Allow tips to be programmatically injected at runtime based on detected conditions. This enables dynamic tips (not just pre-defined ones) to be shown with custom priority and frequency.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:29:46.645583-08:00","updated_at":"2025-11-11T23:50:12.209135-08:00","dependencies":[{"issue_id":"bd-81a","depends_on_id":"bd-d4i","type":"blocks","created_at":"2025-11-11T23:29:46.646327-08:00","created_by":"daemon"}]} +{"id":"bd-omx1","title":"Add `bd merge` command wrapping 3-way merge logic","description":"Implement CLI command to invoke beads-merge functionality.\n\n**Interface**:\n```bash\nbd merge \u003coutput\u003e \u003cbase\u003e \u003cleft\u003e \u003cright\u003e\nbd merge --debug \u003coutput\u003e \u003cbase\u003e \u003cleft\u003e \u003cright\u003e\n```\n\n**Behavior**:\n- Exit code 0 on clean merge\n- Exit code 1 if conflicts (write conflict markers)\n- Support --debug flag for verbose output\n- Match beads-merge's existing behavior\n\n**File**: `cmd/bd/merge.go`","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.427429-08:00","updated_at":"2025-11-05T19:01:29.071365-08:00","closed_at":"2025-11-05T19:01:29.071365-08:00","dependencies":[{"issue_id":"bd-omx1","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.709123-08:00","created_by":"daemon"},{"issue_id":"bd-omx1","depends_on_id":"bd-oif6","type":"blocks","created_at":"2025-11-05T18:42:35.436444-08:00","created_by":"daemon"}]} +{"id":"bd-fb95094c.3","title":"Update documentation after code health cleanup","description":"Update all documentation to reflect code structure changes after cleanup phases complete.\n\nDocumentation to update:\n1. **AGENTS.md** - Update file structure references\n2. **CONTRIBUTING.md** (if exists) - Update build/test instructions\n3. **Code comments** - Update any outdated references\n4. **Package documentation** - Update godoc for reorganized packages\n\nNew documentation to add:\n1. **internal/util/README.md** - Document shared utilities\n2. **internal/debug/README.md** - Document debug logging\n3. **internal/rpc/README.md** - Document new file organization\n4. **internal/storage/sqlite/migrations/README.md** - Migration system docs\n\nImpact: Keeps documentation in sync with code","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:32:00.141028-07:00","updated_at":"2025-11-23T14:14:13.334363-08:00","closed_at":"2025-11-08T18:15:48.644285-08:00","dependencies":[{"issue_id":"bd-fb95094c.3","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:32:00.1423-07:00","created_by":"daemon"}]} +{"id":"bd-ihp9","title":"Fix FOREIGN KEY constraint failures in AddComment and ApplyCompaction","description":"The 'CloseIssue', 'UpdateIssueID', and 'RemoveLabel' methods were fixed in PR #348 to prevent foreign key constraint failures when operating on non-existent issues.\n\nHowever, the Oracle identified two other methods that follow the same problematic pattern:\n1. `AddComment` (in `internal/storage/sqlite/events.go`)\n2. `ApplyCompaction` (in `internal/storage/sqlite/compact.go`)\n\nThese methods attempt to insert an event record after updating the issue, without verifying that the issue update actually affected any rows. This leads to a foreign key constraint failure if the issue does not exist.\n\nWe need to:\n1. Create reproduction tests for these failure cases\n2. Apply the same fix pattern: check `RowsAffected()` after the update, and return a proper \"issue not found\" error if it is 0, before attempting to insert the event.\n3. Standardize the error message format to \"issue %s not found\" or \"issue not found: %s\" for consistency.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T09:49:55.090644-08:00","updated_at":"2025-11-20T09:53:54.466769-08:00","closed_at":"2025-11-20T09:53:54.466769-08:00"} +{"id":"bd-0447029c","title":"bd find-duplicates - AI-powered duplicate detection","description":"Find semantically duplicate issues.\n\nApproaches:\n1. Mechanical: Exact title/description matching\n2. Embeddings: Cosine similarity (cheap, scalable)\n3. AI: LLM-based semantic comparison (expensive, accurate)\n\nUses embeddings by default for \u003e100 issues.\n\nFiles: cmd/bd/find_duplicates.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T12:40:11.705915-05:00","updated_at":"2025-11-20T12:40:11.705915-05:00","closed_at":"2025-10-29T16:15:10.64719-07:00"} +{"id":"bd-nq41","title":"Fix Homebrew warning about Ruby file location","description":"Homebrew warning: Found Ruby file outside steveyegge/beads tap formula directory.\nWarning points to: /opt/homebrew/Library/Taps/steveyegge/homebrew-beads/bd.rb\nIt should likely be inside a Formula/ directory or similar structure expected by Homebrew taps.\n","status":"open","priority":2,"issue_type":"chore","created_at":"2025-11-20T18:56:21.226579-05:00","updated_at":"2025-11-20T18:56:21.226579-05:00"} +{"id":"bd-u8j","title":"Clarify exclusive lock protocol compatibility with multi-repo","description":"The contributor-workflow-analysis.md proposes per-repo file locking (Decision #7) using flock on JSONL files. However, VC (a downstream library consumer) uses an exclusive lock protocol (vc-195, requires Beads v0.17.3+) that allows bd daemon and VC executor to coexist.\n\nNeed to clarify:\n- Does the proposed per-repo file locking work with VC's existing exclusive lock protocol?\n- Do library consumers like VC need to adapt their locking logic?\n- Can multiple repos be locked atomically for cross-repo operations?\n\nContext: contributor-workflow-analysis.md lines 662-681","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:08.257493-08:00","updated_at":"2025-11-05T14:15:01.506885-08:00","closed_at":"2025-11-05T14:15:01.506885-08:00"} +{"id":"bd-mf0o","title":"Add 'new' as alias for 'create' command","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-08T03:11:46.791657-08:00","updated_at":"2025-11-08T03:11:51.035418-08:00","closed_at":"2025-11-08T03:11:51.035418-08:00"} +{"id":"bd-my64","title":"Pre-push hook and daemon export produce different JSONL","description":"After committing and pushing, git status shows .beads/beads.jsonl as dirty. Investigation shows:\n\n1. Pre-push hook ran successfully and exported DB β†’ JSONL\n2. Push completed\n3. Shortly after, daemon exported DB β†’ JSONL again with different content\n4. Diff shows comments added to old issues (bd-23a8, bd-6049, bd-87a0)\n\nTimeline:\n- Commit c731c45 \"Update beads JSONL\"\n- Pre-push hook exported JSONL\n- Push succeeded\n- Daemon PID 33314 exported again with different content\n\nQuestions:\n1. Did someone run a command between commit and daemon export?\n2. Is there a timing issue where pre-push hook doesn't capture all DB changes?\n3. Should pre-commit hook flush daemon changes before committing?\n\nThe comments appear to be from Nov 5 (created_at: 2025-11-05T08:38:46Z) but are only appearing in JSONL now. This suggests the DB had these comments but they weren't exported during pre-push.\n\nPossible causes:\n- Pre-push hook uses BEADS_NO_DAEMON=1 which might skip pending writes\n- Daemon has unflushed changes in memory\n- Race condition between pre-push export and daemon's periodic export","notes":"Improved fix based on oracle code review:\n1. Pre-push now flushes pending changes first (prevents debounce race)\n2. Uses git status --porcelain to catch all change types\n3. Handles both beads.jsonl and issues.jsonl\n4. Works even if bd not installed (git-only check)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:49:54.570993-08:00","updated_at":"2025-11-06T19:01:14.549032-08:00","closed_at":"2025-11-06T18:57:42.710282-08:00"} +{"id":"bd-loka.3","title":"Implement bd upgrade subcommand with status/review/ack","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:29.849527-08:00","updated_at":"2025-11-23T17:02:54.925905-08:00","closed_at":"2025-11-23T17:02:54.925905-08:00","dependencies":[{"issue_id":"bd-loka.3","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:29.850054-08:00","created_by":"daemon"}]} +{"id":"bd-317ddbbf","title":"Add BEADS_DAEMON_MODE flag handling","description":"Add environment variable BEADS_DAEMON_MODE (values: poll, events). Default to 'poll' for Phase 1. Wire into daemon startup to select runEventLoop vs runEventDrivenLoop.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.433638-07:00","updated_at":"2025-10-30T17:12:58.224373-07:00","closed_at":"2025-10-28T12:31:47.819136-07:00"} +{"id":"bd-8931","title":"Daemon gets stuck when auto-import blocked by git conflicts","description":"CRITICAL: The daemon enters a corrupt state that breaks RPC commands when auto-import is triggered but git pull fails due to uncommitted changes.\n\nImpact: This is a data integrity and usability issue that could cause users to lose trust in Beads. The daemon silently fails for certain commands while appearing healthy.\n\nReproduction:\n1. Make local changes to issues (creates uncommitted .beads/beads.jsonl)\n2. Remote has updates (JSONL newer, triggers auto-import)\n3. Daemon tries to pull but fails: 'cannot pull with rebase: You have unstaged changes'\n4. Daemon enters bad state - 'bd show' and other commands return EOF\n5. 'bd list' still works, daemon process is running, no errors logged\n\nTechnical details:\n- Auto-import check runs in handleRequest() before processing RPC commands\n- When import is blocked, it appears to corrupt daemon state\n- Likely: deadlock, unclosed transaction, or storage handle corruption\n- Panic recovery (server_lifecycle_conn.go:183) didn't catch anything - not a panic\n\nRequired fix:\n- Auto-import must not block RPC command execution\n- Handle git pull failures gracefully without corrupting state\n- Consider: skip auto-import if git is dirty, queue import for later, or use separate goroutine\n- Add timeout/circuit breaker for import operations\n- Log clear warnings when auto-import is skipped\n\nWithout this fix, users in collaborative environments will frequently encounter mysterious EOF errors that require daemon restarts.","status":"closed","issue_type":"bug","created_at":"2025-11-02T17:15:25.181425-08:00","updated_at":"2025-11-03T12:08:12.949061-08:00","closed_at":"2025-11-03T12:08:12.949064-08:00","dependencies":[{"issue_id":"bd-8931","depends_on_id":"bd-1048","type":"blocks","created_at":"2025-11-02T17:15:25.181857-08:00","created_by":"stevey"}]} +{"id":"bd-8ql","title":"Remove misleading placeholder 'bd merge' command from duplicates output","description":"**Problem:**\nThe `bd duplicates` command suggests running a command that doesn't exist:\n```\nbd merge \u003csource-ids\u003e --into \u003ctarget-id\u003e\n```\n\nThis is confusing because:\n1. `bd merge` is actually a git 3-way JSONL merge driver (takes 4 file paths)\n2. The suggested syntax for merging duplicate issues is not implemented\n3. Line 75 in duplicates.go even has: `// TODO: performMerge implementation pending`\n\n**Current behavior:**\n- Users see suggested command that doesn't work\n- No indication that feature is unimplemented\n- Related to issue #349 item #2\n\n**Proposed fix:**\nReplace line 77 in cmd/bd/duplicates.go with either:\n\nOption A (conservative):\n```go\ncmd := fmt.Sprintf(\"# TODO: Merge %s into %s (merge command not yet implemented)\", \n strings.Join(sources, \" \"), target.ID)\n```\n\nOption B (actionable):\n```go\ncmd := fmt.Sprintf(\"# Duplicate found: %s\\n# Manual merge: Close duplicates with 'bd close %s' and link to %s as 'related'\", \n strings.Join(sources, \" \"), strings.Join(sources, \" \"), target.ID)\n```\n\n**Files to modify:**\n- cmd/bd/duplicates.go (line ~77)","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:48:01.707967-05:00","updated_at":"2025-11-23T18:06:29.857946-08:00","closed_at":"2025-11-20T20:59:13.416865-05:00"} +{"id":"bd-9rw1","title":"Support P-prefix priority format (P0-P4) in create and update commands","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T13:56:04.796826-08:00","updated_at":"2025-11-05T13:56:08.157061-08:00","closed_at":"2025-11-05T13:56:08.157061-08:00"} +{"id":"bd-l5gq","title":"Optimize test suite performance - cut runtime by 50%+","description":"## Problem\nTest suite takes ~20.8 seconds, with 95% of time spent in just 2 tests:\n- TestHashIDs_MultiCloneConverge: 11.08s (53%)\n- TestHashIDs_IdenticalContentDedup: 8.78s (42%)\n\nBoth tests in beads_hash_multiclone_test.go perform extensive Git operations (bare repos, multiple clones, sync rounds).\n\n## Goal\nCut total test time by at least 50% (to ~10 seconds or less).\n\n## Analysis\nTests already have some optimizations:\n- --shared --depth=1 --no-tags for fast cloning\n- Disabled hooks, gc, fsync\n- Support -short flag\n\n## Impact\n- Faster development feedback loop\n- Reduced CI costs and time\n- Better developer experience","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-11-04T01:23:14.410648-08:00","updated_at":"2025-11-04T11:23:13.683213-08:00","closed_at":"2025-11-04T11:23:13.683213-08:00"} +{"id":"bd-6545","title":"Update daemon commit logic for separate branch","description":"Modify daemon to use worktree for commits when sync.branch configured.\n\nTasks:\n- Update internal/daemon/server_export_import_auto.go\n- Detect sync.branch configuration\n- Ensure worktree exists before commit\n- Sync JSONL to worktree\n- Commit in worktree context\n- Push to configured branch\n- Fallback to current behavior if sync.branch not set\n- Handle git errors (network, permissions, conflicts)\n\nEstimated effort: 3-4 days","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.598861-08:00","updated_at":"2025-11-04T11:10:23.531964-08:00","closed_at":"2025-11-04T11:10:23.531966-08:00","dependencies":[{"issue_id":"bd-6545","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.375661-08:00","created_by":"stevey"}]} +{"id":"bd-zwtq","title":"Run bd doctor at end of bd init to verify setup","description":"Run bd doctor diagnostics at end of bd init (after line 398 in init.go). If issues found, warn user immediately: '⚠ Setup incomplete. Run bd doctor --fix to complete setup.' Catches configuration problems before user encounters them in normal workflow.","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-21T23:16:09.596778-08:00","updated_at":"2025-11-21T23:16:27.781976-08:00","dependencies":[{"issue_id":"bd-zwtq","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:09.597617-08:00","created_by":"daemon"}]} +{"id":"bd-06aec0c3","title":"Integration Testing","description":"Verify cache removal doesn't break any workflows","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T10:50:15.126668-07:00","updated_at":"2025-10-30T17:12:58.217214-07:00","closed_at":"2025-10-28T10:49:20.471129-07:00"} +{"id":"bd-7fe8","title":"Fix linting error in migrate.go","description":"Linter reports error:\n```\ncmd/bd/migrate.go:647:37: cleanupWALFiles - result 0 (error) is always nil (unparam)\n```\n\nThe `cleanupWALFiles` function always returns nil, so the error return type should be removed or the function should actually return errors when appropriate.","status":"closed","priority":2,"issue_type":"chore","created_at":"2025-11-02T09:29:37.279747-08:00","updated_at":"2025-11-02T09:46:52.18793-08:00","closed_at":"2025-11-02T09:46:52.18793-08:00","dependencies":[{"issue_id":"bd-7fe8","depends_on_id":"bd-1231","type":"blocks","created_at":"2025-11-02T09:29:37.280881-08:00","created_by":"stevey"}]} +{"id":"bd-85487065","title":"Add tests for internal/autoimport package","description":"Currently 0.0% coverage. Need tests for auto-import functionality that detects and imports updated JSONL files.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:18.154805-07:00","updated_at":"2025-11-08T22:42:08.862467-08:00","closed_at":"2025-11-08T18:06:25.811317-08:00"} +{"id":"bd-cbed9619.2","title":"Implement content-first idempotent import","description":"## Overview\nPhase 4: Refactor import to be content-first and idempotent, ensuring importing same JSONL multiple times always converges correctly.\n\n## Current Problem\nCurrent import is ID-first:\n1. Look up by ID\n2. If exists, update\n3. If not exists, create\n\nThis causes issues when:\n- Same content arrives with different IDs (renames not detected)\n- Multiple rounds of import needed for convergence\n- Import order affects final state\n\n## Solution\nMake import content-first and idempotent:\n1. Hash all incoming and existing issues\n2. Match by content hash first (detect renames)\n3. Handle ID conflicts second (using global resolution)\n4. Ensure importing same data multiple times = no-op\n\n## Implementation Tasks\n\n### 1. Refactor ImportIssues to be content-first\nFile: internal/importer/importer.go\n\n```go\nfunc ImportIssues(ctx context.Context, dbPath string, store storage.Storage, \n issues []*types.Issue, opts Options) (*Result, error) {\n \n result := \u0026Result{...}\n \n sqliteStore, needCloseStore, err := getOrCreateStore(ctx, dbPath, store)\n if err != nil {\n return nil, err\n }\n if needCloseStore {\n defer func() { _ = sqliteStore.Close() }()\n }\n \n // Phase 1: Compute content hashes for all incoming issues\n for _, issue := range issues {\n issue.ContentHash = issue.ComputeContentHash()\n }\n \n // Phase 2: Build content hash maps\n incomingByHash := buildHashMap(issues)\n dbIssues, _ := sqliteStore.SearchIssues(ctx, \"\", types.IssueFilter{})\n dbByHash := buildHashMap(dbIssues)\n dbByID := buildIDMap(dbIssues)\n \n // Phase 3: Content-first matching\n var newIssues []*types.Issue\n var idConflicts []*CollisionDetail\n \n for hash, incoming := range incomingByHash {\n if existing, found := dbByHash[hash]; found {\n // Same content exists\n if existing.ID == incoming.ID {\n // Exact match - idempotent case\n result.Unchanged++\n } else {\n // Same content, different ID - rename detected\n // Delete old ID, keep new ID (incoming is canonical)\n if err := handleRename(ctx, sqliteStore, existing, incoming); err != nil {\n return nil, err\n }\n result.Updated++\n }\n } else {\n // New content - check for ID collision\n if existingWithID, found := dbByID[incoming.ID]; found {\n // ID exists but different content - collision\n idConflicts = append(idConflicts, \u0026CollisionDetail{\n ID: incoming.ID,\n IncomingIssue: incoming,\n ExistingIssue: existingWithID,\n })\n } else {\n // Truly new issue\n newIssues = append(newIssues, incoming)\n }\n }\n }\n \n // Phase 4: Resolve ID conflicts using global algorithm\n if len(idConflicts) \u003e 0 {\n if !opts.ResolveCollisions {\n return nil, fmt.Errorf(\"collision detected\")\n }\n \n idMapping, err := sqlite.ResolveNWayCollisions(ctx, sqliteStore, \n idConflicts, issues)\n if err != nil {\n return nil, err\n }\n \n if err := applyIDMapping(ctx, sqliteStore, idMapping); err != nil {\n return nil, err\n }\n \n result.IDMapping = idMapping\n result.Collisions = len(idConflicts)\n }\n \n // Phase 5: Create new issues\n if len(newIssues) \u003e 0 {\n if err := sqliteStore.CreateIssues(ctx, newIssues, \"import\"); err != nil {\n return nil, err\n }\n result.Created = len(newIssues)\n }\n \n // Phase 6: Import dependencies, labels, comments (existing logic)\n // ...\n \n return result, nil\n}\n```\n\n### 2. Implement helper functions\n\n```go\n// buildHashMap creates a map of content hash β†’ issue\nfunc buildHashMap(issues []*types.Issue) map[string]*types.Issue {\n result := make(map[string]*types.Issue)\n for _, issue := range issues {\n result[issue.ContentHash] = issue\n }\n return result\n}\n\n// buildIDMap creates a map of ID β†’ issue\nfunc buildIDMap(issues []*types.Issue) map[string]*types.Issue {\n result := make(map[string]*types.Issue)\n for _, issue := range issues {\n result[issue.ID] = issue\n }\n return result\n}\n\n// handleRename handles content match with different IDs\nfunc handleRename(ctx context.Context, s *SQLiteStorage, \n existing *types.Issue, incoming *types.Issue) error {\n \n // Delete old ID\n if err := s.DeleteIssue(ctx, existing.ID); err != nil {\n return fmt.Errorf(\"failed to delete old ID %s: %w\", existing.ID, err)\n }\n \n // Create with new ID\n if err := s.CreateIssue(ctx, incoming, \"import-rename\"); err != nil {\n return fmt.Errorf(\"failed to create renamed issue %s: %w\", \n incoming.ID, err)\n }\n \n // Update references from old ID to new ID\n idMapping := map[string]string{existing.ID: incoming.ID}\n return updateReferences(ctx, s, idMapping)\n}\n```\n\n### 3. Add idempotency tests\n\nTest cases:\n1. Import same JSONL twice β†’ second import reports all Unchanged\n2. Import, modify DB, import again β†’ reports Updated\n3. Import with rename, import again β†’ idempotent\n4. Import with collision resolution, import again β†’ idempotent\n\n### 4. Update handleCollisions to use new flow\nCurrent handleCollisions in importer.go needs to be updated to:\n- Use content-first matching\n- Call new ResolveNWayCollisions\n- Apply results using ApplyCollisionResolution\n\n## Acceptance Criteria\n- Import matches by content hash before checking IDs\n- Importing same JSONL multiple times is idempotent (reports Unchanged)\n- Rename detection works (same content, different ID)\n- ID conflicts resolved using global algorithm\n- Result.Unchanged correctly tracks idempotent imports\n- TestThreeCloneCollision passes\n- All existing import tests still pass\n\n## Testing Strategy\n\n### Unit Tests\n- buildHashMap correctly indexes by content hash\n- buildIDMap correctly indexes by ID\n- handleRename deletes old, creates new, updates references\n\n### Integration Tests\n- Import same data twice β†’ idempotent\n- Import renamed issue β†’ handled correctly\n- Import with collision β†’ resolved globally\n- Final pull after 3-way collision β†’ all clones converge\n\n### Property Tests\n- Idempotency: Import(x); Import(x) ≑ Import(x)\n- Commutativity: Import(a); Import(b) ≑ Import(b); Import(a) (for non-colliding issues)\n- Convergence: After N rounds of sync, all clones identical\n\n## Files to Modify\n- internal/importer/importer.go (major refactor of ImportIssues)\n- internal/importer/importer_test.go (new tests)\n- cmd/bd/import_bug_test.go (update for new behavior)\n\n## Dependencies\n- Requires bd-cbed9619.5 (ContentHash field)\n- Requires bd-cbed9619.4 (read-only detection)\n- Requires bd-cbed9619.3 (global resolution)\n\n## Risk Mitigation\nMajor refactor of import logic. Recommend:\n1. Comprehensive tests before modifying\n2. Feature flag to enable/disable\n3. Keep old import code path for rollback\n4. Test with all existing import tests\n5. Manual testing with real repositories\n\n## Success Metrics\nAfter this phase:\n- TestThreeCloneCollision should PASS\n- All clones converge after final pull\n- Import is demonstrably idempotent\n- No data loss in N-way scenarios","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:38:25.671302-07:00","updated_at":"2025-10-30T17:12:58.229134-07:00","closed_at":"2025-10-28T20:21:39.529971-07:00","dependencies":[{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.616846-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-28T18:39:28.360026-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-28T18:39:28.383624-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.2","depends_on_id":"bd-cbed9619.3","type":"blocks","created_at":"2025-10-28T18:39:28.407157-07:00","created_by":"daemon"}]} +{"id":"bd-zwpw","title":"Test dependency child","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T11:23:05.998311-08:00","updated_at":"2025-11-05T11:23:30.389454-08:00","closed_at":"2025-11-05T11:23:30.389454-08:00","dependencies":[{"issue_id":"bd-zwpw","depends_on_id":"bd-k0j9","type":"blocks","created_at":"2025-11-05T11:23:05.998981-08:00","created_by":"daemon"}]} +{"id":"bd-1048","title":"Daemon crashes silently on RPC query after startup","description":"The daemon fails to handle 'show' RPC commands when:\n1) JSONL is newer than database (needs import)\n2) git pull fails due to uncommitted changes\n\nSymptoms:\n- Daemon appears to run (ps shows process)\n- 'bd list' and other commands work fine \n- 'bd show \u003cid\u003e' returns \"failed to read response: EOF\"\n- No panic or error logged in daemon.log\n\nRoot cause likely: auto-import deadlock or state corruption when import is blocked by git conflicts.\n\nWorkaround: \n- Restart daemon after syncing git state (commit/push changes)\n- OR use --no-daemon flag for all commands\n\nThe panic recovery added in server_lifecycle_conn.go:183 didn't catch any panics, confirming this isn't a panic-based crash.","notes":"Root cause found and fixed: Two bugs - (1) nil pointer check missing in handleShow causing panic, (2) double JSON encoding in show.go ID resolution. Both fixed. bd show now works with daemon.","status":"closed","issue_type":"bug","created_at":"2025-11-02T17:05:03.658333-08:00","updated_at":"2025-11-03T12:08:12.947672-08:00","closed_at":"2025-11-03T12:08:12.947676-08:00"} +{"id":"bd-b5a3","title":"Extract Daemon struct and config into internal/daemonrunner","description":"Create internal/daemonrunner with Config struct and Daemon struct. Move daemon runtime logic from cmd/bd/daemon.go Run function into Daemon.Start/Stop methods.","notes":"Refactoring complete! Created internal/daemonrunner package with:\n- Config struct (config.go)\n- Daemon struct with Start/Stop methods (daemon.go)\n- RPC server lifecycle (rpc.go)\n- Sync loop implementation (sync.go)\n- Git operations (git.go)\n- Process management (process.go, flock_*.go)\n- Logger setup (logger.go)\n- Platform-specific signal handling (signals_*.go)\n- Database fingerprint validation (fingerprint.go)\n\nBuild succeeds and most daemon tests pass. Import functionality still delegated to cmd/bd (marked with TODO(bd-b5a3)).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.843103-07:00","updated_at":"2025-11-01T20:23:46.475885-07:00","closed_at":"2025-11-01T20:23:46.475888-07:00"} +{"id":"bd-au0","title":"Command Set Standardization \u0026 Flag Consistency","description":"Comprehensive improvements to bd command set based on 2025 audit findings.\n\n## Background\nSee docs/command-audit-2025.md for detailed analysis.\n\n## Goals\n1. Standardize flag naming and behavior across all commands\n2. Add missing flags for feature parity\n3. Fix naming confusion\n4. Improve consistency in JSON output\n\n## Success Criteria\n- All mutating commands support --dry-run (no --preview variants)\n- bd update supports label operations\n- bd search has filter parity with bd list\n- Priority flags accept both int and P0-P4 format everywhere\n- JSON output is consistent across all commands","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-21T21:05:55.672749-05:00","updated_at":"2025-11-21T21:05:55.672749-05:00"} +{"id":"bd-7yg","title":"Git merge driver uses invalid placeholders (%L, %R instead of %A, %B)","description":"## Problem\n\nThe beads git merge driver is configured with invalid Git placeholders:\n\n```\ngit config merge.beads.driver \"bd merge %A %O %L %R\"\n```\n\nGit doesn't recognize `%L` or `%R` as valid merge driver placeholders. The valid placeholders are:\n- `%O` = base (common ancestor)\n- `%A` = current version (ours)\n- `%B` = other version (theirs)\n\n## Impact\n\n- Affects ALL users when they have `.beads/beads.jsonl` merge conflicts\n- Automatic JSONL merge fails with error: \"error reading left file: failed to open file: open 7: no such file or directory\"\n- Users must manually resolve conflicts instead of getting automatic merge\n\n## Root Cause\n\nThe `bd init` command (or wherever the merge driver is configured) is using non-standard placeholders. When Git encounters `%L` and `%R`, it either passes them literally or interprets them incorrectly.\n\n## Fix\n\nUpdate the merge driver configuration to:\n```\ngit config merge.beads.driver \"bd merge %A %O %A %B\"\n```\n\nWhere:\n- 1st `%A` = output file (current file, will be overwritten)\n- `%O` = base (common ancestor)\n- 2nd `%A` = left/current version\n- `%B` = right/other version\n\n## Action Items\n\n1. Fix `bd init` (or equivalent setup command) to use correct placeholders\n2. Add migration/warning for existing users with misconfigured merge driver\n3. Update documentation with correct merge driver setup\n4. Consider adding validation when `bd init` is run","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-21T19:51:55.747608-05:00","updated_at":"2025-11-21T19:51:55.747608-05:00"} +{"id":"bd-e05d","title":"Investigate and optimize test suite performance","description":"Test suite is taking very long to run (\u003e45s for cmd/bd tests, full suite timing unknown but was cancelled).\n\nThis impacts development velocity and CI/CD performance.\n\nInvestigation needed:\n- Profile which tests are slowest\n- Identify bottlenecks (disk I/O, network, excessive setup/teardown?)\n- Consider parallelization opportunities\n- Look for redundant test cases\n- Check if integration tests can be optimized","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T15:37:44.529955-08:00","updated_at":"2025-11-02T16:35:38.093133-08:00","closed_at":"2025-11-02T16:35:38.093137-08:00"} +{"id":"bd-hy9p","title":"Add --body-file flag to bd create for reading descriptions from files","description":"## Problem\n\nCreating issues with long/complex descriptions via CLI requires shell escaping gymnastics:\n\n```bash\n# Current workaround - awkward heredoc quoting\nbd create --title=\"...\" --description=\"$(cat \u003c\u003c'EOF'\n...markdown...\nEOF\n)\"\n\n# Often fails with quote escaping errors in eval context\n# Agents resort to writing temp files then reading them\n```\n\n## Proposed Solution\n\nAdd `--body-file` and `--description-file` flags to read description from a file, matching `gh` CLI pattern.\n\n```bash\n# Natural pattern that aligns with training data\ncat \u003e /tmp/desc.md \u003c\u003c 'EOF'\n...markdown content...\nEOF\n\nbd create --title=\"...\" --body-file=/tmp/desc.md\n```\n\n## Implementation\n\n### 1. Add new flags to `bd create`\n\n```go\ncreateCmd.Flags().String(\"body-file\", \"\", \"Read description from file (use - for stdin)\")\ncreateCmd.Flags().String(\"description-file\", \"\", \"Alias for --body-file\")\n```\n\n### 2. Flag precedence\n\n- If `--body-file` or `--description-file` is provided, read from file\n- If value is `-`, read from stdin\n- Otherwise fall back to `--body` or `--description` flag\n- If neither provided, description is empty (current behavior)\n\n### 3. Error handling\n\n- File doesn't exist β†’ clear error message\n- File not readable β†’ clear error message\n- stdin specified but not available β†’ clear error message\n\n## Benefits\n\nβœ… **Matches training data**: `gh issue create --body-file file.txt` is a common pattern\nβœ… **No shell escaping issues**: File content is read directly\nβœ… **Works with any content**: Markdown, special characters, quotes, etc.\nβœ… **Agent-friendly**: Agents already write complex content to temp files\nβœ… **User-friendly**: Easier for humans too when pasting long descriptions\n\n## Related Commands\n\nConsider adding similar support to:\n- `bd update --body-file` (for updating descriptions)\n- `bd comment --body-file` (if/when we add comments)\n\n## Examples\n\n```bash\n# From file\nbd create --title=\"Add new feature\" --body-file=feature.md\n\n# From stdin\necho \"Quick description\" | bd create --title=\"Bug fix\" --body-file=-\n\n# With other flags\nbd create \\\n --title=\"Security issue\" \\\n --type=bug \\\n --priority=0 \\\n --body-file=security-report.md \\\n --label=security\n```\n\n## Testing\n\n- Test with normal files\n- Test with stdin (`-`)\n- Test with non-existent files (error handling)\n- Test with binary files (should handle gracefully)\n- Test with empty files (valid - empty description)\n- Test that `--description-file` and `--body-file` are equivalent aliases","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-22T00:02:08.762684-08:00","updated_at":"2025-11-22T00:02:08.762684-08:00"} +{"id":"bd-au0.8","title":"Improve clean vs cleanup command naming/documentation","description":"Clarify the difference between bd clean and bd cleanup to reduce user confusion.\n\n**Current state:**\n- bd clean: Remove temporary artifacts (.beads/bd.sock, logs, etc.)\n- bd cleanup: Delete old closed issues from database\n\n**Options:**\n1. Rename for clarity:\n - bd clean β†’ bd clean-temp\n - bd cleanup β†’ bd cleanup-issues\n \n2. Keep names but improve help text and documentation\n\n3. Add prominent warnings in help output\n\n**Preferred approach:** Option 2 (improve documentation)\n- Update short/long descriptions in commands\n- Add examples to help text\n- Update README.md\n- Add cross-references in help output\n\n**Files to modify:**\n- cmd/bd/clean.go\n- cmd/bd/cleanup.go\n- README.md or ADVANCED.md","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-21T21:07:49.960534-05:00","updated_at":"2025-11-21T21:07:49.960534-05:00","dependencies":[{"issue_id":"bd-au0.8","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:49.962743-05:00","created_by":"daemon"}]} +{"id":"bd-942469b8","title":"Rapid 5","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.508166-07:00","updated_at":"2025-11-07T23:21:44.924708-08:00","closed_at":"2025-11-07T23:18:52.298739-08:00"} +{"id":"bd-3396","title":"Add merge helper commands (bd sync --merge)","description":"Add commands to merge beads branch back to main.\n\nTasks:\n- Implement bd sync --merge command\n- Implement bd sync --status command\n- Implement bd sync --auto-merge (optional, for automation)\n- Detect merge conflicts and provide guidance\n- Show commit diff between branches\n- Verify main branch is clean before merge\n- Push merged changes to remote\n\nEstimated effort: 2-3 days","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.580873-08:00","updated_at":"2025-11-02T17:12:34.620481-08:00","closed_at":"2025-11-02T17:12:34.620486-08:00","dependencies":[{"issue_id":"bd-3396","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.376916-08:00","created_by":"stevey"}]} +{"id":"bd-9e23","title":"Optimize Memory backend GetIssueByExternalRef with index","description":"Currently GetIssueByExternalRef in Memory storage uses O(n) linear search through all issues.\n\nCurrent code (memory.go:282-308):\nfor _, issue := range m.issues {\n if issue.ExternalRef != nil \u0026\u0026 *issue.ExternalRef == externalRef {\n return \u0026issueCopy, nil\n }\n}\n\nProposed optimization:\n- Add externalRefToID map[string]string to MemoryStorage\n- Maintain it in CreateIssue, UpdateIssue, DeleteIssue\n- Achieve O(1) lookup like SQLite's index\n\nImpact: Low (--no-db mode typically has smaller datasets)\nRelated: bd-1022","status":"open","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:30.242357-08:00","updated_at":"2025-11-02T15:32:30.242357-08:00"} +{"id":"bd-nbc","title":"Add security tests for file path validation in clean command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/clean.go:118, os.Open(gitignorePath) is flagged by gosec G304 for potential file inclusion via variable without validation.\n\nAdd tests covering:\n- Path traversal attempts (../../etc/passwd)\n- Absolute paths outside project directory\n- Symlink following behavior\n- Non-existent file handling\n- Validation that only .gitignore files in valid locations are opened\n\nThis is a security-sensitive code path that needs validation to prevent unauthorized file access.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-21T10:25:33.526884-05:00","updated_at":"2025-11-23T18:06:29.85849-08:00","closed_at":"2025-11-21T19:31:21.864673-05:00","dependencies":[{"issue_id":"bd-nbc","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.528582-05:00","created_by":"ai-supervisor"}]} +{"id":"bd-j3zt","title":"Fix mypy errors in beads-mcp","description":"Running `mypy .` in `integrations/beads-mcp` reports 287 errors. These should be addressed to improve type safety and code quality.","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-20T18:53:28.557708-05:00","updated_at":"2025-11-20T18:53:28.557708-05:00"} +{"id":"bd-0dcea000","title":"Add tests for internal/importer package","description":"Currently 0.0% coverage. Need tests for JSONL import logic including collision detection and resolution.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:21.071024-07:00","updated_at":"2025-11-08T22:42:08.859374-08:00","closed_at":"2025-11-08T18:06:20.150657-08:00","dependencies":[{"issue_id":"bd-0dcea000","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-29T19:52:05.531279-07:00","created_by":"import-remap"},{"issue_id":"bd-0dcea000","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-29T19:52:05.53166-07:00","created_by":"import-remap"}]} +{"id":"bd-p3b0.1","title":"Fix variable shadowing in upgradeAckCmd","status":"closed","issue_type":"bug","created_at":"2025-11-23T17:12:26.745382-08:00","updated_at":"2025-11-23T17:12:57.792344-08:00","closed_at":"2025-11-23T17:12:57.792344-08:00","dependencies":[{"issue_id":"bd-p3b0.1","depends_on_id":"bd-p3b0","type":"parent-child","created_at":"2025-11-23T17:12:26.74595-08:00","created_by":"daemon"}]} +{"id":"bd-17fa2d21","title":"Batch test 2","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:29:01.877052-07:00","updated_at":"2025-10-31T12:00:43.183657-07:00","closed_at":"2025-10-31T12:00:43.183657-07:00"} +{"id":"bd-cb64c226.10","title":"Delete server_cache_storage.go","description":"Remove the entire cache implementation file (~286 lines)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:38.729299-07:00","updated_at":"2025-10-30T17:12:58.212391-07:00","closed_at":"2025-10-28T14:08:38.064592-07:00"} +{"id":"bd-ut5","title":"Test label update feature","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-21T22:07:25.488849-05:00","updated_at":"2025-11-21T22:07:25.488849-05:00"} +{"id":"bd-ar2.7","title":"Add edge case tests for GetNextChildID parent resurrection","description":"## Current Coverage\nTestGetNextChildID_ResurrectParent tests happy path only:\n- Parent exists in JSONL\n- Resurrection succeeds\n\n## Missing Test Cases\n\n### 1. Parent Not in JSONL\n- Parent doesn't exist in DB\n- Parent doesn't exist in JSONL either\n- Should return: \"could not be resurrected from JSONL history\"\n\n### 2. JSONL File Missing\n- Parent doesn't exist in DB\n- No issues.jsonl file exists\n- Should handle gracefully\n\n### 3. Malformed JSONL\n- Parent doesn't exist in DB\n- JSONL file exists but has invalid JSON\n- Should skip bad lines, continue searching\n\n### 4. Concurrent Resurrections\n- Multiple goroutines call GetNextChildID with same parent\n- Only one should resurrect, others should succeed\n- Test for race conditions\n\n### 5. Deeply Nested Missing Parents\n- Creating bd-abc.1.2.1 where:\n - bd-abc exists\n - bd-abc.1 missing (should fail with current fix)\n- Related to bd-ar2.4\n\n### 6. Content Hash Mismatch\n- Parent in JSONL has different content_hash than expected\n- Should still resurrect (content_hash is for integrity, not identity)\n\n## Files\n- internal/storage/sqlite/child_id_test.go\n\n## Implementation\n```go\nfunc TestGetNextChildID_ResurrectParent_NotInJSONL(t *testing.T) { ... }\nfunc TestGetNextChildID_ResurrectParent_NoJSONL(t *testing.T) { ... }\nfunc TestGetNextChildID_ResurrectParent_MalformedJSONL(t *testing.T) { ... }\nfunc TestGetNextChildID_ResurrectParent_Concurrent(t *testing.T) { ... }\n```","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:25:46.661849-05:00","updated_at":"2025-11-22T17:48:48.070745-08:00","closed_at":"2025-11-21T11:40:47.686231-05:00","dependencies":[{"issue_id":"bd-ar2.7","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:46.66235-05:00","created_by":"daemon"}]} +{"id":"bd-e55c","title":"Import overwrites newer local issues with older remote versions","description":"## Problem\n\nDuring git pull + import, local issues with newer updated_at timestamps get overwritten by older versions from remote JSONL.\n\n## What Happened\n\nTimeline:\n1. 17:52 - Closed bd-df190564 and bd-b501fcc1 locally (updated_at: 2025-10-31)\n2. 17:51 - Remote pushed same issues with status=open (updated_at: 2025-10-30)\n3. 17:52 - Local sync pulled remote commit and imported JSONL\n4. Result: Issues reverted to open despite local version being newer\n\n## Root Cause\n\nDetectCollisions (internal/storage/sqlite/collision.go:67-79) compares fields but doesn't check timestamps:\n\n```go\nconflictingFields := compareIssues(existing, incoming)\nif len(conflictingFields) == 0 {\n result.ExactMatches = append(result.ExactMatches, incoming.ID)\n} else {\n // Same ID, different content - treats as UPDATE\n result.Collisions = append(result.Collisions, \u0026CollisionDetail{...})\n}\n```\n\nImport applies incoming version regardless of which is newer.\n\n## Expected Behavior\n\nImport should:\n1. Compare updated_at timestamps when collision detected\n2. Skip update if local version is newer\n3. Apply update only if remote version is newer\n4. Warn on timestamp conflicts\n\n## Solution\n\nAdd timestamp checking to DetectCollisions or importIssues:\n\n```go\nif len(conflictingFields) \u003e 0 {\n // Check timestamps\n if !incoming.UpdatedAt.After(existing.UpdatedAt) {\n // Local is newer or same - skip update\n result.ExactMatches = append(result.ExactMatches, incoming.ID)\n continue\n }\n // Remote is newer - apply update\n result.Collisions = append(result.Collisions, \u0026CollisionDetail{...})\n}\n```\n\n## Files\n- internal/storage/sqlite/collision.go\n- internal/importer/importer.go\n\n## References\n- Discovered during bd-df190564, bd-b501fcc1 re-opening","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-31T17:56:43.919306-07:00","updated_at":"2025-10-31T18:05:55.521427-07:00","closed_at":"2025-10-31T18:05:55.521427-07:00"} +{"id":"bd-ggbc","title":"Update documentation for merge driver auto-config","description":"Update documentation to reflect the new merge driver auto-configuration during `bd init`.\n\n**Files to update:**\n- README.md - Mention merge driver setup in initialization section\n- AGENTS.md - Update onboarding section about merge driver\n- Possibly QUICKSTART.md\n\n**Content:**\n- Explain what the merge driver does\n- Show --skip-merge-driver flag usage\n- Manual installation steps for post-init setup","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T19:27:04.155662-08:00","updated_at":"2025-11-05T19:29:55.188122-08:00","closed_at":"2025-11-05T19:29:55.188122-08:00","dependencies":[{"issue_id":"bd-ggbc","depends_on_id":"bd-32nm","type":"discovered-from","created_at":"2025-11-05T19:27:04.156491-08:00","created_by":"daemon"}]} +{"id":"bd-31aab707","title":"Unit tests for FileWatcher","description":"Test watcher detects JSONL changes. Test git ref changes trigger import. Test debounce integration. Test watcher recovery from file removal/rename.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T11:30:59.842317-07:00","updated_at":"2025-10-31T12:00:43.189591-07:00","closed_at":"2025-10-31T12:00:43.189591-07:00"} +{"id":"bd-poh9","title":"Complete and commit beads-mcp type safety improvements","description":"Uncommitted type safety work in beads-mcp needs review and completion","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:23:32.8516-05:00","updated_at":"2025-11-20T19:27:00.88849-05:00","closed_at":"2025-11-20T19:27:00.88849-05:00"} +{"id":"bd-4462","title":"Test basic bd commands in WASM (init, create, list)","description":"Compile and verify basic bd functionality works in WASM:\n- Test bd init --quiet\n- Test bd create with simple issue\n- Test bd list --json output\n- Verify SQLite database creation and queries work\n- Document any runtime issues or workarounds needed","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.291771-08:00","updated_at":"2025-11-02T23:07:10.273212-08:00","closed_at":"2025-11-02T23:07:10.273212-08:00","dependencies":[{"issue_id":"bd-4462","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.448668-08:00","created_by":"stevey"},{"issue_id":"bd-4462","depends_on_id":"bd-b4b0","type":"blocks","created_at":"2025-11-02T22:23:55.596771-08:00","created_by":"stevey"}]} +{"id":"bd-2b34.4","title":"Extract daemon config functions to daemon_config.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.349237-07:00","updated_at":"2025-11-01T21:02:58.361676-07:00","closed_at":"2025-11-01T21:02:58.361676-07:00"} +{"id":"bd-a557","title":"Issue 1 to reopen","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.753517-05:00","updated_at":"2025-11-20T19:43:48.753517-05:00","closed_at":"2025-11-07T21:57:59.910467-08:00"} +{"id":"bd-e0o","title":"Phase 3: Enhance daemon robustness for GH #353","description":"Improve daemon health checks and metadata refresh to prevent staleness issues.\n\n**Tasks:**\n1. Enhance daemon health checks to detect unreachable daemons\n2. Add daemon metadata refresh (check disk every 5s)\n3. Comprehensive testing in sandbox environments\n\n**Implementation:**\n- cmd/bd/main.go: Better health check error handling (lines 300-367)\n- cmd/bd/daemon_event_loop.go: Periodic metadata refresh\n- cmd/bd/daemon_unix.go: Permission-aware process checks\n\n**References:**\n- docs/GH353_INVESTIGATION.md (Solutions 4 \u0026 5, lines 161-209)\n- Depends on: Phase 2 (bd-u3t)\n\n**Acceptance Criteria:**\n- Daemon detects when it's unreachable and auto-switches to direct mode\n- Daemon picks up external import operations without restart\n- All edge cases handled gracefully","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T18:52:13.376092-05:00","updated_at":"2025-11-22T17:48:48.073222-08:00","closed_at":"2025-11-21T19:31:42.718395-05:00"} +{"id":"bd-0650a73b","title":"Create cmd/bd/daemon_debouncer.go (~60 LOC)","description":"Implement Debouncer to batch rapid events into single action. Default 500ms, configurable via BEADS_DEBOUNCE_MS. Thread-safe with mutex.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.431118-07:00","updated_at":"2025-10-30T17:12:58.221711-07:00","closed_at":"2025-10-28T12:03:35.614191-07:00"} +{"id":"bd-f8b764c9.8","title":"Update JSONL format to use hash IDs","description":"Update JSONL import/export to use hash IDs, store aliases separately.\n\n## Current JSONL Format\n```jsonl\n{\"id\":\"bd-1c63eb84\",\"title\":\"Fix bug\",\"status\":\"open\",...}\n{\"id\":\"bd-9063acda\",\"title\":\"Add test\",\"status\":\"open\",...}\n```\n\n## New JSONL Format (Option A: Include Alias)\n```jsonl\n{\"id\":\"bd-af78e9a2\",\"alias\":1,\"title\":\"Fix bug\",\"status\":\"open\",...}\n{\"id\":\"bd-e5f6a7b8\",\"alias\":2,\"title\":\"Add test\",\"status\":\"open\",...}\n```\n\n## New JSONL Format (Option B: Hash ID Only)\n```jsonl\n{\"id\":\"bd-af78e9a2\",\"title\":\"Fix bug\",\"status\":\"open\",...}\n{\"id\":\"bd-e5f6a7b8\",\"title\":\"Add test\",\"status\":\"open\",...}\n```\n\nStore aliases in separate .beads/aliases.jsonl (local only, git-ignored):\n```jsonl\n{\"hash\":\"bd-af78e9a2\",\"alias\":1}\n{\"hash\":\"bd-e5f6a7b8\",\"alias\":2}\n```\n\n**Recommendation**: Option B (hash only in main JSONL)\n- Cleaner git diffs (no alias conflicts)\n- Aliases are workspace-local preference\n- Main JSONL is canonical, portable\n\n## Export Changes\nFile: cmd/bd/export.go\n```go\n// Export issues with hash IDs\nfor _, issue := range issues {\n json := marshalIssue(issue) // Uses issue.ID (hash)\n // Don't include alias in JSONL\n}\n\n// Separately export aliases to .beads/aliases.jsonl\nexportAliases(issues)\n```\n\n## Import Changes \nFile: cmd/bd/import.go, internal/importer/importer.go\n```go\n// Import issues by hash ID\nissue := unmarshalIssue(line)\n// Assign new alias on import (don't use incoming alias)\nissue.Alias = getNextAlias()\n\n// No collision detection needed! Hash IDs are globally unique\n```\n\n## Dependency Reference Format\nNo change needed - already uses issue IDs:\n```json\n{\"depends_on_id\":\"bd-af78e9a2\",\"type\":\"blocks\"}\n```\n\n## Files to Modify\n- cmd/bd/export.go (use hash IDs)\n- cmd/bd/import.go (import hash IDs, assign aliases)\n- internal/importer/importer.go (remove collision detection!)\n- .gitignore (add .beads/aliases.jsonl)\n\n## Testing\n- Test export produces hash IDs\n- Test import assigns new aliases\n- Test dependencies preserved with hash IDs\n- Test no collision detection triggered","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:47.408106-07:00","updated_at":"2025-10-31T12:32:32.609925-07:00","closed_at":"2025-10-31T12:32:32.609925-07:00","dependencies":[{"issue_id":"bd-f8b764c9.8","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:47.409489-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.8","depends_on_id":"bd-f8b764c9.9","type":"blocks","created_at":"2025-10-29T21:24:47.409977-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.8","depends_on_id":"bd-f8b764c9.10","type":"blocks","created_at":"2025-10-29T21:29:45.975499-07:00","created_by":"stevey"}]} +{"id":"bd-m62x","title":"Benchmark Suite for Critical Operations","description":"Extend existing benchmark suite with comprehensive benchmarks for critical operations at 10K-20K scale.\n\nExisting benchmarks (keep these):\n- cycle_bench_test.go - Cycle detection up to 5K issues (linear, tree, dense graphs)\n- compact_bench_test.go - Compaction candidate queries (100 issues)\n- internal/rpc/bench_test.go - Daemon vs direct mode comparison\n\nNew benchmarks to add in sqlite_bench_test.go (~10-12 total):\n1. GetReadyWork - Simple, deep hierarchies, cross-linked (CRITICAL - not currently benchmarked)\n2. SearchIssues - No filters, complex filters (CRITICAL - not currently benchmarked)\n3. CreateIssue - Single issue creation\n4. UpdateIssue - Status/priority/assignee changes\n5. AddDependency - Extend to 10K/20K scale (currently only up to 5K)\n6. JSONL Export - Full export performance\n7. JSONL Import - Import performance\n\nScale levels:\n- Large: 10K issues (5K open, 5K closed)\n- XLarge: 20K issues (10K open, 10K closed)\n\nImplementation:\n- NEW FILE: internal/storage/sqlite/sqlite_bench_test.go\n- Keep existing cycle_bench_test.go and compact_bench_test.go unchanged\n- Build tag: //go:build bench\n- Standard testing.B benchmarks\n- b.ReportAllocs() for memory tracking\n- Test both SQLite and JSONL-imported databases\n\nAlways generates CPU and memory profiles for analysis.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-13T22:22:43.770787-08:00","updated_at":"2025-11-13T23:15:33.781023-08:00","closed_at":"2025-11-13T23:15:33.781023-08:00","dependencies":[{"issue_id":"bd-m62x","depends_on_id":"bd-q13h","type":"blocks","created_at":"2025-11-13T22:24:02.668091-08:00","created_by":"daemon"},{"issue_id":"bd-m62x","depends_on_id":"bd-zj8e","type":"blocks","created_at":"2025-11-13T22:24:06.30131-08:00","created_by":"daemon"}]} +{"id":"bd-rpn","title":"Implement `bd prime` command for AI context loading","description":"Create a `bd prime` command that outputs AI-optimized markdown containing essential Beads workflow context. This provides an alternative to the MCP server for token-conscious users and enables context recovery after compaction/clearing.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-11T23:28:42.74124-08:00","updated_at":"2025-11-12T08:30:15.711595-08:00","closed_at":"2025-11-12T08:30:15.711595-08:00","dependencies":[{"issue_id":"bd-rpn","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:20.357861-08:00","created_by":"daemon"}]} +{"id":"bd-63e9","title":"Fix Nix flake build test failures","description":"Nix build is failing during test phase with same test errors as Windows.\n\n**Error:**\n```\nerror: Cannot build '/nix/store/rgyi1j44dm6ylrzlg2h3z97axmfq9hzr-beads-0.9.9.drv'.\nReason: builder failed with exit code 1.\nFAIL github.com/steveyegge/beads/cmd/bd 16.141s\n```\n\nThis may be related to test environment setup or the same issues affecting Windows tests.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-02T09:29:37.2851-08:00","updated_at":"2025-11-04T11:10:23.531386-08:00","closed_at":"2025-11-04T11:10:23.531389-08:00","dependencies":[{"issue_id":"bd-63e9","depends_on_id":"bd-1231","type":"blocks","created_at":"2025-11-02T09:29:37.28618-08:00","created_by":"stevey"}]} +{"id":"bd-fasa","title":"Prefix detection treats embedded hyphens as prefix delimiters","description":"The prefix detection logic in bd import incorrectly identifies issues like 'vc-baseline-test' and 'vc-92cl-gate-test' as having different prefixes ('vc-baseline-' and 'vc-92cl-gate-') instead of recognizing them as having the standard 'vc-' prefix with hyphenated suffixes.\n\nThis breaks import with error: 'prefix mismatch detected: database uses vc- but found issues with prefixes: [vc-92cl-gate- (1 issues) vc-baseline- (1 issues)]'\n\nThe prefix should be determined by the pattern: prefix is everything up to and including the first hyphen. The suffix can contain hyphens without being treated as part of the prefix.\n\nExample problematic IDs:\n- vc-baseline-test (detected as prefix: vc-baseline-)\n- vc-92cl-gate-test (detected as prefix: vc-92cl-gate-)\n- vc-test (correctly detected as prefix: vc-)\n\nImpact: Users cannot use descriptive multi-part IDs without triggering false prefix mismatch errors.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-09T14:27:19.046489-08:00","updated_at":"2025-11-09T14:53:53.22312-08:00","closed_at":"2025-11-09T14:53:53.22312-08:00"} +{"id":"bd-5ce8","title":"Document protected branch workflow","description":"Create comprehensive documentation for protected branch workflow.\n\nTasks:\n- Add \"Protected Branch Workflow\" section to AGENTS.md\n- Create docs/PROTECTED_BRANCHES.md guide\n- Update README.md quick start\n- Add examples to examples/protected-branch/\n- Update bd init --help documentation\n- Add troubleshooting guide\n- Add migration guide for existing users\n- Record demo video (optional)\n\nEstimated effort: 2-3 days","notes":"Completed protected branch workflow documentation. Created comprehensive guide (docs/PROTECTED_BRANCHES.md), updated AGENTS.md with workflow section, added feature to README.md, and created working example (examples/protected-branch/). All commands verified working (bd init --branch, bd sync --status, bd sync --merge, bd config get/set sync.branch).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.59013-08:00","updated_at":"2025-11-04T11:10:23.530618-08:00","closed_at":"2025-11-04T11:10:23.530621-08:00","dependencies":[{"issue_id":"bd-5ce8","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.379767-08:00","created_by":"stevey"}]} +{"id":"bd-zo7o","title":"Create multi-agent race condition test","description":"Automated test that runs 2+ agents simultaneously to verify collision prevention.\n\nAcceptance Criteria:\n- Script spawns 2 agents in parallel\n- Both try to claim same issue\n- Only one succeeds (via reservation)\n- Other agent skips to different work\n- Verify in JSONL that no duplicate claims\n- Test with Agent Mail enabled/disabled\n\nFile: tests/integration/test_agent_race.py\n\nSuccess Metric: Zero duplicate claims with Agent Mail, collisions without it","status":"closed","issue_type":"task","created_at":"2025-11-07T22:43:21.360663-08:00","updated_at":"2025-11-08T00:34:14.40119-08:00","closed_at":"2025-11-08T00:34:14.40119-08:00","dependencies":[{"issue_id":"bd-zo7o","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:43:21.361571-08:00","created_by":"daemon"}]} +{"id":"bd-197b","title":"Set up WASM build pipeline","description":"Configure Goβ†’WASM compilation pipeline. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Create build-wasm.sh script (GOOS=js GOARCH=wasm)\n- [ ] Test basic WASM module loading in Node.js\n- [ ] Set up wasm_exec.js wrapper\n- [ ] Add WASM build to CI/CD\n- [ ] Document build process\n\n## Validation\n- bd.wasm compiles successfully\n- Can load in Node.js without errors\n- Bundle size \u003c10MB","status":"closed","issue_type":"task","created_at":"2025-11-02T18:33:19.407373-08:00","updated_at":"2025-11-05T00:55:48.755936-08:00","closed_at":"2025-11-05T00:55:48.755941-08:00","dependencies":[{"issue_id":"bd-197b","depends_on_id":"bd-44d0","type":"blocks","created_at":"2025-11-02T18:33:19.407904-08:00","created_by":"daemon"}]} +{"id":"bd-fc2d","title":"Refactor sqlite.go (2298 lines)","description":"Break down internal/storage/sqlite/sqlite.go into smaller, more focused modules. The file is currently 2298 lines and should be split into logical components.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-01T19:28:40.899111-07:00","updated_at":"2025-11-01T22:21:01.729379-07:00","closed_at":"2025-11-01T22:21:01.729379-07:00"} +{"id":"bd-ar2.6","title":"Add transaction boundaries for export metadata updates","description":"## Problem\nMetadata updates happen after export, but there's no transaction ensuring atomicity between:\n1. JSONL file write (exportToJSONLWithStore)\n2. Metadata update (updateExportMetadata)\n3. Database mtime update (TouchDatabaseFile)\n\nIf process crashes between these steps, metadata will be inconsistent.\n\n## Example Failure Scenario\n```\n1. Export to JSONL succeeds\n2. [CRASH] Process killed before metadata update\n3. Next export: \"JSONL content has changed\" error\n4. User must run import to fix metadata\n```\n\n## Options\n\n### Option 1: Tolerate Inconsistency (Current)\n- Simple, no code changes\n- Safe (worst case: need import before next export)\n- Annoying for users if crashes are frequent\n\n### Option 2: Add Write-Ahead Log\n- Write metadata intent to temp file\n- Complete operations\n- Clean up temp file\n- More complex, better guarantees\n\n### Option 3: Store Metadata in JSONL Comments\n- Add metadata as JSON comment in JSONL file\n- Single atomic write\n- Requires JSONL format change\n\n### Option 4: Defensive Checks\n- On startup, verify metadata matches JSONL\n- Auto-fix if mismatch detected\n- Simplest improvement\n\n## Recommendation\nStart with Option 4 (defensive checks), consider others if needed.\n\n## Files\n- cmd/bd/daemon_sync.go\n- Possibly: cmd/bd/main.go (startup checks)\n\n## Related\nThis is lower priority - current behavior is safe, just not ideal","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:32.469469-05:00","updated_at":"2025-11-22T17:48:48.07026-08:00","closed_at":"2025-11-21T11:40:47.685571-05:00","dependencies":[{"issue_id":"bd-ar2.6","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:25:32.470004-05:00","created_by":"daemon"}]} +{"id":"bd-vavh","title":"Fix row iterator resource leak in recursive dependency queries","description":"Critical resource leak in findAllDependentsRecursive() where rows.Close() is called AFTER early return on error, never executing.\n\nLocation: internal/storage/sqlite/sqlite.go:1131-1136\n\nProblem: \n- rows.Close() placed after return statement\n- On scan error, iterator never closed\n- Can exhaust SQLite connections under moderate load\n\nFix: Move defer rows.Close() to execute on all code paths\n\nImpact: Connection exhaustion during dependency traversal","status":"closed","issue_type":"bug","created_at":"2025-11-16T14:50:55.881698-08:00","updated_at":"2025-11-16T15:03:55.009607-08:00","closed_at":"2025-11-16T15:03:55.009607-08:00"} +{"id":"bd-ar2.3","title":"Fix TestExportUpdatesMetadata to test actual daemon functions","description":"## Problem\nTestExportUpdatesMetadata (daemon_sync_test.go:296) manually replicates the metadata update logic rather than calling the fixed functions (createExportFunc/createSyncFunc).\n\nThis means:\n- Test verifies the CONCEPT works\n- But doesn't verify the IMPLEMENTATION in the actual daemon functions\n- If daemon code is wrong, test still passes\n\n## Current Test Flow\n```go\n// Test does:\nexportToJSONLWithStore() // ← Direct call\n// ... manual metadata update ...\nexportToJSONLWithStore() // ← Direct call again\n```\n\n## Should Be\n```go\n// Test should:\ncreateExportFunc(...)() // ← Call actual daemon function\n// ... verify metadata was updated by the function ...\ncreateExportFunc(...)() // ← Call again, should not fail\n```\n\n## Challenge\ncreateExportFunc returns a closure that's run by the daemon. Testing this requires:\n- Mock logger\n- Proper context setup\n- Git operations might need mocking\n\n## Files\n- cmd/bd/daemon_sync_test.go\n\n## Acceptance Criteria\n- Test calls actual createExportFunc and createSyncFunc\n- Test verifies metadata updated by daemon code, not test code\n- Both functions tested (export and sync)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:24:46.756315-05:00","updated_at":"2025-11-22T17:48:48.068767-08:00","closed_at":"2025-11-21T11:07:25.321289-05:00","dependencies":[{"issue_id":"bd-ar2.3","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:24:46.757622-05:00","created_by":"daemon"}]} +{"id":"bd-jijf","title":"Fix: --parent flag doesn't create parent-child dependency","description":"When using `bd create --parent \u003cid\u003e`, the code generates a hierarchical child ID (e.g., bd-123.1) but never creates a parent-child dependency. This causes `bd epic status` to show zero children even though child issues exist.\n\nRoot cause: create.go generates child ID using store.GetNextChildID() but never calls store.AddDependency() with type parent-child.\n\nFix: After creating the issue when parentID is set, automatically add a parent-child dependency linking child -\u003e parent.","status":"closed","issue_type":"bug","created_at":"2025-11-15T13:15:22.138854-08:00","updated_at":"2025-11-15T13:18:29.301788-08:00","closed_at":"2025-11-15T13:18:29.301788-08:00"} +{"id":"bd-d76d","title":"Modify EnsureIDs to support parent resurrection","description":"Update internal/storage/sqlite/ids.go:189-202 to call TryResurrectParent before failing on missing parent. Add resurrection mode flag, log resurrected parents for transparency. Maintain backwards compatibility with strict validation mode.","status":"closed","issue_type":"task","created_at":"2025-11-04T12:31:59.659507-08:00","updated_at":"2025-11-05T00:08:42.814463-08:00","closed_at":"2025-11-05T00:08:42.814466-08:00"} +{"id":"bd-f8b764c9.1","title":"Dogfood: Migrate beads repo to hash IDs","description":"Final validation: migrate the beads project itself to hash-based IDs.\n\n## Purpose\nDogfooding the migration on beads' own issue database to:\n1. Validate migration tool works on real data\n2. Discover edge cases\n3. Verify all workflows still work\n4. Build confidence for users\n\n## Pre-Migration Checklist\n- [ ] All bd-f8b764c9 child tasks completed\n- [ ] All tests pass: `go test ./...`\n- [ ] Migration tool tested on test databases\n- [ ] Documentation updated\n- [ ] MCP server updated and published\n- [ ] Clean git status\n\n## Migration Steps\n\n### 1. Create Backup\n```bash\n# Backup database\ncp -r .beads .beads.backup-1761798568\n\n# Backup JSONL\ncp .beads/beads.jsonl .beads/beads.jsonl.backup\n\n# Create git branch for migration\ngit checkout -b hash-id-migration\ngit add .beads.backup-*\ngit commit -m \"Pre-migration backup\"\n```\n\n### 2. Run Migration (Dry Run)\n```bash\nbd migrate --hash-ids --dry-run \u003e migration-plan.txt\ncat migration-plan.txt\n\n# Review:\n# - Number of issues to migrate\n# - Hash collision check (should be zero)\n# - Text reference updates\n# - Dependency updates\n```\n\n### 3. Run Migration (Real)\n```bash\nbd migrate --hash-ids 2\u003e\u00261 | tee migration-log.txt\n\n# Expected output:\n# βœ“ Backup created: .beads/beads.db.backup-1234567890\n# βœ“ Generated 150 hash IDs\n# βœ“ No hash collisions detected\n# βœ“ Updated issues table schema\n# βœ“ Updated 150 issue IDs\n# βœ“ Updated 87 dependencies\n# βœ“ Updated 234 text references\n# βœ“ Exported to .beads/beads.jsonl\n# βœ“ Migration complete!\n```\n\n### 4. Validation\n\n#### Database Integrity\n```bash\n# Check all issues have hash IDs\nbd list | grep -v \"bd-[a-f0-9]\\{8\\}\" \u0026\u0026 echo \"FAIL: Non-hash IDs found\"\n\n# Check all issues have aliases\nsqlite3 .beads/beads.db \"SELECT COUNT(*) FROM issues WHERE alias IS NULL\"\n# Should be 0\n\n# Check no alias duplicates\nsqlite3 .beads/beads.db \"SELECT alias, COUNT(*) FROM issues GROUP BY alias HAVING COUNT(*) \u003e 1\"\n# Should be empty\n```\n\n#### Functionality Tests\n```bash\n# Test show by hash ID\nbd show bd-\n\n# Test show by alias\nbd show #1\n\n# Test create new issue\nbd create \"Test issue after migration\" -p 2\n# Should get hash ID + alias\n\n# Test update\nbd update #1 --priority 1\n\n# Test dependencies\nbd dep tree #1\n\n# Test export\nbd export\ngit diff .beads/beads.jsonl\n# Should show hash IDs\n```\n\n#### Text Reference Validation\n```bash\n# Check that old IDs were updated in descriptions\ngrep -r \"bd-[0-9]\\{1,3\\}[^a-f0-9]\" .beads/beads.jsonl \u0026\u0026 echo \"FAIL: Old ID format found\"\n\n# Verify hash ID references exist\ngrep -o \"bd-[a-f0-9]\\{8\\}\" .beads/beads.jsonl | sort -u | wc -l\n# Should match number of hash IDs\n```\n\n### 5. Commit Migration\n```bash\ngit add .beads/beads.jsonl .beads/beads.db\ngit commit -m \"Migrate to hash-based IDs (v2.0)\n\n- Migrated 150 issues to hash IDs\n- Preserved aliases (#1-#150)\n- Updated 87 dependencies\n- Updated 234 text references\n- Zero hash collisions\n\nMigration log: migration-log.txt\"\n\ngit push origin hash-id-migration\n```\n\n### 6. Create PR\n```bash\ngh pr create --title \"Migrate to hash-based IDs (v2.0)\" --body \"## Summary\nMigrates beads project to hash-based IDs as part of v2.0 release.\n\n## Migration Stats\n- Issues migrated: 150\n- Dependencies updated: 87\n- Text references updated: 234\n- Hash collisions: 0\n- Aliases assigned: 150\n\n## Validation\n- βœ… All tests pass\n- βœ… Database integrity verified\n- βœ… All workflows tested (show, update, create, deps)\n- βœ… Text references updated correctly\n- βœ… Export produces valid JSONL\n\n## Files Changed\n- `.beads/beads.jsonl` - Hash IDs in all entries\n- `.beads/beads.db` - Schema updated with aliases\n\n## Rollback\nIf issues arise:\n\\`\\`\\`bash\nmv .beads.backup-1234567890 .beads\nbd export\n\\`\\`\\`\n\nSee migration-log.txt for full details.\"\n```\n\n### 7. Merge and Cleanup\n```bash\n# After PR approval\ngit checkout main\ngit merge hash-id-migration\ngit push origin main\n\n# Tag release\ngit tag v2.0.0\ngit push origin v2.0.0\n\n# Cleanup\nrm migration-log.txt migration-plan.txt\ngit checkout .beads.backup-* # Keep in git history\n```\n\n## Rollback Procedure\nIf migration fails or has issues:\n\n```bash\n# Restore backup\nmv .beads .beads.failed-migration\nmv .beads.backup-1234567890 .beads\n\n# Regenerate JSONL\nbd export\n\n# Verify restoration\nbd list\ngit diff .beads/beads.jsonl\n\n# Cleanup\ngit checkout hash-id-migration\ngit reset --hard main\n```\n\n## Post-Migration Communication\n\n### GitHub Issue/Discussion\n```markdown\n## Beads v2.0 Released: Hash-Based IDs\n\nWe've migrated beads to hash-based IDs! πŸŽ‰\n\n**What changed:**\n- Issues now use hash IDs (bd-af78e9a2) instead of sequential (bd-cb64c226.3)\n- Human-friendly aliases (#42) for easy reference\n- Zero collision risk in distributed workflows\n\n**Action required:**\nIf you have a local clone, you need to migrate:\n\n\\`\\`\\`bash\ngit pull origin main\nbd migrate --hash-ids\ngit push origin main\n\\`\\`\\`\n\nSee MIGRATION.md for details.\n\n**Benefits:**\n- βœ… No more ID collisions\n- βœ… Work offline without coordination\n- βœ… Simpler codebase (-2,100 LOC)\n\nQuestions? Reply here or see docs/HASH_IDS.md\n```\n\n## Success Criteria\n- [ ] Migration completes without errors\n- [ ] All validation checks pass\n- [ ] PR merged to main\n- [ ] v2.0.0 tagged and released\n- [ ] Documentation updated\n- [ ] Community notified\n- [ ] No rollback needed within 1 week\n\n## Files to Create\n- migration-log.txt (transient)\n- migration-plan.txt (transient)\n\n## Timeline\nExecute after all other bd-f8b764c9 tasks complete (estimated: ~8 weeks from start)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:29:28.591526-07:00","updated_at":"2025-10-31T12:32:32.607092-07:00","closed_at":"2025-10-31T12:32:32.607092-07:00","dependencies":[{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:29:28.59248-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.4","type":"blocks","created_at":"2025-10-29T21:29:28.593033-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.3","type":"blocks","created_at":"2025-10-29T21:29:28.593437-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.12","type":"blocks","created_at":"2025-10-29T21:29:28.593876-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.1","depends_on_id":"bd-f8b764c9.2","type":"blocks","created_at":"2025-10-29T21:29:28.594521-07:00","created_by":"stevey"}]} +{"id":"bd-t596","title":"Create comments.go with comment methods","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:15.987782-08:00","updated_at":"2025-11-23T18:13:57.446443-08:00","closed_at":"2025-11-23T18:13:57.446443-08:00"} +{"id":"bd-p6vp","title":"Clarify .beads/.gitattributes handling in Protected Branches docs","description":"Protected Branches docs quick start leaves untracked `.beads` directory and `.gitattributes`.\nQuestion: Are these changes meant to be checked into the protected branch?\nNeed to clarify if these should be ignored or committed, or if the instructions are missing a step.\n","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T18:56:25.79407-05:00","updated_at":"2025-11-20T18:56:25.79407-05:00"} +{"id":"bd-b5tg","title":"Document code review findings for bd-0a43 refactoring","description":"Code review completed successfully with minor suggestions for future improvements","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-23T18:18:10.766188-08:00","updated_at":"2025-11-23T18:18:10.766188-08:00"} +{"id":"bd-27xm","title":"Debug MCP Agent Mail tool execution errors","description":"**EXTERNAL WORK**: Debug the standalone MCP Agent Mail server (separate from beads integration).\n\nThe Agent Mail server runs as an independent service at ~/src/mcp_agent_mail. This is NOT beads code - it's a separate GitHub project we're evaluating for optional coordination features.\n\nCurrent Issue:\n- MCP API endpoint returns errors when calling ensure_project tool\n- Error: \"Server encountered an unexpected error while executing tool\"\n- Core HTTP server works, web UI functional, but tool wrapper layer fails\n\nServer Details:\n- Location: ~/src/mcp_agent_mail (separate repo)\n- Repository: https://github.com/Dicklesworthstone/mcp_agent_mail\n- Runs on: http://127.0.0.1:8765\n- Bearer token: In .env file\n\nInvestigation Steps:\n1. Check tool execution logs for full stack trace\n2. Verify Git storage initialization at ~/.mcp_agent_mail_git_mailbox_repo\n3. Review database setup (storage.sqlite3)\n4. Test with simpler MCP tools if available\n5. Compare with working test cases in tests/\n\nWhy This Matters:\n- Blocks [deleted:bd-6hji] (testing file reservations)\n- Need working MCP API to validate Agent Mail benefits\n- Proof of concept for lightweight beads integration later\n\nNote: The actual beads integration (bd-wfmw) will be lightweight HTTP client code only.","status":"closed","issue_type":"bug","created_at":"2025-11-07T23:20:10.973891-08:00","updated_at":"2025-11-08T03:12:04.151537-08:00","closed_at":"2025-11-07T23:40:19.309202-08:00","dependencies":[{"issue_id":"bd-27xm","depends_on_id":"bd-muls","type":"discovered-from","created_at":"2025-11-07T23:20:21.895654-08:00","created_by":"daemon"}]} +{"id":"bd-2b34.2","title":"Extract daemon server functions to daemon_server.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.345639-07:00","updated_at":"2025-11-01T21:02:58.338168-07:00","closed_at":"2025-11-01T21:02:58.338168-07:00"} +{"id":"bd-9f1fce5d","title":"Add internal/ai package for LLM integration","description":"Shared AI client for repair commands.\n\nProviders:\n- Anthropic (Claude)\n- OpenAI (GPT)\n- Ollama (local)\n\nEnv vars:\n- BEADS_AI_PROVIDER\n- BEADS_AI_API_KEY\n- BEADS_AI_MODEL\n\nFiles: internal/ai/client.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T14:48:29.072473-07:00","updated_at":"2025-11-06T19:36:13.972045-08:00","closed_at":"2025-11-06T19:27:19.128093-08:00"} +{"id":"bd-f8b764c9.11","title":"Design hash ID generation algorithm","description":"Design and specify the hash-based ID generation algorithm.\n\n## Requirements\n- Deterministic: same inputs β†’ same ID\n- Collision-resistant: ~2^32 space for 8-char hex\n- Fast: \u003c1ΞΌs per generation\n- Includes timestamp for uniqueness\n- Includes creator/workspace for distributed uniqueness\n\n## Proposed Algorithm\n```go\nfunc GenerateIssueID(title, desc string, created time.Time, workspaceID string) string {\n h := sha256.New()\n h.Write([]byte(title))\n h.Write([]byte(desc))\n h.Write([]byte(created.Format(time.RFC3339Nano)))\n h.Write([]byte(workspaceID))\n hash := hex.EncodeToString(h.Sum(nil))\n return \"bd-\" + hash[:8] // 8-char prefix = 2^32 space\n}\n```\n\n## Open Questions\n1. 8 chars (2^32) or 16 chars (2^64) for collision resistance?\n2. Include priority/type in hash? (Pro: more entropy. Con: immutable)\n3. How to handle workspace ID generation? (hostname? UUID?)\n4. What if title+desc change? (Answer: ID stays same - hash only used at creation)\n\n## Deliverables\n- Design doc: docs/HASH_ID_DESIGN.md\n- Collision probability analysis\n- Performance benchmarks\n- Prototype implementation in internal/types/id_generator.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:24:01.843634-07:00","updated_at":"2025-10-31T12:32:32.610902-07:00","closed_at":"2025-10-31T12:32:32.610902-07:00","dependencies":[{"issue_id":"bd-f8b764c9.11","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:24:01.844994-07:00","created_by":"stevey"}]} +{"id":"bd-cb64c226.9","title":"Remove Cache-Related Tests","description":"Delete or update tests that assume multi-repo caching","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:44.511897-07:00","updated_at":"2025-10-30T17:12:58.212659-07:00","closed_at":"2025-10-28T14:08:38.065118-07:00"} +{"id":"bd-ckvw","title":"Add schema compatibility probe to prevent silent migration failures","description":"Issue #262 revealed a serious bug: migrations may fail silently, causing UNIQUE constraint errors later.\n\nRoot cause:\n- sqlite.New() runs migrations once on open\n- checkVersionMismatch() prints 'database will be upgraded automatically' but only updates metadata\n- If migrations fail or daemon runs older version, queries expecting new columns fail with 'no such column'\n- Import logic misinterprets this as 'not found' and tries INSERT on existing ID\n- Result: UNIQUE constraint failed: issues.id\n\nFix strategy (minimal):\n1. Add schema probe in sqlite.New() after RunMigrations\n - SELECT all expected columns from all tables with LIMIT 0\n - If fails, retry RunMigrations and probe again\n - If still fails, return fatal error with clear message\n2. Fix checkVersionMismatch to not claim 'will upgrade' unless probe passes\n3. Only update bd_version after successful migration probe\n4. Add schema verification before import operations\n5. Map 'no such column' errors to clear actionable message\n\nRelated: #262","status":"closed","issue_type":"bug","created_at":"2025-11-08T13:23:26.934246-08:00","updated_at":"2025-11-08T13:53:29.219542-08:00","closed_at":"2025-11-08T13:53:29.219542-08:00"} +{"id":"bd-b0c8","title":"Research hooks/skills approach for enforcing issue descriptions","description":"## Solution: Hooks/Skills (mentioned in discussion)\n\nResearch the hooks/skills system mentioned by riordanpawley in discussion #366:\nhttps://www.reddit.com/r/ClaudeAI/s/wrn2tjkMHX\n\n## Investigation Tasks\n\n1. Review the Reddit post to understand the approach\n2. Determine if beads hooks can enforce validation\n3. Check if Claude Code skills/hooks can intercept MCP calls\n4. Assess feasibility and user burden\n\n## Notes\n\nFrom discussion #366:\n\u003e I'm using a skills/hooks system to get Claude to do that kind of thing right similar to https://www.reddit.com/r/ClaudeAI/s/wrn2tjkMHX\n\nThis might be a client-side solution rather than server-side.\n\n## Deliverable\n\nDocument findings in issue notes, with recommendation on whether to pursue this approach.","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-23T14:01:01.57079-08:00","updated_at":"2025-11-23T14:01:01.57079-08:00","dependencies":[{"issue_id":"bd-b0c8","depends_on_id":"bd-0tr0","type":"discovered-from","created_at":"2025-11-23T14:01:01.572166-08:00","created_by":"daemon"}]} +{"id":"bd-2b34.6","title":"Add tests for daemon lifecycle module","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.359587-07:00","updated_at":"2025-11-01T21:22:39.009259-07:00","closed_at":"2025-11-01T21:22:39.009259-07:00"} +{"id":"bd-879d","title":"Test issue 1","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T09:44:12.538697729Z","updated_at":"2025-11-02T09:45:20.76214671Z","closed_at":"2025-11-02T09:45:20.76214671Z","dependencies":[{"issue_id":"bd-879d","depends_on_id":"bd-d3e5","type":"discovered-from","created_at":"2025-11-02T09:44:22.103468321Z","created_by":"mrdavidlaing"}]} +{"id":"bd-ar2.9","title":"Fix variable shadowing in GetNextChildID resurrection code","description":"## Problem\nMinor variable shadowing in hash_ids.go:\n\n```go\n// Line 33: err declared here\nerr := s.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM issues WHERE id = ?`, parentID).Scan(\u0026count)\n\n// Line 38: err reused/shadowed here\nresurrected, err := s.TryResurrectParent(ctx, parentID)\n```\n\nWhile Go allows this, it can be confusing and some linters flag it.\n\n## Solution\nUse different variable name:\n\n```go\nresurrected, resurrectErr := s.TryResurrectParent(ctx, parentID)\nif resurrectErr != nil {\n return \"\", fmt.Errorf(\"failed to resurrect parent %s: %w\", parentID, resurrectErr)\n}\n```\n\n## Files\n- internal/storage/sqlite/hash_ids.go:38\n\n## Priority\nLow - code works correctly, just a style improvement","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:26:09.734162-05:00","updated_at":"2025-11-22T17:48:48.071927-08:00","closed_at":"2025-11-21T11:25:23.408878-05:00","dependencies":[{"issue_id":"bd-ar2.9","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:26:09.734618-05:00","created_by":"daemon"}]} +{"id":"bd-jx90","title":"Add simple cleanup command to delete closed issues","description":"Users want a simple command to delete all closed issues without requiring Anthropic API key (unlike compact). Requested in GH #243.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-07T00:26:30.372137-08:00","updated_at":"2025-11-07T22:07:17.347122-08:00","closed_at":"2025-11-07T22:05:16.325863-08:00"} +{"id":"bd-812a","title":"Add unit tests for import ordering","description":"Test topological sort: import [child, parent] should succeed, import [parent.1.2, parent, parent.1] should sort correctly. Verify depth-based batching works. Test max depth limits.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.278448-08:00","updated_at":"2025-11-05T00:08:42.812949-08:00","closed_at":"2025-11-05T00:08:42.812952-08:00"} +{"id":"bd-02a4","title":"Modify CreateIssue to support parent resurrection","description":"Update internal/storage/sqlite/sqlite.go:182-196 to call TryResurrectParent before failing on missing parent. Coordinate with EnsureIDs changes for consistent behavior. Handle edge case where parent never existed in JSONL (fail gracefully).","status":"closed","issue_type":"task","created_at":"2025-11-04T12:31:59.701571-08:00","updated_at":"2025-11-05T00:08:42.811436-08:00","closed_at":"2025-11-05T00:08:42.81144-08:00"} +{"id":"bd-es19","title":"BG's issue to reopen","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T19:43:48.756893-05:00","updated_at":"2025-11-20T19:43:48.756893-05:00","closed_at":"2025-11-07T21:57:59.90981-08:00"} +{"id":"bd-1a6j","title":"Test issue 2","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-07T19:07:12.24632-08:00","updated_at":"2025-11-07T19:07:12.24632-08:00"} +{"id":"bd-woro","title":"Separate canonical BD_GUIDE.md from AGENTS.md","description":"Create architectural separation between bd-specific instructions and project-specific instructions.\n\n## Problem\nCurrently AGENTS.md mixes:\n- bd tool documentation (changes with bd upgrades)\n- Project-specific workflow (stable, manually maintained)\n\nThis makes it hard to update bd instructions without touching project docs.\n\n## Solution\n1. Generate .beads/BD_GUIDE.md from 'bd onboard' output\n2. Mark it as auto-generated (never manually edit)\n3. Version-stamp header with bd version\n4. AGENTS.md references it instead of duplicating content\n5. Auto-update BD_GUIDE.md when bd version changes\n\n## Implementation\n- Add 'bd onboard --output .beads/BD_GUIDE.md' option\n- Detect version changes and offer to regenerate\n- Add header: '\u003c!-- Auto-generated by bd v0.24.2 - DO NOT EDIT --\u003e'\n- Update AGENTS.md to reference BD_GUIDE.md\n\n## Benefits\n- Clear separation of concerns\n- Deterministic updates (no agent LLM involved)\n- Git-trackable diffs show exactly what changed\n- Progressive disclosure (agents read when needed)\n\n## Acceptance Criteria\n- BD_GUIDE.md auto-generated and version-stamped\n- AGENTS.md references it appropriately\n- Upgrade workflow auto-updates BD_GUIDE.md\n- Git diffs clearly show bd instruction changes\n","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-23T16:21:55.451925-08:00","updated_at":"2025-11-23T16:21:55.451925-08:00","dependencies":[{"issue_id":"bd-woro","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:55.453758-08:00","created_by":"daemon"}]} +{"id":"bd-e92","title":"Add test coverage for internal/autoimport package","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:22.338577-05:00","updated_at":"2025-11-20T21:21:22.338577-05:00","dependencies":[{"issue_id":"bd-e92","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.128625-05:00","created_by":"daemon"}]} +{"id":"bd-51jl","title":"Feature P1","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T19:04:24.852171-08:00","updated_at":"2025-11-07T22:07:17.343481-08:00","closed_at":"2025-11-07T21:55:09.426728-08:00"} +{"id":"bd-y6d","title":"Refactor create_test.go to use shared DB setup","description":"Convert TestCreate_* functions to use test suites with shared database setup.\n\nExample transformation:\n- Before: 10 separate tests, each with newTestStore() \n- After: 1 TestCreate() with 10 t.Run() subtests sharing one DB\n\nEstimated speedup: 10x faster (1 DB setup instead of 10)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T11:48:56.858213-05:00","updated_at":"2025-11-21T16:06:03.814206-05:00","closed_at":"2025-11-21T15:15:31.315407-05:00","dependencies":[{"issue_id":"bd-y6d","depends_on_id":"bd-1rh","type":"blocks","created_at":"2025-11-21T11:49:09.660182-05:00","created_by":"daemon"},{"issue_id":"bd-y6d","depends_on_id":"bd-c49","type":"blocks","created_at":"2025-11-21T11:49:26.410452-05:00","created_by":"daemon"}]} +{"id":"bd-40a0","title":"bd doctor should check for multiple DBs, multiple JSONLs, daemon health","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-10-31T21:16:47.042913-07:00","updated_at":"2025-10-31T21:21:27.093525-07:00","closed_at":"2025-10-31T21:21:27.093525-07:00"} +{"id":"bd-1231","title":"CI failing on all 3/4 test jobs despite individual tests passing","description":"CI has been broken for a day+ with mysterious test failures. Issue #173 on GitHub tracks this.\n\n## Current Status\n- **Lint job**: βœ… PASSING\n- **Test (Linux)**: ❌ FAILING (exit code 1)\n- **Test (Windows)**: ❌ FAILING (exit code 1)\n- **Test Nix Flake**: ❌ FAILING (exit code 1)\n\n## Key Observations\nAll three failing jobs show identical pattern:\n- Individual test output shows PASS for every test\n- Final result: `FAIL github.com/steveyegge/beads/cmd/bd`\n- Exit code 1 despite no visible test failures\n- Last visible test output before failure: \"No Reason Issue\" test (TestCloseCommand/close_without_reason)\n\n## Investigation So Far\n1. All tests appear to pass when examined individually\n2. Likely causes:\n - Race detector finding data races during test cleanup (`-race` flag)\n - Panic/error occurring after main tests complete\n - Test harness issue not reporting actual failure\n - Possible regression from PR #203 (dependency_type changes)\n\n## Recent CI Runs\n- Run 19015040655 (latest): 3/4 failing\n- Multiple recent commits tried to fix Windows/lint issues\n- Agent on rrnewton/beads fork attempting fixes (2/4 passing there)\n\n## Next Steps\n1. Run tests locally with `-race -v` to see full output\n2. Check for unreported test failures or panics\n3. Examine test cleanup/teardown code\n4. Review recent changes around close command tests\n5. Consider if race detector is too sensitive or catching real issues","notes":"## Progress Update\n\n### βœ… Fixed (commits 09bd4d3, 21a29bc)\n1. **Daemon auto-import** - Always recompute content_hash in importer to avoid stale hashes\n2. **TestScripts failures** - Added bd binary to PATH for shell subprocess tests\n3. **Test infrastructure** - Added .gitignore to test repos, fixed last_import_time metadata\n\n### βœ… CI Status (Run 19015638968)\n- **Test (Linux)**: βœ… SUCCESS - All tests passing\n- **Test (Windows)**: ❌ FAILURE - Pre-existing Windows test failures\n- **Test Nix Flake**: ❌ FAILURE - Build fails with same test errors\n- **Lint**: ❌ FAILURE - Pre-existing issue in migrate.go:647\n\n### ❌ Remaining Issues (not related to original bd-1231)\n\n**Windows failures:**\n- TestFindDatabasePathEnvVar\n- TestHashIDs_MultiCloneConverge \n- TestHashIDs_IdenticalContentDedup\n- TestDatabaseReinitialization (5 subtests)\n- TestFindBeadsDir_NotFound\n- TestMetricsSnapshot/uptime\n\n**Lint failure:**\n- cmd/bd/migrate.go:647:37: cleanupWALFiles - result 0 (error) is always nil (unparam)\n\n**Nix failure:**\n- Build fails during test phase with same test errors\n\n### Next Steps\n1. Investigate Windows-specific test failures\n2. Fix linting issue in migrate.go\n3. Debug Nix build test failures","status":"closed","issue_type":"bug","created_at":"2025-11-02T08:42:16.142128-08:00","updated_at":"2025-11-02T12:32:00.15834-08:00","closed_at":"2025-11-02T12:32:00.158346-08:00"} +{"id":"bd-1vv","title":"Add WebSocket support","description":"## Feature Request\n\n[Describe the desired feature]\n\n## Motivation\n\n[Why is this feature needed? What problem does it solve?]\n\n## Use Cases\n\n1. **Use Case 1**: [description]\n2. **Use Case 2**: [description]\n\n## Proposed Solution\n\n[High-level approach to implementing this feature]\n\n## Alternatives Considered\n\n- **Alternative 1**: [description and why not chosen]\n- **Alternative 2**: [description and why not chosen]\n","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-03T19:56:41.271215-08:00","updated_at":"2025-11-03T19:56:41.271215-08:00"} +{"id":"bd-l4b6","title":"Add tests for bd init --team wizard","description":"Write integration tests for the team wizard:\n- Test branch detection\n- Test sync branch creation\n- Test protected branch workflow\n- Test auto-sync configuration","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:58:18.192425-08:00","updated_at":"2025-11-06T20:06:49.22056-08:00","closed_at":"2025-11-06T19:55:39.687439-08:00"} +{"id":"bd-3djj","title":"Add aider integration for beads issue tracking","description":"Based on GH#206 discussion, add aider-specific integration to help aider users work with beads. Aider requires explicit user command invocation via /run, unlike Claude Code which executes autonomously. Need to create setup command, configuration template, and documentation that accounts for aider's human-in-the-loop workflow.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-23T15:08:17.314598-08:00","updated_at":"2025-11-23T15:13:33.84131-08:00","closed_at":"2025-11-23T15:13:33.84131-08:00"} +{"id":"bd-m9th","title":"Create Python adapter library","description":"Create beads_mail_adapter.py library that wraps Agent Mail HTTP calls with health checks and graceful degradation.\n\nAcceptance Criteria:\n- AgentMailAdapter class with health check on init\n- enabled flag auto-disables if server unreachable\n- All methods wrapped in try/catch (non-blocking failures)\n- Methods: reserve_issue(), release_issue(), notify(), check_inbox()\n- Environment-based configuration (AGENT_MAIL_URL, AGENT_MAIL_TOKEN)\n- Unit tests for enabled/disabled modes\n\nFile: lib/beads_mail_adapter.py","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-07T22:42:28.60152-08:00","updated_at":"2025-11-08T00:11:02.746747-08:00","closed_at":"2025-11-08T00:11:02.746747-08:00","dependencies":[{"issue_id":"bd-m9th","depends_on_id":"bd-4cyb","type":"blocks","created_at":"2025-11-07T22:42:28.602698-08:00","created_by":"daemon"}]} +{"id":"bd-325da116","title":"Fix N-way collision convergence","description":"Epic to fix the N-way collision convergence problem documented in n-way-collision-convergence.md.\n\n## Problem Summary\nThe current collision resolution implementation works correctly for 2-way collisions but does not converge for 3-way (and by extension N-way) collisions. TestThreeCloneCollision demonstrates this with reproducible failures.\n\n## Root Causes Identified\n1. Pairwise resolution doesn't scale - each clone makes local decisions without global context\n2. DetectCollisions modifies state during detection (line 83-86 in collision.go)\n3. No remapping history - can't track transitive remap chains (test-1 β†’ test-2 β†’ test-3)\n4. Import-time resolution is too late - happens after git merge\n\n## Solution Architecture\nReplace pairwise resolution with deterministic global N-way resolution using:\n- Content-addressable identity (content hashing)\n- Global collision resolution (sort all versions by hash)\n- Read-only detection phase (separate from modification)\n- Idempotent imports (content-first matching)\n\n## Success Criteria\n- TestThreeCloneCollision passes without skipping\n- All clones converge to identical content after final pull\n- No data loss (all issues present in all clones)\n- Works for N workers (test with 5+ clones)\n- Idempotent imports (importing same JSONL multiple times is safe)\n\n## Implementation Phases\nSee child issues for detailed breakdown of each phase.","status":"closed","issue_type":"epic","created_at":"2025-10-29T23:05:13.889079-07:00","updated_at":"2025-10-31T11:59:41.031668-07:00","closed_at":"2025-10-31T11:59:41.031668-07:00"} +{"id":"bd-1mzt","title":"Client self-heal: remove stale pid when lock free + socket missing","description":"When client detects:\n- Socket is missing AND\n- tryDaemonLock shows lock NOT held\n\nThen automatically:\n1. Remove stale daemon.pid file\n2. Optionally auto-start daemon (behind BEADS_AUTO_START_DAEMON=1 env var)\n\nThis prevents stale artifacts from accumulating after daemon crashes.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T16:42:12.75205-08:00","updated_at":"2025-11-07T22:07:17.342845-08:00","closed_at":"2025-11-07T21:21:15.317562-08:00","dependencies":[{"issue_id":"bd-1mzt","depends_on_id":"bd-ndyz","type":"discovered-from","created_at":"2025-11-07T16:42:12.753099-08:00","created_by":"daemon"}]} +{"id":"bd-cb64c226.1","title":"Performance Validation","description":"Confirm no performance regression from cache removal","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T10:50:15.126019-07:00","updated_at":"2025-10-30T17:12:58.216721-07:00","closed_at":"2025-10-28T10:49:45.021037-07:00"} +{"id":"bd-hpt5","title":"show commit hash in 'bd version' when built from source'\n","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-13T13:26:14.662089379-07:00","updated_at":"2025-11-14T09:18:09.721428859-07:00","closed_at":"2025-11-14T09:18:09.721428859-07:00"} +{"id":"bd-3e3b","title":"Add circular dependency detection to bd doctor","description":"Added cycle detection as Check #10 in bd doctor command. Uses same recursive CTE query as DetectCycles() to find circular dependencies. Reports error status with count and fix suggestion if cycles found.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-01T20:18:23.416056-07:00","updated_at":"2025-11-01T20:18:26.76113-07:00","closed_at":"2025-11-01T20:18:26.76113-07:00"} +{"id":"bd-au0.1","title":"Standardize --dry-run flag across all commands","description":"Replace all instances of --preview with --dry-run for consistency.\n\n**Commands to update:**\n- clean: Change --preview to --dry-run\n\n**Commands to verify:**\n- cleanup, compact, delete, duplicates, epic close-eligible, import, sync\n\n**Testing:**\n- Ensure all mutating commands support --dry-run\n- Verify backward compatibility (deprecation warning for --preview?)\n- Update tests and documentation","notes":"All commands already use --dry-run consistently. Verified:\n- cleanup: line 130\n- compact: line 873\n- delete: line 559\n- duplicates: line 158\n- import: line 703\n- sync: line 333\n- epic close-eligible: line 208\n- clean: line 162\n\nNo --preview flags found in the codebase. This task appears to have been completed before the epic was created.","status":"closed","issue_type":"task","created_at":"2025-11-21T21:06:09.6033-05:00","updated_at":"2025-11-21T21:28:29.836473-05:00","closed_at":"2025-11-21T21:28:29.836473-05:00","dependencies":[{"issue_id":"bd-au0.1","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:09.603828-05:00","created_by":"daemon"}]} +{"id":"bd-790","title":"Document which files to commit after bd init --branch","description":"GH #312 reported confusion about which files should be committed after running 'bd init --branch beads-metadata'. Updated PROTECTED_BRANCHES.md to clearly document:\n\n1. Files that should be committed to protected branch (main):\n - .beads/.gitignore\n - .gitattributes\n\n2. Files that are automatically gitignored\n3. Files that live in the sync branch (beads-metadata)\n\nChanges:\n- Added step-by-step instructions in Quick Start section\n- Added 'What lives in each branch' section to How It Works\n- Clarified the directory structure diagram\n\nFixes: https://github.com/steveyegge/beads/issues/312","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:47:25.813954-05:00","updated_at":"2025-11-20T21:47:33.567649-05:00","closed_at":"2025-11-20T21:47:33.567651-05:00"} +{"id":"bd-cb64c226.12","title":"Remove Storage Cache from Server Struct","description":"Eliminate cache fields and use s.storage directly","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:25.474412-07:00","updated_at":"2025-10-30T17:12:58.211812-07:00","closed_at":"2025-10-28T14:08:38.061444-07:00"} +{"id":"bd-q2ri","title":"bd-hv01: Add comprehensive edge case tests for deletion tracking","description":"Need to add tests for: corrupted snapshot file, stale snapshot (\u003e 1 hour), concurrent sync operations (daemon + manual), partial deletion failure, empty remote JSONL, multi-repo mode with deletions, git worktree scenario.\n\nAlso refine TestDeletionWithLocalModification to check for specific conflict error instead of accepting any error.\n\nFiles: cmd/bd/deletion_tracking_test.go","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-06T18:16:26.849881-08:00","updated_at":"2025-11-06T20:06:49.221043-08:00","closed_at":"2025-11-06T19:55:39.700695-08:00","dependencies":[{"issue_id":"bd-q2ri","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.104113-08:00","created_by":"daemon"}]} +{"id":"bd-c362","title":"Extract database search logic into helper function","description":"The logic for finding a database in a beads directory is duplicated:\n- FindDatabasePath() BEADS_DIR section (beads.go:141-169)\n- findDatabaseInTree() (beads.go:248-280)\n\nBoth implement the same search order:\n1. Check config.json first (single source of truth)\n2. Fall back to canonical beads.db\n3. Search for *.db files, filtering backups and vc.db\n\nRefactoring suggestion:\nExtract to a helper function like:\n func findDatabaseInBeadsDir(beadsDir string) string\n\nBenefits:\n- Single source of truth for database search logic\n- Easier to maintain and update search order\n- Reduces code duplication\n\nRelated to [deleted:[deleted:[deleted:bd-e16b]]] implementation.","status":"open","priority":3,"issue_type":"chore","created_at":"2025-11-02T18:34:02.831543-08:00","updated_at":"2025-11-20T20:40:13.912032-05:00","dependencies":[{"issue_id":"bd-c362","depends_on_id":"bd-e16b","type":"blocks","created_at":"2025-11-02T18:34:02.832607-08:00","created_by":"daemon"}]} +{"id":"bd-gz0x","title":"Fix daemon exiting after 5s on macOS due to PID 1 parent monitoring","description":"GitHub issue #278 reports that the daemon exits after \u003c=5 seconds on macOS because it incorrectly treats PID 1 (launchd) as a dead parent.\n\nWhen the daemon detaches on macOS, it gets reparented to PID 1 (launchd), which is the init process. The checkParentProcessAlive function was incorrectly treating PID 1 as a sign that the parent died.\n\nFixed by changing the logic to treat PID 1 as a valid parent for detached daemons.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-09T16:15:34.606508-08:00","updated_at":"2025-11-09T16:15:37.46914-08:00","closed_at":"2025-11-09T16:15:37.46914-08:00"} +{"id":"bd-09b5f2f5","title":"Daemon fails to auto-import after git pull updates JSONL","description":"After git pull updates .beads/issues.jsonl, daemon doesn't automatically re-import changes, causing stale data to be shown until next sync cycle (up to 5 minutes).\n\nReproduction:\n1. Repo A: Close issues, export, commit, push\n2. Repo B: git pull (successfully updates .beads/issues.jsonl)\n3. bd show \u003cissue\u003e shows OLD status from daemon's SQLite db\n4. JSONL on disk has correct new status\n\nRoot cause: Daemon sync cycle runs on timer (5min). When user manually runs git pull, daemon doesn't detect JSONL was updated externally and continues serving stale data from SQLite.\n\nImpact:\n- High for AI agents using beads in git workflows\n- Breaks fundamental git-as-source-of-truth model\n- Confusing UX: git log shows commit, bd shows old state\n- Data consistency issues between JSONL and daemon\n\nSee WYVERN_SYNC_ISSUE.md for full analysis.","notes":"**Fixed in v0.21.2!**\n\nThe daemon auto-import is fully implemented:\n- internal/autoimport package handles staleness detection\n- internal/importer package provides shared import logic (used by both CLI and daemon)\n- daemon's checkAndAutoImportIfStale() calls autoimport.AutoImportIfNewer()\n- importFunc uses importer.ImportIssues() with auto-rename enabled\n- All tests passing\n\nThe critical data corruption bug is FIXED:\nβœ… After git pull, daemon detects JSONL is newer (mtime check)\nβœ… Daemon auto-imports before serving requests\nβœ… No stale data served\nβœ… No data loss in multi-agent workflows\n\nVerification needed: Run two-repo test to confirm end-to-end behavior.","status":"closed","issue_type":"epic","created_at":"2025-10-25T23:13:12.270766-07:00","updated_at":"2025-11-01T16:52:50.931197-07:00","closed_at":"2025-11-01T16:52:50.931197-07:00"} +{"id":"bd-hv01","title":"Deletions not propagated across multi-workspace sync","description":"## Problem\n\nWhen working with multiple beads workspaces (clones) sharing the same git remote, deleted issues keep coming back.\n\n## Reproduction\n\n1. Clone A deletes issue `bd-xyz` via `bd delete bd-xyz --force`\n2. Clone A daemon syncs and pushes to GitHub\n3. Clone B still has `bd-xyz` in its database\n4. Clone B daemon exports and pushes its JSONL\n5. Clone A pulls and imports β†’ `bd-xyz` comes back!\n\n## Root Cause\n\n**No deletion tracking mechanism.** The system has no way to distinguish between:\n- \"Issue doesn't exist in JSONL because it was deleted\" \n- \"Issue doesn't exist in JSONL because the export is stale\"\n\nImport treats missing issues as \"not in this export\" rather than \"explicitly deleted.\"\n\n## Solution Options\n\n1. **Tombstone records** - Keep deleted issues in JSONL with `\"status\":\"deleted\"` or `\"deleted_at\"` field\n2. **Deletion log** - Separate `.beads/deletions.jsonl` file tracking all deleted IDs\n3. **Three-way merge** - Import compares: DB state, old JSONL, new JSONL\n4. **Manual conflict resolution** - Detect resurrection and prompt user\n\n## Related\n\n- Similar to resurrection logic for orphaned children (bd-cc4f)\n- beads-merge tool handles this better with 3-way merge","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-05T18:34:24.094474-08:00","updated_at":"2025-11-06T18:19:16.233949-08:00","closed_at":"2025-11-06T17:52:24.860716-08:00","dependencies":[{"issue_id":"bd-hv01","depends_on_id":"bd-qqvw","type":"blocks","created_at":"2025-11-05T18:42:35.485002-08:00","created_by":"daemon"}]} +{"id":"bd-2c5a","title":"Investigate why test issues persist in database","description":"Test issues (bd-0do3, bd-cjxp, bd-phr2, etc.) keep appearing in ready/list output, cluttering real work. These appear to be leftover test data from test runs.\n\nNeed to investigate:\n1. Why are test issues not being cleaned up after tests?\n2. Are tests creating issues in the main database instead of test databases?\n3. Should we add better test isolation or cleanup hooks?\n4. Can we add a label/prefix to distinguish test issues from real issues?\n\nThese test issues have characteristics:\n- Empty descriptions\n- Generic titles like \"Test issue 0\", \"Bug P0\", \"Issue to reopen with reason\"\n- Created around 2025-11-07 19:00-19:07\n- Some assigned to test users like \"alice\", \"bob\", \"testuser\"","notes":"## Root Cause Analysis\n\n**Problem**: Python MCP integration tests created test issues in production `.beads/beads.db` instead of isolated test databases.\n\n**Evidence**:\n- 29 test issues created on Nov 7, 2025 at 19:00-19:07\n- Patterns: \"Bug P0\", \"Test issue X\", assignees \"alice\"/\"bob\"/\"testuser\"\n- Git commit 0e8936b shows test issues committed to .beads/beads.jsonl\n- Tests were being fixed for workspace isolation around the same time\n\n**Why It Happened**:\n1. Before commit 0e8936b, `test_client_lazy_initialization()` didn't set `BEADS_WORKING_DIR`\n2. Tests fell back to discovering `.beads/` in the project root directory\n3. Auto-sync committed test issues to production database\n\n**Resolution**:\n1. βœ… Closed 29 test pollution issues (bd-0do3, bd-cjxp, etc.)\n2. βœ… Added `failIfProductionDatabase()` guard in Go test helpers\n3. βœ… Added production pollution checks in RPC test setup\n4. βœ… Created `conftest.py` with pytest safety checks for Python tests\n5. βœ… Added `BEADS_TEST_MODE` env var to mark test execution\n6. βœ… Tests now fail fast if they detect production database usage\n\n**Prevention**:\n- All test helper functions now verify database paths are in temp directories\n- Python tests fail immediately if BEADS_DB points to production\n- BEADS_TEST_MODE flag helps identify test vs production execution\n- Clear error messages guide developers to use proper test isolation\n\n**Files Modified**:\n- cmd/bd/test_helpers_test.go - Added failIfProductionDatabase()\n- internal/rpc/rpc_test.go - Added temp directory verification\n- integrations/beads-mcp/tests/conftest.py - New file with pytest safeguards","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T21:31:34.845887-08:00","updated_at":"2025-11-07T21:57:30.892086-08:00","closed_at":"2025-11-07T21:57:30.892086-08:00"} +{"id":"bd-c49","title":"Audit all cmd/bd tests and group into suites","description":"Analyze all 279 tests in cmd/bd and identify:\n1. Which tests can share DB setup (most of them\\!)\n2. Which tests actually need isolation (export/import, git ops)\n3. Optimal grouping into test suites\n\nCreate a mapping document showing:\n- Current: 279 individual test functions\n- Proposed: ~10-15 test suites with subtests\n- Expected speedup per suite\n\nBlocks all refactoring work.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-21T11:49:19.438242-05:00","updated_at":"2025-11-21T16:06:03.811278-05:00","closed_at":"2025-11-21T15:15:29.50544-05:00"} +{"id":"bd-0vfe","title":"Blocked issue","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:07:17.105974-08:00","updated_at":"2025-11-07T22:07:17.342098-08:00","closed_at":"2025-11-07T21:55:09.425545-08:00"} +{"id":"bd-98c4e1fa","title":"Event-driven daemon architecture","description":"Replace 5-second polling sync loop with event-driven architecture that reacts instantly to changes. Eliminates stale data issues while reducing CPU ~60%. Key components: FileWatcher (fsnotify), Debouncer (500ms), RPC mutation events, optional git hooks. Target latency: \u003c500ms (vs 5000ms). See event_driven_daemon.md for full design.","notes":"## Implementation Progress\n\n**Completed:**\n1. βœ… Mutation events infrastructure (bd-143 equivalent)\n - MutationEvent channel in RPC server\n - Events emitted for all write operations: create, update, close, label add/remove, dep add/remove, comment add\n - Non-blocking emission with dropped event counter\n\n2. βœ… FileWatcher with fsnotify (bd-b0c7f7ef related)\n - Watches .beads/issues.jsonl and .git/refs/heads\n - 500ms debounce\n - Polling fallback if fsnotify unavailable\n\n3. βœ… Debouncer (bd-144 equivalent)\n - 500ms debounce for both export and import triggers\n - Thread-safe trigger/cancel\n\n4. βœ… Separate export-only and import-only functions\n - createExportFunc(): exports + optional commit/push (no pull/import)\n - createAutoImportFunc(): pull + import (no export)\n - Target latency \u003c500ms achieved by avoiding full sync\n\n5. βœ… Dropped events safety net (bd-eef03e0a related)\n - Atomic counter tracks dropped mutation events\n - 60-second health check triggers export if events were dropped\n - Prevents silent data loss from event storms\n\n**Still Needed:**\n- Platform-specific tests (bd-69bce74a)\n- Integration test for mutationβ†’export latency (bd-140)\n- Unit tests for FileWatcher (bd-b0c7f7ef)\n- Unit tests for Debouncer (bd-144)\n- Event storm stress test (bd-eef03e0a)\n- Documentation update (bd-142)\n\n**Next Steps:**\nAdd comprehensive test coverage before enabling events mode by default.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-29T21:19:36.203436-07:00","updated_at":"2025-10-30T17:12:58.197875-07:00","closed_at":"2025-10-29T15:53:34.022335-07:00"} +{"id":"bd-oif6","title":"Vendor beads-merge Go code into internal/merge/","description":"Copy beads-merge source code from @neongreen's repo into bd codebase.\n\n**Tasks**:\n- Create `internal/merge/` package\n- Copy merge algorithm code\n- Add attribution header to all files\n- Update imports to use bd's internal types\n- Add LICENSE/ATTRIBUTION file crediting @neongreen\n- Keep original algorithm intact\n\n**Source**: https://github.com/neongreen/mono/tree/main/beads-merge","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:42:20.405283-08:00","updated_at":"2025-11-05T18:52:53.71713-08:00","closed_at":"2025-11-05T18:52:53.71713-08:00","dependencies":[{"issue_id":"bd-oif6","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.69196-08:00","created_by":"daemon"}]} +{"id":"bd-a5251b1a","title":"Test RPC mutation event","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T19:08:03.315443-07:00","updated_at":"2025-10-31T12:00:43.177494-07:00","closed_at":"2025-10-31T12:00:43.177494-07:00"} +{"id":"bd-36320a04","title":"Add mutation channel to internal/rpc/server.go","description":"Add mutationChan chan MutationEvent to Server struct. Emit events on CreateIssue, UpdateIssue, DeleteIssue, AddComment. Non-blocking send with default case for full channel.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T19:42:29.860173-07:00","updated_at":"2025-10-31T18:31:27.928693-07:00","closed_at":"2025-10-31T18:31:27.928693-07:00"} +{"id":"bd-f9a1","title":"Add index usage verification test for external_ref lookups","description":"Currently we test that idx_issues_external_ref index exists, but we don't verify that it's actually being used by the query planner.\n\nProposed solution:\n- Add test using EXPLAIN QUERY PLAN\n- Verify that 'SEARCH TABLE issues USING INDEX idx_issues_external_ref' appears in plan\n- Ensures O(1) lookup performance is maintained\n\nRelated: bd-1022\nFiles: internal/storage/sqlite/external_ref_test.go:260","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-02T15:32:09.85419-08:00","updated_at":"2025-11-02T16:04:47.221064-08:00","closed_at":"2025-11-02T16:04:47.221064-08:00"} +{"id":"bd-1f64","title":"Add comprehensive tests for config.yaml issue-prefix migration","description":"The GH #209 config.yaml migration lacks test coverage:\n\nMissing tests:\n- config.SetIssuePrefix() edge cases (empty file, comments, malformed YAML)\n- config.GetIssuePrefix() with various config states\n- MigrateConfigToYAML() automatic migration logic\n- bd init writing to config.yaml instead of DB\n- bd migrate DBβ†’config.yaml migration path\n\nTest scenarios needed:\n1. SetIssuePrefix with empty config.yaml\n2. SetIssuePrefix with existing config.yaml (preserves other settings)\n3. SetIssuePrefix with commented issue-prefix line\n4. SetIssuePrefix atomic write (temp file cleanup)\n5. GetIssuePrefix fallback behavior\n6. MigrateConfigToYAML when config.yaml missing prefix but DB has it\n7. MigrateConfigToYAML when both missing (detect from issues)\n8. MigrateConfigToYAML when config.yaml already has prefix (no-op)\n9. Integration test: fresh bd init writes to config.yaml only\n10. Integration test: upgrade from v0.21 DB migrates to config.yaml\n\nPriority 1 because this is a user-facing migration affecting all users upgrading to v0.22.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-03T22:33:43.08753-08:00","updated_at":"2025-11-03T22:46:16.306565-08:00","closed_at":"2025-11-03T22:46:16.306565-08:00"} +{"id":"bd-0134cc5a","title":"Fix auto-import creating duplicates instead of updating issues","description":"ROOT CAUSE: server_export_import_auto.go line 221 uses ResolveCollisions: true for ALL auto-imports. This is wrong.\n\nProblem:\n- ResolveCollisions is for branch merges (different issues with same ID)\n- Auto-import should UPDATE existing issues, not create duplicates\n- Every git pull creates NEW duplicate issues with different IDs\n- Two agents ping-pong creating endless duplicates\n\nEvidence:\n- 31 duplicate groups found (bd duplicates)\n- bd-236-246 are duplicates of bd-224-235\n- Both agents keep pulling and creating more duplicates\n- JSONL file grows endlessly with duplicates\n\nThe Fix:\nChange checkAndAutoImportIfStale in server_export_import_auto.go:\n- Remove ResolveCollisions: true (line 221)\n- Use normal import logic that updates existing issues by ID\n- Only use ResolveCollisions for explicit bd import --resolve-collisions\n\nImpact: Critical - makes beads unusable for multi-agent workflows","status":"closed","issue_type":"bug","created_at":"2025-10-27T21:48:57.733846-07:00","updated_at":"2025-10-30T17:12:58.21084-07:00","closed_at":"2025-10-27T22:26:40.627239-07:00"} +{"id":"bd-sc57","title":"Production Readiness (Optional)","description":"Enable multi-machine deployments with containerization and monitoring.","status":"closed","priority":3,"issue_type":"epic","created_at":"2025-11-07T22:43:31.527617-08:00","updated_at":"2025-11-08T01:06:12.904671-08:00","closed_at":"2025-11-08T01:06:12.904671-08:00","dependencies":[{"issue_id":"bd-sc57","depends_on_id":"bd-wfmw","type":"blocks","created_at":"2025-11-07T22:43:31.528743-08:00","created_by":"daemon"},{"issue_id":"bd-sc57","depends_on_id":"bd-pdjb","type":"blocks","created_at":"2025-11-07T22:43:31.529193-08:00","created_by":"daemon"}]} +{"id":"bd-mlcz","title":"Implement bd migrate command","description":"Add bd migrate command to move issues between repos with filtering. Should support: filtering by status/priority/labels, dry-run mode, preserving dependencies, handling source_repo field updates.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:29.902151-08:00","updated_at":"2025-11-05T18:42:52.536951-08:00","closed_at":"2025-11-05T18:42:52.536951-08:00","dependencies":[{"issue_id":"bd-mlcz","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.072312-08:00","created_by":"daemon"}]} +{"id":"bd-1c77","title":"Implement filesystem shims for WASM","description":"WASM needs JS shims for filesystem access. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Implement file read/write shims\n- [ ] Map WASM syscalls to Node.js fs API\n- [ ] Handle .beads/ directory discovery\n- [ ] Test with real JSONL files\n- [ ] Support both absolute and relative paths\n\n## Technical Notes\n- Use Node.js fs module via syscall/js\n- Consider MEMFS for in-memory option","status":"closed","issue_type":"task","created_at":"2025-11-02T18:33:31.280464-08:00","updated_at":"2025-11-05T00:55:48.756428-08:00","closed_at":"2025-11-05T00:55:48.756432-08:00","dependencies":[{"issue_id":"bd-1c77","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.281134-08:00","created_by":"daemon"}]} +{"id":"bd-4ri","title":"Fix TestFallbackToDirectModeEnablesFlush deadlock causing 10min test timeout","description":"## Problem\n\nTestFallbackToDirectModeEnablesFlush in direct_mode_test.go deadlocks for 9m59s before timing out, causing the entire test suite to take 10+ minutes instead of \u003c10 seconds.\n\n## Root Cause\n\nDatabase lock contention between test cleanup and flushToJSONL():\n- Test cleanup (line 36) tries to close DB via defer\n- flushToJSONL() (line 132) is still accessing DB\n- Results in deadlock: database/sql.(*DB).Close() waits for mutex while GetJSONLFileHash() holds it\n\n## Stack Trace Evidence\n\n```\ngoroutine 512 [sync.Mutex.Lock, 9 minutes]:\ndatabase/sql.(*DB).Close(0x14000643790)\n .../database/sql/sql.go:927 +0x84\ngithub.com/steveyegge/beads/cmd/bd.TestFallbackToDirectModeEnablesFlush.func1()\n .../direct_mode_test.go:36 +0xf4\n\nWhile goroutine running flushToJSONL() holds DB connection via GetJSONLFileHash()\n```\n\n## Impact\n\n- Test suite: 10+ minutes β†’ should be \u003c10 seconds\n- ALL other tests pass in ~4 seconds\n- This ONE test accounts for 99.9% of test runtime\n\n## Related\n\nThis is the EXACT same issue documented in MAIN_TEST_REFACTOR_NOTES.md for why main_test.go refactoring was deferred - global state manipulation + DB cleanup = deadlock.\n\n## Fix Approaches\n\n1. **Add proper cleanup sequencing** - stop flush goroutines BEFORE closing DB\n2. **Use test-specific DB lifecycle** - ensure flush completes before cleanup\n3. **Mock the flush mechanism** - avoid real DB for testing this code path \n4. **Add explicit timeout handling** - fail fast with clear error instead of hanging\n\n## Files\n\n- cmd/bd/direct_mode_test.go:36-132\n- cmd/bd/autoflush.go:353 (validateJSONLIntegrity)\n- cmd/bd/autoflush.go:508 (flushToJSONLWithState)\n\n## Acceptance\n\n- Test passes without timeout\n- Test suite completes in \u003c10 seconds\n- No deadlock between cleanup and flush operations","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T20:09:00.794372-05:00","updated_at":"2025-11-23T18:06:29.862036-08:00","closed_at":"2025-11-23T15:15:00.482019-08:00"} +{"id":"bd-cf349eb3","title":"Update LINTING.md with current baseline","description":"After cleanup, document the remaining acceptable baseline in LINTING.md so we can track regression.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T19:43:48.755997-05:00","updated_at":"2025-11-20T19:43:48.755997-05:00","closed_at":"2025-11-07T10:55:55.985273-08:00"} +{"id":"bd-29c128e8","title":"Update AGENTS.md with event-driven mode","description":"Document BEADS_DAEMON_MODE env var. Explain opt-in during Phase 1. Add troubleshooting for watcher failures.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T16:20:02.433145-07:00","updated_at":"2025-10-30T17:12:58.223058-07:00","closed_at":"2025-10-29T15:53:24.019613-07:00"} +{"id":"bd-ee1","title":"Add security tests for WriteFile permissions in doctor command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:[deleted:bd-da96-baseline-lint]]\n\nIn cmd/bd/doctor/gitignore.go:98, os.WriteFile uses 0644 permissions, flagged by gosec G306 as potentially too permissive.\n\nAdd tests to verify:\n- File is created with appropriate permissions (0600 or less)\n- Existing file permissions are not loosened\n- File ownership is correct\n- Sensitive data handling if .gitignore contains secrets\n\nThis ensures .gitignore files are created with secure permissions to prevent unauthorized access.\n\n_This issue was automatically created by AI test coverage analysis._","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T10:25:33.529153-05:00","updated_at":"2025-11-23T18:06:29.860633-08:00","dependencies":[{"issue_id":"bd-ee1","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.530705-05:00","created_by":"ai-supervisor"}]} +{"id":"bd-7a00c94e","title":"Rapid 2","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.430725-07:00","updated_at":"2025-11-07T23:21:44.923877-08:00","closed_at":"2025-11-07T23:18:52.352188-08:00"} +{"id":"bd-71107098","title":"Make two-clone workflow actually work (no hacks)","description":"TestTwoCloneCollision proves beads CANNOT handle two independent clones filing issues simultaneously. This is the basic collaborative workflow and it must work cleanly.\n\nTest location: beads_twoclone_test.go\n\nThe test creates two git clones, both file issues with same ID (test-1), --resolve-collisions remaps clone B's to test-2, but after sync:\n- Clone A has test-1=\"Issue from clone A\", test-2=\"Issue from clone B\" \n- Clone B has test-1=\"Issue from clone B\", test-2=\"Issue from clone A\"\n\nThe TITLES are swapped! Both clones have 2 issues but with opposite title assignments.\n\nWe've tried many fixes (per-project daemons, auto-sync, lamport hashing, precommit hooks) but nothing has made the test pass.\n\nGoal: Make the test pass WITHOUT hacks. The two clones should converge to identical state after sync.","notes":"**Major progress achieved!** The two-clone workflow now converges correctly.\n\n**What was fixed:**\n--3d844c58: Implemented content-hash based rename detection\n- bd-64c05d00.1: Fixed test to compare content not timestamps\n- Both clones now converge to identical issue databases\n- test-1 and test-2 have correct titles in both clones\n- No more title swapping!\n\n**Current status (VERIFIED):**\nβœ… Acceptance criteria 1: TestTwoCloneCollision passes (confirmed Oct 28)\nβœ… Acceptance criteria 2: Both clones converge to identical issue database (content matches)\nβœ… Acceptance criteria 3: No manual conflict resolution required (automatic)\nβœ… Acceptance criteria 4: Git status clean\nβœ… Acceptance criteria 5: bd ready output identical (timestamps are expected difference)\n\n**ALL ACCEPTANCE CRITERIA MET!** This issue is complete and can be closed.","status":"closed","issue_type":"epic","created_at":"2025-10-28T16:34:53.278793-07:00","updated_at":"2025-10-31T19:38:09.206303-07:00","closed_at":"2025-10-28T19:20:04.143242-07:00"} +{"id":"bd-l954","title":"Performance Testing Framework","description":"Add comprehensive performance testing for beads focusing on optimization guidance and validating 10K+ database scale. Uses standard Go tooling, follows existing patterns, minimal complexity.\n\nComponents:\n- Benchmark suite for critical operations at 10K-20K scale\n- Fixture generator for realistic test data (epic hierarchies, cross-links)\n- User diagnostics via bd doctor --perf\n- Always-on profiling integration\n\nGoals:\n- Identify bottlenecks for optimization work\n- Validate performance at 10K+ issue scale\n- Enable users to collect diagnostics for bug reports\n- Support both SQLite and JSONL import paths","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-13T22:22:11.203467-08:00","updated_at":"2025-11-13T22:22:11.203467-08:00"} +{"id":"bd-zpnq","title":"Daemons don't exit when parent process dies, causing accumulation and race conditions","description":"Multiple daemon processes accumulate over time because daemons don't automatically stop when their parent process (e.g., coding agent) is killed. This causes:\n\n1. Race conditions: 8+ daemons watching same .beads/beads.db, each with own 30s debounce timer\n2. Git conflicts: Multiple daemons racing to commit/push .beads/issues.jsonl\n3. Resource waste: Orphaned daemons from sessions days/hours old still running\n\nExample: User had 8 daemons from multiple sessions (12:37AM, 7:20PM, 7:22PM, 7:47PM, 9:19PM yesterday + 9:54AM, 10:55AM today).\n\nSolutions to consider:\n1. Track parent PID and exit when parent dies\n2. Use single global daemon instead of per-session\n3. Document manual cleanup: pkill -f \"bd daemon\"\n4. Add daemon lifecycle management (auto-cleanup of stale daemons)","notes":"Implementation complete:\n\n1. Added ParentPID field to DaemonLockInfo struct (stored in daemon.lock JSON)\n2. Daemon now tracks parent PID via os.Getppid() at startup\n3. Both event loops (polling and event-driven) check parent process every 10 seconds\n4. Daemon gracefully exits if parent process dies (detected via isProcessRunning check)\n5. Handles edge cases:\n - ParentPID=0: Older daemons without tracking (ignored)\n - ParentPID=1: Adopted by init means parent died (exits)\n - Otherwise checks if parent process is still running\n\nThe fix prevents daemon accumulation by ensuring orphaned daemons automatically exit within 10 seconds of parent death.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T18:48:41.65456-08:00","updated_at":"2025-11-07T18:53:26.382573-08:00","closed_at":"2025-11-07T18:53:26.382573-08:00"} +{"id":"bd-a1691807","title":"Integration test: mutation to export latency","description":"Measure time from bd create to JSONL update. Verify \u003c500ms latency. Test with multiple rapid mutations to verify batching.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.105247-07:00","updated_at":"2025-10-31T12:00:43.198883-07:00","closed_at":"2025-10-31T12:00:43.198883-07:00"} +{"id":"bd-6ada971e","title":"Create cmd/bd/daemon_event_loop.go (~200 LOC)","description":"Implement runEventDrivenLoop to replace polling ticker. Coordinate FileWatcher, mutation events, debouncer. Include health check ticker (60s) for daemon validation.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.429383-07:00","updated_at":"2025-10-30T17:12:58.220612-07:00","closed_at":"2025-10-28T12:30:44.067036-07:00"} +{"id":"bd-d3f0","title":"Add 'bd comment' as alias for 'bd comments add'","description":"The command 'bd comments add' is verbose and unintuitive. Add 'bd comment' as a shorter alias that works the same way.\n\n## Rationale\n- More natural: 'bd comment \u003cissue-id\u003e \u003ctext\u003e' reads better than 'bd comments add \u003cissue-id\u003e \u003ctext\u003e'\n- Matches user expectations: users naturally try 'bd comment' first\n- Follows convention: other commands like 'bd create', 'bd show', 'bd close' are verbs\n\n## Implementation\nCould be implemented as:\n1. A new command that wraps bd comments add\n2. An alias registered in cobra\n3. Keep 'bd comments add' for backwards compatibility\n\n## Examples\n```bash\nbd comment bd-1234 'This is a comment'\nbd comment bd-1234 'Multi-line comment' --body 'Additional details here'\n```","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-02T17:13:18.82563-08:00","updated_at":"2025-11-03T22:20:30.223939-08:00","closed_at":"2025-11-03T22:20:30.223939-08:00"} +{"id":"bd-ge7","title":"Improve Beads test coverage from 46% to 80%","status":"open","priority":1,"issue_type":"epic","created_at":"2025-11-20T21:21:03.700271-05:00","updated_at":"2025-11-20T21:21:03.700271-05:00"} +{"id":"bd-o78","title":"Enhance `bd doctor` to verify Claude Code integration","description":"Add checks to `bd doctor` that verify Claude Code integration is properly set up when .claude/ directory or Claude environment is detected.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-11T23:30:05.782406-08:00","updated_at":"2025-11-12T00:12:07.717579-08:00","dependencies":[{"issue_id":"bd-o78","depends_on_id":"bd-rpn","type":"blocks","created_at":"2025-11-11T23:30:05.783234-08:00","created_by":"daemon"},{"issue_id":"bd-o78","depends_on_id":"bd-br8","type":"blocks","created_at":"2025-11-11T23:30:05.783647-08:00","created_by":"daemon"},{"issue_id":"bd-o78","depends_on_id":"bd-90v","type":"parent-child","created_at":"2025-11-11T23:31:27.886095-08:00","created_by":"daemon"}]} +{"id":"bd-9f86-baseline-test","title":"Baseline quality gate failure: test","description":"The test quality gate is failing on the baseline (main branch).\n\nThis blocks the executor from claiming work until fixed.\n\nError: go test failed: exit status 1\n\nOutput:\n```\n? \tgithub.com/steveyegge/beads\t[no test files]\n# github.com/steveyegge/beads/internal/beads_test [github.com/steveyegge/beads/internal/beads.test]\ninternal/beads/routing_integration_test.go:142:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\n# github.com/steveyegge/beads/internal/compact [github.com/steveyegge/beads/internal/compact.test]\ninternal/compact/compactor_test.go:17:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\n# github.com/steveyegge/beads/cmd/bd [github.com/steveyegge/beads/cmd/bd.test]\ncmd/bd/integrity_content_test.go:31:32: undefined: ctx\ncmd/bd/integrity_content_test.go:183:32: undefined: ctx\nFAIL\tgithub.com/steveyegge/beads/cmd/bd [build failed]\n# github.com/steveyegge/beads/internal/daemon [github.com/steveyegge/beads/internal/daemon.test]\ninternal/daemon/discovery_test.go:21:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/daemon/discovery_test.go:59:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/daemon/discovery_test.go:232:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\n# github.com/steveyegge/beads/internal/importer [github.com/steveyegge/beads/internal/importer.test]\ninternal/importer/external_ref_test.go:22:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/external_ref_test.go:106:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/external_ref_test.go:197:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/external_ref_test.go:295:27: not enough arguments in call to sqlite.New\n\thave (string)\n\twant (context.Context, string)\ninternal/importer/importer_test.go:566:27: not enough arguments in call to sqlite.New\n\thave (st\n... (truncated, see full output in logs)\n```","notes":"Released by executor after budget limit hit. Tests were already fixed manually. Issue can be closed when tests are verified to pass.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T10:17:25.962406-05:00","updated_at":"2025-11-23T18:06:29.862951-08:00","closed_at":"2025-11-21T23:21:58.865069-08:00"} +{"id":"bd-cbed9619.3","title":"Implement global N-way collision resolution algorithm","description":"## Overview\nPhase 3: Replace pairwise collision resolution with global N-way resolution that produces deterministic results regardless of sync order.\n\n## Current Problem\nScoreCollisions (collision.go:228) compares issues pairwise:\n```go\ncollision.RemapIncoming = existingHash \u003c incomingHash\n```\n\nThis works for 2-way but fails for 3+ way because:\n- Each clone makes local decisions without global context\n- No guarantee intermediate states are consistent\n- Remapping decisions depend on sync order\n- Can't detect transitive remap chains (test-1 β†’ test-2 β†’ test-3)\n\n## Solution\nImplement global resolution that:\n1. Collects ALL versions of same logical issue\n2. Sorts by content hash (deterministic)\n3. Assigns sequential IDs based on sorted order\n4. All clones converge to same assignments\n\n## Implementation Tasks\n\n### 1. Create ResolveNWayCollisions function\nFile: internal/storage/sqlite/collision.go\n\nReplace ScoreCollisions with:\n```go\n// ResolveNWayCollisions handles N-way collisions deterministically.\n// Groups all versions with same base ID, sorts by content hash,\n// assigns sequential IDs. Returns mapping of old ID β†’ new ID.\nfunc ResolveNWayCollisions(ctx context.Context, s *SQLiteStorage,\n collisions []*CollisionDetail, incoming []*types.Issue) (map[string]string, error) {\n \n if len(collisions) == 0 {\n return make(map[string]string), nil\n }\n \n // Group by base ID pattern (e.g., test-1, test-2 β†’ base \"test-1\")\n groups := groupCollisionsByBaseID(collisions)\n \n idMapping := make(map[string]string)\n \n for baseID, versions := range groups {\n // 1. Collect all unique versions by content hash\n uniqueVersions := deduplicateVersionsByContentHash(versions)\n \n // 2. Sort by content hash (deterministic!)\n sort.Slice(uniqueVersions, func(i, j int) bool {\n return uniqueVersions[i].ContentHash \u003c uniqueVersions[j].ContentHash\n })\n \n // 3. Assign sequential IDs based on sorted order\n prefix := extractPrefix(baseID)\n baseNum := extractNumber(baseID)\n \n for i, version := range uniqueVersions {\n targetID := fmt.Sprintf(\"%s-%d\", prefix, baseNum+i)\n \n // Map this version to its deterministic ID\n if version.ID != targetID {\n idMapping[version.ID] = targetID\n }\n }\n }\n \n return idMapping, nil\n}\n```\n\n### 2. Implement helper functions\n\n```go\n// groupCollisionsByBaseID groups collisions by their logical base ID\nfunc groupCollisionsByBaseID(collisions []*CollisionDetail) map[string][]*types.Issue {\n groups := make(map[string][]*types.Issue)\n for _, c := range collisions {\n baseID := c.ID // All share same ID (that's why they collide)\n groups[baseID] = append(groups[baseID], c.ExistingIssue, c.IncomingIssue)\n }\n return groups\n}\n\n// deduplicateVersionsByContentHash keeps one issue per unique content hash\nfunc deduplicateVersionsByContentHash(issues []*types.Issue) []*types.Issue {\n seen := make(map[string]*types.Issue)\n for _, issue := range issues {\n if _, found := seen[issue.ContentHash]; !found {\n seen[issue.ContentHash] = issue\n }\n }\n result := make([]*types.Issue, 0, len(seen))\n for _, issue := range seen {\n result = append(result, issue)\n }\n return result\n}\n```\n\n### 3. Update handleCollisions in importer\nFile: internal/importer/importer.go\n\nReplace ScoreCollisions call with:\n```go\n// OLD:\nif err := sqlite.ScoreCollisions(ctx, sqliteStore, collisionResult.Collisions, allExistingIssues); err != nil {\n return nil, fmt.Errorf(\"failed to score collisions: %w\", err)\n}\n\n// NEW:\nidMapping, err := sqlite.ResolveNWayCollisions(ctx, sqliteStore, \n collisionResult.Collisions, issues)\nif err != nil {\n return nil, fmt.Errorf(\"failed to resolve collisions: %w\", err)\n}\n```\n\n### 4. Update RemapCollisions\nRemapCollisions currently uses collision.RemapIncoming field. Update to use idMapping directly:\n- Remove RemapIncoming logic\n- Use idMapping to determine what to remap\n- Simplify to just apply the computed mapping\n\n### 5. Add comprehensive tests\n\nTest cases:\n1. 3-way collision with different content β†’ 3 sequential IDs\n2. 3-way collision with 2 identical content β†’ 2 IDs (dedupe works)\n3. Sync order independence (Aβ†’Bβ†’C vs Cβ†’Aβ†’B produce same result)\n4. Content hash ordering is respected\n5. Works with 5+ clones\n\n## Acceptance Criteria\n- ResolveNWayCollisions implemented and replaces ScoreCollisions\n- Groups all versions of same ID together\n- Deduplicates by content hash\n- Sorts by content hash deterministically\n- Assigns sequential IDs starting from base ID\n- Returns complete mapping (old ID β†’ new ID)\n- All clones converge to same ID assignments\n- Works for arbitrary N-way collisions\n- TestThreeCloneCollision passes (or gets much closer)\n\n## Files to Modify\n- internal/storage/sqlite/collision.go (new function, helpers)\n- internal/importer/importer.go (call new function)\n- internal/storage/sqlite/collision_test.go (comprehensive tests)\n\n## Testing Strategy\n\n### Unit Tests\n- groupCollisionsByBaseID correctly groups\n- deduplicateVersionsByContentHash removes duplicates\n- Sorting by hash is stable and deterministic\n- Sequential ID assignment is correct\n\n### Integration Tests\n- 3-way collision resolves to 3 issues\n- Sync order doesn't affect final IDs\n- Content hash ordering determines winner\n\n### Property Tests\n- For any N clones with same content, all converge to same IDs\n- Idempotent: running resolution twice produces same result\n\n## Dependencies\n- Requires bd-cbed9619.5 (ContentHash field) to be completed first\n- Requires bd-cbed9619.4 (read-only detection) for clean integration\n\n## Notes\nThis is the core algorithm that enables convergence. The key insight:\n**Sort by content hash globally, not pairwise comparison.**","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:37:42.85616-07:00","updated_at":"2025-10-30T17:12:58.228707-07:00","closed_at":"2025-10-28T20:03:26.675257-07:00","dependencies":[{"issue_id":"bd-cbed9619.3","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.593102-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.3","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-28T18:39:28.30886-07:00","created_by":"daemon"},{"issue_id":"bd-cbed9619.3","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-28T18:39:28.336312-07:00","created_by":"daemon"}]} +{"id":"bd-yb8","title":"Propagate context through command handlers","description":"Thread context from signal-aware parent through all command handlers.\n\n## Context\nPart of context propagation work. Builds on bd-rtp (signal-aware contexts).\n\n## Current State\nMany command handlers create their own context.Background() locally instead of receiving context from parent.\n\n## Implementation\n1. Add context parameter to command handler functions\n2. Pass context from cobra command Run/RunE closures\n3. Update all storage operations to use propagated context\n\n## Example Pattern\n```go\n// Before\nRun: func(cmd *cobra.Command, args []string) {\n ctx := context.Background()\n store.GetIssues(ctx, ...)\n}\n\n// After \nRun: func(cmd *cobra.Command, args []string) {\n // ctx comes from parent signal-aware context\n store.GetIssues(ctx, ...)\n}\n```\n\n## Files to Update\n- All cmd/bd/*.go command handlers\n- Ensure context flows from main -\u003e cobra -\u003e handlers -\u003e storage\n\n## Benefits\n- Commands respect cancellation signals\n- Consistent context handling\n- Enables timeouts and deadlines\n\n## Acceptance Criteria\n- [ ] All command handlers use propagated context\n- [ ] No new context.Background() calls in command handlers\n- [ ] Context flows from signal handler to storage layer","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-20T21:27:02.854242-05:00","updated_at":"2025-11-20T21:37:32.44525-05:00","closed_at":"2025-11-20T21:37:32.44525-05:00","dependencies":[{"issue_id":"bd-yb8","depends_on_id":"bd-rtp","type":"blocks","created_at":"2025-11-20T21:27:02.854904-05:00","created_by":"daemon"}]} +{"id":"bd-gra","title":"Add error handling test for cmd.Help() in search command","description":"Test coverage gap identified by automated analysis (vc-217).\n\n**Original Issue:** [deleted:bd-da96-baseline-lint]\n\nIn cmd/bd/search.go:39, the return value of cmd.Help() is not checked, flagged by errcheck linter.\n\nAdd test to verify:\n- Error handling when cmd.Help() fails (e.g., output redirection fails)\n- Proper error propagation to caller\n- Command still exits gracefully on help error\n\nThis ensures the search command handles help errors properly and doesn't silently ignore failures.\n\n_This issue was automatically created by AI test coverage analysis._","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T10:25:33.52308-05:00","updated_at":"2025-11-23T18:06:29.861106-08:00","closed_at":"2025-11-21T19:31:21.889039-05:00","dependencies":[{"issue_id":"bd-gra","depends_on_id":"bd-da96-baseline-lint","type":"discovered-from","created_at":"2025-11-21T10:25:33.526016-05:00","created_by":"ai-supervisor"}]} +{"id":"bd-au0.3","title":"Fix --title vs --title-contains redundancy in bd list","description":"Clarify or consolidate --title and --title-contains flags in bd list command.\n\n**Analysis needed:**\n- Determine if these serve different purposes\n- Check actual implementation in cmd/bd/list.go\n- Review user expectations\n\n**Options:**\n1. Keep both if they have semantic difference (exact vs substring)\n2. Make one an alias of the other\n3. Remove --title-contains if truly redundant\n\n**Testing:**\n- Verify current behavior\n- Update documentation\n- Add tests for chosen approach","notes":"Investigation complete:\n\n--title and --title-contains serve DIFFERENT purposes:\n- --title: Maps to Query field (searches title, description, AND ID) - line 226\n- --title-contains: Maps to TitleContains field (searches title ONLY) - line 233\n\nThese are NOT redundant. The flag names are confusing:\n- --title is actually a general search\n- --title-contains is title-specific\n\nRECOMMENDATION: Rename --title to --query or --search for clarity\n- More intuitive: 'bd list --query foo' vs 'bd list --title foo'\n- Makes it clear it searches multiple fields\n- --title-contains remains for title-only searches\n\nAlternative: Keep as-is but improve documentation to clarify the difference.","status":"closed","issue_type":"task","created_at":"2025-11-21T21:06:37.597079-05:00","updated_at":"2025-11-21T21:31:53.446905-05:00","closed_at":"2025-11-21T21:31:53.446905-05:00","dependencies":[{"issue_id":"bd-au0.3","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:06:37.597595-05:00","created_by":"daemon"}]} +{"id":"bd-49kw","title":"Workaround for FastMCP outputSchema bug in Claude Code","description":"The beads MCP server (v0.23.1) successfully connects to Claude Code, but all tools fail to load with a schema validation error due to a bug in FastMCP 2.13.1.\n\nError: \"Invalid literal value, expected \\\"object\\\"\" in outputSchema.\n\nRoot Cause: FastMCP generates outputSchema with $ref at root level without \"type\": \"object\" for self-referential models (Issue).\n\nWorkaround: Use slash commands (/beads:ready) or wait for FastMCP fix.\n","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-20T18:55:39.041831-05:00","updated_at":"2025-11-20T18:55:39.041831-05:00"} +{"id":"bd-37dd","title":"Add topological sort utility functions","description":"Create internal/importer/sort.go with utilities for depth-based sorting of issues. Functions: GetHierarchyDepth(id), SortByDepth(issues), GroupByDepth(issues). Include stable sorting for same-depth issues.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:31:42.309207-08:00","updated_at":"2025-11-05T00:08:42.812378-08:00","closed_at":"2025-11-05T00:08:42.81238-08:00"} +{"id":"bd-g9eu","title":"Investigate TestRoutingIntegration failure","description":"TestRoutingIntegration/maintainer_with_SSH_remote failed during pre-commit check with \"expected role maintainer, got contributor\".\nThis occurred while running `go test -short ./...` on darwin/arm64.\nThe failure appears unrelated to storage/sqlite changes.\nNeed to investigate if this is a flaky test or environmental issue.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T15:55:19.337094-08:00","updated_at":"2025-11-20T15:55:19.337094-08:00"} +{"id":"bd-z3s3","title":"Create deployment scripts for GCP","description":"Automated provisioning scripts for GCP Compute Engine deployment.\n\nAcceptance Criteria:\n- Terraform/gcloud scripts\n- Static IP allocation\n- Firewall rules\n- NGINX reverse proxy config\n- TLS setup (Let's Encrypt)\n- Systemd service file\n\nFile: deployment/agent-mail/gcp/","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.294839-08:00","updated_at":"2025-11-07T22:43:43.294839-08:00","dependencies":[{"issue_id":"bd-z3s3","depends_on_id":"bd-9li4","type":"blocks","created_at":"2025-11-07T23:04:27.982336-08:00","created_by":"daemon"}]} +{"id":"bd-73iz","title":"Test issue 1","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T19:04:17.430269-08:00","updated_at":"2025-11-07T22:07:17.344468-08:00","closed_at":"2025-11-07T21:55:09.427697-08:00"} +{"id":"bd-z0yn","title":"Channel isolation test - beads","notes":"Resetting stale in_progress status from old executor run (13 days old)","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-08T04:21:17.327983-08:00","updated_at":"2025-11-21T14:38:35.459782-05:00"} +{"id":"bd-bdhn","title":"bd message: Add input validation for --importance flag","description":"The --importance flag accepts any string without validation, leading to confusing server errors.\n\n**Location:** cmd/bd/message.go:256-258\n\n**Fix:**\n- Add flag validation for: low, normal, high, urgent\n- Add shell completion support\n- Validate in runMessageSend before sending\n\n**Impact:** Better UX, prevents confusing errors","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T12:54:26.43027-08:00","updated_at":"2025-11-08T12:57:59.65367-08:00","closed_at":"2025-11-08T12:57:59.65367-08:00","dependencies":[{"issue_id":"bd-bdhn","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.910841-08:00","created_by":"daemon"}]} +{"id":"bd-2b34.8","title":"Extract daemon lifecycle functions to daemon_lifecycle.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.382892-07:00","updated_at":"2025-11-01T21:02:58.350055-07:00","closed_at":"2025-11-01T21:02:58.350055-07:00"} +{"id":"bd-eimz","title":"Add Agent Mail to QUICKSTART.md","description":"Mention Agent Mail as optional advanced feature in quickstart guide.\n\nFile: docs/QUICKSTART.md","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T22:42:51.357009-08:00","updated_at":"2025-11-08T01:07:11.598558-08:00","closed_at":"2025-11-08T01:07:11.598558-08:00","dependencies":[{"issue_id":"bd-eimz","depends_on_id":"bd-xzrv","type":"blocks","created_at":"2025-11-07T23:04:09.841956-08:00","created_by":"daemon"}]} +{"id":"bd-csvy","title":"Add tests for merge driver auto-config in bd init","description":"Add comprehensive tests for the merge driver auto-configuration functionality in `bd init`.\n\n**Test cases needed:**\n- Auto-install in quiet mode\n- Skip with --skip-merge-driver flag\n- Detect already-installed merge driver\n- Append to existing .gitattributes\n- Interactive prompt behavior (if feasible)\n\n**File:** `cmd/bd/init_test.go`","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T19:27:04.133078-08:00","updated_at":"2025-11-06T18:19:16.233673-08:00","closed_at":"2025-11-06T15:56:36.014814-08:00","dependencies":[{"issue_id":"bd-csvy","depends_on_id":"bd-32nm","type":"discovered-from","created_at":"2025-11-05T19:27:04.134299-08:00","created_by":"daemon"}]} +{"id":"bd-9b13","title":"Backend task","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-03T19:11:59.359262-08:00","updated_at":"2025-11-05T00:25:06.484312-08:00","closed_at":"2025-11-05T00:25:06.484312-08:00"} +{"id":"bd-5arw","title":"Fix remaining FK constraint failures in AddComment and ApplyCompaction","description":"Follow-up to PR #348 (Fix FOREIGN KEY constraint failed).\n\nThe initial fix addressed CloseIssue, UpdateIssueID, and RemoveLabel.\nHowever, `AddComment` (in internal/storage/sqlite/events.go) and `ApplyCompaction` (in internal/storage/sqlite/compact.go) still suffer from the same pattern: inserting an event after an UPDATE without verifying the UPDATE affected any rows.\n\nThis causes \"FOREIGN KEY constraint failed\" errors when operating on non-existent issues, instead of clean \"issue not found\" errors.\n\nTask:\n1. Apply the same fix pattern to `AddComment` and `ApplyCompaction`: check RowsAffected() after UPDATE and before event INSERT.\n2. Ensure error messages are consistent (\"issue %s not found\").\n3. Verify with reproduction tests (create a test that calls these methods with a non-existent ID).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T09:53:38.314776-08:00","updated_at":"2025-11-20T11:25:04.698765-08:00","closed_at":"2025-11-20T11:25:04.698765-08:00"} +{"id":"bd-web8","title":"Fix Windows test failures - metadata keys contain colons from absolute paths","status":"closed","issue_type":"bug","created_at":"2025-11-22T10:56:05.537802-08:00","updated_at":"2025-11-22T10:59:13.74478-08:00","closed_at":"2025-11-22T10:59:13.74478-08:00"} +{"id":"bd-p0zr","title":"bd message: Improve type safety with typed parameter structs","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-08T12:54:29.675678-08:00","updated_at":"2025-11-08T12:58:59.559643-08:00","closed_at":"2025-11-08T12:58:59.559643-08:00","dependencies":[{"issue_id":"bd-p0zr","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:55.058354-08:00","created_by":"daemon"}]} +{"id":"bd-ww0g","title":"MCP server: \"No workspace set\" and \"chunk longer than limit\" errors","description":"Two related errors reported in beads-mcp v0.21:\n\n**Error 1: \"No workspace set\" after successful set_context**\n```\nβœ“ Set beads context\nβœ— list\n Error calling tool 'list': No workspace set. Either provide workspace_root\n parameter or call set_context() first.\n```\n\nHypothesis: Environment variable persistence issue between MCP tool calls, or ContextVar not being set correctly by @with_workspace decorator.\n\n**Error 2: \"Separator is found, but chunk is longer than limit\"**\n```\nβœ— list\n Error calling tool 'list': Separator is found, but chunk is longer than limit\n```\n\nHypothesis: MCP protocol output size limit exceeded. Large issue databases may produce JSON output that exceeds MCP stdio buffer limits.\n\nPlatform: Fedora 43, using copilot-cli with Sonnet 4.5\n\nWorkaround: CLI works fine (`bd list --status open --json`)","notes":"## Fixes Implemented\n\n**Issue 1: \"No workspace set\" after successful set_context** βœ… FIXED\n\nRoot cause: os.environ doesn't persist across MCP tool calls. When set_context() set BEADS_WORKING_DIR in os.environ, that change was lost on the next tool call.\n\nSolution:\n- Added module-level _workspace_context dict for persistent storage (server.py:51)\n- Modified set_context() to store in both persistent dict and os.environ (server.py:265-287)\n- Modified with_workspace() decorator to check persistent context first (server.py:129-133)\n- Updated where_am_i() to check persistent context (server.py:302-330)\n\n**Issue 2: \"chunk longer than limit\"** βœ… FIXED\n\nRoot cause: MCP stdio protocol has buffer limits. Large issue lists with full dependencies/dependents exceed this.\n\nSolution:\n- Reduced default list limit from 50 to 20 (server.py:356, models.py:122)\n- Reduced max list limit from 1000 to 100 (models.py:122)\n- Strip dependencies/dependents from list() and ready() responses (server.py:343-350, 368-373)\n- Full dependency details still available via show() command\n\n## Testing\n\nβœ… Python syntax validated with py_compile\nβœ… Changes are backward compatible\nβœ… Persistent context falls back to os.environ for compatibility\n\nUsers should now be able to call set_context() once and have it persist across all subsequent tool calls. Large databases will no longer cause buffer overflow errors.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T14:32:18.315155-08:00","updated_at":"2025-11-07T21:02:55.470937-08:00","closed_at":"2025-11-07T16:53:46.929942-08:00"} +{"id":"bd-85d1","title":"Add integration tests for multi-repo sync","description":"Test: Clone A deletes issue, Clone B imports Clone A's JSONL. Verify Clone B handles deletion gracefully with resurrection. Test concurrent imports with same orphans (should be idempotent). Test round-trip fidelity (exportβ†’delete parentβ†’importβ†’verify structure).","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.410318-08:00","updated_at":"2025-11-05T00:44:27.948465-08:00","closed_at":"2025-11-05T00:44:27.948467-08:00"} +{"id":"bd-8zf2","title":"MCP server loses workspace context after Amp restart - causes silent failures","description":"**CRITICAL BUG**: The beads MCP server loses workspace context when Amp restarts, leading to silent failures and potential data corruption.\n\n## Reproduction\n1. Start Amp with beads MCP server configured\n2. Call `mcp__beads__set_context(workspace_root=\"/path/to/project\")`\n3. Use MCP tools successfully (e.g., `mcp__beads__show`, `mcp__beads__list`)\n4. Restart Amp (new thread/session)\n5. Try to use MCP tools without calling `set_context` again\n6. **Result**: \"Not connected\" or \"No workspace set\" errors\n\n## Impact\n- Amp agents silently fail when trying to read/update beads issues\n- May attempt to create duplicate issues because they can't see existing ones\n- Potential for data corruption if operating on wrong database\n- Breaks multi-session workflows\n- Creates confusion: CLI works (`./bd`) but MCP tools don't\n\n## Current Workaround\nManually call `mcp__beads__set_context()` at start of every Amp session.\n\n## Root Cause\nMCP server is stateful and doesn't persist workspace context across restarts.\n\n## Proposed Fix\n**Option 1 (Best)**: Auto-detect workspace from current working directory\n- Match behavior of CLI `./bd` commands\n- Check for `.beads/` directory in current dir or parents\n- No manual context setting needed\n\n**Option 2**: Persist context in MCP server state file\n- Save last workspace_root to `~/.config/beads/mcp_context.json`\n- Restore on server startup\n\n**Option 3**: Require explicit context in every MCP call\n- Add optional `workspace_root` parameter to all MCP tools\n- Fall back to saved context if not provided\n\nAcceptance:\n- MCP tools work across Amp restarts without manual set_context()\n- Auto-detection matches CLI behavior (walks up from CWD)\n- Clear error message when no workspace found\n- set_context() still works for explicit override\n- BEADS_WORKING_DIR env var support\n- Integration test validates restart behavior","status":"closed","issue_type":"bug","created_at":"2025-11-07T23:50:52.083111-08:00","updated_at":"2025-11-07T23:58:44.397502-08:00","closed_at":"2025-11-07T23:58:44.397502-08:00"} +{"id":"bd-8ayj","title":"bd-hv01: Race condition with concurrent snapshot operations","description":"## Problem\nSnapshot files have no locking. Multiple processes can call captureLeftSnapshot simultaneously:\n\n1. Process A: export β†’ begins snapshot\n2. Process B: export β†’ begins snapshot\n3. Process A: writes partial left.jsonl\n4. Process B: overwrites with its left.jsonl\n5. Process A: completes merge with wrong snapshot\n\n## Impact\n- Data corruption in multi-process scenarios\n- Daemon + manual sync race\n- Multiple git clones on same filesystem\n\n## Fix\nUse atomic file operations with process-specific temp files:\n```go\nfunc captureLeftSnapshot(jsonlPath string) error {\n _, leftPath := getSnapshotPaths(jsonlPath)\n tempPath := fmt.Sprintf(\"%s.%d.tmp\", leftPath, os.Getpid())\n if err := copyFileSnapshot(jsonlPath, tempPath); err != nil {\n return err\n }\n return os.Rename(tempPath, leftPath) // Atomic on POSIX\n}\n```\n\n## Files Affected\n- cmd/bd/deletion_tracking.go:24-29 (captureLeftSnapshot)\n- cmd/bd/deletion_tracking.go:31-36 (updateBaseSnapshot)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:15:38.177367-08:00","updated_at":"2025-11-06T18:46:55.91344-08:00","closed_at":"2025-11-06T18:46:55.91344-08:00","dependencies":[{"issue_id":"bd-8ayj","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.875543-08:00","created_by":"daemon"}]} +{"id":"bd-r46","title":"Support --reason flag in daemon mode for reopen command","description":"The reopen.go command has a TODO at line 61 to add reason as a comment once RPC supports AddComment. Currently --reason flag is ignored in daemon mode with a warning.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-21T18:55:10.773626-05:00","updated_at":"2025-11-21T18:55:10.773626-05:00"} +{"id":"bd-3433","title":"Implement topological sort for import ordering","description":"Refactor upsertIssues() to sort issues by hierarchy depth before batch creation. Ensures parents are created before children, fixing latent bug where parent-child pairs in same batch can fail if ordered wrong. Sort by dot count, create in depth-order batches (0β†’1β†’2β†’3).","status":"closed","issue_type":"task","created_at":"2025-11-04T12:31:42.22005-08:00","updated_at":"2025-11-05T00:08:42.812154-08:00","closed_at":"2025-11-05T00:08:42.812156-08:00"} +{"id":"bd-d68f","title":"Add tests for Comments API (AddIssueComment, GetIssueComments)","description":"Comments API currently has 0% coverage. Need tests for:\n- AddIssueComment - adding comments to issues\n- GetIssueComments - retrieving comments\n- Comment ordering and pagination\n- Edge cases (non-existent issues, empty comments)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-01T22:40:58.980688-07:00","updated_at":"2025-11-01T22:53:42.124391-07:00","closed_at":"2025-11-01T22:53:42.124391-07:00"} +{"id":"bd-22e0bde9","title":"Add TestNWayCollision for 5+ clones","description":"## Overview\nAdd comprehensive tests for N-way (5+) collision resolution to verify the solution scales beyond 3 clones.\n\n## Purpose\nWhile TestThreeCloneCollision validates the basic N-way case, we need to verify:\n1. Solution scales to arbitrary N\n2. Performance is acceptable with more clones\n3. Convergence time is bounded\n4. No edge cases in larger collision groups\n\n## Implementation Tasks\n\n### 1. Create TestFiveCloneCollision\nFile: beads_twoclone_test.go (or new beads_nway_test.go)\n\n```go\nfunc TestFiveCloneCollision(t *testing.T) {\n // Test with 5 clones creating same ID with different content\n // Verify all 5 clones converge after sync rounds\n \n t.Run(\"SequentialSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"A\", \"B\", \"C\", \"D\", \"E\")\n })\n \n t.Run(\"ReverseSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"E\", \"D\", \"C\", \"B\", \"A\")\n })\n \n t.Run(\"RandomSync\", func(t *testing.T) {\n testNCloneCollision(t, 5, \"C\", \"A\", \"E\", \"B\", \"D\")\n })\n}\n```\n\n### 2. Implement generalized testNCloneCollision\nGeneralize the 3-clone test to handle arbitrary N:\n\n```go\nfunc testNCloneCollision(t *testing.T, numClones int, syncOrder ...string) {\n t.Helper()\n \n if len(syncOrder) != numClones {\n t.Fatalf(\"syncOrder length (%d) must match numClones (%d)\", \n len(syncOrder), numClones)\n }\n \n tmpDir := t.TempDir()\n \n // Setup remote and N clones\n remoteDir := setupBareRepo(t, tmpDir)\n cloneDirs := make(map[string]string)\n \n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n cloneDirs[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates issue with same ID but different content\n for name, dir := range cloneDirs {\n createIssue(t, dir, fmt.Sprintf(\"Issue from clone %s\", name))\n }\n \n // Sync in specified order\n for _, name := range syncOrder {\n syncClone(t, cloneDirs[name], name)\n }\n \n // Final pull for convergence\n for name, dir := range cloneDirs {\n finalPull(t, dir, name)\n }\n \n // Verify all clones have all N issues\n expectedTitles := make(map[string]bool)\n for i := 0; i \u003c numClones; i++ {\n name := string(rune('A' + i))\n expectedTitles[fmt.Sprintf(\"Issue from clone %s\", name)] = true\n }\n \n for name, dir := range cloneDirs {\n titles := getTitles(t, dir)\n if !compareTitleSets(titles, expectedTitles) {\n t.Errorf(\"Clone %s missing issues: expected %v, got %v\", \n name, expectedTitles, titles)\n }\n }\n \n t.Log(\"βœ“ All\", numClones, \"clones converged successfully\")\n}\n```\n\n### 3. Add performance benchmarks\nTest convergence time and memory usage:\n\n```go\nfunc BenchmarkNWayCollision(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n // Run N-way collision and measure time\n testNCloneCollisionBench(b, n)\n }\n })\n }\n}\n```\n\n### 4. Add convergence time tests\nVerify bounded convergence:\n\n```go\nfunc TestConvergenceTime(t *testing.T) {\n // Test that convergence happens within expected rounds\n // For N clones, should converge in at most N-1 sync rounds\n \n for n := 3; n \u003c= 10; n++ {\n t.Run(fmt.Sprintf(\"N=%d\", n), func(t *testing.T) {\n rounds := measureConvergenceRounds(t, n)\n maxExpected := n - 1\n if rounds \u003e maxExpected {\n t.Errorf(\"Convergence took %d rounds, expected ≀ %d\", \n rounds, maxExpected)\n }\n })\n }\n}\n```\n\n### 5. Add edge case tests\nTest boundary conditions:\n- All N clones have identical content (dedup works)\n- N-1 clones have same content, 1 differs\n- All N clones have unique content\n- Mix of collisions and non-collisions\n\n## Acceptance Criteria\n- TestFiveCloneCollision passes with all sync orders\n- All 5 clones converge to identical content\n- Performance is acceptable (\u003c 5 seconds for 5 clones)\n- Convergence time is bounded (≀ N-1 rounds)\n- Edge cases handled correctly\n- Benchmarks show scalability to 10+ clones\n\n## Files to Create/Modify\n- beads_twoclone_test.go or beads_nway_test.go\n- Add helper functions for N-clone setup\n\n## Testing Strategy\n\n### Test Matrix\n| N Clones | Sync Orders | Expected Result |\n|----------|-------------|-----------------|\n| 3 | Aβ†’Bβ†’C | Pass |\n| 3 | Cβ†’Bβ†’A | Pass |\n| 5 | Aβ†’Bβ†’Cβ†’Dβ†’E | Pass |\n| 5 | Eβ†’Dβ†’Cβ†’Bβ†’A | Pass |\n| 5 | Random | Pass |\n| 10 | Sequential | Pass |\n\n### Performance Targets\n- 3 clones: \u003c 2 seconds\n- 5 clones: \u003c 5 seconds\n- 10 clones: \u003c 15 seconds\n\n## Dependencies\n- Requires bd-cbed9619.5, bd-cbed9619.4, bd-cbed9619.3, bd-cbed9619.2 to be completed\n- TestThreeCloneCollision must pass first\n\n## Success Metrics\n- All tests pass for N ∈ {3, 5, 10}\n- Convergence time scales linearly (O(N))\n- Memory usage reasonable (\u003c 100MB for 10 clones)\n- No data corruption or loss in any scenario","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T23:05:13.974702-07:00","updated_at":"2025-10-31T12:00:43.197709-07:00","closed_at":"2025-10-31T12:00:43.197709-07:00"} +{"id":"bd-5599","title":"Fix TestListCommand duplicate dependency constraint violation","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-10-31T21:27:05.557548-07:00","updated_at":"2025-10-31T21:27:11.429018-07:00","closed_at":"2025-10-31T21:27:11.429018-07:00"} +{"id":"bd-248bdc3e","title":"Add optional post-merge git hook example for bd sync","description":"Create example git hook that auto-runs bd sync after git pull/merge.\n\nAdd to examples/git-hooks/:\n- post-merge hook that checks if .beads/issues.jsonl changed\n- If changed: run `bd sync` automatically\n- Make it optional/documented (not auto-installed)\n\nBenefits:\n- Zero-friction sync after git pull\n- Complements auto-detection as belt-and-suspenders\n\nNote: post-merge hook already exists for pre-commit/post-merge. Extend it to support sync.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-25T22:47:14.668842-07:00","updated_at":"2025-11-06T20:06:49.217298-08:00","closed_at":"2025-11-06T19:51:37.787964-08:00"} +{"id":"bd-fd56","title":"Wrap git operations in GitClient interface","description":"Create internal/daemonrunner/git.go with GitClient interface (HasUpstream, HasChanges, Commit, Push, Pull). Default implementation using os/exec. Use in Syncer and Run loop for testability.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.88734-07:00","updated_at":"2025-11-02T12:32:00.159595-08:00","closed_at":"2025-11-02T12:32:00.159597-08:00"} +{"id":"bd-07af","title":"Need comprehensive daemon health check command (bd daemon doctor?)","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-10-31T21:08:09.092473-07:00","updated_at":"2025-11-01T20:10:41.957435-07:00","closed_at":"2025-11-01T20:10:41.957435-07:00","dependencies":[{"issue_id":"bd-07af","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:09.093276-07:00","created_by":"stevey"}]} +{"id":"bd-o4qy","title":"Improve CheckStaleness error handling","description":"## Problem\n\nCheckStaleness returns 'false' (not stale) for multiple error conditions instead of returning errors. This masks problems.\n\n**Location:** internal/autoimport/autoimport.go:253-285\n\n## Edge Cases That Return False\n\n1. **Invalid last_import_time format** (line 259-262)\n2. **No JSONL file found** (line 267-277) \n3. **JSONL stat fails** (line 279-282)\n\n## Fix\n\nReturn errors for abnormal conditions:\n\n```go\nlastImportTime, err := time.Parse(time.RFC3339, lastImportStr)\nif err != nil {\n return false, fmt.Errorf(\"corrupted last_import_time: %w\", err)\n}\n\nif jsonlPath == \"\" {\n return false, fmt.Errorf(\"no JSONL file found\")\n}\n\nstat, err := os.Stat(jsonlPath)\nif err != nil {\n return false, fmt.Errorf(\"cannot stat JSONL: %w\", err)\n}\n```\n\n## Impact\nMedium - edge cases are rare but should be handled\n\n## Effort \n30 minutes - requires updating callers in RPC server","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-20T20:17:27.606219-05:00","updated_at":"2025-11-20T20:17:27.606219-05:00","dependencies":[{"issue_id":"bd-o4qy","depends_on_id":"bd-2q6d","type":"blocks","created_at":"2025-11-20T20:18:26.81065-05:00","created_by":"stevey"}]} +{"id":"bd-363f","title":"Document bd-wasm installation and usage","description":"Create documentation for bd-wasm:\n- Update README with npm installation instructions\n- Add troubleshooting section for WASM-specific issues\n- Document known limitations vs native bd\n- Add examples for Claude Code Web sandbox usage\n- Update INSTALLING.md with bd-wasm option","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T21:58:07.305711-08:00","updated_at":"2025-11-05T00:55:48.756684-08:00","closed_at":"2025-11-05T00:55:48.756687-08:00","dependencies":[{"issue_id":"bd-363f","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.530675-08:00","created_by":"stevey"}]} +{"id":"bd-sjmr","title":"Fix inconsistent error handling in multi-repo deletion tracking","description":"From bd-xo6b code review: Multi-repo deletion tracking has mixed failure modes that can leave system in inconsistent state.\n\n**Current behavior (daemon_sync.go):**\n- Snapshot capture (L505-514): Hard fail β†’ aborts sync\n- Merge/prune (L575-584): Hard fail β†’ aborts sync \n- Base snapshot update (L613-619): Soft fail β†’ logs warning, continues\n\n**Critical problem:**\nIf merge fails on repo 3 of 5:\n- Repos 1-2 have already merged and deleted issues (irreversible)\n- Repos 3-5 are untouched\n- Database is in partially-updated state\n- No rollback mechanism\n\n**Real-world scenario:**\n```\nSync with repos [A, B, C]:\n1. Capture snapshots A βœ“, B βœ“, C βœ— β†’ ABORT (good)\n2. Merge A βœ“, B βœ— β†’ ABORT but A already deleted issues (BAD - no rollback)\n3. Update base A ⚠, B ⚠ β†’ Warnings only (inconsistent with 1 \u0026 2)\n```\n\n**Solution options:**\n1. **Two-phase commit:**\n - Phase 1: Validate all repos (check files exist, readable, parseable)\n - Phase 2: Apply changes atomically (or fail entirely before any mutations)\n\n2. **Fail-fast validation:**\n - Before any snapshot/merge operations, validate all repos upfront\n - Abort entire sync if any repo fails validation\n\n3. **Make base snapshot update consistent:**\n - Either make it hard-fail like the others, or make all soft-fail\n\n**Files:**\n- cmd/bd/daemon_sync.go:505-514 (snapshot capture)\n- cmd/bd/daemon_sync.go:575-584 (merge/prune)\n- cmd/bd/daemon_sync.go:613-619 (base snapshot update)\n\n**Recommendation:** Use option 1 (two-phase) or option 2 (fail-fast validation) + fix base snapshot inconsistency.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T19:31:29.538092-08:00","updated_at":"2025-11-06T19:35:41.268584-08:00","closed_at":"2025-11-06T19:35:41.268584-08:00","dependencies":[{"issue_id":"bd-sjmr","depends_on_id":"bd-xo6b","type":"discovered-from","created_at":"2025-11-06T19:32:12.310033-08:00","created_by":"daemon"}]} +{"id":"bd-bxha","title":"Default to YES for git hooks and merge driver installation","description":"Currently bd init prompts user to install git hooks and merge driver, but setup is incomplete if user declines. Change to install by default unless --skip-hooks or --skip-merge-driver flags are passed. Better safe defaults. If installation fails, warn user and suggest bd doctor --fix.","status":"open","priority":1,"issue_type":"feature","created_at":"2025-11-21T23:16:10.172238-08:00","updated_at":"2025-11-21T23:16:28.369137-08:00","dependencies":[{"issue_id":"bd-bxha","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:10.173034-08:00","created_by":"daemon"}]} +{"id":"bd-cb64c226.8","title":"Update Metrics and Health Endpoints","description":"Remove cache-related metrics from health/metrics endpoints","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T22:55:49.212047-07:00","updated_at":"2025-10-30T17:12:58.212888-07:00","closed_at":"2025-10-28T14:08:38.06569-07:00"} +{"id":"bd-4oqu.1","title":"Test child direct","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T13:00:55.992712-08:00","updated_at":"2025-11-05T13:01:11.654435-08:00","closed_at":"2025-11-05T13:01:11.654435-08:00"} +{"id":"bd-968f","title":"Add unit tests for config modes","description":"Test all four orphan_handling modes: strict (fails), resurrect (creates tombstone), skip (logs warning), allow (imports orphan). Verify error messages and logging output for each mode.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:21.367129-08:00","updated_at":"2025-11-05T00:44:27.948775-08:00","closed_at":"2025-11-05T00:44:27.948777-08:00"} +{"id":"bd-b55e2ac2","title":"Fix autoimport tests for content-hash collision scoring","description":"## Overview\nThree autoimport tests are failing after bd-cbed9619.4 because they expect behavior based on the old reference-counting collision resolution, but the system now uses deterministic content-hash scoring.\n\n## Failing Tests\n1. `TestAutoImportMultipleCollisionsRemapped` - expects local versions preserved\n2. `TestAutoImportAllCollisionsRemapped` - expects local versions preserved \n3. `TestAutoImportCollisionRemapMultipleFields` - expects specific collision resolution behavior\n\n## Root Cause\nThese tests were written when ScoreCollisions used reference counting to determine which version to keep. Now it uses content-hash comparison (introduced in commit 2e87329), which produces different but deterministic results.\n\n## Example\nOld behavior: Issue with more references would be kept\nNew behavior: Issue with lexicographically lower content hash is kept\n\n## Solution\nUpdate each test to:\n1. Verify the new content-hash based behavior is correct\n2. Check that the remapped issue (not necessarily local/remote) has the expected content\n3. Ensure dependencies are preserved on the correct remapped issue\n\n## Acceptance Criteria\n- All three autoimport tests pass\n- Tests verify content-hash determinism (same collision always resolves the same way)\n- Tests check dependency preservation on remapped issues\n- Test documentation explains content-hash scoring expectations\n\n## Files to Modify\n- `cmd/bd/autoimport_collision_test.go`\n\n## Testing\nRun: `go test ./cmd/bd -run \"TestAutoImport.*Collision\" -v`","status":"open","priority":2,"issue_type":"task","created_at":"2025-10-28T19:17:28.358028-07:00","updated_at":"2025-10-30T17:12:58.179059-07:00"} +{"id":"bd-0e74","title":"Comprehensive testing for separate branch workflow","description":"Comprehensive testing for separate branch workflow including unit tests, integration tests, and performance testing.\n\nTasks:\n- Unit tests for worktree management\n- Unit tests for config parsing\n- Integration tests: create/update/close β†’ beads branch\n- Integration test: merge beads β†’ main\n- Integration test: protected branch scenario\n- Integration test: network failure recovery\n- Integration test: config change handling\n- Manual testing guide\n- Performance testing (worktree overhead)\n\nTest scenarios: fresh setup, issue operations, merge workflow, protected branch, error handling, migration, multiple workspaces, sparse checkout\n\nEstimated effort: 4-5 days","notes":"Completed comprehensive test coverage. Added 4 new integration tests: config change handling, multiple concurrent clones (3-way), performance testing (avg 77ms \u003c 150ms target), and network failure recovery. All tests pass. Coverage includes fresh setup, issue ops, error handling, multiple workspaces, sparse checkout, config changes, network failures, and performance.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.580741-08:00","updated_at":"2025-11-02T21:40:35.337464-08:00","closed_at":"2025-11-02T21:40:35.337468-08:00","dependencies":[{"issue_id":"bd-0e74","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:51.348226-08:00","created_by":"stevey"}]} +{"id":"bd-64c05d00.1","title":"Fix TestTwoCloneCollision to compare content not timestamps","description":"The test at beads_twoclone_test.go:204-207 currently compares full JSON output including timestamps, causing false negative failures.\n\nCurrent behavior:\n- Both clones converge to identical semantic content\n- Clone A: test-2=\"Issue from clone A\", test-1=\"Issue from clone B\"\n- Clone B: test-1=\"Issue from clone B\", test-2=\"Issue from clone A\"\n- Titles match IDs correctly, no data corruption\n- Only timestamps differ (expected and acceptable)\n\nFix needed:\n- Replace exact JSON comparison with content-aware comparison\n- Normalize or ignore timestamp fields when asserting convergence\n- Test should PASS after this fix\n\nThis blocks completion of bd-71107098.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T17:58:52.057194-07:00","updated_at":"2025-10-30T17:12:58.226744-07:00","closed_at":"2025-10-28T18:01:38.751895-07:00","dependencies":[{"issue_id":"bd-64c05d00.1","depends_on_id":"bd-64c05d00","type":"parent-child","created_at":"2025-10-28T17:58:52.058202-07:00","created_by":"stevey"},{"issue_id":"bd-64c05d00.1","depends_on_id":"bd-71107098","type":"blocks","created_at":"2025-10-28T17:58:52.05873-07:00","created_by":"stevey"}]} +{"id":"bd-e1d645e8","title":"Rapid 4","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.484329-07:00","updated_at":"2025-11-07T23:21:44.925546-08:00","closed_at":"2025-11-07T23:18:52.316948-08:00"} +{"id":"bd-9msn","title":"Add monitoring and alerting","description":"Observability for production Agent Mail server.\n\nAcceptance Criteria:\n- Health check endpoint (/health)\n- Prometheus metrics export\n- Grafana dashboard\n- Alerts for server downtime\n- Alerts for high error rate\n- Log aggregation config\n\nFile: deployment/agent-mail/monitoring/","status":"open","priority":3,"issue_type":"task","created_at":"2025-11-07T22:43:43.354117-08:00","updated_at":"2025-11-07T22:43:43.354117-08:00","dependencies":[{"issue_id":"bd-9msn","depends_on_id":"bd-z3s3","type":"blocks","created_at":"2025-11-07T23:04:28.050074-08:00","created_by":"daemon"}]} +{"id":"bd-2b34.5","title":"Add tests for daemon sync module","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.354701-07:00","updated_at":"2025-11-01T21:06:55.184844-07:00","closed_at":"2025-11-01T21:06:55.184844-07:00"} +{"id":"bd-nszi","title":"Post-merge hook silently fails on JSONL conflicts, poor UX","description":"When git pull results in merge conflicts in .beads/issues.jsonl, the post-merge hook runs 'bd sync --import-only' which fails, but stderr was redirected to /dev/null. User only saw generic warning.\n\nFixed by capturing and displaying the actual error output, so users see 'Git conflict markers detected' message immediately.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T02:31:04.909925-08:00","updated_at":"2025-11-08T02:31:45.237286-08:00","closed_at":"2025-11-08T02:31:45.237286-08:00"} +{"id":"bd-5bbf","title":"Test all core bd commands in WASM for feature parity","description":"Comprehensive testing of bd-wasm against native bd:\n- Test all CRUD operations (create, update, show, close)\n- Test dependency management (dep add, dep tree)\n- Test sync operations (sync, import, export)\n- Verify JSONL output matches native bd\n- Run existing Go test suite in WASM if possible\n- Benchmark performance (should be within 2x of native)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T21:58:07.300923-08:00","updated_at":"2025-11-05T00:55:48.757247-08:00","closed_at":"2025-11-05T00:55:48.757249-08:00","dependencies":[{"issue_id":"bd-5bbf","depends_on_id":"bd-44d0","type":"parent-child","created_at":"2025-11-02T22:23:49.503229-08:00","created_by":"stevey"},{"issue_id":"bd-5bbf","depends_on_id":"bd-b4b0","type":"blocks","created_at":"2025-11-02T22:23:55.623601-08:00","created_by":"stevey"}]} +{"id":"bd-1h8","title":"Fix compact --analyze/--apply error messages to clarify direct mode requirement","description":"**Problem:**\nWhen users run `bd compact --analyze` with daemon running, they get:\n```\nError: compact requires SQLite storage\n```\n\nThis is misleading because they ARE using SQLite (via daemon), but the command needs DIRECT SQLite access.\n\n**Current behavior:**\n- Error message suggests they don't have SQLite\n- No hint about using --no-daemon flag\n- Related to issue #349 item #1\n\n**Proposed fix:**\n1. Update error messages in cmd/bd/compact.go lines 106-114 (analyze) and 121-137 (apply)\n2. Add explicit hint: \"Use --no-daemon flag to bypass daemon\"\n3. Change SQLite check error from \"requires SQLite storage\" to \"failed to open database in direct mode\"\n\n**Files to modify:**\n- cmd/bd/compact.go (lines ~106-137)\n\n**Testing:**\n- Run with daemon: `bd compact --analyze` should show clear error + hint\n- Run with --no-daemon: `bd compact --analyze --no-daemon` should work\n- Verify error message is actionable","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-20T20:47:45.606924-05:00","updated_at":"2025-11-23T18:06:29.865286-08:00","closed_at":"2025-11-20T20:59:13.406952-05:00"} +{"id":"bd-a101","title":"Support separate branch for beads commits","description":"Allow beads to commit to a separate branch (e.g., beads-metadata) using git worktrees to support protected main branch workflows.\n\nSolves GitHub Issue #205 - Users need to protect main branch while maintaining beads workflow.\n\nKey advantages:\n- Works on any git platform\n- Main branch stays protected \n- No disruption to user's working directory\n- Backward compatible (opt-in via config)\n- Minimal disk overhead (sparse checkout)\n\nTotal estimate: 17-24 days (4-6 weeks with parallel work)","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-02T15:21:20.098247-08:00","updated_at":"2025-11-04T12:36:53.772727-08:00","closed_at":"2025-11-04T12:36:53.772727-08:00"} +{"id":"bd-2b34.1","title":"Extract daemon logger functions to daemon_logger.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.343617-07:00","updated_at":"2025-11-01T20:31:54.434039-07:00","closed_at":"2025-11-01T20:31:54.434039-07:00"} +{"id":"bd-23o5","title":"Update FAQ: How does OpenSpec/spec-driven development relate to Beads?","description":"Answer the question raised in GH discussion #240 about OpenSpec integration.\n\nAnswer Summary:\n- Single-agent: OpenSpec β†’ Beads β†’ Code\n- Multi-agent swarm: Use Gastown as coordination layer\n- Gastown provides OpenSpec-style planning infrastructure\n- Planning agents create specs, distribute as Beads issues\n- 'Gastown plans, Beads remembers, Agents execute'\n\nAction Items:\n1. Add FAQ entry explaining the architecture layers\n2. Link to Gastown planning design (gt-cke)\n3. Reference discussion #240 and rbergman's insights\n4. Clarify: Beads focuses on execution memory, not planning\n\nCross-Reference:\n- Gastown issue gt-cke: Design OpenSpec-style planning layer\n- GH discussion #240: https://github.com/steveyegge/beads/discussions/240\n\nKeep FAQ concise - detailed architecture lives in Gastown docs.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-23T14:52:23.786022-08:00","updated_at":"2025-11-23T14:52:23.786022-08:00"} +{"id":"bd-d3e5","title":"Test issue 2","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T09:44:17.116768539Z","updated_at":"2025-11-08T03:09:48.249933-08:00","closed_at":"2025-11-08T03:09:48.249936-08:00"} +{"id":"bd-urob","title":"bd-hv01: Refactor snapshot management into dedicated module","description":"Problem: Snapshot logic is scattered across deletion_tracking.go. Would benefit from abstraction with SnapshotManager type.\n\nBenefits: cleaner separation of concerns, easier to test in isolation, better encapsulation, could add observability/metrics.\n\nSuggested improvements: add magic constants, track merge statistics, better error messages.\n\nFiles: cmd/bd/deletion_tracking.go (refactor into new snapshot_manager.go)","status":"closed","priority":3,"issue_type":"chore","created_at":"2025-11-06T18:16:27.943666-08:00","updated_at":"2025-11-08T02:24:24.686744-08:00","closed_at":"2025-11-08T02:19:14.152412-08:00","dependencies":[{"issue_id":"bd-urob","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:15.192447-08:00","created_by":"daemon"}]} +{"id":"bd-7e7ddffa.1","title":"bd resolve-conflicts - Git merge conflict resolver","description":"Automatically resolve JSONL merge conflicts.\n\nModes:\n- Mechanical: ID remapping (no AI)\n- AI-assisted: Smart merge/keep decisions\n- Interactive: Review each conflict\n\nHandles \u003c\u003c\u003c\u003c\u003c\u003c\u003c conflict markers in .beads/beads.jsonl\n\nFiles: cmd/bd/resolve_conflicts.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-10-28T14:48:30.083642-07:00","updated_at":"2025-10-30T17:12:58.220145-07:00","dependencies":[{"issue_id":"bd-7e7ddffa.1","depends_on_id":"bd-7e7ddffa","type":"parent-child","created_at":"2025-10-29T19:58:28.847736-07:00","created_by":"stevey"}]} +{"id":"bd-m8t","title":"Extract computeJSONLHash helper to eliminate code duplication","description":"SHA256 hash computation is duplicated in 3 places:\n- cmd/bd/integrity.go:50-52\n- cmd/bd/sync.go:611-613\n- cmd/bd/import.go:318-319\n\nExtract to shared helper function computeJSONLHash(jsonlPath string) (string, error) that includes proper #nosec comment and error handling.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:31:05.836496-05:00","updated_at":"2025-11-20T21:35:36.04171-05:00","closed_at":"2025-11-20T21:35:36.04171-05:00","dependencies":[{"issue_id":"bd-m8t","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:05.837915-05:00","created_by":"daemon"}]} +{"id":"bd-8kde","title":"bd delete bulk operations fight with auto-import/daemon causing data resurrection","description":"When bulk deleting issues (e.g., 244 closed issues older than 24h), the process fights with auto-import and daemon infrastructure:\n\n**Expected behavior:**\n- Delete 244 issues from 468-issue database\n- Export to JSONL (224 lines)\n- Commit and push\n- Result: 224 issues\n\n**Actual behavior:**\n- Delete 244 issues \n- Import runs (from stale git JSONL with 468 issues)\n- Resurrects deleted issues back into database\n- Export writes 356 lines (not 224)\n- Math: 468 - 244 = 224, but got 356 (132 issues resurrected)\n\n**Root cause:**\nAuto-import keeps re-importing from git during the delete operation, before the new JSONL is committed. The workflow is:\n1. Delete from DB\n2. Auto-import runs (reads old JSONL from git with deleted issues still present)\n3. Issues come back\n4. Export writes partially-deleted state\n\n**Solution options:**\n1. Add `--no-auto-import` flag to bulk delete operations\n2. Atomic delete-export-commit operation that suppresses imports\n3. Dedicated `bd prune` command that handles this correctly\n4. Lock file to prevent auto-import during bulk mutations\n\n**Impact:**\n- Bulk cleanup operations don't work reliably\n- Makes it nearly impossible to prune old closed issues\n- Confusing UX (delete 244, but only 112 actually removed)","notes":"**FIXED**: Auto-import now skips during delete operations to prevent resurrection.\n\n**Root cause confirmed**: Auto-import was running in PersistentPreRun before delete executed, causing it to re-import stale JSONL from git and resurrect deleted issues.\n\n**Solution implemented**:\n1. Added delete to skip list in main.go PersistentPreRun (alongside import and sync --dry-run)\n2. Delete operations now complete atomically without auto-import interference\n3. Added comprehensive test (TestBulkDeleteNoResurrection) to prevent regression\n\n**Test verification**:\n- Creates 20 issues, deletes 10\n- Verifies no resurrection after delete\n- Confirms JSONL has correct count (10 remaining)\n- All existing tests still pass","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T03:01:09.796852-08:00","updated_at":"2025-11-08T03:06:04.416994-08:00","closed_at":"2025-11-08T03:06:04.416994-08:00"} +{"id":"bd-c9a482db","title":"Add internal/ai package for AI-assisted repairs","description":"Add AI integration package to support AI-powered repair commands.\n\nProviders:\n- Anthropic (Claude)\n- OpenAI\n- Ollama (local)\n\nFeatures:\n- Conflict resolution analysis\n- Duplicate detection via embeddings\n- Configuration via env vars (BEADS_AI_PROVIDER, BEADS_AI_API_KEY, etc.)\n\nSee repair_commands.md lines 357-425 for design.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T19:37:55.722841-07:00","updated_at":"2025-11-06T19:36:13.972304-08:00","closed_at":"2025-11-06T19:27:19.150657-08:00"} +{"id":"bd-3e307cd4","title":"File change test issue","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T19:11:28.425601-07:00","updated_at":"2025-10-31T12:00:43.176605-07:00","closed_at":"2025-10-31T12:00:43.176605-07:00"} +{"id":"bd-627d","title":"AI-supervised database migrations for safer schema evolution","description":"## Problem\n\nDatabase migrations can lose user data through edge cases that are hard to anticipate (e.g., GH #201 where bd migrate failed to set issue_prefix, or bd-d355a07d false positive data loss warnings). Since beads is designed to be run by AI agents, we should leverage AI to make migrations safer.\n\n## Current State\n\nMigrations run blindly with:\n- No pre-flight validation\n- No data integrity verification\n- No rollback on failure\n- Limited post-migration testing\n\nRecent issues:\n- GH #201: Migration didn't set issue_prefix config, breaking commands\n- bd-d355a07d: False positive \"data loss\" warnings on collision resolution\n- Users reported migration data loss (fixed but broader problem remains)\n\n## Proposal: AI-Supervised Migration Framework\n\nUse AI to supervise migrations through structured verification:\n\n### 1. Pre-Migration Analysis\n- AI reads migration code and current schema\n- Identifies potential data loss scenarios\n- Generates validation queries to verify assumptions\n- Creates snapshot queries for before/after comparison\n\n### 2. Migration Execution\n- Take database backup/snapshot\n- Run validation queries (pre-state)\n- Execute migration in transaction\n- Run validation queries (post-state)\n\n### 3. Post-Migration Verification\n- AI compares pre/post snapshots\n- Verifies data integrity invariants\n- Checks for unexpected data loss\n- Validates config completeness (like issue_prefix)\n\n### 4. Rollback on Anomalies\n- If AI detects data loss, rollback transaction\n- Present human-readable error report\n- Suggest fix before retrying\n\n## Example Flow\n\n```\n$ bd migrate\n\nβ†’ Analyzing migration plan...\nβ†’ AI identified 3 potential data loss scenarios\nβ†’ Generating validation queries...\nβ†’ Creating pre-migration snapshot...\nβ†’ Running migration in transaction...\nβ†’ Verifying post-migration state...\nβœ“ All 247 issues accounted for\nβœ“ Config table complete (issue_prefix: \"mcp\")\nβœ“ Dependencies intact (342 relationships verified)\nβ†’ Migration successful!\n```\n\nIf something goes wrong:\n```\n$ bd migrate\n\nβ†’ Analyzing migration plan...\nβ†’ AI identified issue: Missing issue_prefix config after migration\nβ†’ Recommendation: Add prefix detection step\nβ†’ Aborting migration - database unchanged\n```\n\n## Implementation Ideas\n\n### A. Migration Validator Tool\nCreate `bd migrate --validate` that:\n- Simulates migration on copy of database\n- Uses AI to verify data integrity\n- Reports potential issues before real migration\n\n### B. Migration Test Generator\nAI generates test cases for migrations:\n- Edge cases (empty DB, large DB, missing config)\n- Data integrity checks\n- Regression tests\n\n### C. Migration Invariants\nDefine invariants that AI checks:\n- Issue count should not decrease (unless collision resolution)\n- All required config keys present\n- Foreign key relationships intact\n- No orphaned dependencies\n\n### D. Self-Healing Migrations\nAI detects incomplete migrations and suggests fixes:\n- Missing config values (like GH #201)\n- Orphaned data\n- Index inconsistencies\n\n## Benefits\n\n1. **Catch edge cases**: AI explores scenarios humans miss\n2. **Self-documenting**: AI explains what migration does\n3. **Agent-friendly**: Agents can run migrations confidently\n4. **Fewer rollbacks**: Detect issues before committing\n5. **Better testing**: AI generates comprehensive test suites\n\n## Open Questions\n\n1. Which AI model? (Fast: Haiku, Thorough: Sonnet/GPT-4)\n2. How to balance safety vs migration speed?\n3. Should AI validation be required or optional?\n4. How to handle offline scenarios (no API access)?\n5. What invariants should always be checked?\n\n## Related Work\n\n- bd-b245: Migration registry (makes migrations introspectable)\n- GH #201: issue_prefix migration bug (motivating example)\n- bd-d355a07d: False positive data loss warnings","notes":"## Progress\n\n### βœ… Phase 1: Migration Invariants (COMPLETED)\n\n**Implemented:**\n- Created internal/storage/sqlite/migration_invariants.go with 3 invariants\n- Updated RunMigrations() to verify invariants after migrations\n- All tests pass βœ“\n\n### βœ… Phase 2: Inspection Tools (COMPLETED \u0026 PUSHED)\n\n**Commit:** 1abe4e7 - \"Add migration inspection tools for AI agents (bd-627d Phase 2)\"\n\n**Implemented:**\n1. βœ… bd migrate --inspect --json - Shows migration plan\n2. βœ… bd info --schema --json - Returns schema details\n3. βœ… Migration warnings system\n4. βœ… Documentation updated in AGENTS.md\n5. βœ… All tests pass\n\n### βœ… Phase 3: MCP Tools (COMPLETED \u0026 PUSHED)\n\n**Commit:** 2493693 - \"Add MCP tools for migration inspection (bd-627d Phase 3)\"\n\n**Implemented:**\n1. βœ… inspect_migration(workspace_root) tool in beads-mcp\n2. βœ… get_schema_info(workspace_root) tool in beads-mcp\n3. βœ… Abstract methods in BdClientBase\n4. βœ… CLI client implementations\n5. βœ… All tests pass\n\n**All phases complete!** Migration inspection fully integrated into MCP server.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-02T12:57:10.722048-08:00","updated_at":"2025-11-02T14:31:25.095296-08:00","closed_at":"2025-11-02T14:31:25.095308-08:00"} +{"id":"bd-febc","title":"npm package for bd with native binaries","description":"Create an npm package that wraps native bd binaries for easy installation in Claude Code for Web and other Node.js environments.\n\n## Problem\nClaude Code for Web sandboxes are full Linux VMs with npm support, but cannot easily download binaries from GitHub releases due to network restrictions or tooling limitations.\n\n## Solution\nPublish bd as an npm package that:\n- Downloads platform-specific native binaries during postinstall\n- Provides a CLI wrapper that invokes the native binary\n- Works seamlessly in Claude Code for Web SessionStart hooks\n- Maintains full feature parity (uses native SQLite)\n\n## Benefits vs WASM\n- βœ… Full SQLite support (no custom VFS needed)\n- βœ… All features work identically to native bd\n- βœ… Better performance (native vs WASM overhead)\n- βœ… ~4 hours effort vs ~2 days for WASM\n- βœ… Minimal maintenance burden\n\n## Success Criteria\n- npm install @beads/bd works in Claude Code for Web\n- All bd commands function identically to native binary\n- SessionStart hook documented for auto-installation\n- Package published to npm registry","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-02T23:39:37.684109-08:00","updated_at":"2025-11-03T10:39:44.932565-08:00","closed_at":"2025-11-03T10:39:44.932565-08:00"} +{"id":"bd-70419816","title":"Export deduplication breaks when JSONL and export_hashes table diverge","description":"## Problem\n\nThe export deduplication feature (timestamp-only skipping) breaks when the JSONL file and export_hashes table get out of sync, causing exports to skip issues that aren't actually in the file.\n\n## Symptoms\n\n- `bd export` reports \"Skipped 128 issue(s) with timestamp-only changes\"\n- JSONL file only has 38 lines but DB has 149 issues\n- export_hashes table has 149 entries\n- Auto-import doesn't trigger (hash matches despite missing data)\n- Two repos on same commit show different issue counts\n\n## Root Cause\n\nshouldSkipExport() in autoflush.go compares current issue hash with stored export_hashes entry. If they match, it skips export assuming the issue is already in the JSONL.\n\nThis assumption fails when:\n1. Git operations (pull, reset, checkout) change JSONL without clearing export_hashes\n2. Manual JSONL edits or corruption\n3. Import operations that modify DB but don't update export_hashes\n4. Partial exports that update export_hashes but don't complete\n\n## Impact\n\n- **Critical data loss risk**: Issues appear to be tracked but aren't persisted to git\n- Breaks multi-repo sync (root cause of today's debugging session)\n- Auto-import fails to detect staleness (hash matches despite missing data)\n- Silent data corruption (no error messages, just missing issues)\n\n## Reproduction\n\n1. Have DB with 149 issues, all in export_hashes table\n2. Truncate JSONL to 38 lines (simulate git reset or corruption)\n3. Run `bd export` - it skips 128 issues\n4. JSONL still has only 38 lines but export thinks it succeeded\n\n## Current Workaround\n\n```bash\nsqlite3 .beads/beads.db \"DELETE FROM export_hashes\"\nbd export -o .beads/beads.jsonl\n```\n\n## Proposed Solutions\n\n**Option 1: Verify JSONL integrity before skipping**\n- Count lines in JSONL, compare with export_hashes count\n- If mismatch, clear export_hashes and force full export\n- Safe but adds I/O overhead\n\n**Option 2: Hash-based JSONL validation**\n- Store hash of entire JSONL file in metadata\n- Before export, check if JSONL hash matches\n- If mismatch, clear export_hashes\n- More efficient, detects any JSONL corruption\n\n**Option 3: Disable timestamp-only deduplication**\n- Remove the feature entirely\n- Always export all issues\n- Simplest and safest, but creates larger git commits\n\n**Option 4: Clear export_hashes on git operations**\n- Add post-merge hook to clear export_hashes\n- Clear on any import operation\n- Defensive approach but may over-clear\n\n## Recommended Fix\n\nCombination of Options 2 + 4:\n1. Store JSONL file hash in metadata after export\n2. Check hash before export, clear export_hashes if mismatch \n3. Clear export_hashes on import operations\n4. Add `bd validate` check for JSONL/export_hashes sync\n\n## Files Involved\n\n- cmd/bd/autoflush.go (shouldSkipExport)\n- cmd/bd/export.go (export with deduplication)\n- internal/storage/sqlite/metadata.go (export_hashes table)","status":"closed","issue_type":"bug","created_at":"2025-10-29T23:05:13.960352-07:00","updated_at":"2025-10-30T17:12:58.19679-07:00","closed_at":"2025-10-29T22:22:20.406934-07:00"} +{"id":"bd-bc7l","title":"Issue 2 to reopen","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.754817-05:00","updated_at":"2025-11-20T19:43:48.754817-05:00","closed_at":"2025-11-07T21:57:59.91095-08:00"} +{"id":"bd-nxgk","title":"Agent upgrade awareness system","description":"Make it easy for AI agents to discover and adapt to bd upgrades without manual intervention.\n\n## Problem\nWhen bd is upgraded (happens weekly), agents need to:\n1. Discover what changed\n2. Update their workflows/instructions\n3. Keep git hooks in sync\n4. Know which new features to adopt\n\nCurrently this requires manual prompting or re-running bd onboard, which is unreliable.\n\n## Solution Layers\n1. Documentation improvements (immediate)\n2. Startup hook snippet for detection (immediate, zero bd code)\n3. Built-in version tracking in bd (short-term)\n4. Separated canonical BD_GUIDE.md (long-term architectural)\n\n## Success Criteria\n- Agents automatically detect bd upgrades at session start\n- Agents see what changed without re-reading all docs\n- Git hooks stay in sync with bd version\n- bd-specific instructions separated from project instructions\n\n## Related Discussion\nGitHub Discussion #239: 'Upgrading beads: how to let the Agent know'\n","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-23T16:21:14.431233-08:00","updated_at":"2025-11-23T16:21:14.431233-08:00"} +{"id":"bd-ad5e","title":"Add AI planning docs management guidance to bd onboard (GH-196)","description":"Enhanced bd onboard command to provide guidance for managing AI-generated planning documents (Claude slop).\n\nAddresses GitHub issue #196: https://github.com/steveyegge/beads/issues/196\n\nChanges:\n- Added Managing AI-Generated Planning Documents section to bd onboard\n- Recommends using history/ directory for ephemeral planning files\n- Updated AGENTS.md to demonstrate the pattern\n- Added comprehensive tests\n\nCommit: d46177d","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-02T17:11:33.183636-08:00","updated_at":"2025-11-02T17:12:05.599633-08:00","closed_at":"2025-11-02T17:12:05.599633-08:00"} +{"id":"bd-27ea","title":"Improve cmd/bd test coverage from 21% to 40% (multi-session effort)","description":"Current coverage: 21.0% of statements in cmd/bd\nTarget: 40%\nThis is a multi-session incremental effort.\n\nFocus areas:\n- Command handler tests (create, update, close, list, etc.)\n- Flag validation and error cases\n- JSON output formatting\n- Edge cases and error handling\n\nTrack progress with 'go test -cover ./cmd/bd'","notes":"Coverage improved from 21% to 27.4% (package) and 42.9% (total function coverage).\n\nAdded tests for:\n- compact.go test coverage (eligibility checks, dry run scenarios)\n- epic.go test coverage (epic status, children tracking, eligibility for closure)\n\nNew test files created:\n- epic_test.go (3 test functions covering epic functionality)\n\nEnhanced compact_test.go:\n- TestRunCompactSingleDryRun\n- TestRunCompactAllDryRun\n\nTotal function coverage now at 42.9%, exceeding the 40% target.","status":"closed","issue_type":"task","created_at":"2025-10-31T19:35:57.558346-07:00","updated_at":"2025-11-01T12:23:39.158922-07:00","closed_at":"2025-11-01T12:23:39.158926-07:00"} +{"id":"bd-4d7fca8a","title":"Add tests for internal/utils package","description":"Currently 0.0% coverage. Need tests for utility functions including issue ID parsing and validation.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T14:06:24.066403-07:00","updated_at":"2025-11-08T22:42:08.860747-08:00","closed_at":"2025-11-08T17:57:28.956561-08:00","dependencies":[{"issue_id":"bd-4d7fca8a","depends_on_id":"bd-cbed9619.5","type":"blocks","created_at":"2025-10-29T19:52:05.52888-07:00","created_by":"import-remap"},{"issue_id":"bd-4d7fca8a","depends_on_id":"bd-cbed9619.4","type":"blocks","created_at":"2025-10-29T19:52:05.529565-07:00","created_by":"import-remap"},{"issue_id":"bd-4d7fca8a","depends_on_id":"bd-0dcea000","type":"blocks","created_at":"2025-10-29T19:52:05.529982-07:00","created_by":"import-remap"}]} +{"id":"bd-bcrt","title":"Add validation to require description when creating issues","description":"## Solution: Code-level validation\n\nAdd validation in bd create to warn or require a description when creating non-test issues.\n\n## Implementation Options\n\n### Option 1: Warning (Non-blocking)\n- Print a warning when description is empty\n- Similar to existing 'Test' prefix warning in create.go:62-66\n- Allows users to proceed but raises awareness\n\n### Option 2: Strict validation with bypass\n- Require description for all issues except:\n - Issues with 'test' in title (case-insensitive)\n - When --no-description-check flag is provided\n- Exit with error if description is empty and no bypass\n\n### Option 3: Interactive prompt (CLI only)\n- If description empty, prompt user to enter one\n- Only works in CLI, not via MCP/daemon mode\n- May confuse AI agents expecting non-interactive behavior\n\n## Recommendation\n\nStart with Option 1 (warning) to gather feedback, then potentially move to Option 2 if problem persists.\n\n## Files to modify\n\n- cmd/bd/create.go - Add validation after line 80 (where description is retrieved)\n- Consider adding to RPC handler in daemon mode as well","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T14:00:58.803225-08:00","updated_at":"2025-11-23T14:09:20.790174-08:00","closed_at":"2025-11-23T14:09:20.790174-08:00","dependencies":[{"issue_id":"bd-bcrt","depends_on_id":"bd-0tr0","type":"discovered-from","created_at":"2025-11-23T14:00:58.804437-08:00","created_by":"daemon"}]} +{"id":"bd-loka.1","title":"Add LastBdVersion field to Config struct","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T16:56:27.336668-08:00","updated_at":"2025-11-23T16:56:52.180512-08:00","closed_at":"2025-11-23T16:56:52.180512-08:00","dependencies":[{"issue_id":"bd-loka.1","depends_on_id":"bd-loka","type":"parent-child","created_at":"2025-11-23T16:56:27.337232-08:00","created_by":"daemon"}]} +{"id":"bd-eiz9","title":"Help agents understand version changes with bd info --whats-new","description":"**Problem** (from GH Discussion #239 by @maphew):\nWeekly major versions mean agents need to adapt workflows, but currently there's no efficient way to communicate \"what changed that affects you.\"\n\n**Proposed solutions:**\n\n1. **bd info --whats-new** - Show agent-actionable changes since last version\n ```\n Since v0.20.1:\n β€’ Hash IDs eliminate collisions - remove ID coordination workarounds\n β€’ Event-driven daemon (opt-in) - add BEADS_DAEMON_MODE=events\n β€’ Merge driver auto-configured - conflicts rarer\n ```\n\n2. **Version-aware bd onboard** - Detect version changes and show diff of agent-relevant changes\n\n3. **AGENTS.md top section** - \"πŸ†• Recent Changes (Last 3 Versions)\" with workflow impacts\n\n**Why agents need this:**\n- Raw CHANGELOG is token-heavy and buried in release details\n- Full bd onboard re-run wasteful if only 2-3 things changed\n- Currently requires user to manually explain updates\n\n**Related:** https://github.com/steveyegge/beads/discussions/239","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-06T21:03:30.057576-08:00","updated_at":"2025-11-08T02:42:56.733731-08:00","closed_at":"2025-11-08T02:25:55.509249-08:00"} +{"id":"bd-64c05d00","title":"Multi-clone collision resolution testing and documentation","description":"Epic to track improvements to multi-clone collision resolution based on ultrathinking analysis of-3d844c58 and [deleted:bd-71107098].\n\nCurrent state:\n- 2-clone collision resolution is SOUND and working correctly\n- Hash-based deterministic collision resolution works\n- Test fails due to timestamp comparison, not actual logic issues\n\nWork needed:\n1. Fix TestTwoCloneCollision to compare content not timestamps\n2. Add TestThreeCloneCollision for regression protection\n3. Document 3-clone ID non-determinism as known behavior","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T17:58:38.316626-07:00","updated_at":"2025-11-05T00:32:09.153134-08:00","closed_at":"2025-11-04T11:10:23.531681-08:00"} +{"id":"bd-p3b0.2","title":"Fix inconsistent version comparison logic in trackBdVersion","status":"closed","issue_type":"bug","created_at":"2025-11-23T17:12:27.953105-08:00","updated_at":"2025-11-23T17:13:28.241231-08:00","closed_at":"2025-11-23T17:13:28.241231-08:00","dependencies":[{"issue_id":"bd-p3b0.2","depends_on_id":"bd-p3b0","type":"parent-child","created_at":"2025-11-23T17:12:27.953605-08:00","created_by":"daemon"}]} +{"id":"bd-c796","title":"Extract batch operations to batch_ops.go","description":"Move validateBatchIssues, generateBatchIDs, bulkInsertIssues, bulkRecordEvents, bulkMarkDirty, CreateIssues to batch_ops.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.887487-07:00","updated_at":"2025-11-02T08:09:51.579971-08:00","closed_at":"2025-11-02T08:09:51.579978-08:00"} +{"id":"bd-de0h","title":"bd message: Add HTTP client timeout to prevent hangs","description":"HTTP client in `sendAgentMailRequest` uses default http.Post with no timeout.\n\n**Location:** cmd/bd/message.go:181\n\n**Problem:**\n- Can hang indefinitely if server is unresponsive\n- No way to cancel stuck requests\n- Poor UX in flaky networks\n\n**Fix:**\n```go\nclient := \u0026http.Client{Timeout: 30 * time.Second}\nresp, err := client.Post(url, \"application/json\", bytes.NewReader(reqBody))\n```\n\n**Impact:** Production reliability and security issue","status":"closed","issue_type":"bug","created_at":"2025-11-08T12:54:24.942645-08:00","updated_at":"2025-11-08T12:56:59.948929-08:00","closed_at":"2025-11-08T12:56:59.948929-08:00","dependencies":[{"issue_id":"bd-de0h","depends_on_id":"bd-6uix","type":"parent-child","created_at":"2025-11-08T12:55:54.860847-08:00","created_by":"daemon"}]} +{"id":"bd-56p","title":"Add #nosec G304 comments to JSONL file reads in sync.go","description":"sync.go:610 uses os.ReadFile(jsonlPath) without #nosec comment, inconsistent with other JSONL reads that have '// #nosec G304 - controlled path'.\n\nAdd comment for consistency with integrity.go:43 and import.go:316.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:31:09.107493-05:00","updated_at":"2025-11-20T21:34:28.378089-05:00","closed_at":"2025-11-20T21:34:28.378089-05:00","dependencies":[{"issue_id":"bd-56p","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:09.108632-05:00","created_by":"daemon"}]} +{"id":"bd-7bbc4e6a","title":"Add MCP server functions for repair commands","description":"Expose new repair commands via MCP server for agent access:\n\nFunctions to add:\n- beads_repair_deps()\n- beads_detect_pollution()\n- beads_validate()\n- beads_resolve_conflicts() (when implemented)\n\nUpdate integrations/beads-mcp/src/beads_mcp/server.py\n\nSee repair_commands.md lines 803-884 for design.","notes":"Implemented all three MCP server functions:\n\n1. **repair_deps(fix=False)** - Find/fix orphaned dependencies\n2. **detect_pollution(clean=False)** - Detect/clean test issues \n3. **validate(checks=None, fix_all=False)** - Run comprehensive health checks\n\nChanges:\n- Added abstract methods to BdClientBase\n- Implemented in BdCliClient (CLI execution)\n- Added NotImplementedError stubs in BdDaemonClient (falls back to CLI)\n- Created wrapper functions in tools.py\n- Registered @mcp.tool decorators in server.py\n\nAll commands tested and working with --no-daemon flag.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T09:49:06.993201-08:00","updated_at":"2025-11-07T21:02:55.469601-08:00","closed_at":"2025-11-07T19:38:12.152437-08:00"} +{"id":"bd-ic1m","title":"Benchmark git traffic reduction","description":"Automated benchmark comparing git operations with/without Agent Mail.\n\nAcceptance Criteria:\n- Script that processes 50 issues\n- Counts git operations (pull, commit, push)\n- Generates comparison report\n- Verifies β‰₯70% reduction\n- Fails if regression detected\n\nFile: tests/benchmarks/git_traffic.py\n\nOutput: Without Agent Mail: 450 git operations, With Agent Mail: 135 git operations, Reduction: 70%","notes":"Implemented automated benchmark script with following features:\n- Processes configurable number of issues (default 50)\n- Compares git operations in two modes: git-only vs Agent Mail\n- Generates detailed comparison report with statistics\n- Exit code reflects pass/fail based on 70% reduction target\n- Results: 98.5% reduction (200 ops β†’ 3 ops) for 50 issues\n\nFiles created:\n- tests/benchmarks/git_traffic.py (main benchmark script)\n- tests/benchmarks/README.md (documentation)\n- tests/benchmarks/git_traffic_50_issues.md (sample results)\n\nThe benchmark vastly exceeds the 70% target, showing 98.5% reduction.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:43:21.486095-08:00","updated_at":"2025-11-08T02:08:19.648473-08:00","closed_at":"2025-11-08T02:08:19.648473-08:00","dependencies":[{"issue_id":"bd-ic1m","depends_on_id":"bd-fzbg","type":"blocks","created_at":"2025-11-07T22:43:21.486966-08:00","created_by":"daemon"},{"issue_id":"bd-ic1m","depends_on_id":"bd-nemp","type":"blocks","created_at":"2025-11-07T22:43:21.487388-08:00","created_by":"daemon"}]} +{"id":"bd-3sz0","title":"Auto-repair stale merge driver configs with invalid placeholders","description":"Old bd versions (\u003c0.24.0) installed merge driver with invalid placeholders %L %R instead of %A %B. Add detection to bd doctor --fix: check if git config merge.beads.driver contains %L or %R, auto-repair to 'bd merge %A %O %A %B'. One-time migration for users who initialized with old versions.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-11-21T23:16:10.762808-08:00","updated_at":"2025-11-21T23:16:28.892655-08:00","dependencies":[{"issue_id":"bd-3sz0","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:10.763612-08:00","created_by":"daemon"}]} +{"id":"bd-164b","title":"Add template support for issue creation","description":"Support creating issues from predefined templates to streamline common workflows like epics, bug reports, or feature proposals.\n\nExample usage:\n bd create --from-template epic \"Phase 3 Features\"\n bd create --from-template bug \"Login failure\"\n bd template list\n bd template create epic\n\nTemplates should include:\n- Pre-filled description structure\n- Suggested priority and type\n- Common labels\n- Design/acceptance criteria sections\n\nImplementation notes:\n- Store templates in .beads/templates/ directory\n- Support YAML or JSON format\n- Ship with built-in templates (epic, bug, feature)\n- Allow custom project-specific templates","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-03T18:10:18.985902-08:00","updated_at":"2025-11-03T19:56:41.287303-08:00","closed_at":"2025-11-03T19:56:41.287303-08:00"} +{"id":"bd-12c2","title":"Add comprehensive tests for show.go commands (show, update, edit, close)","description":"Need to add tests for cmd/bd/show.go which contains show, update, edit, and close commands.\n\n**Challenge**: The existing test patterns use rootCmd.SetArgs() and rootCmd.Execute(), but the global `store` variable needs to match what the commands use. Initial attempt created tests that failed with \"no issue found\" because the test's store instance wasn't the same as the command's store.\n\n**Files to test**:\n- show.go (contains showCmd, updateCmd, editCmd, closeCmd)\n\n**Coverage needed**:\n- show command (single issue, multiple issues, JSON output, with dependencies, with labels, with compaction)\n- update command (status, priority, title, assignee, description, multiple fields, multiple issues)\n- edit command (requires $EDITOR, may need mocking)\n- close command (single issue, multiple issues, with reason, JSON output)\n\n**Test approach**:\n1. Study working test patterns in init_test.go, list_test.go, etc.\n2. Ensure BEADS_NO_DAEMON=1 is set\n3. Properly initialize database with bd init\n4. Use the command's global store, not a separate instance\n5. May need to reset global state between tests\n\n**Success criteria**: \n- All test functions pass\n- Coverage for show.go increases significantly\n- Tests follow existing patterns in cmd/bd/*_test.go","status":"closed","issue_type":"task","created_at":"2025-10-31T20:08:40.545173-07:00","updated_at":"2025-10-31T20:19:22.411066-07:00","closed_at":"2025-10-31T20:19:22.411066-07:00"} +{"id":"bd-k0j9","title":"Test dependency parent","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T11:23:02.505901-08:00","updated_at":"2025-11-05T11:23:20.91305-08:00","closed_at":"2025-11-05T11:23:20.91305-08:00"} +{"id":"bd-ar2.12","title":"Add validation and documentation for metadata key format","description":"## Issues\n\n### 1. No validation that keySuffix doesn't contain separator\n```go\nif keySuffix != \"\" {\n hashKey += \":\" + keySuffix // ❌ What if keySuffix contains \":\"?\n}\n```\n\nAdd validation:\n```go\nif strings.Contains(keySuffix, \":\") {\n return fmt.Errorf(\"keySuffix cannot contain ':' separator\")\n}\n```\n\n### 2. Inconsistent keySuffix semantics\nEmpty string means \"global\", non-empty means \"scoped\". Better to always pass explicit key:\n```go\nconst (\n SingleRepoKey = \".\"\n // Multi-repo uses source_repo identifier\n)\n```\n\n### 3. Metadata key format not documented\nNeed to document:\n- `last_import_hash` - single-repo mode\n- `last_import_hash:\u003crepo_key\u003e` - multi-repo mode\n- `last_import_time` - when last import occurred\n- `last_import_mtime` - fast-path optimization\n\nAdd to internal/storage/sqlite/schema.go or docs/","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-21T10:59:13.54833-05:00","updated_at":"2025-11-21T11:40:47.687331-05:00","closed_at":"2025-11-21T11:40:47.687331-05:00","dependencies":[{"issue_id":"bd-ar2.12","depends_on_id":"bd-ar2","type":"parent-child","created_at":"2025-11-21T10:59:13.550475-05:00","created_by":"daemon"}]} +{"id":"bd-64c05d00.2","title":"Document 3-clone ID non-determinism in collision resolution","description":"Document the known behavior of 3+ way collision resolution where ID assignments may vary based on sync order, even though content always converges correctly.\n\nUpdates needed:\n- Update bd-71107098 notes to mark 2-clone case as solved\n- Document 3-clone ID non-determinism as known limitation\n- Add explanation to ADVANCED.md or collision resolution docs\n- Explain why this happens (pairwise hash comparison is deterministic, but multi-way ID allocation uses sync-order dependent counters)\n- Clarify trade-offs: content convergence βœ… vs ID stability ❌\n\nKey points to document:\n- Hash-based resolution is pairwise deterministic\n- Content always converges correctly (all issues present with correct data)\n- Numeric ID assignments in 3+ way collisions depend on sync order\n- This is acceptable for most use cases (content convergence is primary goal)\n- Full determinism would require complex multi-way comparison","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T17:59:21.93014-07:00","updated_at":"2025-11-20T12:40:11.70764-05:00","closed_at":"2025-11-15T14:13:47.304584-08:00","dependencies":[{"issue_id":"bd-64c05d00.2","depends_on_id":"bd-64c05d00","type":"parent-child","created_at":"2025-10-28T17:59:21.938709-07:00","created_by":"stevey"}]} +{"id":"bd-ef72b864","title":"Add MCP server functions for repair commands","description":"Expose new repair commands via MCP server for agent access:\n\nFunctions to add:\n- beads_repair_deps()\n- beads_detect_pollution()\n- beads_validate()\n- beads_resolve_conflicts() (when implemented)\n\nUpdate integrations/beads-mcp/src/beads_mcp/server.py\n\nSee repair_commands.md lines 803-884 for design.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-28T19:38:02.227921-07:00","updated_at":"2025-10-30T17:12:58.180404-07:00","closed_at":"2025-10-29T23:14:44.187562-07:00"} +{"id":"bd-5otr","title":"Create startup hook snippet for upgrade detection","description":"Provide a reusable startup hook that agents can use to detect bd upgrades automatically.\n\n## What to Create\nA bash script snippet that:\n1. Reads current bd version\n2. Compares to last-seen version in metadata.json\n3. Shows 'bd info --whats-new' output when version changes\n4. Updates metadata.json with new version\n5. Auto-runs 'bd hooks install' if hooks outdated\n\n## Where to Document\n- Create examples/hooks/startup-version-check.sh\n- Document in AGENTS.md with usage instructions\n- Add comment header explaining how to integrate with Claude Code, Cursor, etc.\n\n## Key Features\n- Works today with zero bd code changes\n- Leverages existing bd info --whats-new\n- Uses metadata.json for persistence\n- Auto-fixes outdated git hooks\n\n## Acceptance Criteria\n- Script works standalone\n- Clear integration instructions for popular AI environments\n- Handles edge cases (no metadata.json, first run, etc.)\n","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T16:21:52.07179-08:00","updated_at":"2025-11-23T16:29:30.969796-08:00","closed_at":"2025-11-23T16:29:30.969796-08:00","dependencies":[{"issue_id":"bd-5otr","depends_on_id":"bd-nxgk","type":"parent-child","created_at":"2025-11-23T16:21:52.073748-08:00","created_by":"daemon"}]} +{"id":"bd-2f388ca7","title":"Fix TestTwoCloneCollision timeout","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-10-28T14:11:25.219607-07:00","updated_at":"2025-10-30T17:12:58.217635-07:00","closed_at":"2025-10-28T16:12:26.286611-07:00"} +{"id":"bd-b54c","title":"Document Claude Code for Web SessionStart hook","description":"Create documentation for using bd in Claude Code for Web:\n\n## Documentation locations\n- README.md - Add Claude Code for Web section\n- Create docs/CLAUDE_CODE_WEB.md with detailed instructions\n\n## SessionStart hook example\n```json\n{\n \"sessionStart\": {\n \"script\": \"npm install -g @beads/bd \u0026\u0026 bd init --quiet --prefix bd || true\"\n }\n}\n```\n\n## Documentation should cover\n- How to configure SessionStart hook in .claude/settings.json\n- Verification: Check bd is installed (bd --version)\n- Basic workflow in Claude Code for Web\n- Troubleshooting common issues\n- Note about network restrictions and why npm approach works\n\n## Examples\n- Creating issues in web sandbox\n- Syncing with git in web environment\n- Using MCP server (if applicable)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T23:40:15.362379-08:00","updated_at":"2025-11-03T10:31:45.382915-08:00","closed_at":"2025-11-03T10:31:45.382915-08:00","dependencies":[{"issue_id":"bd-b54c","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:32.991889-08:00","created_by":"daemon"}]} +{"id":"bd-908z","title":"Add bd hooks install command to embed git hooks in binary","description":"Currently git hooks are installed via `examples/git-hooks/install.sh`, which only exists in the beads source repo. Users who install bd via installer/homebrew/npm can't easily install hooks.\n\n**Proposal:**\nAdd `bd hooks install` command that:\n- Embeds hook scripts in the bd binary (using go:embed)\n- Installs them to .git/hooks/ in current repo\n- Backs up existing hooks\n- Makes them executable\n\n**Commands:**\n- `bd hooks install` - Install all hooks\n- `bd hooks uninstall` - Remove hooks\n- `bd hooks list` - Show installed hooks status\n\n**Benefits:**\n- Works for all bd users, not just source repo users\n- More discoverable (shows in bd --help)\n- Consistent with bd workflow\n- Can version hooks with bd releases","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-08T01:23:24.362827-08:00","updated_at":"2025-11-08T01:28:08.842516-08:00","closed_at":"2025-11-08T01:28:08.842516-08:00"} +{"id":"bd-pi7u","title":"Fix TestAddCommentUpdatesTimestamp timing flake on Windows","description":"The TestAddCommentUpdatesTimestamp test fails on Windows due to insufficient time resolution between creating an issue and adding a comment. The test expects updated_at to be strictly after the original timestamp, but on Windows both operations can complete within the same time unit, causing them to have identical timestamps.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-23T10:56:40.575897-08:00","updated_at":"2025-11-23T10:57:20.956211-08:00","closed_at":"2025-11-23T10:57:20.956211-08:00"} +{"id":"bd-f8b764c9.3","title":"Test: N-clone scenario with hash IDs (no collisions)","description":"Comprehensive test to verify hash IDs eliminate collision problems.\n\n## Test: TestHashIDsNClones\n\n### Purpose\nVerify that N clones can work offline and sync without ID collisions using hash IDs.\n\n### Test Scenario\n```\nSetup:\n- 1 bare remote repo\n- 5 clones (A, B, C, D, E)\n\nOffline Work:\n- Each clone creates 10 issues with different titles\n- No coordination, no network access\n- Total: 50 unique issues\n\nSync:\n- Clones sync in random order\n- Each pull/import other clones' issues\n\nExpected Result:\n- All 5 clones converge to 50 issues\n- Zero ID collisions\n- Zero remapping needed\n- Alias conflicts resolved deterministically\n```\n\n### Implementation\nFile: cmd/bd/beads_hashid_test.go (new)\n\n```go\nfunc TestHashIDsFiveClones(t *testing.T) {\n tmpDir := t.TempDir()\n remoteDir := setupBareRepo(t, tmpDir)\n \n // Setup 5 clones\n clones := make(map[string]string)\n for _, name := range []string{\"A\", \"B\", \"C\", \"D\", \"E\"} {\n clones[name] = setupClone(t, tmpDir, remoteDir, name)\n }\n \n // Each clone creates 10 issues offline\n for name, dir := range clones {\n for i := 0; i \u003c 10; i++ {\n createIssue(t, dir, fmt.Sprintf(\"%s-issue-%d\", name, i))\n }\n // No sync yet!\n }\n \n // Sync in random order\n syncOrder := []string{\"C\", \"A\", \"E\", \"B\", \"D\"}\n for _, name := range syncOrder {\n syncClone(t, clones[name], name)\n }\n \n // Final convergence round\n for _, name := range []string{\"A\", \"B\", \"C\", \"D\", \"E\"} {\n finalPull(t, clones[name], name)\n }\n \n // Verify all clones have all 50 issues\n for name, dir := range clones {\n issues := getIssues(t, dir)\n if len(issues) != 50 {\n t.Errorf(\"Clone %s: expected 50 issues, got %d\", name, len(issues))\n }\n \n // Verify all issue IDs are hash-based\n for _, issue := range issues {\n if !strings.HasPrefix(issue.ID, \"bd-\") || len(issue.ID) != 11 {\n t.Errorf(\"Invalid hash ID: %s\", issue.ID)\n }\n }\n }\n \n // Verify no collision resolution occurred\n // (This would be in logs if it happened)\n \n t.Log(\"βœ“ All 5 clones converged to 50 issues with zero collisions\")\n}\n```\n\n### Edge Case Tests\n\n#### Test: Hash Collision Detection (Artificial)\n```go\nfunc TestHashCollisionDetection(t *testing.T) {\n // Artificially inject collision by mocking hash function\n // Verify system detects and handles it\n}\n```\n\n#### Test: Alias Conflicts Resolved Deterministically\n```go\nfunc TestAliasConflictsNClones(t *testing.T) {\n // Two clones assign same alias to different issues\n // Verify deterministic resolution (content-hash ordering)\n // Verify all clones converge to same alias assignments\n}\n```\n\n#### Test: Mixed Sequential and Hash IDs (Should Fail)\n```go\nfunc TestMixedIDsRejected(t *testing.T) {\n // Try to import JSONL with sequential IDs into hash-ID database\n // Verify error or warning\n}\n```\n\n### Performance Test\n\n#### Benchmark: Hash ID Generation\n```go\nfunc BenchmarkHashIDGeneration(b *testing.B) {\n for i := 0; i \u003c b.N; i++ {\n GenerateHashID(\"title\", \"description\", time.Now(), \"workspace-id\")\n }\n}\n\n// Expected: \u003c 1ΞΌs per generation\n```\n\n#### Benchmark: N-Clone Convergence Time\n```go\nfunc BenchmarkNCloneConvergence(b *testing.B) {\n for _, n := range []int{3, 5, 10, 20} {\n b.Run(fmt.Sprintf(\"N=%d\", n), func(b *testing.B) {\n // Measure total convergence time\n })\n }\n}\n\n// Expected: Linear scaling O(N)\n```\n\n### Acceptance Criteria\n- TestHashIDsFiveClones passes reliably (10/10 runs)\n- Zero ID collisions in any scenario\n- All clones converge in single round (not multi-round like old system)\n- Alias conflicts resolved deterministically\n- Performance benchmarks meet targets (\u003c1ΞΌs hash gen)\n\n## Files to Create\n- cmd/bd/beads_hashid_test.go\n\n## Comparison to Old System\nThis test replaces:\n- TestTwoCloneCollision (bd-71107098) - no longer needed\n- TestThreeCloneCollision (bd-cbed9619) - no longer needed\n- TestFiveCloneCollision (bd-a40f374f) - no longer needed\n\nOld system required complex collision resolution and multi-round convergence.\nNew system: single-round convergence with zero collisions.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:27:26.954107-07:00","updated_at":"2025-10-31T12:32:32.608225-07:00","closed_at":"2025-10-31T12:32:32.608225-07:00","dependencies":[{"issue_id":"bd-f8b764c9.3","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:27:26.955522-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.3","depends_on_id":"bd-f8b764c9.5","type":"blocks","created_at":"2025-10-29T21:27:26.956175-07:00","created_by":"stevey"}]} +{"id":"bd-b121","title":"Fix :memory: database connection pool issue causing \"no such table\" errors","description":"Critical bug in v0.21.6 where :memory: databases with cache=shared create multiple connections in the pool, causing intermittent \"no such table\" errors. SQLite's shared cache for in-memory databases only works reliably with a single connection.\n\nRoot cause: Missing db.SetMaxOpenConns(1) after sql.Open() for :memory: databases.\n\nImpact: 37 test failures in VC project, affects all consumers using :memory: for testing.","status":"closed","issue_type":"bug","created_at":"2025-11-04T00:52:56.318619-08:00","updated_at":"2025-11-05T11:31:27.50439-08:00","closed_at":"2025-11-05T00:50:00.558124-08:00"} +{"id":"bd-537e","title":"Add external_ref change tracking and auditing","description":"Currently we don't track when external_ref is added, removed, or changed. This would be useful for debugging and auditing.\n\nProposed features:\n- Log event when external_ref changes\n- Track in events table with old/new values\n- Add query to find issues where external_ref changed\n- Add metrics: issues with external_ref vs without\n\nUse cases:\n- Debugging import issues\n- Understanding which issues are externally managed\n- Auditing external system linkage\n\nRelated: bd-1022","status":"closed","priority":4,"issue_type":"feature","created_at":"2025-11-02T15:32:31.276883-08:00","updated_at":"2025-11-08T02:24:24.68524-08:00","closed_at":"2025-11-08T02:20:01.022406-08:00"} +{"id":"bd-b245","title":"Add migration registry and simplify New()","description":"Create migrations.go with Migration type and registry. Change New() to: openDB -\u003e initSchema -\u003e RunMigrations(db). This removes 8+ separate migrate functions from New().","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.862623-07:00","updated_at":"2025-11-02T12:55:59.954845-08:00","closed_at":"2025-11-02T12:55:59.954854-08:00"} +{"id":"bd-1f4086c5","title":"Event-driven daemon architecture","description":"Replace 5-second polling sync loop with event-driven architecture that reacts instantly to changes. Eliminates stale data issues while reducing CPU ~60%. Key components: FileWatcher (fsnotify), Debouncer (500ms), RPC mutation events, optional git hooks. Target latency: \u003c500ms (vs 5000ms). See event_driven_daemon.md for full design.","notes":"Production-ready after 3 critical fixes (commit 349b892):\n- Skip redundant imports (mtime check prevents self-trigger loops)\n- Add server.Stop() in serverErrChan case (clean shutdown)\n- Fallback ticker (60s) when watcher unavailable (ensures remote sync)\n\nReady to make default after integration test (bd-1f4086c5.1) passes.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-29T23:05:13.969484-07:00","updated_at":"2025-10-31T20:21:25.464736-07:00","closed_at":"2025-10-31T20:21:25.464736-07:00"} +{"id":"bd-zkl","title":"Add tests for daemon vs non-daemon parity in list filters","description":"After bd-o43 RPC integration, we need tests to verify daemon mode behaves identically to direct mode for all new filter flags.\n\nTest coverage needed:\n- Pattern matching: --title-contains, --desc-contains, --notes-contains\n- Date ranges: all 6 date filter flags (created/updated/closed after/before)\n- Empty/null checks: --empty-description, --no-assignee, --no-labels\n- Priority ranges: --priority-min, --priority-max\n- Status normalization: --status all vs no status flag\n- Date parsing: YYYY-MM-DD, RFC3339, and error cases\n- Backward compat: deprecated --label flag still works\n\nOracle review findings (bd-o43):\n- Date parsing should support multiple formats\n- Status 'all' should be treated as unset\n- NoLabels field was missing from RPC protocol\n- Error messages should be clear and actionable\n\nTest approach:\n- Create RPC integration tests in internal/rpc/server_issues_epics_test.go\n- Compare daemon client.List() vs direct store.SearchIssues() for same filters\n- Verify error messages match between modes\n- Test with real daemon instance, not just unit tests","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T00:43:53.369457-08:00","updated_at":"2025-11-05T00:55:31.318526-08:00","closed_at":"2025-11-05T00:55:31.318526-08:00","dependencies":[{"issue_id":"bd-zkl","depends_on_id":"bd-o43","type":"discovered-from","created_at":"2025-11-05T00:43:53.371274-08:00","created_by":"daemon"}]} +{"id":"bd-1445","title":"Create shared insert/event/dirty helpers","description":"Create issues.go (insertIssue/insertIssues), events.go (recordCreatedEvent/recordCreatedEvents), dirty.go (markDirty/markDirtyBatch). Refactor single and bulk create paths to use these.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T11:41:14.882142-07:00","updated_at":"2025-11-02T15:28:11.99706-08:00","closed_at":"2025-11-02T15:28:11.997063-08:00"} +{"id":"bd-e166","title":"Improve timestamp comparison readability in import","description":"The timestamp comparison logic uses double-negative which can be confusing:\n\nCurrent code:\nif !incoming.UpdatedAt.After(existing.UpdatedAt) {\n // skip update\n}\n\nMore readable:\nif incoming.UpdatedAt.After(existing.UpdatedAt) {\n // perform update\n} else {\n // skip (local is newer)\n}\n\nThis is a minor refactor for code clarity.\n\nRelated: bd-1022\nFiles: internal/importer/importer.go:411, 488","status":"open","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:12.27108-08:00","updated_at":"2025-11-02T15:32:12.27108-08:00"} +{"id":"bd-87a0","title":"Publish @beads/bd package to npm registry","description":"Publish the npm package to the public npm registry:\n\n## Prerequisites\n- npm account created\n- Organization @beads created (or use different namespace)\n- npm login completed locally\n- Package tested locally (bd-f282 completed)\n\n## Publishing steps\n1. Verify package.json version matches current bd version\n2. Run npm pack and inspect tarball contents\n3. Test installation from tarball one more time\n4. Run npm publish --access public\n5. Verify package appears on https://www.npmjs.com/package/@beads/bd\n6. Test installation from registry: npm install -g @beads/bd\n\n## Post-publish\n- Add npm badge to README.md\n- Update CHANGELOG.md with npm package release\n- Announce in release notes\n\n## Note\n- May need to choose different name if @beads namespace unavailable\n- Alternative: beads-cli, bd-cli, or unscoped beads-issue-tracker","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T23:40:25.263569-08:00","updated_at":"2025-11-03T10:39:41.772338-08:00","closed_at":"2025-11-03T10:39:41.772338-08:00","dependencies":[{"issue_id":"bd-87a0","depends_on_id":"bd-febc","type":"parent-child","created_at":"2025-11-02T23:40:33.014043-08:00","created_by":"daemon"}]} +{"id":"bd-fb95094c.1","title":"Run final validation and cleanup checks","description":"Final validation pass to ensure all cleanup objectives met and no regressions introduced.\n\nValidation checklist:\n1. Dead code verification: `go run golang.org/x/tools/cmd/deadcode@latest -test ./...`\n2. Test coverage: `go test -cover ./...`\n3. Build verification: `go build ./cmd/bd/`\n4. Linting: `golangci-lint run`\n5. Integration tests\n6. Metrics verification\n7. Git clean check\n\nFinal metrics to report:\n- LOC removed: ~____\n- Files deleted: ____\n- Files created: ____\n- Test coverage: ____%\n- Build time: ____ (before/after)\n- Test run time: ____ (before/after)\n\nImpact: Confirms all cleanup objectives achieved successfully","notes":"Validation completed:\n- LOC: 52,372 lines total\n- Dead code: 4 functions in import_shared.go (tracked in bd-6fe4622f)\n- Build: βœ“ Successful\n- Test coverage: ~20-82% across packages\n- Test failure: TestTwoCloneCollision (timeout issue)\n- Linting: errcheck warnings present (defer close, fmt errors)\n- Test time: ~20s\n\nIssues found:\n1. bd-6fe4622f: Remove unreachable import functions (renameImportedIssuePrefixes, etc)\n2. TestTwoCloneCollision: Daemon killall timeout causing test failure\n3. Linting: errcheck violations need fixing","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T20:32:00.14166-07:00","updated_at":"2025-10-30T17:12:58.209988-07:00","closed_at":"2025-10-28T14:11:25.218801-07:00","dependencies":[{"issue_id":"bd-fb95094c.1","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T20:32:00.144113-07:00","created_by":"daemon"}]} +{"id":"bd-au0.7","title":"Audit and standardize JSON output across all commands","description":"Ensure consistent JSON format and error handling when --json flag is used.\n\n**Scope:**\n1. Verify all commands respect --json flag\n2. Standardize success response format\n3. Standardize error response format\n4. Document JSON schemas\n\n**Commands to audit:**\n- Core CRUD: create, update, delete, show, list, search βœ“\n- Queries: ready, blocked, stale, count, stats, status\n- Deps: dep add/remove/tree/cycles\n- Labels: label commands\n- Comments: comments add/list/delete\n- Epics: epic status/close-eligible\n- Export/import: already support --json βœ“\n\n**Testing:**\n- Success cases return valid JSON\n- Error cases return valid JSON (not plain text)\n- Consistent field naming (snake_case vs camelCase)\n- Array vs object wrapping consistency","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T21:07:35.304424-05:00","updated_at":"2025-11-21T21:07:35.304424-05:00","dependencies":[{"issue_id":"bd-au0.7","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:35.305663-05:00","created_by":"daemon"}]} +{"id":"bd-23a8","title":"Test simple issue","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-02T17:11:04.464726-08:00","updated_at":"2025-11-04T11:10:23.529727-08:00","closed_at":"2025-11-04T11:10:23.529731-08:00"} +{"id":"bd-78w","title":"Test Epic 2","description":"## Overview\n\n[Describe the high-level goal and scope of this epic]\n\n## Success Criteria\n\n- [ ] Criteria 1\n- [ ] Criteria 2\n- [ ] Criteria 3\n\n## Background\n\n[Provide context and motivation]\n\n## Scope\n\n**In Scope:**\n- Item 1\n- Item 2\n\n**Out of Scope:**\n- Item 1\n- Item 2\n","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-03T20:15:03.878216-08:00","updated_at":"2025-11-05T00:25:06.566242-08:00","closed_at":"2025-11-05T00:25:06.566242-08:00"} +{"id":"bd-gdn","title":"Add functional tests for FlushManager correctness verification","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:53.967757-05:00","updated_at":"2025-11-21T10:59:00.4089-05:00","closed_at":"2025-11-20T21:35:53.1183-05:00"} +{"id":"bd-8y1a","title":"Update Nix flake Go modules hash","status":"closed","issue_type":"bug","created_at":"2025-11-22T10:56:09.819863-08:00","updated_at":"2025-11-22T10:59:18.858399-08:00","closed_at":"2025-11-22T10:59:18.858399-08:00"} +{"id":"bd-x47","title":"Add guidance for self-hosting projects","description":"The contributor-workflow-analysis.md is optimized for OSS contributors making PRs to upstream projects. However, it doesn't address projects like VC that use beads for their own development (self-hosting).\n\nSelf-hosting projects differ from OSS contributors:\n- No upstream/downstream distinction (they ARE the project)\n- May run automated executors (not just humans)\n- In bootstrap/early phase (stability matters)\n- Single team/owner (not multiple contributors with permissions)\n\nGuidance needed on:\n- When self-hosting projects should stay single-repo (default, recommended)\n- When they should adopt multi-repo (team planning, multi-phase dev)\n- How automated executors should handle multi-repo (if at all)\n- Special considerations for projects in bootstrap phase\n\nExamples of self-hosting projects: VC (building itself with beads), internal tools, pet projects","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:27.805341-08:00","updated_at":"2025-11-05T14:16:34.69662-08:00","closed_at":"2025-11-05T14:16:34.69662-08:00"} +{"id":"bd-jo38","title":"Add WaitGroup tracking to FileWatcher goroutines","description":"FileWatcher spawns goroutines without WaitGroup tracking, causing race condition on shutdown.\n\nLocation: cmd/bd/daemon_watcher.go:123-182, 215-291\n\nProblem:\n- Goroutines spawned without sync.WaitGroup\n- Close() cancels context but doesn't wait for goroutines to exit\n- Race condition: goroutine may access fw.debouncer during Close() cleanup\n- No guarantee goroutine stopped before fw.watcher.Close() is called\n\nSolution:\n- Add sync.WaitGroup field to FileWatcher\n- Track goroutines with wg.Add(1) and defer wg.Done()\n- Call wg.Wait() in Close() before cleanup\n\nImpact: Race condition on daemon shutdown; potential panic\n\nEffort: 2 hours","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-16T14:51:38.591371-08:00","updated_at":"2025-11-16T15:04:00.466334-08:00","closed_at":"2025-11-16T15:04:00.466334-08:00"} +{"id":"bd-1f28","title":"Extract migration functions to migrations.go","description":"Move migrateDirtyIssuesTable, migrateExternalRefColumn, migrateCompositeIndexes, migrateClosedAtConstraint, migrateCompactionColumns, migrateSnapshotsTable, migrateCompactionConfig, migrateCompactedAtCommitColumn, migrateExportHashesTable, migrateContentHashColumn to a separate migrations.go file","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-01T19:28:54.892045-07:00","updated_at":"2025-11-01T20:00:09.038174-07:00","closed_at":"2025-11-01T20:00:09.038178-07:00"} +{"id":"bd-4c18","title":"bd delete fails to find closed issues","description":"## Steps to Reproduce\n1. Close some issues with `bd close`\n2. Try to delete them with `bd delete \u003cids\u003e --force`\n3. Get error \"issues not found\"\n\n## Expected Behavior\nShould delete the closed issues\n\n## Actual Behavior\n```\nError: issues not found: bd-74ee, bd-9b13, bd-72w, bd-149, bd-5iv, bd-78w\n```\n\nBut `bd list --status closed --json` shows they exist.\n\n## Root Cause\nLikely the delete command is only looking for open issues, or there's a race condition with auto-import.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-03T20:57:31.763179-08:00","updated_at":"2025-11-03T21:31:18.677629-08:00","closed_at":"2025-11-03T21:31:18.677629-08:00"} +{"id":"bd-1c63eb84","title":"Investigate jujutsu integration for beads","description":"Research and document how beads could integrate with jujutsu (jj), the next-generation VCS. Key areas to explore:\n- How jj's operation model differs from git (immutable operations, working-copy-as-commit)\n- JSONL sync strategy with jj's conflict resolution model\n- Daemon compatibility with jj's more frequent rewrites\n- Whether auto-import/export needs changes for jj workflows\n- Example configurations and documentation updates needed","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-23T09:23:23.582009-07:00","updated_at":"2025-11-05T14:30:10.416881-08:00","closed_at":"2025-11-05T14:26:17.967073-08:00"} +{"id":"bd-82dv","title":"cmd/bd tests fail without -short flag (parallel test deadlock)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T22:58:38.72748-08:00","updated_at":"2025-11-09T12:54:44.557562-08:00","closed_at":"2025-11-09T12:54:44.557562-08:00"} +{"id":"bd-bdaf24d5","title":"Final validation test","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T18:27:28.310533-07:00","updated_at":"2025-10-31T12:00:43.184995-07:00","closed_at":"2025-10-31T12:00:43.184995-07:00"} +{"id":"bd-9nw","title":"Document sandbox workarounds for GH #353","description":"Add documentation for sandbox troubleshooting and new flags.\n\n**Tasks:**\n1. Create or update TROUBLESHOOTING.md with sandbox section\n2. Document new flags in CLI reference\n3. Add comment to GH #353 with immediate workarounds\n\n**Content needed:**\n- Symptoms of daemon lock issues in sandboxed environments\n- Usage guide for --sandbox, --force, and --allow-stale flags\n- Step-by-step troubleshooting for Codex users\n- Examples of each escape hatch\n\n**Files to update:**\n- docs/TROUBLESHOOTING.md (create if needed)\n- docs/CLI_REFERENCE.md or README.md\n- GitHub issue #353\n\n**References:**\n- docs/GH353_INVESTIGATION.md (lines 240-276)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-21T18:52:30.794526-05:00","updated_at":"2025-11-22T17:48:48.067269-08:00","closed_at":"2025-11-21T19:25:19.216834-05:00"} +{"id":"bd-e98221b3","title":"Update AGENTS.md and README.md with \"bd daemons\" documentation","description":"Document the new \"bd daemons\" command and all subcommands in AGENTS.md and README.md. Include examples and troubleshooting guidance.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-26T19:41:11.099254-07:00","updated_at":"2025-11-06T20:06:49.219318-08:00","closed_at":"2025-11-06T19:51:57.75321-08:00"} +{"id":"bd-4ry","title":"Clarify JSONL size bounds with multi-repo","description":"The contributor-workflow-analysis.md states (line 226): 'Keep beads.jsonl small enough for agents to read (\u003c25k)'\n\nWith multi-repo hydration, it's unclear whether this bound applies to:\n- Each individual JSONL file (likely intention)\n- The total hydrated size across all repos (unclear)\n- Both (most conservative)\n\nClarification needed because:\n- VC monitors .beads/issues.jsonl size to stay under limit\n- With multi-repo, VC needs to know if each additional repo also has 25k limit\n- Agents reading hydrated data need to know total size bounds\n- Performance characteristics depend on total vs per-repo limits\n\nExample scenario:\n- Primary repo: 20k JSONL\n- Planning repo: 15k JSONL\n- Total hydrated: 35k\nIs this acceptable or does it violate the \u003c25k principle?","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-03T20:24:50.042748-08:00","updated_at":"2025-11-05T14:18:00.550341-08:00","closed_at":"2025-11-05T14:18:00.550341-08:00"} +{"id":"bd-srwk","title":"bd export should detect and prevent stale database exports","description":"## Problem\n\nWhen `bd export` is run with a stale database (older than issues.jsonl), it silently overwrites the JSONL file with stale data, causing data loss.\n\n## What Happened (vc project)\n\n1. Agent A created 4 new issues and exported to issues.jsonl (commit 99a9d58)\n2. Agent A closed an issue and exported again (commit 58b4613) - JSONL now has 4 epics\n3. Agent B had stale database (from before step 1)\n4. Agent B worked on unrelated issue and exported (commit 0609233)\n5. Agent B's export **overwrote issues.jsonl**, removing the 4 epics created by Agent A\n6. Required manual recovery by re-exporting from Agent A's correct database\n\n## Expected Behavior\n\n`bd export` should detect that the database is stale and either:\n- **Refuse to export** with error message explaining the issue\n- **Warn prominently** and require explicit --force flag to override\n- **Auto-import first** to sync database before exporting\n\n## How to Detect Staleness\n\nCompare modification times (similar to VC's ValidateDatabaseFreshness):\n1. Check .db, .db-wal, .db-shm timestamps (use newest for WAL mode)\n2. Check issues.jsonl timestamp\n3. If JSONL is newer by \u003e1 second: database is stale\n\n## Suggested Fix\n\nAdd staleness check in `bd export`:\n\n```go\nfunc Export(dbPath, jsonlPath string, force bool) error {\n // Check if database is stale\n if !force {\n if err := checkDatabaseFreshness(dbPath, jsonlPath); err != nil {\n return fmt.Errorf(\"database is stale: %w\\n\" +\n \"Run 'bd import %s' first to sync, or use --force to override\",\n err, jsonlPath)\n }\n }\n \n // Proceed with export...\n}\n```\n\n## Impact\n\n- **Severity**: High (silent data loss)\n- **Frequency**: Happens in multi-agent workflows when agents don't sync\n- **Workaround**: Manual recovery (re-export from correct database)\n\n## References\n\n- VC issue tracker: commits 58b4613 -\u003e 0609233 -\u003e c41c638\n- VC has similar check: `storage.ValidateDatabaseFreshness()`\n- Tolerance: 1 second (handles filesystem timestamp precision)","notes":"Fixed with ID-based comparison instead of just count. Now detects:\n1. DB has fewer issues than JSONL (count check)\n2. DB has different issues than JSONL (ID comparison)\n\nBoth scenarios now properly refuse export unless --force is used.\n\nImplementation uses getIssueIDsFromJSONL() to build a set of IDs from JSONL, then checks if any JSONL IDs are missing from DB. Shows specific missing issue IDs in error message.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-07T19:39:24.172154-08:00","updated_at":"2025-11-07T20:05:13.649736-08:00","closed_at":"2025-11-07T19:58:43.300177-08:00"} +{"id":"bd-9ae788be","title":"Implement clone-scoped ID allocation to prevent N-way collisions","description":"## Problem\nCurrent ID allocation uses per-clone atomic counters (issue_counters table) that sync based on local database state. In N-way collision scenarios:\n- Clone B sees {test-1} locally, allocates test-2\n- Clone D sees {test-1, test-2, test-3} locally, allocates test-4\n- When same content gets assigned test-2 and test-4, convergence fails\n\nRoot cause: Each clone independently allocates IDs without global coordination, leading to overlapping assignments for the same content.\n\n## Solution\nAdd clone UUID to ID allocation to make every ID globally unique:\n\n**Current format:** `test-1`, `test-2`, `test-3`\n**New format:** `test-1-a7b3`, `test-2-a7b3`, `test-3-c4d9`\n\nWhere suffix is first 4 chars of clone UUID.\n\n## Implementation\n\n### 1. Add clone_identity table\n```sql\nCREATE TABLE clone_identity (\n clone_uuid TEXT PRIMARY KEY,\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n### 2. Modify getNextIDForPrefix()\n```go\nfunc (s *SQLiteStorage) getNextIDForPrefix(ctx context.Context, prefix string) (string, error) {\n cloneUUID := s.getOrCreateCloneUUID(ctx)\n shortUUID := cloneUUID[:4]\n \n nextNum := s.getNextCounterForPrefix(ctx, prefix)\n return fmt.Sprintf(\"%s-%d-%s\", prefix, nextNum, shortUUID), nil\n}\n```\n\n### 3. Update ID parsing logic\nAll places that parse IDs (utils.ExtractIssueNumber, etc.) need to handle new format.\n\n### 4. Migration strategy\n- Existing IDs remain unchanged (no suffix)\n- New IDs get clone suffix automatically\n- Display layer can hide suffix in UI: `bd-cb64c226.3-a7b3` β†’ `#42`\n\n## Benefits\n- **Zero collision risk**: Same content in different clones gets different IDs\n- **Maintains readability**: Still sequential numbering within clone\n- **No coordination needed**: Works offline, no central authority\n- **Scales to 100+ clones**: 4-char hex = 65,536 unique clones\n\n## Concerns\n- ID format change may break existing integrations\n- Need migration path for existing databases\n- Display logic needs update to hide/show suffixes appropriately\n\n## Success Criteria\n- 10+ clone collision test passes without failures\n- Existing issues continue to work (backward compatibility)\n- Documentation updated with new ID format\n- Migration guide for v1.x β†’ v2.x\n\n## Timeline\nMedium-term (v1.1-v1.2), 2-3 weeks implementation\n\n## References\n- Related to bd-e6d71828 (immediate fix)\n- See beads_nway_test.go for failing N-way tests","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-10-29T10:22:52.260524-07:00","updated_at":"2025-11-08T01:58:15.281403-08:00","closed_at":"2025-11-08T00:36:58.134558-08:00"} +{"id":"bd-2cvu","title":"Update AGENTS.md with Agent Mail workflow","description":"Update agent workflow section to include Agent Mail coordination as optional step.\n\nAcceptance Criteria:\n- Add Agent Mail to recommended workflow\n- Show both with/without examples\n- Update \"Multi-Agent Patterns\" section\n- Cross-reference to AGENT_MAIL.md\n\nFile: AGENTS.md (lines 468-475)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:42:51.295729-08:00","updated_at":"2025-11-08T00:52:34.288915-08:00","closed_at":"2025-11-08T00:52:34.288915-08:00","dependencies":[{"issue_id":"bd-2cvu","depends_on_id":"bd-xzrv","type":"blocks","created_at":"2025-11-07T23:04:09.773656-08:00","created_by":"daemon"}]} +{"id":"bd-fb95094c.5","title":"Centralize BD_DEBUG logging into debug package","description":"The codebase has 43 scattered instances of `if os.Getenv(\"BD_DEBUG\") != \"\"` debug checks across 6 files. Centralize into a debug logging package.\n\nCurrent locations:\n- `cmd/bd/main.go` - 15 checks\n- `cmd/bd/autoflush.go` - 6 checks\n- `cmd/bd/nodb.go` - 4 checks\n- `internal/rpc/server.go` - 2 checks\n- `internal/rpc/client.go` - 5 checks\n- `cmd/bd/daemon_autostart.go` - 11 checks\n\nTarget structure:\n```\ninternal/debug/\n└── debug.go\n```\n\nBenefits:\n- Centralized debug logging\n- Easier to add structured logging later\n- Testable (can mock debug output)\n- Consistent debug message format\n\nImpact: Removes 43 scattered checks, improves code clarity","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T20:31:19.089078-07:00","updated_at":"2025-11-07T00:28:01.781121-08:00","closed_at":"2025-11-06T20:13:09.412212-08:00","dependencies":[{"issue_id":"bd-fb95094c.5","depends_on_id":"bd-fb95094c","type":"parent-child","created_at":"2025-10-27T21:48:41.542395-07:00","created_by":"stevey"}]} +{"id":"bd-06y7","title":"Show dependency status in bd show output","description":"When bd show displays dependencies and dependents, include their status (open/closed/in_progress/blocked) for quick progress tracking. Improves context rebuilding and planning.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T11:22:11.606837-08:00","updated_at":"2025-11-05T11:23:30.431049-08:00","closed_at":"2025-11-05T11:23:30.431049-08:00"} +{"id":"bd-d84j","title":"Fix PR #319: Performance Improvements - CI failures and lint errors","description":"PR #319 (Performance Improvements) has excellent performance optimizations but is blocked by CI failures.\n\n## The PR\n- URL: https://github.com/steveyegge/beads/pull/319\n- Author: @rsnodgrass (Ryan)\n- Claimed improvements: bd ready 20.5x faster (752ms β†’ 36.6ms), startup 10.5x faster\n\n## CI Failures\n\n### Lint Errors (8 total)\n1. cmd/bd/deletion_tracking.go:57 - unchecked os.Remove\n2. cmd/bd/import.go:548 - unchecked os.RemoveAll\n3. cmd/bd/message.go:205 - unchecked resp.Body.Close\n4. cmd/bd/migrate_issues.go:633 - unchecked fmt.Scanln\n5. cmd/bd/migrate_issues.go:701 - unchecked MarkFlagRequired\n6. cmd/bd/migrate_issues.go:702 - unchecked MarkFlagRequired\n7. cmd/bd/show.go:610 - gosec G104 unhandled error\n8. cmd/bd/show.go:614 - gosec G104 unhandled error\n\n### Test Failures\nAll syncbranch_test.go tests failing with:\n\"migration external_ref_column failed: failed to create index on external_ref: sqlite3: SQL logic error: no such table: main.issues\"\n\nThis suggests the PR branch needs rebasing on current main.\n\n## Required Work\n\n### 1. Fix Lint Errors\nAdd proper error handling for all 8 flagged locations. Most can use _ = or log warnings.\n\n### 2. Rebase on Current Main\nThe migration test failures indicate the branch is out of sync. Need to:\n- git fetch upstream\n- git rebase upstream/main\n- Resolve any conflicts\n- Verify tests pass locally\n\n### 3. Verify CI Passes\n- All lint checks green\n- All tests pass (Linux, Windows, Nix)\n\n## Optional Improvements\n- Consider splitting into smaller PRs (core index, WASM cache, testing infra)\n- Add documentation for benchmark usage\n- Extract helper functions in doctor/perf.go for better testability\n\n## Value\nThis PR delivers real performance improvements. The index optimization alone is worth merging quickly once CI is fixed.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-15T12:24:34.50322-08:00","updated_at":"2025-11-15T12:43:11.49933-08:00","closed_at":"2025-11-15T12:43:11.49933-08:00"} +{"id":"bd-ayw","title":"Add 'When to use daemon mode' decision tree to daemon.md","description":"**Problem:**\nUsers (especially local-only developers) see daemon-related messages but don't understand:\n- What daemon mode does (git sync automation)\n- Whether they need it\n- Why they see \"daemon_unsupported\" messages\n\nRelated to issue #349 item #3.\n\n**Current state:**\ncommands/daemon.md explains WHAT daemon does but not WHEN to use it.\n\n**Proposed addition:**\nAdd a \"When to Use Daemon Mode\" section after line 20 in commands/daemon.md with clear decision criteria:\n\n**βœ… You SHOULD use daemon mode if:**\n- Working in a team with git remote sync\n- Want automatic commit/push of issue changes\n- Need background auto-sync (5-second debounce)\n- Making frequent bd commands (performance benefit)\n\n**❌ You DON'T need daemon mode if:**\n- Solo developer with local-only tracking\n- Working in git worktrees (use --no-daemon)\n- Running one-off commands/scripts\n- Debugging database issues\n\n**Local-only users:** Direct mode is perfectly fine. Daemon mainly helps with git sync automation. You can use `bd sync` manually when needed.\n\n**Files to modify:**\n- commands/daemon.md (add section after line 20)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T20:48:23.111621-05:00","updated_at":"2025-11-23T18:06:29.864029-08:00","closed_at":"2025-11-20T20:59:13.429263-05:00"} +{"id":"bd-df11","title":"Add import metrics for external_ref matching statistics","description":"Add observability for external_ref matching behavior during imports to help debug and optimize import operations.\n\nMetrics to track:\n- Number of issues matched by external_ref\n- Number of issues matched by ID\n- Number of issues matched by content hash\n- Number of external_ref updates vs creates\n- Average import time with vs without external_ref\n\nOutput format:\n- Add to ImportResult struct\n- Include in import command output\n- Consider structured logging\n\nUse cases:\n- Debugging slow imports\n- Understanding match distribution\n- Optimizing import performance\n\nRelated: bd-1022","status":"closed","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:46.157899-08:00","updated_at":"2025-11-08T02:24:24.686136-08:00","closed_at":"2025-11-08T02:20:01.01371-08:00"} +{"id":"bd-39o","title":"Rename last_import_hash metadata key to jsonl_content_hash","description":"The metadata key 'last_import_hash' is misleading because it's updated on both import AND export (sync.go:614, import.go:320).\n\nBetter names:\n- jsonl_content_hash (more accurate)\n- last_sync_hash (clearer intent)\n\nThis is a breaking change requiring migration of existing metadata values.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:31:07.568739-05:00","updated_at":"2025-11-20T21:31:07.568739-05:00","dependencies":[{"issue_id":"bd-39o","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:07.5698-05:00","created_by":"daemon"}]} +{"id":"bd-381d7f6c","title":"Audit Current Cache Usage","description":"Understand exactly what code depends on the storage cache","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-27T23:01:15.172045-07:00","updated_at":"2025-10-30T17:12:58.214409-07:00","closed_at":"2025-10-28T10:47:37.87529-07:00"} +{"id":"bd-8hf","title":"Auto-routing and maintainer detection","description":"Implement intelligent routing to automatically send new issues to correct repo based on user's maintainer vs contributor status, with discovered issues inheriting parent's source_repo.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-11-04T11:21:50.961196-08:00","updated_at":"2025-11-05T00:08:42.813482-08:00","closed_at":"2025-11-05T00:08:42.813484-08:00","dependencies":[{"issue_id":"bd-8hf","depends_on_id":"bd-4ms","type":"parent-child","created_at":"2025-11-04T11:22:24.262815-08:00","created_by":"daemon"}]} +{"id":"bd-a4b5","title":"Implement git worktree management","description":"Create git worktree lifecycle management for separate beads branch.\n\nTasks:\n- Create internal/git/worktree.go\n- Implement CreateBeadsWorktree(branch, path)\n- Implement RemoveBeadsWorktree(path)\n- Implement CheckWorktreeHealth(path)\n- Configure sparse checkout (only .beads/)\n- Implement SyncJSONLToWorktree()\n- Handle worktree errors gracefully\n- Auto-cleanup on config change\n\nEstimated effort: 3-4 days","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-02T15:22:35.56423-08:00","updated_at":"2025-11-04T11:10:23.533053-08:00","closed_at":"2025-11-04T11:10:23.533055-08:00","dependencies":[{"issue_id":"bd-a4b5","depends_on_id":"bd-a101","type":"parent-child","created_at":"2025-11-02T15:22:48.359843-08:00","created_by":"stevey"}]} +{"id":"bd-a03d5e36","title":"Improve integration test coverage for stateful features","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-29T21:53:15.397137-07:00","updated_at":"2025-11-08T01:58:15.281757-08:00","closed_at":"2025-11-08T00:36:59.02371-08:00"} +{"id":"bd-au0.5","title":"Add date and priority filters to bd search","description":"Add filter parity with bd list for consistent querying.\n\n**Missing filters to add:**\n- --priority, --priority-min, --priority-max\n- --created-after, --created-before\n- --updated-after, --updated-before\n- --closed-after, --closed-before\n- --empty-description, --no-assignee, --no-labels\n- --desc-contains, --notes-contains\n\n**Files to modify:**\n- cmd/bd/search.go\n- internal/rpc/protocol.go (SearchArgs)\n- internal/storage/storage.go (Search method)\n\n**Testing:**\n- All filter combinations\n- Date format parsing\n- Daemon and direct mode","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-21T21:07:05.496726-05:00","updated_at":"2025-11-21T21:07:05.496726-05:00","dependencies":[{"issue_id":"bd-au0.5","depends_on_id":"bd-au0","type":"parent-child","created_at":"2025-11-21T21:07:05.497762-05:00","created_by":"daemon"}]} +{"id":"bd-8ph6","title":"Support Ubuntu 20.04 LTS (glibc compatibility issue)","description":"Starting at v0.22, precompiled binaries require GLIBC 2.32+ which is not available on Ubuntu 20.04 LTS (Focal Fossa). Ubuntu 20.04 has GLIBC 2.31.\n\nError:\n```\nbd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by bd)\nbd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by bd)\n```\n\nCurrent workarounds:\n1. Upgrade to Ubuntu 22.04+\n2. Build from source: `go build -o bd ./cmd/bd/`\n\nRoot cause: Go 1.24+ runtime requires newer glibc. CGO is already disabled in .goreleaser.yml.\n\nPossible solutions:\n- Pin Go version to 1.21 or 1.22 for releases\n- Use Docker/cross-compile with older build environment\n- Provide separate build for older distros\n- Document minimum requirements clearly","notes":"Decision: Document minimum requirements in README instead of pinning Go version.\n\nRationale:\n- Ubuntu 20.04 LTS standard support ended April 2025 (already EOL)\n- Pinning Go prevents security fixes, performance improvements, and new features\n- Users on EOL distros can upgrade OS or build from source\n- Added Requirements section to README with clear glibc 2.32+ requirement","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-07T14:25:47.055357-08:00","updated_at":"2025-11-07T14:30:15.755733-08:00","closed_at":"2025-11-07T14:30:15.755733-08:00"} +{"id":"bd-p3b0.3","title":"Add unit tests for version tracking functions","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-23T17:12:29.267781-08:00","updated_at":"2025-11-23T17:16:10.649443-08:00","closed_at":"2025-11-23T17:16:10.649443-08:00","dependencies":[{"issue_id":"bd-p3b0.3","depends_on_id":"bd-p3b0","type":"parent-child","created_at":"2025-11-23T17:12:29.268313-08:00","created_by":"daemon"}]} +{"id":"bd-e6d71828","title":"Add transaction + retry logic for N-way collision resolution","description":"## Problem\nCurrent N-way collision resolution fails on UNIQUE constraint violations during convergence rounds when 5+ clones sync. The RemapCollisions function is non-atomic and performs operations sequentially:\n1. Delete old issues (CASCADE deletes dependencies)\n2. Create remapped issues (can fail with UNIQUE constraint)\n3. Recreate dependencies\n4. Update text references\n\nFailure at step 2 leaves database in inconsistent state.\n\n## Solution\nWrap collision resolution in database transaction with retry logic:\n- Make entire RemapCollisions operation atomic\n- Retry up to 3 times on UNIQUE constraint failures\n- Re-sync counters between retries\n- Add better error messages for debugging\n\n## Implementation\nLocation: internal/storage/sqlite/collision.go:342 (RemapCollisions function)\n\n```go\n// Retry up to 3 times on UNIQUE constraint failures\nfor attempt := 0; attempt \u003c 3; attempt++ {\n err := s.db.ExecInTransaction(func(tx *sql.Tx) error {\n // All collision resolution operations\n })\n if !isUniqueConstraintError(err) {\n return err\n }\n s.SyncAllCounters(ctx)\n}\n```\n\n## Success Criteria\n- 5-clone collision test passes reliably\n- No partial state on UNIQUE constraint errors\n- Automatic recovery from transient ID conflicts\n\n## References\n- See beads_nway_test.go:124 for the KNOWN LIMITATION comment\n- Related to-7c5915ae (transaction support)","notes":"## Progress Made\n\n1. Added `ExecInTransaction` helper to SQLiteStorage for atomic database operations\n2. Added `IsUniqueConstraintError` function to detect UNIQUE constraint violations\n3. Wrapped `RemapCollisions` with retry logic (up to 3 attempts) with counter sync between retries\n4. Enhanced `handleRename` to detect and handle race conditions where target ID already exists\n5. Added defensive checks for when old ID has been deleted by another clone\n\n## Test Results\n\nThe changes improve N-way collision handling but don't fully solve the problem:\n- Original error: `UNIQUE constraint failed: issues.id` during first convergence round\n- With changes: Test proceeds further but encounters different collision scenarios\n- New error: `target ID already exists with different content` in later convergence rounds\n\n## Root Cause Analysis\n\nThe issue is more complex than initially thought. In N-way scenarios:\n1. Clone A remaps bd-1c63eb84 β†’ test-2 β†’ test-4\n2. Clone B remaps bd-1c63eb84 β†’ test-3 β†’ test-4 \n3. Both try to create test-4, but with different intermediate states\n4. This creates legitimate content collisions that require additional resolution\n\n## Next Steps \n\nThe full solution requires:\n1. Making remapping fully deterministic across clones (same input β†’ same remapped ID)\n2. OR making `handleRename` more tolerant of mid-flight collisions\n3. OR implementing full transaction support for multi-step collision resolution -7c5915ae)\n\nThe retry logic added here provides a foundation but isn't sufficient for complex N-way scenarios.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T10:22:32.716678-07:00","updated_at":"2025-11-02T16:46:45.864479-08:00","closed_at":"2025-11-02T16:46:45.864479-08:00","dependencies":[{"issue_id":"bd-e6d71828","depends_on_id":"bd-cbed9619.1","type":"related","created_at":"2025-10-29T10:44:44.14653-07:00","created_by":"daemon"}]} +{"id":"bd-0tr0","title":"Claude Code frequently creates issues with empty descriptions","description":"## Problem\n\nUsers report that Claude Code creates beads issues with titles but no descriptions when asked to analyze code and create issues. Discussion #366 on GitHub highlights this.\n\n## Evidence\n\nAnalysis of our own projects shows significant rates of empty descriptions:\n- ~/src/beads: 110 empty / 630 total (17.5%)\n- ~/wyvern: 8 empty / 119 total (6.7%)\n- ~/src/vc: 3 empty / 170 total (1.8%)\n\nExamples of real issues with no description:\n- bd-5qim: Optimize GetReadyWork performance\n- bd-ge7/vc-7kln: Improve test coverage (appears in multiple projects)\n- Package-specific test coverage tasks (bd-m0w, bd-4h3, bd-t3b, bd-e92)\n- Wyvern testing tasks (wy-3hx, wy-qc9, wy-66)\n\nMany date from Nov 20-21, suggesting batch creation operations.\n\n## Impact\n\n- Issues lack context for future work\n- Harder to prioritize without understanding scope\n- Need manual follow-up to add details\n- Poor workflow experience for users\n\n## Related\n\n- GitHub Discussion #366: https://github.com/steveyegge/beads/discussions/366","status":"open","priority":2,"issue_type":"bug","created_at":"2025-11-23T13:59:45.931488-08:00","updated_at":"2025-11-23T13:59:45.931488-08:00"} +{"id":"bd-2530","title":"Issue with labels","description":"This is a description","status":"closed","issue_type":"feature","created_at":"2025-10-31T21:40:34.630173-07:00","updated_at":"2025-11-01T11:11:57.93151-07:00","closed_at":"2025-11-01T11:11:57.93151-07:00"} +{"id":"bd-6hji","title":"Test exclusive file reservations with two agents","description":"Simulate two agents racing to claim the same issue and verify that exclusive reservations prevent collision.\n\nAcceptance Criteria:\n- Agent A reserves bd-123 β†’ succeeds\n- Agent B tries to reserve bd-123 β†’ fails with clear error message\n- Agent B can see who has the reservation\n- Reservation expires after TTL\n- Agent B can claim after expiration","notes":"Successfully tested file reservations:\n- Agent BrownBear reserved bd-123 β†’ granted\n- Agent ChartreuseHill tried same β†’ conflicts returned\n- System correctly prevents collision","status":"closed","issue_type":"task","created_at":"2025-11-07T22:41:59.963468-08:00","updated_at":"2025-11-08T00:03:18.004972-08:00","closed_at":"2025-11-08T00:03:18.004972-08:00","dependencies":[{"issue_id":"bd-6hji","depends_on_id":"bd-muls","type":"blocks","created_at":"2025-11-07T23:03:52.897843-08:00","created_by":"daemon"},{"issue_id":"bd-6hji","depends_on_id":"bd-27xm","type":"blocks","created_at":"2025-11-07T23:20:21.911222-08:00","created_by":"daemon"},{"issue_id":"bd-6hji","depends_on_id":"bd-spmx","type":"parent-child","created_at":"2025-11-08T00:02:47.904652-08:00","created_by":"daemon"}]} +{"id":"bd-wrfz","title":"Create queries.go with core issue CRUD methods","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-23T18:08:13.46714-08:00","updated_at":"2025-11-23T18:12:55.233765-08:00","closed_at":"2025-11-23T18:12:55.233765-08:00"} +{"id":"bd-i00","title":"Convert magic numbers to named constants in FlushManager","status":"closed","priority":4,"issue_type":"task","created_at":"2025-11-20T21:22:17.845269-05:00","updated_at":"2025-11-21T10:59:00.409385-05:00","closed_at":"2025-11-20T21:35:53.11654-05:00"} +{"id":"bd-p68x","title":"Create examples for common workflows","description":"Add examples/ subdirectories: OSS contributor workflow, team branch workflow, multi-phase development, multiple personas (architect/implementer). Each with README and sample configs.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:04:30.128257-08:00","updated_at":"2025-11-05T19:27:33.07555-08:00","closed_at":"2025-11-05T19:08:39.035904-08:00","dependencies":[{"issue_id":"bd-p68x","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.247515-08:00","created_by":"daemon"}]} +{"id":"bd-0a90","title":"bd show --json doesn't include dependency type field","description":"Fix GitHub issue #202. The JSON output from bd show and bd list commands should include the dependency type field (and optionally created_at, created_by) to match internal storage format and enable better tooling integration.","notes":"PR #203 updated with cleaner implementation: https://github.com/steveyegge/beads/pull/203\n\n## Final Implementation\n\nCleanest possible approach - no internal helper methods needed:\n\n**Design:**\n- `GetDependenciesWithMetadata()` / `GetDependentsWithMetadata()` - canonical implementations with full SQL query\n- `GetDependencies()` / `GetDependents()` - thin wrappers that strip metadata for backward compat\n- `scanIssuesWithDependencyType()` - shared helper for scanning rows with dependency type\n\n**Benefits:**\n- Single source of truth - the `...WithMetadata()` methods ARE the implementation\n- Eliminated ~139 lines of duplicated SQL and scanning code\n- All tests passing (14 dependency-related tests)\n- Backward compatible\n- dependency_type field appears correctly in JSON output\n\n**Note on scan helpers:**\nThe duplication between `scanIssues()` and `scanIssuesWithDependencyType()` is necessary because they handle different SQL result shapes (16 vs 17 columns). This is justified as they serve fundamentally different purposes based on query structure.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-11-02T09:42:08.712725096Z","updated_at":"2025-11-02T11:50:54.292546-08:00","closed_at":"2025-11-02T11:50:54.292546-08:00"} +{"id":"bd-uiae","title":"Update documentation for beads-merge integration","description":"Document the integrated merge functionality.\n\n**Updates needed**:\n- AGENTS.md: Replace \"use external beads-merge\" with \"bd merge\"\n- README.md: Add git merge driver section\n- TROUBLESHOOTING.md: Update merge conflict resolution\n- ADVANCED.md: Document 3-way merge algorithm\n- Create CREDITS.md or ATTRIBUTION.md for @neongreen\n\n**Highlight**: Deletion sync fix (bd-hv01)","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-05T18:42:20.488998-08:00","updated_at":"2025-11-06T18:19:16.234758-08:00","closed_at":"2025-11-06T15:40:27.830475-08:00","dependencies":[{"issue_id":"bd-uiae","depends_on_id":"bd-qqvw","type":"parent-child","created_at":"2025-11-05T18:42:28.752447-08:00","created_by":"daemon"}]} +{"id":"bd-6d7efe32","title":"CRDT-based architecture for guaranteed convergence (v2.0)","description":"## Vision\nRedesign beads around Conflict-Free Replicated Data Types (CRDTs) to provide mathematical guarantees for N-way collision resolution at arbitrary scale.\n\n## Current Limitations\n- Content-hash based collision resolution fails at 5+ clones\n- Non-deterministic convergence in multi-round scenarios\n- UNIQUE constraint violations during rename operations\n- No formal proof of convergence properties\n\n## CRDT Benefits\n- Provably convergent (Strong Eventual Consistency)\n- Commutative/Associative/Idempotent operations\n- No coordination required between clones\n- Scales to 100+ concurrent workers\n- Well-understood mathematical foundations\n\n## Proposed Architecture\n\n### 1. UUID-Based IDs\nReplace sequential IDs with UUIDs:\n- Current: bd-1c63eb84, bd-9063acda, bd-4d80b7b1\n- CRDT: bd-a1b2c3d4-e5f6-7890-abcd-ef1234567890\n- Human aliases maintained separately: #42 maps to UUID\n\n### 2. Last-Write-Wins (LWW) Elements\nEach field becomes an LWW register:\n- title: (timestamp, clone_id, value)\n- status: (timestamp, clone_id, value)\n- Deterministic conflict resolution via Lamport timestamp + clone_id tiebreaker\n\n### 3. Operation Log\nTrack all operations as CRDT ops:\n- CREATE(uuid, timestamp, clone_id, fields)\n- UPDATE(uuid, field, timestamp, clone_id, value)\n- DELETE(uuid, timestamp, clone_id) - tombstone, not hard delete\n\n### 4. Sync as Merge\nSyncing becomes merging two CRDT states:\n- No merge conflicts possible\n- Deterministic merge function\n- Guaranteed convergence\n\n## Implementation Phases\n\n### Phase 1: Research \u0026 Design (4 weeks)\n- Study existing CRDT implementations (Automerge, Yjs, Loro)\n- Design schema for CRDT-based issue tracking\n- Prototype LWW-based Issue CRDT\n- Benchmark performance vs current system\n\n### Phase 2: Parallel Implementation (6 weeks)\n- Implement CRDT storage layer alongside SQLite\n- Build conversion tools: SQLite ↔ CRDT\n- Maintain backward compatibility with v1.x format\n- Migration path for existing databases\n\n### Phase 3: Testing \u0026 Validation (4 weeks)\n- Formal verification of convergence properties\n- Stress testing with 100+ clone scenario\n- Performance profiling and optimization\n- Documentation and examples\n\n### Phase 4: Migration \u0026 Rollout (4 weeks)\n- Release v2.0-beta with CRDT backend\n- Gradual migration from v1.x\n- Monitoring and bug fixes\n- Final v2.0 release\n\n## Risks \u0026 Mitigations\n\n**Risk 1: Performance overhead**\n- Mitigation: Benchmark early, optimize hot paths\n- CRDTs can be slower than append-only logs\n- May need compaction strategy\n\n**Risk 2: Storage bloat**\n- Mitigation: Implement operation log compaction\n- Tombstone garbage collection for deleted issues\n- Periodic snapshots to reduce log size\n\n**Risk 3: Breaking changes**\n- Mitigation: Maintain v1.x compatibility layer\n- Gradual migration tools\n- Dual-mode operation during transition\n\n**Risk 4: Complexity**\n- Mitigation: Use battle-tested CRDT libraries\n- Comprehensive documentation\n- Clear migration guide\n\n## Success Criteria\n- 100-clone collision test passes without failures\n- Formal proof of convergence properties\n- Performance within 2x of current system\n- Zero manual conflict resolution required\n- Backward compatible with v1.x databases\n\n## Timeline\n18-20 weeks total (4-5 months)\n\n## References\n- Automerge: https://automerge.org\n- Yjs: https://docs.yjs.dev\n- Loro: https://loro.dev\n- CRDT theory: Shapiro et al, A comprehensive study of CRDTs\n- Related issues: bd-e6d71828, bd-7a2b58fc, bd-81abb639","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-10-29T20:48:00.267237-07:00","updated_at":"2025-10-31T20:06:44.604643-07:00","closed_at":"2025-10-31T20:06:44.604643-07:00"} +{"id":"bd-mn9p","title":"bd-hv01: Brittle string comparison breaks with JSON field reordering","description":"## Problem\ndeletion_tracking.go:125 uses string comparison to detect unchanged issues:\n\n```go\nif leftLine, existsInLeft := leftIndex[id]; existsInLeft \u0026\u0026 leftLine == baseLine {\n deletions = append(deletions, id)\n}\n```\n\nThis breaks if:\n- JSON field order changes (legal in JSON)\n- Timestamps updated by import/export\n- Whitespace/formatting changes\n- Floating point precision varies\n\n## Example Failure\n```json\n// baseLine\n{\"id\":\"bd-1\",\"priority\":1,\"status\":\"open\"}\n// leftLine (same data, different order)\n{\"id\":\"bd-1\",\"status\":\"open\",\"priority\":1}\n```\nThese are semantically identical but string comparison fails.\n\n## Fix\nParse and compare JSON semantically:\n```go\nfunc jsonEquals(a, b string) bool {\n var objA, objB map[string]interface{}\n json.Unmarshal([]byte(a), \u0026objA)\n json.Unmarshal([]byte(b), \u0026objB)\n return reflect.DeepEqual(objA, objB)\n}\n```\n\n## Files Affected\n- cmd/bd/deletion_tracking.go:125\n- cmd/bd/deletion_tracking.go:134-170 (buildIDToLineMap)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-06T18:15:35.090716-08:00","updated_at":"2025-11-06T18:46:55.889888-08:00","closed_at":"2025-11-06T18:46:55.889888-08:00","dependencies":[{"issue_id":"bd-mn9p","depends_on_id":"bd-rbxi","type":"parent-child","created_at":"2025-11-06T18:19:14.790898-08:00","created_by":"daemon"}]} +{"id":"bd-f8b764c9.4","title":"Migration tool: sequential β†’ hash IDs","description":"Create migration tool to convert existing sequential-ID databases to hash-ID format.\n\n## Command: bd migrate --hash-ids\n\n```bash\nbd migrate --hash-ids [--dry-run]\n```\n\n## Migration Process\n\n### 1. Backup Database\n```bash\ncp .beads/beads.db .beads/beads.db.backup-1761798384\necho \"βœ“ Backup created: .beads/beads.db.backup-1234567890\"\n```\n\n### 2. Generate Hash IDs for Existing Issues\n```go\nfunc migrateToHashIDs(db *SQLiteStorage) error {\n // Read all issues\n issues, err := db.ListIssues(ctx, ListOptions{Status: \"all\"})\n \n // Generate mapping: old ID β†’ new hash ID\n mapping := make(map[string]string)\n for _, issue := range issues {\n hashID := GenerateHashID(\n issue.Title,\n issue.Description,\n issue.CreatedAt,\n db.workspaceID,\n )\n mapping[issue.ID] = hashID\n }\n \n // Detect hash collisions (extremely rare)\n if hasCollisions(mapping) {\n return fmt.Errorf(\"hash collision detected, aborting\")\n }\n \n return nil\n}\n```\n\n### 3. Update Database Schema\n```sql\n-- Add alias column\nALTER TABLE issues ADD COLUMN alias INTEGER UNIQUE;\n\n-- Populate aliases from old IDs\nUPDATE issues SET alias = CAST(SUBSTR(id, 4) AS INTEGER)\n WHERE id LIKE 'bd-%' AND SUBSTR(id, 4) GLOB '[0-9]*';\n\n-- Create new issues_new table with hash IDs\nCREATE TABLE issues_new (\n id TEXT PRIMARY KEY, -- Hash IDs now\n alias INTEGER UNIQUE,\n title TEXT NOT NULL,\n -- ... rest of schema\n);\n\n-- Copy data with ID mapping\nINSERT INTO issues_new SELECT \n \u003cnew_hash_id\u003e, -- From mapping\n alias,\n title,\n -- ...\nFROM issues;\n\n-- Drop old table, rename new\nDROP TABLE issues;\nALTER TABLE issues_new RENAME TO issues;\n```\n\n### 4. Update Dependencies\n```sql\n-- Update depends_on_id using mapping\nUPDATE dependencies \nSET issue_id = \u003cnew_hash_id\u003e,\n depends_on_id = \u003cnew_depends_on_hash_id\u003e\nFROM mapping;\n```\n\n### 5. Update Text References\n```go\n// Update all text fields that mention old IDs\nfunc updateTextReferences(db *SQLiteStorage, mapping map[string]string) error {\n for oldID, newID := range mapping {\n // Update description, notes, design, acceptance_criteria\n db.Exec(`UPDATE issues SET \n description = REPLACE(description, ?, ?),\n notes = REPLACE(notes, ?, ?),\n design = REPLACE(design, ?, ?),\n acceptance_criteria = REPLACE(acceptance_criteria, ?, ?)\n `, oldID, newID, oldID, newID, oldID, newID, oldID, newID)\n }\n}\n```\n\n### 6. Export to JSONL\n```bash\nbd export # Writes hash IDs to .beads/issues.jsonl\ngit add .beads/issues.jsonl\ngit commit -m \"Migrate to hash-based IDs\"\n```\n\n## Output\n```bash\n$ bd migrate --hash-ids\nMigrating to hash-based IDs...\nβœ“ Backup created: .beads/beads.db.backup-1730246400\nβœ“ Generated 150 hash IDs\nβœ“ No hash collisions detected\nβœ“ Updated issues table schema\nβœ“ Updated 150 issue IDs\nβœ“ Updated 87 dependencies\nβœ“ Updated 234 text references\nβœ“ Exported to .beads/issues.jsonl\nβœ“ Migration complete!\n\nNext steps:\n 1. Test: bd list, bd show #1, etc.\n 2. Commit: git commit -m \"Migrate to hash-based IDs\"\n 3. Push: git push origin main\n 4. Notify collaborators to pull and re-init\n```\n\n## Dry Run Mode\n```bash\n$ bd migrate --hash-ids --dry-run\n[DRY RUN] Would migrate 150 issues:\n bd-1c63eb84 β†’ bd-af78e9a2 (alias: #1)\n bd-9063acda β†’ bd-e5f6a7b8 (alias: #2)\n ...\n bd-150 β†’ bd-9a8b7c6d (alias: #150)\n\n[DRY RUN] Would update:\n - 150 issue IDs\n - 87 dependencies\n - 234 text references in descriptions/notes\n\nNo changes made. Run without --dry-run to apply.\n```\n\n## Files to Create\n- cmd/bd/migrate.go (new command)\n- internal/storage/sqlite/migrations/hash_ids.go\n\n## Testing\n- Test migration on small database (10 issues)\n- Test migration on large database (1000 issues)\n- Test hash collision detection (inject collision artificially)\n- Test text reference updates\n- Test rollback (restore from backup)\n- Test migrated database works correctly\n\n## Rollback Procedure\n```bash\n# If migration fails or has issues\nmv .beads/beads.db.backup-1234567890 .beads/beads.db\nbd export # Restore JSONL from backup DB\n```\n\n## Multi-Clone Coordination\n**Important**: All clones must migrate before syncing:\n\n1. Coordinator sends message: \"Migrating to hash IDs on 2025-10-30 at 10:00 UTC\"\n2. All collaborators pull latest changes\n3. All run: `bd migrate --hash-ids`\n4. All push changes\n5. New work can continue with hash IDs\n\n**Do NOT**:\n- Mix sequential and hash IDs in same database\n- Sync before all clones migrate","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T21:26:24.563993-07:00","updated_at":"2025-10-31T12:32:32.608574-07:00","closed_at":"2025-10-31T12:32:32.608574-07:00","dependencies":[{"issue_id":"bd-f8b764c9.4","depends_on_id":"bd-f8b764c9","type":"parent-child","created_at":"2025-10-29T21:26:24.565325-07:00","created_by":"stevey"},{"issue_id":"bd-f8b764c9.4","depends_on_id":"bd-f8b764c9.9","type":"blocks","created_at":"2025-10-29T21:26:24.565945-07:00","created_by":"stevey"}]} +{"id":"bd-rtp","title":"Implement signal-aware context in CLI commands","description":"Replace context.Background() with signal.NotifyContext() to enable graceful cancellation.\n\n## Context\nPart of context propagation work (bd-350). Phase 1 infrastructure is complete - sqlite.New() now accepts context parameter.\n\n## Implementation\nSet up signal-aware context at the CLI entry points:\n\n```go\nctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)\ndefer cancel()\n```\n\n## Key Locations\n- cmd/bd/main.go:438 (marked with TODO(bd-350))\n- cmd/bd/daemon.go:317 (marked with TODO(bd-350))\n- Other command entry points\n\n## Benefits\n- Ctrl+C cancels ongoing database operations\n- Graceful shutdown on SIGTERM\n- Better user experience during long operations\n\n## Acceptance Criteria\n- [ ] Ctrl+C during import cancels operation cleanly\n- [ ] Ctrl+C during export cancels operation cleanly\n- [ ] No database corruption on cancellation\n- [ ] Proper cleanup on signal (defers execute)","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-20T21:26:34.621983-05:00","updated_at":"2025-11-20T21:32:26.288303-05:00","closed_at":"2025-11-20T21:32:26.288303-05:00"} +{"id":"bd-2e94","title":"Support --parent flag in daemon mode","description":"Added support for hierarchical child issue creation using --parent flag in daemon mode. Previously only worked in direct mode.","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-11-05T13:55:47.415771-08:00","updated_at":"2025-11-05T13:55:53.252342-08:00","closed_at":"2025-11-05T13:55:53.252342-08:00"} +{"id":"bd-pdwz","title":"Add t.Parallel() to slow hash multiclone tests","description":"Add t.Parallel() to TestHashIDs_MultiCloneConverge and TestHashIDs_IdenticalContentDedup so they run concurrently.\n\nExpected savings: ~10 seconds (from 20s to ~11s)\n\nImplementation:\n- Add t.Parallel() call at start of each test function\n- Verify tests don't share resources that would cause conflicts\n- Run tests to confirm they work in parallel\n\nFile: beads_hash_multiclone_test.go:34, :101","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T01:24:15.705228-08:00","updated_at":"2025-11-04T09:52:31.945545-08:00","closed_at":"2025-11-04T09:52:31.945545-08:00","dependencies":[{"issue_id":"bd-pdwz","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:15.706149-08:00","created_by":"daemon"}]} +{"id":"bd-7a2b58fc","title":"Implement clone-scoped ID allocation to prevent N-way collisions","description":"## Problem\nCurrent ID allocation uses per-clone atomic counters (issue_counters table) that sync based on local database state. In N-way collision scenarios:\n- Clone B sees {test-1} locally, allocates test-2\n- Clone D sees {test-1, test-2, test-3} locally, allocates test-4\n- When same content gets assigned test-2 and test-4, convergence fails\n\nRoot cause: Each clone independently allocates IDs without global coordination, leading to overlapping assignments for the same content.\n\n## Solution\nAdd clone UUID to ID allocation to make every ID globally unique:\n\n**Current format:** `test-1`, `test-2`, `test-3`\n**New format:** `test-1-a7b3`, `test-2-a7b3`, `test-3-c4d9`\n\nWhere suffix is first 4 chars of clone UUID.\n\n## Implementation\n\n### 1. Add clone_identity table\n```sql\nCREATE TABLE clone_identity (\n clone_uuid TEXT PRIMARY KEY,\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n### 2. Modify getNextIDForPrefix()\n```go\nfunc (s *SQLiteStorage) getNextIDForPrefix(ctx context.Context, prefix string) (string, error) {\n cloneUUID := s.getOrCreateCloneUUID(ctx)\n shortUUID := cloneUUID[:4]\n \n nextNum := s.getNextCounterForPrefix(ctx, prefix)\n return fmt.Sprintf(\"%s-%d-%s\", prefix, nextNum, shortUUID), nil\n}\n```\n\n### 3. Update ID parsing logic\nAll places that parse IDs (utils.ExtractIssueNumber, etc.) need to handle new format.\n\n### 4. Migration strategy\n- Existing IDs remain unchanged (no suffix)\n- New IDs get clone suffix automatically\n- Display layer can hide suffix in UI: `bd-cb64c226.3-a7b3` β†’ `#42`\n\n## Benefits\n- **Zero collision risk**: Same content in different clones gets different IDs\n- **Maintains readability**: Still sequential numbering within clone\n- **No coordination needed**: Works offline, no central authority\n- **Scales to 100+ clones**: 4-char hex = 65,536 unique clones\n\n## Concerns\n- ID format change may break existing integrations\n- Need migration path for existing databases\n- Display logic needs update to hide/show suffixes appropriately\n\n## Success Criteria\n- 10+ clone collision test passes without failures\n- Existing issues continue to work (backward compatibility)\n- Documentation updated with new ID format\n- Migration guide for v1.x β†’ v2.x\n\n## Timeline\nMedium-term (v1.1-v1.2), 2-3 weeks implementation\n\n## References\n- Related to bd-0dcea000 (immediate fix)\n- See beads_nway_test.go for failing N-way tests","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-10-29T20:02:47.952447-07:00","updated_at":"2025-11-06T19:36:13.971527-08:00","closed_at":"2025-11-06T19:27:29.41629-08:00"} +{"id":"bd-obxt","title":"Fix bd doctor to recommend issues.jsonl as canonical (not beads.jsonl)","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-21T23:27:02.008716-08:00","updated_at":"2025-11-21T23:44:06.081448-08:00","closed_at":"2025-11-21T23:44:06.081448-08:00"} +{"id":"bd-9826b69a","title":"CRDT-based architecture for guaranteed convergence (v2.0)","description":"## Vision\nRedesign beads around Conflict-Free Replicated Data Types (CRDTs) to provide mathematical guarantees for N-way collision resolution at arbitrary scale.\n\n## Current Limitations\n- Content-hash based collision resolution fails at 5+ clones\n- Non-deterministic convergence in multi-round scenarios\n- UNIQUE constraint violations during rename operations\n- No formal proof of convergence properties\n\n## CRDT Benefits\n- Provably convergent (Strong Eventual Consistency)\n- Commutative/Associative/Idempotent operations\n- No coordination required between clones\n- Scales to 100+ concurrent workers\n- Well-understood mathematical foundations\n\n## Proposed Architecture\n\n### 1. UUID-Based IDs\nReplace sequential IDs with UUIDs:\n- Current: bd-1c63eb84, bd-9063acda, bd-4d80b7b1\n- CRDT: bd-a1b2c3d4-e5f6-7890-abcd-ef1234567890\n- Human aliases maintained separately: #42 maps to UUID\n\n### 2. Last-Write-Wins (LWW) Elements\nEach field becomes an LWW register:\n- title: (timestamp, clone_id, value)\n- status: (timestamp, clone_id, value)\n- Deterministic conflict resolution via Lamport timestamp + clone_id tiebreaker\n\n### 3. Operation Log\nTrack all operations as CRDT ops:\n- CREATE(uuid, timestamp, clone_id, fields)\n- UPDATE(uuid, field, timestamp, clone_id, value)\n- DELETE(uuid, timestamp, clone_id) - tombstone, not hard delete\n\n### 4. Sync as Merge\nSyncing becomes merging two CRDT states:\n- No merge conflicts possible\n- Deterministic merge function\n- Guaranteed convergence\n\n## Implementation Phases\n\n### Phase 1: Research \u0026 Design (4 weeks)\n- Study existing CRDT implementations (Automerge, Yjs, Loro)\n- Design schema for CRDT-based issue tracking\n- Prototype LWW-based Issue CRDT\n- Benchmark performance vs current system\n\n### Phase 2: Parallel Implementation (6 weeks)\n- Implement CRDT storage layer alongside SQLite\n- Build conversion tools: SQLite ↔ CRDT\n- Maintain backward compatibility with v1.x format\n- Migration path for existing databases\n\n### Phase 3: Testing \u0026 Validation (4 weeks)\n- Formal verification of convergence properties\n- Stress testing with 100+ clone scenario\n- Performance profiling and optimization\n- Documentation and examples\n\n### Phase 4: Migration \u0026 Rollout (4 weeks)\n- Release v2.0-beta with CRDT backend\n- Gradual migration from v1.x\n- Monitoring and bug fixes\n- Final v2.0 release\n\n## Risks \u0026 Mitigations\n\n**Risk 1: Performance overhead**\n- Mitigation: Benchmark early, optimize hot paths\n- CRDTs can be slower than append-only logs\n- May need compaction strategy\n\n**Risk 2: Storage bloat**\n- Mitigation: Implement operation log compaction\n- Tombstone garbage collection for deleted issues\n- Periodic snapshots to reduce log size\n\n**Risk 3: Breaking changes**\n- Mitigation: Maintain v1.x compatibility layer\n- Gradual migration tools\n- Dual-mode operation during transition\n\n**Risk 4: Complexity**\n- Mitigation: Use battle-tested CRDT libraries\n- Comprehensive documentation\n- Clear migration guide\n\n## Success Criteria\n- 100-clone collision test passes without failures\n- Formal proof of convergence properties\n- Performance within 2x of current system\n- Zero manual conflict resolution required\n- Backward compatible with v1.x databases\n\n## Timeline\n18-20 weeks total (4-5 months)\n\n## References\n- Automerge: https://automerge.org\n- Yjs: https://docs.yjs.dev\n- Loro: https://loro.dev\n- CRDT theory: Shapiro et al, A comprehensive study of CRDTs\n- Related issues: bd-0dcea000, bd-4d7fca8a, bd-6221bdcd","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-10-29T20:48:00.267736-07:00","updated_at":"2025-10-31T20:06:44.60536-07:00","closed_at":"2025-10-31T20:06:44.60536-07:00"} +{"id":"bd-t3b","title":"Add test coverage for internal/config package","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:22.91657-05:00","updated_at":"2025-11-20T21:21:22.91657-05:00","dependencies":[{"issue_id":"bd-t3b","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.201036-05:00","created_by":"daemon"}]} +{"id":"bd-373c","title":"Daemon crashes silently when multiple .db files exist in .beads/","description":"When daemon detects multiple .db files (after filtering out .backup and vc.db files), it writes error details to .beads/daemon-error file before exiting.\n\nThe error file is checked when:\n1. Daemon discovery fails to connect (internal/daemon/discovery.go)\n2. Auto-start fails to yield a running daemon (cmd/bd/main.go)\n3. Daemon list shows 'daemon not responding' error\n\nThis makes the error immediately visible to users without requiring them to check daemon logs.\n\nFile created: cmd/bd/daemon.go (writes daemon-error on multiple .db detection)\nFiles modified: \n- internal/daemon/discovery.go (reads daemon-error and surfaces in DaemonInfo.Error)\n- cmd/bd/main.go (displays daemon-error when auto-start fails)\n\nTesting: Create multiple .db files in .beads/, start daemon, verify error file created and shown in bd daemons list","notes":"Root cause: Daemon exits with os.Exit(1) when multiple .db files detected (daemon.go:1381), but error only goes to daemon log file. User sees 'daemon not responding' without knowing why.\n\nCurrent detection:\n- daemon.go filters out .backup and vc.db files\n- bd doctor detects multiple databases\n- Error message tells user to run 'bd init' or manually remove\n\nProblem: Error is not user-visible unless they check daemon logs.\n\nProposed fix options:\n1. Surface the error in 'bd info' and 'bd daemons list' output\n2. Add a hint in error messages to run 'bd doctor' when daemon fails\n3. Make daemon write error to a .beads/daemon-error file that gets checked\n4. Improve 'bd doctor' to run automatically when daemon is unhealthy","status":"closed","issue_type":"bug","created_at":"2025-10-31T21:08:03.389259-07:00","updated_at":"2025-11-01T11:13:48.029427-07:00","closed_at":"2025-11-01T11:13:48.029427-07:00","dependencies":[{"issue_id":"bd-373c","depends_on_id":"bd-2752a7a2","type":"discovered-from","created_at":"2025-10-31T21:08:03.390022-07:00","created_by":"stevey"}]} +{"id":"bd-xwo","title":"Fix validatePreExport to use content hash instead of mtime","description":"validatePreExport() in integrity.go:70 still uses isJSONLNewer() (mtime-based), creating inconsistent behavior. Auto-import correctly uses hasJSONLChanged() (hash-based) but export validation still uses the old mtime approach. This can cause false positive blocks after git operations.\n\nFix: Replace isJSONLNewer() call with hasJSONLChanged() in validatePreExport().\n\nImpact: Without this fix, the bd-khnb solution is incomplete - we prevent resurrection but still have export blocking issues.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T21:31:03.183164-05:00","updated_at":"2025-11-20T21:34:00.200803-05:00","closed_at":"2025-11-20T21:34:00.200803-05:00","dependencies":[{"issue_id":"bd-xwo","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:03.184049-05:00","created_by":"daemon"}]} +{"id":"bd-e1085716","title":"bd validate - Comprehensive health check","description":"Run all validation checks in one command.\n\nChecks:\n- Duplicates\n- Orphaned dependencies\n- Test pollution\n- Git conflicts\n\nSupports --fix-all for auto-repair.\n\nDepends on bd-cbed9619.1, bd-0dcea000, bd-31aab707, bd-9826b69a.\n\nFiles: cmd/bd/validate.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-10-29T23:05:13.980679-07:00","updated_at":"2025-10-30T17:12:58.19736-07:00"} +{"id":"bd-5ki8","title":"Add integration tests for adapter library","description":"Test suite for beads_mail_adapter.py covering all scenarios.\n\nAcceptance Criteria:\n- Test enabled mode (server available)\n- Test disabled mode (server unavailable)\n- Test graceful degradation (server dies mid-operation)\n- Test reservation conflicts\n- Test message sending/receiving\n- Mock HTTP server for testing\n- 90%+ code coverage\n\nFile: lib/test_beads_mail_adapter.py","notes":"Test suite completed with 29 comprehensive tests covering:\n- Enabled mode (server available): 10 tests\n- Disabled mode (server unavailable): 2 tests \n- Graceful degradation: 4 tests\n- Reservation conflicts: 2 tests\n- Configuration: 5 tests\n- Health check scenarios: 3 tests\n- HTTP error handling: 3 tests\n\n**Performance**: All tests run in 10ms (fast!)\n\n**Coverage highlights**:\nβœ… Server health checks (ok, degraded, error, timeout)\nβœ… All API operations (reserve, release, notify, check_inbox, get_reservations)\nβœ… HTTP errors (404, 409 conflict, 500, 503)\nβœ… Network errors (timeout, connection refused)\nβœ… Malformed responses (bad JSON, empty body, plain text errors)\nβœ… Environment variable configuration\nβœ… Graceful degradation when server dies mid-operation\nβœ… Conflict handling with both JSON and plain text errors\nβœ… Dict wrapper responses ({\"messages\": [...]} and {\"reservations\": [...]})\nβœ… Custom TTL for reservations\nβœ… Default agent name fallback\n\nNo external dependencies, no slow integration tests, just fast unit tests with mocks.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-07T22:43:21.294596-08:00","updated_at":"2025-11-08T01:32:39.906342-08:00","closed_at":"2025-11-08T01:32:39.906342-08:00","dependencies":[{"issue_id":"bd-5ki8","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T22:43:21.296024-08:00","created_by":"daemon"}]} +{"id":"bd-m0w","title":"Add test coverage for internal/validation package","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-20T21:21:24.129559-05:00","updated_at":"2025-11-20T21:21:24.129559-05:00","dependencies":[{"issue_id":"bd-m0w","depends_on_id":"bd-ge7","type":"blocks","created_at":"2025-11-20T21:21:31.350477-05:00","created_by":"daemon"}]} +{"id":"bd-8072","title":"Add import.orphan_handling config option","description":"Add configuration option to control orphan handling behavior: 'strict' (fail on missing parent, current behavior), 'resurrect' (auto-resurrect from JSONL, recommended default), 'skip' (skip orphaned issues with warning), 'allow' (import orphans without validation). Update CONFIG.md documentation.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:08.569239-08:00","updated_at":"2025-11-05T00:44:27.948157-08:00","closed_at":"2025-11-05T00:44:27.94816-08:00"} +{"id":"bd-c77d","title":"Test SQLite WASM compatibility","description":"Verify modernc.org/sqlite works in WASM target. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Compile minimal SQLite test to WASM\n- [ ] Test database create/open operations\n- [ ] Test query execution\n- [ ] Test JSONL import/export\n- [ ] Benchmark performance vs native\n\n## Decision Point\nIf modernc.org/sqlite issues, evaluate ncruces/go-sqlite3 alternative.","status":"closed","issue_type":"task","created_at":"2025-11-02T18:33:31.247537-08:00","updated_at":"2025-11-05T00:55:48.757762-08:00","closed_at":"2025-11-05T00:55:48.75777-08:00","dependencies":[{"issue_id":"bd-c77d","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.248112-08:00","created_by":"daemon"}]} +{"id":"bd-2b34.3","title":"Extract daemon sync functions to daemon_sync.go","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-31T22:28:42.347332-07:00","updated_at":"2025-11-01T21:02:58.339737-07:00","closed_at":"2025-11-01T21:02:58.339737-07:00"} +{"id":"bd-7e7ddffa","title":"Repair Commands \u0026 AI-Assisted Tooling","description":"Add specialized repair tools to reduce agent repair burden:\n1. Git merge conflicts in JSONL\n2. Duplicate issues from parallel work\n3. Semantic inconsistencies\n4. Orphaned references\n\nSee ~/src/fred/beads/repair_commands.md for full design doc.\n\nReduces agent repair time from 5-10 minutes to \u003c30 seconds per repair.","status":"closed","priority":1,"issue_type":"epic","created_at":"2025-10-28T19:30:17.465812-07:00","updated_at":"2025-11-02T16:40:51.866302-08:00","closed_at":"2025-11-02T16:40:51.866302-08:00"} +{"id":"bd-589c7c1e","title":"Fix revive style issues (78 issues)","description":"Style violations: unused parameters (many cmd/args in cobra commands), missing exported comments, stuttering names (SQLiteStorage), indent-error-flow issues.","notes":"Fixed 19 revive issues:\n- 14 unused-parameter (renamed to _)\n- 2 redefines-builtin-id (maxβ†’maxCount, minβ†’minInt)\n- 3 indent-error-flow (gofmt fixed 2, skipped 1 complex nested one)\n\nRemaining issues are acceptable: 11 unused-params in deeper code, 2 empty-blocks with comments, 1 complex indent case, 1 superfluous-else in test.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-27T23:20:10.391821-07:00","updated_at":"2025-10-30T17:12:58.215077-07:00","closed_at":"2025-10-27T23:02:41.30653-07:00"} +{"id":"bd-7kua","title":"Reduce sync rounds in multiclone tests","description":"Analyze and reduce the number of sync rounds in hash multiclone tests.\n\nCurrent state:\n- TestHashIDs_MultiCloneConverge: 1 round of syncs across 3 clones\n- TestHashIDs_IdenticalContentDedup: 2 rounds across 2 clones\n\nInvestigation needed:\n- Profile to see how much time each sync takes\n- Determine minimum rounds needed for convergence\n- Consider making rounds configurable via env var\n\nFile: beads_hash_multiclone_test.go:70, :132","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-04T01:24:18.405038-08:00","updated_at":"2025-11-04T10:26:34.449434-08:00","closed_at":"2025-11-04T10:26:34.449434-08:00","dependencies":[{"issue_id":"bd-7kua","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:18.405883-08:00","created_by":"daemon"}]} +{"id":"bd-d6aq","title":"Test reservation expiration and renewal","description":"Verify TTL-based reservation expiration works correctly.\n\nAcceptance Criteria:\n- Reserve with short TTL (30s)\n- Verify other agents can't claim\n- Wait for expiration\n- Verify reservation auto-released\n- Other agent can now claim\n- Test renewal/heartbeat mechanism\n\nFile: tests/integration/test_reservation_ttl.py","notes":"Implemented comprehensive TTL/expiration test suite in tests/integration/test_reservation_ttl.py\n\nTest Coverage:\nβœ… Short TTL reservations (30s) - verifies TTL is properly set\nβœ… Reservation blocking - confirms agent2 cannot claim while agent1 holds reservation\nβœ… Auto-release after expiration - validates expired reservations are auto-cleaned and become available\nβœ… Renewal/heartbeat - tests that re-reserving extends expiration time\n\nAll 4 tests passing in 56.9s total (including 30s+ wait time for expiration tests).\n\nMock server implements full TTL management:\n- Reservation class with expiration tracking\n- Auto-cleanup of expired reservations on each request\n- Renewal support (same agent re-reserving)\n- 409 conflict for cross-agent reservation attempts","status":"closed","priority":2,"issue_type":"task","created_at":"2025-11-07T22:43:21.547821-08:00","updated_at":"2025-11-08T02:24:30.296982-08:00","closed_at":"2025-11-08T02:24:30.296982-08:00","dependencies":[{"issue_id":"bd-d6aq","depends_on_id":"bd-m9th","type":"blocks","created_at":"2025-11-07T22:43:21.548731-08:00","created_by":"daemon"}]} +{"id":"bd-8507","title":"Publish bd-wasm to npm","description":"Package and publish WASM build to npm. Child of epic bd-44d0.\n\n## Tasks\n- [ ] Optimize WASM bundle (compression)\n- [ ] Create README for npm package\n- [ ] Set up npm publishing workflow\n- [ ] Publish v0.1.0-alpha\n- [ ] Test installation in clean environment\n- [ ] Update beads AGENTS.md with installation instructions\n\n## Package Name\nbd-wasm (or @beads/wasm-cli)","status":"closed","issue_type":"task","created_at":"2025-11-02T18:33:31.371535-08:00","updated_at":"2025-11-05T00:55:48.757492-08:00","closed_at":"2025-11-05T00:55:48.757494-08:00","dependencies":[{"issue_id":"bd-8507","depends_on_id":"bd-197b","type":"blocks","created_at":"2025-11-02T18:33:31.372224-08:00","created_by":"daemon"},{"issue_id":"bd-8507","depends_on_id":"bd-374e","type":"blocks","created_at":"2025-11-02T22:27:56.025207-08:00","created_by":"daemon"}]} +{"id":"bd-d19a","title":"Fix import failure on missing parent issues","description":"Import process fails atomically when JSONL references deleted parent issues. Implement hybrid solution: topological sorting + parent resurrection to handle deleted parents gracefully while maintaining referential integrity. See docs/import-bug-analysis-bd-3xq.md for full analysis.","status":"closed","issue_type":"epic","created_at":"2025-11-04T12:31:30.994759-08:00","updated_at":"2025-11-05T00:08:42.814239-08:00","closed_at":"2025-11-05T00:08:42.814243-08:00"} +{"id":"bd-3b2fe268","title":"Add fsnotify dependency to go.mod","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T16:20:02.429763-07:00","updated_at":"2025-11-06T19:36:13.969438-08:00","closed_at":"2025-11-06T19:27:34.921866-08:00"} +{"id":"bd-t4u1","title":"False positive detection by Kaspersky Antivirus (Trojan)","description":"Kaspersky Antivirus falsely detects beads (bd.exe v0.23.1) as a Trojan (PDM:Trojan.Win32.Generic) and removes it.\nEvent: Malicious object detected\nComponent: System Watcher\nObject name: bd.exe\n","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-20T18:56:12.498187-05:00","updated_at":"2025-11-20T18:56:12.498187-05:00"} +{"id":"bd-fb95094c","title":"Code Health \u0026 Technical Debt Cleanup","description":"Comprehensive codebase cleanup to remove dead code, refactor monolithic files, deduplicate utilities, and improve maintainability. Based on ultrathink code health analysis conducted 2025-10-27.\n\nGoals:\n- Remove ~1,500 LOC of dead/unreachable code\n- Split 2 monolithic files (server.go 2,273 LOC, sqlite.go 2,136 LOC) into focused modules\n- Deduplicate scattered utility functions (normalizeLabels, BD_DEBUG checks)\n- Consolidate test coverage (2,019 LOC of collision tests)\n- Improve code navigation and reduce merge conflicts\n\nImpact: Reduces codebase by ~6-8%, improves maintainability, faster CI/CD\n\nEstimated Effort: 11 days across 4 phases","status":"closed","priority":2,"issue_type":"epic","created_at":"2025-10-27T20:39:22.22227-07:00","updated_at":"2025-11-23T14:14:13.333263-08:00","closed_at":"2025-11-08T18:15:59.971899-08:00"} +{"id":"bd-gm7p","title":"Use in-memory filesystem for test git operations","description":"Use tmpfs/ramdisk for git operations in tests to reduce I/O overhead.\n\nOptions:\n1. Mount /tmp as tmpfs in CI (GitHub Actions supports this)\n2. Use Go's testing.TB.TempDir() which may already use tmpfs on some systems\n3. Explicitly create ramdisk for tests on macOS\n\nExpected savings: 20-30% reduction in git operation time","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-04T01:24:19.803224-08:00","updated_at":"2025-11-04T10:52:42.722474-08:00","closed_at":"2025-11-04T10:52:42.722474-08:00","dependencies":[{"issue_id":"bd-gm7p","depends_on_id":"bd-l5gq","type":"blocks","created_at":"2025-11-04T01:24:19.80414-08:00","created_by":"daemon"}]} +{"id":"bd-ce75","title":"Test parent issue","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-07T16:08:24.952167-08:00","updated_at":"2025-11-07T22:07:17.343848-08:00","closed_at":"2025-11-07T22:07:17.34385-08:00"} +{"id":"bd-8f8b","title":"Test update","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T12:59:13.608216-08:00","updated_at":"2025-11-05T12:59:20.120052-08:00","closed_at":"2025-11-05T12:59:20.120052-08:00"} +{"id":"bd-twlr","title":"Add bd init --team wizard","description":"Interactive wizard for team workflow setup. Guides user through: branch workflow configuration, shared repo setup, team member onboarding, examples of team collaboration patterns.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-05T18:04:30.013645-08:00","updated_at":"2025-11-05T19:27:33.075826-08:00","closed_at":"2025-11-05T18:56:03.004161-08:00","dependencies":[{"issue_id":"bd-twlr","depends_on_id":"bd-8rd","type":"parent-child","created_at":"2025-11-05T18:04:39.164445-08:00","created_by":"daemon"}]} +{"id":"bd-keb","title":"Add database maintenance commands section to QUICKSTART.md","description":"**Problem:**\nUsers don't discover `bd compact` or `bd cleanup` commands until their database grows large. These maintenance commands aren't mentioned in quickstart documentation.\n\nRelated to issue #349 item #4.\n\n**Current state:**\ndocs/QUICKSTART.md ends at line 217 with \"See README.md for full documentation\" but has no mention of maintenance operations.\n\n**Proposed addition:**\nAdd a \"Database Maintenance\" section after line 140 (before \"Advanced: Agent Mail\" section) covering:\n- When database grows (many closed issues)\n- How to view compaction statistics\n- How to compact old issues\n- How to delete closed issues\n- Warning about permanence\n\n**Example content:**\n```markdown\n## Database Maintenance\n\nAs your project accumulates closed issues, the database grows. Use these commands to manage size:\n\n```bash\n# View compaction statistics\nbd compact --stats\n\n# Preview compaction candidates (30+ days closed)\nbd compact --analyze --json\n\n# Apply agent-generated summary\nbd compact --apply --id bd-42 --summary summary.txt\n\n# Immediately delete closed issues (use with caution!)\nbd cleanup --force\n```\n\n**When to compact:**\n- Database file \u003e 10MB with many old closed issues\n- After major project milestones\n- Before archiving a project phase\n```\n\n**Files to modify:**\n- docs/QUICKSTART.md (add section after line 140)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T20:48:40.488512-05:00","updated_at":"2025-11-23T18:06:29.862481-08:00","closed_at":"2025-11-20T20:59:13.439462-05:00"} +{"id":"bd-379","title":"Implement `bd setup cursor` for Cursor IDE integration","description":"Create a `bd setup cursor` command that integrates Beads workflow into Cursor IDE via .cursorrules file. Unlike Claude Code (which has hooks), Cursor uses a static rules file to provide context to its AI.","status":"open","priority":3,"issue_type":"feature","created_at":"2025-11-11T23:32:22.170083-08:00","updated_at":"2025-11-11T23:32:22.170083-08:00"} +{"id":"bd-az0m","title":"Issue 1","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T19:43:48.754145-05:00","updated_at":"2025-11-20T19:43:48.754145-05:00","closed_at":"2025-11-07T21:55:09.42865-08:00","dependencies":[{"issue_id":"bd-az0m","depends_on_id":"bd-bvo2","type":"related","created_at":"2025-11-07T19:07:21.069031-08:00","created_by":"daemon"}]} +{"id":"bd-cbed9619.5","title":"Add content-addressable identity to Issue type","description":"## Overview\nPhase 1: Add content hashing to enable global identification of issues regardless of their assigned IDs.\n\n## Current Problem\nThe system identifies issues only by ID (e.g., test-1, test-2). When multiple clones create the same ID with different content, there's no way to identify that these are semantically different issues without comparing all fields.\n\n## Solution\nAdd a ContentHash field to the Issue type that represents the canonical content fingerprint.\n\n## Implementation Tasks\n\n### 1. Add ContentHash field to Issue type\nFile: internal/types/types.go\n```go\ntype Issue struct {\n ID string\n ContentHash string // SHA256 of canonical content\n // ... existing fields\n}\n```\n\n### 2. Add content hash computation method\nUse existing hashIssueContent from collision.go:186 as foundation:\n```go\nfunc (i *Issue) ComputeContentHash() string {\n return hashIssueContent(i)\n}\n```\n\n### 3. Compute hash at creation time\n- Modify CreateIssue to compute and store ContentHash\n- Modify CreateIssues (batch) to compute hashes\n\n### 4. Compute hash at import time \n- Modify ImportIssues to compute ContentHash for all incoming issues\n- Store hash in database\n\n### 5. Add database column\n- Add migration to add content_hash column to issues table\n- Update SELECT/INSERT statements to include content_hash\n- Index on content_hash for fast lookups\n\n### 6. Populate existing issues\n- Add migration step to compute ContentHash for all existing issues\n- Use hashIssueContent function\n\n## Acceptance Criteria\n- Issue type has ContentHash field\n- Hash is computed automatically at creation time\n- Hash is computed for imported issues\n- Database stores content_hash column\n- All existing issues have non-empty ContentHash\n- Hash is deterministic (same content β†’ same hash)\n- Hash excludes ID, timestamps (only semantic content)\n\n## Files to Modify\n- internal/types/types.go\n- internal/storage/sqlite/sqlite.go (schema, CreateIssue, CreateIssues)\n- internal/storage/sqlite/migrations.go (new migration)\n- internal/importer/importer.go (compute hash during import)\n- cmd/bd/create.go (compute hash at creation)\n\n## Testing\n- Unit test: same content produces same hash\n- Unit test: different content produces different hash \n- Unit test: hash excludes ID and timestamps\n- Integration test: hash persists in database\n- Migration test: existing issues get hashes populated","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-28T18:36:44.914967-07:00","updated_at":"2025-10-30T17:12:58.2279-07:00","closed_at":"2025-10-28T18:57:10.985198-07:00","dependencies":[{"issue_id":"bd-cbed9619.5","depends_on_id":"bd-325da116","type":"parent-child","created_at":"2025-10-28T18:39:20.547325-07:00","created_by":"daemon"}]} +{"id":"bd-2752a7a2","title":"Create cmd/bd/daemon_watcher.go (~150 LOC)","description":"Implement FileWatcher using fsnotify to watch JSONL file and git refs. Handle platform differences (inotify/FSEvents/ReadDirectoryChangesW). Include edge case handling for file rename, event storm, watcher failure.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T23:05:13.887269-07:00","updated_at":"2025-10-31T18:30:24.131535-07:00","closed_at":"2025-10-31T18:30:24.131535-07:00"} +{"id":"bd-17d5","title":"bd sync false positive: conflict detection triggers on JSON-encoded angle brackets in issue content","description":"The bd sync --import-only command incorrectly detects conflict markers when issue descriptions contain the text '\u003c\u003c\u003c\u003c\u003c\u003c\u003c' or '\u003e\u003e\u003e\u003e\u003e\u003e\u003e' as legitimate content (e.g., documentation about git conflict markers).\n\n**Reproduction:**\n1. Create issue with design field containing: 'Read file, extract \u003c\u003c\u003c\u003c\u003c\u003c\u003c / ======= / \u003e\u003e\u003e\u003e\u003e\u003e\u003e markers'\n2. Export to JSONL (gets JSON-encoded as \\u003c\\u003c\\u003c...)\n3. Commit and push\n4. Pull from remote\n5. bd sync --import-only fails with: 'Git conflict markers detected in JSONL file'\n\n**Root cause:**\nThe conflict detection appears to decode JSON before checking for conflict markers, causing false positives when issue content legitimately contains these strings.\n\n**Expected behavior:**\nConflict detection should only trigger on actual git conflict markers (literal '\u003c\u003c\u003c\u003c\u003c\u003c\u003c' bytes in the raw file), not on JSON-encoded content within issue fields.\n\n**Test case:**\nVC project at ~/src/dave/vc has vc-85 'JSONL Conflict Parser' which documents conflict parsing and triggers this bug.\n\n**Suggested fixes:**\n1. Only scan for literal '\u003c\u003c\u003c\u003c\u003c\u003c\u003c' bytes (not decoded JSON content)\n2. Parse JSONL first and only flag unparseable lines\n3. Check git merge state (git status) to confirm actual conflict\n4. Add --skip-conflict-check flag for override","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-11-08T13:02:54.730745-08:00","updated_at":"2025-11-08T13:07:37.108225-08:00","closed_at":"2025-11-08T13:07:37.108225-08:00"} +{"id":"bd-b134","title":"Add tests for Integration Layer Implementation","description":"While implementing bd-wfmw, noticed missing tests","notes":"Reviewed existing coverage:\n- Basic test coverage exists in lib/test_beads_mail_adapter.py\n- Integration tests cover failure scenarios in tests/integration/test_mail_failures.py\n- Good coverage of: enabled/disabled modes, graceful degradation, 409 conflicts, HTTP errors, config\n- Missing: authorization headers detail, request body structure validation, concurrent reservation timing, TTL edge cases","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-08T00:20:30.804172-08:00","updated_at":"2025-11-08T02:17:04.046571-08:00","closed_at":"2025-11-08T02:17:04.046571-08:00","dependencies":[{"issue_id":"bd-b134","depends_on_id":"bd-wfmw","type":"discovered-from","created_at":"2025-11-08T00:20:30.850776-08:00","created_by":"daemon"}]} +{"id":"bd-bb08","title":"Add ON DELETE CASCADE to child_counters schema","description":"Update schema.go child_counters table foreign key with ON DELETE CASCADE. When parent deleted, child counter should also be deleted. If parent is resurrected, counter gets recreated from scratch. Add migration for existing databases.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-04T12:32:30.681452-08:00","updated_at":"2025-11-05T11:31:27.505024-08:00","closed_at":"2025-11-05T00:55:12.427194-08:00"} +{"id":"bd-vxdr","title":"Investigate database pollution - issue count anomalies","description":"Multiple repos showing inflated issue counts suggesting cross-repo pollution:\n- ~/src/dave/beads: 895 issues (675 open) - clearly polluted\n- ~/src/stevey/src/beads: 280 issues (expected ~209-220) - possibly polluted\n\nNeed to investigate:\n1. Source of pollution (multi-repo sync issues?)\n2. How many duplicate/foreign issues exist\n3. Whether recent sync operations caused cross-contamination\n4. How to clean up and prevent future pollution","notes":"Investigation findings:\n\n**Root cause identified:**\n- NOT cross-repo contamination\n- NOT automated test leakage (tests properly use t.TempDir())\n- Manual testing during template feature development (Nov 2-4)\n- Commit ba325a2: \"test issues were accidentally committed during template feature development\"\n\n**Database growth timeline:**\n- Nov 3: 19 issues (baseline)\n- Nov 2-5: +244 issues (massive development spike)\n- Nov 6-7: +40 issues (continued growth)\n- Current: 291 issues β†’ 270 after cleanup\n\n**Test pollution breakdown:**\n- 21 issues matching \"Test \" prefix pattern\n- Most created Nov 2-5 during feature development\n- Pollution from manual `./bd create \"Test issue\"` commands in production workspace\n- All automated tests properly isolated with t.TempDir()\n\n**Cleanup completed:**\n- Ran scripts/cleanup-test-pollution.sh successfully\n- Removed 21 test issues\n- Database reduced from 291 β†’ 270 issues (7.2% cleanup)\n- JSONL synced to git\n\n**Prevention strategy:**\n- Filed follow-up issue for prevention mechanisms\n- Script can be deleted once prevention is in place\n- Tests are already properly isolated - no code changes needed there","status":"closed","issue_type":"bug","created_at":"2025-11-06T22:34:40.137483-08:00","updated_at":"2025-11-07T16:07:28.274136-08:00","closed_at":"2025-11-07T16:04:02.199807-08:00"} +{"id":"bd-8900f145","title":"Testing event-driven mode!","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-29T15:28:33.564871-07:00","updated_at":"2025-10-30T17:12:58.186325-07:00","closed_at":"2025-10-29T19:12:54.43368-07:00"} +{"id":"bd-rfj","title":"Add unit tests for hasJSONLChanged() function","description":"The hasJSONLChanged() function has no unit tests. Should test:\n- Normal case: hash matches\n- Normal case: hash differs\n- Edge case: empty file\n- Edge case: missing metadata (first run)\n- Edge case: corrupted metadata\n- Edge case: file read errors\n- Edge case: invalid hash format in metadata\n\nAlso add performance benchmarks for large JSONL files.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:31:10.389481-05:00","updated_at":"2025-11-20T21:40:02.664516-05:00","closed_at":"2025-11-20T21:40:02.664516-05:00","dependencies":[{"issue_id":"bd-rfj","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:10.39058-05:00","created_by":"daemon"}]} +{"id":"bd-t5o","title":"Document error handling strategy for metadata update failures","description":"Multiple places silently ignore metadata update failures (sync.go:614-617, import.go:320-322) with non-fatal warnings. This is intentional (degrades gracefully to mtime-based approach) but not well documented.\n\nAdd comments explaining:\n- Why these failures are non-fatal\n- How system degrades gracefully\n- What the fallback behavior is (mtime-based detection)","status":"closed","priority":3,"issue_type":"task","created_at":"2025-11-20T21:31:12.366861-05:00","updated_at":"2025-11-20T21:36:16.972395-05:00","closed_at":"2025-11-20T21:36:16.972395-05:00","dependencies":[{"issue_id":"bd-t5o","depends_on_id":"bd-khnb","type":"blocks","created_at":"2025-11-20T21:31:12.367744-05:00","created_by":"daemon"}]} +{"id":"bd-d7e88238","title":"Rapid 3","status":"closed","priority":3,"issue_type":"task","created_at":"2025-10-29T19:11:57.459655-07:00","updated_at":"2025-11-07T23:21:44.925275-08:00","closed_at":"2025-11-07T23:18:52.333825-08:00"} +{"id":"bd-833559b3","title":"bd validate - Comprehensive health check","description":"Run all validation checks in one command.\n\nChecks:\n- Duplicates\n- Orphaned dependencies\n- Test pollution\n- Git conflicts\n\nSupports --fix-all for auto-repair.\n\nDepends on bd-cbed9619.1, bd-0dcea000, bd-2752a7a2, bd-9826b69a.\n\nFiles: cmd/bd/validate.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-29T20:02:47.957692-07:00","updated_at":"2025-11-05T00:16:42.294117-08:00","closed_at":"2025-11-05T00:16:42.294117-08:00"} +{"id":"bd-s02","title":"Manual task","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-03T20:15:10.022202-08:00","updated_at":"2025-11-03T20:15:10.022202-08:00"} +{"id":"bd-yvlc","title":"URGENT: main branch has failing tests (syncbranch migration error)","description":"The main branch has failing tests that are blocking CI for all PRs.\n\n## Problem\nAll syncbranch_test.go tests failing with:\n\"migration external_ref_column failed: failed to create index on external_ref: sqlite3: SQL logic error: no such table: main.issues\"\n\n## Evidence\n- Last 5 CI runs on main: ALL FAILED\n- Tests fail locally on current main (bd6dca5)\n- Affects: TestGet, TestSet, TestUnset in internal/syncbranch\n\n## Impact\n- Blocking all PR merges\n- CI shows red for all branches\n- Can't trust test results\n\n## Root Cause\nMigration order issue - trying to create index on external_ref column before the issues table exists, or before the external_ref column is added to the issues table.\n\n## Quick Fix Needed\nNeed to investigate migration order in internal/storage/sqlite/migrations.go and ensure:\n1. issues table is created first\n2. external_ref column is added to issues table\n3. THEN index on external_ref is created\n\nThis is CRITICAL - main should never have breaking tests.","status":"closed","issue_type":"bug","created_at":"2025-11-15T12:25:31.51688-08:00","updated_at":"2025-11-15T12:43:11.489612-08:00","closed_at":"2025-11-15T12:43:11.489612-08:00"} +{"id":"bd-b6b2","title":"Feature with design","description":"This is a description","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-10-31T21:40:34.612465-07:00","updated_at":"2025-11-04T11:10:23.533636-08:00","closed_at":"2025-11-04T11:10:23.533638-08:00"} +{"id":"bd-zbq2","title":"bd export should verify JSONL line count matches database count","description":"After export completes, bd should verify that the JSONL file line count matches the number of issues exported. This would catch silent failures where the export appears to succeed but doesn't actually write all issues.\n\nReal-world scenario from VC project:\n- Ran direct SQL DELETE to remove 240 issues \n- Ran 'bd export -o .beads/issues.jsonl'\n- No error shown, appeared to succeed\n- But JSONL file was not updated (still had old line count)\n- Later session found all 240 issues still in JSONL\n- Had to repeat the cleanup\n\nIf export had verified line count, it would have immediately shown:\n Error: Export verification failed\n Expected: 276 issues\n JSONL file: 516 lines\n Mismatch indicates export failed to write all issues\n\nThis is especially important because:\n1. JSONL is source of truth in git\n2. Silent export failures cause data inconsistency\n3. Users assume export succeeded if no error shown\n4. The verification is cheap (just count lines)\n\nImplementation:\n- After writing JSONL, count lines in file\n- Compare to len(exportedIDs)\n- If mismatch, remove temp file and return error\n- Show clear error message with both counts","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-11-05T14:24:56.278249-08:00","updated_at":"2025-11-05T15:09:41.636141-08:00","closed_at":"2025-11-05T14:31:24.494885-08:00"} +{"id":"bd-4aeed709","title":"bd resolve-conflicts - Git merge conflict resolver","description":"Automatically resolve JSONL merge conflicts.\n\nModes:\n- Mechanical: ID remapping (no AI)\n- AI-assisted: Smart merge/keep decisions\n- Interactive: Review each conflict\n\nHandles \u003c\u003c\u003c\u003c\u003c\u003c\u003c conflict markers in .beads/beads.jsonl\n\nFiles: cmd/bd/resolve_conflicts.go (new)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-11-20T12:40:11.707308-05:00","updated_at":"2025-11-20T12:40:11.707308-05:00","closed_at":"2025-10-28T15:47:33.037021-07:00"} +{"id":"bd-kb4g","title":"TestHooksCheckGitHooks failing - version mismatch (0.23.0 vs 0.23.1)","description":"The test is checking embedded hook versions and expecting 0.23.1, but got 0.23.0. This appears to be a version consistency issue that needs investigation.\n\nTest output:\n```\nHook pre-commit version mismatch: got 0.23.0, want 0.23.1\nHook post-merge version mismatch: got 0.23.0, want 0.23.1\nHook pre-push version mismatch: got 0.23.0, want 0.23.1\n```\n\nThis is blocking the landing of GH #274 fix.","status":"closed","issue_type":"bug","created_at":"2025-11-09T14:13:14.138537-08:00","updated_at":"2025-11-20T18:54:56.496852-05:00","closed_at":"2025-11-10T10:46:09.94181-08:00"} diff --git a/internal/storage/sqlite/comments.go b/internal/storage/sqlite/comments.go new file mode 100644 index 00000000..411ca658 --- /dev/null +++ b/internal/storage/sqlite/comments.go @@ -0,0 +1,83 @@ +package sqlite + +import ( + "context" + "fmt" + + "github.com/steveyegge/beads/internal/types" +) + +// AddIssueComment adds a comment to an issue +func (s *SQLiteStorage) AddIssueComment(ctx context.Context, issueID, author, text string) (*types.Comment, error) { + // Verify issue exists + var exists bool + err := s.db.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM issues WHERE id = ?)`, issueID).Scan(&exists) + if err != nil { + return nil, fmt.Errorf("failed to check issue existence: %w", err) + } + if !exists { + return nil, fmt.Errorf("issue %s not found", issueID) + } + + // Insert comment + result, err := s.db.ExecContext(ctx, ` + INSERT INTO comments (issue_id, author, text, created_at) + VALUES (?, ?, ?, CURRENT_TIMESTAMP) + `, issueID, author, text) + if err != nil { + return nil, fmt.Errorf("failed to insert comment: %w", err) + } + + // Get the inserted comment ID + commentID, err := result.LastInsertId() + if err != nil { + return nil, fmt.Errorf("failed to get comment ID: %w", err) + } + + // Fetch the complete comment + comment := &types.Comment{} + err = s.db.QueryRowContext(ctx, ` + SELECT id, issue_id, author, text, created_at + FROM comments WHERE id = ? + `, commentID).Scan(&comment.ID, &comment.IssueID, &comment.Author, &comment.Text, &comment.CreatedAt) + if err != nil { + return nil, fmt.Errorf("failed to fetch comment: %w", err) + } + + // Mark issue as dirty for JSONL export + if err := s.MarkIssueDirty(ctx, issueID); err != nil { + return nil, fmt.Errorf("failed to mark issue dirty: %w", err) + } + + return comment, nil +} + +// GetIssueComments retrieves all comments for an issue +func (s *SQLiteStorage) GetIssueComments(ctx context.Context, issueID string) ([]*types.Comment, error) { + rows, err := s.db.QueryContext(ctx, ` + SELECT id, issue_id, author, text, created_at + FROM comments + WHERE issue_id = ? + ORDER BY created_at ASC + `, issueID) + if err != nil { + return nil, fmt.Errorf("failed to query comments: %w", err) + } + defer func() { _ = rows.Close() }() + + var comments []*types.Comment + for rows.Next() { + comment := &types.Comment{} + err := rows.Scan(&comment.ID, &comment.IssueID, &comment.Author, &comment.Text, &comment.CreatedAt) + if err != nil { + return nil, fmt.Errorf("failed to scan comment: %w", err) + } + comments = append(comments, comment) + } + + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("error iterating comments: %w", err) + } + + return comments, nil +} diff --git a/internal/storage/sqlite/config.go b/internal/storage/sqlite/config.go new file mode 100644 index 00000000..2e245f9c --- /dev/null +++ b/internal/storage/sqlite/config.go @@ -0,0 +1,95 @@ +package sqlite + +import ( + "context" + "database/sql" +) + +// SetConfig sets a configuration value +func (s *SQLiteStorage) SetConfig(ctx context.Context, key, value string) error { + _, err := s.db.ExecContext(ctx, ` + INSERT INTO config (key, value) VALUES (?, ?) + ON CONFLICT (key) DO UPDATE SET value = excluded.value + `, key, value) + return err +} + +// GetConfig gets a configuration value +func (s *SQLiteStorage) GetConfig(ctx context.Context, key string) (string, error) { + var value string + err := s.db.QueryRowContext(ctx, `SELECT value FROM config WHERE key = ?`, key).Scan(&value) + if err == sql.ErrNoRows { + return "", nil + } + return value, err +} + +// GetAllConfig gets all configuration key-value pairs +func (s *SQLiteStorage) GetAllConfig(ctx context.Context) (map[string]string, error) { + rows, err := s.db.QueryContext(ctx, `SELECT key, value FROM config ORDER BY key`) + if err != nil { + return nil, err + } + defer func() { _ = rows.Close() }() + + config := make(map[string]string) + for rows.Next() { + var key, value string + if err := rows.Scan(&key, &value); err != nil { + return nil, err + } + config[key] = value + } + return config, rows.Err() +} + +// DeleteConfig deletes a configuration value +func (s *SQLiteStorage) DeleteConfig(ctx context.Context, key string) error { + _, err := s.db.ExecContext(ctx, `DELETE FROM config WHERE key = ?`, key) + return err +} + +// OrphanHandling defines how to handle orphan issues during import +type OrphanHandling string + +const ( + OrphanStrict OrphanHandling = "strict" // Reject imports with orphans + OrphanResurrect OrphanHandling = "resurrect" // Auto-resurrect parents from JSONL + OrphanSkip OrphanHandling = "skip" // Skip orphans silently + OrphanAllow OrphanHandling = "allow" // Allow orphans (default) +) + +// GetOrphanHandling gets the import.orphan_handling config value +// Returns OrphanAllow (the default) if not set or if value is invalid +func (s *SQLiteStorage) GetOrphanHandling(ctx context.Context) OrphanHandling { + value, err := s.GetConfig(ctx, "import.orphan_handling") + if err != nil || value == "" { + return OrphanAllow // Default + } + + switch OrphanHandling(value) { + case OrphanStrict, OrphanResurrect, OrphanSkip, OrphanAllow: + return OrphanHandling(value) + default: + return OrphanAllow // Invalid value, use default + } +} + +// SetMetadata sets a metadata value (for internal state like import hashes) +func (s *SQLiteStorage) SetMetadata(ctx context.Context, key, value string) error { + _, err := s.db.ExecContext(ctx, ` + INSERT INTO metadata (key, value) VALUES (?, ?) + ON CONFLICT (key) DO UPDATE SET value = excluded.value + `, key, value) + return err +} + +// GetMetadata gets a metadata value (for internal state like import hashes) +func (s *SQLiteStorage) GetMetadata(ctx context.Context, key string) (string, error) { + var value string + err := s.db.QueryRowContext(ctx, `SELECT value FROM metadata WHERE key = ?`, key).Scan(&value) + if err == sql.ErrNoRows { + return "", nil + } + return value, err +} diff --git a/internal/storage/sqlite/ids.go b/internal/storage/sqlite/ids.go index a0eedf43..943a220c 100644 --- a/internal/storage/sqlite/ids.go +++ b/internal/storage/sqlite/ids.go @@ -183,16 +183,6 @@ func tryResurrectParent(parentID string, issues []*types.Issue) bool { return false // Parent not in this batch } -// OrphanHandling defines how to handle missing parent issues during import -type OrphanHandling string - -const ( - OrphanStrict OrphanHandling = "strict" // Fail import on missing parent - OrphanResurrect OrphanHandling = "resurrect" // Auto-resurrect from batch - OrphanSkip OrphanHandling = "skip" // Skip orphaned issues - OrphanAllow OrphanHandling = "allow" // Allow orphans (default) -) - // EnsureIDs generates or validates IDs for issues // For issues with empty IDs, generates unique hash-based IDs // For issues with existing IDs, validates they match the prefix and parent exists (if hierarchical) diff --git a/internal/storage/sqlite/queries.go b/internal/storage/sqlite/queries.go new file mode 100644 index 00000000..67153f00 --- /dev/null +++ b/internal/storage/sqlite/queries.go @@ -0,0 +1,1173 @@ +package sqlite + +import ( + "context" + "database/sql" + "encoding/json" + "fmt" + "strings" + "time" + + "github.com/steveyegge/beads/internal/types" +) + +// REMOVED (bd-8e05): getNextIDForPrefix and AllocateNextID - sequential ID generation +// no longer needed with hash-based IDs +// Migration functions moved to migrations.go (bd-fc2d, bd-b245) + +// getNextChildNumber atomically generates the next child number for a parent ID +// Uses the child_counters table for atomic, cross-process child ID generation +// Hash ID generation functions moved to hash_ids.go (bd-90a5) + +// REMOVED (bd-c7af): SyncAllCounters - no longer needed with hash IDs + +// REMOVED (bd-166): derivePrefixFromPath was causing duplicate issues with wrong prefix +// The database should ALWAYS have issue_prefix config set explicitly (by 'bd init' or auto-import) +// Never derive prefix from filename - it leads to silent data corruption + +// CreateIssue creates a new issue +func (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error { + // Validate issue before creating + if err := issue.Validate(); err != nil { + return fmt.Errorf("validation failed: %w", err) + } + + // Set timestamps + now := time.Now() + issue.CreatedAt = now + issue.UpdatedAt = now + + // Compute content hash (bd-95) + if issue.ContentHash == "" { + issue.ContentHash = issue.ComputeContentHash() + } + + // Acquire a dedicated connection for the transaction. + // This is necessary because we need to execute raw SQL ("BEGIN IMMEDIATE", "COMMIT") + // on the same connection, and database/sql's connection pool would otherwise + // use different connections for different queries. + conn, err := s.db.Conn(ctx) + if err != nil { + return fmt.Errorf("failed to acquire connection: %w", err) + } + defer func() { _ = conn.Close() }() + + // Start IMMEDIATE transaction to acquire write lock early and prevent race conditions. + // IMMEDIATE acquires a RESERVED lock immediately, preventing other IMMEDIATE or EXCLUSIVE + // transactions from starting. This serializes ID generation across concurrent writers. + // + // We use raw Exec instead of BeginTx because database/sql doesn't support transaction + // modes in BeginTx, and modernc.org/sqlite's BeginTx always uses DEFERRED mode. + if _, err := conn.ExecContext(ctx, "BEGIN IMMEDIATE"); err != nil { + return fmt.Errorf("failed to begin immediate transaction: %w", err) + } + + // Track commit state for defer cleanup + // Use context.Background() for ROLLBACK to ensure cleanup happens even if ctx is canceled + committed := false + defer func() { + if !committed { + _, _ = conn.ExecContext(context.Background(), "ROLLBACK") + } + }() + + // Get prefix from config (needed for both ID generation and validation) + var prefix string + err = conn.QueryRowContext(ctx, `SELECT value FROM config WHERE key = ?`, "issue_prefix").Scan(&prefix) + if err == sql.ErrNoRows || prefix == "" { + // CRITICAL: Reject operation if issue_prefix config is missing (bd-166) + // This prevents duplicate issues with wrong prefix + return fmt.Errorf("database not initialized: issue_prefix config is missing (run 'bd init --prefix ' first)") + } else if err != nil { + return fmt.Errorf("failed to get config: %w", err) + } + + // Generate or validate ID + if issue.ID == "" { + // Generate hash-based ID with adaptive length based on database size (bd-ea2a13) + generatedID, err := GenerateIssueID(ctx, conn, prefix, issue, actor) + if err != nil { + return err + } + issue.ID = generatedID + } else { + // Validate that explicitly provided ID matches the configured prefix (bd-177) + if err := ValidateIssueIDPrefix(issue.ID, prefix); err != nil { + return err + } + + // For hierarchical IDs (bd-a3f8e9.1), ensure parent exists + if strings.Contains(issue.ID, ".") { + // Try to resurrect entire parent chain if any parents are missing + // Use the conn-based version to participate in the same transaction + resurrected, err := s.tryResurrectParentChainWithConn(ctx, conn, issue.ID) + if err != nil { + return fmt.Errorf("failed to resurrect parent chain for %s: %w", issue.ID, err) + } + if !resurrected { + // Parent(s) not found in JSONL history - cannot proceed + lastDot := strings.LastIndex(issue.ID, ".") + parentID := issue.ID[:lastDot] + return fmt.Errorf("parent issue %s does not exist and could not be resurrected from JSONL history", parentID) + } + } + } + + // Insert issue + if err := insertIssue(ctx, conn, issue); err != nil { + return err + } + + // Record creation event + if err := recordCreatedEvent(ctx, conn, issue, actor); err != nil { + return err + } + + // Mark issue as dirty for incremental export + if err := markDirty(ctx, conn, issue.ID); err != nil { + return err + } + + // Commit the transaction + if _, err := conn.ExecContext(ctx, "COMMIT"); err != nil { + return fmt.Errorf("failed to commit transaction: %w", err) + } + committed = true + return nil +} + +// validateBatchIssues validates all issues in a batch and sets timestamps +// Batch operation functions moved to batch_ops.go (bd-c796) + +// GetIssue retrieves an issue by ID +func (s *SQLiteStorage) GetIssue(ctx context.Context, id string) (*types.Issue, error) { + var issue types.Issue + var closedAt sql.NullTime + var estimatedMinutes sql.NullInt64 + var assignee sql.NullString + var externalRef sql.NullString + var compactedAt sql.NullTime + var originalSize sql.NullInt64 + var sourceRepo sql.NullString + + var contentHash sql.NullString + var compactedAtCommit sql.NullString + err := s.db.QueryRowContext(ctx, ` + SELECT id, content_hash, title, description, design, acceptance_criteria, notes, + status, priority, issue_type, assignee, estimated_minutes, + created_at, updated_at, closed_at, external_ref, + compaction_level, compacted_at, compacted_at_commit, original_size, source_repo + FROM issues + WHERE id = ? + `, id).Scan( + &issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Design, + &issue.AcceptanceCriteria, &issue.Notes, &issue.Status, + &issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes, + &issue.CreatedAt, &issue.UpdatedAt, &closedAt, &externalRef, + &issue.CompactionLevel, &compactedAt, &compactedAtCommit, &originalSize, &sourceRepo, + ) + + if err == sql.ErrNoRows { + return nil, nil + } + if err != nil { + return nil, fmt.Errorf("failed to get issue: %w", err) + } + + if contentHash.Valid { + issue.ContentHash = contentHash.String + } + if closedAt.Valid { + issue.ClosedAt = &closedAt.Time + } + if estimatedMinutes.Valid { + mins := int(estimatedMinutes.Int64) + issue.EstimatedMinutes = &mins + } + if assignee.Valid { + issue.Assignee = assignee.String + } + if externalRef.Valid { + issue.ExternalRef = &externalRef.String + } + if compactedAt.Valid { + issue.CompactedAt = &compactedAt.Time + } + if compactedAtCommit.Valid { + issue.CompactedAtCommit = &compactedAtCommit.String + } + if originalSize.Valid { + issue.OriginalSize = int(originalSize.Int64) + } + if sourceRepo.Valid { + issue.SourceRepo = sourceRepo.String + } + + // Fetch labels for this issue + labels, err := s.GetLabels(ctx, issue.ID) + if err != nil { + return nil, fmt.Errorf("failed to get labels: %w", err) + } + issue.Labels = labels + + return &issue, nil +} + +// GetIssueByExternalRef retrieves an issue by external reference +func (s *SQLiteStorage) GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error) { + var issue types.Issue + var closedAt sql.NullTime + var estimatedMinutes sql.NullInt64 + var assignee sql.NullString + var externalRefCol sql.NullString + var compactedAt sql.NullTime + var originalSize sql.NullInt64 + var contentHash sql.NullString + var compactedAtCommit sql.NullString + + err := s.db.QueryRowContext(ctx, ` + SELECT id, content_hash, title, description, design, acceptance_criteria, notes, + status, priority, issue_type, assignee, estimated_minutes, + created_at, updated_at, closed_at, external_ref, + compaction_level, compacted_at, compacted_at_commit, original_size + FROM issues + WHERE external_ref = ? + `, externalRef).Scan( + &issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Design, + &issue.AcceptanceCriteria, &issue.Notes, &issue.Status, + &issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes, + &issue.CreatedAt, &issue.UpdatedAt, &closedAt, &externalRefCol, + &issue.CompactionLevel, &compactedAt, &compactedAtCommit, &originalSize, + ) + + if err == sql.ErrNoRows { + return nil, nil + } + if err != nil { + return nil, fmt.Errorf("failed to get issue by external_ref: %w", err) + } + + if contentHash.Valid { + issue.ContentHash = contentHash.String + } + if closedAt.Valid { + issue.ClosedAt = &closedAt.Time + } + if estimatedMinutes.Valid { + mins := int(estimatedMinutes.Int64) + issue.EstimatedMinutes = &mins + } + if assignee.Valid { + issue.Assignee = assignee.String + } + if externalRefCol.Valid { + issue.ExternalRef = &externalRefCol.String + } + if compactedAt.Valid { + issue.CompactedAt = &compactedAt.Time + } + if compactedAtCommit.Valid { + issue.CompactedAtCommit = &compactedAtCommit.String + } + if originalSize.Valid { + issue.OriginalSize = int(originalSize.Int64) + } + + // Fetch labels for this issue + labels, err := s.GetLabels(ctx, issue.ID) + if err != nil { + return nil, fmt.Errorf("failed to get labels: %w", err) + } + issue.Labels = labels + + return &issue, nil +} + +// Allowed fields for update to prevent SQL injection +var allowedUpdateFields = map[string]bool{ + "status": true, + "priority": true, + "title": true, + "assignee": true, + "description": true, + "design": true, + "acceptance_criteria": true, + "notes": true, + "issue_type": true, + "estimated_minutes": true, + "external_ref": true, + "closed_at": true, +} + +// validatePriority validates a priority value +// Validation functions moved to validators.go (bd-d9e0) + +// determineEventType determines the event type for an update based on old and new status +func determineEventType(oldIssue *types.Issue, updates map[string]interface{}) types.EventType { + statusVal, hasStatus := updates["status"] + if !hasStatus { + return types.EventUpdated + } + + newStatus, ok := statusVal.(string) + if !ok { + return types.EventUpdated + } + + if newStatus == string(types.StatusClosed) { + return types.EventClosed + } + if oldIssue.Status == types.StatusClosed { + return types.EventReopened + } + return types.EventStatusChanged +} + +// manageClosedAt automatically manages the closed_at field based on status changes +func manageClosedAt(oldIssue *types.Issue, updates map[string]interface{}, setClauses []string, args []interface{}) ([]string, []interface{}) { + statusVal, hasStatus := updates["status"] + + // If closed_at is explicitly provided in updates, it's already in setClauses/args + // and we should not override it (important for import operations that preserve timestamps) + _, hasExplicitClosedAt := updates["closed_at"] + if hasExplicitClosedAt { + return setClauses, args + } + + if !hasStatus { + return setClauses, args + } + + // Handle both string and types.Status + var newStatus string + switch v := statusVal.(type) { + case string: + newStatus = v + case types.Status: + newStatus = string(v) + default: + return setClauses, args + } + + if newStatus == string(types.StatusClosed) { + // Changing to closed: ensure closed_at is set + now := time.Now() + updates["closed_at"] = now + setClauses = append(setClauses, "closed_at = ?") + args = append(args, now) + } else if oldIssue.Status == types.StatusClosed { + // Changing from closed to something else: clear closed_at + updates["closed_at"] = nil + setClauses = append(setClauses, "closed_at = ?") + args = append(args, nil) + } + + return setClauses, args +} + +// UpdateIssue updates fields on an issue +func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error { + // Get old issue for event + oldIssue, err := s.GetIssue(ctx, id) + if err != nil { + return err + } + if oldIssue == nil { + return fmt.Errorf("issue %s not found", id) + } + + // Build update query with validated field names + setClauses := []string{"updated_at = ?"} + args := []interface{}{time.Now()} + + for key, value := range updates { + // Prevent SQL injection by validating field names + if !allowedUpdateFields[key] { + return fmt.Errorf("invalid field for update: %s", key) + } + + // Validate field values + if err := validateFieldUpdate(key, value); err != nil { + return err + } + + setClauses = append(setClauses, fmt.Sprintf("%s = ?", key)) + args = append(args, value) + } + + // Auto-manage closed_at when status changes (enforce invariant) + setClauses, args = manageClosedAt(oldIssue, updates, setClauses, args) + + // Recompute content_hash if any content fields changed (bd-95) + contentChanged := false + contentFields := []string{"title", "description", "design", "acceptance_criteria", "notes", "status", "priority", "issue_type", "assignee", "external_ref"} + for _, field := range contentFields { + if _, exists := updates[field]; exists { + contentChanged = true + break + } + } + if contentChanged { + // Get updated issue to compute hash + updatedIssue := *oldIssue + for key, value := range updates { + switch key { + case "title": + updatedIssue.Title = value.(string) + case "description": + updatedIssue.Description = value.(string) + case "design": + updatedIssue.Design = value.(string) + case "acceptance_criteria": + updatedIssue.AcceptanceCriteria = value.(string) + case "notes": + updatedIssue.Notes = value.(string) + case "status": + // Handle both string and types.Status + if s, ok := value.(types.Status); ok { + updatedIssue.Status = s + } else { + updatedIssue.Status = types.Status(value.(string)) + } + case "priority": + updatedIssue.Priority = value.(int) + case "issue_type": + // Handle both string and types.IssueType + if t, ok := value.(types.IssueType); ok { + updatedIssue.IssueType = t + } else { + updatedIssue.IssueType = types.IssueType(value.(string)) + } + case "assignee": + if value == nil { + updatedIssue.Assignee = "" + } else { + updatedIssue.Assignee = value.(string) + } + case "external_ref": + if value == nil { + updatedIssue.ExternalRef = nil + } else { + // Handle both string and *string + switch v := value.(type) { + case string: + updatedIssue.ExternalRef = &v + case *string: + updatedIssue.ExternalRef = v + default: + return fmt.Errorf("external_ref must be string or *string, got %T", value) + } + } + } + } + newHash := updatedIssue.ComputeContentHash() + setClauses = append(setClauses, "content_hash = ?") + args = append(args, newHash) + } + + args = append(args, id) + + // Start transaction + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + defer func() { _ = tx.Rollback() }() + + // Update issue + query := fmt.Sprintf("UPDATE issues SET %s WHERE id = ?", strings.Join(setClauses, ", ")) // #nosec G201 - safe SQL with controlled column names + _, err = tx.ExecContext(ctx, query, args...) + if err != nil { + return fmt.Errorf("failed to update issue: %w", err) + } + + // Record event + oldData, err := json.Marshal(oldIssue) + if err != nil { + // Fall back to minimal description if marshaling fails + oldData = []byte(fmt.Sprintf(`{"id":"%s"}`, id)) + } + newData, err := json.Marshal(updates) + if err != nil { + // Fall back to minimal description if marshaling fails + newData = []byte(`{}`) + } + oldDataStr := string(oldData) + newDataStr := string(newData) + + eventType := determineEventType(oldIssue, updates) + + _, err = tx.ExecContext(ctx, ` + INSERT INTO events (issue_id, event_type, actor, old_value, new_value) + VALUES (?, ?, ?, ?, ?) + `, id, eventType, actor, oldDataStr, newDataStr) + if err != nil { + return fmt.Errorf("failed to record event: %w", err) + } + + // Mark issue as dirty for incremental export + _, err = tx.ExecContext(ctx, ` + INSERT INTO dirty_issues (issue_id, marked_at) + VALUES (?, ?) + ON CONFLICT (issue_id) DO UPDATE SET marked_at = excluded.marked_at + `, id, time.Now()) + if err != nil { + return fmt.Errorf("failed to mark issue dirty: %w", err) + } + + // Invalidate blocked issues cache if status changed (bd-5qim) + // Status changes affect which issues are blocked (blockers must be open/in_progress/blocked) + if _, statusChanged := updates["status"]; statusChanged { + if err := s.invalidateBlockedCache(ctx, tx); err != nil { + return fmt.Errorf("failed to invalidate blocked cache: %w", err) + } + } + + return tx.Commit() +} + +// UpdateIssueID updates an issue ID and all its text fields in a single transaction +func (s *SQLiteStorage) UpdateIssueID(ctx context.Context, oldID, newID string, issue *types.Issue, actor string) error { + // Get exclusive connection to ensure PRAGMA applies + conn, err := s.db.Conn(ctx) + if err != nil { + return fmt.Errorf("failed to get connection: %w", err) + } + defer func() { _ = conn.Close() }() + + // Disable foreign keys on this specific connection + _, err = conn.ExecContext(ctx, `PRAGMA foreign_keys = OFF`) + if err != nil { + return fmt.Errorf("failed to disable foreign keys: %w", err) + } + + tx, err := conn.BeginTx(ctx, nil) + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + defer func() { _ = tx.Rollback() }() + + result, err := tx.ExecContext(ctx, ` + UPDATE issues + SET id = ?, title = ?, description = ?, design = ?, acceptance_criteria = ?, notes = ?, updated_at = ? + WHERE id = ? + `, newID, issue.Title, issue.Description, issue.Design, issue.AcceptanceCriteria, issue.Notes, time.Now(), oldID) + if err != nil { + return fmt.Errorf("failed to update issue ID: %w", err) + } + + rows, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to get rows affected: %w", err) + } + if rows == 0 { + return fmt.Errorf("issue not found: %s", oldID) + } + + _, err = tx.ExecContext(ctx, `UPDATE dependencies SET issue_id = ? WHERE issue_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update issue_id in dependencies: %w", err) + } + + _, err = tx.ExecContext(ctx, `UPDATE dependencies SET depends_on_id = ? WHERE depends_on_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update depends_on_id in dependencies: %w", err) + } + + _, err = tx.ExecContext(ctx, `UPDATE events SET issue_id = ? WHERE issue_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update events: %w", err) + } + + _, err = tx.ExecContext(ctx, `UPDATE labels SET issue_id = ? WHERE issue_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update labels: %w", err) + } + + _, err = tx.ExecContext(ctx, `UPDATE comments SET issue_id = ? WHERE issue_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update comments: %w", err) + } + + _, err = tx.ExecContext(ctx, ` + UPDATE dirty_issues SET issue_id = ? WHERE issue_id = ? + `, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update dirty_issues: %w", err) + } + + _, err = tx.ExecContext(ctx, `UPDATE issue_snapshots SET issue_id = ? WHERE issue_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update issue_snapshots: %w", err) + } + + _, err = tx.ExecContext(ctx, `UPDATE compaction_snapshots SET issue_id = ? WHERE issue_id = ?`, newID, oldID) + if err != nil { + return fmt.Errorf("failed to update compaction_snapshots: %w", err) + } + + _, err = tx.ExecContext(ctx, ` + INSERT INTO dirty_issues (issue_id, marked_at) + VALUES (?, ?) + ON CONFLICT (issue_id) DO UPDATE SET marked_at = excluded.marked_at + `, newID, time.Now()) + if err != nil { + return fmt.Errorf("failed to mark issue dirty: %w", err) + } + + _, err = tx.ExecContext(ctx, ` + INSERT INTO events (issue_id, event_type, actor, old_value, new_value) + VALUES (?, 'renamed', ?, ?, ?) + `, newID, actor, oldID, newID) + if err != nil { + return fmt.Errorf("failed to record rename event: %w", err) + } + + return tx.Commit() +} + +// RenameDependencyPrefix updates the prefix in all dependency records +func (s *SQLiteStorage) RenameDependencyPrefix(ctx context.Context, oldPrefix, newPrefix string) error { + return nil +} + +// RenameCounterPrefix is a no-op with hash-based IDs (bd-8e05) +// Kept for backward compatibility with rename-prefix command +func (s *SQLiteStorage) RenameCounterPrefix(ctx context.Context, oldPrefix, newPrefix string) error { + // Hash-based IDs don't use counters, so nothing to update + return nil +} + +// ResetCounter is a no-op with hash-based IDs (bd-8e05) +// Kept for backward compatibility +func (s *SQLiteStorage) ResetCounter(ctx context.Context, prefix string) error { + // Hash-based IDs don't use counters, so nothing to reset + return nil +} + +// CloseIssue closes an issue with a reason +func (s *SQLiteStorage) CloseIssue(ctx context.Context, id string, reason string, actor string) error { + now := time.Now() + + // Update with special event handling + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + defer func() { _ = tx.Rollback() }() + + result, err := tx.ExecContext(ctx, ` + UPDATE issues SET status = ?, closed_at = ?, updated_at = ? + WHERE id = ? + `, types.StatusClosed, now, now, id) + if err != nil { + return fmt.Errorf("failed to close issue: %w", err) + } + + rows, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to get rows affected: %w", err) + } + if rows == 0 { + return fmt.Errorf("issue not found: %s", id) + } + + _, err = tx.ExecContext(ctx, ` + INSERT INTO events (issue_id, event_type, actor, comment) + VALUES (?, ?, ?, ?) + `, id, types.EventClosed, actor, reason) + if err != nil { + return fmt.Errorf("failed to record event: %w", err) + } + + // Mark issue as dirty for incremental export + _, err = tx.ExecContext(ctx, ` + INSERT INTO dirty_issues (issue_id, marked_at) + VALUES (?, ?) + ON CONFLICT (issue_id) DO UPDATE SET marked_at = excluded.marked_at + `, id, time.Now()) + if err != nil { + return fmt.Errorf("failed to mark issue dirty: %w", err) + } + + // Invalidate blocked issues cache since status changed to closed (bd-5qim) + // Closed issues don't block others, so this affects blocking calculations + if err := s.invalidateBlockedCache(ctx, tx); err != nil { + return fmt.Errorf("failed to invalidate blocked cache: %w", err) + } + + return tx.Commit() +} + +// DeleteIssue permanently removes an issue from the database +func (s *SQLiteStorage) DeleteIssue(ctx context.Context, id string) error { + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + defer func() { _ = tx.Rollback() }() + + // Delete dependencies (both directions) + _, err = tx.ExecContext(ctx, `DELETE FROM dependencies WHERE issue_id = ? OR depends_on_id = ?`, id, id) + if err != nil { + return fmt.Errorf("failed to delete dependencies: %w", err) + } + + // Delete events + _, err = tx.ExecContext(ctx, `DELETE FROM events WHERE issue_id = ?`, id) + if err != nil { + return fmt.Errorf("failed to delete events: %w", err) + } + + // Delete from dirty_issues + _, err = tx.ExecContext(ctx, `DELETE FROM dirty_issues WHERE issue_id = ?`, id) + if err != nil { + return fmt.Errorf("failed to delete dirty marker: %w", err) + } + + // Delete the issue itself + result, err := tx.ExecContext(ctx, `DELETE FROM issues WHERE id = ?`, id) + if err != nil { + return fmt.Errorf("failed to delete issue: %w", err) + } + + rowsAffected, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to check rows affected: %w", err) + } + if rowsAffected == 0 { + return fmt.Errorf("issue not found: %s", id) + } + + if err := tx.Commit(); err != nil { + return err + } + + // REMOVED (bd-c7af): Counter sync after deletion - no longer needed with hash IDs + return nil +} + +// DeleteIssuesResult contains statistics about a batch deletion operation +type DeleteIssuesResult struct { + DeletedCount int + DependenciesCount int + LabelsCount int + EventsCount int + OrphanedIssues []string +} + +// DeleteIssues deletes multiple issues in a single transaction +// If cascade is true, recursively deletes dependents +// If cascade is false but force is true, deletes issues and orphans their dependents +// If cascade and force are both false, returns an error if any issue has dependents +// If dryRun is true, only computes statistics without deleting +func (s *SQLiteStorage) DeleteIssues(ctx context.Context, ids []string, cascade bool, force bool, dryRun bool) (*DeleteIssuesResult, error) { + if len(ids) == 0 { + return &DeleteIssuesResult{}, nil + } + + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return nil, fmt.Errorf("failed to begin transaction: %w", err) + } + defer func() { _ = tx.Rollback() }() + + idSet := buildIDSet(ids) + result := &DeleteIssuesResult{} + + expandedIDs, err := s.resolveDeleteSet(ctx, tx, ids, idSet, cascade, force, result) + if err != nil { + return nil, err + } + + inClause, args := buildSQLInClause(expandedIDs) + if err := s.populateDeleteStats(ctx, tx, inClause, args, result); err != nil { + return nil, err + } + + if dryRun { + return result, nil + } + + if err := s.executeDelete(ctx, tx, inClause, args, result); err != nil { + return nil, err + } + + if err := tx.Commit(); err != nil { + return nil, fmt.Errorf("failed to commit transaction: %w", err) + } + + // REMOVED (bd-c7af): Counter sync after deletion - no longer needed with hash IDs + + return result, nil +} + +func buildIDSet(ids []string) map[string]bool { + idSet := make(map[string]bool, len(ids)) + for _, id := range ids { + idSet[id] = true + } + return idSet +} + +func (s *SQLiteStorage) resolveDeleteSet(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool, cascade bool, force bool, result *DeleteIssuesResult) ([]string, error) { + if cascade { + return s.expandWithDependents(ctx, tx, ids, idSet) + } + if !force { + return ids, s.validateNoDependents(ctx, tx, ids, idSet, result) + } + return ids, s.trackOrphanedIssues(ctx, tx, ids, idSet, result) +} + +func (s *SQLiteStorage) expandWithDependents(ctx context.Context, tx *sql.Tx, ids []string, _ map[string]bool) ([]string, error) { + allToDelete, err := s.findAllDependentsRecursive(ctx, tx, ids) + if err != nil { + return nil, fmt.Errorf("failed to find dependents: %w", err) + } + expandedIDs := make([]string, 0, len(allToDelete)) + for id := range allToDelete { + expandedIDs = append(expandedIDs, id) + } + return expandedIDs, nil +} + +func (s *SQLiteStorage) validateNoDependents(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool, result *DeleteIssuesResult) error { + for _, id := range ids { + if err := s.checkSingleIssueValidation(ctx, tx, id, idSet, result); err != nil { + return err + } + } + return nil +} + +func (s *SQLiteStorage) checkSingleIssueValidation(ctx context.Context, tx *sql.Tx, id string, idSet map[string]bool, result *DeleteIssuesResult) error { + var depCount int + err := tx.QueryRowContext(ctx, + `SELECT COUNT(*) FROM dependencies WHERE depends_on_id = ?`, id).Scan(&depCount) + if err != nil { + return fmt.Errorf("failed to check dependents for %s: %w", id, err) + } + if depCount == 0 { + return nil + } + + rows, err := tx.QueryContext(ctx, + `SELECT issue_id FROM dependencies WHERE depends_on_id = ?`, id) + if err != nil { + return fmt.Errorf("failed to get dependents for %s: %w", id, err) + } + defer func() { _ = rows.Close() }() + + hasExternal := false + for rows.Next() { + var depID string + if err := rows.Scan(&depID); err != nil { + return fmt.Errorf("failed to scan dependent: %w", err) + } + if !idSet[depID] { + hasExternal = true + result.OrphanedIssues = append(result.OrphanedIssues, depID) + } + } + + if err := rows.Err(); err != nil { + return fmt.Errorf("failed to iterate dependents for %s: %w", id, err) + } + + if hasExternal { + return fmt.Errorf("issue %s has dependents not in deletion set; use --cascade to delete them or --force to orphan them", id) + } + return nil +} + +func (s *SQLiteStorage) trackOrphanedIssues(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool, result *DeleteIssuesResult) error { + orphanSet := make(map[string]bool) + for _, id := range ids { + if err := s.collectOrphansForID(ctx, tx, id, idSet, orphanSet); err != nil { + return err + } + } + for orphanID := range orphanSet { + result.OrphanedIssues = append(result.OrphanedIssues, orphanID) + } + return nil +} + +func (s *SQLiteStorage) collectOrphansForID(ctx context.Context, tx *sql.Tx, id string, idSet map[string]bool, orphanSet map[string]bool) error { + rows, err := tx.QueryContext(ctx, + `SELECT issue_id FROM dependencies WHERE depends_on_id = ?`, id) + if err != nil { + return fmt.Errorf("failed to get dependents for %s: %w", id, err) + } + defer func() { _ = rows.Close() }() + + for rows.Next() { + var depID string + if err := rows.Scan(&depID); err != nil { + return fmt.Errorf("failed to scan dependent: %w", err) + } + if !idSet[depID] { + orphanSet[depID] = true + } + } + return rows.Err() +} + +func buildSQLInClause(ids []string) (string, []interface{}) { + placeholders := make([]string, len(ids)) + args := make([]interface{}, len(ids)) + for i, id := range ids { + placeholders[i] = "?" + args[i] = id + } + return strings.Join(placeholders, ","), args +} + +func (s *SQLiteStorage) populateDeleteStats(ctx context.Context, tx *sql.Tx, inClause string, args []interface{}, result *DeleteIssuesResult) error { + counts := []struct { + query string + dest *int + }{ + {fmt.Sprintf(`SELECT COUNT(*) FROM dependencies WHERE issue_id IN (%s) OR depends_on_id IN (%s)`, inClause, inClause), &result.DependenciesCount}, + {fmt.Sprintf(`SELECT COUNT(*) FROM labels WHERE issue_id IN (%s)`, inClause), &result.LabelsCount}, + {fmt.Sprintf(`SELECT COUNT(*) FROM events WHERE issue_id IN (%s)`, inClause), &result.EventsCount}, + } + + for _, c := range counts { + queryArgs := args + if c.dest == &result.DependenciesCount { + queryArgs = append(args, args...) + } + if err := tx.QueryRowContext(ctx, c.query, queryArgs...).Scan(c.dest); err != nil { + return fmt.Errorf("failed to count: %w", err) + } + } + + result.DeletedCount = len(args) + return nil +} + +func (s *SQLiteStorage) executeDelete(ctx context.Context, tx *sql.Tx, inClause string, args []interface{}, result *DeleteIssuesResult) error { + deletes := []struct { + query string + args []interface{} + }{ + {fmt.Sprintf(`DELETE FROM dependencies WHERE issue_id IN (%s) OR depends_on_id IN (%s)`, inClause, inClause), append(args, args...)}, + {fmt.Sprintf(`DELETE FROM labels WHERE issue_id IN (%s)`, inClause), args}, + {fmt.Sprintf(`DELETE FROM events WHERE issue_id IN (%s)`, inClause), args}, + {fmt.Sprintf(`DELETE FROM dirty_issues WHERE issue_id IN (%s)`, inClause), args}, + {fmt.Sprintf(`DELETE FROM issues WHERE id IN (%s)`, inClause), args}, + } + + for i, d := range deletes { + execResult, err := tx.ExecContext(ctx, d.query, d.args...) + if err != nil { + return fmt.Errorf("failed to delete: %w", err) + } + if i == len(deletes)-1 { + rowsAffected, err := execResult.RowsAffected() + if err != nil { + return fmt.Errorf("failed to check rows affected: %w", err) + } + result.DeletedCount = int(rowsAffected) + } + } + return nil +} + +// findAllDependentsRecursive finds all issues that depend on the given issues, recursively +func (s *SQLiteStorage) findAllDependentsRecursive(ctx context.Context, tx *sql.Tx, ids []string) (map[string]bool, error) { + result := make(map[string]bool) + for _, id := range ids { + result[id] = true + } + + toProcess := make([]string, len(ids)) + copy(toProcess, ids) + + for len(toProcess) > 0 { + current := toProcess[0] + toProcess = toProcess[1:] + + rows, err := tx.QueryContext(ctx, + `SELECT issue_id FROM dependencies WHERE depends_on_id = ?`, current) + if err != nil { + return nil, err + } + defer rows.Close() + + for rows.Next() { + var depID string + if err := rows.Scan(&depID); err != nil { + return nil, err + } + if !result[depID] { + result[depID] = true + toProcess = append(toProcess, depID) + } + } + if err := rows.Err(); err != nil { + return nil, err + } + } + + return result, nil +} + +// SearchIssues finds issues matching query and filters +func (s *SQLiteStorage) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error) { + whereClauses := []string{} + args := []interface{}{} + + if query != "" { + whereClauses = append(whereClauses, "(title LIKE ? OR description LIKE ? OR id LIKE ?)") + pattern := "%" + query + "%" + args = append(args, pattern, pattern, pattern) + } + + if filter.TitleSearch != "" { + whereClauses = append(whereClauses, "title LIKE ?") + pattern := "%" + filter.TitleSearch + "%" + args = append(args, pattern) + } + + // Pattern matching + if filter.TitleContains != "" { + whereClauses = append(whereClauses, "title LIKE ?") + args = append(args, "%"+filter.TitleContains+"%") + } + if filter.DescriptionContains != "" { + whereClauses = append(whereClauses, "description LIKE ?") + args = append(args, "%"+filter.DescriptionContains+"%") + } + if filter.NotesContains != "" { + whereClauses = append(whereClauses, "notes LIKE ?") + args = append(args, "%"+filter.NotesContains+"%") + } + + if filter.Status != nil { + whereClauses = append(whereClauses, "status = ?") + args = append(args, *filter.Status) + } + + if filter.Priority != nil { + whereClauses = append(whereClauses, "priority = ?") + args = append(args, *filter.Priority) + } + + // Priority ranges + if filter.PriorityMin != nil { + whereClauses = append(whereClauses, "priority >= ?") + args = append(args, *filter.PriorityMin) + } + if filter.PriorityMax != nil { + whereClauses = append(whereClauses, "priority <= ?") + args = append(args, *filter.PriorityMax) + } + + if filter.IssueType != nil { + whereClauses = append(whereClauses, "issue_type = ?") + args = append(args, *filter.IssueType) + } + + if filter.Assignee != nil { + whereClauses = append(whereClauses, "assignee = ?") + args = append(args, *filter.Assignee) + } + + // Date ranges + if filter.CreatedAfter != nil { + whereClauses = append(whereClauses, "created_at > ?") + args = append(args, filter.CreatedAfter.Format(time.RFC3339)) + } + if filter.CreatedBefore != nil { + whereClauses = append(whereClauses, "created_at < ?") + args = append(args, filter.CreatedBefore.Format(time.RFC3339)) + } + if filter.UpdatedAfter != nil { + whereClauses = append(whereClauses, "updated_at > ?") + args = append(args, filter.UpdatedAfter.Format(time.RFC3339)) + } + if filter.UpdatedBefore != nil { + whereClauses = append(whereClauses, "updated_at < ?") + args = append(args, filter.UpdatedBefore.Format(time.RFC3339)) + } + if filter.ClosedAfter != nil { + whereClauses = append(whereClauses, "closed_at > ?") + args = append(args, filter.ClosedAfter.Format(time.RFC3339)) + } + if filter.ClosedBefore != nil { + whereClauses = append(whereClauses, "closed_at < ?") + args = append(args, filter.ClosedBefore.Format(time.RFC3339)) + } + + // Empty/null checks + if filter.EmptyDescription { + whereClauses = append(whereClauses, "(description IS NULL OR description = '')") + } + if filter.NoAssignee { + whereClauses = append(whereClauses, "(assignee IS NULL OR assignee = '')") + } + if filter.NoLabels { + whereClauses = append(whereClauses, "id NOT IN (SELECT DISTINCT issue_id FROM labels)") + } + + // Label filtering: issue must have ALL specified labels + if len(filter.Labels) > 0 { + for _, label := range filter.Labels { + whereClauses = append(whereClauses, "id IN (SELECT issue_id FROM labels WHERE label = ?)") + args = append(args, label) + } + } + + // Label filtering (OR): issue must have AT LEAST ONE of these labels + if len(filter.LabelsAny) > 0 { + placeholders := make([]string, len(filter.LabelsAny)) + for i, label := range filter.LabelsAny { + placeholders[i] = "?" + args = append(args, label) + } + whereClauses = append(whereClauses, fmt.Sprintf("id IN (SELECT issue_id FROM labels WHERE label IN (%s))", strings.Join(placeholders, ", "))) + } + + // ID filtering: match specific issue IDs + if len(filter.IDs) > 0 { + placeholders := make([]string, len(filter.IDs)) + for i, id := range filter.IDs { + placeholders[i] = "?" + args = append(args, id) + } + whereClauses = append(whereClauses, fmt.Sprintf("id IN (%s)", strings.Join(placeholders, ", "))) + } + + whereSQL := "" + if len(whereClauses) > 0 { + whereSQL = "WHERE " + strings.Join(whereClauses, " AND ") + } + + limitSQL := "" + if filter.Limit > 0 { + limitSQL = " LIMIT ?" + args = append(args, filter.Limit) + } + + // #nosec G201 - safe SQL with controlled formatting + querySQL := fmt.Sprintf(` + SELECT id, content_hash, title, description, design, acceptance_criteria, notes, + status, priority, issue_type, assignee, estimated_minutes, + created_at, updated_at, closed_at, external_ref, source_repo + FROM issues + %s + ORDER BY priority ASC, created_at DESC + %s + `, whereSQL, limitSQL) + + rows, err := s.db.QueryContext(ctx, querySQL, args...) + if err != nil { + return nil, fmt.Errorf("failed to search issues: %w", err) + } + defer func() { _ = rows.Close() }() + + return s.scanIssues(ctx, rows) +} diff --git a/internal/storage/sqlite/sqlite.go b/internal/storage/sqlite/sqlite.go index 1c52d00a..9837c65b 100644 --- a/internal/storage/sqlite/sqlite.go +++ b/internal/storage/sqlite/sqlite.go @@ -1,1624 +1,31 @@ // Package sqlite implements the storage interface using SQLite. +// +// This package has been split into focused files for better maintainability: +// +// Core storage components: +// - store.go: SQLiteStorage struct, New() constructor, initialization logic, +// and database utility methods (Close, Path, IsClosed, UnderlyingDB, etc.) +// - queries.go: Issue CRUD operations including CreateIssue, GetIssue, +// UpdateIssue, DeleteIssue, DeleteIssues, SearchIssues +// - config.go: Configuration and metadata management (SetConfig, GetConfig, +// SetMetadata, GetMetadata, OrphanHandling) +// - comments.go: Comment operations (AddIssueComment, GetIssueComments) +// +// Supporting components: +// - schema.go: Database schema definitions +// - migrations.go: Schema migration logic +// - dependencies.go: Dependency management (AddDependency, RemoveDependency, etc.) +// - labels.go: Label operations +// - events.go: Event tracking +// - dirty.go: Dirty issue tracking for incremental exports +// - batch_ops.go: Batch operations for bulk imports +// - hash_ids.go: Hash-based ID generation +// - validators.go: Input validation functions +// - util.go: Utility functions +// +// Historical notes (bd-0a43): +// Prior to this refactoring, sqlite.go was 1050+ lines containing all storage logic. +// The monolithic structure made it difficult to navigate and understand specific +// functionality. This split maintains all existing functionality while improving +// code organization and discoverability. package sqlite - -import ( - "context" - "database/sql" - "encoding/json" - "fmt" - "os" - "path/filepath" - "runtime" - "strings" - "sync/atomic" - "time" - - // Import SQLite driver - sqlite3 "github.com/ncruces/go-sqlite3" - _ "github.com/ncruces/go-sqlite3/driver" - _ "github.com/ncruces/go-sqlite3/embed" - "github.com/steveyegge/beads/internal/types" - "github.com/tetratelabs/wazero" -) - -// SQLiteStorage implements the Storage interface using SQLite -type SQLiteStorage struct { - db *sql.DB - dbPath string - closed atomic.Bool // Tracks whether Close() has been called -} - -// setupWASMCache configures WASM compilation caching to reduce SQLite startup time. -// Returns the cache directory path (empty string if using in-memory cache). -// -// Cache behavior: -// - Location: ~/.cache/beads/wasm/ (platform-specific via os.UserCacheDir) -// - Version management: wazero automatically keys cache by its version -// - Cleanup: Old versions remain harmless (~5-10MB each); manual cleanup if needed -// - Fallback: Uses in-memory cache if filesystem cache creation fails -// -// Performance impact: -// - First run: ~220ms (compile + cache) -// - Subsequent runs: ~20ms (load from cache) -func setupWASMCache() string { - cacheDir := "" - if userCache, err := os.UserCacheDir(); err == nil { - cacheDir = filepath.Join(userCache, "beads", "wasm") - } - - var cache wazero.CompilationCache - if cacheDir != "" { - // Try file-system cache first (persistent across runs) - if c, err := wazero.NewCompilationCacheWithDir(cacheDir); err == nil { - cache = c - // Optional: log cache location for debugging - // fmt.Fprintf(os.Stderr, "WASM cache: %s\n", cacheDir) - } - } - - // Fallback to in-memory cache if dir creation failed - if cache == nil { - cache = wazero.NewCompilationCache() - cacheDir = "" // Indicate in-memory fallback - // Optional: log fallback for debugging - // fmt.Fprintln(os.Stderr, "WASM cache: in-memory only") - } - - // Configure go-sqlite3's wazero runtime to use the cache - sqlite3.RuntimeConfig = wazero.NewRuntimeConfig().WithCompilationCache(cache) - - return cacheDir -} - -func init() { - // Setup WASM compilation cache to avoid 220ms JIT compilation overhead on every process start - _ = setupWASMCache() -} - -// New creates a new SQLite storage backend -func New(ctx context.Context, path string) (*SQLiteStorage, error) { - // Build connection string with proper URI syntax - // For :memory: databases, use shared cache so multiple connections see the same data - var connStr string - if path == ":memory:" { - // Use shared in-memory database with a named identifier - // Note: WAL mode doesn't work with shared in-memory databases, so use DELETE mode - // The name "memdb" is required for cache=shared to work properly across connections - connStr = "file:memdb?mode=memory&cache=shared&_pragma=journal_mode(DELETE)&_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite" - } else if strings.HasPrefix(path, "file:") { - // Already a URI - append our pragmas if not present - connStr = path - if !strings.Contains(path, "_pragma=foreign_keys") { - connStr += "&_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite" - } - } else { - // Ensure directory exists for file-based databases - dir := filepath.Dir(path) - if err := os.MkdirAll(dir, 0o750); err != nil { - return nil, fmt.Errorf("failed to create directory: %w", err) - } - // Use file URI with pragmas - connStr = "file:" + path + "?_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite" - } - - db, err := sql.Open("sqlite3", connStr) - if err != nil { - return nil, fmt.Errorf("failed to open database: %w", err) - } - - // For all in-memory databases (including file::memory:), force single connection. - // SQLite's in-memory databases are isolated per connection by default. - // Without this, different connections in the pool can't see each other's writes (bd-b121, bd-yvlc). - isInMemory := path == ":memory:" || - (strings.HasPrefix(path, "file:") && strings.Contains(path, "mode=memory")) - if isInMemory { - db.SetMaxOpenConns(1) - db.SetMaxIdleConns(1) - } else { - // For file-based databases in daemon mode, limit connection pool to prevent - // connection exhaustion under concurrent load. SQLite WAL mode supports - // 1 writer + unlimited readers, but we limit to prevent goroutine pile-up - // on write lock contention (bd-qhws). - maxConns := runtime.NumCPU() + 1 // 1 writer + N readers - db.SetMaxOpenConns(maxConns) - db.SetMaxIdleConns(2) - db.SetConnMaxLifetime(0) // SQLite doesn't need connection recycling - } - - // For file-based databases, enable WAL mode once after opening the connection. - if !isInMemory { - if _, err := db.Exec("PRAGMA journal_mode=WAL"); err != nil { - return nil, fmt.Errorf("failed to enable WAL mode: %w", err) - } - } - - // Test connection - if err := db.Ping(); err != nil { - return nil, fmt.Errorf("failed to ping database: %w", err) - } - - // Initialize schema - if _, err := db.Exec(schema); err != nil { - return nil, fmt.Errorf("failed to initialize schema: %w", err) - } - - // Run all migrations - if err := RunMigrations(db); err != nil { - return nil, err - } - - // Verify schema compatibility after migrations (bd-ckvw) - // First attempt - if err := verifySchemaCompatibility(db); err != nil { - // Schema probe failed - retry migrations once - if retryErr := RunMigrations(db); retryErr != nil { - return nil, fmt.Errorf("migration retry failed after schema probe failure: %w (original: %v)", retryErr, err) - } - - // Probe again after retry - if err := verifySchemaCompatibility(db); err != nil { - // Still failing - return fatal error with clear message - return nil, fmt.Errorf("schema probe failed after migration retry: %w. Database may be corrupted or from incompatible version. Run 'bd doctor' to diagnose", err) - } - } - - // Convert to absolute path for consistency (but keep :memory: as-is) - absPath := path - if path != ":memory:" { - var err error - absPath, err = filepath.Abs(path) - if err != nil { - return nil, fmt.Errorf("failed to get absolute path: %w", err) - } - } - - storage := &SQLiteStorage{ - db: db, - dbPath: absPath, - } - - // Hydrate from multi-repo config if configured (bd-307) - // Skip for in-memory databases (used in tests) - if path != ":memory:" { - _, err := storage.HydrateFromMultiRepo(ctx) - if err != nil { - return nil, fmt.Errorf("failed to hydrate from multi-repo: %w", err) - } - } - - return storage, nil -} - -// REMOVED (bd-8e05): getNextIDForPrefix and AllocateNextID - sequential ID generation -// no longer needed with hash-based IDs -// Migration functions moved to migrations.go (bd-fc2d, bd-b245) - -// getNextChildNumber atomically generates the next child number for a parent ID -// Uses the child_counters table for atomic, cross-process child ID generation -// Hash ID generation functions moved to hash_ids.go (bd-90a5) - -// REMOVED (bd-c7af): SyncAllCounters - no longer needed with hash IDs - -// REMOVED (bd-166): derivePrefixFromPath was causing duplicate issues with wrong prefix -// The database should ALWAYS have issue_prefix config set explicitly (by 'bd init' or auto-import) -// Never derive prefix from filename - it leads to silent data corruption - -// CreateIssue creates a new issue -func (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error { - // Validate issue before creating - if err := issue.Validate(); err != nil { - return fmt.Errorf("validation failed: %w", err) - } - - // Set timestamps - now := time.Now() - issue.CreatedAt = now - issue.UpdatedAt = now - - // Compute content hash (bd-95) - if issue.ContentHash == "" { - issue.ContentHash = issue.ComputeContentHash() - } - - // Acquire a dedicated connection for the transaction. - // This is necessary because we need to execute raw SQL ("BEGIN IMMEDIATE", "COMMIT") - // on the same connection, and database/sql's connection pool would otherwise - // use different connections for different queries. - conn, err := s.db.Conn(ctx) - if err != nil { - return fmt.Errorf("failed to acquire connection: %w", err) - } - defer func() { _ = conn.Close() }() - - // Start IMMEDIATE transaction to acquire write lock early and prevent race conditions. - // IMMEDIATE acquires a RESERVED lock immediately, preventing other IMMEDIATE or EXCLUSIVE - // transactions from starting. This serializes ID generation across concurrent writers. - // - // We use raw Exec instead of BeginTx because database/sql doesn't support transaction - // modes in BeginTx, and modernc.org/sqlite's BeginTx always uses DEFERRED mode. - if _, err := conn.ExecContext(ctx, "BEGIN IMMEDIATE"); err != nil { - return fmt.Errorf("failed to begin immediate transaction: %w", err) - } - - // Track commit state for defer cleanup - // Use context.Background() for ROLLBACK to ensure cleanup happens even if ctx is canceled - committed := false - defer func() { - if !committed { - _, _ = conn.ExecContext(context.Background(), "ROLLBACK") - } - }() - - // Get prefix from config (needed for both ID generation and validation) - var prefix string - err = conn.QueryRowContext(ctx, `SELECT value FROM config WHERE key = ?`, "issue_prefix").Scan(&prefix) - if err == sql.ErrNoRows || prefix == "" { - // CRITICAL: Reject operation if issue_prefix config is missing (bd-166) - // This prevents duplicate issues with wrong prefix - return fmt.Errorf("database not initialized: issue_prefix config is missing (run 'bd init --prefix ' first)") - } else if err != nil { - return fmt.Errorf("failed to get config: %w", err) - } - - // Generate or validate ID - if issue.ID == "" { - // Generate hash-based ID with adaptive length based on database size (bd-ea2a13) - generatedID, err := GenerateIssueID(ctx, conn, prefix, issue, actor) - if err != nil { - return err - } - issue.ID = generatedID - } else { - // Validate that explicitly provided ID matches the configured prefix (bd-177) - if err := ValidateIssueIDPrefix(issue.ID, prefix); err != nil { - return err - } - - // For hierarchical IDs (bd-a3f8e9.1), ensure parent exists - if strings.Contains(issue.ID, ".") { - // Try to resurrect entire parent chain if any parents are missing - // Use the conn-based version to participate in the same transaction - resurrected, err := s.tryResurrectParentChainWithConn(ctx, conn, issue.ID) - if err != nil { - return fmt.Errorf("failed to resurrect parent chain for %s: %w", issue.ID, err) - } - if !resurrected { - // Parent(s) not found in JSONL history - cannot proceed - lastDot := strings.LastIndex(issue.ID, ".") - parentID := issue.ID[:lastDot] - return fmt.Errorf("parent issue %s does not exist and could not be resurrected from JSONL history", parentID) - } - } - } - - // Insert issue - if err := insertIssue(ctx, conn, issue); err != nil { - return err - } - - // Record creation event - if err := recordCreatedEvent(ctx, conn, issue, actor); err != nil { - return err - } - - // Mark issue as dirty for incremental export - if err := markDirty(ctx, conn, issue.ID); err != nil { - return err - } - - // Commit the transaction - if _, err := conn.ExecContext(ctx, "COMMIT"); err != nil { - return fmt.Errorf("failed to commit transaction: %w", err) - } - committed = true - return nil -} - -// validateBatchIssues validates all issues in a batch and sets timestamps -// Batch operation functions moved to batch_ops.go (bd-c796) - -// GetIssue retrieves an issue by ID -func (s *SQLiteStorage) GetIssue(ctx context.Context, id string) (*types.Issue, error) { - var issue types.Issue - var closedAt sql.NullTime - var estimatedMinutes sql.NullInt64 - var assignee sql.NullString - var externalRef sql.NullString - var compactedAt sql.NullTime - var originalSize sql.NullInt64 - var sourceRepo sql.NullString - - var contentHash sql.NullString - var compactedAtCommit sql.NullString - err := s.db.QueryRowContext(ctx, ` - SELECT id, content_hash, title, description, design, acceptance_criteria, notes, - status, priority, issue_type, assignee, estimated_minutes, - created_at, updated_at, closed_at, external_ref, - compaction_level, compacted_at, compacted_at_commit, original_size, source_repo - FROM issues - WHERE id = ? - `, id).Scan( - &issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Design, - &issue.AcceptanceCriteria, &issue.Notes, &issue.Status, - &issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes, - &issue.CreatedAt, &issue.UpdatedAt, &closedAt, &externalRef, - &issue.CompactionLevel, &compactedAt, &compactedAtCommit, &originalSize, &sourceRepo, - ) - - if err == sql.ErrNoRows { - return nil, nil - } - if err != nil { - return nil, fmt.Errorf("failed to get issue: %w", err) - } - - if contentHash.Valid { - issue.ContentHash = contentHash.String - } - if closedAt.Valid { - issue.ClosedAt = &closedAt.Time - } - if estimatedMinutes.Valid { - mins := int(estimatedMinutes.Int64) - issue.EstimatedMinutes = &mins - } - if assignee.Valid { - issue.Assignee = assignee.String - } - if externalRef.Valid { - issue.ExternalRef = &externalRef.String - } - if compactedAt.Valid { - issue.CompactedAt = &compactedAt.Time - } - if compactedAtCommit.Valid { - issue.CompactedAtCommit = &compactedAtCommit.String - } - if originalSize.Valid { - issue.OriginalSize = int(originalSize.Int64) - } - if sourceRepo.Valid { - issue.SourceRepo = sourceRepo.String - } - - // Fetch labels for this issue - labels, err := s.GetLabels(ctx, issue.ID) - if err != nil { - return nil, fmt.Errorf("failed to get labels: %w", err) - } - issue.Labels = labels - - return &issue, nil -} - -// GetIssueByExternalRef retrieves an issue by external reference -func (s *SQLiteStorage) GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error) { - var issue types.Issue - var closedAt sql.NullTime - var estimatedMinutes sql.NullInt64 - var assignee sql.NullString - var externalRefCol sql.NullString - var compactedAt sql.NullTime - var originalSize sql.NullInt64 - var contentHash sql.NullString - var compactedAtCommit sql.NullString - - err := s.db.QueryRowContext(ctx, ` - SELECT id, content_hash, title, description, design, acceptance_criteria, notes, - status, priority, issue_type, assignee, estimated_minutes, - created_at, updated_at, closed_at, external_ref, - compaction_level, compacted_at, compacted_at_commit, original_size - FROM issues - WHERE external_ref = ? - `, externalRef).Scan( - &issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Design, - &issue.AcceptanceCriteria, &issue.Notes, &issue.Status, - &issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes, - &issue.CreatedAt, &issue.UpdatedAt, &closedAt, &externalRefCol, - &issue.CompactionLevel, &compactedAt, &compactedAtCommit, &originalSize, - ) - - if err == sql.ErrNoRows { - return nil, nil - } - if err != nil { - return nil, fmt.Errorf("failed to get issue by external_ref: %w", err) - } - - if contentHash.Valid { - issue.ContentHash = contentHash.String - } - if closedAt.Valid { - issue.ClosedAt = &closedAt.Time - } - if estimatedMinutes.Valid { - mins := int(estimatedMinutes.Int64) - issue.EstimatedMinutes = &mins - } - if assignee.Valid { - issue.Assignee = assignee.String - } - if externalRefCol.Valid { - issue.ExternalRef = &externalRefCol.String - } - if compactedAt.Valid { - issue.CompactedAt = &compactedAt.Time - } - if compactedAtCommit.Valid { - issue.CompactedAtCommit = &compactedAtCommit.String - } - if originalSize.Valid { - issue.OriginalSize = int(originalSize.Int64) - } - - // Fetch labels for this issue - labels, err := s.GetLabels(ctx, issue.ID) - if err != nil { - return nil, fmt.Errorf("failed to get labels: %w", err) - } - issue.Labels = labels - - return &issue, nil -} - -// Allowed fields for update to prevent SQL injection -var allowedUpdateFields = map[string]bool{ - "status": true, - "priority": true, - "title": true, - "assignee": true, - "description": true, - "design": true, - "acceptance_criteria": true, - "notes": true, - "issue_type": true, - "estimated_minutes": true, - "external_ref": true, - "closed_at": true, -} - -// validatePriority validates a priority value -// Validation functions moved to validators.go (bd-d9e0) - -// determineEventType determines the event type for an update based on old and new status -func determineEventType(oldIssue *types.Issue, updates map[string]interface{}) types.EventType { - statusVal, hasStatus := updates["status"] - if !hasStatus { - return types.EventUpdated - } - - newStatus, ok := statusVal.(string) - if !ok { - return types.EventUpdated - } - - if newStatus == string(types.StatusClosed) { - return types.EventClosed - } - if oldIssue.Status == types.StatusClosed { - return types.EventReopened - } - return types.EventStatusChanged -} - -// manageClosedAt automatically manages the closed_at field based on status changes -func manageClosedAt(oldIssue *types.Issue, updates map[string]interface{}, setClauses []string, args []interface{}) ([]string, []interface{}) { - statusVal, hasStatus := updates["status"] - - // If closed_at is explicitly provided in updates, it's already in setClauses/args - // and we should not override it (important for import operations that preserve timestamps) - _, hasExplicitClosedAt := updates["closed_at"] - if hasExplicitClosedAt { - return setClauses, args - } - - if !hasStatus { - return setClauses, args - } - - // Handle both string and types.Status - var newStatus string - switch v := statusVal.(type) { - case string: - newStatus = v - case types.Status: - newStatus = string(v) - default: - return setClauses, args - } - - if newStatus == string(types.StatusClosed) { - // Changing to closed: ensure closed_at is set - now := time.Now() - updates["closed_at"] = now - setClauses = append(setClauses, "closed_at = ?") - args = append(args, now) - } else if oldIssue.Status == types.StatusClosed { - // Changing from closed to something else: clear closed_at - updates["closed_at"] = nil - setClauses = append(setClauses, "closed_at = ?") - args = append(args, nil) - } - - return setClauses, args -} - -// UpdateIssue updates fields on an issue -func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error { - // Get old issue for event - oldIssue, err := s.GetIssue(ctx, id) - if err != nil { - return err - } - if oldIssue == nil { - return fmt.Errorf("issue %s not found", id) - } - - // Build update query with validated field names - setClauses := []string{"updated_at = ?"} - args := []interface{}{time.Now()} - - for key, value := range updates { - // Prevent SQL injection by validating field names - if !allowedUpdateFields[key] { - return fmt.Errorf("invalid field for update: %s", key) - } - - // Validate field values - if err := validateFieldUpdate(key, value); err != nil { - return err - } - - setClauses = append(setClauses, fmt.Sprintf("%s = ?", key)) - args = append(args, value) - } - - // Auto-manage closed_at when status changes (enforce invariant) - setClauses, args = manageClosedAt(oldIssue, updates, setClauses, args) - - // Recompute content_hash if any content fields changed (bd-95) - contentChanged := false - contentFields := []string{"title", "description", "design", "acceptance_criteria", "notes", "status", "priority", "issue_type", "assignee", "external_ref"} - for _, field := range contentFields { - if _, exists := updates[field]; exists { - contentChanged = true - break - } - } - if contentChanged { - // Get updated issue to compute hash - updatedIssue := *oldIssue - for key, value := range updates { - switch key { - case "title": - updatedIssue.Title = value.(string) - case "description": - updatedIssue.Description = value.(string) - case "design": - updatedIssue.Design = value.(string) - case "acceptance_criteria": - updatedIssue.AcceptanceCriteria = value.(string) - case "notes": - updatedIssue.Notes = value.(string) - case "status": - // Handle both string and types.Status - if s, ok := value.(types.Status); ok { - updatedIssue.Status = s - } else { - updatedIssue.Status = types.Status(value.(string)) - } - case "priority": - updatedIssue.Priority = value.(int) - case "issue_type": - // Handle both string and types.IssueType - if t, ok := value.(types.IssueType); ok { - updatedIssue.IssueType = t - } else { - updatedIssue.IssueType = types.IssueType(value.(string)) - } - case "assignee": - if value == nil { - updatedIssue.Assignee = "" - } else { - updatedIssue.Assignee = value.(string) - } - case "external_ref": - if value == nil { - updatedIssue.ExternalRef = nil - } else { - // Handle both string and *string - switch v := value.(type) { - case string: - updatedIssue.ExternalRef = &v - case *string: - updatedIssue.ExternalRef = v - default: - return fmt.Errorf("external_ref must be string or *string, got %T", value) - } - } - } - } - newHash := updatedIssue.ComputeContentHash() - setClauses = append(setClauses, "content_hash = ?") - args = append(args, newHash) - } - - args = append(args, id) - - // Start transaction - tx, err := s.db.BeginTx(ctx, nil) - if err != nil { - return fmt.Errorf("failed to begin transaction: %w", err) - } - defer func() { _ = tx.Rollback() }() - - // Update issue - query := fmt.Sprintf("UPDATE issues SET %s WHERE id = ?", strings.Join(setClauses, ", ")) // #nosec G201 - safe SQL with controlled column names - _, err = tx.ExecContext(ctx, query, args...) - if err != nil { - return fmt.Errorf("failed to update issue: %w", err) - } - - // Record event - oldData, err := json.Marshal(oldIssue) - if err != nil { - // Fall back to minimal description if marshaling fails - oldData = []byte(fmt.Sprintf(`{"id":"%s"}`, id)) - } - newData, err := json.Marshal(updates) - if err != nil { - // Fall back to minimal description if marshaling fails - newData = []byte(`{}`) - } - oldDataStr := string(oldData) - newDataStr := string(newData) - - eventType := determineEventType(oldIssue, updates) - - _, err = tx.ExecContext(ctx, ` - INSERT INTO events (issue_id, event_type, actor, old_value, new_value) - VALUES (?, ?, ?, ?, ?) - `, id, eventType, actor, oldDataStr, newDataStr) - if err != nil { - return fmt.Errorf("failed to record event: %w", err) - } - - // Mark issue as dirty for incremental export - _, err = tx.ExecContext(ctx, ` - INSERT INTO dirty_issues (issue_id, marked_at) - VALUES (?, ?) - ON CONFLICT (issue_id) DO UPDATE SET marked_at = excluded.marked_at - `, id, time.Now()) - if err != nil { - return fmt.Errorf("failed to mark issue dirty: %w", err) - } - - // Invalidate blocked issues cache if status changed (bd-5qim) - // Status changes affect which issues are blocked (blockers must be open/in_progress/blocked) - if _, statusChanged := updates["status"]; statusChanged { - if err := s.invalidateBlockedCache(ctx, tx); err != nil { - return fmt.Errorf("failed to invalidate blocked cache: %w", err) - } - } - - return tx.Commit() -} - -// UpdateIssueID updates an issue ID and all its text fields in a single transaction -func (s *SQLiteStorage) UpdateIssueID(ctx context.Context, oldID, newID string, issue *types.Issue, actor string) error { - // Get exclusive connection to ensure PRAGMA applies - conn, err := s.db.Conn(ctx) - if err != nil { - return fmt.Errorf("failed to get connection: %w", err) - } - defer func() { _ = conn.Close() }() - - // Disable foreign keys on this specific connection - _, err = conn.ExecContext(ctx, `PRAGMA foreign_keys = OFF`) - if err != nil { - return fmt.Errorf("failed to disable foreign keys: %w", err) - } - - tx, err := conn.BeginTx(ctx, nil) - if err != nil { - return fmt.Errorf("failed to begin transaction: %w", err) - } - defer func() { _ = tx.Rollback() }() - - result, err := tx.ExecContext(ctx, ` - UPDATE issues - SET id = ?, title = ?, description = ?, design = ?, acceptance_criteria = ?, notes = ?, updated_at = ? - WHERE id = ? - `, newID, issue.Title, issue.Description, issue.Design, issue.AcceptanceCriteria, issue.Notes, time.Now(), oldID) - if err != nil { - return fmt.Errorf("failed to update issue ID: %w", err) - } - - rows, err := result.RowsAffected() - if err != nil { - return fmt.Errorf("failed to get rows affected: %w", err) - } - if rows == 0 { - return fmt.Errorf("issue not found: %s", oldID) - } - - _, err = tx.ExecContext(ctx, `UPDATE dependencies SET issue_id = ? WHERE issue_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update issue_id in dependencies: %w", err) - } - - _, err = tx.ExecContext(ctx, `UPDATE dependencies SET depends_on_id = ? WHERE depends_on_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update depends_on_id in dependencies: %w", err) - } - - _, err = tx.ExecContext(ctx, `UPDATE events SET issue_id = ? WHERE issue_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update events: %w", err) - } - - _, err = tx.ExecContext(ctx, `UPDATE labels SET issue_id = ? WHERE issue_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update labels: %w", err) - } - - _, err = tx.ExecContext(ctx, `UPDATE comments SET issue_id = ? WHERE issue_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update comments: %w", err) - } - - _, err = tx.ExecContext(ctx, ` - UPDATE dirty_issues SET issue_id = ? WHERE issue_id = ? - `, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update dirty_issues: %w", err) - } - - _, err = tx.ExecContext(ctx, `UPDATE issue_snapshots SET issue_id = ? WHERE issue_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update issue_snapshots: %w", err) - } - - _, err = tx.ExecContext(ctx, `UPDATE compaction_snapshots SET issue_id = ? WHERE issue_id = ?`, newID, oldID) - if err != nil { - return fmt.Errorf("failed to update compaction_snapshots: %w", err) - } - - _, err = tx.ExecContext(ctx, ` - INSERT INTO dirty_issues (issue_id, marked_at) - VALUES (?, ?) - ON CONFLICT (issue_id) DO UPDATE SET marked_at = excluded.marked_at - `, newID, time.Now()) - if err != nil { - return fmt.Errorf("failed to mark issue dirty: %w", err) - } - - _, err = tx.ExecContext(ctx, ` - INSERT INTO events (issue_id, event_type, actor, old_value, new_value) - VALUES (?, 'renamed', ?, ?, ?) - `, newID, actor, oldID, newID) - if err != nil { - return fmt.Errorf("failed to record rename event: %w", err) - } - - return tx.Commit() -} - -// RenameDependencyPrefix updates the prefix in all dependency records -func (s *SQLiteStorage) RenameDependencyPrefix(ctx context.Context, oldPrefix, newPrefix string) error { - return nil -} - -// RenameCounterPrefix is a no-op with hash-based IDs (bd-8e05) -// Kept for backward compatibility with rename-prefix command -func (s *SQLiteStorage) RenameCounterPrefix(ctx context.Context, oldPrefix, newPrefix string) error { - // Hash-based IDs don't use counters, so nothing to update - return nil -} - -// ResetCounter is a no-op with hash-based IDs (bd-8e05) -// Kept for backward compatibility -func (s *SQLiteStorage) ResetCounter(ctx context.Context, prefix string) error { - // Hash-based IDs don't use counters, so nothing to reset - return nil -} - -// CloseIssue closes an issue with a reason -func (s *SQLiteStorage) CloseIssue(ctx context.Context, id string, reason string, actor string) error { - now := time.Now() - - // Update with special event handling - tx, err := s.db.BeginTx(ctx, nil) - if err != nil { - return fmt.Errorf("failed to begin transaction: %w", err) - } - defer func() { _ = tx.Rollback() }() - - result, err := tx.ExecContext(ctx, ` - UPDATE issues SET status = ?, closed_at = ?, updated_at = ? - WHERE id = ? - `, types.StatusClosed, now, now, id) - if err != nil { - return fmt.Errorf("failed to close issue: %w", err) - } - - rows, err := result.RowsAffected() - if err != nil { - return fmt.Errorf("failed to get rows affected: %w", err) - } - if rows == 0 { - return fmt.Errorf("issue not found: %s", id) - } - - _, err = tx.ExecContext(ctx, ` - INSERT INTO events (issue_id, event_type, actor, comment) - VALUES (?, ?, ?, ?) - `, id, types.EventClosed, actor, reason) - if err != nil { - return fmt.Errorf("failed to record event: %w", err) - } - - // Mark issue as dirty for incremental export - _, err = tx.ExecContext(ctx, ` - INSERT INTO dirty_issues (issue_id, marked_at) - VALUES (?, ?) - ON CONFLICT (issue_id) DO UPDATE SET marked_at = excluded.marked_at - `, id, time.Now()) - if err != nil { - return fmt.Errorf("failed to mark issue dirty: %w", err) - } - - // Invalidate blocked issues cache since status changed to closed (bd-5qim) - // Closed issues don't block others, so this affects blocking calculations - if err := s.invalidateBlockedCache(ctx, tx); err != nil { - return fmt.Errorf("failed to invalidate blocked cache: %w", err) - } - - return tx.Commit() -} - -// DeleteIssue permanently removes an issue from the database -func (s *SQLiteStorage) DeleteIssue(ctx context.Context, id string) error { - tx, err := s.db.BeginTx(ctx, nil) - if err != nil { - return fmt.Errorf("failed to begin transaction: %w", err) - } - defer func() { _ = tx.Rollback() }() - - // Delete dependencies (both directions) - _, err = tx.ExecContext(ctx, `DELETE FROM dependencies WHERE issue_id = ? OR depends_on_id = ?`, id, id) - if err != nil { - return fmt.Errorf("failed to delete dependencies: %w", err) - } - - // Delete events - _, err = tx.ExecContext(ctx, `DELETE FROM events WHERE issue_id = ?`, id) - if err != nil { - return fmt.Errorf("failed to delete events: %w", err) - } - - // Delete from dirty_issues - _, err = tx.ExecContext(ctx, `DELETE FROM dirty_issues WHERE issue_id = ?`, id) - if err != nil { - return fmt.Errorf("failed to delete dirty marker: %w", err) - } - - // Delete the issue itself - result, err := tx.ExecContext(ctx, `DELETE FROM issues WHERE id = ?`, id) - if err != nil { - return fmt.Errorf("failed to delete issue: %w", err) - } - - rowsAffected, err := result.RowsAffected() - if err != nil { - return fmt.Errorf("failed to check rows affected: %w", err) - } - if rowsAffected == 0 { - return fmt.Errorf("issue not found: %s", id) - } - - if err := tx.Commit(); err != nil { - return err - } - - // REMOVED (bd-c7af): Counter sync after deletion - no longer needed with hash IDs - return nil -} - -// DeleteIssuesResult contains statistics about a batch deletion operation -type DeleteIssuesResult struct { - DeletedCount int - DependenciesCount int - LabelsCount int - EventsCount int - OrphanedIssues []string -} - -// DeleteIssues deletes multiple issues in a single transaction -// If cascade is true, recursively deletes dependents -// If cascade is false but force is true, deletes issues and orphans their dependents -// If cascade and force are both false, returns an error if any issue has dependents -// If dryRun is true, only computes statistics without deleting -func (s *SQLiteStorage) DeleteIssues(ctx context.Context, ids []string, cascade bool, force bool, dryRun bool) (*DeleteIssuesResult, error) { - if len(ids) == 0 { - return &DeleteIssuesResult{}, nil - } - - tx, err := s.db.BeginTx(ctx, nil) - if err != nil { - return nil, fmt.Errorf("failed to begin transaction: %w", err) - } - defer func() { _ = tx.Rollback() }() - - idSet := buildIDSet(ids) - result := &DeleteIssuesResult{} - - expandedIDs, err := s.resolveDeleteSet(ctx, tx, ids, idSet, cascade, force, result) - if err != nil { - return nil, err - } - - inClause, args := buildSQLInClause(expandedIDs) - if err := s.populateDeleteStats(ctx, tx, inClause, args, result); err != nil { - return nil, err - } - - if dryRun { - return result, nil - } - - if err := s.executeDelete(ctx, tx, inClause, args, result); err != nil { - return nil, err - } - - if err := tx.Commit(); err != nil { - return nil, fmt.Errorf("failed to commit transaction: %w", err) - } - - // REMOVED (bd-c7af): Counter sync after deletion - no longer needed with hash IDs - - return result, nil -} - -func buildIDSet(ids []string) map[string]bool { - idSet := make(map[string]bool, len(ids)) - for _, id := range ids { - idSet[id] = true - } - return idSet -} - -func (s *SQLiteStorage) resolveDeleteSet(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool, cascade bool, force bool, result *DeleteIssuesResult) ([]string, error) { - if cascade { - return s.expandWithDependents(ctx, tx, ids, idSet) - } - if !force { - return ids, s.validateNoDependents(ctx, tx, ids, idSet, result) - } - return ids, s.trackOrphanedIssues(ctx, tx, ids, idSet, result) -} - -func (s *SQLiteStorage) expandWithDependents(ctx context.Context, tx *sql.Tx, ids []string, _ map[string]bool) ([]string, error) { - allToDelete, err := s.findAllDependentsRecursive(ctx, tx, ids) - if err != nil { - return nil, fmt.Errorf("failed to find dependents: %w", err) - } - expandedIDs := make([]string, 0, len(allToDelete)) - for id := range allToDelete { - expandedIDs = append(expandedIDs, id) - } - return expandedIDs, nil -} - -func (s *SQLiteStorage) validateNoDependents(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool, result *DeleteIssuesResult) error { - for _, id := range ids { - if err := s.checkSingleIssueValidation(ctx, tx, id, idSet, result); err != nil { - return err - } - } - return nil -} - -func (s *SQLiteStorage) checkSingleIssueValidation(ctx context.Context, tx *sql.Tx, id string, idSet map[string]bool, result *DeleteIssuesResult) error { - var depCount int - err := tx.QueryRowContext(ctx, - `SELECT COUNT(*) FROM dependencies WHERE depends_on_id = ?`, id).Scan(&depCount) - if err != nil { - return fmt.Errorf("failed to check dependents for %s: %w", id, err) - } - if depCount == 0 { - return nil - } - - rows, err := tx.QueryContext(ctx, - `SELECT issue_id FROM dependencies WHERE depends_on_id = ?`, id) - if err != nil { - return fmt.Errorf("failed to get dependents for %s: %w", id, err) - } - defer func() { _ = rows.Close() }() - - hasExternal := false - for rows.Next() { - var depID string - if err := rows.Scan(&depID); err != nil { - return fmt.Errorf("failed to scan dependent: %w", err) - } - if !idSet[depID] { - hasExternal = true - result.OrphanedIssues = append(result.OrphanedIssues, depID) - } - } - - if err := rows.Err(); err != nil { - return fmt.Errorf("failed to iterate dependents for %s: %w", id, err) - } - - if hasExternal { - return fmt.Errorf("issue %s has dependents not in deletion set; use --cascade to delete them or --force to orphan them", id) - } - return nil -} - -func (s *SQLiteStorage) trackOrphanedIssues(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool, result *DeleteIssuesResult) error { - orphanSet := make(map[string]bool) - for _, id := range ids { - if err := s.collectOrphansForID(ctx, tx, id, idSet, orphanSet); err != nil { - return err - } - } - for orphanID := range orphanSet { - result.OrphanedIssues = append(result.OrphanedIssues, orphanID) - } - return nil -} - -func (s *SQLiteStorage) collectOrphansForID(ctx context.Context, tx *sql.Tx, id string, idSet map[string]bool, orphanSet map[string]bool) error { - rows, err := tx.QueryContext(ctx, - `SELECT issue_id FROM dependencies WHERE depends_on_id = ?`, id) - if err != nil { - return fmt.Errorf("failed to get dependents for %s: %w", id, err) - } - defer func() { _ = rows.Close() }() - - for rows.Next() { - var depID string - if err := rows.Scan(&depID); err != nil { - return fmt.Errorf("failed to scan dependent: %w", err) - } - if !idSet[depID] { - orphanSet[depID] = true - } - } - return rows.Err() -} - -func buildSQLInClause(ids []string) (string, []interface{}) { - placeholders := make([]string, len(ids)) - args := make([]interface{}, len(ids)) - for i, id := range ids { - placeholders[i] = "?" - args[i] = id - } - return strings.Join(placeholders, ","), args -} - -func (s *SQLiteStorage) populateDeleteStats(ctx context.Context, tx *sql.Tx, inClause string, args []interface{}, result *DeleteIssuesResult) error { - counts := []struct { - query string - dest *int - }{ - {fmt.Sprintf(`SELECT COUNT(*) FROM dependencies WHERE issue_id IN (%s) OR depends_on_id IN (%s)`, inClause, inClause), &result.DependenciesCount}, - {fmt.Sprintf(`SELECT COUNT(*) FROM labels WHERE issue_id IN (%s)`, inClause), &result.LabelsCount}, - {fmt.Sprintf(`SELECT COUNT(*) FROM events WHERE issue_id IN (%s)`, inClause), &result.EventsCount}, - } - - for _, c := range counts { - queryArgs := args - if c.dest == &result.DependenciesCount { - queryArgs = append(args, args...) - } - if err := tx.QueryRowContext(ctx, c.query, queryArgs...).Scan(c.dest); err != nil { - return fmt.Errorf("failed to count: %w", err) - } - } - - result.DeletedCount = len(args) - return nil -} - -func (s *SQLiteStorage) executeDelete(ctx context.Context, tx *sql.Tx, inClause string, args []interface{}, result *DeleteIssuesResult) error { - deletes := []struct { - query string - args []interface{} - }{ - {fmt.Sprintf(`DELETE FROM dependencies WHERE issue_id IN (%s) OR depends_on_id IN (%s)`, inClause, inClause), append(args, args...)}, - {fmt.Sprintf(`DELETE FROM labels WHERE issue_id IN (%s)`, inClause), args}, - {fmt.Sprintf(`DELETE FROM events WHERE issue_id IN (%s)`, inClause), args}, - {fmt.Sprintf(`DELETE FROM dirty_issues WHERE issue_id IN (%s)`, inClause), args}, - {fmt.Sprintf(`DELETE FROM issues WHERE id IN (%s)`, inClause), args}, - } - - for i, d := range deletes { - execResult, err := tx.ExecContext(ctx, d.query, d.args...) - if err != nil { - return fmt.Errorf("failed to delete: %w", err) - } - if i == len(deletes)-1 { - rowsAffected, err := execResult.RowsAffected() - if err != nil { - return fmt.Errorf("failed to check rows affected: %w", err) - } - result.DeletedCount = int(rowsAffected) - } - } - return nil -} - -// findAllDependentsRecursive finds all issues that depend on the given issues, recursively -func (s *SQLiteStorage) findAllDependentsRecursive(ctx context.Context, tx *sql.Tx, ids []string) (map[string]bool, error) { - result := make(map[string]bool) - for _, id := range ids { - result[id] = true - } - - toProcess := make([]string, len(ids)) - copy(toProcess, ids) - - for len(toProcess) > 0 { - current := toProcess[0] - toProcess = toProcess[1:] - - rows, err := tx.QueryContext(ctx, - `SELECT issue_id FROM dependencies WHERE depends_on_id = ?`, current) - if err != nil { - return nil, err - } - defer rows.Close() - - for rows.Next() { - var depID string - if err := rows.Scan(&depID); err != nil { - return nil, err - } - if !result[depID] { - result[depID] = true - toProcess = append(toProcess, depID) - } - } - if err := rows.Err(); err != nil { - return nil, err - } - } - - return result, nil -} - -// SearchIssues finds issues matching query and filters -func (s *SQLiteStorage) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error) { - whereClauses := []string{} - args := []interface{}{} - - if query != "" { - whereClauses = append(whereClauses, "(title LIKE ? OR description LIKE ? OR id LIKE ?)") - pattern := "%" + query + "%" - args = append(args, pattern, pattern, pattern) - } - - if filter.TitleSearch != "" { - whereClauses = append(whereClauses, "title LIKE ?") - pattern := "%" + filter.TitleSearch + "%" - args = append(args, pattern) - } - - // Pattern matching - if filter.TitleContains != "" { - whereClauses = append(whereClauses, "title LIKE ?") - args = append(args, "%"+filter.TitleContains+"%") - } - if filter.DescriptionContains != "" { - whereClauses = append(whereClauses, "description LIKE ?") - args = append(args, "%"+filter.DescriptionContains+"%") - } - if filter.NotesContains != "" { - whereClauses = append(whereClauses, "notes LIKE ?") - args = append(args, "%"+filter.NotesContains+"%") - } - - if filter.Status != nil { - whereClauses = append(whereClauses, "status = ?") - args = append(args, *filter.Status) - } - - if filter.Priority != nil { - whereClauses = append(whereClauses, "priority = ?") - args = append(args, *filter.Priority) - } - - // Priority ranges - if filter.PriorityMin != nil { - whereClauses = append(whereClauses, "priority >= ?") - args = append(args, *filter.PriorityMin) - } - if filter.PriorityMax != nil { - whereClauses = append(whereClauses, "priority <= ?") - args = append(args, *filter.PriorityMax) - } - - if filter.IssueType != nil { - whereClauses = append(whereClauses, "issue_type = ?") - args = append(args, *filter.IssueType) - } - - if filter.Assignee != nil { - whereClauses = append(whereClauses, "assignee = ?") - args = append(args, *filter.Assignee) - } - - // Date ranges - if filter.CreatedAfter != nil { - whereClauses = append(whereClauses, "created_at > ?") - args = append(args, filter.CreatedAfter.Format(time.RFC3339)) - } - if filter.CreatedBefore != nil { - whereClauses = append(whereClauses, "created_at < ?") - args = append(args, filter.CreatedBefore.Format(time.RFC3339)) - } - if filter.UpdatedAfter != nil { - whereClauses = append(whereClauses, "updated_at > ?") - args = append(args, filter.UpdatedAfter.Format(time.RFC3339)) - } - if filter.UpdatedBefore != nil { - whereClauses = append(whereClauses, "updated_at < ?") - args = append(args, filter.UpdatedBefore.Format(time.RFC3339)) - } - if filter.ClosedAfter != nil { - whereClauses = append(whereClauses, "closed_at > ?") - args = append(args, filter.ClosedAfter.Format(time.RFC3339)) - } - if filter.ClosedBefore != nil { - whereClauses = append(whereClauses, "closed_at < ?") - args = append(args, filter.ClosedBefore.Format(time.RFC3339)) - } - - // Empty/null checks - if filter.EmptyDescription { - whereClauses = append(whereClauses, "(description IS NULL OR description = '')") - } - if filter.NoAssignee { - whereClauses = append(whereClauses, "(assignee IS NULL OR assignee = '')") - } - if filter.NoLabels { - whereClauses = append(whereClauses, "id NOT IN (SELECT DISTINCT issue_id FROM labels)") - } - - // Label filtering: issue must have ALL specified labels - if len(filter.Labels) > 0 { - for _, label := range filter.Labels { - whereClauses = append(whereClauses, "id IN (SELECT issue_id FROM labels WHERE label = ?)") - args = append(args, label) - } - } - - // Label filtering (OR): issue must have AT LEAST ONE of these labels - if len(filter.LabelsAny) > 0 { - placeholders := make([]string, len(filter.LabelsAny)) - for i, label := range filter.LabelsAny { - placeholders[i] = "?" - args = append(args, label) - } - whereClauses = append(whereClauses, fmt.Sprintf("id IN (SELECT issue_id FROM labels WHERE label IN (%s))", strings.Join(placeholders, ", "))) - } - - // ID filtering: match specific issue IDs - if len(filter.IDs) > 0 { - placeholders := make([]string, len(filter.IDs)) - for i, id := range filter.IDs { - placeholders[i] = "?" - args = append(args, id) - } - whereClauses = append(whereClauses, fmt.Sprintf("id IN (%s)", strings.Join(placeholders, ", "))) - } - - whereSQL := "" - if len(whereClauses) > 0 { - whereSQL = "WHERE " + strings.Join(whereClauses, " AND ") - } - - limitSQL := "" - if filter.Limit > 0 { - limitSQL = " LIMIT ?" - args = append(args, filter.Limit) - } - - // #nosec G201 - safe SQL with controlled formatting - querySQL := fmt.Sprintf(` - SELECT id, content_hash, title, description, design, acceptance_criteria, notes, - status, priority, issue_type, assignee, estimated_minutes, - created_at, updated_at, closed_at, external_ref, source_repo - FROM issues - %s - ORDER BY priority ASC, created_at DESC - %s - `, whereSQL, limitSQL) - - rows, err := s.db.QueryContext(ctx, querySQL, args...) - if err != nil { - return nil, fmt.Errorf("failed to search issues: %w", err) - } - defer func() { _ = rows.Close() }() - - return s.scanIssues(ctx, rows) -} - -// SetConfig sets a configuration value -func (s *SQLiteStorage) SetConfig(ctx context.Context, key, value string) error { - _, err := s.db.ExecContext(ctx, ` - INSERT INTO config (key, value) VALUES (?, ?) - ON CONFLICT (key) DO UPDATE SET value = excluded.value - `, key, value) - return err -} - -// GetConfig gets a configuration value -func (s *SQLiteStorage) GetConfig(ctx context.Context, key string) (string, error) { - var value string - err := s.db.QueryRowContext(ctx, `SELECT value FROM config WHERE key = ?`, key).Scan(&value) - if err == sql.ErrNoRows { - return "", nil - } - return value, err -} - -// GetAllConfig gets all configuration key-value pairs -func (s *SQLiteStorage) GetAllConfig(ctx context.Context) (map[string]string, error) { - rows, err := s.db.QueryContext(ctx, `SELECT key, value FROM config ORDER BY key`) - if err != nil { - return nil, err - } - defer func() { _ = rows.Close() }() - - config := make(map[string]string) - for rows.Next() { - var key, value string - if err := rows.Scan(&key, &value); err != nil { - return nil, err - } - config[key] = value - } - return config, rows.Err() -} - -// DeleteConfig deletes a configuration value -func (s *SQLiteStorage) DeleteConfig(ctx context.Context, key string) error { - _, err := s.db.ExecContext(ctx, `DELETE FROM config WHERE key = ?`, key) - return err -} - -// GetOrphanHandling gets the import.orphan_handling config value -// Returns OrphanAllow (the default) if not set or if value is invalid -func (s *SQLiteStorage) GetOrphanHandling(ctx context.Context) OrphanHandling { - value, err := s.GetConfig(ctx, "import.orphan_handling") - if err != nil || value == "" { - return OrphanAllow // Default - } - - switch OrphanHandling(value) { - case OrphanStrict, OrphanResurrect, OrphanSkip, OrphanAllow: - return OrphanHandling(value) - default: - return OrphanAllow // Invalid value, use default - } -} - -// SetMetadata sets a metadata value (for internal state like import hashes) -func (s *SQLiteStorage) SetMetadata(ctx context.Context, key, value string) error { - _, err := s.db.ExecContext(ctx, ` - INSERT INTO metadata (key, value) VALUES (?, ?) - ON CONFLICT (key) DO UPDATE SET value = excluded.value - `, key, value) - return err -} - -// GetMetadata gets a metadata value (for internal state like import hashes) -func (s *SQLiteStorage) GetMetadata(ctx context.Context, key string) (string, error) { - var value string - err := s.db.QueryRowContext(ctx, `SELECT value FROM metadata WHERE key = ?`, key).Scan(&value) - if err == sql.ErrNoRows { - return "", nil - } - return value, err -} - -// AddIssueComment adds a comment to an issue -func (s *SQLiteStorage) AddIssueComment(ctx context.Context, issueID, author, text string) (*types.Comment, error) { - // Verify issue exists - var exists bool - err := s.db.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM issues WHERE id = ?)`, issueID).Scan(&exists) - if err != nil { - return nil, fmt.Errorf("failed to check issue existence: %w", err) - } - if !exists { - return nil, fmt.Errorf("issue %s not found", issueID) - } - - // Insert comment - result, err := s.db.ExecContext(ctx, ` - INSERT INTO comments (issue_id, author, text, created_at) - VALUES (?, ?, ?, CURRENT_TIMESTAMP) - `, issueID, author, text) - if err != nil { - return nil, fmt.Errorf("failed to insert comment: %w", err) - } - - // Get the inserted comment ID - commentID, err := result.LastInsertId() - if err != nil { - return nil, fmt.Errorf("failed to get comment ID: %w", err) - } - - // Fetch the complete comment - comment := &types.Comment{} - err = s.db.QueryRowContext(ctx, ` - SELECT id, issue_id, author, text, created_at - FROM comments WHERE id = ? - `, commentID).Scan(&comment.ID, &comment.IssueID, &comment.Author, &comment.Text, &comment.CreatedAt) - if err != nil { - return nil, fmt.Errorf("failed to fetch comment: %w", err) - } - - // Mark issue as dirty for JSONL export - if err := s.MarkIssueDirty(ctx, issueID); err != nil { - return nil, fmt.Errorf("failed to mark issue dirty: %w", err) - } - - return comment, nil -} - -// GetIssueComments retrieves all comments for an issue -func (s *SQLiteStorage) GetIssueComments(ctx context.Context, issueID string) ([]*types.Comment, error) { - rows, err := s.db.QueryContext(ctx, ` - SELECT id, issue_id, author, text, created_at - FROM comments - WHERE issue_id = ? - ORDER BY created_at ASC - `, issueID) - if err != nil { - return nil, fmt.Errorf("failed to query comments: %w", err) - } - defer func() { _ = rows.Close() }() - - var comments []*types.Comment - for rows.Next() { - comment := &types.Comment{} - err := rows.Scan(&comment.ID, &comment.IssueID, &comment.Author, &comment.Text, &comment.CreatedAt) - if err != nil { - return nil, fmt.Errorf("failed to scan comment: %w", err) - } - comments = append(comments, comment) - } - - if err := rows.Err(); err != nil { - return nil, fmt.Errorf("error iterating comments: %w", err) - } - - return comments, nil -} - -// Close closes the database connection -func (s *SQLiteStorage) Close() error { - s.closed.Store(true) - return s.db.Close() -} - -// Path returns the absolute path to the database file -func (s *SQLiteStorage) Path() string { - return s.dbPath -} - -// IsClosed returns true if Close() has been called on this storage -func (s *SQLiteStorage) IsClosed() bool { - return s.closed.Load() -} - -// UnderlyingDB returns the underlying *sql.DB connection for extensions. -// -// This allows extensions (like VC) to create their own tables in the same database -// while leveraging the existing connection pool and schema. The returned *sql.DB is -// safe for concurrent use and shares the same transaction isolation and locking -// behavior as the core storage operations. -// -// IMPORTANT SAFETY RULES: -// -// 1. DO NOT call Close() on the returned *sql.DB -// - The SQLiteStorage owns the connection lifecycle -// - Closing it will break all storage operations -// - Use storage.Close() to close the database -// -// 2. DO NOT modify connection pool settings -// - Avoid SetMaxOpenConns, SetMaxIdleConns, SetConnMaxLifetime, etc. -// - The storage has already configured these for optimal performance -// -// 3. DO NOT change SQLite PRAGMAs -// - The database is configured with WAL mode, foreign keys, and busy timeout -// - Changing these (e.g., journal_mode, synchronous, locking_mode) can cause corruption -// -// 4. Expect errors after storage.Close() -// - Check storage.IsClosed() before long-running operations if needed -// - Pass contexts with timeouts to prevent hanging on closed connections -// -// 5. Keep write transactions SHORT -// - SQLite has a single-writer lock even in WAL mode -// - Long-running write transactions will block core storage operations -// - Use read transactions (BEGIN DEFERRED) when possible -// -// GOOD PRACTICES: -// -// - Create extension tables with FOREIGN KEY constraints to maintain referential integrity -// - Use the same DATETIME format (RFC3339 / ISO8601) for consistency -// - Leverage SQLite indexes for query performance -// - Test with -race flag to catch concurrency issues -// -// EXAMPLE (creating a VC extension table): -// -// db := storage.UnderlyingDB() -// _, err := db.Exec(` -// CREATE TABLE IF NOT EXISTS vc_executions ( -// id INTEGER PRIMARY KEY AUTOINCREMENT, -// issue_id TEXT NOT NULL, -// status TEXT NOT NULL, -// created_at DATETIME DEFAULT CURRENT_TIMESTAMP, -// FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE -// ); -// CREATE INDEX IF NOT EXISTS idx_vc_executions_issue ON vc_executions(issue_id); -// `) -func (s *SQLiteStorage) UnderlyingDB() *sql.DB { - return s.db -} - -// UnderlyingConn returns a single connection from the pool for scoped use. -// -// This provides a connection with explicit lifetime boundaries, useful for: -// - One-time DDL operations (CREATE TABLE, ALTER TABLE) -// - Migration scripts that need transaction control -// - Operations that benefit from connection-level state -// -// IMPORTANT: The caller MUST close the connection when done: -// -// conn, err := storage.UnderlyingConn(ctx) -// if err != nil { -// return err -// } -// defer conn.Close() -// -// For general queries and transactions, prefer UnderlyingDB() which manages -// the connection pool automatically. -// -// EXAMPLE (extension table migration): -// -// conn, err := storage.UnderlyingConn(ctx) -// if err != nil { -// return err -// } -// defer conn.Close() -// -// _, err = conn.ExecContext(ctx, ` -// CREATE TABLE IF NOT EXISTS vc_executions ( -// id INTEGER PRIMARY KEY AUTOINCREMENT, -// issue_id TEXT NOT NULL, -// FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE -// ) -// `) -func (s *SQLiteStorage) UnderlyingConn(ctx context.Context) (*sql.Conn, error) { - return s.db.Conn(ctx) -} - -// CheckpointWAL checkpoints the WAL file to flush changes to the main database file. -// In WAL mode, writes go to the -wal file, leaving the main .db file untouched. -// Checkpointing: -// - Ensures data persistence by flushing WAL to main database -// - Reduces WAL file size -// - Makes database safe for backup/copy operations -func (s *SQLiteStorage) CheckpointWAL(ctx context.Context) error { - _, err := s.db.ExecContext(ctx, "PRAGMA wal_checkpoint(FULL)") - return err -} diff --git a/internal/storage/sqlite/store.go b/internal/storage/sqlite/store.go new file mode 100644 index 00000000..93b952a6 --- /dev/null +++ b/internal/storage/sqlite/store.go @@ -0,0 +1,306 @@ +// Package sqlite implements the storage interface using SQLite. +package sqlite + +import ( + "context" + "database/sql" + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + "sync/atomic" + + // Import SQLite driver + sqlite3 "github.com/ncruces/go-sqlite3" + _ "github.com/ncruces/go-sqlite3/driver" + _ "github.com/ncruces/go-sqlite3/embed" + "github.com/tetratelabs/wazero" +) + +// SQLiteStorage implements the Storage interface using SQLite +type SQLiteStorage struct { + db *sql.DB + dbPath string + closed atomic.Bool // Tracks whether Close() has been called +} + +// setupWASMCache configures WASM compilation caching to reduce SQLite startup time. +// Returns the cache directory path (empty string if using in-memory cache). +// +// Cache behavior: +// - Location: ~/.cache/beads/wasm/ (platform-specific via os.UserCacheDir) +// - Version management: wazero automatically keys cache by its version +// - Cleanup: Old versions remain harmless (~5-10MB each); manual cleanup if needed +// - Fallback: Uses in-memory cache if filesystem cache creation fails +// +// Performance impact: +// - First run: ~220ms (compile + cache) +// - Subsequent runs: ~20ms (load from cache) +func setupWASMCache() string { + cacheDir := "" + if userCache, err := os.UserCacheDir(); err == nil { + cacheDir = filepath.Join(userCache, "beads", "wasm") + } + + var cache wazero.CompilationCache + if cacheDir != "" { + // Try file-system cache first (persistent across runs) + if c, err := wazero.NewCompilationCacheWithDir(cacheDir); err == nil { + cache = c + // Optional: log cache location for debugging + // fmt.Fprintf(os.Stderr, "WASM cache: %s\n", cacheDir) + } + } + + // Fallback to in-memory cache if dir creation failed + if cache == nil { + cache = wazero.NewCompilationCache() + cacheDir = "" // Indicate in-memory fallback + // Optional: log fallback for debugging + // fmt.Fprintln(os.Stderr, "WASM cache: in-memory only") + } + + // Configure go-sqlite3's wazero runtime to use the cache + sqlite3.RuntimeConfig = wazero.NewRuntimeConfig().WithCompilationCache(cache) + + return cacheDir +} + +func init() { + // Setup WASM compilation cache to avoid 220ms JIT compilation overhead on every process start + _ = setupWASMCache() +} + +// New creates a new SQLite storage backend +func New(ctx context.Context, path string) (*SQLiteStorage, error) { + // Build connection string with proper URI syntax + // For :memory: databases, use shared cache so multiple connections see the same data + var connStr string + if path == ":memory:" { + // Use shared in-memory database with a named identifier + // Note: WAL mode doesn't work with shared in-memory databases, so use DELETE mode + // The name "memdb" is required for cache=shared to work properly across connections + connStr = "file:memdb?mode=memory&cache=shared&_pragma=journal_mode(DELETE)&_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite" + } else if strings.HasPrefix(path, "file:") { + // Already a URI - append our pragmas if not present + connStr = path + if !strings.Contains(path, "_pragma=foreign_keys") { + connStr += "&_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite" + } + } else { + // Ensure directory exists for file-based databases + dir := filepath.Dir(path) + if err := os.MkdirAll(dir, 0o750); err != nil { + return nil, fmt.Errorf("failed to create directory: %w", err) + } + // Use file URI with pragmas + connStr = "file:" + path + "?_pragma=foreign_keys(ON)&_pragma=busy_timeout(30000)&_time_format=sqlite" + } + + db, err := sql.Open("sqlite3", connStr) + if err != nil { + return nil, fmt.Errorf("failed to open database: %w", err) + } + + // For all in-memory databases (including file::memory:), force single connection. + // SQLite's in-memory databases are isolated per connection by default. + // Without this, different connections in the pool can't see each other's writes (bd-b121, bd-yvlc). + isInMemory := path == ":memory:" || + (strings.HasPrefix(path, "file:") && strings.Contains(path, "mode=memory")) + if isInMemory { + db.SetMaxOpenConns(1) + db.SetMaxIdleConns(1) + } else { + // For file-based databases in daemon mode, limit connection pool to prevent + // connection exhaustion under concurrent load. SQLite WAL mode supports + // 1 writer + unlimited readers, but we limit to prevent goroutine pile-up + // on write lock contention (bd-qhws). + maxConns := runtime.NumCPU() + 1 // 1 writer + N readers + db.SetMaxOpenConns(maxConns) + db.SetMaxIdleConns(2) + db.SetConnMaxLifetime(0) // SQLite doesn't need connection recycling + } + + // For file-based databases, enable WAL mode once after opening the connection. + if !isInMemory { + if _, err := db.Exec("PRAGMA journal_mode=WAL"); err != nil { + return nil, fmt.Errorf("failed to enable WAL mode: %w", err) + } + } + + // Test connection + if err := db.Ping(); err != nil { + return nil, fmt.Errorf("failed to ping database: %w", err) + } + + // Initialize schema + if _, err := db.Exec(schema); err != nil { + return nil, fmt.Errorf("failed to initialize schema: %w", err) + } + + // Run all migrations + if err := RunMigrations(db); err != nil { + return nil, err + } + + // Verify schema compatibility after migrations (bd-ckvw) + // First attempt + if err := verifySchemaCompatibility(db); err != nil { + // Schema probe failed - retry migrations once + if retryErr := RunMigrations(db); retryErr != nil { + return nil, fmt.Errorf("migration retry failed after schema probe failure: %w (original: %v)", retryErr, err) + } + + // Probe again after retry + if err := verifySchemaCompatibility(db); err != nil { + // Still failing - return fatal error with clear message + return nil, fmt.Errorf("schema probe failed after migration retry: %w. Database may be corrupted or from incompatible version. Run 'bd doctor' to diagnose", err) + } + } + + // Convert to absolute path for consistency (but keep :memory: as-is) + absPath := path + if path != ":memory:" { + var err error + absPath, err = filepath.Abs(path) + if err != nil { + return nil, fmt.Errorf("failed to get absolute path: %w", err) + } + } + + storage := &SQLiteStorage{ + db: db, + dbPath: absPath, + } + + // Hydrate from multi-repo config if configured (bd-307) + // Skip for in-memory databases (used in tests) + if path != ":memory:" { + _, err := storage.HydrateFromMultiRepo(ctx) + if err != nil { + return nil, fmt.Errorf("failed to hydrate from multi-repo: %w", err) + } + } + + return storage, nil +} + +// Close closes the database connection +func (s *SQLiteStorage) Close() error { + s.closed.Store(true) + return s.db.Close() +} + +// Path returns the absolute path to the database file +func (s *SQLiteStorage) Path() string { + return s.dbPath +} + +// IsClosed returns true if Close() has been called on this storage +func (s *SQLiteStorage) IsClosed() bool { + return s.closed.Load() +} + +// UnderlyingDB returns the underlying *sql.DB connection for extensions. +// +// This allows extensions (like VC) to create their own tables in the same database +// while leveraging the existing connection pool and schema. The returned *sql.DB is +// safe for concurrent use and shares the same transaction isolation and locking +// behavior as the core storage operations. +// +// IMPORTANT SAFETY RULES: +// +// 1. DO NOT call Close() on the returned *sql.DB +// - The SQLiteStorage owns the connection lifecycle +// - Closing it will break all storage operations +// - Use storage.Close() to close the database +// +// 2. DO NOT modify connection pool settings +// - Avoid SetMaxOpenConns, SetMaxIdleConns, SetConnMaxLifetime, etc. +// - The storage has already configured these for optimal performance +// +// 3. DO NOT change SQLite PRAGMAs +// - The database is configured with WAL mode, foreign keys, and busy timeout +// - Changing these (e.g., journal_mode, synchronous, locking_mode) can cause corruption +// +// 4. Expect errors after storage.Close() +// - Check storage.IsClosed() before long-running operations if needed +// - Pass contexts with timeouts to prevent hanging on closed connections +// +// 5. Keep write transactions SHORT +// - SQLite has a single-writer lock even in WAL mode +// - Long-running write transactions will block core storage operations +// - Use read transactions (BEGIN DEFERRED) when possible +// +// GOOD PRACTICES: +// +// - Create extension tables with FOREIGN KEY constraints to maintain referential integrity +// - Use the same DATETIME format (RFC3339 / ISO8601) for consistency +// - Leverage SQLite indexes for query performance +// - Test with -race flag to catch concurrency issues +// +// EXAMPLE (creating a VC extension table): +// +// db := storage.UnderlyingDB() +// _, err := db.Exec(` +// CREATE TABLE IF NOT EXISTS vc_executions ( +// id INTEGER PRIMARY KEY AUTOINCREMENT, +// issue_id TEXT NOT NULL, +// status TEXT NOT NULL, +// created_at DATETIME DEFAULT CURRENT_TIMESTAMP, +// FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE +// ); +// CREATE INDEX IF NOT EXISTS idx_vc_executions_issue ON vc_executions(issue_id); +// `) +func (s *SQLiteStorage) UnderlyingDB() *sql.DB { + return s.db +} + +// UnderlyingConn returns a single connection from the pool for scoped use. +// +// This provides a connection with explicit lifetime boundaries, useful for: +// - One-time DDL operations (CREATE TABLE, ALTER TABLE) +// - Migration scripts that need transaction control +// - Operations that benefit from connection-level state +// +// IMPORTANT: The caller MUST close the connection when done: +// +// conn, err := storage.UnderlyingConn(ctx) +// if err != nil { +// return err +// } +// defer conn.Close() +// +// For general queries and transactions, prefer UnderlyingDB() which manages +// the connection pool automatically. +// +// EXAMPLE (extension table migration): +// +// conn, err := storage.UnderlyingConn(ctx) +// if err != nil { +// return err +// } +// defer conn.Close() +// +// _, err = conn.ExecContext(ctx, ` +// CREATE TABLE IF NOT EXISTS vc_executions ( +// id INTEGER PRIMARY KEY AUTOINCREMENT, +// issue_id TEXT NOT NULL, +// FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE +// ) +// `) +func (s *SQLiteStorage) UnderlyingConn(ctx context.Context) (*sql.Conn, error) { + return s.db.Conn(ctx) +} + +// CheckpointWAL checkpoints the WAL file to flush changes to the main database file. +// In WAL mode, writes go to the -wal file, leaving the main .db file untouched. +// Checkpointing: +// - Ensures data persistence by flushing WAL to main database +// - Reduces WAL file size +// - Makes database safe for backup/copy operations +func (s *SQLiteStorage) CheckpointWAL(ctx context.Context) error { + _, err := s.db.ExecContext(ctx, "PRAGMA wal_checkpoint(FULL)") + return err +}