Overview
Give each coding agent task its own git worktree and its own local port or address, so parallel branches of an Electron app do not collide while you test them.
Problem or Objective
- Which agents build a non-trivial feature with you?
- Which agents take on multi-step tasks in the background and report back when they finish or need approval?
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code · Cursor · Electron
- Prerequisites
- Cursor cloud agents need source control connected by an admin; the loopback address setup is not covered by the cited pages.
How It Works
For each task, create a separate git worktree on its own branch instead of sharing one working folder. In Claude Code, ask for an isolated worktree for the task; for Cursor, consider a cloud agent, which the docs say works on a separate branch. Give each worktree its own dev-server port or loopback address, set through an environment file, so two copies of the Electron app can run side by side; how to add an extra loopback address is operating-system specific, so check your system's documentation. Start each agent with a short brief and its branch name, and keep logs per worktree. Review each branch separately and merge them yourself, one at a time, after the tests pass.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Cursor, Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code, Cursor, Electron.
- Check the prerequisitesCursor cloud agents need source control connected by an admin; the loopback address setup is not covered by the cited pages.
- Gather your detailsCollect what the prompt asks for: Task, Branch name, Dev server port for this worktree, Log folder.
- Run the starter promptPaste the starter prompt below into Cursor and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Start a task in its own worktree
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Create an isolated git worktree for the task "[Task]" on a new branch called [Branch name], and work only inside it. Use port [Dev server port for this worktree] for the dev server instead of the default, and keep logs in [Log folder]. Before changing code, tell me your plan and wait for my approval. Do not push, merge or delete any branch or worktree without asking me first.One worktree per task, one port per worktree, and a person approves the plan and every merge.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. The cited pages document Claude Code's worktree tool and Cursor cloud agents running on separate branches (the Cursor docs now redirect to docs.grok.com under Grok Build branding). They say nothing about Electron or extra loopback addresses, so the port and address setup is yours to test.
Limitations and Considerations
Worktrees separate files, not secrets or databases, so give each branch its own test data and keep credentials out of agent sessions. The cloud agent docs flag that cloud agents auto-run terminal commands, which they describe as a data-exfiltration risk from prompt injection, so use test secrets only. An admin must connect source control before Cursor cloud agents can work on repositories. Delete finished worktrees only after the branch is merged or pushed, and never merge without reading the diff. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Tool Repository
A tool this workflow relies on.
Official Website
The official site of the main tool or project in this use case.
Visit Website (opens in a new tab)code.claude.com
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Tools reference - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 2 Dec 2026, 13:30 UTC
What this source supports
- The EnterWorktree tool creates an isolated git worktree and switches into it.
- Cloud Agents (opens in a new tab)
Project documentation · docs.grok.com · Undated · Source checked 2 Dec 2026, 14:46 UTC
What this source supports
- Cloud agents clone your repo from GitHub, GitLab, Azure DevOps Services, or Bitbucket Cloud and work on a separate branch, then push changes to your repo for handoff.
- You can run as many agents as you want in parallel, and they do not require your local machine to be connected to the internet.
- Secrets & network (opens in a new tab)
Project documentation · docs.grok.com · Undated · Source checked 2 Dec 2026, 14:46 UTC
What this source supports
- Auto-running introduces data exfiltration risk: attackers could execute prompt injection attacks, tricking the agent to upload code to malicious websites.
- electron/electron README (opens in a new tab)
Project documentation · github.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- The Electron framework lets you write cross-platform desktop applications using JavaScript, HTML and CSS.

