Narrow claude-team find_subagent_jsonl scan to team session dir#121
Merged
Conversation
Look up the team config containing the named member, read its
leadSessionId, and glob only ~/.claude/projects/*/{leadSessionId}/subagents/
instead of every project's subagents directory. Empirically narrows the
haystack from 4816 files to 9 on this machine (~535x reduction).
Falls back to the original broad scan when no team config is found, no
leadSessionId is set, or the narrowed scan returns nothing — defensive
against unexpected layouts. A stderr warning fires in the fallback case so
the slowdown is observable.
…n, optional test skipped with rationale
Mark the docstring as a raw string (r"""...""") so the literal
backslash-backtick in the example heading no longer triggers:
SyntaxWarning: "\`" is an invalid escape sequence.
No behavior change.
…mpirical narrowing 4863→9-16 files, SyntaxWarning fix scoped correctly Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
clkao
added a commit
that referenced
this pull request
Apr 18, 2026
clkao
added a commit
that referenced
this pull request
Apr 18, 2026
…ntity remained at validation; idle-hook catch)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Narrow
claude-team's subagent JSONL scan from a global~/.claude/projectsglob to the team's own session directory, collapsing ~4800-file lookups to ~10-20.What changed
_narrowed_subagent_patternshelper and tries narrowed lookup first infind_subagent_jsonlSyntaxWarningonextract_stage_subsection's docstring via raw-string prefixEvidence
4816→9 claimSyntaxWarningabsent on worktree binary, present on main binary — fix scoped correctly#184