iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🦔

Syncing Tasks between Claude Code on the web and CLI

に公開

This is Beagle 🐶

This article is a contribution to the 8th day of the mohikanz Advent Calendar 2025.

https://adventar.org/calendars/12219

I haven't been able to participate due to timing in the past, but this is my first time participating in the 9th year of the mohiz Advent Calendar.
I appreciate your kindness and support.

Overview

Claude Code on the web (hereafter "CC on the web") and the Claude Code CLI have a feature that allows you to move tasks between them.
In other words, you can bring work being done in CC on the web to your local environment for verification, or push local work to CC on the web.
This article provides a beginner-friendly explanation of how to perform these operations.

Moving tasks from CC on the web to local (Session transfer)

Moving from Web to CLI is more like transferring the session itself rather than just a specific task.
I briefly touched on the method in my past article, "Tried out Claude Code on the web."

https://zenn.dev/beagle/articles/bc6ef88dd68615#「cliで開く」--セッションのローカルへの移行

First, pull the current working branch from GitHub to your local machine.
Then, clicking the "Open in CLI" button will copy the claude command to your clipboard.
All that's left is to move to the working branch in your local terminal, paste the command, and execute it to resume the session locally.

When I wrote that article, several people mentioned, "I'm not used to Git or GitHub operations, so I don't understand the specific steps."
Therefore, I will outline the specific steps here.

1. Clone the GitHub repository you are using to your local machine

In your terminal, type:
git clone <repository URL>
If you can use the GitHub CLI,
gh repo clone <username/repository name>
works as well.

Once cloned, move to the cloned directory with:
cd <repository name>

2. Move to the working branch

Work in CC on the web is performed by creating a new working branch, not on the main branch.
The working branch name is displayed above the chat area in the bottom right of CC on the web.
Generally, it should be in the format claude/<some string>.

As shown in the image below, the branch name is displayed to the left of the "Create PR" button, and there is a button at the right end of the field to copy the branch name.

Copy the branch name and type:
git switch <branch name>

This will create a branch with the same name locally and switch you to that branch.

3. Click the "Open in CLI" button on CC on the web

The command claude --teleport <session ID> will be copied to your clipboard. Paste and execute it.
Then, Claude Code will launch and restore the session from CC on the web.

You can now resume work with the local Claude Code.

Supplementary Note 1: Using Git Worktree

For example, consider the following situation:

"I have a GitHub repository where I've been working on CC on the web from the start and have merged the results into the main branch several times. Now, I want to verify a specific working branch locally, but I also want to verify the current main branch locally as well."

In such cases, it is recommended to use Git Worktree.

Git Worktree is a feature that allows you to check out multiple branches from a single repository into separate folders. It is provided as a standard Git feature, so you can use it immediately if Git is installed.

After cloning the repository, execute:
git worktree add ../<directory name of your choice> <branch name>

With this, the cloned directory will be the main branch, and the directory specified by Worktree will be the remote working branch, with file states corresponding to each branch. In other words, you can verify each branch individually. In this case, you can restore the CC on the web session in the Worktree directory.

For more details on how to use Git Worktree, this article is a helpful resource:

https://zenn.dev/hiraoku/articles/56f4f9ffc6d186

Supplementary Note 2: Using Git Worktree Runner

If you find the operations like changing directories tedious even if you generally understand Git Worktree, there is also a method using Git Worktree Runner.

https://github.com/coderabbitai/git-worktree-runner

This is a tool provided by CodeRabbit, famous for its AI review tool, which makes it easier to work with Git Worktree.

https://www.coderabbit.ai/

Please refer to the README of the GitHub repository above for installation and usage instructions. Assuming you have finished installing Git Worktree Runner, let's consider the same situation as in Supplementary Note 1.

After cloning the repository, execute:
git gtr new <remote branch name> --name <local branch name>
Since branch names can be long, it is a good idea to give it any name you like for the "local branch name." With this, the remote branch is expanded as a local repository.

When you actually open this new branch, run:
git gtr editor <local branch name> --editor <IDE name>
This will open a new IDE window with this branch as the current directory. Supported IDEs appear to be vscode, cursor, and zed.

Also, if you are using a terminal, you can move to that branch's directory with:
cd "$(git gtr go <local branch name>)"

As shown above, it is a very convenient tool because you no longer need to be conscious of where the Worktree directory is located.

How to move tasks from Claude Code (CLI) to CC on the web

This is very simple, but as it has been implemented only recently (mid-November), it seems it is not widely known. Oikon's post on X is a useful reference.
https://twitter.com/oikon48/status/1990930519731941749

The procedure is to just enter & in the Claude Code chat field, followed by the task details, and send it. However, the working directory must be managed by Git, and the remote repository must exist on GitHub.

Let's look at it specifically. For example:
& Please fix the issue where feature.ts is not working correctly.
After waiting a while, the corresponding task will begin on CC on the web. At this time, a URL link to CC on the web will be displayed simultaneously, allowing you to check the progress by opening it in a browser. Alternatively, you can check progress within Claude Code using the /tasks command.

Summary

With recent updates, the integration between CC on the web and Claude Code (CLI) has been strengthened, making it easier to move tasks/sessions.

Session transfer from CC on the web to Claude Code is useful not only for verifying generated code locally but also when you want to develop code created on CC on the web in earnest within a local environment.

On the other hand, the use case for moving tasks from Claude Code to CC on the web might be harder to imagine. For example, it is effective in the following scenarios:

  • Pushing a task to CC on the web before going out so you can check progress on your smartphone while on the move.
  • Letting CC on the web handle time-consuming tasks while you proceed with other work on your local Claude Code.
  • Offloading a task to CC on the web to clear your head because you don't want to keep that context in your mind.

It is not an essential feature for development, but I believe there are situations where knowing it will be useful.

GitHubで編集を提案

Discussion