Add .beads/config.yaml support for template validation settings:
- validation.on-create: warn|error|none (default: none)
- validation.on-sync: warn|error|none (default: none)
When set to "warn", issues missing required sections (based on type) show
warnings but operations proceed. When set to "error", operations fail.
Implementation:
- Add validation keys to YamlOnlyKeys in yaml_config.go
- Add defaults in config.go
- Wire up bd create to check validation.on-create config
- Wire up bd sync to run validation before export
- Add tests for config loading
- Update CONFIG.md documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This implements Phase 1 of the Step.Gate feature (bd-7zka.2):
- bd cook now creates gate issues for steps with gate fields
- Gate issues have type=gate and block the gated step via dependency
- bd list filters out gate issues by default (use --include-gates to show)
- New bd gate command with list and resolve subcommands
Gate types supported in Phase 1:
- human: Manual closure via bd close or bd gate resolve
Implementation details:
- createGateIssue() in cook.go creates gate issues with proper metadata
- collectSteps() creates gate dependencies when processing gated steps
- IssueFilter.ExcludeTypes added to storage layer for type-based filtering
- Gate command provides dedicated UX for gate management
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add opt-in strict mode that fails creation if required sections are
missing. Uses ValidateTemplate() under the hood.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Checks issues for missing recommended sections based on type:
- bd lint # Lint all open issues
- bd lint bd-xxx # Lint specific issue
- bd lint --type bug # Filter by type
- bd lint --json # JSON output for CI
Supports both daemon and direct mode. Exit code 1 when warnings found.
Part of opt-in validation epic (bd-ou35).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The close command now properly routes to different beads directories
based on issue ID prefix, matching the behavior of bd show/update.
Changes:
- Check needsRouting() for each ID in both daemon and direct mode
- Handle routed IDs via resolveAndGetIssueWithRouting()
- Close issues in the correct remote store
Fixes bd-3jrb
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds --pretty flag to bd ready for consistency with bd list.
Uses the same displayPrettyList() function to show issues in
a tree format with status/priority symbols.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The bd update command now checks needsRouting() before attempting daemon
RPC resolution. When an issue ID (like hq-eggh5) routes to a different
beads directory, the update bypasses the daemon and uses direct mode with
the routed storage.
This enables polecats in gastown to update HQ beads (hq-* prefix) and
vice versa. The fix mirrors the routing pattern already used by bd show.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Two fixes for bare repo worktree setups:
1. fork_protection.go: Use git.GetGitDir() instead of hardcoding .git
In worktrees, .git is a file containing gitdir path, not a directory.
Using GetGitDir() handles this correctly.
2. sync_git.go: Simplify gitHasBeadsChanges to use absolute paths
The previous code used git -C main-repo-root status, but in bare
repo worktrees GetMainRepoRoot() returns the parent of the bare repo
which is not a valid working tree. Using absolute paths without -C
lets git find the repo from cwd, which always works.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The last-touched file was accidentally removed from GitignoreTemplate
in commit 310d374 (GH#814 fix). This restores it and adds it to
requiredPatterns so bd doctor will detect outdated gitignores.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add --notes flag to bd create command, enabling agents to set notes
during issue creation instead of requiring a separate update command.
Motivation: AI agents repeatedly tried to use --notes with bd create.
Context is fresh at creation time - forcing a two-step process means
context loss or workflow interruption.
Changes:
- cmd/bd/flags.go: Added --notes flag to common issue flags
- cmd/bd/create.go: Read and pass notes in both RPC and direct modes
- cmd/bd/update.go: Removed duplicate --notes flag definition
- internal/rpc/protocol.go: Added Notes field to CreateArgs
- internal/rpc/server_issues_epics.go: Process Notes in handleCreate
- cmd/bd/create_notes_test.go: Comprehensive test coverage
- website/docs/cli-reference/issues.md: Documentation
Also adds gitignore entries for Augment AI and .beads/redirect.
Co-authored-by: Leon Letto <lettol@vmware.com>
The fork protection logic incorrectly treated all repos where
origin != steveyegge/beads as forks, including user's own projects
that just use beads as a tool.
Changes:
- Add isForkOfBeads() that scans ALL remotes for steveyegge/beads
- Only apply protection when a beads-related remote exists
- Add git config opt-out: `git config beads.fork-protection false`
(per-clone, never tracked, matches beads.role pattern)
Test coverage for 8 scenarios plus edge cases for config values.
Adds #nosec G204 annotations to exec.Command calls that use
hardcoded paths. Fixes pre-existing lint failure exposed by PR #832.
🤖 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
* test(daemon): Prove autoPull reads sync.branch from SQLite
- Verify daemon reads sync.branch from SQLite config source
- Show config.yaml sync-branch is ignored (YAML-only key)
- Add skipped tracer bullet test for issue #831
Coverage: daemon autoPull config resolution
* fix(daemon): Use syncbranch.IsConfigured() for autoPull
Problem:
- Daemon's periodic sync never activated when sync-branch configured in config.yaml
- autoPull check only read sync.branch from SQLite, missing YAML-only configuration
Solution:
- Replace SQLite-only check with syncbranch.IsConfigured()
- Update test to validate correct detection of YAML-configured sync branch
Impact:
- Periodic sync now activates correctly when sync-branch is configured in config.yaml
- Fixes daemon hanging issue for users with YAML-only configuration
When .beads/redirect exists, bd sync was using GetRepoRoot(cwd) to find
the git worktree location. This failed because the worktree should be
in the same repo as the beads directory, not the current working directory.
Fix: Use getRepoRootFromPath(beadsDir) to derive the repo root from
the actual beads location after following the redirect.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds closed_by_session tracking for entity CV building per Gas Town
decision 009-session-events-architecture.md.
Changes:
- Add ClosedBySession field to Issue struct
- Add closed_by_session column to issues table (migration 034)
- Add --session flag to bd close command
- Support CLAUDE_SESSION_ID env var as fallback
- Add --session flag to bd update for status=closed
- Display closed_by_session in bd show output
- Update Storage interface to include session parameter in CloseIssue
🤖 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
For molecules with >100 steps, shows summary instead of full step list:
- Counts children first using efficient GetMoleculeProgress query
- Shows progress summary with pointer to bd mol progress
- Add --limit flag to cap output (e.g., --limit 50)
- Add --range flag for specific ranges (e.g., --range 1-50)
Also closes epic bd-5nu1 (mega-molecule progress support).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace findInProgressMolecules (which loads full subgraphs) with
findInProgressMoleculeIDs (which only returns IDs). This ensures
auto-discovery is efficient for mega-molecules.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root cause: When a bd daemon crashes, its daemon.lock file remains with
the old PID. If that PID gets reused by an unrelated process, the code
would wait 5 seconds for a socket that will never appear.
Fix: Use flock-based check as authoritative source for daemon liveness.
The OS releases flocks when a process dies, so this is immune to PID reuse.
Changes:
- handleExistingSocket: Check daemon flock before waiting for socket
- acquireStartLock: Verify daemon lock is held before waiting
- handleStaleLock: Use flock check to detect stale startlocks
- lockfile/process_*.go: Add pid <= 0 check to prevent false positives
(PID 0 signals process group on Unix, not a specific process)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Warn if source issue is already closed
- Copy all issue fields (SourceRepo, Ephemeral, MolType, RoleType, Rig)
- Log warnings on label copy failures instead of silently ignoring
- Schedule auto-flush when source is local store
- Remove stale comment
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Users with conflicting git hooks (e.g., hooks that read the staging
area like GGA) can now set BEADS_NO_AUTO_STAGE=1 to disable auto-staging
and get check-and-block behavior instead.
Default behavior unchanged - auto-staging still works for most users.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new `bd mol progress` command that shows molecule progress using
indexed queries instead of loading all steps into memory. This makes it
suitable for mega-molecules with millions of steps.
Features:
- Efficient SQL-based counting via idx_dependencies_depends_on_type index
- Progress display: completed / total (percentage)
- Current step identification
- Rate calculation from closure timestamps
- ETA estimation
- JSON output support
New storage interface method: GetMoleculeProgress(ctx, moleculeID)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements `bd refile <source-id> <target-rig>` which:
- Gets source issue via routing
- Creates new issue in target rig with same content
- Closes source with "Refiled to <new-id>"
- Appends "(Refiled from <old-id>)" to description
Target rig accepts rig names (beads), prefixes (bd-), or prefix shorthand (bd).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code review found that deleteBatchFallback was missing the text
reference update step (replacing "issue-id" with "[deleted:issue-id]"
in connected issues). This aligns the fallback path with the SQLite
batch delete behavior.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add CreateTombstone() to MemoryStorage and deleteBatchFallback() to
handle deletion when SQLite is not available. This fixes the error
"tombstone operation not supported by this storage backend" when
using bd delete with --no-db flag.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merge PR #819 from justbry with improvements:
- Add --format obsidian option to bd export
- Generate Obsidian Tasks-compatible markdown
- Default output to ai_docs/changes-log.md
- Map status to checkboxes, priority to emoji, type to tags
- Support parent-child hierarchy with indentation
- Use official Obsidian Tasks format (🆔, ⛔ emojis)
Improvement over PR: replaced O(n²) bubble sort with slices.SortFunc
for date ordering.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: justbry <justbu42@proton.me>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add compile-time step filtering based on formula variables:
- New EvaluateStepCondition function for {{var}} truthy and equality checks
- FilterStepsByCondition to exclude steps based on conditions
- Integration into pour, wisp, and mol bond commands
- Supports: {{var}}, {{var}} == value, {{var}} != value
Steps with conditions that evaluate to false are excluded from the
cooked formula, along with their children.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Implement runVersionSyncCheck() to compare version.go and default.nix
- Reports version mismatch as hard failure
- Gracefully skips if default.nix is missing
- Fix version mismatch: update default.nix from 0.37.0 to 0.42.0
🤖 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
- Add Warning field to CheckResult for soft failures
- Implement runNixHashCheck() that detects go.sum changes
- Warnings (⚠) shown separately from failures (✗)
- Warnings don't fail the overall preflight result
- Summary shows warning count separately
- Add test for warning state
🤖 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
- Add Skipped field to CheckResult for graceful handling of missing tools
- Implement runLintCheck() that runs golangci-lint run ./...
- Skip lint check gracefully if golangci-lint not in PATH
- Update summary to show skipped count separately
- Add test for skipped state
🤖 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
Fix test file to match the actual preflight.go implementation:
- Remove capitalizeFirst test (function doesn't exist)
- Rename PreflightResults -> PreflightResult
- Update truncation test to use actual truncateOutput function
- Update test data to match current Name format
🤖 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
- Add CheckResult and PreflightResults structs for check outcomes
- Implement runTestCheck() to execute go test -short ./...
- Wire up --check flag to actually run tests instead of placeholder
- Add ✓/✗ output formatting with command and truncated output
- Support --json flag for programmatic consumption
- Exit with non-zero code when tests fail
- Add tests for new preflight functionality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
bd cook previously treated its argument as a file path only. Now it first
tries to load by name from the formula registry (.beads/formulas/), and
only falls back to parsing as a file path if that fails.
This enables commands like `bd cook beads-release` to work without
specifying the full path to the formula file.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When .beads/redirect points to another location that crosses directory
boundaries, isExternalBeadsDir() can return true even when both paths
are in the same git repo. Previously, this would trigger the direct
commit mode, bypassing the configured sync.branch workflow.
Now we check hasSyncBranchConfig before entering the external path.
When sync.branch is configured, we skip direct-commit mode and use
the sync.branch worktree workflow instead, which properly handles
copying JSONL files regardless of where the source .beads lives.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Two fixes:
1. `bd init` chaining was broken - the code referenced `.old` hooks but
never actually renamed the existing hooks. Added the missing os.Rename().
2. `bd hooks install` now supports --chain flag to chain with existing hooks
(e.g., pre-commit framework). When used, existing hooks are renamed to
.old and bd hooks run will call them before the bd logic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add redirect to GitignoreTemplate with explanatory comment
- Add redirect to requiredPatterns for outdated gitignore detection
- Add CheckRedirectNotTracked() to detect already-tracked redirect files
- Add FixRedirectTracking() to untrack via git rm --cached
- Register check in bd doctor under Git Integration category
- Add 6 tests for the new functionality
The redirect file contains a relative path that only works in the
original worktree. When committed, it causes warnings in other clones:
"Warning: redirect target does not exist"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Follow-up to #812 fix. When useSyncBranch is true, we always call
CommitToSyncBranch (bypassing gitHasBeadsChanges). If the worktree
has no actual changes, we now show "→ No changes to commit" for
consistent UX with the non-sync-branch code path.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TestSet cases for main/master rejection in syncbranch_test.go
- Add TestInitWithSyncBranch to verify --branch flag works
- Add TestInitWithoutBranchFlag to verify no auto-detection (root cause)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Scaffolds bd preflight for PR readiness checks. Currently prints a
static checklist of common pre-PR validation items:
- Tests pass
- Lint passes
- No beads pollution
- Nix hash current
- Version sync
--check and --fix flags are documented but not yet implemented
(see bd-lfak.2 through bd-lfak.5 for roadmap).
(bd-lfak.1)
Cherry-picked from polecat/amber-1767146829144
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The root cause was isExternalBeadsDir() incorrectly identifying bare repo
worktrees as "external" repos. This caused bd sync to take the "external
beads dir" code path instead of the worktree-based sync branch path.
The bug: isExternalBeadsDir() compared syncbranch.GetRepoRoot() (which returns
incorrect values for bare repo worktrees) with getRepoRootFromPath() (which
uses --show-toplevel). These returned different values for bare repo
worktrees, causing local worktrees to be treated as external.
The fix: Use git rev-parse --git-common-dir for comparison instead of repo
root. This correctly identifies that worktrees of the same repo share the
same git directory, regardless of bare repo setup.
Also added:
- getGitCommonDir() helper function
- Tests for both getGitCommonDir and isExternalBeadsDir
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds atomic claim operation for work queue messages:
- New --claim flag on bd update command
- Sets assignee to claimer and status to in_progress
- Fails with clear error if already claimed by someone else
- Works in both daemon and direct modes
- Includes comprehensive tests for claim functionality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When using sync-branch with aggressive gitignore on code branches
(.beads/* ignored), gitHasBeadsChanges() returns false because git
does not track the files. This caused bd sync to skip CommitToSyncBranch
entirely, even though CommitToSyncBranch has its own internal change
detection that checks the worktree where gitignore is different.
The fix bypasses gitHasBeadsChanges when useSyncBranch is true, letting
CommitToSyncBranch determine if there are actual changes in the worktree.
Closes#812🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Completes the work from #813 by actually calling the new functions:
- Add Check 14b in doctor.go for redirect file tracking detection
- Add Redirect Not Tracked case in doctor_fix.go switch statement
Without this wiring, bd doctor would not detect or fix already-tracked
redirect files, only prevent new ones via the updated .gitignore template.
🤖 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
When bd worktree creates a worktree, it writes a .beads/redirect file
pointing back to the main repo's .beads/. If this file is accidentally
committed (e.g., via git add .), it causes "redirect target does not exist"
warnings when cloned or used in other worktrees.
Changes:
- Add 'redirect' to GitignoreTemplate to prevent future accidental commits
- Add 'redirect' to requiredPatterns so bd doctor detects outdated .gitignore
- Add CheckRedirectNotTracked() to detect already-tracked redirect files
- Add FixRedirectTracking() to untrack accidentally committed redirects
Tests: 8 new tests covering template, detection, and fix scenarios
The prefix mismatch check in bd doctor was reporting warnings when
issues were created via molecule workflows (bd mol pour), which
intentionally use a different prefix pattern (<base>-mol instead
of just <base>).
Added recognition of valid workflow prefix variants:
- <prefix>-mol (molecules from bd mol pour)
- <prefix>-wisp (ephemeral wisps)
- <prefix>-eph (ephemeral issues)
These are intentional prefix extensions for visual distinction, not
actual mismatches. The check now only warns for truly mismatched
prefixes (e.g., different project entirely).
Added comprehensive regression tests for all prefix variant cases.
Fixes#811
Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>