What are molecules?
A molecule is a collection of related issues that form a cohesive workflow:- Formula: A template defining the workflow structure
- Proto: An uninstantiated formula (not yet poured)
- Molecule: A spawned instance with actual issues
- Bond: A link between issues in the molecule
Core concepts
Formulas
Formulas are YAML files defining workflow structure:Lifecycle
- Seed: Verify formula is valid (
bd mol seed) - Pour: Instantiate formula into actual issues (
bd mol pour) - Bond: Link issues together (
bd mol bond) - Current: Track position in workflow (
bd mol current) - Distill: Extract formula from existing molecule (
bd mol distill)
Mol seed: Formula verification
bd mol seed verifies formulas can be cooked:
Example output
Example output
- CI/CD pre-flight checks
- Debugging formula syntax
- Validating formula before distribution
Mol bond: Linking issues
bd mol bond creates relationships between issues:
Sequential bonding
Create linear workflow:Parallel bonding
Create parallel work:Conditional bonding
Create conditional workflows:Polymorphic bonding
Bond accepts multiple operand types:Phase control
Control when bonds become permanent:Mol current: Position tracking
bd mol current shows your position in a molecule workflow:
Example output
Example output
Large molecule handling
For molecules with 100+ steps:Multi-agent coordination
Mol distill: Formula extraction
bd mol distill reverse-engineers a formula from an existing molecule:
Example output
Example output
Variable substitution
Distill detects repeated patterns:Use cases
Capture tribal knowledge:Workflow patterns
Pipeline composition
Compose workflows from smaller pieces:Progressive enhancement
Start minimal, add steps:Patrol workflows
Repetitive maintenance tasks:The Christmas Ornament pattern
Dynamic bonding with custom IDs:Best practices
For formula authors
- ✅ Keep formulas focused (5-10 steps max)
- ✅ Use variables for reusability
- ✅ Document formula purpose in YAML comments
- ✅ Test formulas with
bd mol seedbefore distribution - ✅ Version control formulas in
.beads/formulas/
For formula users
- ✅ Use
bd mol currentto track progress - ✅ Pour from trusted formulas only
- ✅ Customize poured molecules as needed
- ✅ Distill successful workflows for reuse
- ✅ Clean up ephemeral bonds with
bd purge
For teams
- ✅ Maintain formula library in
.beads/formulas/ - ✅ Document formula usage in README
- ✅ Review formula changes in PRs
- ✅ Use
bd mol seedin CI to validate formulas - ✅ Share successful workflows via distill
Troubleshooting
Formula not found
Symptom:bd mol seed reports “formula not found”
Solution: Check search paths:
Circular dependencies
Symptom:bd mol pour fails with “circular dependency detected”
Solution: Check formula for cycles:
Bond failed: issues already linked
Symptom:bd mol bond fails with “dependency already exists”
Solution: Remove existing dependency first:
See also
- CLI Reference: mol-seed - Formula verification
- CLI Reference: mol-bond - Bonding operations
- CLI Reference: mol-current - Position tracking
- CLI Reference: mol-distill - Formula extraction
- Dependencies - Dependency system overview