check-apm-agents-valid.sh filtered find output with `-not -path '*/.claude/worktrees/*'`, matched against absolute paths. When the checkout itself lives at <repo>/.claude/worktrees/<name>/, every path contains that segment, so every agent file was excluded and the gate reported "N of N tracked agent files were not discovered". The walk starts at $REPO_ROOT/plugins, so a nested worktree is unreachable and the filter is dropped. The test suite gains a case that runs the gate from a fixture under .claude/worktrees/, and now unsets inherited GIT_* variables so its git fixtures never resolve to the caller's repository. Fixes #199 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi