Skip to content

Add a built-in Agent messages plugin for agent-to-agent messages - #4772

Open
brsbl wants to merge 13 commits into
mainfrom
bb/improve-how-agent-to-agent-messages-are-thr_4u5mgu9qe7
Open

brsbl wants to merge 13 commits into
mainfrom
bb/improve-how-agent-to-agent-messages-are-thr_4u5mgu9qe7

Conversation

@brsbl

@brsbl brsbl commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Agents had no explicit way to address another agent, so every answer meant for an agent landed in the user's timeline as an ordinary reply. In busy coordinating threads this cluttered the timeline and buried the messages meant for the user: in one, 60 of 238 turns were started by another agent's message, and 52 of them ended with a visible reply. Outgoing messages were bb thread tell shell commands, hidden in the turn's work summary.

What changed

  • Agents message another thread with a new bb_thread_message tool from the built-in Agent messages plugin, which is off by default.
  • Agents answer another agent with the tool and answer the user in their normal response.
  • The sending thread shows each sent message as "Message to ", outside the work summary.
  • The receiving thread keeps its existing "Message from " row.
  • The tool refuses path-like thread IDs, its own thread, and side chats before sending anything.
  • The tool also refuses a thread that runs with broader permissions than the sender. bb tools skip the sender's approval prompts, so without this an accept-edits thread could set a full-access thread to work.
  • The tool's instructions prefer bb_thread_message, because only it shows the message in the sending thread. They reserve bb thread tell for its --mode queue, --send-at, --plan, and attachment options.
  • Agents are told not to announce or restate messages, because the timeline already shows them.
  • The plugin's instructions let agents answer a thread that messaged them. bb's core guide is unchanged, so agents without the plugin behave as before.
  • No server, SDK, contract, or daemon protocol changes. bb thread tell behaves as before.

How you verified

  • Remote CI passed on 128b7b92c6: 31 checks passed and 3 were skipped.
  • Live dev-app run with two Claude Haiku 4.5 threads: each agent answered the other through the tool, then the manager answered the user.
  • A fresh Claude Code session accepted the tool's thread-ID schema and completed a second exchange.
  • Fresh Sonnet 5.5 pair after the no-narration guidance: the worker answered through the tool and ended with one word. The manager still announced its send and relayed the reply.
  • Chrome for Testing: a hard reload showed no console errors, the row expanded, and the recipient link opened that thread.
  • Live dev-app check of the permission guard: an auto-mode thread tried to message a full-access thread, got the refusal, and nothing reached the full-access thread.
  • Slop Cop review of the stack found two P1s in this layer, both fixed here: the core-guide change and the approval bypass. P2 follow-ups are listed below.

Before: cd12e7a9df. After: 258f7b703c. Captured before the rebase onto main c201f6490a, whose two new commits don't touch the timeline. Same dev database, threads, and viewports, captured at 2×.

Screen / state Viewport Before After
Calendar worker (receiver) Desktop 1440×900 Before receiver After receiver
Release manager (sender) Desktop 1440×900 Before sender After sender
Release manager (sender) Mobile 390×844 Before sender mobile After sender mobile
P2 follow-ups, not in this PR
  • Pi threads do not tag plugin tool calls as bb:, so they show no "Message to" row.
  • The tool name and arguments are defined in both the plugin and thread-view, with no contract test linking them.
  • bb thread log prints a sent message as a generic tool row.
  • A third-party plugin can register bb_thread_message first and borrow the row.
  • Agent replies have no hop or rate limit, and the reply guidance revisits the decision in df121ea.
  • The bb-cli skill still points agents to bb thread tell.
  • A message that steers a busy recipient is folded into that recipient's work summary.
  • No test covers the app's completed-only check or live-turn bundling.
  • Claude Code persists plugin tool rows with a generic label and icon instead of the plugin's own.
  • Claude Code often calls a deferred bb tool before loading its schema, which leaves one failed attempt row before the first send. A per-tool always-load opt-in would fix it without loading every bb tool.
  • Agents still sometimes announce sends and relay replies despite the guidance.
  • Two Haiku agents traded five rounds of acknowledgements before stopping; there is no loop guard.
  • The permission check reads the recipient's default settings, not a one-off mode on a turn it is already running.

