How to Run Claude Code Unattended

How to keep a Claude Code session alive, handle approval gates from your phone, and check in on progress without touching a laptop.

Running Claude Code unattended requires solving three problems at once: keeping the process alive after you close your terminal, handling approval gates that would otherwise stall the session indefinitely, and staying visible to the agent's progress without opening a laptop. With tmux handling persistence, Grass handling mobile approvals, and optionally Daytona removing the laptop dependency entirely, you can kick off a Claude Code task before bed and wake up to a finished session — not a frozen one.

TL;DR

  • Use tmux to keep Claude Code running after your terminal closes
  • Use Grass to approve or deny tool requests from your phone — no stalled sessions
  • Use grass start --network tailscale or --network remote-ip to connect remotely
  • For fully unattended cloud runs, use Daytona so the agent doesn't depend on your laptop being on
  • --dangerously-skip-permissions is an option, but it removes all oversight — understand the tradeoff

The problem with running Claude Code unattended

Claude Code is built to run autonomously. According to Anthropic's research on agent autonomy, the 99.9th percentile turn duration for Claude Code sessions exceeded 45 minutes as of early 2026 — up from under 25 minutes in late 2025. Full feature builds run across many sessions totalling hours.

But two things reliably break unattended runs:

Terminal death. Close your laptop lid, lose your SSH connection, or let your terminal emulator time out — and the Claude Code process dies with it. The work stops mid-task.

Approval gates. By default, Claude Code asks for permission before executing shell commands, writing to files outside your project directory, or making network requests. If you're not at the keyboard to approve, the session parks itself and waits. Indefinitely. You come back eight hours later to a frozen prompt.

These aren't edge cases. They're the default behaviour, and they make truly unattended runs impossible without additional tooling.

How Grass solves this

Grass addresses the approval gate problem directly. When Claude Code hits a tool execution that requires your sign-off, Grass surfaces a native permission modal on your phone — regardless of which screen you're on in the app. One tap to approve. One tap to deny. The session continues.

This means you don't have to choose between oversight and mobility. You step away, your agent runs, and if it needs you, your phone tells you — the same way a message notification works. The agent approval gate never becomes a dead end; it becomes an async check-in.

Grass also streams live agent output over SSE so you can check progress at any point. Open the app on the train, see what your agent has written, read the diff. No laptop required — this is mobile coding agent access in the most literal sense.

Step-by-step: setting up Claude Code for an unattended overnight run

  1. Start a tmux session before you begin. tmux new -s overnight creates a named session that survives terminal disconnects. If you lose the connection, tmux attach -t overnight brings you straight back.

  2. Install the Grass CLI if you haven't already: npm install -g @grass-ai/ide (requires Node.js 18+).

  3. Start Grass in your project directory. Run grass start — it auto-selects a port from 32100–32199 and prints a QR code. Scan it with the Grass mobile app.

  4. Start your Claude Code task from within the same tmux session. Claude Code runs normally; Grass monitors it alongside.

  5. Set up remote access. If you'll be away from your home network, run grass start --network tailscale (if you have Tailscale set up) or grass start --network remote-ip to generate a QR code that encodes your external address. Scan it once; the connection is stored in the app.

  6. Close your laptop. The tmux session keeps Claude Code running. Grass keeps streaming to your phone. When the agent hits an approval gate, you get a modal. Approve or deny from wherever you are.

  7. Resume if needed. If the session ever drops, claude --continue or claude --resume picks up where it left off using the .jsonl transcript stored at ~/.claude/projects/<cwd>/<session-id>.jsonl. See the Claude Code CLI reference for full flag documentation.

What about --dangerously-skip-permissions?

Claude Code includes a --dangerously-skip-permissions flag that bypasses all approval gates. The agent runs without ever pausing for your input.

This is the maximum-autonomy option. It's also zero-oversight. The agent can execute shell commands, write files, and make network requests without any confirmation. If it goes off-track — and agents do go off-track — you won't know until you check back in.

Use --dangerously-skip-permissions when:

  • The task is well-scoped and reversible (e.g. generating test files in an isolated branch)
  • You're running in a sandboxed or throwaway environment
  • You've reviewed the task plan and are confident the agent won't need to make judgment calls

Don't use it when:

  • The task involves database writes, external API calls, or infrastructure changes
  • You haven't read what Claude Code is planning to do
  • The environment is not isolated

The Grass approach is the middle path: you stay hands-off by default, but you're reachable when it matters.

For fully cloud-based unattended runs: Daytona

If you want Claude Code to run without your laptop being on at all, Daytona removes that dependency. Daytona spins up transient dev servers — ephemeral remote workspaces that you can provision, run a task on, and tear down. See the Daytona workspaces documentation for setup details.

The workflow: spin up a Daytona workspace, run grass start --network tailscale or grass start --network remote-ip on it, scan the QR code. From that point, your agent runs on a remote server. Your phone connects to it. Your laptop can be off, dead, or in another country.

Grass includes Daytona support out of the box — you can provision a workspace directly from the app. Free credits are included.

What do you need to run Claude Code unattended?

  • Grass CLI: npm install -g @grass-ai/ide (Node.js 18+)
  • Grass mobile app: iOS App Store (native) or Android PWA at codeongrass.com
  • tmux (for local runs): brew install tmux or your distro's package manager
  • Claude Code installed and authenticated
  • Optional: Tailscale for remote network access
  • Optional: Daytona account for fully cloud-based runs (free credits included)

Frequently asked questions

Can Claude Code run without supervision?

Yes, but with caveats. Claude Code will run autonomously until it hits an approval gate — at which point it pauses and waits for input. Without a way to handle those gates remotely, unattended runs stall. Grass surfaces approval requests as mobile notifications so you can respond from your phone without being at a keyboard. Alternatively, --dangerously-skip-permissions skips all gates, but removes all oversight.

How do I run Claude Code overnight?

Run Claude Code inside a tmux session so the process survives terminal disconnects. Install Grass alongside it to handle any approval gates that come up while you're asleep. If you want to check progress in the morning without opening a laptop, the Grass mobile app streams live agent output and lets you browse diffs directly.

How do I leave Claude Code running while I sleep?

Two things need to be true: the process must survive your terminal closing (use tmux), and any approval gates must be handleable without you being at a keyboard (use Grass). Without both, either the session dies or it stalls at the first gate and sits frozen until morning.

What happens if Claude Code hits an error while running unattended?

It depends on the error. For tool execution errors, Claude Code typically retries or adjusts its approach and keeps going. For approval gates, it pauses and waits — Grass will surface this as a mobile prompt. For fatal errors, the process exits. If you're running inside tmux, you can reconnect and inspect the output. Claude Code's transcript is always stored at ~/.claude/projects/<cwd>/<session-id>.jsonl, so you can review exactly what happened.

How do I run Claude Code autonomously without --dangerously-skip-permissions?

Use Grass. The flag removes approval gates entirely, which means no oversight. Grass keeps approval gates active but makes them async — you get a mobile notification, approve in one tap, and the session continues. You get autonomy without giving up visibility.

How do I check on a Claude Code session without opening my laptop?

Open the Grass mobile app. It streams live agent output over SSE, lets you browse the file tree, and shows a color-coded diff of everything the agent has written. You can also send a new prompt or stop the session entirely — all from your phone. No SSH, no laptop.

What is the safest way to run Claude Code unattended?

The safest setup keeps approval gates active (no --dangerously-skip-permissions), runs the agent in tmux so it's persistent and inspectable, and uses Grass to handle any gate that comes up remotely. For extra isolation, run the session in a Daytona workspace so the agent operates in a throwaway environment that doesn't touch your local machine.

Related use cases

Approve or deny a coding agent action from your phone — A closer look at how the Grass permission modal works and what information it shows before you approve.

Monitor a long-running coding agent overnight — How to use the Grass dashboard to track progress across a multi-hour session without staying at your desk.

What is a remote coding session? — Background on what it means for a coding session to run on a server you're not physically at, and how Grass connects to it.