Overview
Thebd mol distill command is the reverse of bd mol pour: instead of formula → molecule, it’s molecule → formula. It extracts a reusable formula from an existing epic, converting concrete values to variable placeholders for future reuse.
Usage
Arguments
<epic-id>- ID of the epic to distill into a formula[formula-name]- Optional formula name. If omitted, derived from epic title.
Options
--var key=value- Replace value with{{variable}}placeholder (can be specified multiple times)--dry-run- Preview what would be created without writing files--output <dir>- Output directory for formula file (default: auto-detect)--json- Output results in JSON format
Variable Syntax
Both formats are supported (smart detection):Output Locations
Formulas are written to the first writable directory (in order):.beads/formulas/(project-level, default)~/.beads/formulas/(user-level, if project not writable)
--output to specify a different directory.
Examples
Extract Simple Workflow
Capture a successful workflow for reuse:Extract with Variables
Replace specific values with variables:Preview Before Creating
Use--dry-run to see the structure:
Custom Output Location
Save formula to specific directory:Variable Substitution
How It Works
The--var flag replaces concrete values in the epic text with {{variable}} placeholders:
Before:
Smart Detection
The command automatically detects which format you used:Multiple Variables
Replace multiple values:Formula Structure
The generated formula includes:- Title and description (from epic root)
- Steps (from epic children)
- Dependencies (from issue relationships)
- Variables (from —var flags)
- Labels (excluding internal ones)
- Priority levels
Example Output File
.beads/formulas/feature-workflow.formula.json:
Use Cases
Capture Tribal Knowledge
Team develops a successful workflow organically:Create Organization Standards
Standardize processes across teams:Incremental Refinement
Start with basic formula, refine over iterations:Document Successful Releases
Capture release processes that worked well:Emergency Response Templates
Create templates from incident responses:JSON Output
Workflow: Distill → Refine → Pour
1. Distill
Extract the raw formula:2. Refine
Edit the generated formula file:3. Verify
Test the formula:4. Pour
Use the refined formula:Common Patterns
No Variables (Direct Copy)
Just capture the structure:Auto-Named Formula
Let formula name derive from epic title:Multiple Epics, Same Formula
Distill similar epics to compare:Error Handling
Variable Not Found
Epic Not Found
bd list --type epic.
Write Permission Denied
.beads/formulas/ directory or use --output.
Related Commands
- bd mol pour - Instantiate formula as persistent molecule (reverse of distill)
- bd mol seed - Verify formula can be loaded and cooked
- bd mol show - Display molecule structure before distilling
- bd formula list - List available formulas
- bd template save - Save issue as template (simpler, single-issue version)