[BUG] /team-onboarding scans only the current workspace's transcripts, not the user's full Claude Code usage
What's Wrong?
/team-onboarding generates a teammate ramp-up guide from usage stats (top slash commands, MCP servers, work-type breakdown, session count). The system prompt describes the data source as "the guide creator's local Claude Code transcripts" and presents the output as a personal usage summary (Based on [name]'s usage over the last N days, with generatedBy populated from git config user.name).
In practice, the command scans only ~/.claude/projects/<current-cwd-encoded>/ — i.e. the .jsonl transcripts belonging to the directory Claude was launched from. Sessions opened in any sibling workspace (worktrees, other repos, $HOME, /tmp, …) are invisible to the scan, even though they're on the same machine under the same user and live in adjacent folders under ~/.claude/projects/.
This makes the output directory-scoped, not user-scoped, which:
- Contradicts the prompt's framing ("the creator's local Claude Code transcripts" /
generatedBy= git user name). - Produces dramatically different reports depending on which directory the command is launched from — same user, same 30-day window, totally different numbers, commands, MCP servers, and repo lists.
- Under-counts the creator's actual usage whenever their real work is split across worktrees or sibling repos, which is the normal case on any multi-repo team (exactly the audience
/team-onboardingis built for). - Over-represents whichever directory the user happened to cd into, including transient ones like
$HOMEor/tmpwhere smoke tests accumulate.
What Should Happen?
/team-onboarding should aggregate transcripts across all of ~/.claude/projects/*/*.jsonl for the configured window, so the stats reflect the user's full Claude Code usage — matching both the prompt's wording and users' natural expectation for a "summary of how I use Claude Code."
If directory-scoped scanning is deliberate, it should at minimum be documented and ideally exposed as an opt-in flag (e.g. /team-onboarding --scope=workspace|user), with user as the default since that's what the prompt and output framing describe.
Steps to Reproduce
Reproduced with claude 2.1.104 on macOS (Darwin arm64). Same user, same 30-day window, three separate runs from different directories — one from $HOME, one from /tmp, one from a real project directory (~/code/project-a):
| | Run A ($HOME) | Run B (/tmp) | Run C (~/code/project-a) |
|---|---|---|---|
| sessionCount | ~50 | 0 | ~60 |
| Top slash command | /clear (high) | (none) | /usage (highest) |
| #2 slash command | /plugin | — | /clear |
| Top MCP server | server-x (few calls) | — | server-y (many calls) |
| Work-type breakdown | Plan-heavy | all TODO | Balanced across Plan / Build / Debug / Quality / Docs |
| Codebases detected | unrelated side projects | tmp | actual work repos (project-a + siblings) |
| Team name inferred | generic guess | (blank) | accurate inference |
Three runs, one user, one machine, one 30-day window — three incompatible "personal usage" summaries. Run B from /tmp returned zero sessions despite dozens of real sessions that day in other directories.
Steps:
- Use Claude Code regularly in
~/code/repo-aand~/code/repo-bover a few weeks. cd ~ && claude --print "/team-onboarding"→ one set of numbers.cd ~/code/repo-a && claude --print "/team-onboarding"→ a completely different set.cd /tmp && claude --print "/team-onboarding"→ empty /_TODOreport.- None of the three reflects the user's actual total usage across repos.
Root cause (from the shipped binary)
In the minified bundle, the scanner is called with a path derived from cwd:
// _L5(H): resolve usage data for /team-onboarding
let _ = H8(); // _ = cwd
let q = hWH(_); // q = ~/.claude/projects/<sanitized-cwd>/
let K = await xx7(q, H); // scan .jsonl files in that ONE directory
// xx7(H, _): the scanner
let O = await BxH.readdir(H); // readdir(ONE directory)
for (let T of O) {
if (ut_.extname(T) !== ".jsonl") continue;
// ...accumulate slashCommandCounts / mcpServerCounts / sessionDescriptors
}
There is no code path that iterates sibling project directories under ~/.claude/projects/. The scanner is strictly scoped to the cwd-encoded project folder. (Found by grepping strings in the claude binary for sessionDescriptors, generatedBy, currentRepo, windowDays.)
Meanwhile the prompt the model receives (same bundle, qL5 / guide template, and agent-prompt-onboarding-guide-generator.md) describes the data as "the guide creator's local Claude Code transcripts" and instructs the model to report it as "Based on [name]'s usage over the last N days" with generatedBy = git config user.name. The prompt is written for a user-level scan; the collector performs a workspace-level scan. Prompt and implementation disagree.
Suggested fix
Change _L5 to walk every project directory under ~/.claude/projects/, merge their counts, and still record currentRepo from cwd for the "Codebases" section. Concretely, something like:
let projectsRoot = path.join(homedir(), ".claude", "projects");
let dirs = await fs.readdir(projectsRoot);
let merged = { slashCommandCounts: new Map(), mcpServerCounts: new Map(), sessionDescriptors: [], sessionFileCount: 0 };
for (let d of dirs) {
let partial = await xx7(path.join(projectsRoot, d), windowDays);
// merge partial into merged
}
Optionally gate via /team-onboarding --scope=user|workspace with user as default.
Additional Information
- The discrepancy is extra painful because
/team-onboardingis explicitly designed for teams that work across multiple repos — exactly the users whose real usage is scattered across many~/.claude/projects/*/folders. - There is already an open docs issue (#46384) pointing out
/team-onboardingis undocumented; that probably hid this behavior from earlier users. generatedBycoming fromgit config user.name(a user-level identifier) plus the template's "[name]'s usage" phrasing strongly indicates the intended design is user-scoped, making this a regression-from-intent rather than a deliberate design choice.
Version: 2.1.104 (Claude Code)
Platform: Anthropic API
OS: macOS (Darwin arm64)
Terminal: iTerm2
Regression? Command was only added in v2.1.101, so no prior version to compare against.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