Skip to content

feat(agents2): teams and channel templates - #867

Open
baxen wants to merge 4 commits into
baxen/agent-siblingsfrom
baxen/agent-teams
Open

baxen wants to merge 4 commits into
baxen/agent-siblingsfrom
baxen/agent-teams

Conversation

@baxen

@baxen baxen commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Merge stack, bottom to top: #838 → #855 → #856 → #858 → #859 → #860 → #865 → #867 → #871. Each PR targets the one before it. Earlier stack notes here are superseded.

Folded in: #868 (closed). Their descriptions are below.

A first, local-only version of Agents2 teams.

  • Data: a team is its own record { id, name, instructions, members: pubkey[] } in localStorage (buzz.agents2.teams.v1). Agents store nothing about teams. Deleting a team never touches an agent; a deleted agent drops out of every team.
  • Prompt: each run's Delivery gets a team string with one <team> section per team the agent is on: the team name, every member's name and npub (the agent marked "you"), and the team's instructions in <team-instructions>.
    • Claude puts it after <agent-instructions> in the system prompt. It is part of the session fingerprint, so a change restarts an idle process and resumes its conversation.
    • Codex sends it with the per-turn buzz.instructions context, after the agent instructions, with a line saying the latest team sections replace earlier ones.
  • Channel members: typing in the members search also matches teams by name; "Add team" adds every member who is an agent in this community and not yet in the channel, through the normal per-member additions (each failure keeps its own Retry).
  • UI: a Teams button on the Agents2 page opens a side panel listing teams; create/edit with name, instructions and member checkboxes; delete from the editor.

Not included: leads, roles, team mentions, relay storage.

Testing

  • Unit: store round-trip/validation, service save/validate/prune and the roster in deliveries, Claude system prompt + resume on team change, Codex instructions, Agents2 page create/list/delete.
  • vitest run full suite: 8229 pass, one unrelated reminders timeout under load that passes in isolation.
  • Not yet: the panel in the running app (themes, widths, enlarged text), or a live run of two teamed agents.

🤖 Generated with Claude Code

From #868

Brings back channel templates on top of Agents2 teams. A template is a name, the teams a new channel starts with, and a starting Canvas.

  • Storage: templates are saved on this device in buzz.channel-templates.v1, the same way teams are (features/channel-templates/local.ts). Relay storage is deferred: teams don't fit the kit team record, which has no instructions field and is read per community. We'll revisit both together.
  • Settings → Channel templates: create, edit and delete templates (new card in the channels plugin).
  • Create channel: a Template select appears when any templates exist. Picking one sends the existing channel setup: the members of its teams who are your agents in this community, plus the Canvas. The session applies, confirms and retries that setup as before. Teams deleted since are skipped. A template that would add nothing here creates a plain channel.

Not brought back: group default templates, Save as template…, picking individual agents.

Validation

  • Full vitest run at 5b01707: 579 files, 8239 tests passed. New tests in local.test.ts, ChannelTemplateSettings.test.tsx and CreateChannelDialog.test.tsx.
  • tsc and design:check are clean.
  • An independent agent review ran. Fixed from it: an empty template no longer sends setup, a template deleted mid-draft no longer stays selected, a blank Canvas is not seeded, and an edit keeps team ids that aren't on this device.
  • Not yet exercised in the running app. Deferred to a native test: both themes, narrow/wide widths, keyboard.

Browser integration validation

The isolated mentions and packed-conversation fixtures provide the Agents dependency required by Channels. Settings keyboard traversal includes the new Channel templates entry. Full channel-completion, conversation, and Settings specs pass in Chromium and WebKit (22 cases); no retries, timeouts, or assertions were relaxed.

@baxen
baxen force-pushed the baxen/agent-teams branch from 79d3ac3 to caa7312 Compare October 11, 2026 21:50
@baxen
baxen changed the base branch from baxen/agent-audience to baxen/agent-siblings October 11, 2026 22:57
@baxen
baxen force-pushed the baxen/agent-siblings branch from 02298fd to 9eeaff8 Compare October 11, 2026 23:11
@baxen
baxen force-pushed the baxen/agent-teams branch from caa7312 to 4711adc Compare October 11, 2026 23:11
@baxen baxen changed the title feat(agents2): teams with shared instructions and a roster feat(agents2): teams and channel templates Oct 11, 2026
@baxen
baxen force-pushed the baxen/agent-siblings branch from 9eeaff8 to cdb4132 Compare October 11, 2026 23:55
@baxen
baxen force-pushed the baxen/agent-teams branch from 4711adc to 836de40 Compare October 11, 2026 23:55
@baxen
baxen marked this pull request as ready for review October 11, 2026 23:56
@baxen
baxen requested a review from a team as a code owner October 11, 2026 23:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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 ⚠️ Failed 2026-10-12T00:04:46.693045Z 836de40 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.

