orca icon indicating copy to clipboard operation
orca copied to clipboard

[Feature]: multi-repo work driven by agent-managed worktrees and stacked PRs

Open minho-pinta-sh opened this issue 4 months ago • 0 comments

Problem or use case

This is a summary issue describing one workflow end-to-end, linking the specific gaps filed separately.

My workflow. I work on several repos at the same time. In each repo I drive the work with claude agents (Claude Code's Agent View) launched inside an Orca terminal pane. A single task frequently spans multiple repos, so I open work in more than one repo at once and cross-link the resulting PRs. Some PRs depend on other PRs, so the PRs form a tree.

Where Orca stops helping. The moment agents start managing worktrees and sessions themselves, they fall out of Orca's model:

  1. Agent View background sessions are invisible. Orca sees one foreground process per pane, so the N background sessions inside Agent View have no status anywhere — and, worst of all, no notifications when one finishes a turn or blocks on input.
  2. Agent-created worktrees look unmanaged. Worktrees Claude Code creates (.claude/worktrees/*, worktree-* branches) fall into Orca's "external worktree" bucket, which is hidden by default.
  3. Ownership is lost on access. When Orca opens an agent-created worktree, it doesn't bind that worktree to the Agent View session that owns it — so the workspace is ownerless and the live agent is unreachable from it.
  4. Agent worktrees arrive with no context — no linked issue, no linked PR — even though Orca already models those links.
  5. The PR tree is invisible. Orca shows each PR independently, so I can't see what is blocked on what, or learn that an upstream PR merged.
  6. Orca can't even launch Agent View. There's a launch mode for claude and for Agent Teams, but none for claude agents — and settings can't fake it.

The net effect: Orca is excellent at the workspaces it creates, and progressively less useful the more I let agents drive.

What makes this tractable: Claude Code already exposes the data. claude agents --json [--all] [--cwd <path>] lists background sessions without a TTY (sessionId, cwd, status, pid, …), --cwd scopes them to a directory, and the Notification hook pushes idle_prompt / agent_needs_input / agent_completed. Orca already runs an agent-hooks HTTP server for PreToolUse / PostToolUse / Stop. The pieces exist on both sides; they aren't connected.

Proposed solution

Filed as focused issues:

  • [ ] Agent View session tracking + notifications — consume Claude Code's Notification matchers (idle_prompt, agent_needs_input, agent_completed); one agent row per background session. → #7911
  • [ ] Adopt agent-created worktrees instead of hiding them behind externalWorktreeVisibility: 'hide'. → #7912
  • [ ] Bind an agent-created worktree to the Agent View session that owns it when Orca accesses it. → #7913
  • [ ] Auto-attach issue/PR context to agent-created worktrees. → #7914
  • [ ] PR dependency awareness (stacked PRs), read-only, sourced from existing stacking tools. → #7915
  • [ ] Support Agent View (claude agents) as a launch mode, scoped with --cwd <worktree>. → #7916

Multi-repo presentation is already tracked and I don't need a new issue for it — both shapes are useful to me depending on the task:

  • #1099 — one workspace containing several repos (for viewing diffs together)
  • #7568 — a task-level group of PR-aware, repo-scoped workspaces (for managing PRs)

Alternatives or additional context

  • Notes for anyone reproducing my setup: I scope Agent View per repo with claude agents --cwd ., which shows only the background sessions started under that directory. Agent Teams are a separate, experimental feature whose teammates run as separate processes (--teammate-mode), which is why they also escape pane-level tracking (cf. #2432).
  • Monorepo tooling (e.g. nx) does not address this: it orchestrates tasks within one repo and says nothing about cross-repo worktrees, agent sessions, or PR dependencies.
  • Related: #1165, #2432, #5104, #5700, #5718, #6943, #2654.

minho-pinta-sh avatar Jul 09 '26 08:07 minho-pinta-sh