BB-Thread-ID: thr_4u5mgu9qe7

🤖 Generated with Claude Code

AGENT GENERATED

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 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-02T22:37:43.860699Z 019192a PR opened
ℹ️ 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: 019192ad67

ℹ️ 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 on lines +38 to +43
row.kind === "conversation" &&
row.role === "user" &&
row.initiator === "agent" &&
row.senderThreadId !== null &&
row.turnId !== null &&
!isExcludedSender(row.senderThreadId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict reply attribution to accepted agent messages

When an agent steer is still pending or is rejected, it still satisfies this predicate, so collectAgentReplyRecipients treats subsequent assistant output in the already-running turn as a reply to that agent. This can relabel output that was generated for the prior requester as “Reply to …” even though the agent message was never accepted; rejected/pending agent requests should clear or preserve the prior attribution rather than become the recipient.

Useful? React with 👍 / 👎.

@brsbl brsbl changed the title Show agent replies as chips and collapse agent conversations Show agent-to-agent conversations as chips on both threads Oct 3, 2026
@brsbl brsbl changed the title Show agent-to-agent conversations as chips on both threads Send agent-to-agent messages through a built-in tool Oct 3, 2026
@brsbl
brsbl added this pull request to stack #4823 October 3, 2026 18:49
@brsbl brsbl changed the title Send agent-to-agent messages through a built-in tool Add a built-in Agent messages plugin for agent-to-agent messages Oct 4, 2026
brsbl added a commit that referenced this pull request Oct 4, 2026
#4822 closed, so this layer now builds directly on #4772.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brsbl
brsbl removed this pull request from stack #4823 October 4, 2026 02:10
@brsbl
brsbl added this pull request to stack #4834 October 4, 2026 02:10
@brsbl
brsbl force-pushed the bb/improve-how-agent-to-agent-messages-are-thr_4u5mgu9qe7 branch from 258f7b7 to a9f3fc9 Compare October 4, 2026 02:39
brsbl and others added 13 commits October 3, 2026 22:46
Add the bundled Agent messages plugin with a bb_thread_message tool. An agent
messages another thread, or answers one that messaged it, through the tool,
and addresses the user in its normal response. The receiver already shows
"Message from"; the sender now shows the tool call as a matching "Message
to" chip outside the turn's work summary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The thread id reached the SDK's unencoded URL path, so a crafted id could
traverse to other loopback API routes or bypass the self-send guard. Accept
only a single id segment, and render chips only for canonical thread ids.

A side chat's forwarded message reads as an agent message in its main
thread; refuse to message side chats so the main agent answers the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tell agents the timeline already shows messages they send and receive, so
they should not announce or restate them, and to prefer bb_thread_message
over bb thread tell unless they need its options. Only lift successful or
in-flight calls out of the work summary, so a failed attempt stays folded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collapse two or more settled agent-started exchanges into one Agent
conversation row, skipping live, user-steered, pending, pinned, and
side-chat exchanges. Explain in the tool's instructions what
bb_thread_message and bb thread tell each offer, keep that out of the core
bb-cli skill, and keep the tool result to delivery status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Write the tool instructions as one short imperative paragraph like core bb
tool guidance, listing only the bb thread tell options agents need. Keep
GeneratedConversationMessage's existing layout, inline the side-chat check,
and collapse overlapping test cases into tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Treat the live row and the first unread row as pinned, so one rule keeps
those exchanges expanded instead of separate active-turn and divider
handling. Render the Message to row in ThreadTimelineRows from its contexts
like ConversationRow, and print grouped rows flat in CLI text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bb-guide introduction applies to every agent, so the exception for
answering an agent now lives in the plugin's own instructions and the core
line is unchanged. The tool refuses recipients that run with broader
permissions than the sender, because bb tools skip the sender's approvals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dgements

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er receives them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brsbl
brsbl force-pushed the bb/improve-how-agent-to-agent-messages-are-thr_4u5mgu9qe7 branch from a96bc1e to ec663e6 Compare October 4, 2026 05:46

This branch has not been deployed

No deployments
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.

1 participant