r/ClaudeAI • • 12d ago

Claude Workflow How do you decide where to start a Claude Code session? Local, worktree, cloud, or SSH?

I kept wondering which environment to pick when starting a new session in the Claude desktop app's Code tab, so here's how I think about it. I'd like to hear how others decide.

  • Local (your folder): The default. The session works directly in the folder you pick. Good for quick edits and small fixes where you want to see changes right away.
  • Worktree (separate branch): A second working copy of the repo on its own branch. Good for risky changes, or for running two tasks on the same repo at once without them colliding. Your main checkout stays untouched until you merge.
  • Cloud: Runs in a cloud environment against a GitHub repo. Good for long jobs you don't want to watch, or when your computer is off. The project has to be on GitHub.
  • SSH: Runs on another machine you can reach over SSH. Good when the code or the compute lives on a server or dev box.

Rule of thumb I use:

  • Small change, one task → Local
  • Risky change, or a parallel task in the same repo → Worktree
  • Long job while you're away → Cloud
  • Code on another machine → SSH

What's your default, and why?

20 Upvotes

20 comments sorted by

5

u/KingYF1 12d ago

My default is a git worktree, even for medium changes, not only for the obviously risky ones.

Local in the main checkout is fine for a typo, a test name, or reading around. The moment the agent might touch more than a couple of files, I want it in a worktree so a second session can keep going on something else, and so I can throw the whole tree away if the approach is wrong. After the branch is merged or abandoned I just git worktree remove. I keep them under a sibling directory like ../repo-wt/ so they don't clutter the main checkout.

Cloud I only use when I genuinely won't be at the machine: long test or eval runs, or a refactor I can check later. The loop is slower, and I still review the diff as if a junior had opened the PR.

SSH is for when the dependencies or the hardware aren't on my laptop, like a GPU box or an internal service. I still treat the git remote as the source of truth and pull the branch back to review locally.

The decision that actually matters isn't the host, it's isolation. Two agents in one working tree will overwrite each other and then spend tokens trying to understand the mess.

2

u/Ok_Gur_9033 12d ago

Local, almost every time, and my logs agree. Over the last 14 days I started 120 sessions. 119 came from the terminal in a local folder, one from the desktop app, and none in a worktree, the cloud or over SSH.

Most of my work is spread across separate repos, 17 folders in those two weeks, with a branch per job. About a quarter of the sessions ran on main or master and the rest on branches like a redesign or a dead code cleanup. The case I don't cover is two sessions in the same repo at once, which is what your worktree rule is for. Do you clean up worktrees after a merge, or do they pile up?

2

u/SoftwareNegative8783 12d ago

One thing people forget with worktrees: they do not copy .env, vendor or node_modules. In Laravel projects, both sessions also hit the same local database. Give each worktree its own DB name in .env.

1

u/Overall_Anywhere53 12d ago

Github repos for different projects, with all outputs locally or sent to Google Drive if I need them available online.

I don't need memory and framework MD files with rules locally, but I do need PDFs, docsx and other software based files locally.

1

u/ianreboot 12d ago

A new worktree gets the committed tree and nothing else, so whatever your repo keeps out of git is missing: node_modules, .env, the local database, the build cache. A cloud session on a fresh clone has the same hole. Which of the four is worth it usually turns on that. If rebuilding the environment is a script, worktree is cheap enough to use for anything you might throw away; if it is half an hour of memory, fixing that buys more than picking a different host.

1

u/Wezabis2 12d ago

My default is local on its own branch for anything I will review the same day, and a worktree when a second session is running in the same repo. The decision I actually check first is whether the environment rebuilds from a script, because a worktree or cloud session that starts without node_modules, env or the local database wastes the isolation it was supposed to buy. For cloud jobs I also require the agent to write a short progress note with test results every half hour or so, so a session that gets killed mid-run is resumable instead of lost. And I never start a cloud session on uncommitted work, since the cloud clone only sees what is committed, and that is the easiest way to lose an afternoon.

1

u/Terrible-Round1599 12d ago

I start the Mac session in the terminal (on iOS in Blink via mosh and tailscale) and move it to remote control. Each feature branch has its own worktree folder but git is not used in the traditional way. Way better than pull requests is for me just telling the agent to commit the master and then surgically implement the feature edits into it. When done, I sync it back to the feature folders.

1

u/TheAreaProblem 12d ago

i struggled with this so i built https://swarmcontrol.dev - it lets you run on your mac, so all your logins/claude sub, but access your agents anywhere (mobile, different computer etc.). you talk to a lead agent and they kick off worker agents so you can also parallelize well. give it a try and let me know what you think!

1

u/tommyahav10 11d ago

My default is local only for small, reversible changes.

If the task crosses modules, runs in parallel or may need to be abandoned, use a worktree. Cloud and SSH are execution locations; they don't replace isolation.

The real decision is whether the task can safely share state with your current work.

1

u/i_hav_tegridy 11d ago

there's kind of a fifth option for "long job while i'm away": a machine at home that stays on. i run the agents on my boxes at home and check in from my phone. the env is already set up (deps, .env, local db), the repo doesn't have to be on github, and it doesn't care if my laptop is closed or i'm travelling. downside is you're the one keeping it awake and updated haha.

also +1 to fantomkoenig on notes getting stuck on a branch. i keep task state outside the repos entirely, in a tracker every session can read, so it doesn't matter which worktree or machine a session runs in, they all see the same list

0

u/fantomkoenig 12d ago

Local, almost always. I run a few dozen Claude Code sessions in one repo and they talk through shared markdown files, notes another session reads an hour later. Put one in a worktree and its notes sit on a branch until somebody merges, so the others just don't see them. Your rule of thumb treats sessions as isolated tasks. Do yours ever need to read what another one wrote?

1

u/fulger099 11d ago

Once sessions hand work off, the repo becomes both codebase and message bus. With parallel sessions, I’ve found the harder problem is stale assumptions, so how do you keep those shared notes authoritative?