Skip to content

Sonny: keep the person's settings when it changes a lead - #149

Merged
lydakis merged 66 commits into
mainfrom
claude/project-thread-45hlbm-settings
Oct 26, 2026
Merged

lydakis merged 66 commits into
mainfrom
claude/project-thread-45hlbm-settings

Conversation

@lydakis

@lydakis lydakis commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #148. This fixes the three ways Sonny could quietly overwrite something the person set.

Instructions. When Sonny opens a lead, it now refreshes the lead's instructions only if it saw a client compose what the lead holds now. It keeps one fingerprint file per lead in ~/.agent/sonny/instructions/<bot_id>. If the instructions were set any other way (configure from another client, or before Sonny ever saw the lead), Sonny keeps them and shows a note. The new /instructions command takes the folder's instructions again. The Rex note is gone from the instructions, since the rex-windows skill already says the same thing. So a lead's instructions read the same inside Rex and out, and no longer flip each time.

Model. /model now writes the lead's model and reasoning into .agents/project.toml when the folder has that file. Only those two lines change. Before the edited file replaces the original, Sonny parses it and checks it names what was picked. The global "last model Sonny ran on" (~/.agent/sonny/model) is gone. A new folder's lead takes --model, then the project file, the role, AGENT_MODEL, and finally the newest agent's model.

Picks while a turn runs. A /model or /approvals pick made mid-turn now shows in the footer as → MODEL EFFORT when idle (or · MODE approvals when idle) until it applies. If a configured event from another client changes the same setting first, Sonny drops the pick and says so, instead of laying it over the other client's change.

a pending model pick in the footer

Checked by hand against a protocol 14 daemon:

  • A fresh lead records its fingerprint.
  • Instructions set through the socket are kept on the next open, with the note.
  • /instructions restores the folder's instructions.
  • /model rewrote project.toml and kept the comment.
  • An /approvals pick made mid-turn shows in the footer and applies when the turn ends.

cargo test -p sonny passes, including tests for the file edit and for quoted keys.

🤖 Generated with Claude Code

claude added 26 commits October 26, 2026 00:31
Protocol 14. configure replaces what a bot's client chose when it made
it: its instructions, a model of the same family with an optional
effort, and a root bot's gate (approve: [] alone removes it; a bot
another bot made keeps the gates it descends from). It is refused
while a turn runs or waits parked, answers which fields changed, and
tells followers with a live configured event. ready.providers now
names the efforts each binding's family takes, and the client keeps
it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
The app's project file helpers and its ~/.agent/env reader move to
agent-client, so a terminal client composes a lead the app's way.
Finding a folder's project now stops at its repository's top, and the
home folder's project applies to home itself only, so a repo under
home is never claimed by it. The coordinator lists only its own
project's agents when it names or finds a task.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
Sonny opens a folder's lead in a Codex-style TUI, lays each task out as
a Rex window, and offers /model, /approvals, /status, /sound, /copy,
/open and /quit. Agents get a rex-windows skill, and an errand skill
when Errand is installed; Errand runs are drawn as calls, and detached
jobs open in their own Rex window. Pictures come in a follow-up.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
In a terminal that speaks the Kitty graphics protocol (Rex, Kitty,
Ghostty), Sonny draws a reply's SVG, Mermaid (through Pele), math
(through MathJax) and HTML pages as pictures, and agents get a
pictures skill saying so. Elsewhere they stay text.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
Each release also builds a universal sonny, packs it with the app's
signed agent daemon as sonny-X.Y.Z.tar.gz, and renders Formula/sonny.rb;
publish-homebrew validates and pushes the formula beside the Agent cask,
under the same tag. A formula's download is not quarantined, so sonny
needs no signing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
A steer restarts the demo script within a turn, and a turn keys its
calls by id, so each request now names its calls afresh.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
Clearing the thinking binding makes the next request strip thinking
written under the old instructions. The docs now say a client-made
fork's gates can be replaced too, since that client could make an
ungated bot anyway.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
…nect

