<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: joshinamsterdam-ai</title>
    <description>The latest articles on DEV Community by joshinamsterdam-ai (@joshinamsterdamai).</description>
    <link>https://dev.to/joshinamsterdamai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273127%2F0a527db9-0839-4a43-b85a-f7d1ca28062a.png</url>
      <title>DEV Community: joshinamsterdam-ai</title>
      <link>https://dev.to/joshinamsterdamai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joshinamsterdamai"/>
    <language>en</language>
    <item>
      <title>Claude Code remembered a fact in one clone of our repo and not in the other</title>
      <dc:creator>joshinamsterdam-ai</dc:creator>
      <pubDate>Mon, 30 Nov 2026 01:00:00 +0000</pubDate>
      <link>https://dev.to/joshinamsterdamai/claude-code-remembered-a-fact-in-one-clone-of-our-repo-and-not-in-the-other-3o37</link>
      <guid>https://dev.to/joshinamsterdamai/claude-code-remembered-a-fact-in-one-clone-of-our-repo-and-not-in-the-other-3o37</guid>
      <description>&lt;p&gt;A fact you tell Claude Code to remember stays with the clone you said it in. A worktree of that clone gets it. A second clone of the same repository, on the same laptop, does not. We checked this on 25 November 2026 with Claude Code 2.1.331. Our AI agent sessions ran the test under a founder's direction.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;We made a throwaway repository with a committed &lt;code&gt;CLAUDE.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# Project rules
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;We deploy on Fridays.
&lt;span class="k"&gt;- &lt;/span&gt;Release steps: @docs/release.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;docs/release.md&lt;/code&gt; holds one line: "Run &lt;code&gt;make release-koala&lt;/code&gt; to cut a release."&lt;/p&gt;

&lt;p&gt;A fresh session, asked what day we deploy and what command cuts a release, answered: "We deploy on Fridays, and &lt;code&gt;make release-koala&lt;/code&gt; cuts a release." So the committed file and the file it imports both loaded. No surprise there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Saving the fact
&lt;/h2&gt;

&lt;p&gt;In that checkout, one session got this prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Remember this for future sessions: the staging database is called wombat-staging-7.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude wrote two files: a note called &lt;code&gt;staging-database-name.md&lt;/code&gt;, and a one-line entry pointing to it in &lt;code&gt;MEMORY.md&lt;/code&gt;. Both went into Claude Code's own config folder, under &lt;code&gt;projects/C--work-guides-test-20261125-teamrepo/memory/&lt;/code&gt;. Nothing went into the repository, and &lt;code&gt;git status&lt;/code&gt; had nothing to commit.&lt;/p&gt;

&lt;p&gt;Look at that folder name. It is the clone's path on disk, with the separators turned into dashes. That turns out to matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Asking around
&lt;/h2&gt;

&lt;p&gt;Every check used the same question in a fresh session. It told Claude not to use tools, so the answer could only come from what the session loaded at start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What is the staging database called? Do not use any tools. If nothing you were given says, answer exactly: I do not know.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where the session ran&lt;/th&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The same checkout, new session&lt;/td&gt;
&lt;td&gt;&lt;code&gt;wombat-staging-7&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A git worktree of that repository, on another branch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;wombat-staging-7&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A second clone of the repository, same laptop, same user&lt;/td&gt;
&lt;td&gt;"I do not know."&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The second clone still answered "Fridays" when asked what day we deploy. It read the same committed &lt;code&gt;CLAUDE.md&lt;/code&gt;. It had no way to see the note.&lt;/p&gt;

&lt;p&gt;Two details surprised us.&lt;/p&gt;

&lt;p&gt;First, the worktree. Claude Code gave the worktree a project folder of its own, and that folder had no memory in it at all. The session still knew the database name, so it was reading the main repository's memory. That matches Anthropic's memory docs, which say all worktrees and subdirectories of one git repository share one auto memory directory.&lt;/p&gt;

&lt;p&gt;Second, the clone. It got its own project folder, &lt;code&gt;C--work-guides-test-20261125-teammate-clone&lt;/code&gt;, with an empty memory folder. The docs say the project path "is derived from the git repository". In our test, two clones of the same repository on one laptop were two projects with two memories.&lt;/p&gt;

&lt;p&gt;We did not test a second laptop. The docs cover that case directly: auto memory is machine-local, and its files are not shared across machines or cloud environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  What that means for a team
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Anything a person tells Claude to "remember" lives on their laptop, in that one clone. The rest of the team's agents never see it.&lt;/li&gt;
&lt;li&gt;The same holds for one person with two clones of a repository.&lt;/li&gt;
&lt;li&gt;Worktrees of one clone on one laptop share memory.&lt;/li&gt;
&lt;li&gt;What reaches everyone is what is committed: &lt;code&gt;CLAUDE.md&lt;/code&gt;, the files it imports with &lt;code&gt;@path&lt;/code&gt;, and scoped rules in &lt;code&gt;.claude/rules/&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The quiet risk is a fact one person's agent knows and the others do not. Nothing warns you. Our second clone said "I do not know" only because the question told it to answer that way when nothing it had been given said otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you want a fact to travel
&lt;/h2&gt;

&lt;p&gt;Ask Claude to put it in &lt;code&gt;CLAUDE.md&lt;/code&gt;, by name, and commit the change. A request to "remember" goes to auto memory. Naming the file gets the file edited.&lt;/p&gt;

&lt;p&gt;Look at your auto memory now and then. By default it is plain markdown under &lt;code&gt;~/.claude/projects/&amp;lt;project&amp;gt;/memory/&lt;/code&gt;, with &lt;code&gt;MEMORY.md&lt;/code&gt; as the index. Anything in there a teammate would need belongs in the repository.&lt;/p&gt;

&lt;p&gt;Know the limits of &lt;code&gt;CLAUDE.md&lt;/code&gt;. Claude reads it as context, and Claude Code does not enforce it, so rules that must always hold belong in hooks or permissions. It also changes only when someone merges an edit.&lt;/p&gt;

&lt;p&gt;The full list of what Claude Code shares and what it keeps local, with links to Anthropic's docs, is in our guide, &lt;a href="https://www.koalafix.com/guides/is-claude-code-memory-shared-with-your-team" rel="noopener noreferrer"&gt;Is Claude Code's memory shared with your team?&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disclosure
&lt;/h2&gt;

&lt;p&gt;We build KoalaFix, a shared memory for a team's AI coding agents, so we have an interest in this topic. Read this post with that in mind. A committed &lt;code&gt;CLAUDE.md&lt;/code&gt; is worth keeping either way.&lt;/p&gt;

&lt;p&gt;This post was drafted with AI assistance and checked by a founder.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>git</category>
      <category>productivity</category>
    </item>
    <item>
      <title>We let two Claude Code agents change the same line at once</title>
      <dc:creator>joshinamsterdam-ai</dc:creator>
      <pubDate>Mon, 30 Nov 2026 00:57:48 +0000</pubDate>
      <link>https://dev.to/joshinamsterdamai/we-let-two-claude-code-agents-change-the-same-line-at-once-34nh</link>
      <guid>https://dev.to/joshinamsterdamai/we-let-two-claude-code-agents-change-the-same-line-at-once-34nh</guid>
      <description>&lt;p&gt;The usual advice for running several Claude Code agents is to give each one its own git worktree. We wanted to see what that buys you when two agents want the same line, so we tested it. The same afternoon, our own agents ran into the real version.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test
&lt;/h2&gt;

&lt;p&gt;On 25 November 2026 we made a throwaway repository with one file that matters, &lt;code&gt;src/price.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;TAX_RATE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we started two Claude Code sessions (version 2.1.331) at the same moment, each in its own worktree, with conflicting jobs. Our AI agent sessions ran the commands; nobody typed them by hand. The core of each one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;claude -p "In src/price.js change TAX_RATE to 0.15. Then commit with git: git commit -am 'Tax 15'. Reply with the commit hash only." --worktree tax-a
claude -p "In src/price.js change TAX_RATE to 0.125. Then commit with git: git commit -am 'Tax 12.5'. Reply with the commit hash only." --worktree tax-b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our wrapper script also pinned the model and kept our own settings and MCP servers out of the run.&lt;/p&gt;

&lt;p&gt;What happened:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each session finished in about seven seconds.&lt;/li&gt;
&lt;li&gt;Each one edited the file and committed on its own branch, &lt;code&gt;worktree-tax-a&lt;/code&gt; and &lt;code&gt;worktree-tax-b&lt;/code&gt;. Neither touched the other's files.&lt;/li&gt;
&lt;li&gt;The main checkout still said &lt;code&gt;0.10&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git worktree list&lt;/code&gt; showed both worktrees as locked, and &lt;code&gt;.claude/&lt;/code&gt; showed up as an untracked folder in the main checkout.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During the work, nothing collided. The collision waited for the merge. Merging the first branch was a fast-forward. Merging the second gave this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Auto-merging src/price.js
CONFLICT (content): Merge conflict in src/price.js
Automatic merge failed; fix conflicts and then commit the result.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the right result. Git cannot know whether tax is 15% or 12.5%. Somebody has to decide, and that person needs to know two agents were asked two different things. The worktrees kept the agents from overwriting each other's files. Neither agent ever learned the other one existed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same thing, for real, on the same day
&lt;/h2&gt;

&lt;p&gt;That afternoon our agents built three new guide pages for our website, one pull request each. Each page needs its route added to a list in the site's &lt;code&gt;worker.js&lt;/code&gt;. That list is a single line. On main today it holds 51 routes in about 1,200 characters.&lt;/p&gt;

&lt;p&gt;Every pull request added one entry to that one line. Nothing else overlapped: the guides index page and the sitemap merged cleanly. A trial merge before review had already shown that the second and third pull requests would conflict on that line. Knowing in advance did not make it free.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first pull request merged.&lt;/li&gt;
&lt;li&gt;The second was approved 12 seconds later, while it already conflicted. The repair, merging main in and keeping both routes, went up about a minute and a half after the approval. GitHub dismissed the approval 5 seconds after the push, so it had to be approved again.&lt;/li&gt;
&lt;li&gt;The third was repaired in the same minute. When the second merged, about an hour and a quarter later, the third conflicted on the same line again and needed another repair.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each repair was mechanical: merge main, keep every route from both sides, change no wording, rerun the tests (195 passed each time). From the first merge to the last took about an hour and a half. None of the repairs was hard. Most of that time was a pull request waiting for review while the branch under it kept moving.&lt;/p&gt;

&lt;p&gt;So the collisions that cost us time showed up at merge time, on a small shared structure, and in the review step that resets when a branch changes. While the agents worked, the worktrees kept them apart just as the test showed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two more from our notes
&lt;/h2&gt;

&lt;p&gt;Worktrees share more than you might expect. On 2 November two of our agent sessions, each in its own worktree of the same repository, each used &lt;code&gt;git stash&lt;/code&gt;. Each pop brought back the other session's changes. Git keeps one stash list per repository, and every worktree pushes and pops the same stack. We saved both diffs as patches and put each one back in its own worktree.&lt;/p&gt;

&lt;p&gt;On 4 November a local check said a branch would merge cleanly. The pull request opened as conflicting in seven files. The worktree's copy of &lt;code&gt;origin/main&lt;/code&gt; was an hour old, and another change had landed in the same spots since.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we do now
&lt;/h2&gt;

&lt;p&gt;Right before opening a pull request, the agent fetches and checks the merge against the real main:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git fetch origin
git merge-tree --write-tree --name-only origin/main HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No &lt;code&gt;git stash&lt;/code&gt; in a repository where other agents are running. To set changes aside, we use a patch instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; x.patch
git apply -R x.patch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When several branches add to the same shared list, we expect the conflict, merge them one at a time, and repair each in turn by keeping both sides. The route list is still one line. We have not fixed that yet.&lt;/p&gt;

&lt;p&gt;The setup itself (worktree commands, subagents, the experimental agent teams switch and its limits) is in our &lt;a href="https://www.koalafix.com/guides/run-several-claude-code-agents-at-once" rel="noopener noreferrer"&gt;guide to running several Claude Code agents at once&lt;/a&gt;. One finding from that guide is worth repeating here: a &lt;code&gt;claude -p&lt;/code&gt; run with agent teams switched on, asked for two teammates, got two ordinary subagents and no team. Teammates start only in interactive sessions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disclosure
&lt;/h2&gt;

&lt;p&gt;We build KoalaFix, a tool for coordinating a team's AI coding agents, so we have an interest in this topic. Weigh what we say with that in mind.&lt;/p&gt;

&lt;p&gt;This post was drafted with AI assistance and checked by a founder.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>git</category>
      <category>claudecode</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
