Git worktree based parallel agent workflow for running Codex CLI, Claude Code, OpenCode, and other coding agents concurrently without file conflicts...
This repo uses named git worktrees as the main concurrency primitive: one writer per worktree/role, plus an integrator that merges and runs checks.
Create the standard worktrees (default root C:\pt-study-sop-worktrees):
cd C:\pt-study-sop
.\scripts\agent_worktrees.ps1 ensure
List the mapping:
.\scripts\agent_worktrees.ps1 list
Open a tool in a specific worktree (new PowerShell window):
.\scripts\agent_worktrees.ps1 open -Role ui -Tool claude
.\scripts\agent_worktrees.ps1 open -Role brain -Tool codex -ToolArgs "--search"
.\scripts\agent_worktrees.ps1 open -Role integrate -Tool opencode
Route a task by file paths, or dispatch automatically:
.\scripts\agent_worktrees.ps1 route -Paths dashboard_rebuild\\client\\src\\pages\\tutor.tsx
.\scripts\agent_worktrees.ps1 dispatch -Paths brain\\db_setup.py -Tool codex
Roles are meant to be obvious, not clever:
integrate (wt/integrate): merges, conflict resolution, running checks, and any cross-cutting change touching multiple areas.ui (wt/ui): frontend work in dashboard_rebuild/.brain (wt/brain): backend work in brain/ (Flask/API/db).docs (wt/docs, optional): docs + meta-work in docs/, conductor/, scripts/, tests.ASCII overview:
wt/ui (Claude or Codex) -> commits on wt/ui
wt/brain (Codex) -> commits on wt/brain
wt/integrate (you) -> merges + runs checks -> main
Route by files touched, not by vibes:
dashboard_rebuild/ -> uibrain/ -> brainintegratedocs -> docs (otherwise integrate)When in doubt, send it to integrate.
wt/ui, wt/brain, etc.).main and runs the repo's required checks.Practical merge flow (run from wt/integrate):
cd C:\pt-study-sop-worktrees\integrate
git fetch
git merge wt/ui
git merge wt/brain
pytest brain/tests/ # when relevant
Yes, but keep the concurrency model simple:
scripts/agent_worktrees.ps1scripts/launch_codex_session.ps1 (use -Tool opencode for Opencode sessions).