Multi-branch perplexity selection as an Effection operation
Forks N branches from a parent (or a fresh root), generates to EOG via
batched BranchStore.commit, then selects the lowest-perplexity
attempt. Loser branches are pruned; the caller receives the best branch
still alive.
When opts.parent is provided, the parent branch is NOT pruned — it's
owned by the calling scope. Only the forked attempt branches (losers)
are pruned. The caller owns the winning branch's lifecycle, typically
via Session.promote.
Cleanup is structured: each forked branch registers an ensure() callback
that prunes it on scope exit. Winners are marked disposed-safe (already
pruned or ownership transferred) before the ensure fires.
Multi-branch perplexity selection as an Effection operation
Forks N branches from a parent (or a fresh root), generates to EOG via batched BranchStore.commit, then selects the lowest-perplexity attempt. Loser branches are pruned; the caller receives the best branch still alive.
When
opts.parentis provided, the parent branch is NOT pruned — it's owned by the calling scope. Only the forked attempt branches (losers) are pruned. The caller owns the winning branch's lifecycle, typically via Session.promote.Cleanup is structured: each forked branch registers an
ensure()callback that prunes it on scope exit. Winners are marked disposed-safe (already pruned or ownership transferred) before the ensure fires.