- Update WitnessPatrolMolecule() with dynamic bonding pattern:
- PREFLIGHT: inbox-check, check-refinery, load-state
- DISCOVERY: survey-workers (bonds mol-polecat-arm per polecat)
- CLEANUP: aggregate (WaitsFor: all-children), save-state, generate-summary,
context-check, burn-or-loop
- Reduced from 11 sequential steps to 9 with parallel arm execution
- Add PolecatArmMolecule() for per-polecat inspection:
- 5 sequential steps: capture, assess, load-history, decide, execute
- Uses {{polecat_name}} and {{rig}} variable substitution
- Bonded dynamically by survey-workers step
- Update tests: 14 builtin molecules, new test cases
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
79 lines
2.1 KiB
Go
79 lines
2.1 KiB
Go
// Package beads provides a wrapper for the bd (beads) CLI.
|
|
package beads
|
|
|
|
// BuiltinMolecule defines a built-in molecule template.
|
|
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.
|
|
// Molecules are defined in separate files by category:
|
|
// - molecules_work.go: EngineerInBox, QuickFix, Research, PolecatWork, ReadyWork
|
|
// - molecules_patrol.go: DeaconPatrol, WitnessPatrol, RefineryPatrol
|
|
// - molecules_session.go: CrewSession, PolecatSession, Bootstrap, VersionBump, InstallGoBinary
|
|
func BuiltinMolecules() []BuiltinMolecule {
|
|
return []BuiltinMolecule{
|
|
// Work molecules
|
|
EngineerInBoxMolecule(),
|
|
QuickFixMolecule(),
|
|
ResearchMolecule(),
|
|
PolecatWorkMolecule(),
|
|
ReadyWorkMolecule(),
|
|
|
|
// Patrol molecules
|
|
DeaconPatrolMolecule(),
|
|
RefineryPatrolMolecule(),
|
|
WitnessPatrolMolecule(),
|
|
PolecatArmMolecule(),
|
|
|
|
// Session and utility molecules
|
|
CrewSessionMolecule(),
|
|
PolecatSessionMolecule(),
|
|
BootstrapGasTownMolecule(),
|
|
VersionBumpMolecule(),
|
|
InstallGoBinaryMolecule(),
|
|
}
|
|
}
|
|
|
|
// SeedBuiltinMolecules creates all built-in molecules in the beads database.
|
|
// It skips molecules that already exist (by title match).
|
|
// Returns the number of molecules created.
|
|
func (b *Beads) SeedBuiltinMolecules() (int, error) {
|
|
molecules := BuiltinMolecules()
|
|
created := 0
|
|
|
|
// Get existing molecules to avoid duplicates
|
|
existing, err := b.List(ListOptions{Type: "molecule", Priority: -1})
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
|
|
// Build map of existing molecule titles
|
|
existingTitles := make(map[string]bool)
|
|
for _, issue := range existing {
|
|
existingTitles[issue.Title] = true
|
|
}
|
|
|
|
// Create each molecule if it doesn't exist
|
|
for _, mol := range molecules {
|
|
if existingTitles[mol.Title] {
|
|
continue // Already exists
|
|
}
|
|
|
|
_, err := b.Create(CreateOptions{
|
|
Title: mol.Title,
|
|
Type: "molecule",
|
|
Priority: 2, // Medium priority
|
|
Description: mol.Description,
|
|
})
|
|
if err != nil {
|
|
return created, err
|
|
}
|
|
created++
|
|
}
|
|
|
|
return created, nil
|
|
}
|