PeakWatch · Guide

Claude Code tips: how to run long sessions without babysitting them

Claude Code tips for long sessions: scope the task, set permissions deliberately, use worktrees, checkpoint with commits and supervise from a distance.

By Hen Eytan, updated 7 min read3 sources
WAITING ON YOUWORKINGMIRROR · IDLEYOUR TURNThree sessions, one blocked. The ranked list tells youwhere to look

Key takeaways

  • Write the goal, done-criteria and constraints up front; keep repo facts in CLAUDE.md; plan first for big tasks.
  • Allow reads, tests and commits silently; keep the gate on pushes, installs, writes outside the project and anything destructive.
  • One worktree per session, commits at boundaries, and compaction after a commit keep long sessions revertable and sharp.
  • Supervise from a distance: Remote Control for the phone, PeakWatch for the wrist.

Short Claude Code sessions run themselves. Long ones, the hour-long refactor or the multi-file feature, need a different set of habits, most of which are about setting things up so you can walk away. These are the ones that hold up, checked against what the tool actually does.

Scope the task before you start

A long session with a vague goal wanders. Write the goal, the definition of done and the constraints in the first prompt, and put anything stable about the repo in a CLAUDE.md so it is read every time: build and test commands, conventions, known traps, the things you find yourself repeating. The best long sessions are the ones where the agent never has to guess what you meant.

A useful first prompt has four parts: the outcome in one sentence, how you will know it is done (a passing test, a command that succeeds, a page that renders), what must not change, and where to stop and ask. The last one matters more for a long session than a short one; "ask before touching the database schema" turns a possible bad hour into a question you can answer from your phone.

If the task is big enough that you would plan it yourself, start in plan mode. Claude reads files and runs read-only commands but does not edit until you approve a plan, which is a cheap way to find out whether it understood the job before it spends an hour on it.

Set permissions deliberately

Decide up front which tools can run without asking, and write it down in .claude/settings.json rather than answering the same prompt forty times. Claude Code reads file reads inside the project without asking in every mode; everything else is yours to allow or gate.

Let it run silentlyKeep the gate on
Reads, grep, the test suiteWrites outside the project directory
Bash(npm run *), Bash(git commit *)Bash(git push *), force pushes, rebases
Fetches from your docs domainsInstalls, package publishes, anything with credentials
Edits inside the working directory (acceptEdits mode)Deletes, rm -rf, database migrations

Rules are evaluated deny first, then ask, then allow, so a deny on git push holds even if a broader allow matches. The syntax, the modes and where each file lives are in the permissions guide. Never switch the gate off wholesale for a session you are not watching; the vendor's own documentation reserves that for isolated containers.

PeakWatch does this from your own data. Your coding agent, on your wrist. Join the free beta →

Run parallel sessions in worktrees

Two sessions editing the same checkout will eventually edit the same file. Give each independent task its own git worktree so they cannot collide, and so the diff you review later belongs to one task. Claude Code's server mode will do this for you: claude remote-control --spawn worktree gives every on-demand session its own worktree, and pressing w at runtime toggles the behaviour.

Name the sessions. In server mode --name sets the title you see on the phone; in a terminal, /rename does the same. Three sessions called "refactor auth", "fix flaky test" and "docs" are supervisable; three called by their hostname and a random animal are not.

Keep the number small. Two or three sessions is what one person can supervise well; beyond that the review queue, not the agents, is the bottleneck.

Checkpoint with commits

Ask the agent to commit at natural boundaries with descriptive messages. A long session then becomes a series of small, revertable steps, and reviewing the diff later is a review of commits rather than a wall of changes. If something goes sideways, you reset to the last good one.

  1. Put "commit after each passing test run" or similar in the first prompt or in CLAUDE.md.
  2. Allow Bash(git commit *) so the commits do not become prompts.
  3. Keep git push gated; the push is the one you want to see.

Keep the context window healthy

