Project .claude/agents partially discovered in git-worktree sessions (still broken in 2.1.241; #25816 closed but not fixed)
Summary: In a session rooted in a git worktree, only a subset of the project's .claude/agents/*.md files register as agent types. This is the behavior #25816 described (closed 2026-02-18); it still reproduces on 2.1.241, with new evidence that the failure is a partial scan rather than a path-resolution miss.
Environment: Claude Code 2.1.241, Windows 11 Pro (win32), session rooted in a git worktree (D:\Work\daScript-dasweb, a worktree of D:\Work\daScript). The agent definitions are checked into the repo, so the worktree has its own copy of .claude/agents/.
Observed (one session, 2026-08-23):
.claude/agents/in the worktree holds 11 agent files:agent_babysitter,analysis-bot,dragon,flashlight,placement-auditor,rescue-bot,rescue-sweep-bot,review-md-auditor,spartan,style-hygiene-auditor,targeted-reviewer,tdd-auditor.- The session-start registry contained only 6 of them:
dragon,flashlight,placement-auditor,rescue-bot,spartan,style-hygiene-auditor. Absent:tdd-auditor,review-md-auditor,targeted-reviewer,analysis-bot,rescue-sweep-bot. - Mid-session, the registry updated dynamically: a notification announced
analysis-botandrescue-sweep-botas newly available andrescue-botas removed. So hot-loading works for some files — yettdd-auditor,review-md-auditor, andtargeted-reviewernever appeared at any point in a session lasting many hours. - All the missing files are valid: they load fine in sessions rooted in the main checkout, and a
general-purposeagent instructed to read the definition file as its charter executes the same brief without problems (our standing fallback). - The rejects are silent — nothing indicates a file was skipped or why (same gap as #5099).
Expected: every valid .claude/agents/*.md in the project root of the session (worktree or not) registers as an agent type, or the skip is reported with a reason.
Why this isn't just #25816 reopened with the same words: #25816 framed it as worktree agents not being discovered at all. What we see repeatedly (multiple worktrees, multiple sessions, several weeks) is a partial load — always a subset, not the same subset across sessions — while dynamic mid-session updates prove the watcher sees the directory. That points at the initial scan (or a race in it) rather than path resolution.
Repro sketch:
- Repo with ~10 valid agent files in
.claude/agents/, checked in. git worktree add ../wt, start a Claude Code session in../wt.- Compare the available-agents listing against the directory contents.