<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
    <title>Tmux · Jared Lynskey</title>
    <link>https://jared.lynskey.co.nz/en/tags/tmux/</link>
    <description>Short stories of value on software engineering and engineering leadership — performance reviews, hiring and scaling teams, CI/CD, DevOps monitoring and agentic AI. Written from Seoul.</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>© 2026 Jared Lynskey</copyright>
    <lastBuildDate>Thu, 19 Nov 2026 00:00:00 +1300</lastBuildDate>
    <atom:link href="https://jared.lynskey.co.nz/en/tags/tmux/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Claude Code Worktrees: Running Parallel Agents Without Collisions</title>
      <link>https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/</link>
      <guid isPermaLink="true">https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/</guid>
      <pubDate>Thu, 19 Nov 2026 00:00:00 +1300</pubDate>
      <dc:creator>Jared Lynskey</dc:creator>
      <category>Claude Code</category>
      <category>AI Agents</category>
      <category>Git</category>
      <category>Git Worktree</category>
      <category>tmux</category>
      <category>Developer Tools</category>
      <category>Parallel Development</category>
      <description>How to use Claude Code worktrees: claude -w, .worktreeinclude for .env, node_modules, base ref and cleanup, and running parallel agents in tmux.</description>
      <content:encoded><![CDATA[<p>To run Claude Code in a git worktree, start it with <code>claude -w &lt;name&gt;</code> (the long form is <code>--worktree</code>). Claude Code creates <code>.claude/worktrees/&lt;name&gt;/</code> at the root of your repository, on a new branch called <code>worktree-&lt;name&gt;</code> cut from your default branch on the remote, and from then on the session can only edit files inside that folder. Run the same command with a different name in a second terminal and you have two agents that can&rsquo;t touch each other&rsquo;s files. The catch is that a worktree is a fresh checkout. Your <code>.env</code>, your <code>node_modules</code> and anything else git ignores aren&rsquo;t there until you copy or install them, and nearly every worktree problem I&rsquo;ve had came from exactly that.</p>
<p>I run a lot of agents in parallel, and I came to worktrees the hard way. This post covers how <code>claude -w</code> behaves (I tested it on version 2.1.328), what <code>.worktreeinclude</code> is for, what to do about <code>node_modules</code>, how I lay the sessions out in tmux, and when I still reach for plain <code>git worktree add</code>.</p>
<figure><div class="film-pair">
  <div class="mc-film film-dark">
  <video
    class="my-0 rounded-md"
    controls playsinline preload="none"
    poster="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film-poster.jpg" style="background:url('data:image/webp;base64,UklGRoQAAABXRUJQVlA4IHgAAABwBQCdASogABIAPw1wq0omIyGYDAQAYxDE9IBn0BuOmrQv+whr1JowkP2GvdEWiylHGHsAAP7r1B494gmKZxYarGSLJSBCQLucUwJnafSMMs2DcN8Xi7b7w/dBQJDESVxNVTjZ96FIOv3VtbbF3xp3++/ULAEhgAA=') center/cover no-repeat"
    width="1280"
    height="720"
    aria-label="A short narrated film of this post">
    <source src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film.webm" type="video/webm">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_en.vtt" srclang="en" label="English">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_ja.vtt" srclang="ja" label="日本語">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_ko.vtt" srclang="ko" label="한국어">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_vi.vtt" srclang="vi" label="Tiếng Việt">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_zh-cn.vtt" srclang="zh-cn" label="简体中文">
  </video>
  </div>
  <div class="mc-film film-light">
  <video
    class="my-0 rounded-md"
    controls playsinline preload="none"
    poster="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film-light-poster.jpg" style="background:url('data:image/webp;base64,UklGRoIAAABXRUJQVlA4IHYAAADQBACdASogABIAPw1uqUemIyIYBABjEMT0gAc4DbW6V3D/YCrZgv8AsVgfEQtYAAD+77ncv/xfKWHnvcUR0S+hsPg7hFdUPAZo9hZKq5p8p/3q6SK+cmbz04KNDvyW45u0Ws/43dQYB5jO2XsnWh2nnV30wAAA') center/cover no-repeat"
    width="1280"
    height="720"
    aria-label="A short narrated film of this post">
    <source src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film-light.webm" type="video/webm">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_en.vtt" srclang="en" label="English">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_ja.vtt" srclang="ja" label="日本語">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_ko.vtt" srclang="ko" label="한국어">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_vi.vtt" srclang="vi" label="Tiếng Việt">
    <track kind="subtitles" src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktrees-film_zh-cn.vtt" srclang="zh-cn" label="简体中文">
  </video>
  </div>
  <script>(function(){if(window.mcFilm)return window.mcFilm();var a={play:'<path d="M8 5.6v12.8a1 1 0 0 0 1.52.85l10.2-6.4a1 1 0 0 0 0-1.7L9.52 4.75A1 1 0 0 0 8 5.6z"/>',pause:'<rect x="6.5" y="5" width="4" height="14" rx="1.2"/><rect x="13.5" y="5" width="4" height="14" rx="1.2"/>',volume:'<path d="M4 9.5v5a1 1 0 0 0 1 1h3l4.4 3.6a.6.6 0 0 0 1-.47V5.37a.6.6 0 0 0-1-.47L8 8.5H5a1 1 0 0 0-1 1z"/><path d="M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>',muted:'<path d="M4 9.5v5a1 1 0 0 0 1 1h3l4.4 3.6a.6.6 0 0 0 1-.47V5.37a.6.6 0 0 0-1-.47L8 8.5H5a1 1 0 0 0-1 1z"/><path d="M16.5 9.5l5 5m0-5l-5 5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>',cc:'<rect x="3" y="5.5" width="18" height="13" rx="3" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M10.5 10.3a2.2 2.2 0 1 0 0 3.4M17 10.3a2.2 2.2 0 1 0 0 3.4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>',full:'<path d="M4.5 9V5.5a1 1 0 0 1 1-1H9M15 4.5h3.5a1 1 0 0 1 1 1V9M19.5 15v3.5a1 1 0 0 1-1 1H15M9 19.5H5.5a1 1 0 0 1-1-1V15" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/>',exit:'<path d="M9 4.5V8a1 1 0 0 1-1 1H4.5M19.5 9H16a1 1 0 0 1-1-1V4.5M15 19.5V16a1 1 0 0 1 1-1h3.5M4.5 15H8a1 1 0 0 1 1 1v3.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/>'},s={en:["Play","Pause","Mute","Unmute","Subtitles","Off","Full screen","Exit full screen","Seek"],ko:["재생","일시정지","음소거","음소거 해제","자막","끄기","전체 화면","전체 화면 종료","탐색"],ja:["再生","一時停止","ミュート","ミュート解除","字幕","オフ","全画面","全画面を終了","シーク"],zh:["播放","暂停","静音","取消静音","字幕","关闭","全屏","退出全屏","进度"],vi:["Phát","Tạm dừng","Tắt tiếng","Bật tiếng","Phụ đề","Tắt","Toàn màn hình","Thoát toàn màn hình","Tua"]},r=(document.documentElement.lang||"en").toLowerCase().slice(0,2),e=s[r]||s.en,t=function(e){return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">'+a[e]+"</svg>"},o={},i=function(e,t){if(o[e]||typeof window.gtag!="function")return;o[e]=!0;var n=(t.currentSrc||(t.querySelector("source")||{}).src||"").split("/").pop();window.gtag("event",e,{film:n.replace(/-light(?=\.)/,"")})},n=function(e){(!isFinite(e)||e<0)&&(e=0),e=Math.floor(e);var t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=String(e%60).padStart(2,"0");return t?t+":"+String(n).padStart(2,"0")+":"+s:n+":"+s};function c(s){var a,r,c,d,u,m,p,g,v,b,j,_,w,O,C,E,k,A,o=s.querySelector("video");if(!o)return;s.classList.add("is-ready"),o.controls=!1,o.removeAttribute("controls"),s.insertAdjacentHTML("beforeend",'<button type="button" class="mc-film__big" aria-label="'+e[0]+'">'+t("play")+'</button><div class="mc-film__bar"><button type="button" class="mc-film__btn" data-act="play" aria-label="'+e[0]+'">'+t("play")+'</button><span class="mc-film__time"><span data-cur>0:00</span><span class="mc-film__of"> / </span><span data-dur>0:00</span></span><input class="mc-film__seek" type="range" min="0" max="1000" step="1" value="0" aria-label="'+e[8]+'"><span class="mc-film__cc"><button type="button" class="mc-film__btn" data-act="cc" aria-label="'+e[4]+'" aria-haspopup="true" aria-expanded="false">'+t("cc")+'</button><span class="mc-film__menu" role="menu" hidden></span></span><button type="button" class="mc-film__btn" data-act="mute" aria-label="'+e[2]+'">'+t("volume")+'</button><button type="button" class="mc-film__btn" data-act="full" aria-label="'+e[6]+'">'+t("full")+"</button></div>"),A=s.querySelector(".mc-film__big"),a=s.querySelector(".mc-film__bar"),j=a.querySelector('[data-act="play"]'),p=a.querySelector('[data-act="mute"]'),u=a.querySelector('[data-act="full"]'),d=a.querySelector('[data-act="cc"]'),r=a.querySelector(".mc-film__menu"),c=a.querySelector(".mc-film__seek"),w=a.querySelector("[data-cur]"),O=a.querySelector("[data-dur]"),g=!1,v=0,b=function(){return Array.prototype.filter.call(o.textTracks,function(e){return e.kind==="subtitles"||e.kind==="captions"})},b().length||(d.parentNode.hidden=!0),_=null;function f(e){var n,i,t=!s.classList.contains("is-idle")&&s.classList.contains("is-started");if(e!==!0&&t===_)return;_=t,n=o.clientHeight,i=n?Math.max(40,100-(a.offsetHeight+22)/n*100):85,b().forEach(function(e){if(e.mode!=="showing"||!e.cues)return;for(var n,s=0;s<e.cues.length;s++)n=e.cues[s],t?(n.snapToLines=!1,n.line=i,n.lineAlign="end"):(n.snapToLines=!0,n.line="auto",n.lineAlign="start")})}m=function(){f(!0)},window.addEventListener("resize",m),Array.prototype.forEach.call(o.querySelectorAll("track"),function(e){e.addEventListener("load",m)});function y(){o.paused||o.ended?o.play().catch(function(){}):o.pause()}function l(){s.classList.remove("is-idle"),f(),clearTimeout(v),v=setTimeout(function(){!o.paused&&r.hidden&&!a.querySelector(":focus-visible")&&(s.classList.add("is-idle"),f())},2600)}function M(){clearTimeout(v),h(),s.classList.add("is-idle"),f()}function h(){r.hidden=!0,d.setAttribute("aria-expanded","false")}function F(){var t=b(),n=t.filter(function(e){return e.mode==="showing"})[0];r.innerHTML="",[null].concat(t).forEach(function(s){var o=document.createElement("button");o.type="button",o.setAttribute("role","menuitemradio"),o.setAttribute("aria-checked",String(s?s===n:!n)),o.textContent=s?s.label||s.language:e[5],o.addEventListener("click",function(){t.forEach(function(e){e.mode=e===s?"showing":"disabled"}),h(),setTimeout(m,0),l()}),r.appendChild(o)}),r.hidden=!1,d.setAttribute("aria-expanded","true")}function x(){var n=!o.paused&&!o.ended;s.classList.toggle("is-playing",n),j.innerHTML=t(n?"pause":"play"),j.setAttribute("aria-label",n?e[1]:e[0]),n||l()}function S(){if(w.textContent=n(o.currentTime),!g&&o.duration){var e=o.currentTime/o.duration*1e3;c.value=e,c.style.setProperty("--p",e/10+"%")}}A.addEventListener("click",function(){o.play().catch(function(){})}),C="mouse",s.addEventListener("pointerdown",function(e){C=e.pointerType}),o.addEventListener("click",function(){if(!s.classList.contains("is-started"))return o.play().catch(function(){});if(C==="mouse")return y();s.classList.contains("is-idle")?l():M()}),j.addEventListener("click",y),o.addEventListener("play",function(){s.classList.contains("is-started")||i("film_play",o),s.classList.add("is-started"),x(),l()}),"IntersectionObserver"in window&&(E=new IntersectionObserver(function(e){if(!e.some(function(e){return e.isIntersecting}))return;E.disconnect(),i("film_view",o)},{threshold:.5}),E.observe(s)),o.addEventListener("pause",x),o.addEventListener("ended",x),o.addEventListener("timeupdate",S),o.addEventListener("durationchange",function(){O.textContent=n(o.duration),S()}),o.addEventListener("loadedmetadata",function(){O.textContent=n(o.duration)}),o.addEventListener("volumechange",function(){p.innerHTML=t(o.muted?"muted":"volume"),p.setAttribute("aria-label",o.muted?e[3]:e[2])}),p.addEventListener("click",function(){o.muted=!o.muted}),c.addEventListener("input",function(){g=!0,c.style.setProperty("--p",c.value/10+"%"),o.duration&&(o.currentTime=c.value/1e3*o.duration,w.textContent=n(o.currentTime))}),c.addEventListener("change",function(){g=!1}),d.addEventListener("click",function(e){e.stopPropagation(),r.hidden?F():h()}),document.addEventListener("click",function(e){!r.hidden&&!r.contains(e.target)&&h()}),u.addEventListener("click",function(){document.fullscreenElement||document.webkitFullscreenElement?(document.exitFullscreen||document.webkitExitFullscreen).call(document):s.requestFullscreen?s.requestFullscreen().catch(function(){}):s.webkitRequestFullscreen?s.webkitRequestFullscreen():o.webkitEnterFullscreen&&o.webkitEnterFullscreen()}),k=function(){var n=(document.fullscreenElement||document.webkitFullscreenElement)===s;s.classList.toggle("is-fullscreen",n),u.innerHTML=t(n?"exit":"full"),u.setAttribute("aria-label",n?e[7]:e[6])},document.addEventListener("fullscreenchange",k),document.addEventListener("webkitfullscreenchange",k),s.addEventListener("pointermove",function(e){e.pointerType==="mouse"&&l()}),s.addEventListener("focusin",l),s.addEventListener("keydown",function(e){if(e.target===c&&/^Arrow/.test(e.key))return;var t=e.key.toLowerCase();if(t==="k"||t===" "&&e.target===o)y();else if(t==="arrowleft")o.currentTime=Math.max(0,o.currentTime-5);else if(t==="arrowright")o.currentTime=Math.min(o.duration||0,o.currentTime+5);else if(t==="m")o.muted=!o.muted;else if(t==="f")u.click();else if(t==="escape"&&!r.hidden)h();else return;e.preventDefault(),l()}),o.tabIndex=0}window.mcFilm=function(){document.querySelectorAll(".mc-film:not(.is-ready)").forEach(c)},window.mcFilm()})()</script></div>
  <script>
  new MutationObserver(() => {
    const dark = document.documentElement.classList.contains("dark");
    document.querySelectorAll(".film-pair").forEach((pair) => {
      const from = pair.querySelector(dark ? ".film-light video" : ".film-dark video");
      const to = pair.querySelector(dark ? ".film-dark video" : ".film-light video");
      if (!from || !to || !from.currentTime) return;
      const playing = !from.paused;
      from.pause();
      to.currentTime = from.currentTime;
      [...from.textTracks].forEach((track, i) => { if (to.textTracks[i]) to.textTracks[i].mode = track.mode; });
      if (playing) to.play().catch(() => {});
    });
  }).observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
  </script><figcaption>This post as an eight-minute film, if you&rsquo;d rather watch than read. Some footage from Coverr.</figcaption>
</figure>


<h2 class="relative group">Why one checkout doesn&rsquo;t work for parallel agents
    <div id="why-one-checkout-doesnt-work-for-parallel-agents" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-one-checkout-doesnt-work-for-parallel-agents" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>One day in September I had five Claude Code sessions working in the same checkout of my marketplace app, and two things went wrong. A one-line fix to a test config file survived four failed builds and was gone by the time it was ready to commit: <code>git commit</code> said the working tree was clean, and the file held another session&rsquo;s version. Git keeps no record of a lost update like that. No reflog entry, no stash, just an ordinary modification time. The same day, a deploy script that builds from the working tree came close to shipping a different session&rsquo;s unfinished work to production.</p>
<p>In October a third one turned up. A session committed its own files beside another session&rsquo;s unstaged work, and the pre-commit hook stashed <em>everything</em> unstaged for the length of the hook. The other session&rsquo;s edits vanished from disk while the hook ran, the type checker then failed on its new files, and the commit aborted. Every session commits under my name, too, so <code>git log</code> can&rsquo;t tell you which one did what.</p>
<p>That&rsquo;s the case for worktrees in one line: a working tree with several writers is a race, and the loser can&rsquo;t see it happen. Give each agent its own working tree and the race goes away.</p>
<figure class="diagram">
  <div role="img" aria-label="Diagram: one shared .git directory holding commits, branches, config and a small private folder per worktree, connected to three working directories: the main checkout on main with .env and node_modules, a git worktree add checkout on fix-login with neither, and a claude -w checkout on worktree-add-search with .env copied by .worktreeinclude, locked while the session runs"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 906" aria-hidden="true" focusable="false">
<path class="d-group" d="M30,267 V735 M30,435.5 H62 M30,578.5 H62 M30,735 H62"></path>
<text class="d-title d-mono" x="2" y="30" font-size="28">.git</text>
<text class="d-sub" x="2" y="57" font-size="18">shared by every worktree</text>
<rect class="d-panel" x="2" y="75" width="696" height="192" rx="22"></rect>
<rect class="d-head" x="25" y="105" width="8" height="8" rx="2"></rect>
<text class="d-label" x="46" y="115.8" font-size="19">commits and objects</text>
<rect class="d-head" x="25" y="137" width="8" height="8" rx="2"></rect>
<text class="d-label" x="46" y="147.8" font-size="19">branches and tags (refs/)</text>
<rect class="d-head" x="25" y="169" width="8" height="8" rx="2"></rect>
<text class="d-label" x="46" y="179.8" font-size="19">config, remotes, hooks</text>
<rect class="d-head" x="25" y="201" width="8" height="8" rx="2"></rect>
<text class="d-label" x="46" y="211.8" font-size="19">worktrees/: a small private folder per linked worktree, holding its</text>
<text class="d-label" x="46" y="239.8" font-size="19">own HEAD and index</text>
<text class="d-title" x="62" y="327" font-size="26">Three working directories</text>
<text class="d-sub" x="62" y="354" font-size="18">each with its own files, HEAD and index</text>
<rect class="d-box" x="62" y="372" width="636" height="127" rx="14"></rect>
<text class="d-label d-mono" x="82" y="409.2" font-size="20">~/code/myapp</text>
<rect class="d-panel" x="82" y="424" width="60.1" height="28" rx="14"></rect>
<text class="d-label d-mono" x="94" y="443.4" font-size="15">main</text>
<text class="d-sub" x="154.1" y="444.1" font-size="17">main checkout</text>
<path class="d-badge" style="fill:none;stroke-width:2.6" d="M83,474 l4.5,4.5 l9.5,-10"></path>
<text class="d-label" x="107" y="479.6" font-size="17">.env</text>
<path class="d-badge" style="fill:none;stroke-width:2.6" d="M168.4,474 l4.5,4.5 l9.5,-10"></path>
<text class="d-label" x="192.4" y="479.6" font-size="17">node_modules 45 MB</text>
<rect class="d-box" x="62" y="515" width="636" height="127" rx="14"></rect>
<text class="d-label d-mono" x="82" y="552.2" font-size="20">~/code/myapp-fix-login</text>
<rect class="d-panel" x="82" y="567" width="105.3" height="28" rx="14"></rect>
<text class="d-label d-mono" x="94" y="586.4" font-size="15">fix-login</text>
<text class="d-sub" x="199.3" y="587.1" font-size="17">made with git worktree add</text>
<path class="d-line" style="fill:none;stroke-width:2.2" d="M85,611.5 l10,10 M95,611.5 l-10,10"></path>
<text class="d-sub" x="107" y="622.6" font-size="17">no .env</text>
<path class="d-line" style="fill:none;stroke-width:2.2" d="M193.4,611.5 l10,10 M203.4,611.5 l-10,10"></path>
<text class="d-sub" x="215.4" y="622.6" font-size="17">no node_modules (84 KB until npm install)</text>
<rect class="d-box" x="62" y="658" width="636" height="154" rx="14"></rect>
<text class="d-label d-mono" x="82" y="695.2" font-size="20">~/code/myapp/.claude/worktrees/add-search</text>
<rect class="d-panel" x="82" y="710" width="195.6" height="28" rx="14"></rect>
<text class="d-label d-mono" x="94" y="729.4" font-size="15">worktree-add-search</text>
<text class="d-sub" x="289.6" y="730.1" font-size="17">made with claude -w add-search</text>
<path class="d-badge" style="fill:none;stroke-width:2.6" d="M83,760 l4.5,4.5 l9.5,-10"></path>
<text class="d-label" x="107" y="765.6" font-size="17">.env, copied by .worktreeinclude</text>
<path class="d-line" style="fill:none;stroke-width:2.2" d="M395.7,754.5 l10,10 M405.7,754.5 l-10,10"></path>
<text class="d-sub" x="417.7" y="765.6" font-size="17">no node_modules</text>
<rect class="d-line" style="fill:none;stroke-width:2" x="84" y="785.5" width="12" height="9" rx="2"></rect>
<path class="d-line" style="fill:none;stroke-width:2" d="M86.5,785.5 v-2.5 a3.5,3.5 0 0 1 7,0 v2.5"></path>
<text class="d-sub" x="107" y="792.6" font-size="17">locked while the session runs</text>
<text class="d-sub" x="2" y="850" font-size="16">Claude Code also shares two things across a repository's worktrees: “don't ask again”</text>
<text class="d-sub" x="2" y="874" font-size="16">approvals (saved in the main checkout's .claude/settings.local.json) and project-scope</text>
<text class="d-sub" x="2" y="898" font-size="16">plugins.</text>
</svg>
</div><figcaption>One repository, three working directories. History is stored once; files, HEAD and index are per worktree.</figcaption>
</figure>


<h2 class="relative group">How claude -w works
    <div id="how-claude--w-works" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-claude--w-works" aria-label="Anchor">#</a>
    </span>
    
</h2>
<figure><video
    class="my-0 rounded-md"
    autoplay loop muted playsinline preload="metadata"
    poster="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/claude-worktree.jpg" style="background:url('data:image/webp;base64,UklGRkoAAABXRUJQVlA4ID4AAACQAwCdASogABIAPw16sU+mI6IhKAgAxiGJ6QDC+BPdNCPmtcKAAP7ozOlPLz658ebe527EEQOHuoyZaAAAAA==') center/cover no-repeat"
    width="1280"
    height="720"
    aria-label="Terminal: cat .worktreeinclude shows .env; claude -w add-search answers that it is on worktree-add-search; git worktree list shows the new worktree as locked; ls shows .env copied but no node_modules; git worktree remove refuses because the worktree is locked by a claude session whose process has exited; unlock and remove succeed">
    <source src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/claude-worktree.mp4" type="video/mp4">
  </video><figcaption>A real run in a throwaway repo. Note the lock that&rsquo;s still there after the session ended.</figcaption>
</figure>

<p>What <a href="https://code.claude.com/docs/en/worktrees"  target="_blank" rel="noreferrer">the worktrees page in the docs</a> says, and what I saw when I tried it:</p>
<ul>
<li><strong>Where and which branch.</strong> <code>claude -w add-search</code> creates <code>.claude/worktrees/add-search/</code> on a new branch <code>worktree-add-search</code>. Leave the name out and you get a generated one like <code>bright-running-fox</code>. Add <code>.claude/worktrees/</code> to your <code>.gitignore</code>, or the main checkout shows it all as untracked.</li>
<li><strong>What it branches from.</strong> By default, <code>worktree.baseRef</code> is <code>&quot;fresh&quot;</code>: the remote&rsquo;s default branch, usually <code>origin/main</code>. Claude Code fetches it if the repository hasn&rsquo;t been fetched in the last 24 hours, capped at five seconds. Set it to <code>&quot;head&quot;</code> and new worktrees start from your current local <code>HEAD</code>, unpushed commits and all. You can&rsquo;t set it to a branch name; for a specific branch, use <code>git worktree add</code> yourself.</li>
<li><strong>Pull requests.</strong> <code>claude --worktree &quot;#1234&quot;</code> fetches that PR&rsquo;s head and creates <code>.claude/worktrees/pr-1234</code>. Quote it, or your shell treats <code>#</code> as a comment.</li>
<li><strong>Trust.</strong> The first time, an interactive <code>claude -w</code> in a folder you&rsquo;ve never opened Claude in fails with &ldquo;Workspace trust not yet accepted&rdquo;. Run plain <code>claude</code> there once and accept the dialog. <code>claude -p -w</code> skips the check.</li>
<li><strong>The fence.</strong> While a session is in a worktree, Claude Code refuses edits to files in the main checkout, commands whose working directory is the main checkout, and git pointed back at it through <code>git -C</code>, <code>--git-dir</code> or <code>GIT_DIR</code>. The docs say plainly what it doesn&rsquo;t catch: a <code>cp</code> or a shell redirect that writes into the main checkout isn&rsquo;t refused by these checks.</li>
</ul>
<p>What a worktree shares with the main checkout matters as much as what it doesn&rsquo;t. Every worktree writes to the same <code>.git</code>, so commits and branches made in one are visible from all of them. Project-scope plugins load everywhere. And a &ldquo;Yes, and don&rsquo;t ask again&rdquo; answered inside a worktree is saved to the <em>main</em> checkout&rsquo;s <code>.claude/settings.local.json</code>, so the approval applies to every worktree and outlives the one it was given in. That&rsquo;s convenient, and also one more reason to keep secrets out of the commands you approve.</p>

<h2 class="relative group">Cleaning up, and the lock that stays behind
    <div id="cleaning-up-and-the-lock-that-stays-behind" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#cleaning-up-and-the-lock-that-stays-behind" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When you exit an interactive worktree session, Claude Code checks for anything removal would lose. An unnamed session with a clean worktree is removed automatically, branch and all. A named one asks first. If there&rsquo;s work in it, you&rsquo;re asked whether to keep it, and you can come back later with the <code>claude --worktree &lt;name&gt; --resume</code> command it prints.</p>
<p>Non-interactive runs are different, and it&rsquo;s the one thing that caught me out when I tested this. <code>claude -p</code> has no exit prompt, so it doesn&rsquo;t clean up. Claude Code also holds a <code>git worktree lock</code> on the worktree while the session runs, and after a <code>-p</code> run that lock is still there with a process ID that no longer exists. You can see it in the recording above: <code>git worktree remove</code> refuses with &ldquo;cannot remove a locked working tree, lock reason: claude session add-search&rdquo;. The docs describe exactly this: a later session&rsquo;s stale-lock sweep releases it, or you run <code>git worktree unlock</code> first. It&rsquo;s harmless once you know, and slightly alarming the first time.</p>

<h2 class="relative group">.worktreeinclude: the files a fresh checkout doesn&rsquo;t have
    <div id="worktreeinclude-the-files-a-fresh-checkout-doesnt-have" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#worktreeinclude-the-files-a-fresh-checkout-doesnt-have" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>A worktree contains tracked files and nothing else. To bring gitignored files along, put a <code>.worktreeinclude</code> in the root of the repository. It uses <code>.gitignore</code> syntax, and Claude Code copies a file only if it matches a pattern <em>and</em> is gitignored, so tracked files are never duplicated:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl"># .worktreeinclude
</span></span><span class="line"><span class="cl">.env
</span></span><span class="line"><span class="cl">.env.local
</span></span><span class="line"><span class="cl">config/secrets.json</span></span></code></pre></div></div>
<p>It applies to every worktree Claude Code creates with git: <code>claude -w</code>, subagent worktrees and the desktop app&rsquo;s parallel sessions. It doesn&rsquo;t apply to worktrees you make with <code>git worktree add</code>, and it&rsquo;s skipped entirely if you replace worktree creation with a <code>WorktreeCreate</code> hook.</p>
<p>I&rsquo;d put more than <code>.env</code> in it, because the gitignored files you forget are rarely the ones that fail loudly. My app&rsquo;s deploy script was changed to build from a clean worktree, so that other sessions&rsquo; uncommitted edits could never ship. The clean tree didn&rsquo;t have the gitignored signing certificates that one feature needs, the image built anyway, and that feature failed in production for 13 days, until the script was changed to copy the certificates in and warn when one is missing. On another deploy from a worktree, a gitignored theme folder was missing, and the build failed only <em>after</em> a two-minute export had already dirtied the tree. Before you trust a worktree with anything that ships, run <code>git status --short --ignored</code> in your main checkout and ask which of those files the build reads.</p>

<h2 class="relative group">node_modules: the expensive part
    <div id="node_modules-the-expensive-part" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#node_modules-the-expensive-part" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p><code>.worktreeinclude</code> is for small files. It won&rsquo;t help with <code>node_modules</code>, and nothing in Claude Code shares it between worktrees, so every worktree that needs to run your code needs its own.</p>
<figure><video
    class="my-0 rounded-md"
    autoplay loop muted playsinline preload="metadata"
    poster="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktree-basics.jpg" style="background:url('data:image/webp;base64,UklGRkgAAABXRUJQVlA4IDwAAADQAwCdASogABIAPw18sk+mI6IhKAgAxiGJ6QC/OBPdOMkqQtYu1AAA/ujR5WBjJmvERft5/vglvvCMAAA=') center/cover no-repeat"
    width="1280"
    height="720"
    aria-label="Terminal: git worktree add creates myapp-fix-login on a new branch and myapp-hotfix detached at origin/main; git worktree list shows all three; the new worktree has no .env and no node_modules; du shows 45M for the main checkout and 84K for the worktree, then 45M for both after npm install">
    <source src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/worktree-basics.mp4" type="video/mp4">
  </video><figcaption>Plain git worktrees in a demo repo: 84 KB until you install, then the full 45 MB again.</figcaption>
</figure>

<p>On a real project the numbers get serious. My mobile app&rsquo;s repository has 19 worktrees beside the main checkout. I measured 12 of them: they range from 194 MB to 12 GB, and the four biggest were the four with their own <code>node_modules</code>. With my laptop&rsquo;s disk at 96% this week, they&rsquo;re the obvious place to start cleaning.</p>
<p>The options, from simplest to cleverest:</p>
<ol>
<li><strong>Install per worktree.</strong> Ask the agent to run <code>npm install</code> first thing, or do it yourself. Slow, costs disk, never surprises you.</li>
<li><strong>Clone from a checkout with the same lockfile.</strong> On macOS, <code>cp -c -R ../myapp/node_modules .</code> uses APFS clones, which share data blocks until one side changes. Cloning the 45 MB demo took 0.8 seconds. I&rsquo;ve used this for real deploys from worktrees. Only clone when the lockfiles match, and be careful with native build folders: my main checkout&rsquo;s iOS Pods were built for an older SDK than the worktree&rsquo;s branch, so those had to be installed fresh.</li>
<li><strong>Use pnpm.</strong> Its packages live in one store, and on macOS pnpm <a href="https://pnpm.io/settings/node-modules#packageimportmethod"  target="_blank" rel="noreferrer">clones from the store before trying hard links</a> (on Linux and Windows it hard-links first). A second worktree&rsquo;s install of the demo took about five seconds.</li>
<li><strong>Install in a <code>WorktreeCreate</code> hook.</strong> The hook replaces Claude Code&rsquo;s default git logic, so it could run <code>git worktree add</code> and then the install. I haven&rsquo;t tried this one. If you do, remember <code>.worktreeinclude</code> stops being processed and the hook has to copy your <code>.env</code> too.</li>
</ol>

<h2 class="relative group">Parallel agents in tmux
    <div id="parallel-agents-in-tmux" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#parallel-agents-in-tmux" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I already live in tmux (the <a href="https://jared.lynskey.co.nz/en/posts/2026/2026-10-22-claude-code-day-to-day/" >day-to-day post</a> has the layout), so worktrees slot straight in: one window, or one pane, per worktree. Here are three agents started at the same moment, each told to change the same file:</p>
<figure><video
    class="my-0 rounded-md"
    autoplay loop muted playsinline preload="metadata"
    poster="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/parallel-agents-tmux.jpg" style="background:url('data:image/webp;base64,UklGRlQAAABXRUJQVlA4IEgAAACQBACdASogABIAPw10rE0mIyIhKAqoxiGJ6QDImBPdLsmKk7T7Naw9bcwBsAAA/ui+5wOzf0YXxkY1UgYA04COTxtokeJAAAA=') center/cover no-repeat"
    width="1280"
    height="720"
    aria-label="tmux with three panes: claude -w add-bye, add-greet and add-tests run at the same time; the pane titles switch to the worktree names while they run; two report a modified src/index.js and one a new test folder; the top pane then shows the main checkout clean and three locked worktrees">
    <source src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/parallel-agents-tmux.mp4" type="video/mp4">
  </video><figcaption>Three agents, one file, no collisions. The main checkout ends up clean, and each change waits in its own branch.</figcaption>
</figure>

<p>Two of them edited <code>src/index.js</code> at the same time and neither noticed the other, because each one&rsquo;s <code>src/index.js</code> was a different file on disk. The main checkout stayed clean. What you get at the end is three branches to review and merge, which is the work worktrees can&rsquo;t do for you: if two agents change the same lines, you still get a merge conflict. It just arrives in a merge, where you can see it, instead of as a silent overwrite.</p>
<p>In VS Code, a worktree is just a folder: <code>code .claude/worktrees/add-search</code> opens it in its own window, on its own branch.</p>

<h2 class="relative group">A worktree is a snapshot
    <div id="a-worktree-is-a-snapshot" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#a-worktree-is-a-snapshot" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Worktrees age. On 19 November an over-the-air update went out from a worktree that had been prepared two or three days earlier, and it quietly reverted two fixes that had shipped from elsewhere in the meantime. It was caught and replaced the same day. The worktree was perfectly isolated, and that was the problem: it never saw those fixes. A git one-liner would have caught it before release:</p>
<figure><video
    class="my-0 rounded-md"
    autoplay loop muted playsinline preload="metadata"
    poster="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/stale-worktree-check.jpg" style="background:url('data:image/webp;base64,UklGRkgAAABXRUJQVlA4IDwAAACwAwCdASogABIAPw16sk+mI6IhKAgAxiGJ6QDEJBPdNJGDbpnawAD+6TSngiBlgQG6+gLgAZ5HH8TQAAA=') center/cover no-repeat"
    width="1280"
    height="720"
    aria-label="Terminal: main has a new commit &#39;Fix sign-in token handling&#39;; an older worktree is still on the initial commit; git merge-base --is-ancestor main HEAD prints &#39;missing the fix: rebase before you ship&#39;; after git rebase main the same check prints &#39;has the fix&#39;">
    <source src="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/stale-worktree-check.mp4" type="video/mp4">
  </video><figcaption>The check to run before shipping from any worktree that isn&rsquo;t freshly cut.</figcaption>
</figure>

<p><code>baseRef: &quot;fresh&quot;</code> keeps new worktrees current. Nothing keeps old ones current, so check before you release from one.</p>

<h2 class="relative group">Subagents and hooks
    <div id="subagents-and-hooks" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#subagents-and-hooks" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>You don&rsquo;t need a terminal per agent to get this isolation. A custom subagent with <code>isolation: worktree</code> in its front matter always runs in a temporary worktree of its own:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl"><span class="nn">---</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">refactorer</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">description</span><span class="p">:</span><span class="w"> </span><span class="l">Applies mechanical refactors across many files</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">isolation</span><span class="p">:</span><span class="w"> </span><span class="l">worktree</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nn">---</span><span class="w">
</span></span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Apply the requested refactor across every affected file, then run the tests
</span></span><span class="line"><span class="cl">and report the results.</span></span></code></pre></div></div>
<p>That&rsquo;s the example from the <a href="https://code.claude.com/docs/en/worktrees#isolate-subagents-with-worktrees"  target="_blank" rel="noreferrer">docs</a>. The worktree is removed when the subagent finishes without changes. One with changes stays until a periodic sweep can remove it without losing work. One subtlety: a subagent in a worktree under <code>.claude/worktrees/</code> takes its instructions from your main conversation and doesn&rsquo;t load the <code>CLAUDE.md</code> at the worktree&rsquo;s root.</p>
<p><code>WorktreeCreate</code> and <code>WorktreeRemove</code> hooks replace the git logic entirely. They&rsquo;re meant for other version control systems, or for putting worktrees somewhere other than <code>.claude/worktrees/</code>, and they&rsquo;re also the place for setup steps like the install above.</p>

<h2 class="relative group">When plain git worktree add is the better tool
    <div id="when-plain-git-worktree-add-is-the-better-tool" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#when-plain-git-worktree-add-is-the-better-tool" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Here&rsquo;s the confession: the <code>.claude/worktrees</code> folder in my app&rsquo;s repository is empty. All 19 of its worktrees were made with plain <code>git worktree add</code>, all of them in the past month, and half of them sit on a detached HEAD. Other repositories on my laptop have 40, 40, 18, 10, 3, 2 and 2 more. And most of the time it isn&rsquo;t me making them: 85 of the 638 Claude Code transcripts on this laptop have an agent running <code>git worktree add</code>, 336 times in all.</p>
<p>Plain git is better when:</p>
<ul>
<li><strong>You need a specific existing branch,</strong> such as a release branch kept for hotfixes. <code>baseRef</code> can&rsquo;t do that.</li>
<li><strong>You want to ship exactly one fix.</strong> Other sessions had committed work to <code>main</code> that hadn&rsquo;t been deployed yet, so a detached worktree at the commit running in production, with my fix cherry-picked into it, was the way to deploy that fix and nothing else.</li>
<li><strong>You&rsquo;re briefing agents yourself.</strong> When I start several agents on one repository, each brief says to work in its own <code>git worktree add --detach &quot;$TMPDIR/&lt;task&gt;-wt&quot; refs/remotes/origin/main</code>, push with <code>git push origin HEAD:main</code>, and rebase on conflict.</li>
<li><strong>You want it kept.</strong> Claude Code&rsquo;s sweep never removes a worktree you created with <code>git worktree add</code>.</li>
</ul>
<p><code>claude -w</code> is better when you&rsquo;re starting a session by hand and want the branch, the <code>.env</code> copy, the fence around the main checkout and the cleanup handled for you. The two mix fine: Claude Code treats any worktree as a worktree, including the main-checkout sharing described above.</p>

<h2 class="relative group">The short version
    <div id="the-short-version" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-short-version" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Use <code>claude -w &lt;name&gt;</code> for each parallel session, and add <code>.claude/worktrees/</code> to <code>.gitignore</code>. List every gitignored file your build needs in <code>.worktreeinclude</code>, not just <code>.env</code>. Plan for <code>node_modules</code>, whether that means installing per worktree, cloning or pnpm. After a <code>-p</code> run, expect a lock you may need to <code>git worktree unlock</code>. Before you ship from a worktree that isn&rsquo;t new, check it contains what&rsquo;s already live. Worktrees stop agents overwriting each other&rsquo;s files; they don&rsquo;t stop them disagreeing, so you&rsquo;ll still be reviewing three branches at the end.</p>

<h2 class="relative group">Further reading
    <div id="further-reading" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#further-reading" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p><strong>On this site:</strong></p>
<ul>
<li><a href="https://jared.lynskey.co.nz/en/posts/2026/2026-10-22-claude-code-day-to-day/" >How I Run Claude Code Day to Day</a>, on tmux, permission modes and reaching it from my phone</li>
</ul>
<p><strong>Elsewhere:</strong></p>
<ul>
<li><a href="https://code.claude.com/docs/en/worktrees"  target="_blank" rel="noreferrer">Run parallel sessions with worktrees</a> in the Claude Code docs, which is more thorough than most docs pages</li>
<li><a href="https://git-scm.com/docs/git-worktree"  target="_blank" rel="noreferrer">git-worktree</a>, for what&rsquo;s shared and what&rsquo;s per worktree</li>
<li><a href="https://pnpm.io/settings/node-modules#packageimportmethod"  target="_blank" rel="noreferrer">pnpm&rsquo;s <code>packageImportMethod</code></a>, for clones versus hard links</li>
</ul>
]]></content:encoded>
      <media:content url="https://jared.lynskey.co.nz/en/posts/2026/claude-code-git-worktrees/featured.jpg" medium="image" type="image/jpeg" />
    </item>
    <item>
      <title>How I Run Claude Code Day to Day: tmux, Permission Modes and My Phone</title>
      <link>https://jared.lynskey.co.nz/en/posts/2026/2026-10-22-claude-code-day-to-day/</link>
      <guid isPermaLink="true">https://jared.lynskey.co.nz/en/posts/2026/2026-10-22-claude-code-day-to-day/</guid>
      <pubDate>Thu, 22 Oct 2026 00:00:00 +1300</pubDate>
      <dc:creator>Jared Lynskey</dc:creator>
      <category>Claude Code</category>
      <category>AI Agents</category>
      <category>LLM</category>
      <category>Developer Experience</category>
      <category>DevOps</category>
      <category>tmux</category>
      <category>SSH</category>
      <category>Codex</category>
      <category>Automation</category>
      <description>Claude Code is Anthropic&#39;s coding agent: the Claude models working on your own machine, with your files and your shell. How I run it day to day, with numbers from my own logs: in a terminal inside tmux, five sessions, permission prompts mostly bypassed, reached from my phone over Remote Control, SSH and a chat bot, and why I can&#39;t tell you how it compares with Codex.</description>
      <content:encoded><![CDATA[<p>Claude Code is Anthropic&rsquo;s coding agent. It runs the same Claude models as the Claude app, but on your own machine, where it can read your files, run shell commands and change your code, and it comes with the paid Claude plans. I use it in a terminal rather than the VS Code extension or the desktop app: five sessions inside one tmux session on my laptop, nearly all started with permission prompts switched off, and reachable from my phone through the Claude app&rsquo;s Remote Control, over SSH, or through a chat bot.</p>
<p>What follows is that setup in detail, with numbers from my own machine rather than from memory: the settings files, the session transcripts Claude Code keeps under <code>~/.claude/projects</code> (mine go back to 28 August), and its prompt history, which goes back to February and holds 7,323 prompts.</p>

<h2 class="relative group">Claude and Claude Code are different things
    <div id="claude-and-claude-code-are-different-things" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#claude-and-claude-code-are-different-things" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Claude is the family of models, and the chat app at claude.ai, on the desktop and on your phone, where you talk to them. Claude Code is an agent built on those models. You start it in a project folder and it works there in a loop, reading files, running commands, editing code and running the tests, until the job is done or it needs you. Ask Claude how to fix something and you get an answer. Ask Claude Code and you get the fix, and a diff to read.</p>
<p>I use both. Since 18 October a marketplace and community app I build has sent its translations straight to the Claude API from its Django backend, and the change that switched it over was made in a Claude Code session. In my transcripts, 94% of the replies came from Opus 5.5, and my settings have the effort level at high.</p>
<p>The native installer is one line and keeps itself up to date:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -fsSL https://claude.ai/install.sh <span class="p">|</span> bash</span></span></code></pre></div></div>
<p>It leaves a <code>claude</code> symlink in <code>~/.local/bin</code> pointing into <code>~/.local/share/claude/versions/</code>; mine moved from 2.1.305 to 2.1.306 on its own on 21 October. Claude Code needs a paid Claude plan (Pro, Max, Team or Enterprise) or an API account. Prices change often enough that I&rsquo;ll leave them to <a href="https://claude.com/pricing"  target="_blank" rel="noreferrer">Anthropic&rsquo;s pricing page</a>.</p>

<h2 class="relative group">One tmux session, seven windows
    <div id="one-tmux-session-seven-windows" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#one-tmux-session-seven-windows" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>As I write this, <code>tmux list-panes -a</code> shows one session on my laptop, <code>main</code>, with seven windows. Five are Claude Code, one per project: my marketplace app and my estimating app (both described in <a href="https://jared.lynskey.co.nz/en/posts/2026/2026-07-22-my-current-stack/" >Django on Fly.io</a>), this blog and two smaller things. My terminal profile opens every window with a login shell that attaches to <code>main</code>, so a new tab on the laptop and an SSH login from my phone land on the same sessions.</p>
<p>I tried another multiplexer from 17 September to 8 October and went back to tmux for a practical reason: the SSH app on my phone multiplexes with tmux, and its shortcut buttons send tmux&rsquo;s stock keys. Lines like these in <code>~/.tmux.conf</code> exist for the phone:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">set</span> -g prefix C-a                 <span class="c1"># Ctrl-a prefix</span>
</span></span><span class="line"><span class="cl"><span class="nb">set</span> -g prefix2 C-b                <span class="c1"># stock Ctrl-b too, for apps that send it</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Size each window to the client that used it last, not the smallest one,</span>
</span></span><span class="line"><span class="cl"><span class="c1"># so a phone attached to the same session doesn&#39;t shrink it.</span>
</span></span><span class="line"><span class="cl">setw -g window-size latest
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Copy to the clipboard of whichever terminal is attached (OSC 52),</span>
</span></span><span class="line"><span class="cl"><span class="c1"># so over SSH it lands on the phone&#39;s clipboard too.</span>
</span></span><span class="line"><span class="cl"><span class="nb">set</span> -g set-clipboard on</span></span></code></pre></div></div>
<p>Inside tmux, two things change. Claude Code moves a running command to the background with Ctrl+B, which is now my second tmux prefix, so <code>~/.claude/keybindings.json</code> switches it off and uses Meta+B instead:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;bindings&#34;</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">    <span class="p">{</span> <span class="nt">&#34;context&#34;</span><span class="p">:</span> <span class="s2">&#34;Global&#34;</span><span class="p">,</span> <span class="nt">&#34;bindings&#34;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&#34;ctrl+b&#34;</span><span class="p">:</span> <span class="kc">null</span> <span class="p">}</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl">    <span class="p">{</span> <span class="nt">&#34;context&#34;</span><span class="p">:</span> <span class="s2">&#34;Task&#34;</span><span class="p">,</span> <span class="nt">&#34;bindings&#34;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&#34;ctrl+b&#34;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span> <span class="nt">&#34;meta+b&#34;</span><span class="p">:</span> <span class="s2">&#34;task:background&#34;</span> <span class="p">}</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl">  <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>The other is new lines. Enter sends the prompt. The docs give <code>\</code> then Enter, and Ctrl+J, as the two that work in any terminal; Option+Enter works once the terminal sends Option as Meta; and Shift+Enter works natively in some terminals, but tmux only passes it through with <code>extended-keys</code> switched on. Mine isn&rsquo;t, so in my sessions Shift+Enter sends the prompt. I rarely need any of them: 84 of my 7,323 prompts contain a line break I typed, while 279 contain a paste, which Claude Code folds into a placeholder like <code>[Pasted text #1 +34 lines]</code> and sends in full.</p>

<h2 class="relative group">Terminal, VS Code extension or desktop app?
    <div id="terminal-vs-code-extension-or-desktop-app" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#terminal-vs-code-extension-or-desktop-app" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The same agent comes in several wrappers, and they read the same settings files. Going by the entry point Claude Code records in each transcript, this is how my sessions split:</p>
<table>
	<thead>
			<tr>
					<th>Surface</th>
					<th>What it is</th>
					<th>My use, 28 August to 21 October</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>CLI in a terminal</td>
					<td><code>claude</code> in a terminal, inside tmux</td>
					<td>128 sessions</td>
			</tr>
			<tr>
					<td>Desktop app, Code tab</td>
					<td>Claude Code inside the Claude app, with a diff view and panes</td>
					<td>2 sessions</td>
			</tr>
			<tr>
					<td>VS Code extension</td>
					<td>a chat panel in the editor</td>
					<td>none; it isn&rsquo;t installed now, and only its settings are left</td>
			</tr>
	</tbody>
</table>
<p>The Claude app and claude.ai/code aren&rsquo;t a fourth place to start a session: they steer a session already running on my laptop, or one in the cloud, and most of my sessions since October have had that link through Remote Control.</p>
<p>For me it&rsquo;s the terminal, and not out of loyalty. tmux, which my phone attaches to, needs one, and so do channels, which push outside events into a session and which the docs list as a CLI feature.</p>
<p>People also ask whether Claude Code needs git. The CLI doesn&rsquo;t: my home directory isn&rsquo;t a repository, and 208 of my prompts went to sessions started there. The desktop app&rsquo;s documentation says git is required for its session isolation, where each session gets its own worktree, and pulling a cloud session into the terminal needs a checkout of the same repository. I&rsquo;ve never seen the &ldquo;Git is required&rdquo; message myself. My last desktop session, on 20 October, ran in a folder that isn&rsquo;t a repository at all.</p>

<h2 class="relative group">Permission modes, and the one I actually use
    <div id="permission-modes-and-the-one-i-actually-use" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#permission-modes-and-the-one-i-actually-use" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The permission mode decides how often Claude Code stops to ask, and Shift+Tab cycles through the modes. Manual (<code>default</code>) asks before most actions that edit files, run commands or reach the network. <code>acceptEdits</code> lets file edits and common filesystem commands through. <code>plan</code> reads and proposes without editing. <code>auto</code> has a second model, a classifier, block the risky actions instead of asking you. <code>bypassPermissions</code> asks about almost nothing. Since 2.1.283, a terminal session starts in auto mode unless <code>permissions.defaultMode</code> says otherwise.</p>
<p>So my honest answer to &ldquo;how do I run Claude Code without it asking for permission&rdquo; is that I start it like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">claude --dangerously-skip-permissions</span></span></code></pre></div></div>
<p>62 of the 69 <code>claude</code> commands in my shell history carry that flag, and so do all five sessions running now. Of the 1,266 prompts I typed between 28 August and 21 October, 1,179 went to sessions in bypass mode, 82 to auto mode and five to Manual or accept-edits.</p>
<p>The docs are plain that bypass mode is meant for &ldquo;isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.&rdquo; My laptop is none of those, and my settings record that I&rsquo;ve clicked through that warning (<code>&quot;skipDangerousModePermissionPrompt&quot;: true</code>). If you do the same, know that allow rules have no effect in bypass mode, so in my everyday sessions the 378 allow rules spread over 19 settings files do nothing at all. Deny and ask rules do still apply, and I have none of either.</p>
<p>The exception is the session that reads other people&rsquo;s words. Its launcher doesn&rsquo;t pass the flag, so it starts in auto mode. All 27 production events and 42 of the 43 chat messages that reached a session between 12 and 20 October arrived in auto mode, and none in bypass.</p>
<p>What actually keeps bypass mode from biting me is a few habits, written into Claude&rsquo;s memory after a day in September when two sessions in the same checkout overwrote each other&rsquo;s work and nearly deployed it (<a href="https://jared.lynskey.co.nz/en/posts/2026/2026-10-22-agentic-ai-security/#isolation-because-the-likeliest-threat-is-another-agent" >the agentic AI security post</a> has the whole story): commit a small fix the moment it works, stage files by name and never with <code>git add -A</code>, look at <code>git status</code> for changes you didn&rsquo;t make, and when <code>main</code> holds other sessions&rsquo; undeployed work, deploy from a worktree at the commit that&rsquo;s live.</p>

<h2 class="relative group">Reaching it from my phone
    <div id="reaching-it-from-my-phone" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#reaching-it-from-my-phone" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>There are three ways in, and each one reaches something different.</p>
<table>
	<thead>
			<tr>
					<th>Way in</th>
					<th>What I get on the phone</th>
					<th>What it runs on</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Remote Control, in the Claude app</td>
					<td>one session&rsquo;s conversation: type, answer its questions, attach a photo</td>
					<td><code>remoteControlAtStartup: true</code>, plus push notifications</td>
			</tr>
			<tr>
					<td>SSH into <code>main</code>, from a phone SSH app</td>
					<td>the terminal itself, every window</td>
					<td>a private network, an sshd running as my user, and a short alias to attach</td>
			</tr>
			<tr>
					<td>A chat bot</td>
					<td>a session that hears production errors and answers messages</td>
					<td>an official Claude Code channel plugin and an event channel I wrote</td>
			</tr>
	</tbody>
</table>
<p>Remote Control connects the Claude app on a phone, or claude.ai/code in a browser, to a session that keeps running on the laptop, files, tools and MCP servers included. I typed <code>/rc</code> 26 times between 13 September and 20 October. Now <code>remoteControlAtStartup</code> is on and new sessions connect by themselves: since the start of October, 67 of the 77 sessions I started had a Remote Control link, against 3 of 52 in the second half of September.</p>
<p>With <code>agentPushNotifEnabled</code> on, Claude can send a push notification when it decides one is needed, which the docs say is usually when a long task finishes or it needs a decision. It needs a claude.ai subscription rather than an API key, and because the session runs on the laptop, the laptop has to be awake. Since 15 October mine doesn&rsquo;t sleep with the lid shut (<code>sudo pmset -a disablesleep 1</code>).</p>
<p>It works the other way too. <code>/teleport</code>, or <code>claude --teleport</code>, pulls a cloud session that was started on the web or in the app down into the terminal, with its branch and its conversation. I&rsquo;ve done that twice, both times in July.</p>
<p>SSH is for when I want the terminal itself. The phone reaches the laptop over the private network from <a href="https://jared.lynskey.co.nz/en/posts/2026/2026-10-01-cloudflare-warp-dev-network/" >my private-network post</a>, and an alias attaches it to <code>main</code>, so I can swipe between the windows I left on the laptop. Getting the Mac to answer phone apps properly took four separate fixes, and the one that matters for Claude Code is that tmux must never start by itself: an app that opened a session to run <code>docker ps</code> got 72 KB of screen redraw back instead.</p>
<p>The chat bot is for the session I don&rsquo;t want to sit and watch. Since 12 October one session has run with a small channel I wrote, which checks the app&rsquo;s server once a minute for new production errors and project-board activity and hands them to the session, plus one of the official chat plugins, so the two of us on its allowlist can message it. The launch line looks like this, with the names made generic:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">exec</span> claude <span class="se">\
</span></span></span><span class="line"><span class="cl">  --channels plugin:&lt;chat-plugin&gt;@claude-plugins-official <span class="se">\
</span></span></span><span class="line"><span class="cl">  --dangerously-load-development-channels server:my-events <span class="s2">&#34;</span><span class="nv">$@</span><span class="s2">&#34;</span></span></span></code></pre></div></div>
<p>A supervisor script keeps it running inside tmux. After a restart it resumes the same conversation, so the session carries on rather than waking up blank, and it announces every restart in the chat. The session fixes things in the working tree and stops there, with one exception I added on 13 October: a bug that is actually hurting users in production it may fix, test, commit and deploy, and then tell us what it did.</p>

<h2 class="relative group">Skills, memory and /goal
    <div id="skills-memory-and-goal" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#skills-memory-and-goal" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>There&rsquo;s no <code>hooks</code> key in any of my settings files. The nearest thing is <code>/goal</code>, which I&rsquo;ve used again and again since 11 July. It takes a condition and sets up a Stop hook for the session that, in Claude Code&rsquo;s words, &ldquo;will block stopping until the condition holds&rdquo;. My goals read the way I&rsquo;d say them out loud. A real one from July, typos and all, told it the build was &ldquo;still broken, try a deeper fix and dont stop until&rdquo; it was out to testers. To check on a long run without derailing it there&rsquo;s <code>/btw</code>, a side question that stays out of the conversation. Mine are mostly some version of &ldquo;hows it going?&rdquo;.</p>
<p>Skills hold the things I&rsquo;d otherwise explain every time. One user-level skill reads a weekly keyword report for the sites I look after, this blog among them, and applies it to titles, descriptions and tags. The questions this post answers came from its report for this blog, dated 18 October, and the skill file is versioned in a repo alongside its code. The marketplace app&rsquo;s repo has its own skills: one starts the API in Docker and runs a smoke test, one works the project board, and one files the company&rsquo;s expenses. The two plugins I have installed are a Swift language-server plugin and the chat one.</p>
<p>Memory is where the lessons go. I have 160 memory files across 17 projects, 83 of them for the marketplace app, and many are about something that broke. The app&rsquo;s <code>CLAUDE.md</code> is now about six times as long as it was in June. This blog&rsquo;s <code>CLAUDE.md</code> is an empty file; how a post should sound lives in a memory file instead.</p>
<p>For bigger jobs Claude starts subagents, 120 times in my main sessions, 40 of them forks of the conversation. That&rsquo;s how this blog gets its Japanese, Korean, Chinese and Vietnamese versions. On 19 and 20 October a redesign of the app&rsquo;s community section went through the Workflow tool four times: an audit through seven lenses and a critic, which confirmed about 58 findings; fixes by five groups that each owned their own files and were each reviewed; a pass for the leftovers; and an independent check that every finding had been fixed. It shipped on the 20th.</p>

<h2 class="relative group">Driving a workstation over SSH
    <div id="driving-a-workstation-over-ssh" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#driving-a-workstation-over-ssh" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p><a href="https://jared.lynskey.co.nz/en/posts/2026/2026-10-01-cloudflare-warp-dev-network/" >My private-network post</a> is about putting the heavy work on devbox, the office workstation with the GPU, and reaching it from anywhere. Claude Code does most of that reaching. Between 24 September and 19 October, 21 sessions on the laptop ran 1,470 commands on devbox over plain <code>ssh</code>: <code>kubectl</code> into the cluster that runs there, <code>psql</code> inside a database pod, <code>tmux capture-pane</code> to see how a long job was getting on. Because <code>ssh devbox</code> falls back to a tunnel off the office network, the same session works from the office, from home or from a café. And since the laptop no longer sleeps, a session can keep driving devbox while I look in on it from the phone.</p>

<h2 class="relative group">Why I can&rsquo;t compare it with Codex
    <div id="why-i-cant-compare-it-with-codex" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-i-cant-compare-it-with-codex" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I can&rsquo;t tell you from my own use whether Claude Code is better than Codex, and the table shows why:</p>
<table>
	<thead>
			<tr>
					<th></th>
					<th>Codex</th>
					<th>Claude Code</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>When</td>
					<td>29 November to 4 December 2025</td>
					<td>since at least November 2025; prompt history from February 2026</td>
			</tr>
			<tr>
					<td>Where</td>
					<td>the VS Code extension</td>
					<td>the terminal (128 sessions), the desktop app (2)</td>
			</tr>
			<tr>
					<td>Model and effort</td>
					<td><code>gpt-5.1-codex</code>, medium</td>
					<td>Opus 5.5, high</td>
			</tr>
			<tr>
					<td>Approvals</td>
					<td><code>workspace-write</code> sandbox, network off, asks on request</td>
					<td>bypass in 93% of prompts, auto for the chat session</td>
			</tr>
			<tr>
					<td>How much</td>
					<td>4 threads</td>
					<td>7,323 prompts since February</td>
			</tr>
			<tr>
					<td>Project notes</td>
					<td>reads <code>AGENTS.md</code></td>
					<td>reads <code>CLAUDE.md</code>, plus its memory files</td>
			</tr>
	</tbody>
</table>
<p>Four threads in one week, on an image question, two changes to a website and a 3D scene, is a trial, not a comparison. One detail from them applies to any switch between agents. The 3D project kept its rules in a <code>claude.md</code>, and my first question to Codex there was whether it read Claude&rsquo;s files before a conversation. It said it didn&rsquo;t, and it only picked up the project&rsquo;s rules when I asked it to read that file. Whichever agent you move to, the instructions file stays behind unless you bring it. I haven&rsquo;t opened a Codex thread since. The extension loaded in VS Code on a handful of days between 24 September and 4 October without my starting one, and it&rsquo;s uninstalled now.</p>
<p>So the verdict I can stand behind is narrow. Claude Code is what my setup is built around, and I haven&rsquo;t gone back to see how Codex handles the same things today.</p>
<p>One last number says more about how I use it than anything above. In the main sessions on my laptop since late August, Claude Code ran 18,311 shell commands and read, wrote or edited a file 2,331 times. By count, most of its work is running the commands I&rsquo;d otherwise be typing, on the laptop and over SSH, from wherever I happen to be. When it does write the code, that code isn&rsquo;t welcome everywhere, which is a story of its own in <a href="https://jared.lynskey.co.nz/en/posts/2026/2026-10-18-pyhtml2text/" >the pyhtml2text post</a>.</p>
]]></content:encoded>
      <media:content url="https://jared.lynskey.co.nz/en/posts/2026/2026-10-22-claude-code-day-to-day/featured.jpg" medium="image" type="image/jpeg" />
    </item>
  </channel>
</rss>
