- Add witness, deacon, refinery role templates
- Ignore bd_test binary (bd-test was already ignored)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for JetBrains Junie AI agent:
- Create .junie/guidelines.md with workflow instructions
- Create .junie/mcp/mcp.json for MCP server configuration
- Add 'junie' to BuiltinRecipes in recipes.go
- Add runJunieRecipe() handler in setup.go
- Add website documentation
- Add integrations/junie/README.md
Usage: bd setup junie
Add daemonClient.ResolveID() calls before AddComment and ListComments
operations in daemon mode, following the pattern from update.go.
Previously, short IDs (e.g., "5wbm") worked with most bd commands but
failed with `comments add` and `comments list` when using the daemon.
The short ID was passed directly to the RPC server which expected full
IDs (e.g., "prefix-5wbm").
Changes:
- cmd/bd/comments.go: Add ID resolution before daemon RPC calls
- internal/rpc/comments_test.go: Update tests to reflect client-side
resolution pattern (RPC server expects full IDs, CLI resolves first)
Fixes: https://github.com/steveyegge/beads/issues/1070
Add tests demonstrating that `bd comments add` and `bd comments list`
don't accept short IDs in daemon mode, while other commands do.
Tests added:
- TestCLI_CommentsAddShortID (cli_fast_test.go)
- Tests short ID, partial ID, and comment alias in direct mode (passes)
- TestCommentAddWithShortID (internal/rpc/comments_test.go)
- Tests RPC layer with short ID (FAILS - demonstrates bug)
- TestCommentListWithShortID (internal/rpc/comments_test.go)
- Tests listing comments with short ID (FAILS - demonstrates bug)
The fix should add daemonClient.ResolveID() before AddComment/ListComments,
following the pattern in update.go and label.go.
Refs: https://github.com/steveyegge/beads/issues/1070
Previously, displayGates() always showed 'Open Gates' header even when
closed gates were included via --all flag. Also, closed gates would
appear mixed with open gates under the misleading 'Open Gates' header.
Changes:
- Modified displayGates() to accept showAll parameter
- Separates gates into 'Open Gates' and 'Closed Gates' sections
- Closed gates only shown when --all flag is used
- Fixed handleGateList RPC handler to use ExcludeStatus instead of
Status filter for consistency with CLI behavior
Fixes gas-town issue go-47m
Add multiple layers of defense against misclassified wisps:
- Importer auto-detects -wisp- pattern and sets ephemeral flag
- GetReadyWork excludes -wisp- IDs via SQL LIKE clause
- Doctor check 26d detects misclassified wisps in JSONL
This addresses recurring issue where wisps with missing ephemeral
flag would pollute bd ready output after JSONL import.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add insertIssuesStrict function that uses plain INSERT instead of
INSERT OR IGNORE. Update bulkInsertIssues and transactional CreateIssues
to use the strict variant.
This fixes a race condition where INSERT OR IGNORE could silently skip
duplicate insertions, but the code would still attempt to record events
for those "inserted" issues, causing FOREIGN KEY constraint failures.
The strict INSERT will now fail explicitly if a duplicate is encountered,
which should never happen since checkForExistingIDs runs first within
the same transaction.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add missing reconnectMu.RLock() protection to storage methods that were
vulnerable to the same race condition fixed in GH#607. The FreshnessChecker
can trigger reconnect() which closes s.db while queries are in flight,
causing "database is closed" errors during daemon export operations.
Protected methods:
- labels.go: GetLabelsForIssues (GetLabels intentionally unprotected - called from GetIssue which holds lock)
- comments.go: GetIssueComments, GetCommentsForIssues
- dependencies.go: GetDependencyCounts, GetDependencyRecords, GetAllDependencyRecords, GetDependencyTree, loadDependencyGraph
- config.go: SetConfig, GetConfig, GetAllConfig, DeleteConfig, SetMetadata, GetMetadata
- dirty.go: MarkIssueDirty, GetDirtyIssues, GetDirtyIssueHash, GetDirtyIssueCount
- events.go: GetEvents, GetStatistics, GetMoleculeProgress
- hash.go: All hash methods
- hash_ids.go: GetNextChildID, ensureChildCounterUpdated (getNextChildNumber unprotected - called internally)
Internal helpers called from already-locked contexts intentionally omit
RLock to avoid deadlock (Go's RWMutex doesn't support recursive locking).
Fixes: bd-vx7fp
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
* fix(create): Use prefix from routes.jsonl when creating issues with --rig
When using `bd create --rig <name>`, the prefix from routes.jsonl was
being discarded. This caused issues to be created with the target
database's default prefix instead of the route's prefix.
This is particularly problematic when using the redirect mechanism to
share a single database across multiple rigs - the redirect correctly
routes to the shared database, but the prefix was not being applied.
The fix:
1. Capture the prefix from routing.ResolveBeadsDirForRig()
2. Temporarily override the target database's issue_prefix config
3. Restore the original prefix after issue creation
Example scenario that now works:
- routes.jsonl: {"prefix": "aops-", "path": "src/academicOps"}
- src/academicOps/.beads/redirect points to ~/writing/.beads
- `bd create --rig aops "Test"` now creates aops-xxx instead of ns-xxx
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(create): pass prefix via struct field instead of mutating config
The previous approach temporarily mutated the database's issue_prefix
config during cross-rig issue creation, then restored it afterward.
This was fragile in multi-user scenarios where concurrent operations
could see the wrong prefix.
New approach:
- Add PrefixOverride field to types.Issue
- CreateIssue checks PrefixOverride first, uses it if set
- createInRig sets issue.PrefixOverride instead of mutating config
This passes state as a parameter rather than mutating shared state,
making it safe for concurrent multi-user access.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
RenameDependencyPrefix updates issue IDs in the dependencies table but
was not rebuilding the blocked_issues_cache, leaving stale IDs in the
cache that no longer exist in the issues table.
Add invalidateBlockedCache() call at the end of RenameDependencyPrefix
to rebuild the cache with the new issue IDs.
Fixes: GH#1016
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add QualityScore *float32 field to internal/merge/merge.go to match
internal/types/types.go. Also add last-touched to .beads/.gitignore.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(validation): add failing tests for hyphenated prefix parsing
Reproduces bug where `bd create --parent` fails for projects with
hyphenated prefixes like "bead-me-up" or "web-app".
Root cause: ValidateIDFormat splits on first hyphen, so:
"bead-me-up-3e9.1" → prefix "bead" (wrong, should be "bead-me-up")
The bug flow in create.go:
1. User runs: bd create "Child" --parent bead-me-up-3e9
2. GetNextChildID generates: bead-me-up-3e9.1
3. ValidateIDFormat extracts: "bead" (splits at first hyphen)
4. ValidatePrefix compares: "bead" vs "bead-me-up" → MISMATCH
Tests added:
- TestValidateIDFormat: 6 cases for hyphenated prefix IDs
- TestValidateIDFormat_ParentChildFlow: simulates exact --parent flow,
showing simple prefixes pass while hyphenated prefixes fail
Workaround: use --force flag to bypass prefix validation.
* fix(validation): support hyphenated prefixes in ValidateIDFormat
Use utils.ExtractIssuePrefix instead of naive first-hyphen splitting.
This fixes bd create --parent failing for projects with hyphenated
prefixes like "bead-me-up" or "web-app".
Before: "bead-me-up-3e9" → prefix "bead" (wrong)
After: "bead-me-up-3e9" → prefix "bead-me-up" (correct)
ExtractIssuePrefix uses smart heuristics: split on last hyphen,
check if suffix is hash-like (3-8 chars, alphanumeric, digits for 4+).
* Update internal/validation/bead_test.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Remove duplicate crystallizes column from schema.go
- Add crystallizes to SELECT in transaction.go SearchIssues
- Add crystallizes to SELECT in ready.go GetReadyWork and GetNewlyUnblockedByClose
- Add crystallizes to SELECT in labels.go GetIssuesByLabel
- Add missing placeholder in issues.go INSERT VALUES
- Update migrations_test.go schema to include crystallizes column
Fixes test failures caused by schema/query column count mismatches.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TypeRig IssueType constant for rig identity beads
- Add TypeRig to IsValid() switch statement
- Add IsBuiltIn() method for multi-repo hydration trust checks
- Add Crystallizes field to Issue struct and ComputeContentHash
Fixes validation rejecting documented issue types like 'rig' and 'agent'.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds crystallizes column for work economics (compounds vs evaporates)
per Decision 006. Includes migration 036 and updates to all INSERT/SELECT
queries in issues.go, queries.go, dependencies.go, and transaction.go.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The linear.project_id config was being read and used for filtering
when pulling issues from Linear, but was not being passed when
creating new issues via --push. Now CreateIssue includes projectId
in the mutation input when configured.
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
- multirepo.go: discoverChildTypes now returns []string instead of
([]string, error) since error was always nil
- socket_path.go: tmpDir changed from function to const since it
always returned "/tmp" regardless of platform
Fixes CI lint failures caused by unparam linter detecting unused
error returns and constant function results.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
Tests were failing because beads.FindDatabasePath() follows the
project's .beads/redirect file, causing tests to find unexpected
databases. Fixed by:
- Setting BEADS_DIR in tests that need isolation from git repo detection
- Clearing BEADS_DIR in TestMain to prevent global contamination
- Updating migration test schema to include owner column
This ensures tests work correctly in crew directories that have
redirect files pointing to shared .beads directories.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
Merges schema additions from crew/fang, crew/giles, crew/grip, and crew/wolf:
- crystallizes: bool field for work economics (compounds vs evaporates)
- work_type: WorkType field for assignment model (mutex vs open_competition)
- source_system: string field for federation adapter tracking
- quality_score: *float32 for aggregate quality (0.0-1.0)
- delegated-from: new dependency type for work delegation chains
Migrations properly sequenced as 037-040 (after existing 036 owner_column).
Also fixes test compilation errors for removed TypeRig and IsBuiltIn references.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
Add checkForExistingIDs check to transaction-based batch creation
(sqliteTxStorage.CreateIssues) before calling insertIssues. This
prevents INSERT OR IGNORE from silently skipping duplicate IDs,
which would cause FK constraint failures when recording events
for issues that weren't actually inserted.
Also fixes unrelated test bug: renamed parseCommaSeparated to
parseCommaSeparatedList in validators_test.go.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add two tests to verify that issue blocking/dependencies are enforced
when closing issues via the RPC handler:
- TestHandleClose_BlockerCheck: Verifies closing a blocked issue fails
when blocker is still open, and --force flag overrides the check
- TestHandleClose_BlockerCheck_ClosedBlocker: Verifies close succeeds
once the blocking issue is closed
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TypeRig constant to IssueType enum
- Add IsBuiltIn() method to IssueType for multi-repo hydration trust logic
- Fix parseCommaSeparated -> parseCommaSeparatedList function name in test
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new DependencyType 'attests' for skill attestations. Enables:
Entity X attests that Entity Y has skill Z at level N.
- Add DepAttests constant to dependency types
- Add AttestsMeta struct for skill, level, date, evidence, notes
- Update IsWellKnown() to include attests
- Add test cases for the new edge type
Foundation for HOP skill portability.
Closes: bd-2papc
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
Add 'owner' field to Issue struct for tracking the human responsible
for the issue, distinct from 'created_by' which tracks the executor.
Owner is populated from git author email (GIT_AUTHOR_EMAIL or git
config user.email), per Decision 008 for CV accumulation.
Changes:
- Add Owner field to types.Issue with omitempty JSON tag
- Include Owner in content hash computation
- Add owner column migration (036_owner_column.go)
- Update all SQL queries to include owner field
- Add getOwner() helper using git author email fallback chain
- Populate owner in bd create command
- Add owner to RPC CreateArgs protocol
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
* fix: respect hierarchy.max-depth config setting (GH#995)
The hierarchy.max-depth config setting was being ignored because storage
implementations had the depth limit hardcoded to 3. This fix:
- Registers hierarchy.max-depth default (3) in config initialization
- Adds hierarchy.max-depth to yaml-only keys for config.yaml storage
- Updates SQLite and Memory storage to read max depth from config
- Adds validation to reject hierarchy.max-depth values < 1
- Adds tests for configurable hierarchy depth
Users can now set deeper hierarchies:
bd config set hierarchy.max-depth 10
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: extract shared CheckHierarchyDepth function (GH#995)
- Extract duplicated depth-checking logic to types.CheckHierarchyDepth()
- Update sqlite and memory storage backends to use shared function
- Add t.Cleanup() for proper test isolation in sqlite test
- Add equivalent test coverage for memory storage backend
- Add comprehensive unit tests for CheckHierarchyDepth function
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
reqCtx() now applies the server's requestTimeout (default 30s) to the
context returned for request handlers. This prevents bd list and other
commands from hanging indefinitely when database operations stall.
The fix ensures:
- All RPC handlers get a context with a deadline
- Database operations (using QueryContext) honor context cancellation
- reconnectMu read locks are released when context times out
Fixes: bd-p76kv
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
Same fix as PR #991 for FindBeadsDir() - the loop condition
dir != "/" && dir != "." doesn't handle Windows drive roots.
On Windows, filepath.Dir("C:\\") returns "C:\\", not "/" or ".".
Changed both functions to check parent == dir to detect filesystem root,
which works correctly on both Unix and Windows.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
On Unix systems, socket paths are limited to 104 chars (macOS) or 108 chars
(Linux). Deep workspace paths like /Volumes/External Drive/Dropbox/...
would exceed this limit and cause daemon startup failures.
This fix:
- Adds ShortSocketPath() which computes /tmp/beads-{hash}/bd.sock for
paths that would exceed the limit
- Keeps backward compatibility: short paths still use .beads/bd.sock
- Updates daemon discovery to check both locations
- Uses SHA256 hash of canonical workspace path for unique directories
Closes GH#1001
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use SearchIssues with filter.IDs instead of GetIssue in ResolvePartialID.
This fixes inconsistencies where bd list could find issues that bd show
could not, due to subtle query differences between the two code paths.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
On Windows, the daemon stop command was failing with "exit status 1" because
`taskkill` without `/F` flag does not work for console processes that do not
have windows to receive close messages.
Changes:
- Use `os.Process.Kill()` which calls Windows `TerminateProcess` API
- This is the reliable way to terminate processes on Windows
- The graceful RPC shutdown is already attempted before falling back to kill
- Updated error messages to be platform-agnostic (removed SIGTERM/SIGKILL)
The fix uses Go cross-platform process APIs instead of shelling out to
external commands, which is more reliable and portable.
Closes#992
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Auto-detect WSL2 environment with Windows filesystem paths (/mnt/c/, etc.)
and fall back to DELETE journal mode instead of WAL. SQLite WAL mode
does not work reliably across the WSL2/Windows 9P filesystem boundary
due to shared-memory limitations.
Detection checks:
1. Path matches /mnt/[a-z]/ pattern (Windows drive mount)
2. /proc/version contains microsoft or wsl
Fixes#920
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
The sync command was closing the daemon connection without initializing
the direct store, leaving store=nil. This caused errors in post-checkout
hook when running bd sync --import-only.
Fixed by using fallbackToDirectMode() which properly closes daemon and
initializes the store.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root cause: CreateIssue used INSERT OR IGNORE which could silently skip
the insert (e.g., on duplicate ID from hash collision), then fail with
FOREIGN KEY constraint error when trying to record the creation event.
Fix: Add insertIssueStrict() that uses plain INSERT (fails on duplicates)
and use it for CreateIssue in both queries.go and transaction.go. The
existing insertIssue() with INSERT OR IGNORE is preserved for import
scenarios where duplicates are expected.
Added test TestCreateIssueDuplicateID to verify duplicate IDs are properly
rejected instead of silently ignored.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added IsBlocked method to Storage interface that checks if an issue is
in the blocked_issues_cache and returns the blocking issue IDs.
The close command now checks for blockers before allowing an issue to
be closed:
- If an issue has open blockers, closing is blocked with an error message
- The --force flag overrides this check
- Works in both daemon mode (RPC) and direct storage mode
- Also handles cross-rig routed IDs
This addresses the bug where agents could close a bead even when it
depends on an open bug/issue.
Closes#962
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
v0.46.0 removed these types breaking gt install/doctor/sling/convoy commands.
This restores them as built-in types so `bd create --type=agent` works again.
Fixes GH#941
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements federation trust model for multi-repo type validation:
- Built-in types are validated (catch typos)
- Non-built-in types trusted from source repos
Changes:
- Add IssueType.IsBuiltIn() method
- Add Issue.ValidateForImport() for trust-based validation
- Update upsertIssueInTx to use ValidateForImport
Closes: bd-dqwuf, bd-alpw2 | Epic: bd-9ji4z
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Two issues caused `bd migrate sync` to fail when run from a git worktree:
1. Used GetGitDir() instead of GetGitCommonDir() for worktree path
- GetGitDir() returns the worktree-specific path (.bare/worktrees/main)
- GetGitCommonDir() returns the shared git dir (.bare) where new
worktrees can actually be created
2. Used strings.Index instead of LastIndex in GetRepoRoot()
- When user paths contain "worktrees" (e.g., ~/Development/worktrees/),
Index finds the first occurrence and incorrectly strips the path
- LastIndex finds git's internal /worktrees/ directory
Added GetGitCommonDir() to internal/git/gitdir.go for reuse.
Fixes GH#639 (remaining unfixed callsite in migrate_sync.go)
Add AllowStale field to ListArgs struct to support resilient hook detection.
When set, callers signal they accept potentially stale data rather than
failing on staleness check errors.
This enables gastown checkSlungWork() to fall back gracefully when the
beads database is out of sync with JSONL (common after concurrent agent syncs).
- Add AllowStale bool to ListArgs in internal/rpc/protocol.go
- Pass --allow-stale flag through to RPC in cmd/bd/list.go
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew
bd list --tree:
- Use actual parent-child dependencies instead of dotted ID hierarchy
- Treat epic dependencies as parent-child relationships
- Sort children by priority (P0 first)
- Fix tree display in daemon mode with read-only store access
bd graph:
- Add --all flag to show dependency graph of all open issues
- Add --compact flag for tree-style rendering (reduces 44+ lines to 13)
- Fix "needs:N" cognitive noise by using semantic colors
- Add blocks:N indicator with semantic red coloring
bd show:
- Tufte-aligned header with status icon, priority, and type badges
- Add glamour markdown rendering with auto light/dark mode detection
- Cap markdown line width at 100 chars for readability
- Mute entire row for closed dependencies (work done, no attention needed)
Design system:
- Add shared status icons (○ ◐ ● ✓ ❄) with semantic colors
- Implement priority colors: P0 red, P1 orange, P2 muted gold, P3-P4 neutral
- Add TrueColor profile for distinct hex color rendering
- Type badges for epic (purple) and bug (red)
Design principles:
- Semantic colors only for actionable items
- Closed items fade (muted gray)
- Icons > text labels for better scanability
Co-Authored-By: SageOx <ox@sageox.ai>
Reviewed by beads/crew/wolf. Fixes daemon mode silently ignoring --due and --defer flags. Adds comprehensive tests including TestDualPathParity for regression prevention.
The daemon's handleCreate was parsing DueAt but ignoring the DeferUntil
field from CreateArgs. This caused --defer flag to be silently dropped
when using daemon mode.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add project_id filter for Linear sync
When linear.project_id is configured, bd linear sync will only fetch issues
belonging to that project instead of all team issues.
Closes#937
In contributor mode (bd init --contributor), .beads/ is excluded in
.git/info/exclude to prevent committing upstream issue databases.
However, this exclusion applies to ALL worktrees, including the sync
worktree where .beads/ must be committed.
The fix adds -f flag to git add in commitInWorktree() to force-add
files even when gitignored. This follows the existing pattern in
beads where -f is used for worktree operations (git worktree add -f).
Fixes: bd sync failing with "git add failed in worktree: exit status 1"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove Gas Town-specific issue types (agent, role, rig, convoy, slot)
from beads core. These types are now identified by labels instead:
- gt:agent, gt:role, gt:rig, gt:convoy, gt:slot
Changes:
- internal/types/types.go: Remove TypeAgent, TypeRole, TypeRig, TypeConvoy, TypeSlot constants
- cmd/bd/agent.go: Create agents with TypeTask + gt:agent label
- cmd/bd/merge_slot.go: Create slots with TypeTask + gt:slot label
- internal/storage/sqlite/queries.go, transaction.go: Query convoys by gt:convoy label
- internal/rpc/server_issues_epics.go: Check gt:agent label for role_type/rig label auto-add
- cmd/bd/create.go: Check gt:agent label for role_type/rig label auto-add
- internal/ui/styles.go: Remove agent/role/rig type colors
- cmd/bd/export_obsidian.go: Remove agent/role/rig/convoy type tag mappings
- Update all affected tests
This enables beads to be a generic issue tracker while Gas Town
uses labels for its specific type semantics.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/dave
Rig: beads
Role: crew