The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
Phone Start Lead card Implementation Plan
This plan follows the project's own way of working (project instructions, Engineer): each plan task commits its failing test before its code, and the pull request's one review step is the independent review. There is no execution handoff; the Engineer implements it.
Goal: In a Personal Swarm, the phone's empty project chat with no Lead shows Desktop's Start card (#2815): pick one of the person's computers and Claude Code or Codex (only the ones signed in there), Start Lead, then Starting…, or "Couldn’t start a Lead: " and Start Lead again.
Architecture: Desktop starts a Personal project's Lead itself (desktop/lib/super_tabs/personal_lead.dart):
lead.claim (backend leadStart.ts), then the person's computer starts the agent in the project's repo folder (or a
new folder in its Harness projects folder) over Desktop's connection to it, then agent.add joins it as Lead. The
Swarm's own start (lead.start) can't serve a Personal project: it needs the project's repository on the server, and
a Personal project never sends one (personal_projects.dart). The phone has the same connection to the person's
computers (AppNotifier.createAgent), so it runs Desktop's three steps: it runs nothing itself, the computer does.
No backend change.
Tech Stack: Flutter (mobile/), widget tests with the Swarm fixture server (test/swarm/swarm_fixture.dart) and
a fake of the person's computers; AppNotifier rig tests (test/app_state_agent_rpcs_test.dart) for the computer
call.
Spec: Swarm task #2941's brief (Huy, 11-04), quoted in the pull request; Desktop's card plan
docs/plans/2026-11-04-personal-lead-start-card-plan.md.
Global Constraints
- Only a Personal Swarm (named
Personal, owned by the reader, no one else in it, Desktop'sPersonalProjects.eligible) shows the card, in a project's own chat that is open, has no Lead, and the reader can write. Team Swarms unchanged; the server refuseslead.claimoutside a Personal Swarm anyway (PERSONAL_SWARM_ONLY). - Computers: the person's own connected computers (never shared, never a Harness Team account, never one waiting for a link). Engines: Claude Code, then Codex, each only when installed (or installable) and not signed out there; an engine list not read yet offers Claude Code, as Desktop does.
- Folder: the project's repo folder on that computer when one of its agents there works in a checkout whose remote
makes this project's id (
personal-repo-<sha256 24>, Desktop'spersonalProjectOperation), else a new folder in the Harness projects folder. - Copy, as Desktop: "This project has no Lead yet", "Start Lead", "Starting…", "Folder:
- The start sends what Desktop's sends:
lead.claim {projectId, machineId}; the computer'sagent_createwithengine,cwdor the generated project folder (labelLead, the project's name),permissionMode: full,swarmRole: lead,swarmSkillMode(the project's), Desktop's Lead launch prompt, and for Claudemodel: opus,effort: xhigh; thenagent.add {conversationId, machineId, harnessId, name: Lead, lead: true, project, configuration}. - Harness design language: the phone's theme tokens only (
grid.App*), no new numericEdgeInsets,Coloror radius. - Never install on anyone's phone; screenshots come from widget tests in light and dark.
Review Focus
- Start Lead tapped twice, or a second tap while the claim is out: one claim, one computer start.
- The computer started the agent and
agent.addfailed: Start Lead again joins that same agent, never starts a second one. - Another of the person's machines holds the claim (
leadStart: waiting): the card shows Starting…, and the phone starts nothing. - None of the person's computers is connected, or no engine is signed in on the one picked: the card says why and offers no Start.
- The Lead joins while the card shows (another machine started it): the card goes on the next read.
- A failed join, then another computer picked: Start again claims the kept harness's computer and joins it; the card shows that computer and engine and offers no other until it joins (review of #3029).
Known limits (review of #3029, Minor): the harness kept for a failed join lives in memory only, so after the app
restarts Start Lead starts a second one; Desktop resumes its journal, the phone has none. The new folder is
ProjectFolderRequest.forTask(projectName) where Desktop sends generated(label: Lead, name: projectName): both send
the project's name as a suggested folder name the computer numbers past one that exists.
Task 1: The start, as Desktop runs it
Files:
- Create:
mobile/lib/swarm/swarm_lead_start.dart - Test:
mobile/test/swarm/swarm_lead_start_test.dart
Interfaces:
Produces:
typedef SwarmLeadComputer = ({String id, String name, List<String> engines, Map<String, String> folders}),folderskeyed by normalized remote (github.com/owner/repo).Produces:
typedef SwarmLeadLaunch = ({String engine, String? folder, String projectName, String prompt, String skillMode}).Produces:
typedef SwarmLeadStarted = ({String harnessId, String? cwd, String? remote}): the harness started, and the folder and remote it reports (foragent.add'sproject).Produces:
abstract interface class SwarmLeadComputers implements Listenable { List<SwarmLeadComputer> get leadComputers; Future<SwarmLeadStarted> startLead(String machineId, SwarmLeadLaunch launch); }: throws aSuperTabFailurewith the reason.Produces:
bool swarmWantsLeadStart(SwarmReader reader, String chatId).Produces:
String? swarmNormalizedRemote(String? remote)andString swarmPersonalProjectOperation(String repo)(ports of Desktop'snormalizedRemoteandpersonalProjectOperation).Produces:
typedef SwarmLeadPlan = ({String machineId, String engine, String? folder});SwarmLeadPlan swarmLeadPlan(SwarmReader reader, SwarmLeadComputers computers, String chatId, {String? machineId, String? engine}), throwingSuperTabFailure('NO_MACHINE', 'none of your computers is online')or('NO_ENGINE', 'Claude Code and Codex aren’t signed in on <name>').Produces:
class SwarmLeadStatus { starting | failed(reason) }andclass SwarmLeadStarter extends ChangeNotifierwithstatic SwarmLeadStarter of(SwarmReader reader),SwarmLeadStatus? statusOf(String chatId),Future<void> start(SwarmReader reader, SwarmLeadComputers computers, String chatId, {required String machineId, required String engine}).Produces:
String swarmLeadLaunchPrompt({required String tabId, required String conversationId}), Desktop'ssuperTabLaunchPrompt(lead: true)word for word.Step 1: Write the failing tests in
swarm_lead_start_test.dart, on the Swarm fixture server with a Personal Swarm (name: Personal, ownerme, onlyme) and a fakeSwarmLeadComputers:wants a Lead only in a Personal Swarm's empty project chat: true for the project chat with no Lead; false with a Lead joined, in a Team Swarm (another person in it, or another name), in a task chat, for a reader who can't write.the plan is the repo's folder on the picked computer, else a new one: folders keyed by the remote whoseswarmPersonalProjectOperationis the project's id give that folder; another computer gives null.the plan says why there is nothing to start on: no computers →none of your computers is online; a computer with no engines →Claude Code and Codex aren’t signed in on Studio.start claims, starts on the computer, then joins it as Lead: commands sent in orderlead.claim(projectId,machineId), thenstartLeadwith enginecodex, the folder, the project's name, the prompt and skill mode, thenagent.addwithharnessIdfromstartLead,name: Lead,lead: true,project.cwd.two taps make one claim and one start.a claim another machine holds starts nothing here and shows starting.a failure shows its reason, and Start again joins the agent already started:agent.addrefused withThis project already has its Lead.→ status failed withThis project already has its Lead; a second start sendslead.claimandagent.addagain but no secondstartLead.
Step 2: Run them and watch them fail:
flutter test test/swarm/swarm_lead_start_test.dartfails to compile (noswarm_lead_start.dart).Step 3: Implement the interfaces above. The started harness is kept per chat until its join succeeds.
Step 4: Run them and watch them pass (same command).
Step 5: Commit the tests, then the code.
Task 2: The card in the empty project chat
Files:
- Create:
mobile/lib/swarm/swarm_lead_start_card.dart - Modify:
mobile/lib/swarm/swarm_conversation_page.dart(theNo messages yet.branch) - Test:
mobile/test/swarm/swarm_lead_start_card_test.dart
Interfaces:
Consumes: Task 1's
swarmWantsLeadStart,swarmLeadPlan,SwarmLeadStarter,SwarmLeadComputers.Produces:
SwarmLeadStartCard({required SwarmReader reader, required SwarmLeadComputers computers, required String chatId}), keyedswarm-lead-start; its fieldsswarm-lead-start-machine,swarm-lead-start-engine, buttonswarm-lead-start-button, linesswarm-lead-start-folder,swarm-lead-start-error,swarm-lead-start-unavailable.Step 1: Write the failing tests in
swarm_lead_start_card_test.dart, opening the conversation page on the fixture withSwarmScopecomputers that implementSwarmLeadComputers:an empty Personal project chat shows the Start card with the person's computers and signed-in engines: card withThis project has no Lead yet, machine fieldStudio, picking listsStudioandAir, engine field lists only the engines of the picked computer (Claude Codeonly on Air),Folder: /Users/me/games.Start sends Desktop's start and shows Starting…: tap →lead.claimthenstartLeadon the picked computer and engine, button readsStarting…and is disabled.a failed start shows its reason and Start Lead tries again:startLeadthrowsCodex isn’t signed in→Couldn’t start a Lead: Codex isn’t signed in; tap again → a secondstartLead.no computer online says why and offers no Start.a Team Swarm's project chat shows no cardanda project with a Lead shows no card.- With
LEAD_CARD_SHOTS=<dir>, light and dark screenshots of the card ready, starting and failed.
Step 2: Run them and watch them fail:
flutter test test/swarm/swarm_lead_start_card_test.dartfails (noswarm-lead-start).Step 3: Implement the card with the phone's theme tokens: a title, a full-width machine field, an engine field, the folder line, a full-width filled button, the error line and the message line. In the conversation page, show it in place of
No messages yet.whileswarmWantsLeadStartholds andSwarmScope.computersOf(context)is aSwarmLeadComputers.Step 4: Run them and watch them pass, then the files that draw the conversation page:
flutter test test/swarm/swarm_conversation_test.dart test/swarm/swarm_chat_agents_test.dart.Step 5: Commit the tests, then the code.
Task 3: The app's computers start the Lead
Files:
- Modify:
mobile/lib/state/app_state.dart(createAgent:swarmRole,swarmSkillMode,launchModel) - Modify:
mobile/lib/swarm/swarm_computers.dart(AppSwarmComputers implements SwarmLeadComputers) - Test:
mobile/test/app_state_agent_rpcs_test.dart,mobile/test/swarm/swarm_lead_computers_test.dart
Interfaces:
Consumes: Task 1's
SwarmLeadComputers,SwarmLeadComputer,SwarmLeadLaunch,swarmNormalizedRemote.Produces:
AppNotifier.createAgent(..., String? swarmRole, String? swarmSkillMode, ({String model, String? effort})? launchModel), sendingswarmRole/swarmSkillModefor claude and codex only, andmodel/effort, as Desktop's.Step 1: Write the failing tests:
- In
app_state_agent_rpcs_test.dart,a Swarm Lead's create carries its role, skill mode and model:agent_createhasswarmRole: lead,swarmSkillMode: default,model: opus,effort: xhigh; a terminal's has none of the Swarm keys. - In
swarm_lead_computers_test.dart, on theAppNotifierrig:leadComputers lists the person's own connected computers with their signed-in engines and repo folders(a Team account and a shared computer left out; an engine signed out left out; an agent'sproject.remoteandrootgivefolders), andstartLead creates the agent in the folder, or a generated Lead folder, and answers its id.
- In
Step 2: Run them and watch them fail:
flutter test test/app_state_agent_rpcs_test.dart test/swarm/swarm_lead_computers_test.dart.Step 3: Implement.
startLeadcallscreateAgentwithpermissionMode: 'full',prompt,swarmRole: 'lead',swarmSkillMode, Claude'slaunchModel(model: 'opus', effort: 'xhigh'), and eitherfolderorProjectFolderRequest.forTask-style generated folder named after the project; a failure string becomesSuperTabFailure('CREATE_FAILED', failure); no agent id becomesthe computer didn’t say which harness it started.Step 4: Run them and watch them pass, then
flutter test test/swarm/swarm_lead_start_card_test.dart.Step 5: Commit the tests, then the code.