baxen and others added 4 commits October 11, 2026 17:09
A team is its own local record (name, instructions, member pubkeys) in
buzz.agents2.teams.v1; agents store nothing about their teams. Deleting a
team leaves its agents alone, and a deleted agent leaves every team.

Each run passes the agent a section per team it is on: the team's name,
every member's name and npub (marking the agent itself), and the team's
instructions. Claude adds it after the agent's own instructions in the
system prompt, so a change resumes idle sessions with the new prompt;
Codex sends it with the per-turn instructions.

The Agents2 page gets a Teams side panel to create, edit and delete teams.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bradley Axen <baxen@squareup.com>
Typing in the channel members search now also matches the owner's Agents2
teams by name. Each matching team with members not yet in the channel is
offered with an "Add team" button that adds those members through the same
per-member additions, so a failed one shows its own error and Retry.

Only team members that are agents in this community are added or shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bradley Axen <baxen@squareup.com>
A channel template is a name, the Agents2 teams a new channel starts with
and a starting Canvas, saved on this device in buzz.channel-templates.v1
like teams are. Settings > Channel templates creates, edits and deletes
them.

Create channel offers a Template select when any exist. Picking one adds
each member of its teams that is the owner's agent in this community, and
seeds the Canvas, through the existing channel setup, so the session still
owns applying, confirming and retrying it. A team deleted since is skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bradley Axen <baxen@squareup.com>
Provide the new Agents dependency in isolated Channels fixtures and include Channel templates in Settings keyboard traversal. Existing assertions remain intact: channel completion, packed conversation integration, and Settings pass in Chromium and WebKit (22 cases).

Co-authored-by: codex00 <6922125dbee102fcf02d2b32441fd56927c1298ac16119167f82f72529d13676@buzz.block.builderlab.xyz>
Signed-off-by: Bradley Axen <baxen@squareup.com>
@baxen
baxen force-pushed the baxen/agent-siblings branch from cdb4132 to e267355 Compare October 12, 2026 00:12
@baxen
baxen force-pushed the baxen/agent-teams branch from 836de40 to fc6c53d Compare October 12, 2026 00:12

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two changes needed: resolve template members through ready shared eligibility evidence, and restore keyboard focus when leaving the team editor. Details and smallest fixes are inline.

Star Lord automated source review via Wes’s account. Head fc6c53d9ce172ad83b2ccb5e73f2370b26937e83; base e2673550da9ae775ba0e89b11d0d2ab2f5b9bf04. Source-only: no tests, app/keyboard runs, or native agent execution performed. Public PR text and changed material inspected; no attached images were present.

Comment on lines +112 to +120
const agentNames = new Map(
(agentsSnapshot?.agents ?? []).map((agent) => [agent.pubkey, agent.name]),
);
const templateSetup = template && {
agents: templateAgents(
template,
agentsSnapshot?.teams ?? [],
new Set(agentNames.keys()),
),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Resolve template members from ready shared selection evidence

agentsSnapshot.agents is empty while the native list is loading or after an initial list failure, but the saved template/teams are already available. Selecting that template and submitting freezes agents: []; with no Canvas/group, setup is omitted entirely, so session.ts never performs its inventory preflight and a plain channel is created without the intended agents. This snapshot also includes archived agents, which the later templateAgentChoices check rejects on every retry. Use session.agentChoices with the existing template eligibility policy, and keep unresolved inventory distinct from a genuinely empty/deleted-team template before enabling submission. Add loading/error and archived-member coverage; the current tests only provide ready snapshots.

agents2={agents2}
agents={agents}
{...(team ? { team } : {})}
onDone={() => setEditing(undefined)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Restore focus when the team editor is replaced

Saving, deleting, pressing Escape, or closing the editor calls setEditing(undefined) and unmounts the focused form control. This panel is a plain <aside>, not a Dialog, and neither Teams nor Agents2Page restores focus, so keyboard users are left on the document body rather than back at the edited team (or New team after deletion). Preserve the initiating control and restore to the surviving Edit/New team action when focus was still in the editor; do not steal focus if the user moved elsewhere. Cover save, delete and cancel, plus retaining focus on a failed save, as required by DESIGN.md’s focus-restoration/state-transition rules.

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