A session that runs for hours fills its context, and a full context is a slower, vaguer agent. Claude Code compacts the conversation automatically when it gets long, and /compact lets you do it at a boundary you choose, such as right after a commit, when the summary will be cleanest. /clear starts fresh when the next task has nothing to do with the last one.

Compaction is also why checkpoints matter: the commit log survives it even when the conversation does not.

Two habits keep compaction from losing anything that matters. First, put the durable facts in files rather than in the conversation: CLAUDE.md for the repo, a short plan file for the task, commit messages for the history. A compacted conversation can re-read a file; it cannot re-read what you said an hour ago. Second, ask for a one-paragraph status before a long break, so the summary exists before the context is squeezed.

Supervise from a distance

The habit that makes long sessions possible: leave. The session needs you at unpredictable moments for a few seconds each; be reachable for those moments without being tethered. Watching a terminal is an open inbox by another name, and it costs the same attention.

Anthropic's Remote Control covers the phone: run claude remote-control or type /remote-control in a session, open it in the Claude app, and enable Push when actions required under /config so permission prompts reach you as notifications. The step-by-step setup takes a minute, and the session keeps running on your machine.

PeakWatch covers the wrist. It puts the session list on a Wear OS watch such as a Galaxy Watch, ranked by which one is waiting, with the tool and arguments in every approval and a sixty-second countdown that denies if you do not answer. Dictate the next prompt from wherever you are; ask for a summary when you come back. It is in private beta.

Whichever device answers the ask, keep the deny-on-timeout rule. A forwarded permission prompt stays open in the Claude app until you answer it; on the watch it denies itself after sixty seconds. Neither turns into a yes because you were busy, and that is what lets you leave.

Review, then trust

Read the diff. Run the tests yourself once. Long sessions earn trust the same way colleagues do, by being right in ways you checked. Then widen the allow list a little, keep the gate on the things that can hurt, and let the next session run longer.

A practical rhythm: review the first session of a new kind of task line by line, the second by commits, and the third by tests plus a skim. Each round, promote one more command from ask to allow and demote anything that surprised you. The allow list in .claude/settings.json becomes a record of what you have learned to trust, and because it is committed, the team learns it too.

Want this answered from your own data?

That is what PeakWatch does. Your coding agent, on your wrist. In private beta — the waitlist is free.

Join the beta About PeakWatch

Questions

How long can a Claude Code session usefully run?
As long as the task is well scoped and checkpointed. Hours are fine; compaction keeps the context manageable and commits keep the work revertable. The practical limit is your plan's usage, which PeakWatch shows with reset times so you know before the last hour runs out.
Should I run several Claude Code sessions at once?
Yes, for independent tasks, each in its own working directory or git worktree so they cannot edit the same files. Two or three is what one person can supervise well. Ranked supervision, with the blocked session at the top, makes it manageable.
What goes in CLAUDE.md?
Build and test commands, conventions, known traps, and the things you find yourself repeating in prompts. Keep it short and stable; it is read at the start of every session, so anything that changes weekly belongs in the prompt instead.
How do I stop Claude Code asking the same permission every time?
Choose 'Yes, and don't ask again' on the prompt, which saves an allow rule to .claude/settings.local.json, or write the rule yourself, such as Bash(npm run *). Keep deny rules for the commands you never want run unattended; a deny wins over any allow.
Can I leave a long session and come back from my phone?
Yes. Run claude remote-control, or /remote-control inside the session, and open it in the Claude app or at claude.ai/code. The session keeps running on your machine, so the computer must stay on. Permission prompts and messages are forwarded.

Sources

  1. Anthropic. Claude Code documentation: best practices for agentic coding. https://docs.claude.com/en/docs/claude-code/overview
  2. Anthropic. Claude Code: configure permissions. https://code.claude.com/docs/en/permissions
  3. Anthropic. Continue local sessions from any device with Remote Control. https://code.claude.com/docs/en/remote-control
Hen Eytan · Founder, UPeak

Builds the UPeak apps and writes up the research behind them.