Skip to content

Sonny: agents ask sonny where for their terminal, with a skill for each multiplexer the machine has - #810

Merged
lydakis merged 3 commits into
mainfrom
claude/project-thread-eqgptt
Nov 8, 2026
Merged

lydakis merged 3 commits into
mainfrom
claude/project-thread-eqgptt

Conversation

@lydakis

@lydakis lydakis commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Problem

With a project open in a Herdr window and a cmux window at once, an agent opened its tabs correctly in cmux, but when asked "do you know you're inside cmux?" it answered "No, I'm inside Herdr" (FEEDBACK H19).

Since #604, an agent's run_in_pane and show_agent calls go to the window the person used last among those showing it (mux::latest_for). The skill was still chosen by the old rule, though: mux::install_skill installed one multiplexer skill for every agent, picked from whichever terminal the most recent Sonny started in, and removed the other skills. So every agent read the text for that one multiplexer.

Reproduced on the old code: with fake herdr and cmux on PATH, a Sonny start in a cmux tab installed cmux-tabs. A later start in a Herdr pane replaced it with herdr-panes, and every agent's skill then began "Herdr is the terminal multiplexer the person watches the work in".

Change

  • sonny where [AGENT] prints one line: the multiplexer, plus the workspace or session the agent's calls act in right now. Examples: cmux, workspace workspace:3, Herdr, workspace w1, or an error saying nothing opened would be seen. In an agent's shell, AGENT defaults to $AGENT_BOT. The rule lives in one place: mux::aim decides, and for_agent now just opens whatever aim names, so the command can never disagree with the tools.
  • A skill for each multiplexer installed on the machine. rex-windows, herdr-panes and cmux-tabs are each installed when that CLI is found, and removed when it is not. The "last window to start wins" rule is gone. Each skill opens with a "Which terminal" section: run sonny where first, before opening anything and whenever the person asks where you are, then follow the skill for the multiplexer it names.
  • Performance. sonny where reads the project's places file and asks a multiplexer only when no window of the project's is known, the same as the tools do. It does no file walks and took about 11 ms a call in a debug build against a real daemon. In the fallback branch, the cheap like check now runs before the has_lead CLI call.

This is a Sonny-only change; nothing in the daemon changed. It adds a FEATURES row and updates README and docs/SONNY.md.

Tests

  • an_agent_in_herdr_and_cmux_acts_in_the_one_used_last: one agent has a Herdr window and a cmux window. Its calls aim at the window used last and follow the person when they switch. All three skills stay installed, and each mentions sonny where.
  • an_agent_with_no_window_acts_where_its_lead_is_or_nowhere: covers the fallbacks and the errors, and checks that a multiplexer the machine no longer has loses its skill.
  • End to end against a real agent daemon with a hand-written places file: sonny where printed cmux, then Herdr after the Herdr window's use time moved ahead. It gave the typed error for a project that has no window, and the usage text when no agent was named.
  • cargo fmt --check and cargo clippy -p sonny --all-targets are clean.

…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
@lydakis lydakis self-assigned this Nov 8, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T00:48:58.642729Z 5edcf62 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-08T00:51:34.778698Z 5edcf62 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lydakis
lydakis marked this pull request as draft November 8, 2026 00:39
@lydakis
lydakis marked this pull request as ready for review November 8, 2026 00:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7d9cfadc3

ℹ️ 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".

Comment thread sonny/src/main.rs Resolved
…m 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
@lydakis
lydakis marked this pull request as draft November 8, 2026 00:47
@lydakis
lydakis marked this pull request as ready for review November 8, 2026 00:47
@lydakis
lydakis merged commit 2dd9577 into main Nov 8, 2026
5 checks passed
@lydakis
lydakis deleted the claude/project-thread-eqgptt branch November 8, 2026 01:14
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.

2 participants