René's URL Explorer Experiment


Title: feat: Worktree creation and lifecycle missing from coordinator/spawn flow · Issue #525 · github/squad · GitHub

Open Graph Title: feat: Worktree creation and lifecycle missing from coordinator/spawn flow · Issue #525 · github/squad

X Title: feat: Worktree creation and lifecycle missing from coordinator/spawn flow · Issue #525 · github/squad

Description: Summary Squad has full worktree detection (reading .squad/ state from worktrees) but the coordinator and spawn flow never creates worktrees for parallel agent work. Every branch-creation path hardcodes git checkout -b, which breaks paral...

Open Graph Description: Summary Squad has full worktree detection (reading .squad/ state from worktrees) but the coordinator and spawn flow never creates worktrees for parallel agent work. Every branch-creation path hardc...

X Description: Summary Squad has full worktree detection (reading .squad/ state from worktrees) but the coordinator and spawn flow never creates worktrees for parallel agent work. Every branch-creation path hardc...

Opengraph URL: https://github.com/github/squad/issues/525

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: Worktree creation and lifecycle missing from coordinator/spawn flow","articleBody":"## Summary\n\nSquad has full worktree **detection** (reading `.squad/` state from worktrees) but the coordinator and spawn flow never **creates** worktrees for parallel agent work. Every branch-creation path hardcodes `git checkout -b`, which breaks parallel multi-agent execution — agents clobber each other's working directory.\n\n## What exists (worktree reading — works correctly)\n\n| Component | File | What it does |\n|-----------|------|-------------|\n| SDK resolution | `packages/squad-sdk/src/resolution.ts` L61-82 | `resolveSquad()` detects `.git` as file (worktree pointer), stops at boundary correctly |\n| Coordinator session start | `.squad-templates/squad.agent.md` L100 | Resolves team root via `git rev-parse --show-toplevel`, passes `TEAM_ROOT` to agents |\n| Worktree Awareness section | `.squad-templates/squad.agent.md` L569-601 | Documents two strategies (worktree-local vs main-checkout), `TEAM_ROOT` passing |\n| Agent charters | `packages/squad-sdk/src/roles/index.ts` L193 | All agents told to `git rev-parse --show-toplevel` — never assume CWD |\n| Merge safety | `.gitattributes` | `merge=union` on append-only `.squad/` files |\n| Consult mode | `packages/squad-sdk/src/sharing/consult.ts` L320-367 | `resolveGitExcludePath()` uses `git rev-parse` to handle worktrees/submodules |\n| Tests | `test/resolution.test.ts` L51-63 | Two tests: `.git` worktree file boundary detection + `.squad/` found in worktree |\n\n## What's missing (worktree creation/lifecycle — the gap)\n\n| What exists | What's missing |\n|-------------|----------------|\n| Worktree detection (can I read state?) | Worktree creation (do I create one per agent?) |\n| Worktree state resolution (where is `.squad/`?) | Worktree lifecycle (create before spawn, cleanup after merge) |\n| `merge=union` for clean merges | Spawn template saying \"work in your worktree, don't `checkout -b`\" |\n| git-workflow skill documents `git worktree add` | Nothing in the coordinator flow invokes it |\n\n## Specific locations that need changes\n\n### 1. `ralph-commands.ts` — all 3 platform adapters hardcode `checkout -b`\n\n**File:** `packages/squad-sdk/src/platform/ralph-commands.ts`\n\nAll three adapters (GitHub L71, ADO L92, Planner L50) have:\n\n```typescript\ncreateBranch: 'git checkout main && git pull && git checkout -b {branchName}',\n```\n\nNo worktree variant exists. When Ralph spawns parallel agents, they all run `checkout -b` in the same working directory, clobbering each other.\n\n### 2. `issue-lifecycle.md` — referenced but doesn't exist\n\n**File:** `.squad-templates/squad.agent.md` L1097 and L1103\n\n```\nSee `.squad/templates/issue-lifecycle.md` for the full spawn prompt ISSUE CONTEXT block...\n```\n\nThis template is referenced twice but **does not exist anywhere in the repo**. The coordinator has no template for the issue-to-branch-to-PR flow, so it falls back to `git checkout -b` from the git-workflow skill's default single-issue workflow (L33).\n\n### 3. git-workflow skill defaults to `checkout -b`\n\n**File:** `.copilot/skills/git-workflow/SKILL.md` L29-34\n\nThe default \"Workflow for Issue Work\" uses `git checkout -b`. The worktree path (L62-130) is documented as a separate \"Parallel Multi-Issue Work\" section, but nothing in the coordinator flow triggers it — the coordinator reads the default workflow.\n\n### 4. No `WORKTREE_PATH` in spawn prompts\n\n**File:** `.squad-templates/squad.agent.md` L592-595\n\n`TEAM_ROOT` is passed to agents (for reading `.squad/` state), but there's no `WORKTREE_PATH` mechanism to tell an agent \"you are in worktree X, stay there, don't switch branches.\"\n\n### 5. No worktree lifecycle management\n\nNothing in the codebase:\n- Creates worktrees before spawning parallel agents\n- Passes the worktree path to the spawned agent\n- Cleans up worktrees after PR merge\n- Decides when to use worktrees vs `checkout -b` (single agent = checkout, multiple = worktrees)\n\n## Proposed fix\n\n### Coordinator pre-spawn (parallel work):\n\n```bash\n# Create a worktree per agent/issue\ngit worktree add ./worktrees/squad-{issue} -b squad/{issue}-{slug} origin/dev\n```\n\n### Agent spawn prompt addition:\n\n```\nWORKTREE_PATH: ./worktrees/squad-{issue}\n\"You are already on branch squad/{issue}-{slug}. Work only in {WORKTREE_PATH}.\"\n```\n\n### Post-merge cleanup:\n\n```bash\ngit worktree remove ./worktrees/squad-{issue}\ngit worktree prune\n```\n\n### Decision logic:\n\n- **Single agent** -> `git checkout -b` (current behavior, fine)\n- **Multiple agents in parallel** -> `git worktree add` per agent (new)\n- **Ralph batch work** -> worktrees (new)\n\n### Files to change:\n\n1. `packages/squad-sdk/src/platform/ralph-commands.ts` — add `createWorktree` / `removeWorktree` commands\n2. `.squad-templates/squad.agent.md` — update spawn flow to create worktrees for parallel work, add `WORKTREE_PATH` to spawn prompts\n3. Create `.squad-templates/issue-lifecycle.md` — the missing template, with worktree-aware lifecycle\n4. `.copilot/skills/git-workflow/SKILL.md` — make worktree the default for parallel work, not a separate section\n5. `test/` — add tests for worktree creation/cleanup lifecycle\n\n## Additional context\n\n- The git-workflow skill already documents the correct `git worktree add` commands (L82-84) and cleanup (L120-130) — the knowledge exists, it just isn't wired into the coordinator flow.\n- The `merge=union` `.gitattributes` strategy already handles the merge side correctly.\n- The SDK `resolution.ts` + tests already handle the read side correctly.\n- This is purely a coordinator/orchestration gap, not an SDK gap.","author":{"url":"https://github.com/joniba","@type":"Person","name":"joniba"},"datePublished":"2026-03-22T22:42:16Z","url":"https://github.com/github/squad/issues/525"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:51c5cebc-1cc3-6a41-461d-3ccaad6efef1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id83BA:B1B84:10647F9:14C7180:6B014EE1
html-safe-nonced3fda634aa5025ebf314c5417ad190a81cf464107ca01e34472143e8618465da
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0JBOkIxQjg0OjEwNjQ3Rjk6MTRDNzE4MDo2QjAxNEVFMSIsInZpc2l0b3JfaWQiOiIzNTE3MjQzODE5NjU1NTE1ODczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacaba8c46591c4b1f814cc2f4ef0d97a7bc0ed5297e1f6d89b8b21f29b36b0b82d
hovercard-subject-tagissue:4117297159
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/squad/525/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4fc6ab94fbcb28ed3da9aa31ccc0d9fa8b770d7f0c56d480d5aa349e5c6c4591/github/squad/issues/525
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4fc6ab94fbcb28ed3da9aa31ccc0d9fa8b770d7f0c56d480d5aa349e5c6c4591/github/squad/issues/525
og:image:altSummary Squad has full worktree detection (reading .squad/ state from worktrees) but the coordinator and spawn flow never creates worktrees for parallel agent work. Every branch-creation path hardc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejoniba
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/github/squad git https://github.com/github/squad.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id1151205052
octolytics-dimension-repository_nwogithub/squad
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1151205052
octolytics-dimension-repository_network_root_nwogithub/squad
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/github/squad/issues/525#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fsquad%2Fissues%2F525
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fsquad%2Fissues%2F525
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=github%2Fsquad
Reloadhttps://github.com/github/squad/issues/525
Reloadhttps://github.com/github/squad/issues/525
Reloadhttps://github.com/github/squad/issues/525
githubhttps://github.com/github
squadhttps://github.com/github/squad
Codehttps://github.com/github/squad
Issues108 (108)https://github.com/github/squad/issues
Pull requests26 (26)https://github.com/github/squad/pulls
Discussionshttps://github.com/github/squad/discussions
Actionshttps://github.com/github/squad/actions
Projectshttps://github.com/github/squad/projects
Security and qualityhttps://github.com/github/squad/security
Insightshttps://github.com/github/squad/insights
https://github.com/github/squad
New issuehttps://github.com/login?return_to=https://github.com/github/squad/issues/525
New issuehttps://github.com/login?return_to=https://github.com/github/squad/issues/525
#526https://github.com/github/squad/pull/526
feat: Worktree creation and lifecycle missing from coordinator/spawn flowhttps://github.com/github/squad/issues/525#top
#526https://github.com/github/squad/pull/526
https://github.com/joniba
jonibahttps://github.com/joniba
on Mar 22, 2026https://github.com/github/squad/issues/525#issue-4117297159
jonibahttps://github.com/joniba
on Mar 22, 2026https://github.com/github/squad/issues/525#event-23795992143
feat: add worktree creation/lifecycle to coordinator spawn flow (gith…https://github.com/joniba/squad/commit/8f6a366afeffc194e304d95a6789a5b8724ca4fe
gith…https://github.com/github/squad/issues/525
8f6a366https://github.com/joniba/squad/commit/8f6a366afeffc194e304d95a6789a5b8724ca4fe
https://github.com/bradygaster
bradygasterhttps://github.com/bradygaster
on Mar 22, 2026https://github.com/github/squad/issues/525#issuecomment-4107177467
#527https://github.com/github/squad/issues/527
#528https://github.com/github/squad/issues/528
#529https://github.com/github/squad/issues/529
#530https://github.com/github/squad/issues/530
#531https://github.com/github/squad/issues/531
#531https://github.com/github/squad/issues/531
#527https://github.com/github/squad/issues/527
#528https://github.com/github/squad/issues/528
#529https://github.com/github/squad/issues/529
#530https://github.com/github/squad/issues/530
bradygasterhttps://github.com/bradygaster
on Mar 22, 2026https://github.com/github/squad/issues/525#event-23796186148
chore(.squad): triage #525, backlog prioritizationhttps://github.com/github/squad/commit/83d02dbb0c0f0d45448fa0658c1ec603c3a9d396
#525https://github.com/github/squad/issues/525
83d02dbhttps://github.com/github/squad/commit/83d02dbb0c0f0d45448fa0658c1ec603c3a9d396
chore(.squad): merge decisions, log #508/#525 fan-outhttps://github.com/github/squad/commit/c4b383da6832a507e3ad1cc0c92e78d020fca562
#508https://github.com/github/squad/issues/508
#525https://github.com/github/squad/issues/525
c4b383dhttps://github.com/github/squad/commit/c4b383da6832a507e3ad1cc0c92e78d020fca562
chore(.squad): merge decisions, log #508/#525 fan-outhttps://github.com/github/squad/commit/3744d5063dddb1a2ce6bec240cf3f8e2330c9c17
#508https://github.com/github/squad/issues/508
#525https://github.com/github/squad/issues/525
3744d50https://github.com/github/squad/commit/3744d5063dddb1a2ce6bec240cf3f8e2330c9c17
docs(decisions): architecture decision for worktree heuristic (#531) (#…https://github.com/github/squad/commit/b0b2cd6d63ff5946c9caeb264c59fe566228146d
#531https://github.com/github/squad/issues/531
#…https://github.com/github/squad/pull/532
b0b2cd6https://github.com/github/squad/commit/b0b2cd6d63ff5946c9caeb264c59fe566228146d
bradygasterhttps://github.com/bradygaster
completedhttps://github.com/github/squad/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#526https://github.com/github/squad/pull/526
on Mar 23, 2026https://github.com/github/squad/issues/525#event-23799577683
bradygasterhttps://github.com/bradygaster
on Mar 23, 2026https://github.com/github/squad/issues/525#event-23799585008
feat(sdk): post-merge worktree cleanup lifecycle (#530) (#540)https://github.com/github/squad/commit/c7462b5b4feb5cc4e81a1e33c6465d7b906bcda5
#530https://github.com/github/squad/issues/530
#540https://github.com/github/squad/pull/540
c7462b5https://github.com/github/squad/commit/c7462b5b4feb5cc4e81a1e33c6465d7b906bcda5
docs(audit): VCS removal Phase 1 prep (#498) (#542)https://github.com/github/squad/commit/703a38339da429eb61e9fd1dba9c9b7b55966606
#498https://github.com/github/squad/issues/498
#542https://github.com/github/squad/pull/542
703a383https://github.com/github/squad/commit/703a38339da429eb61e9fd1dba9c9b7b55966606
chore(.squad): log session completion — #508/#525/#498 all donehttps://github.com/github/squad/commit/04cbf845f3ae6aefd0ac6c8a3c10c88a494870df
#508https://github.com/github/squad/issues/508
#525https://github.com/github/squad/issues/525
#498https://github.com/github/squad/issues/498
04cbf84https://github.com/github/squad/commit/04cbf845f3ae6aefd0ac6c8a3c10c88a494870df
docs(.squad): log mega-session — #508 complete, #525 complete, #498 a…https://github.com/github/squad/commit/0e0e1601f83faa277047c778933162a44e79cda2
#508https://github.com/github/squad/issues/508
#525https://github.com/github/squad/issues/525
#498https://github.com/github/squad/issues/498
0e0e160https://github.com/github/squad/commit/0e0e1601f83faa277047c778933162a44e79cda2
chrislomonicohttps://github.com/chrislomonico
on Mar 26, 2026https://github.com/github/squad/issues/525#event-23921574632
feat: consolidated CLI help, shell, and docs improvements (github#546)https://github.com/clomonico/squad/commit/9d2e81dc0b568cb7afc4307b404a9a40aeda2f26
github#546https://github.com/github/squad/issues/546
https://docs.github.com/articles/closing-issues-via-commit-messages
9d2e81dhttps://github.com/clomonico/squad/commit/9d2e81dc0b568cb7afc4307b404a9a40aeda2f26
Sign up for freehttps://github.com/signup?return_to=https://github.com/github/squad/issues/525
Sign in to commenthttps://github.com/login?return_to=https://github.com/github/squad/issues/525
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.