- History and live results read Anthropic tool_use/tool_result blocks
  as calls and outputs, so Claude bots' calls show with their output.
- A history read the daemon cut at its byte limit asks for the rest.
- Calls still running when Sonny attaches finish live.
- After a reconnect the fleet reads the project's bots again, opening
  tasks that started meanwhile and marking stopped ones idle.
- An Errand listing that runs past three seconds is killed.
- A new lead takes the project file's model and effort first.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
A tool_started event carries a 2 KiB preview of a call's arguments, so
a truncated one is read from the bot's items. The bot is inspected
after the replay is skipped, so a turn that ended meanwhile is not
shown as running.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
- CSS variables are filled in inside tags only, so a Mermaid label
  that reads var(--x) stays as written.
- Image ids keep a 16-bit count, so pictures still in scrollback keep
  theirs for the first 65,535.
- A fence a reply never closed shows its lines as code when the reply
  ends, instead of vanishing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
…figure

A turn that ran before configure moved the bot keeps the model and effort
it ran at, in its record and as the cache the next turn takes as held. A
keyed creation keeps a fingerprint of the instructions it was sent with,
so a resend still matches after they are replaced. Schema 49.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
Sonny now replaces a lead's instructions on attach only when it saw a
client compose what they hold (a fingerprint per bot in
~/.agent/sonny/instructions.json); instructions set any other way are
kept, with /instructions to take the folder's again. The Rex note leaves
the instructions for the rex-windows skill, so they read the same in
any client.

/model writes the lead's model and effort to .agents/project.toml when
the folder has one, editing only those lines, and the global remembered
model is gone. A pick made while a turn runs shows in the footer and
applies when idle; one that another client overtakes is dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T02:35:44.551734Z 2a55cf8 New commits
🔒 Security Review ✅ Completed 2026-10-26T02:39:52.124388Z 2a55cf8 New commits
ℹ️ 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.

A failed edit, write or read shows its error instead of the change it
asked for. A call denied before it started is read from the bot's items
and shown as denied. Sonny opened anywhere in a project attaches to the
lead working in the project's folder, makes it there when missing, and
refuses a same-named lead working elsewhere. Reconnecting pages back to
the last node drawn and matches results to calls kept from before. The
next page of approvals shows once the first is answered. An unclosed
$( and a backslash before a non-ASCII character no longer crash the
renderer.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
claude added 12 commits October 26, 2026 01:46
The daemon outlives Sonny and gives agents its own path as AGENT_BIN.
Started from the versioned keg, that path is gone after an upgrade and
brew cleanup. The formula's sonny wrapper now names the opt path.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
- A hunk range that doesn't start with - or + is read as line 1 rather
  than sliced mid-character.
- While /status holds the screen, the newest 5,000 transcript lines wait
  for it and a note says how many earlier ones went by.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
- A call waiting on the person is written above the status row in full,
  every line of its command, before y can allow it.
- Bots Sonny makes get the default compaction instructions, as the CLI's
  and the app's do, so long conversations can compact.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks

@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: 47aea0520b

ℹ️ 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/project.rs Resolved
claude added 11 commits October 26, 2026 01:57
…, unclosed fences

A call listed with cut arguments is shown whole, read from the node that
planned it; when that read fails, y is refused and n denies it. Errand runs
are keyed by bot and call, since call ids repeat across bots. Transcript
lines go into scrollback in chunks a u16 row count holds. A fence or $$
block still open when a reply ends shows as code instead of vanishing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
…-thread-45hlbm-pictures

# Conflicts:
#	sonny/src/main.rs
#	sonny/src/transcript.rs
@lydakis
lydakis changed the base branch from claude/project-thread-45hlbm-homebrew to main October 26, 2026 02:33
# Conflicts:
#	Cargo.lock
#	client/src/project.rs
#	sonny/Cargo.toml
#	sonny/README.md
#	sonny/src/main.rs
#	sonny/src/project.rs
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