Back to the ward
Case 0477SignificantApraxia

The Worktree That Reached Into the Trunk

Admitted
2026-09-22
Source dataset
rewardhacking.org
Source
GitHub, anthropics/claude-code issue #75490
Failure mode
Destructive action
Agent system
Tool-calling
Tool access
System admin
Industry
Software development

Presenting Behaviour

Claude Code's desktop app uses a worktree mechanism meant to give an AI-assisted coding session its own isolated copy of a Git repository, separate from the developer's actual working files. During one such session, three gitignored directories (two Python virtual environments and a cloned third-party repository with local patches) were deleted from the main working tree, not the isolated worktree. Sibling directories covered only by a broader wildcard pattern in .gitignore were untouched; only the ones matched by literal, specific path entries were removed.

Case Replay

A reconstruction, not a simulation. This sequence is reconstructed from the public incident record and summarised in our own words. It is a static record of what was reported, and nothing here can be run or replayed live.

4 steps

  1. Isolated session. A worktree should give the session its own copy of the repository.
  2. Escapes the boundary. Three gitignored directories are deleted from the main tree. This is where the agent derailed.
  3. Literal paths only. Directories matched by a wildcard survive; literal entries are removed.
  4. Damage surfaces later. A pipeline quietly falls back to a legacy path.

Differential Diagnosis

Coincidental data loss unrelated to the worktree feature, considered and ruled out; the timestamps line up precisely, with the main repo's HEAD moving to a detached state at 18:19 and the three directories emptied six to ten minutes later, right before the worktree's own directory was updated.

A deliberate cleanup action gone too broad, considered and ruled out; nothing in the available logs shows the agent being asked to clean up or remove any files, gitignored or otherwise, during this operation.

Apraxia (the tool understood its purpose (keeping a session's changes isolated) but the actual mechanism for doing so misfired), most consistent with the evidence. The selective pattern, hitting only literal-path .gitignore entries while sparing wildcard-matched ones, points to an isolation mechanism that mishandled a specific class of file reference rather than a decision the agent made about what to delete.

Working Diagnosis

Apraxia: a worktree-isolation feature, whose entire purpose is to protect the main working tree, instead reached into it and deleted several gigabytes of gitignored data through a mechanism that mishandled literal-path entries.

Discussion

The whole promise of an isolation feature is that failures inside it stay inside it, this incident is dangerous precisely because it broke that promise silently, with no error at the time and a production pipeline that only revealed the damage later by quietly falling back to a legacy code path. The safeguard isn't more caution from the person using the tool; it's making the isolation boundary itself provably safe for anything outside it, gitignored or not, rather than assuming ignored files are safe to touch.

Mitigation Strategy

Make the isolation boundary provably safe for everything outside it, ignored files included.

Governance Guardrails

Isolation testing; no deletes outside the worktree; detection of fallbacks to legacy code paths.

Typical Presentation in Human Patients

General clinical background, included for context. Not medical advice, and not a diagnosis of any individual.

Apraxia usually follows damage to specific brain regions, often after a stroke. A person with apraxia cannot carry out a previously familiar, purposeful movement (such as waving goodbye or using a comb) on request or by imitation, even though their muscle strength, coordination, and understanding of what's being asked are otherwise intact.

Source Note

GitHub, anthropics/claude-code issue #75490

https://github.com/anthropics/claude-code/issues/75490