AIToday
AI Coding AssistantsZenn AI/MLPublished: Oct 7, 2026, 10:01 JST

Claude Code worktree keeps parallel tasks apart, guide shows

Claude Code worktree keeps parallel tasks apart, guide shows

3 Key Points

  1. What happened

    The guide walks through five Claude Code features: --worktree, which starts separate work folders and branches; /rename with /resume and /branch for conversation history; claude -p for one-line scripted requests; /loop for repeated checks; and MCP for connecting outside tools.

  2. Why it matters

    These separate parallel work into distinct folders and branches, so readers juggling multiple edits or long-running jobs can pick a method by problem, though each has limits the author flags.

  3. What to watch

    Adoption hinges on fixes for gaps the guide names — claude -p has no one to answer permission prompts, and /loop stops after 7 days and only works while the conversation stays open.

WHO IT HITSDevelopers and automation engineers running Claude Code in scripts or side-by-side branches benefit most, since claude -p and --worktree target their workflow. Teams sharing .claude/ settings through commits also gain shared setups.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The guide groups the five features into three families: splitting work to delegate, moving between conversations and running without the screen open, and adding outside tools and views. Worktree sits in the first family, sharing the repository history while giving each task its own folder (.claude/worktrees/name/) and branch (worktree-name). The author's test — appending to a README and fixing a bug simultaneously — ended cleanly, with each change landing in its own folder. One session even noticed the addition bug in the other tree and asked whether to fix it, because the other branch's fix lived only in that folder. A tradeoff the guide notes: a freshly checked-out worktree has no git-untracked files like .env, so dependencies must be reinstalled.

The second family covers conversation flow and headless requests. /rename gives a conversation a name so /resume lists it clearly; /branch copies the conversation into a new branch while keeping the original in the list, though conversations created by claude -p never appear there. claude -p runs a single request and exits, reading standard input, and scripts can consume its JSON output by reading the result field. The catch: with no one to answer prompts, claude -p refuses operations needing confirmation until permissions are pre-set in .claude/settings.json and the folder trust is accepted. /loop repeats a request at an interval (m for minutes, h for hours) but only inside an open conversation and expires after 7 days; persistent scheduling needs Anthropic's cloud Routines via /schedule.

MCP, the third family, is an open common standard connecting AI apps to outside tools and data. The author added a documentation-search server from outside Claude Code and confirmed the connection with /mcp after approving the project server. Whether the combination pays off hinges on the caveats the guide itself raises — pre-setting permissions, respecting the 7-day loop limit, and verifying a server's trustworthiness to avoid prompt injection.

FAQ
How do I run Claude Code without opening a conversation screen?
Use claude -p "request" to make a single request and exit, reading data via standard input so you can pipe it, for example: git diff | claude -p 'summarize this change in one sentence'. Scripts can parse the output with --output-format json, reading the result field.
Does /loop keep running after I close the conversation?
No. /loop only runs within the open conversation and automatically expires 7 days after creation. If you need it to continue after closing, create a Routine from /schedule on Anthropic's cloud, with a minimum interval of 1 hour, currently in preview.
Why did my claude -p request fail to edit a file?
claude -p has no one present to answer prompts, so operations requiring confirmation are refused. Adding "permissions": {"allow": ["Edit", "Read"]} to your repository's .claude/settings.json and accepting the folder trust allowed the same request to add a line to the README.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleMeta opens Muse Gadgets SDK for ESP32 and Raspberry Pi 5