Commit Graph

3989 Commits

Author SHA1 Message Date
Steve Yegge
dd0fb7ce90 Remove bd mol run - orchestration belongs in gt
bd mol run was a convenience combo (pour + assign + pin + start) that
felt like orchestration but lived in the data layer. This blurred the
architectural boundary between bd (data) and gt (orchestration).

- Delete cmd/bd/mol_run.go entirely
- Update mol.go help text to remove run reference
- Update mol_current.go to suggest bd pour instead

gt spawn will implement the orchestration combo by calling the atomic
bd commands (pour, update, pin) directly.

Closes bd-00u3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:05:16 -08:00
Steve Yegge
812832496c bd sync: 2025-12-25 01:05:06 2025-12-25 01:05:06 -08:00
Steve Yegge
8b6a8cf8f8 bd sync: 2025-12-25 00:59:25 2025-12-25 00:59:37 -08:00
Steve Yegge
c429405e0d fix: mol run loads all hierarchical children + supports title lookup (bd-c8d5, bd-drcx)
Two issues fixed:

1. bd-c8d5: mol run only created partial children from proto
   - Root cause: children with missing/wrong dependencies were not loaded
   - Fix: loadDescendants now uses two strategies:
     - Strategy 1: Check dependency records for parent-child relationships
     - Strategy 2: Find hierarchical children by ID pattern (parent.N)
   - This catches children that may have broken dependency data

2. bd-drcx: mol run now supports proto lookup by title
   - Can use: bd mol run mol-polecat-work --var issue=gt-xxx
   - Or by ID: bd mol run gt-lwuu --var issue=gt-xxx
   - Title matching is case-insensitive and supports partial matches
   - Shows helpful error on ambiguous matches

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 23:33:34 -08:00
Steve Yegge
81171ff237 bd sync: 2025-12-24 23:32:27 2025-12-24 23:32:27 -08:00
Steve Yegge
fecbc5be76 bd sync: 2025-12-24 23:12:58 2025-12-24 23:12:58 -08:00
Steve Yegge
a1a4341b41 bd sync: 2025-12-24 22:41:46 2025-12-24 22:42:10 -08:00
Steve Yegge
2a6191e49b fix: use content-level merge for divergence recovery (bd-kpy)
Replace fetchAndRebaseInWorktree with contentMergeRecovery in pushFromWorktree.

The problem: When push fails due to non-fast-forward, the old code used git
rebase to recover. But git rebase is text-level and does not invoke the JSONL
merge driver. This could resurrect tombstones - if remote had a tombstone and
local had closed, the rebase would overwrite the tombstone.

The fix: Use the same content-level merge algorithm that PullFromSyncBranch
uses. This respects tombstone semantics - recent tombstones always win over
live issues.

Changes:
- Add contentMergeRecovery() that does content-level merge instead of rebase
- Update pushFromWorktree to call contentMergeRecovery
- Mark fetchAndRebaseInWorktree as deprecated (kept for reference)
- Add tests for tombstone preservation during merge recovery

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:41:40 -08:00
Steve Yegge
5a46879741 refactor: remove deprecated .beads-wisp directory support (bd-bkul)
Wisps now use Wisp=true flag in the main database. The separate
.beads-wisp/ directory is no longer needed.

Removed:
- WispDirName constant
- FindWispDir()
- FindWispDatabasePath()
- NewWispStorage()
- EnsureWispGitignore()
- IsWispDatabase()
- All related tests
- .beads-wisp/ from .gitignore
2025-12-24 21:30:20 -08:00
Steve Yegge
94c3fa2b29 fix: filter wisps from nodb writeIssuesToJSONL (bd-9avq) 2025-12-24 21:19:00 -08:00
Steve Yegge
ba6f1f5e5e bd sync: 2025-12-24 21:18:49 2025-12-24 21:18:49 -08:00
Steve Yegge
358eed70bd bd sync: 2025-12-24 21:17:16 2025-12-24 21:17:16 -08:00
Steve Yegge
204e8e66c7 bd sync: 2025-12-24 21:16:04 2025-12-24 21:16:04 -08:00
Steve Yegge
3c14ec7bf7 bd sync: 2025-12-24 21:02:59 2025-12-24 21:03:56 -08:00
Steve Yegge
53d905aa7a bd sync: 2025-12-24 20:43:10 2025-12-24 21:03:56 -08:00
Steve Yegge
12bd2e4963 bd sync: 2025-12-24 20:07:54 2025-12-24 21:03:56 -08:00
Steve Yegge
c3b971e639 bd sync: 2025-12-24 20:00:04 2025-12-24 21:03:56 -08:00
Steve Yegge
9f8b3478fd fix: filter wisps from sync_export.go (bd-687g)
The sync command's exportToJSONL function was not filtering wisps,
causing them to be re-added to JSONL during bd sync re-export step.

autoflush.go had wisp filtering but sync_export.go did not. Added
the same filtering logic to prevent wisps from being exported to JSONL.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:55:31 -08:00
Steve Yegge
f2e6df95c0 refactor: simplify wisp architecture - single DB with Wisp flag (bd-bkul)
- Remove cross-store squash logic from mol_squash.go
  - Delete runWispSquash() and squashWispToPermanent() functions
  - Simplify runMolSquash() to work with main store only

- Update mol_burn.go to work with main database
  - Remove .beads-wisp/ directory references
  - Look for Wisp=true issues in main store instead

- Update mol_bond.go to use Wisp flag instead of separate store
  - --wisp now creates issues with Wisp=true in main store
  - --pour creates issues with Wisp=false (persistent)
  - Update bondProtoMol signature to accept both flags

- Deprecate wisp storage functions in beads.go
  - WispDirName, FindWispDir, FindWispDatabasePath
  - NewWispStorage, EnsureWispGitignore, IsWispDatabase
  - All marked deprecated with reference to bd-bkul

- Remove obsolete cross-store squash tests
  - TestSquashWispToPermanent
  - TestSquashWispToPermanentWithSummary
  - TestSquashWispToPermanentKeepChildren

All tests pass. Build succeeds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:42:54 -08:00
Steve Yegge
c0271aedbf wip: simplify wisp architecture - single db with Wisp flag (bd-bkul)
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>
2025-12-24 20:31:27 -08:00
Steve Yegge
5f16d10634 docs: rewrite MOLECULES.md with workflow-first structure (bd-ul59)
Completely rewrote the molecular chemistry doc to be more practical:
- Start with execution semantics (what users care about)
- TL;DR section at top with 5 key concepts
- Explain dependency types and blocking behavior
- Clarify molecules = epics (no special types needed)
- Move chemistry metaphor to secondary section
- Add common patterns (sequential, fanout, dynamic bonding)
- Keep agent pitfalls and quick reference

The doc now reads like a reference manual with examples rather than
a philosophical treatise on work composition.

Filed gt-qe9w for Gas Town docs to follow same pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 19:52:01 -08:00
Steve Yegge
5e971bd90a docs: add molecular chemistry documentation (bd-ul59)
Create docs/MOLECULES.md with comprehensive coverage of:
- Layer cake architecture (formulas → protos → molecules → epics → issues)
- Phase metaphor (solid/proto, liquid/mol, vapor/wisp)
- Phase transitions (pour, wisp create, squash, burn)
- Bonding patterns (proto+proto, proto+mol, mol+mol)
- Agent pitfalls (temporal language, forgetting to squash)
- Orphan vs stale matrix
- Progress tracking (computed, not stored)
- Parallelism model (default parallel, opt-in sequential)

Update CLI_REFERENCE.md with Molecular Chemistry section covering:
- Proto/template commands
- Pour command
- Wisp commands
- Bonding commands
- Squash and burn commands

