Skip to content

feat: pick which repositories get a worktree in a multi-repo run, and add or remove them later - #352

Merged
LoganRupe merged 1 commit into
multi-repo-workspacesfrom
feature/multi-repo/thread-repo-subset
Oct 20, 2026
Merged

LoganRupe merged 1 commit into
multi-repo-workspacesfrom
feature/multi-repo/thread-repo-subset

Conversation

@LoganRupe

@LoganRupe LoganRupe commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Problem

In a multi-repo project, a new worktree copies every repository. A game repo with a big assets repo copies the assets on every task. A 70-repo polyrepo can't realistically use worktrees at all, so people work at the project root and lose per-repo diffs, commits and PRs. There was also no way to pull another repo into a thread once it had started.

Change

  • Pick repos when starting. The repositories menu (web composer, thread panel, mobile new task) has a checkbox per repo. Unpicked repos are linked into the run as the project's own checkouts, and agents are told they can read them but must ask before changing them. Above 8 repos nothing is picked until you choose; the server enforces the same rule, so MCP launches and early sends can't fan out 70 copies. t3_thread_launch takes repositories.
  • Add or remove mid-thread. Adding creates a worktree on the thread's branch and runs the setup script in it. Removing deletes the worktree, keeps the branch, puts the link back, and refuses while the worktree has uncommitted changes. On web this is in the thread panel; on mobile, the Git sheet.
  • Filter in every repo list once a project has more than 5 repos.
  • Claude picks up the change. Claude Code reuses a resumed session's original system prompt, so after a change Claude still had the old repo list. A reopened Claude process now gets the current list in its first prompt. Other providers already rebuild it every turn.
  • Two fixes found while testing: the thread panel stayed stuck in its compact layout after a 70-repo draft became a thread, which hid the repos menu. Separately, checkpoints for 70 repos took 2.2s each, now 1.5s (8 at a time instead of 4).

Known limit: a thread can't rewind to a turn from before a repo was added. This is noted in the user docs.

Scope and approval

Requested in the multi-repo projects discussion: choosing which repos get a worktree, telling the agent about the rest, and adding more later. This extends the existing multi-repo isolated runs on the fork's multi-repo-workspaces branch.

Verification

  • Tests: worktree subset, link, add, remove and dirty refusal against real git repos; launch subset and the 8-repo default; runtime policy and instruction blocks; a Claude test that fails without the reopen fix; single-repo setup script; shared picker and filter helpers. Server, web, mobile, contracts, client-runtime and provider packages typecheck clean.
  • Live on web (Claude Haiku): assets left out → agent reports it as shared, and the run is 12 KB instead of 150 MB. Added mid-thread → agent sees it on the next turn. Dirty remove refused. 70-repo project: nothing picked by default, Start blocked, filter to pick, 2 worktrees and 68 links.
  • Live on the iOS simulator (iPhone 17, iOS 27): filter, pick, start; add and remove in the Git sheet, checked on disk.
  • Not run live: Codex, Cursor, OpenCode (they rebuild instructions each turn, covered by the shared builder); Android.

Demo video (before/after, then web + iOS walkthrough):

repo-subset-demo.mp4

Written with Claude Opus 5.5 in Claude Code, running inside T3 Code.

… add or remove them later

An isolated run of a multi-repo project copied every repository, so a big
assets repo was checked out on every task and a 70-repo polyrepo could not
use worktrees at all.

The worktree strategy takes `repositories`. Left-out repositories are linked
into the run (or named by path when the run's root is itself a checkout), and
agents are told they are shared checkouts to read but ask before changing.
Above 8 repositories none gets a worktree unless named. A running thread can
add a repository (worktree on its branch, setup script runs) or remove one
(branch kept, refused while dirty). Web and mobile get pickers with a filter
past 5 repositories.

Claude Code keeps a resumed session's first system prompt, so a reopened
Claude process now gets the current repository list in its first prompt.
Multi-repo checkpoints run 8 at a time instead of 4.
@LoganRupe
LoganRupe merged commit bb01bc8 into multi-repo-workspaces Oct 20, 2026
@LoganRupe

Copy link
Copy Markdown
Owner Author
before-after.mp4

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant