Skip to content

Director: parallel phase execution via worktrees #2

Description

@fgmacedo

Future enhancement: Parallel phase execution via worktrees

Summary

Once the Director produces a typed plan with explicit dependencies, the structure to run independent phases in parallel is sitting there. This adds a parallel execution mode: bcc spins up N git worktrees, dispatches one Executor session per independent phase, and runs them concurrently. After parallel phases complete, the Director coordinates a reconciliation pass that merges the worktrees back into the main tree, surfacing conflicts as Director verdicts. For specs whose plan has independent leaves, wall-clock time drops sub-linearly. For specs without independence, the mode is a no-op.

Problem

Long specs often have phases that touch different parts of the codebase. Today bcc runs them serially because the loop has no model of independence. With the Director's typed DAG, independence is explicit. The wall-clock penalty of serial execution is the user-visible metric, and engagement decays over multi-hour runs that could have been parallel.

Goals

  • Identify parallelizable phases from the DAG.
  • Create ephemeral git worktrees, one per parallel phase, on a fresh branch derived from current HEAD.
  • Dispatch one Executor session per worktree concurrently, coordinated by a single bcc loop.
  • Reconciliation pass after all parallel phases complete: review each phase, then merge in dependency order.
  • On merge conflict, the Director produces a structured outcome (auto-resolve trivial, retry-serial, escalate semantic).
  • TUI shows multiple concurrent Executor streams and the reconciliation as a final phase.

Non-goals

  • Cross-spec parallelism.
  • Parallel Director (Briefer/Reviewer); parallelism is on the Executor axis, not the planning axis.
  • Merging strategies beyond what git provides plus Director-led conflict reasoning.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions