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

@@ -292,8 +292,8 @@ Example:
return
}
// Clone the subgraph
result, err := cloneSubgraph(ctx, store, subgraph, vars, assignee, actor)
// Clone the subgraph (deprecated command, non-ephemeral for backwards compatibility)
result, err := cloneSubgraph(ctx, store, subgraph, vars, assignee, actor, false)
if err != nil {
fmt.Fprintf(os.Stderr, "Error instantiating template: %v\n", err)
os.Exit(1)
@@ -453,7 +453,8 @@ func substituteVariables(text string, vars map[string]string) string {
// cloneSubgraph creates new issues from the template with variable substitution
// If assignee is non-empty, it will be set on the root epic
func cloneSubgraph(ctx context.Context, s storage.Storage, subgraph *TemplateSubgraph, vars map[string]string, assignee string, actorName string) (*InstantiateResult, error) {
// If ephemeral is true, spawned issues are marked for bulk deletion when closed (bd-2vh3)
func cloneSubgraph(ctx context.Context, s storage.Storage, subgraph *TemplateSubgraph, vars map[string]string, assignee string, actorName string, ephemeral bool) (*InstantiateResult, error) {
if s == nil {
return nil, fmt.Errorf("no database connection")
}
@@ -483,6 +484,7 @@ func cloneSubgraph(ctx context.Context, s storage.Storage, subgraph *TemplateSub
IssueType: oldIssue.IssueType,
Assignee: issueAssignee,
EstimatedMinutes: oldIssue.EstimatedMinutes,
Ephemeral: ephemeral, // bd-2vh3: mark for cleanup when closed
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}