Skip to content

Client-declared tools, and reactions in Sonny - #224

Merged
lydakis merged 7 commits into
mainfrom
claude/project-thread-q2z704
Oct 27, 2026
Merged

lydakis merged 7 commits into
mainfrom
claude/project-thread-q2z704

Conversation

@lydakis

@lydakis lydakis commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

For 0.4.1.

Reactions both ways in Sonny, built on a new daemon mechanism: tools a client declares on a bot. Design: Client-declared tools in the daemon.

Daemon: client-declared tools (protocol 19, schema 53)

  • create and configure take declare: [{name, description, parameters, result?}] (at most 16 tools, 64 KiB). configure replaces the whole set, and [] removes it. inspect reports declared, and configured names declared when the set changes.
  • The model is shown declared tools after the daemon's own tools. The daemon never runs one. A call that fits the schema gets the fixed result (default ok) at once. A call that does not fit gets invalid_arguments. The schema check covers an object, the required fields, a closed object's extra fields, and basic types. The call is otherwise ordinary: the usual events and history items, with no slot, no process, and no approval gate. Its meaning belongs to the client.
  • A name must not shadow a daemon tool, and duplicate names are refused (invalid_declare).
  • A bot created by another takes its creator's set unless its own client declares one. A fork keeps its source's set, and a fork's allow narrows declared tools the way it narrows the daemon's.
  • The request-encoding cache key includes the declared set. Changing the set keys a fork's own prompt cache from then on, as changing instructions does.
  • The schema 52→53 migration adds the declared column.

Sonny

  • Your reactions. An emoji sent alone (or a :shortcode:) is a reaction, not a message. It goes under the agent's last reply and is sent with delivery: attach, so it starts no turn.
    • /react picks an older reply. The agent is told which reply by its quoted first line.
    • Sending the same emoji again takes the reaction off.
    • Replay draws reactions under their reply, from ~/.agent/sonny/reactions/.
  • The agent's reactions. Sonny declares a react {emoji, remove?} tool on the bots it opens, but not on side chats. The declaration is sent with configure once no turn runs. Tasks a lead creates inherit it.
    • The tool's description says to react rarely, never in place of an answer, and never toward other agents.
    • A reaction lands on the person's newest message. Live, the net reactions are drawn when the turn ends. When nothing came between, they go right under the message, with no turn line if reacting was all the turn did. Otherwise they get a quiet row that quotes the message. A 👀 that is taken off again never shows.
    • Replay draws the agent's reactions under the message they answer.

Screenshots

From a scripted demo run against a real daemon: the agent's 🎉 under "Merged, thanks!" (a turn that only reacted) and the person's 👍 on a reply. The 👀 the agent put up while it worked on the notes and then took off is not drawn.

Reactions

/react picking an older reply, and the row that results:

/react picker

A reaction to an older reply

Tests

  • cargo test --workspace: all pass except the two sandfs tests in sonny/tests/task.rs, which need FUSE and fail on main in the cloud container too.
  • New store contract tests cover declaring on create and configure, creator inheritance, fork copies, fork allow narrowing, and the schema 52 migration.
  • New end-to-end test test_a_declared_tool_is_shown_after_the_daemons_and_its_call_is_recorded_not_run covers the shown order, the fixed result, invalid_arguments, invalid_declare, and removal via configure.
  • The Python suites tests.test_runtime, test_daemon, test_cli and test_delivery pass against a release build (135 tests). One test needs psutil, which the container lacks.
  • New Sonny tests cover live and replayed agent reactions, the declaration waiting for an idle bot, and the person's reactions.
  • cargo clippy --workspace --all-targets and cargo fmt --check are clean.

… turn

A message of only an emoji (or Slack shortcodes such as 👍) is the
person's reaction to what the bot said last. Sonny sends it with
delivery attach, so it starts no turn and the bot reads it with its next
model call, and draws it as a pill right under the reply. To a busy bot
it waits staged and lands where the running turn takes it in. Replayed
history puts a reaction an idle bot's next turn took in back under the
reply it answered, before that turn's prompt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDk4BeGJDqCBN5aYnW
A bare emoji still reacts to the bot's last reply; /react picks one of
its last nine by first line, and the emoji sent next reacts to that one.
The bot is told with an attached message (no turn): the emoji alone for
its last reply, quoted under the reply's first line for an older one.
Sending an emoji already on a reply takes it off. Reactions are kept by
reply node in ~/.agent/sonny/reactions/, so a replay draws them as a pill
under the reply they answer and leaves out the messages that told the bot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDk4BeGJDqCBN5aYnW
A client can now declare tools of its own on create and configure: a
name, a description, an object schema and a fixed result. The model is
shown them after the daemon's tools; the daemon never runs one. A call
that fits the schema is recorded at once with the fixed result, and one
that does not is `invalid_arguments`. The call is otherwise ordinary:
its events and history items are the usual ones, and the client gives
it meaning. Created bots take their creator's set, forks keep theirs,
and a fork's allow list narrows them. Protocol 19, schema 53.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDk4BeGJDqCBN5aYnW
Sonny declares a `react` tool on the bots it opens (not side chats),
once no turn runs. A call adds or takes off an emoji on the person's
newest message. Live, the net reactions are drawn when the turn ends:
right under the message when nothing came between, with no turn line
when that was all the turn did, else a row that quotes the message. A
replay draws them under the message they answer. The README shows both
kinds of reaction.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDk4BeGJDqCBN5aYnW
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-27T07:13:23.704062Z f48efaf Manual request
🔒 Security Review ✅ Completed 2026-10-27T07:16:36.319683Z f48efaf Manual request
ℹ️ 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.

@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: 6009f79398

ℹ️ 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
Comment thread sonny/src/main.rs Resolved
Comment thread sonny/src/reactions.rs Resolved
A `react` call is applied when it completes without failing, live and
on replay, so one the daemon refused is never drawn. Replay goes back
to reading history a batch at a time and draws the bot's reactions as
they were drawn live. Sonny adds `react` only within the daemon's
limits on declared tools, leaving a bot's own set as it is otherwise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDk4BeGJDqCBN5aYnW

lydakis commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: f48efaf55e

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: f48efaf55e

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

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