Repository navigation
Sonny: /switch lists every agent to pick, and each agent acts in the terminal it is spoken to in - #604
Conversation
…ast typed /switch alone (and /lead alone) opens one list of every agent over the composer, found by typing with the shared matcher: the folder's leads first, then the project's agents, then other projects' leads, then the rest; the agent beside the conversation is picked to start, and a last row makes a new lead. /switch NAME still opens an agent at once, and a name found in none lists what it narrows to. Each of a project's Sonny windows now notes where it is (none for a bare terminal) and when the person last used it. An agent's show_agent and run_in_pane, and the lead's new task tabs, follow the open window used last, as tmux picks the most recent client, so a Sonny in Ghostty no longer opens agents in another terminal's Rex session. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
…ad's tabs opening there Codex review on #604: a worker window marking itself made the lead's window not the latest, so later task tabs stopped opening even in the same home; and a worker borrowed whichever home was typed in last. A lead now opens task tabs while the window used last is in its own home, and an agent's window takes its home once, when it starts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
Codex review on #604: /switch execs the other agent's Sonny in the same process, so the old project kept counting the window as open. Before exec its entry is kept as a closed window's (pid 0), its place kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
…once Codex review on #604: a task's window that replaced its lead's (the only open one) could not learn its home, so it never marked; it now gets the place it replaced in the same terminal (--window-place, unlisted). And a quick return from another window was lost to the once-a-second throttle: only typing is throttled now; Enter, clicks, pastes and focus mark at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
Codex review on #604: a window opened by show_agent with every Sonny closed could not learn its home. Every window Sonny opens in a layout (show_agent, the lead's task tabs, /switch) now gets --window-place; a window opened by hand falls back to the newest home known, open or closed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
The test wrote another sky's haiku while the read started at Ready could still be on its way; on a slow runner that older read landed last and the haiku was never seen. It now lets that read land first. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d64979b5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4616d39ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6307844273
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-7nasaw # Conflicts: # sonny/FEATURES.md # sonny/src/main.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2aa4891fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-7nasaw # Conflicts: # sonny/src/main.rs
|
The runtime job on 353b3a1 failed in Generated by Claude Code |
…-7nasaw # Conflicts: # sonny/FEATURES.md
George (on #604): talking to one agent in Ghostty and another in Rex at once, each should act where it is spoken to. The places record was one most-recent window per project; it now notes the agent each window shows, and an agent's show_agent/run_in_pane, and a lead's task tabs, go by the window used last of those showing that agent, a task's by its maker's, then the project's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGG8kk4PkzKWAc5neW8
…each multiplexer the machine has (#810) * Sonny: agents ask `sonny where` for their terminal, with a skill for each multiplexer the machine has An agent's run_in_pane and show_agent calls go to the window the person used last among those showing it (#604), but Sonny installed one multiplexer skill for every agent: the one for the terminal the last Sonny started in, removing the others. With a project open in Herdr and in cmux, the cmux agent opened its tabs in cmux yet said it was in Herdr. - `sonny where [AGENT]` prints the multiplexer and the workspace or session the agent's calls act in now, by the tools' own rule (mux::aim, which for_agent now opens). It reads the places file and asks a multiplexer only when no window says. - Sonny installs the skill of every multiplexer the machine has and removes one it no longer has; each tells the agent to run `sonny where` first and to follow the skill it names. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDUmvDiLkLgbMSmJMF * FEATURES: sonny where row names #810 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDUmvDiLkLgbMSmJMF * sonny where: find the window places under the daemon's own socket from a sandboxed shell A sandboxed agent's shell on macOS reaches the daemon by the bot's own socket, which no Sonny window notes its place under, so `sonny where` fell back to asking the multiplexers and could name the wrong one. It now reads the places noted under the socket it was given, else under the store's own socket, which Sonny windows use unless one is named. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDUmvDiLkLgbMSmJMF --------- Co-authored-by: Claude <[email protected]>
What happened
George had one Sonny running in Ghostty and another in Rex. In the Ghostty one he typed a bare
/switch, which only printed a hint asking for a name. His next words then went to the agent as an ordinary message, and the agent openedagent.leadwithshow_agent. That window opened in Rex. The cause is thatmux::for_agentread a single place per project, recorded by whichever Sonny last laid the project out. A Sonny in a bare terminal never writes one, so it could never take the project back. The Rex window also kept opening tabs for new tasks while George was typing in Ghostty.What changes
1. Each agent acts in the terminal it is spoken to in.
~/.agent/sonny/places/<hash>.jsonnow holds one entry per Sonny window of the project:{pid, bot, used_ms, place | null}. A bare terminal's entry has no place. A window marks itself, at most once a second, on any of these:For agent B,
mux::latest_forpicks the open window used last among those showing B. If no window shows B, it tries the windows showing the agent that made B, and so on up to the first lead (viacreated_by). If none of those has a window, it uses the project's window used last. Three things use that rule:show_agentandrun_in_panecalls (for_agent)open_leadon the other lead's own windowsFleet::showis gated onmux::mine(lead))So with one lead in Ghostty and another lead of the project in Rex, each acts where it is spoken to. The Ghostty lead's calls open nothing anywhere and return an error saying nothing opened would be seen. The Rex lead keeps opening its tasks' tabs. Every window Sonny opens in a layout is told its home with
--window-place:show_agent, the lead's task tabs, and/switch. A window opened by hand takes the newest home known.This is tmux's rule for a command that names no client, the client used most recently, taken per agent. The trade-off tmux accepts is that a window you only look at, without typing, clicking or focusing it, doesn't count. One case still shares a record: the same agent open in two terminals goes with whichever was used last.
2. One
/switchpicker;/leadalone is the same list. The picker sits over the composer (the one list component, usingfuzzy.rs):•. The agent beside the conversation is picked to start, otherwise the first one that isn't this window.workingand, for other projects, their folder in fish form.new lead [NAME], makes a new lead.picks.jsonunderagents./switch NAMEstill opens an agent at once. A name that matches no agent opens the list narrowed to it. This follows Claude Code's and Codex's/resume: one searchable list rather than a command per kind. A follow-up PR, still under discussion, replaces the new-lead row and/leadwith a/newcommand.Design pass
Checked against the interface system's "Pickers" and "Finding and confirming" rules and the visual system:
•marks the current agent↑↓ pick · enter switch · esc closeTests
mux: covers the window used last, which agent acts where with two terminals on two agents (each_agent_acts_in_the_terminal_it_is_spoken_to_in), closed windows, pruning,/switchhanding on its place, and the liveness check.switch: ordering, the beside agent picked first, narrowing, and the new lead's name./switch.cargo test -p sonny: 905 passed. Clippy: clean. fmt: clean.The runtime job's single failure on 353b3a1 is flake #612, from main, in code this PR doesn't touch. There is no daemon or protocol change.