claude-code - 💡(How to fix) Fix [DOCS] Claude directory swept-paths table omits `.claude/worktrees/` for background agent worktrees

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

| `projects/<project>/<session>.jsonl`         | Full conversation transcript |
| `projects/<project>/<session>/subagents/`    | Subagent conversation transcripts |
| `projects/<project>/<session>/tool-results/` | Large tool outputs |
| `file-history/<session>/`                    | Pre-edit snapshots |
| `plans/`                                     | Plan files |
| `debug/`                                     | Debug logs |
| `paste-cache/`, `image-cache/`               | Large paste/image caches |
| `session-env/`                               | Session environment metadata |
| `tasks/`                                     | Task lists |
| `shell-snapshots/`                           | Captured shell environment |
| `backups/`                                   | Config backups |
| `feedback-bundles/`                          | Redacted transcript archives |
| `todos/`, `statsig/`, `logs/`                | Legacy directories |

---

| `worktrees/`                                 | Worktree directories created by background agents, cleaned up once older than `cleanupPeriodDays` |
RAW_BUFFERClick to expand / collapse

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/claude-directory

Section/Topic

"Application data" > "Cleaned up automatically" table (lists paths under ~/.claude/ that the cleanupPeriodDays sweep removes on startup).

Current Documentation

The swept-paths table currently lists these directories under ~/.claude/:

| `projects/<project>/<session>.jsonl`         | Full conversation transcript |
| `projects/<project>/<session>/subagents/`    | Subagent conversation transcripts |
| `projects/<project>/<session>/tool-results/` | Large tool outputs |
| `file-history/<session>/`                    | Pre-edit snapshots |
| `plans/`                                     | Plan files |
| `debug/`                                     | Debug logs |
| `paste-cache/`, `image-cache/`               | Large paste/image caches |
| `session-env/`                               | Session environment metadata |
| `tasks/`                                     | Task lists |
| `shell-snapshots/`                           | Captured shell environment |
| `backups/`                                   | Config backups |
| `feedback-bundles/`                          | Redacted transcript archives |
| `todos/`, `statsig/`, `logs/`                | Legacy directories |

What's Wrong or Missing?

The .claude/worktrees/ directory — where background agent worktrees are stored — is not listed in the swept-paths table. Background agents create worktrees under this path, and the cleanupPeriodDays sweep (default 30 days) is expected to clean them up at startup when they are older than the configured retention period.

The Worktrees page documents the general sweep behavior for subagent worktrees at line 93:

Subagent worktrees orphaned by a crash or interrupted run are removed at startup once they are older than your cleanupPeriodDays setting

But the swept-paths table in the Claude directory reference — the canonical list of all ~/.claude/ paths covered by automatic cleanup — omits the worktrees/ entry.

As of v2.1.157, background agent worktrees under .claude/worktrees/ that were orphaned after the sweep are now properly cleaned up. The swept-paths table should reflect that this path is covered.

Suggested Improvement

Add a row to the "Cleaned up automatically" table:

| `worktrees/`                                 | Worktree directories created by background agents, cleaned up once older than `cleanupPeriodDays` |

Insert it alphabetically after the tasks/ row and before shell-snapshots/, or at the end of the list.

Impact

Low - Minor confusion or inconvenience

Additional Context

Affected Pages:

PageSectionContext
https://code.claude.com/docs/en/claude-directory"Cleaned up automatically" tableMissing worktrees/ row

Total scope: 1 page affected

The cleanupPeriodDays setting defaults to 30 days. The Worktrees page (https://code.claude.com/docs/en/worktrees) references this sweep but the Claude directory page (the authoritative catalog of swept paths) is missing the entry.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [DOCS] Claude directory swept-paths table omits `.claude/worktrees/` for background agent worktrees