feat(mol): spawn molecules as ephemeral by default (bd-2vh3.2)

Molecule spawning now creates ephemeral issues that can be bulk-deleted
when closed using `bd cleanup --ephemeral`. This supports the ephemeral
molecule workflow pattern where execution traces are cleaned up while
outcomes persist.

Changes:
- Add `ephemeral` parameter to cloneSubgraph() and spawnMolecule()
- mol spawn: ephemeral=true by default, add --persistent flag to opt out
- mol run: ephemeral=true (molecule execution)
- mol bond: ephemeral=true (bonded protos)
- template instantiate: ephemeral=false (deprecated, backwards compat)

This is Tier 1 of the ephemeral molecule workflow epic (bd-2vh3).

🤖 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-21 13:44:25 -08:00
parent 169684754d
commit d6ab9ab62c
6 changed files with 21 additions and 14 deletions

View File

@@ -53,6 +53,7 @@ func runMolSpawn(cmd *cobra.Command, args []string) {
assignee, _ := cmd.Flags().GetString("assignee")
attachFlags, _ := cmd.Flags().GetStringSlice("attach")
attachType, _ := cmd.Flags().GetString("attach-type")
persistent, _ := cmd.Flags().GetBool("persistent")
// Parse variables
vars := make(map[string]string)
@@ -181,7 +182,9 @@ func runMolSpawn(cmd *cobra.Command, args []string) {
}
// Clone the subgraph (spawn the molecule)
result, err := spawnMolecule(ctx, store, subgraph, vars, assignee, actor)
// Spawned molecules are ephemeral by default (bd-2vh3) - use --persistent to opt out
ephemeral := !persistent
result, err := spawnMolecule(ctx, store, subgraph, vars, assignee, actor, ephemeral)
if err != nil {
fmt.Fprintf(os.Stderr, "Error spawning molecule: %v\n", err)
os.Exit(1)
@@ -233,6 +236,7 @@ func init() {
molSpawnCmd.Flags().String("assignee", "", "Assign the root issue to this agent/user")
molSpawnCmd.Flags().StringSlice("attach", []string{}, "Proto to attach after spawning (repeatable)")
molSpawnCmd.Flags().String("attach-type", types.BondTypeSequential, "Bond type for attachments: sequential, parallel, or conditional")
molSpawnCmd.Flags().Bool("persistent", false, "Create non-ephemeral issues (default: ephemeral for cleanup)")
molCmd.AddCommand(molSpawnCmd)
}