Automation and Web Commands
Choose the right Claude Code surface for web sessions, PR autofix, schedules, background Agent View work, Desktop handoff, and remote control.
Key takeaways
- Choose the right Claude Code surface for web sessions, PR autofix, schedules, background Agent View work, Desktop handoff, and remote control.
- Use this chapter as a first-pass operating checklist before changing systems, data, permissions, or customer-facing workflows.
- Validate platform-specific details against current official docs or internal policy before rollout.
- v2.1.251 formalizes top-level
attach,logs,stop,respawn, andrmcommands and streams foreground subagents in Remote Control.
Choose the Right Surface
| Command | Best for | Requirements |
|---|---|---|
/autofix-pr [prompt] | Spawning a Claude Code on the web session that watches the current branch's PR and pushes fixes when CI fails or reviewers comment. | Open PR detected from the checked-out branch, gh CLI, Claude Code on the web access. |
/schedule [description] | Creating, updating, listing, or running routines that run on Anthropic-managed cloud infrastructure on a schedule, API trigger, or GitHub event. Alias: /routines. | Claude Code on the web access; GitHub connected (it prompts for /web-setup if not). |
/web-setup | Connecting your GitHub account to Claude Code on the web using local gh credentials. | Local gh authentication and repository access; v2.1.248+ warns when the token lacks the workflow scope. |
/remote-control or /rc | Making this local session available for remote control from claude.ai. | Claude.ai login, trusted local workspace. |
/background or /bg | Detaching the current local conversation to run as a background agent and free the terminal. | Agent View available (research preview, v2.1.139+); worktree isolation understood. |
claude --bg | Starting a background session directly from the shell. | Local Claude Code session with the right directory and permissions. |
claude --bg --exec | Running a shell command as an Agent View background job without invoking a model. | Command is safe to run in the target directory. |
/goal | Keeping Claude working across turns until a concrete completion condition is met. | Success condition must be observable. |
/workflows | Watching, pausing, resuming, or saving running and completed dynamic workflow runs. | A running or completed workflow. |
/teleport or /tp | Pulling a Claude Code on the web session back into the terminal. | Claude.ai subscription and web session access. |
/desktop or /app | Continuing the session in the Claude Code Desktop app. | macOS or Windows and a Claude subscription. |
/mobile | Showing a QR code to download the Claude mobile app. Aliases: /ios, /android. | Claude.ai account. |
PR Automation Pattern
/autofix-pr detects the open PR from your checked-out branch with gh pr view. To watch a different PR, check out its branch first. By default the remote session is told to fix every CI failure and review comment; pass a prompt to give it narrower instructions.
- Ensure the branch has an open PR.
- Run
/web-setupif the web GitHub connection is not already configured. - Start with a bounded prompt:
/autofix-pr only fix lint, typecheck, and reviewer comments that do not change architecture- Review the resulting commits and CI status before merging.
/pr-commentswas removed in v2.1.91. To view pull request comments inside a session, ask Claude directly to read them instead.
Routine Pattern
Use /schedule when a workflow should run without your laptop staying open. Routines execute on Anthropic-managed cloud infrastructure, and Claude walks you through the setup conversationally:
/schedule every weekday morning triage new issues and post a Slack summaryIf GitHub is not yet connected, /schedule prompts you to run /web-setup first.
Use /loop instead when the loop depends on the current local shell, running server, or local
filesystem state. /loop [interval] [prompt] runs a prompt repeatedly while the session stays open; omit the interval to let Claude self-pace between iterations (alias: /proactive).
Use /goal when the task is not scheduled but has a concrete stop condition:
/goal tests pass and the migration notes are updatedClear an active goal early with /goal clear (also stop, off, reset, none, or cancel).
Subagent definitions and /agents
Since v2.1.198, /agents prints guidance to ask Claude to create or edit a subagent file. The Running/Library wizard belongs to v2.1.197 and earlier. Use .claude/agents/ for project definitions or ~/.claude/agents/ for personal definitions; claude agents is the separate background-session view.
Changes in existing project/user agents directories are detected automatically. A newly created agents directory, one loaded through an added directory, or a session launched with --disable-slash-commands still needs a restart. See Subagents.
Remote Work Pattern
Use Remote Control (/remote-control or /rc) when you want the work to keep running on your machine while interacting from a browser or phone. Use Claude Code on the web when the work should run in Anthropic-managed cloud infrastructure. Use /teleport (or /tp) when a web session needs to come back to your terminal.
Use Agent View for local background work you may attach to later. Open it with claude agents, or dispatch a session straight to the background from the shell:
claude --bg --name "flaky-test-fix" "investigate the failing SettingsChangeDetector test"
claude --bg --exec 'pnpm test -- --runInBand'
claude agents--bg starts a session that goes straight to the background; --name sets its display name in Agent View; --exec runs a shell command as a background job in place of a Claude session, so no model is invoked. After backgrounding, Claude prints the session's short ID. Current top-level management commands are claude attach <id>, claude logs <id>, claude stop <id>, claude respawn <id>, and claude rm <id> (v2.1.251+).
Before editing files, a background session moves into an isolated git worktree under .claude/worktrees/ so parallel sessions can read the same checkout while each writes to its own.
Use /workflows when Claude has generated a dynamic workflow that coordinates many background
agents. It opens the workflow progress view to watch, pause, resume, or save runs. It is a control surface, not a replacement for merge review.
Related Commands and Naming Notes
A few commands relevant to automation and review have been renamed or aliased recently:
/code-review [low|medium|high|xhigh|max|ultra]reviews the current diff for correctness bugs, with cleanup coverage depending on model and effort; pass--fixto apply findings or--commentto post them as inline GitHub PR comments./code-review ultraruns a deep cloud-based multi-agent review; this is the preferred invocation, and/ultrareviewremains as an alias./code-reviewand/verifyare user-invoked only since v2.1.215. v2.1.218 introduced background review execution. In v2.1.274+, models without tuned review settings use a leaner inline prompt, so the execution strategy is model-dependent./forkcopies the current conversation into a separate background session;/subtaskdelegates inherited-context work inside the current conversation (v2.1.212+)./usageshows session cost, plan usage limits, and activity stats./costand/statsare aliases (/statsopens on the Stats tab)./usage-creditsconfigures usage credits to keep working when you hit a limit; it was previously named/extra-usage./configopens the Settings interface;/settingsis an alias. The legacy/vimcommand was removed in v2.1.92 — toggle Vim editing mode through/config→ Editor mode./initinitializes a projectCLAUDE.mdguide. SetCLAUDE_CODE_NEW_INIT=1for an interactive flow that also walks through skills, hooks, and personal memory files; when aCLAUDE.mdalready exists,/initsuggests improvements rather than overwriting it./fewer-permission-promptsis the bundled skill that scans your transcripts for common read-only Bash and MCP calls and adds a prioritized allowlist to.claude/settings.jsonto reduce permission prompts.