Fixessteveyegge/beads#2725. The --dry-run early return was executing
before the rootOnly override logic, causing dry-run to report all N
issues would be created while the actual run only creates 1 (root).
- Move rootOnly override block above the dryRun check so both paths
see the same rootOnly value
- Update dry-run output to show '1 issue (root only)' with a note
explaining how many child steps were skipped and how to enable them
via pour=true in the formula
- For pour=true formulas, dry-run still reports all issues as before
Co-authored-by: Toast (gastown) <Toast@gastown.local>
Remove Gas Town-specific patrol formula references from bd commands:
- mol_seed.go: Remove --patrol flag and verifyPatrolFormulas(). The seed
command now only verifies individual formulas by name.
- wisp.go: Replace patrol cycle examples with generic operational examples.
- pour.go: Replace patrol cycle reference with generic description.
Patrol formulas (mol-deacon-patrol, mol-witness-patrol, mol-refinery-patrol)
are Gas Town orchestration concerns, not beads core functionality.
Separates "no git history" from "garbage-collectible" for beads stored in the
wisps table. Previously --ephemeral bundled both behaviors, causing agent identity
beads to be incorrectly GC'd.
Changes:
- Add NoHistory field to types.Issue and wisps/issues schema (migration 011)
- Route NoHistory issues to wisps table, skip DOLT_COMMIT, but leave ephemeral=0
- Wire --no-history flag in bd create and bd update (with --history to undo)
- Add --exclude-type flag to bd mol wisp gc
- Add --type filter flag to bd mol wisp list
- Include type and labels in wisp list JSON output
- Move ephemeral/no-history mutual exclusion to validation layer
- Migrate issues between tables when --no-history/--ephemeral set on update
- Fix ExcludeTypes filter self-join subquery inefficiency
- Ensure JSONL export/import roundtrip preserves no_history
- Remove dead AllEphemeral function (superseded by AllWisps)
- Comprehensive test coverage for all new flags and edge cases
Resolves: steveyegge/beads#2619
Refs: steveyegge/gastown#2768
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all BEADS_NO_DAEMON env var handling from test files (dead code
since daemon removal in v0.50.0), delete stopRepoDaemon() and daemon
file guards from test setup, remove no-daemon config key from tests,
and update daemon→server wording in docs and comments.
37 files changed, -193 lines net.
Co-Authored-By: davetashner <davetashner@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three changes to prevent the scenario where an AI agent destroyed 247 issues
by following bd error message suggestions:
1. Error messages no longer suggest bd init when the real problem is server
misconfiguration (wrong port, wrong data dir). Instead they suggest
bd doctor and bd dolt status for diagnosis.
2. bd init --force now counts existing issues and requires typing a
confirmation phrase (destroy N issues) in interactive mode. In
non-interactive mode (AI agents, piped input), it refuses outright
unless --quiet is also set.
3. .beads/.gitignore updated to include dolt-server.port, dolt-server.activity,
and dolt-monitor.pid (already in doctor template but missing from shipped file).
Also pinned Homebrew tap to v0.55.4 - pulled v0.56.1-v0.58.0 from distribution
due to Dolt server data-loss and cross-project leakage bugs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When bd mol wisp gc deletes an abandoned parent formula wisp, its
dependent step children were left behind as permanent orphans. The GC
collected parents by age but DeleteIssues partitioned wisps out before
the cascade expansion logic, so wisp-to-wisp cascade never happened.
Add FindWispDependentsRecursive to DoltStore which does batched BFS
traversal of wisp_dependencies to find all transitive dependents.
Call it from runWispGC to expand the abandoned set before deletion,
ensuring blocked step children are cleaned up with their parents.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wisp creation was materializing child step issues for every formula,
causing ~12 orphan DB rows per patrol cycle. Wisps are vapor (ephemeral)
by definition — child steps should only be materialized when the formula
explicitly sets pour=true (e.g. release workflows needing checkpoint
recovery). Adds Pour field to Formula and TemplateSubgraph types.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the --root-only flag for both 'bd mol wisp create' and
'bd mol wisp <proto>' commands, which creates only the root issue
without materializing child step issues.
This flag is used by 'gt patrol new' to create patrol wisps where
steps are inlined at prime time rather than tracked as individual
beads. Without this flag, gt patrol new fails because it calls
'bd mol wisp create --root-only' which previously was an unrecognized
flag.
Changes:
- Add RootOnly field to CloneOptions in template.go
- Filter child issues in cloneSubgraph when RootOnly is true
- Read --root-only flag in runWispCreate and pass via CloneOptions
- Register --root-only flag on both wispCmd and wispCreateCmd
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Infrastructure types (agent, rig, role, message) were hardcoded in
IsInfraType and duplicated in list.go. Now configurable via DB config
key "types.infra" with config.yaml fallback, following the same pattern
as types.custom. Hardcoded defaults preserved as fallback.
- Add DefaultInfraTypes and IsInfraTypeCtx to ephemeral_routing.go
- Add GetInfraTypes(ctx) to DoltStore with caching
- Add GetInfraTypesFromYAML() to config package
- Update callers in issues.go, list.go, wisp.go to use config-driven API
- Add cache invalidation for types.infra in SetConfig
Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
Infrastructure bead types (agent, rig, role, message) now auto-route to the
wisps table via CreateIssue, keeping the versioned issues table clean for
real work items. This reduces open issue noise from ~298 to ~76 real issues.
Changes:
- IsInfraType() in ephemeral_routing.go for type detection
- CreateIssue routes infra types to wisps automatically
- Wisp GC skips infra types (protected from cleanup)
- bd list excludes infra types by default (--include-infra to show)
- bd list --type=agent routes to wisps table where infra beads live
- Migration 007 moves existing infra beads from issues to wisps
- Schema version bumped to 6 to trigger migration on next write
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove FindJSONLPath, FindJSONLInDir, JSONLExport config field, JSONL
bootstrap detection, post-merge JSONL import hook, and findActualJSONLFile.
Update hasBeadsProjectFiles to check for dolt/ directory instead of JSONL
files. Simplify error messages and hook descriptions to remove JSONL
references. Update comments across types, storage, and doctor subsystem.
29 files changed, -882/+79 lines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert ~250 instances of direct fmt.Fprintf(os.Stderr)+os.Exit(1)
to FatalError/FatalErrorWithHint/FatalErrorRespectJSON across 54 files.
Complex multi-line messages, warnings, loop-internal errors, and
JSON-branching patterns intentionally preserved where the helpers
do not fit cleanly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Batch N+1 query patterns in GetBlockedIssues, GetEpicsEligibleForClosure,
GetMoleculeProgress, and GetStatistics with IN-clause batch operations.
Add per-invocation caching for custom statuses, custom types, and blocked
IDs (invalidated on writes). Introduce storage.ErrNotFound sentinel error
replacing the (nil, nil) not-found pattern across all callers.
Comprehensive unit tests for queries.go and compact.go (2209 new lines).
PR: https://github.com/steveyegge/beads/pull/1874
Author: Steven Syrek <sjsyrek@users.noreply.github.com>
Reviewed-by: beads/crew/jane
Co-Authored-By: Steven Syrek <sjsyrek@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unbounded SearchIssues calls in wisp gc, wisp list, and purge-closed
loaded all ephemeral issues at once, causing sqlite3 OOM on large stores.
Add Limit:5000 to all three filters as Phase 1 mitigation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closed wisps accumulate rapidly and bloat the database. This adds a
--closed flag to wisp gc that uses batch deletion infrastructure for
efficient bulk purge, safe by default (preview-only without --force).
Also upgrades the existing abandoned-wisp deletion from O(n) per-issue
DeleteIssue calls to a single deleteBatch() call.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Code health review found 30+ instances of error suppression using blank
identifier without explanation. Added comments to 82 files explaining WHY
each error is safely ignored (best-effort cleanup, advisory operations,
safe defaults, etc.) to improve code maintainability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
Since daemonClient is always nil (daemon_deprecated.go stub), every
`if daemonClient != nil` branch was dead code. This removes all 171
occurrences across 56 command files, keeping only the direct storage
(else) branches. Also cleans up unused rpc/json/types imports and
fixes variable shadowing issues left behind.
Part of Dolt transition Phase 2 (dolt-test-woho epic).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
These three operations asserted *sqlite.SQLiteStorage but only called
DeleteIssue() which is already on the storage.Storage interface. This
caused hard failures on the Dolt backend. Now they work on any backend.
Closes dolt-test-zlwt, dolt-test-ek44, dolt-test-697r
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
* fix(ready): exclude molecule steps from bd ready by default (GH#1239)
Add ID prefix constants (IDPrefixMol, IDPrefixWisp) to types.go as single
source of truth. Update pour.go and wisp.go to use these constants.
GetReadyWork now excludes issues with -mol- in their ID when no explicit
type filter is specified. Users can still see mol steps with --type=task.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(ready): config-driven ID pattern exclusion (GH#1239)
Add ready.exclude_id_patterns config for excluding IDs from bd ready.
Default patterns: -mol-, -wisp- (molecule steps and wisps).
Changes:
- Add IncludeMolSteps to WorkFilter for internal callers
- Update findGateReadyMolecules and getMoleculeCurrentStep to use it
- Make exclusion patterns config-driven via ready.exclude_id_patterns
- Remove hardcoded MolStepIDPattern() in favor of config
- Add test for custom patterns (e.g., gastown's -role-)
Usage: bd config set ready.exclude_id_patterns "-mol-,-wisp-,-role-"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: remove -role- example from ready.go comments
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: remove GH#1239 references from code comments
Issue references belong in commit messages, not code.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
GetIssue returns (nil, nil) when an issue is not found, but the code
assumed a non-nil issue when err was nil. Added nil checks before
accessing issue fields.
Fixes crash when running `bd mol wisp create` with nonexistent proto.
Closes: gt-2uzn2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New wisps now use 'wisp' segment (e.g., gt-wisp-xxx) instead of 'eph'.
Detection patterns updated to support both for backwards compatibility
with existing gt-eph-* wisps in databases.
🤖 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 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>
Changed all --var flags from StringSlice to StringArray.
StringSlice splits on commas, breaking values like 'desc=A, B, C'.
StringArray only splits on separate --var flags.
Affected commands: pour, cook, wisp, mol distill, mol bond, template instantiate
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Strip (bd-xxx), (gt-xxx) suffixes from code comments and changelog
entries. The descriptions remain meaningful without the ephemeral
issue IDs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wisp operations (mol wisp *, mol burn, mol squash) and commands operating on
ephemeral issue IDs (bd-eph-*, gt-eph-*, eph-*) now auto-bypass the daemon.
Since wisps are ephemeral (Ephemeral=true) and never exported to JSONL,
the daemon cannot help with them anyway. This eliminates the need to manually
add --no-daemon for every wisp operation.
Changes:
- Add isWispOperation() helper to detect wisp commands and ephemeral IDs
- Add FallbackWispOperation constant for daemon status tracking
- Insert wisp detection in PersistentPreRunE daemon connection logic
- Update error messages in wisp.go, mol_burn.go, mol_squash.go
- Add comprehensive unit tests for isWispOperation()
- Add Phase field to Formula type to indicate recommended instantiation phase
- Add warning in 'bd mol pour' when formula has phase="vapor"
- Improve pour/wisp help text with clear comparison of when to use each
- Add CheckPersistentMolIssues doctor check to detect mol- issues in JSONL
- Update beads-release.formula.json with phase="vapor"
This helps prevent accidental persistence of ephemeral workflow issues.
- Add nolint:unparam for readOnly param in sqlite_open.go
- Handle cmd.Help() error in wisp.go
- Handle rows.Close() error in migration 028
- Handle targetStore.Close() error in create.go
- Update Nix vendorHash for current dependencies
Cherry-picked from PR #769
Analysis found these commands are dead code:
- gt never calls `bd pin` - uses `bd update --status=pinned` instead
- Beads.Pin() wrapper exists but is never called
- bd hook functionality duplicated by gt mol status
- Code comment says "pinned field is cosmetic for bd hook visibility"
Removed:
- cmd/bd/pin.go
- cmd/bd/unpin.go
- cmd/bd/hook.go
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The verb 'wisp' fits the chemistry metaphor (pour, bond, burn, squash)
while 'ephemeral' is an adjective. The internal API field remains
'Ephemeral' but the CLI command is now 'bd mol wisp'.
Commands:
bd mol wisp <proto> - create ephemeral wisp
bd mol wisp list - list wisps
bd mol wisp gc - garbage collect old wisps
Major refactor of molecular chemistry to make protos ephemeral:
- Formulas are now cooked directly to in-memory TemplateSubgraph
- No more proto beads stored in the database
Changes:
- cook.go: Add cookFormulaToSubgraph() and resolveAndCookFormula()
for in-memory formula cooking
- template.go: Add VarDefs field to TemplateSubgraph for default
value handling, add extractRequiredVariables() and
applyVariableDefaults() helpers
- pour.go: Try formula loading first for any name (not just mol-)
- wisp.go: Same pattern as pour
- mol_bond.go: Use resolveOrCookToSubgraph() for in-memory subgraphs
- mol_catalog.go: List formulas from disk instead of DB proto beads
- mol_distill.go: Output .formula.json files instead of proto beads
Flow: Formula (.formula.json) -> pour/wisp (cook inline) -> Mol/Wisp
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove resolvePartialIDDirect function and context import that became
dead code after switching to resolveOrCookFormula in bd-rciw.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- bd cook: outputs proto JSON to stdout by default, add --persist flag
for legacy behavior (write to database)
- bd pour: accepts formula names, cooks inline as ephemeral proto,
spawns mol, then cleans up temporary proto
- bd wisp create: accepts formula names, cooks inline as ephemeral proto,
creates wisp, then cleans up temporary proto
- bd mol bond: already supported ephemeral protos (gt-8tmz.25)
The ephemeral proto pattern avoids persisting templates in the database.
Protos are only needed temporarily during spawn operations - the spawned
mol/wisp is what gets persisted.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added type-specific ID prefixes for better visual recognition:
- `bd pour` now generates IDs with "mol-" prefix
- `bd wisp create` now generates IDs with "wisp-" prefix
- Regular issues continue using the configured prefix
Implementation:
- Added IDPrefix field to types.Issue (internal, not exported to JSONL)
- Added Prefix field to CloneOptions for spawning operations
- Added IDPrefix to RPC CreateArgs for daemon communication
- Updated storage layer to use issue.IDPrefix when generating IDs
- Updated pour.go and wisp.go to pass appropriate prefixes
This enables instant visual recognition of entity types and prevents
accidental modification of templates.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wisps are now just issues with Wisp=true flag in the main database,
not exported to JSONL. Removes all references to .beads-wisp/ directory.
- Update docs: CLAUDE.md, CLI_REFERENCE.md, MOLECULES.md, DELETIONS.md
- Update code comments: wisp.go
- Update changelog and info.go version notes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Progress on eliminating separate .beads-wisp/ directory:
- Add --wisp flag to bd create (creates issue with Wisp=true)
- Update bd wisp create to use main db instead of separate wisp storage
- Update bd wisp list to query main db with Wisp filter
- Update bd wisp gc to work with main database
- Add Wisp field to RPC ListArgs for daemon mode support
- Fix terminology: use "old/abandoned" for time-based cleanup,
reserve "stale" for graph-pressure staleness (per Gas Town taxonomy)
Still TODO:
- Finish mol squash simplification (remove cross-store logic)
- Remove runWispSquash and squashWispToPermanent functions
- Update mol burn similarly
- Deprecate .beads-wisp/ functions in internal/beads/beads.go
- Test all changes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove the spawn command from bd mol. Proto instantiation now uses:
- bd pour <proto> - Instantiate as persistent mol (liquid phase)
- bd wisp create <proto> - Instantiate as ephemeral wisp (vapor phase)
Rationale:
- 'spawn' doesn't fit the chemistry metaphor
- Two phase transitions (pour/wisp) are clearer than one command with flags
- Avoids confusion about defaults
Changes:
- Delete mol_spawn.go
- Update mol.go, mol_catalog.go, mol_distill.go to reference pour/wisp
- Update pour.go and wisp.go to remove 'Equivalent to spawn' comments
- Update info.go changelog entries
- Update CHANGELOG.md, ARCHITECTURE.md, DELETIONS.md
Closes bd-8y9t
Modernize sorting code to use Go 1.21+ slices package:
- Replace sort.Slice with slices.SortFunc across 16 files
- Use cmp.Compare for orderable types (strings, ints)
- Use time.Time.Compare for time comparisons
- Use cmp.Or for multi-field sorting
- Use slices.SortStableFunc where stability matters
Benefits: cleaner 3-way comparison, slightly better performance,
modern idiomatic Go.
Part of GH#692 refactoring epic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements wisp management commands for ephemeral molecules:
- bd wisp list: List wisps with stale detection
- bd wisp gc: Garbage collect orphaned wisps
- bd mol burn: Delete wisp without creating digest
Wisps are ephemeral molecules stored in .beads-wisp/ for patrol cycles
and operational loops that shouldn't accumulate in permanent storage.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>