Repository navigation
Description
Item 4 of 11 in the Crews: organic teamwork milestone.
The problem
j5_list_participants is every agent's address book, and it knows nothing about crews. A row has a display name, a participant id, placement, and provenance, but no crew name, no seat, no "this is a Captain," and no responsibility. So:
- A seat that wants "whoever's doing review on my crew" has to guess from thread titles.
- A Captain that wants to coordinate with the Captain of another crew has no way to find them except titles. That's the cross-crew case in the fleet vision, where leads each run several PR Groups.
- When one Captain runs several crews, nothing says which seat belongs to which.
Where this sits
This is the lookup half of "crewmates know each other": #679 puts names on messages, this issue puts crews in the address book, and #681 pushes roster changes to the crew. It's also the cheapest fix for crews finding each other, since nothing else exists for that today.
Definition
The docs PR on j5/crew-teamwork-docs writes the end state into the definitions, so read these first; this issue builds to them. Agent tool surface AC39 (the crews field, the filter, and its refusal) and Crews AC26.
What we already have
- Tool and handler:
J5ListParticipantsToolinapps/server/src/j5/a2a/mcp/tools.ts:695and the handler inapps/server/src/j5/a2a/mcp/handlers.ts(around line 234), reading throughRosterService.ts. - Live crews, members, seat names, reasons, and Captains:
AgentCrewInstanceService.ts. Thereasonon each member is the responsibility the person approved. fleetRead.ts:31already builds a participant → crew seat map for the Fleet page, so that's the pattern to follow.- The documented contract:
docs/j5/product/a2a/agent-tools.md, sectionj5_list_participants.
Proposal
Each agent row gains a crews list covering every live crew the agent is in:
"crews": [
{ "crew_instance_id": "…", "crew_name": "Invoice Export", "role": "member", "seat": "Critic", "responsibility": "Independent review of the export PR" },
{ "crew_instance_id": "…", "crew_name": "Pricing Copy", "role": "captain" }
]Add a crew_instance_id filter that lists that crew's Captain and seats.
Acceptance criteria
- Each agent row on this server carries
crews: every live crew the agent captains or holds a seat in, with crew id, crew name, role, and for a member its seat name and approved responsibility. An agent in no crew gets an empty list. - A
crew_instance_idfilter returns that crew's Captain and live seats (plus the caller's own row and the people, as every listing does today). An unknown or retired crew id is refused, namingj5_list_participantswithout the filter. - Retired crews don't appear in
crews. - Peer-server rows leave
crewsout. A peer server doesn't report crews, and the doc says so. - The tool description says when to use the filter ("find your crewmates" and "find another crew's Captain") in a sentence or two, not a paragraph.
- The quoted tool descriptions in
agent-tools.mdstay as shipped until the code changes them, so this PR updates the shipped description and its quoted copy together (EnvelopeFormatter.test.tscompares thej5_send_messageone). The field and filter are already inagent-tools.md. - Focused handler tests cover a member, a Captain of two crews, a solo agent, a retired crew, and the filter.
Dependencies
- None blocking.
- Crews: tell existing seats when someone joins the crew #681's join notice can point at this filter for the current roster.
Activity