Molecules
Molecules are workflow templates that coordinate multi-step work in Gas Town.
Molecule Lifecycle
Section titled “Molecule Lifecycle”Formula (source TOML) ─── "Ice-9" │ ▼ bd cookProtomolecule (frozen template) ─── Solid │ ├─▶ bd mol pour ──▶ Mol (persistent) ─── Liquid ──▶ bd squash ──▶ Digest │ └─▶ bd mol wisp ──▶ Wisp (ephemeral) ─── Vapor ──┬▶ bd squash ──▶ Digest └▶ bd burn ──▶ (gone)Core Concepts
Section titled “Core Concepts”| Term | Description |
|---|---|
| Formula | Source TOML template defining workflow steps |
| Protomolecule | Frozen template ready for instantiation |
| Molecule | Active workflow instance with trackable steps |
| Wisp | Ephemeral molecule for patrol cycles (never synced) |
| Digest | Squashed summary of completed molecule |
| Shiny Workflow | Canonical polecat formula: design → implement → review → test → submit |
Common Mistake: Reading Formulas Directly
Section titled “Common Mistake: Reading Formulas Directly”WRONG:
# Reading a formula file and manually creating beads for each stepcat .beads/formulas/mol-polecat-work.formula.tomlbd create --title "Step 1: Load context" --type taskbd create --title "Step 2: Branch setup" --type task# ... creating beads from formula proseRIGHT:
# Cook the formula into a proto, pour into a moleculebd cook mol-polecat-workbd mol pour mol-polecat-work --var issue=gt-xyz# Now work through the step beads that were createdbd ready # Find next stepbd close <step-id> # Complete itKey insight: Formulas are source templates (like source code). You never read
them directly during work. The cook → pour pipeline creates step beads for you.
Your molecule already has steps - use bd ready to find them.
Navigating Molecules
Section titled “Navigating Molecules”Molecules help you track where you are in multi-step workflows.
Finding Your Place
Section titled “Finding Your Place”bd mol current # Where am I?bd mol current gt-abc # Status of specific moleculeOutput:
You're working on molecule gt-abc (Feature X)
✓ gt-abc.1: Design ✓ gt-abc.2: Scaffold ✓ gt-abc.3: Implement → gt-abc.4: Write tests [in_progress] <- YOU ARE HERE ○ gt-abc.5: Documentation ○ gt-abc.6: Exit decision
Progress: 3/6 steps completeSeamless Transitions
Section titled “Seamless Transitions”Close a step and advance in one command:
bd close gt-abc.3 --continue # Close and advance to next stepbd close gt-abc.3 --no-auto # Close but don't auto-claim nextThe old way (3 commands):
bd close gt-abc.3bd ready --parent=gt-abcbd update gt-abc.4 --status=in_progressThe new way (1 command):
bd close gt-abc.3 --continueTransition Output
Section titled “Transition Output”✓ Closed gt-abc.3: Implement feature
Next ready in molecule: gt-abc.4: Write tests
→ Marked in_progress (use --no-auto to skip)When Molecule Completes
Section titled “When Molecule Completes”✓ Closed gt-abc.6: Exit decision
Molecule gt-abc complete! All steps closed.Consider: bd mol squash gt-abc --summary '...'Molecule Commands
Section titled “Molecule Commands”Beads Operations (bd)
Section titled “Beads Operations (bd)”# Formulasbd formula list # Available formulasbd formula show <name> # Formula detailsbd cook <formula> # Formula → Proto
# Molecules (data operations)bd mol list # Available protosbd mol show <id> # Proto detailsbd mol pour <proto> # Create molbd mol wisp <proto> # Create wispbd mol bond <proto> <parent> # Attach to existing molbd mol squash <id> # Condense to digestbd mol burn <id> # Discard wispbd mol current # Where am I in the current molecule?Agent Operations (gt)
Section titled “Agent Operations (gt)”# Hook managementgt hook # What's on MY hookgt mol current # What should I work on nextgt mol progress <id> # Execution progress of moleculegt mol attach <bead> <mol> # Pin molecule to beadgt mol detach <bead> # Unpin molecule from bead
# Agent lifecyclegt mol burn # Burn attached moleculegt mol squash # Squash attached moleculegt mol step done <step> # Complete a molecule stepPolecat Workflow
Section titled “Polecat Workflow”Polecats receive work via their hook - a pinned molecule attached to an issue. They execute molecule steps sequentially, closing each step as they complete it.
Molecule Types for Polecats
Section titled “Molecule Types for Polecats”| Type | Storage | Use Case |
|---|---|---|
| Regular Molecule | .beads/ (synced) | Discrete deliverables, audit trail |
| Wisp | .beads/ (ephemeral) | Patrol cycles, operational loops |
Polecats typically use regular molecules because each assignment has audit value. Patrol agents (Witness, Refinery, Deacon) use wisps to prevent accumulation.
Hook Management
Section titled “Hook Management”gt hook # What's on MY hook?gt mol attach-from-mail <id> # Attach work from mail messagegt done # Signal completion (syncs, submits to MQ, notifies Witness)Polecat Workflow Summary
Section titled “Polecat Workflow Summary”1. Spawn with work on hook2. gt hook # What's hooked?3. bd mol current # Where am I?4. Execute current step5. bd close <step> --continue6. If more steps: GOTO 37. gt done # Signal completionWisp vs Molecule Decision
Section titled “Wisp vs Molecule Decision”| Question | Molecule | Wisp |
|---|---|---|
| Does it need audit trail? | Yes | No |
| Will it repeat continuously? | No | Yes |
| Is it discrete deliverable? | Yes | No |
| Is it operational routine? | No | Yes |
Best Practices
Section titled “Best Practices”- CRITICAL: Close steps in real-time - Mark
in_progressBEFORE starting,closedIMMEDIATELY after completing. Never batch-close steps at the end. Molecules ARE the ledger - each step closure is a timestamped CV entry. Batch-closing corrupts the timeline and violates HOP’s core promise. - Use
--continuefor propulsion - Keep momentum by auto-advancing - Check progress with
bd mol current- Know where you are before resuming - Squash completed molecules - Create digests for audit trail
- Burn routine wisps - Don’t accumulate ephemeral patrol data
