Remove deprecated builtin molecules infrastructure

- Delete builtin_molecules.go (empty stubs)
- Remove `mol export` command (exported 0 molecules)
- Clean dead code in catalog.go iterating empty BuiltinMolecules()
- Update docs to reference formula files instead of Go code

Molecules are now defined as .beads/formulas/*.formula.json files
and cooked into proto beads via `bd cook`.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-25 11:29:27 -08:00
parent 18a4a6a3e1
commit e0a2187636
7 changed files with 15 additions and 99 deletions

View File

@@ -705,9 +705,9 @@ gt spawn --issue gt-xyz --molecule mol-engineer-in-box
- Each instance has an `instantiated_from` edge to the source molecule
- Enables querying: "show all instances of mol-engineer-in-box"
### Built-in Molecules
### Standard Molecules
Gas Town ships with three built-in molecules:
Gas Town includes formula files (`.beads/formulas/`) for standard molecules:
**mol-engineer-in-box** (5 steps):
```
@@ -727,9 +727,9 @@ investigate → document
```
Exploration workflow for understanding problems.
Seed built-in molecules with:
Cook formula files into proto beads:
```bash
gt molecule seed
bd cook <formula-id>
```
### Usage

View File

@@ -285,8 +285,8 @@ bd mol detach
### Phase 1: Core Infrastructure (P0)
1. Add `mol-crew-session` to builtin_molecules.go
2. Add `mol-polecat-session` to builtin_molecules.go
1. Create `mol-crew-session.formula.json` in `.beads/formulas/`
2. Create `mol-polecat-session.formula.json` in `.beads/formulas/`
3. Add wisp attachment mechanism to beads
4. Update spawn.go for polecat session wisps

View File

@@ -1,28 +0,0 @@
// Package beads provides a wrapper for the bd (beads) CLI.
package beads
// BuiltinMolecule defines a built-in molecule template.
// Deprecated: Molecules are now defined as formula files in .beads/formulas/
// and cooked into proto beads via `bd cook`. This type remains for backward
// compatibility but is no longer used.
type BuiltinMolecule struct {
ID string // Well-known ID (e.g., "mol-engineer-in-box")
Title string
Description string
}
// BuiltinMolecules returns all built-in molecule definitions.
// Deprecated: Molecules are now defined as formula files (.beads/formulas/*.formula.json)
// and cooked into proto beads via `bd cook`. This function returns an empty slice.
// Use `bd cook` to create proto beads from formulas instead.
func BuiltinMolecules() []BuiltinMolecule {
return []BuiltinMolecule{}
}
// SeedBuiltinMolecules is deprecated and does nothing.
// Molecules are now created by cooking formula files with `bd cook`.
// This function remains for backward compatibility with existing installations.
func (b *Beads) SeedBuiltinMolecules() (int, error) {
// No-op: formulas are cooked on-demand, not seeded at install time
return 0, nil
}

View File

@@ -16,15 +16,14 @@ type CatalogMolecule struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Source string `json:"source,omitempty"` // "builtin", "town", "rig", "project"
Source string `json:"source,omitempty"` // "town", "rig", "project"
}
// MoleculeCatalog provides hierarchical molecule template loading.
// It loads molecules from multiple sources in priority order:
// 1. Built-in molecules (shipped with the binary)
// 2. Town-level: <town>/.beads/molecules.jsonl
// 3. Rig-level: <town>/<rig>/.beads/molecules.jsonl
// 4. Project-level: .beads/molecules.jsonl in current directory
// 1. Town-level: <town>/.beads/molecules.jsonl
// 2. Rig-level: <town>/<rig>/.beads/molecules.jsonl
// 3. Project-level: .beads/molecules.jsonl in current directory
//
// Later sources can override earlier ones by ID.
type MoleculeCatalog struct {
@@ -46,21 +45,11 @@ func NewMoleculeCatalog() *MoleculeCatalog {
// - rigPath: Path to the rig directory (e.g., ~/gt/gastown). Empty to skip rig-level.
// - projectPath: Path to the project directory. Empty to skip project-level.
//
// Built-in molecules are always loaded first.
// Molecules are loaded from town, rig, and project levels (no builtin molecules).
func LoadCatalog(townRoot, rigPath, projectPath string) (*MoleculeCatalog, error) {
catalog := NewMoleculeCatalog()
// 1. Load built-in molecules
for _, builtin := range BuiltinMolecules() {
catalog.Add(&CatalogMolecule{
ID: builtin.ID,
Title: builtin.Title,
Description: builtin.Description,
Source: "builtin",
})
}
// 2. Load town-level molecules
// 1. Load town-level molecules
if townRoot != "" {
townMolsPath := filepath.Join(townRoot, ".beads", "molecules.jsonl")
if err := catalog.LoadFromFile(townMolsPath, "town"); err != nil && !os.IsNotExist(err) {
@@ -68,7 +57,7 @@ func LoadCatalog(townRoot, rigPath, projectPath string) (*MoleculeCatalog, error
}
}
// 3. Load rig-level molecules
// 2. Load rig-level molecules
if rigPath != "" {
rigMolsPath := filepath.Join(rigPath, ".beads", "molecules.jsonl")
if err := catalog.LoadFromFile(rigMolsPath, "rig"); err != nil && !os.IsNotExist(err) {
@@ -76,7 +65,7 @@ func LoadCatalog(townRoot, rigPath, projectPath string) (*MoleculeCatalog, error
}
}
// 4. Load project-level molecules
// 3. Load project-level molecules
if projectPath != "" {
projectMolsPath := filepath.Join(projectPath, ".beads", "molecules.jsonl")
if err := catalog.LoadFromFile(projectMolsPath, "project"); err != nil && !os.IsNotExist(err) {
@@ -196,17 +185,3 @@ func (mol *CatalogMolecule) ToIssue() *Issue {
}
}
// ExportBuiltinMolecules writes all built-in molecules to a JSONL file.
// This is useful for creating a base molecules.jsonl file.
func ExportBuiltinMolecules(path string) error {
catalog := NewMoleculeCatalog()
for _, builtin := range BuiltinMolecules() {
catalog.Add(&CatalogMolecule{
ID: builtin.ID,
Title: builtin.Title,
Description: builtin.Description,
Source: "builtin",
})
}
return catalog.SaveToFile(path)
}

View File

@@ -80,22 +80,6 @@ Use --db to show only database molecules.`,
RunE: runMoleculeList,
}
var moleculeExportCmd = &cobra.Command{
Use: "export <path>",
Short: "Export built-in molecules to JSONL",
Long: `Export built-in molecule templates to a JSONL file.
This creates a molecules.jsonl file containing all built-in molecules.
You can place this in:
- <town>/.beads/molecules.jsonl (town-level)
- <rig>/.beads/molecules.jsonl (rig-level)
- .beads/molecules.jsonl (project-level)
The file can be edited to customize or add new molecules.`,
Args: cobra.ExactArgs(1),
RunE: runMoleculeExport,
}
var moleculeShowCmd = &cobra.Command{
Use: "show <id>",
Short: "Show molecule with parsed steps",
@@ -408,7 +392,6 @@ func init() {
moleculeCmd.AddCommand(moleculeParseCmd)
moleculeCmd.AddCommand(moleculeInstantiateCmd)
moleculeCmd.AddCommand(moleculeInstancesCmd)
moleculeCmd.AddCommand(moleculeExportCmd)
moleculeCmd.AddCommand(moleculeProgressCmd)
moleculeCmd.AddCommand(moleculeAttachCmd)
moleculeCmd.AddCommand(moleculeDetachCmd)

View File

@@ -130,19 +130,6 @@ func runMoleculeList(cmd *cobra.Command, args []string) error {
return nil
}
func runMoleculeExport(cmd *cobra.Command, args []string) error {
path := args[0]
if err := beads.ExportBuiltinMolecules(path); err != nil {
return fmt.Errorf("exporting molecules: %w", err)
}
fmt.Printf("%s Exported %d built-in molecules to %s\n",
style.Bold.Render("✓"), len(beads.BuiltinMolecules()), path)
return nil
}
func runMoleculeShow(cmd *cobra.Command, args []string) error {
molID := args[0]

View File

@@ -478,7 +478,6 @@ func (m *Manager) createRoleCLAUDEmd(workspacePath string, role string, rigName
// These molecules define the work loops for Deacon, Witness, and Refinery roles.
func (m *Manager) seedPatrolMolecules(rigPath string) error {
// Use bd command to seed molecules (more reliable than internal API)
// The bd mol seed command creates built-in molecules if they don't exist
cmd := exec.Command("bd", "mol", "seed", "--patrol")
cmd.Dir = rigPath
if err := cmd.Run(); err != nil {
@@ -491,7 +490,7 @@ func (m *Manager) seedPatrolMolecules(rigPath string) error {
// seedPatrolMoleculesManually creates patrol molecules using bd create commands.
func (m *Manager) seedPatrolMoleculesManually(rigPath string) error {
// Patrol molecule definitions (subset of builtin_molecules.go for seeding)
// Patrol molecule definitions for seeding
patrolMols := []struct {
title string
desc string