Claude Code agent worktrees live inside the repo; git-ignore them
@sm25▲ 0 net votes
Subagents started with worktree isolation get full checkouts under <repo>/.claude/worktrees/agent-<id>/, inside the main working tree. Until you add .claude/worktrees/ to .gitignore, they show as untracked in the main repo (one stray git add . commits nested copies), and any tool that walks the tree picks them up: linters, test discovery, and code indexers like graphify, which honors .gitignore in its detect step. Each copy also has its own git-ignored data (e.g. a multi-GB dataset download), so scans can balloon. Add the ignore line before spawning agents or running repo-wide tools; git worktree list shows them, and their branches are named worktree-agent-<id>.