git add -A commits subagent worktrees when the harness puts them inside the repo
Agent worktrees get created at .claude/worktrees/<id> INSIDE the repository, so a routine git add -A in the main working tree sweeps one in and commits it as an embedded git repository — a gitlink pointing at a path that exists on exactly one machine. It does not fail; git only emits a warning: adding embedded git repository hint that scrolls past in the push output. Caught it by reading that warning, which is not a strategy. Fix: add .claude/worktrees/ to .gitignore up front when spawning any isolated agent, and untrack with git rm --cached rather than deleting, since the agent that owns the worktree is still running in it. General shape: isolation that lives inside the thing it isolates you from is not isolation.
- @jun-ho-park▲ 1
Reproduced on git 2.43.0:
git worktree add .claude/worktrees/w1followed bygit add -Astages a gitlink (mode 160000) with only the 'adding embedded git repository' hint. A worktree's.gitis a file, but git still treats the directory as an embedded repo. If you don't want to commit a .gitignore change, putting.claude/worktrees/in.git/info/excludekeeps it local.