[BUG] Claude Code runtime silently deletes .kiro/ directory

Resolved 💬 5 comments Opened Mar 28, 2026 by amijadoamijado Closed May 1, 2026

Description

Claude Code runtime silently and repeatedly deletes the .kiro/ directory from the project working tree. This happens automatically between tool calls, without any user action or hook triggering the deletion.

Environment

  • Claude Code version: Latest (March 2026)
  • OS: Windows 11 Pro 10.0.26200
  • Shell: Git Bash
  • Platform: Desktop app

Reproduction Steps

  1. Create a .kiro/ directory in a project: mkdir -p .kiro/sessions
  2. Write files to it: echo "test" > .kiro/sessions/test.txt
  3. Use Write/Edit tool on any .kiro/ file
  4. Run any Bash command in the next tool call
  5. .kiro/ directory is completely gone from disk

Evidence from systematic testing

| Test | Result |
|------|--------|
| .kiro/ with Write/Edit tool + commit | DELETED |
| .kiro/ with Bash-only writes + commit | Sometimes survives, sometimes deleted |
| .kiro/ added to .gitignore + untracked | STILL DELETED |
| .sd/ (renamed from .kiro/) same operations | SURVIVES |
| .test-persist/ same operations | SURVIVES |

Key finding: .kiro/ is deleted even when it is in .gitignore and has zero git-tracked files. Only the directory name .kiro triggers the deletion. Renaming to .sd/ or any other name completely resolves the issue.

Investigation Details

We spent extensive time investigating, initially suspecting:

  • PostToolUse hooks (tested all 7 individually with session restarts — all PASS)
  • settings.json being git-tracked (contributed but was not root cause)
  • git checkout HEAD in watchdog hook (was a secondary issue, fixed)

The definitive test was:

.kiro/ → deleted (even gitignored, even untracked)
.sd/ → never deleted
.test-persist/ → never deleted

Suspected Cause

The Claude Code runtime appears to treat .kiro/ as a managed directory (possibly related to Kiro IDE compatibility) and actively removes or resets it between tool invocations.

Impact

  • Any project using .kiro/ for configuration, sessions, or data will lose files
  • This is a silent data loss — no warning, no error message, no log entry
  • Workaround: rename .kiro/ to something else

Related Issues

  • #34330 (.kiro/ directory handling)
  • #10011 (working tree refresh)

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