feat(instances): add multi-repo agent sessions#314
Merged
asheshgoplani merged 4 commits intoasheshgoplani:mainfrom Mar 16, 2026
Merged
feat(instances): add multi-repo agent sessions#314asheshgoplani merged 4 commits intoasheshgoplani:mainfrom
asheshgoplani merged 4 commits intoasheshgoplani:mainfrom
Conversation
Allow a single session to operate across multiple repositories simultaneously. Users can toggle multi-repo mode via "m" hotkey, add/remove paths with autocomplete, and the agent receives all paths via --add-dir flags. Key changes: - Data model: MultiRepoEnabled, AdditionalPaths, MultiRepoTempDir, MultiRepoWorktrees fields on Instance - UI: Multi-repo checkbox, stacked path list with inline editing, Tab autocomplete, parent-dir pre-fill on add - Session lifecycle: temp working dir, per-repo worktrees, cleanup on delete - Docker sandbox: WithMultiRepoPaths mounts each repo under /workspace/<name> - Persistence: extended tool_data JSON blob (no schema migration needed) - Fork support: propagates multi-repo state to forked sessions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of creating worktrees inside each original repo's .worktrees/ directory, create them all inside a single persistent parent dir at ~/.agent-deck/multi-repo-worktrees/<branch>-<id>/. Each worktree is named after its repo (e.g., server/, webapp/), making them co-located and avoiding permission prompts from the agent trying to access files across separate repo directories. For multi-repo without worktree, the same parent dir layout is used with symlinks instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrate upstream sandbox persistence changes (sandboxJSON, sandboxContainer fields in UnmarshalToolData/MarshalToolData) alongside multi-repo fields. Updated statedb test to match the new 22-value return signature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflict in single-repo worktree creation: combine upstream's worktree reuse detection (GetWorktreeForBranch) with our multiRepoEnabled guard that skips single-repo creation when multi-repo handles it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.agent-deck/multi-repo-worktrees/<branch>-<id>/, named after each repo (e.g.,server/,webapp/). This co-locates all repos under the agent's cwd, eliminating cross-repo permission prompts/workspace/<dirname>with automatic name deduplicationtool_dataJSON blob — no schema migration neededDirectory layout example
Test plan
go build ./cmd/... ./internal/ui/... ./internal/session/... ./internal/docker/... ./internal/statedb/...— compiles without errorsgo test ./internal/ui/...— all tests passgo test ./internal/docker/...— all tests pass (including newWithMultiRepoPathstests)go test ./internal/statedb/...— all tests pass (including new marshal/unmarshal round-trip tests)go test ./internal/session/... -run "MultiRepo|Deduplicate"— all new unit tests passgo fmt— no formatting issues~/.agent-deck/multi-repo-worktrees/🤖 Generated with Claude Code