Update ARCHITECTURE.md with cross-reference to new MOLECULES.md.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 19:31:14 -08:00
Steve Yegge
fbae7711bc bd sync: 2025-12-24 19:31:04 2025-12-24 19:31:04 -08:00
Steve Yegge
4668240495 bd sync: 2025-12-24 18:30:11 2025-12-24 18:30:11 -08:00
Steve Yegge
5eacec482d bd sync: 2025-12-24 18:24:08 2025-12-24 18:24:08 -08:00
Steve Yegge
6325487c81 bd sync: 2025-12-24 17:40:20 2025-12-24 17:40:20 -08:00
Steve Yegge
d3245d2610 bd sync: 2025-12-24 16:53:22 2025-12-24 16:53:22 -08:00
Steve Yegge
d953cf6138 bd sync: 2025-12-24 16:45:30 2025-12-24 16:45:30 -08:00
Steve Yegge
e3a7bf8b0b bd sync: 2025-12-24 16:30:40 2025-12-24 16:30:40 -08:00
Steve Yegge
922e54588b bd sync: 2025-12-24 16:25:37 2025-12-24 16:25:37 -08:00
Steve Yegge
c065e9840b bd sync: 2025-12-24 16:23:00 2025-12-24 16:23:10 -08:00
Steve Yegge
fda4f78207 bd sync: 2025-12-24 15:53:49 2025-12-24 16:23:10 -08:00
Steve Yegge
fd72ce8b3f bd sync: 2025-12-24 14:39:47 2025-12-24 16:23:10 -08:00
Steve Yegge
2f1ec2d388 release: v0.36.0
## Highlights

- **Formula system** - `bd cook` for declarative workflow templates
- **Gate issue type** - Async coordination primitives
- **`bd list --pretty --watch`** - Built-in colorized viewer with live updates
- **Child→parent dep prevention** - Blocks LLM temporal reasoning trap

## Breaking Changes

- `bd mol spawn` removed - use `bd pour` or `bd wisp create`
- `bd ready` excludes workflow types by default

## Bug Fixes

- GH#664: Dots in prefix handling
- GH#728: Child counter updates for explicit IDs
- GH#422: Multi-hyphen prefix parsing
- GH#704: Stealth mode uses .git/info/exclude

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 15:57:22 -08:00
Steve Yegge
7f33ee8f4d docs(info): add 0.36.0 to versionChanges
Adds release notes for v0.36.0 including:
- Formula system and gate issue type
- bd list --pretty --watch enhancements
- Child→parent dep prevention (LLM temporal trap)
- Multiple bug fixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 15:55:50 -08:00
Steve Yegge
a574dc2206 docs(changelog): expand child→parent dep detection explanation
Highlights that this prevents a common LLM temporal reasoning trap
where 'Phase 1 before Phase 2' gets modeled as Phase 1 blocking Phase 2
instead of Phase 2 depending on Phase 1.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 15:46:42 -08:00
Steve Yegge
42c23e24df fix(lint): add nosec directive for formula parser file read
Also: comprehensive CHANGELOG update for v0.36.0 prep
- Formula system (bd cook, extends, needs/waits_for)
- Gate issue type for async coordination
- bd list --pretty/--watch viewer enhancements
- bd search date/priority/content filters
- 15+ bug fixes since v0.35.0
- Test coverage improvements (daemon 72%, compact 82%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 15:22:01 -08:00
Steve Yegge
c28defb710 fix(sqlite): handle dots in prefix for extractParentChain (GH#664)
extractParentChain was using strings.Split(id, ".") which incorrectly
parsed prefixes containing dots (like "alicealexandra.com"). This caused
--parent to fail with "parent does not exist" even when the parent was
present in the database.

The fix uses IsHierarchicalID to walk up the hierarchy correctly, only
splitting on dots followed by numeric suffixes (the actual hierarchy
delimiter).

Example:
- "test.example-abc.1" now correctly returns ["test.example-abc"]
- Previously it incorrectly returned ["test", "test.example-abc"]

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 14:39:30 -08:00
Steve Yegge
25402184a6 fix: respect allowed_prefixes config during import (gt-2z6s)
The buildAllowedPrefixSet function now parses the allowed_prefixes config
and includes those prefixes when validating imports. This allows mol-*
prefixes to be imported without errors when configured.

Config example: bd config set allowed_prefixes "gt-,mol-"
2025-12-24 14:28:23 -08:00
Steve Yegge
f28785d2dc feat(formula): support needs and waits_for fields, add --prefix flag
- bd-hr39: Add `needs` field to Step as alias for depends_on. Converts
  to blocking dependencies between sibling steps during cooking.

- bd-j4cr: Add `waits_for` field to Step. Values: all-children or
  any-children. Preserved as gate:<value> label during cooking.

- bd-47qx: Add --prefix flag to bd cook command to prepend a prefix
  to proto IDs, enabling use of project prefixes like gt-.

Includes validation, dry-run output, and comprehensive tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:59:38 -08:00
Steve Yegge
90421e4567 bd sync: 2025-12-24 13:59:28 2025-12-24 13:59:28 -08:00
Steve Yegge
ad77e60499 bd sync: 2025-12-24 13:51:55 2025-12-24 13:51:55 -08:00
Steve Yegge
3fd11ad390 bd sync: 2025-12-24 13:50:26 2025-12-24 13:50:38 -08:00
Steve Yegge
d1c4526e6e fix(formula): address code review findings
Fixes from self-review of formula parser and bd cook:

1. Atomicity: Add cleanup on failure in cookFormula - if labels/deps
   transaction fails, delete the already-created issues

2. Validation: Add recursive depends_on validation for child steps
   and validate priority ranges for children

3. Documentation: Mark unimplemented fields (Expand, ExpandVars,
   Condition, Gate) with TODO(future) comments

4. Thread safety: Add note that Parser is NOT thread-safe

5. Error messages: Track first definition location for duplicate ID
   errors (e.g., "duplicate id at steps[1], first defined at steps[0]")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:50:19 -08:00
Steve Yegge
4fdcda4568 feat(formula): add formula parser and bd cook command (bd-weu8, bd-wa2l)
Implements a new formula system for defining workflow templates in YAML:

- internal/formula/types.go: YAML schema types for .formula.yaml files
  - Formula, Step, VarDef, ComposeRules, BondPoint, Gate types
  - Support for workflow, expansion, and aspect formula types
  - Variable definitions with required, default, enum, and pattern

- internal/formula/parser.go: Parser with extends/inheritance support
  - Parse formula files from multiple search paths
  - Resolve extends references for formula inheritance
  - Variable extraction and substitution
  - Variable validation (required, enum, pattern)

- cmd/bd/cook.go: bd cook command to compile formulas into protos
  - Parse and resolve formula YAML
  - Create proto bead with template label
  - Create child issues for each step
  - Set up parent-child and blocking dependencies
  - Support --dry-run, --force, --search-path flags

Example workflow:
  bd cook mol-feature.formula.yaml
  bd pour mol-feature --var component=Auth --var framework=react

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:42:01 -08:00
Steve Yegge
0514e40c68 bd sync: 2025-12-24 13:41:27 2025-12-24 13:41:27 -08:00
Steve Yegge
37257e8dbc bd sync: 2025-12-24 13:20:01 2025-12-24 13:24:28 -08:00
Steve Yegge
1e7c7f5e54 fix(sqlite): update child_counters when explicit child IDs are created (GH#728)
When creating issues with explicit hierarchical IDs (e.g., bd-test.1, bd-test.2
via --id flag or import), the child_counters table was not being updated.
This caused GetNextChildID to return colliding IDs when later called with
--parent.

Changes:
- Add ensureChildCounterUpdatedWithConn() to update counter on explicit child creation
- Add ParseHierarchicalID() to extract parent and child number from IDs
- Update CreateIssue to call counter update after hierarchical ID validation
- Update EnsureIDs to call counter update when parent exists
- Add post-insert phase in batch operations to update counters after FK
  constraint can be satisfied
- Update tests to reflect new behavior where counter is properly initialized

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:22:55 -08:00
Steve Yegge
ce2b05356a feat(deps): detect/prevent child→parent dependency anti-pattern (bd-nim5)
This prevents a common mistake where users add dependencies from child
issues to their parent epics. This creates a deadlock:
- Child can't start (blocked by open parent)
- Parent can't close (children not done)

Changes:
- dep.go: Reject child→parent deps at creation time with clear error
- server_labels_deps_comments.go: Same check for daemon RPC
- doctor/validation.go: New check detects existing bad deps
- doctor/fix/validation.go: Auto-fix removes bad deps
- doctor.go: Wire up check and fix handler

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 13:03:27 -08:00
Steve Yegge
566e4f5225 bd sync: 2025-12-24 13:02:54 2025-12-24 13:02:54 -08:00