Skip to content

Playbooks: the owner hands each step to someone #788

Open

Description

@bryantderosier

Item 3 of 9 in the Playbooks v2: one owner, flexible staffing milestone. It needs #795, and it's the biggest one.

The problem

Today a playbook decides staffing up front. When a Captain builds a Crew from a playbook, it proposes one seat per persona the steps name, adds a stand-in for any persona that's missing, and fixes each step to the seat that owns it when the roster is proposed. A run without a Crew gets no delivery at all, so the owner does every step itself. That's backwards. The agent following the playbook knows better than the YAML who should take a step, and a playbook shouldn't need a Crew to hand work out.

Where this sits

This is section 1 ("One owner, staffing chosen at runtime"), section 2 ("The owner hands each step to someone"), and the "no separate announcements" part of section 8 of the Playbooks proposal (26 October).

What we already have

  • Tool inputs. The Movement, Reselection, and Start schemas are at apps/server/src/j5/playbooks/mcp.ts:23-30, and only start takes crew_instance_id. The handlers are at mcp.ts:193-231.
  • Delivery records. Only a run started with a Crew gets them (PlaybookStore.ts:611-613 on start, :719-723 on a move). A run without a Crew returns no delivery (PlaybookCrewRelay.ts:313-316).
  • The table. j5_playbook_step_delivery and j5_playbook_run.crew_instance_id are in 029_CrewPlaybookRuns.ts:13-31. Rows are mapped at PlaybookStore.ts:94-136 and read and written at :807-857.
  • Fixed ownership. stepOwner and resolveTarget are at PlaybookCrewRelay.ts:86-110. A step that no live seat owns falls back to the Captain silently, as does a seat whose thread is archived or rejected the delivery (:43-48, :159).
  • The handoff. PlaybookCrewRelay.ts:118-201 calls threads.dispatch({type:"message.dispatch", createdBy:"system", dispatchMode:start_immediately}) with fixed command and message ids (:50-64, :160-181).
    • Its states map to delivered, captain, and pending at :67-77, and the contract is packages/contracts/src/j5/playbook.ts:105-114,132.
    • A pending handoff is only retried on the owner's next call (drainLocked, :207-216).
  • The step notice. crewStepNotice.ts:14-37 wraps the prompt in a <j5_playbook_step> header and a <step_prompt> block and ends with "report back to your Captain".
  • The lock. The relay serializes on crews.serialize(crewInstanceId) (:218-219), so a run without a Crew needs its own lock.
  • Retry keys. encodeRequest (PlaybookStore.ts:577-581, :655-660) has no assignee, so today a retry with a different assignee wouldn't conflict.
  • Ownership checks. The owner check is readRun's not_owner (PlaybookStore.ts:251-255). Starting with a Crew requires the caller to be its Captain and the Crew to follow the same playbook (PlaybookCrewRelay.ts:285-295).
  • The roster derived from step personas:
    • apps/server/src/j5/a2a/crewPlaybookPlan.ts:53-110, used at CrewProposalService.ts:188-209,688
    • j5_propose_crew's description and playbook parameters (a2a/mcp/tools.ts:384-394, :454-470, :563), and j5_request_crew_member's steps (:566)
    • its handler (a2a/mcp/handlers.ts:731-752)
    • the per-seat playbook_step_ids (028_CrewPlaybooks.ts), read and written at AgentCrewInstanceService.ts:24,208-225,238,298-309 and set at CrewLaunchService.ts:799,840
  • Crew text about playbooks:
    • the launch report tells the Captain to start the playbook (crewGateNotice.ts:180-182,203-206)
    • a seat's first turn carries a <seat_playbook> block saying "wait for that hand-off" (spawnIds.ts:137-148, fed from CrewLaunchService.ts:656-662)
    • the relay itself posts nothing to the owner's thread (PlaybookCrewRelay.ts:153-155)
  • How participants are identified:
    • Crew members are AgentCrewMember {seatName, participantId, threadId} (AgentCrewInstanceService.ts:14-25). The Captain is captainThreadId and captainParticipantId (:45-46).
    • Peer Agents have participant ids, resolved through A2ASendService.listParticipants, as j5_stop_agent does (handlers.ts:834-868).
    • delegate_task children have only a taskId, a childThreadId, and lineage with relationshipToParent:"subagent". ThreadRegistration.ts:67 keeps them out of A2A, so they have no participant id, can't use j5_send_message, and j5_stop_agent can't reach them.
  • UI showing ownership:
    • the Fleet header "Step N of M: title · holder" (apps/web/src/j5/fleet/fleet.logic.ts:34-54, rendered at FleetPage.tsx:474-477)
    • seat step badges (FleetPage.tsx:91-98,520, fleet.logic.ts:116-121)
    • the proposal card's seat steps and "Unowned steps, done by the Captain" (CrewProposalCard.tsx:89-95,142-252, apps/web/src/j5/crew/crewPlaybookPlan.ts)
    • on the server, fleetRun (PlaybookCrewRelay.ts:345-372) is read in fleetRead.ts:244-246. Only live Crews get a run there, and the contract nests it under FleetCrew.playbookRun.seat (packages/contracts/src/j5.ts:342-362), so a run without a Crew never shows in Fleet.

