Agent chaosAs reported·17 Nov 2026
Claude Code threw away a subagent's notes because they were in a gitignored folder, a user reports
As reported One person’s public account. We couldn’t independently confirm it, and we’ll update this if the facts change.
As reported: a Claude Code subagent working in its own git worktree wrote notes to a gitignored folder. Cleanup decided it had made no changes, removed the worktree and the notes with it.
This is one person's account in a GitHub issue, not independently confirmed. It was filed on 15 November against Claude Code 2.1.325 on macOS, with steps to reproduce it, and had no replies when we checked.
What happened
Claude Code can give a subagent its own git worktree, a separate checkout of the repo, so it can work without touching the main copy. When the subagent finishes "without changes", Claude Code removes that worktree to keep things tidy.
The catch is how it decides there were no changes. Files in gitignored paths don't count. So anything the subagent wrote to an ignored folder is deleted along with the worktree, and nobody is warned.
How it went wrong
The user says this is not an edge case. Gitignored folders are exactly where agents are told to put scratch output: local notes, build products and logs. In their case a research subagent's notes vanished this way. They got them back only by replaying the subagent's file writes from its transcript, one by one.
Their repro is short. In a repo where the target folder is gitignored, start a worktree-isolated subagent and have it write a single file there, with no tracked changes and no commits. When it finishes, the worktrees folder is empty, git lists only the main checkout, and the file is gone.
What the user wants
Either treat new untracked or ignored files as changes, so the worktree is kept and its path reported back, or tell the parent agent which ignored files are about to be deleted. The user notes that the desktop app's worktree pool has had the same class of problem in earlier reports.
Until there's a fix, the workaround is to brief subagents to return their findings in the final report, or to write anywhere outside the worktree.
Our take
Cleanup code that only asks git what changed will always miss what git was told to ignore. Any tool that deletes a working directory should list what is in it first and keep anything new.
Never let cleanup delete a folder based on git status alone: ignored files are still someone's work.

