[Feature]: Support Claude Code Agent View (`claude agents`) as a launch mode
Problem or use case
Claude Code's Agent View (claude agents) is the TUI that manages background sessions. It's how I actually drive my work: I open Agent View and run several background sessions, often isolated in their own worktrees.
Orca has a launch mode per TUI agent (src/shared/tui-agent-config.ts): claude launches the claude binary, and claude-agent-teams launches the orca claude-teams wrapper — which is Agent Teams, a different Claude Code feature. There is no launch mode for Agent View.
Agent View is directly scriptable and scopable, which is what makes this worth wiring in properly. From claude agents --help:
--cwd <path>— "Show only background sessions started under<path>" (a scope filter, not a working-directory setter)--json— "Print active sessions as a JSON array and exit (for scripting; does not require a TTY)"--all— with--json, include completed sessions- plus per-dispatch defaults:
--agent,--model,--effort,--permission-mode,--allow-dangerously-skip-permissions,--add-dir,--mcp-config,--settings
So claude agents --cwd <worktree> is exactly "Agent View for this workspace."
Today I can't get that through Orca. It also can't be faked through settings:
agentDefaultArgsis documented as "CLI arguments appended after the binary/path and before prompts", andclaudeusespromptInjectionMode: 'argv'withdraftPromptFlag: '--prefill', so the final command isclaude <args> --prefill "<prompt>". Puttingagentsin the args yieldsclaude agents --prefill "…"— the prompt flag lands after a subcommand, and Orca's prompt injection and session tracking both assume the normal interactive chat TUI.agentCmdOverrides(replacing the binary withclaude agents) hits the same problem.
Proposed solution
- [ ] Add an Agent View launch mode that runs
claude agents --cwd <worktree path>, so the view opened from a workspace shows exactly that workspace's background sessions. - [ ] Don't apply the single-chat prompt-injection path to it — Agent View is a session manager, not a chat.
- [ ] Pass through the useful per-dispatch defaults (
--agent,--model,--permission-mode) from Orca's agent settings. - [ ] Wire it into the rest of the agent model: per-session tracking/notifications, and binding each background session to the worktree it owns.
Alternatives or additional context
- Agent Teams (
orca claude-teams) is a different feature: teammates run as separate processes (--teammate-mode, tmux/iTerm2 split panes or in-process), which is why they also escape pane-level tracking (cf. #2432). This request is specifically about Agent View. --jsonmeans Orca doesn't need to scrape a TTY to know what's running — see #7911.- Related: #7911, #7913, #2432, #5700.
- Part of #7918 (umbrella: multi-repo work driven by agent-managed worktrees and stacked PRs).
Some diagnostics from running Agent View inside Orca, in case it helps scope this (Orca 1.4.217, Claude Code 2.1.288, macOS).
Symptom: sessions dispatched from claude agents never appear in Orca's sidebar agent list, no matter which Orca tab they are viewed or attached from. Regular claude sessions in the same worktree are listed normally.
What I found:
- The first
claude agentsrun spawns a detached daemon (claude daemon run --origin transient …, parentlaunchd). It inherits the fullORCA_*environment of the Orca tab it was started from (ORCA_TAB_ID,ORCA_TERMINAL_HANDLE,ORCA_PANE_KEY,ORCA_AGENT_LAUNCH_TOKEN, …). - Every background session runs as a child of that daemon (
claude bg-pty-host→claude bg-spare), so all of them carry that one tab's identity, including sessions dispatched or attached from other tabs. - A tab running
claude agentsorclaude attach <id>only hosts a viewer. The session's hooks fire inside the daemon's child process, not in the viewer's pane. agent-hooks/last-status.jsonhad no entries for either the daemon's origin tab or the viewer tabs. I did not pin down where the events are dropped (hooks not reaching the server vs. being rejected by the pane/authority checks).
Gotcha when working around it: claude --resume <id> for a session that is still alive in the daemon does not start a local session. Claude Code turns it into claude attach <id> (visible in ps), so the session stays undetected. /exit or ← in the attached view also leaves it running (claude attach --help: "The session keeps running either way").
Workaround that works: stop the background session first (exit it from Agent View, or claude stop <id>), then run claude --resume <full-session-id> in a normal Orca tab. The process is then a plain claude --resume … owned by that tab, and Orca lists it right away.
Repro:
- Orca tab A: run
claude agentsand dispatch a session. - Orca tab B: run
claude agents(orclaude attach <id>) and open that session. - Neither tab shows the session in the sidebar.
ps eww <session pid>shows tab A'sORCA_TAB_ID/ORCA_TERMINAL_HANDLE.
Possibly useful for an implementation: claude agents --json lists both interactive and background sessions with sessionId, cwd, state, and pid for live processes.