Proposal

  • j5_playbook_start, j5_playbook_next, and j5_playbook_back take an optional assignee, a participant id. Start no longer takes crew_instance_id.
  • The assignee is checked, and the holder recorded, in the same transaction as the move. A refusal leaves the run where it was.
  • Delivery keeps today's message.dispatch path with stable ids. The step notice carries the prompt unchanged, plus a line naming the owner to report back to, instead of "your Captain".
  • The holder is chosen at runtime instead of looked up from seat ownership. Reuse the delivery table with a runtime target, or add a column; the PR decides.
  • A run is serialized per run, whether or not it has a Crew.
  • Everything that derives seats from step personas goes away.

Acceptance criteria

Handing off

  • j5_playbook_start, j5_playbook_next, and j5_playbook_back take an optional assignee.
  • With an assignee, the platform delivers that step's prompt, unchanged, to the assignee as a fresh turn. Without one, the step stays with the owner, whose tool result carries the instructions as it does today.
  • The owner can hand the current step to someone else, or take it back, without moving. This is how it recovers from a holder that's stuck or archived.
  • An assignee the owner can't hand work to is refused with a clear error, and the run doesn't move. That covers a kind of participant that can't be named (see the open question below), a participant that isn't the owner's, and an archived one. Nothing falls back to the owner silently.
  • The holder is recorded on the run and attributed to the owner who named it. j5_playbook_current returns it.
  • The holder's notice says it holds the step, and who to report back to. Only the owner can move the run; the holder's movement calls are refused with not_owner.
  • A retry with the same client_request_id and the same assignee delivers once. The same id with a different assignee is a request_conflict.
  • A handoff whose dispatch fails stays pending and is retried on the owner's next call, as today. j5_playbook_current shows it as pending.
  • Runs without a Crew can hand off steps. They're serialized per run.

No Crew required

  • Starting a playbook doesn't take or need a Crew. The owner can start a Crew later, or hand steps to a Crew it already captains, without restarting the run.
  • Playbooks no longer derive a roster from step personas or create stand-in seats:
    • crewPlaybookPlan.ts is removed;
    • j5_propose_crew and j5_request_crew_member lose their playbook step parameters;
    • the proposal card no longer shows seat steps or "Unowned steps";
    • the launch report no longer tells the Captain to start a playbook;
    • a seat's first turn has no <seat_playbook> block.
  • Fixed seat ownership in j5_playbook_step_delivery, and the per-seat columns from 028, stop being read and written. Old proposals and Crews that have them still decode.

What I see

  • Fleet shows who holds the current step for every run, including runs without a Crew.
  • A handoff adds no launch, handoff, or completion announcements to the owner's chat. Worker activity stays in lineage.

Tests and docs

  • Focused tests cover:
    • delivery to a Crew member and to a Peer Agent;
    • no assignee, which keeps the step with the owner;
    • reassigning the current step without moving;
    • each kind of refused assignee, with the run unmoved;
    • a retry with the same assignee and with a different one;
    • a handoff in a run without a Crew.
  • docs/j5/product/features/playbooks.md is rewritten: the Definition's step-owner paragraphs, AC2, AC5, and the "A release Playbook" and "A Crew from a playbook" scenarios. crews.md and agent-tools.md drop the Crew-from-playbook wording. The shipped tool descriptions change with their quoted copies.

Surfaces

Agents through MCP and scheduled tasks; Fleet on web and desktop (Crews have no mobile surface); and Codex, Claude, and Cursor as both owner and holder.

Out of scope

Open question

Which participants can be named to take a step? I'd allow Crew members of a Crew the owner captains, and Peer Agents the owner spawned: anything with a participant id the owner can message and stop. I wouldn't allow delegate_task children. They have no participant id, can't message anyone, and j5_stop_agent can't reach them, so neither the report-back nor cancelling would work. The owner can still use delegate_task inside a step it holds. Provider-native subagents work under whoever holds the step. The AC above is written that way.

Activity

  1. added
    enhancement
    on Oct 29, 2026
  2. changed the title [-]Playbooks: revise an active run's procedure[/-] [+]Playbooks: the owner hands each step to someone[/+] on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions