Feature Request: Record (custom) slash command usage as telemetry events
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 7 comments · opened Sep 2, 2025 · closed Jan 20, 2026
As an organization, we would like to see what slash commands are providing the most value to our developers, e.g. to determine ROI based on automation of mechanical tasks.
We've implemented OpenTelemetry monitoring based off https://docs.anthropic.com/en/docs/claude-code/monitoring-usage, however it seems that no telemetry event is emitted when a slash command is invoked. One thought is maybe claude_code.user_prompt event would be emitted with the prompt contents starting with the /[command] text (when OTEL_LOG_USER_PROMPTS is enabled), however this is also not the case.
It would be great if there was an event tracking slash command usage. I think the key attributes would be:
- the slash command name
- the scope of the command (project vs. personal). Ideally with some way to determine what the project was as well? (but maybe that's a separate feature request).
- Maybe also the arguments to the slash command (but only with
OTEL_LOG_USER_PROMPTSenabled?)
7 Comments
+1, this is a great feature request.
Like you, I noticed that slash commands don't trigger the
claude_code.user_promptevent, even withOTEL_LOG_USER_PROMPTSenabled. It seems like the telemetry hook for prompts only fires on natural language inputs, not commands.As a potential workaround until there's official support, you might be able to use Claude Code Hooks.
The documentation mentions a
UserPromptSubmithook that runs before Claude processes any user input. This hook receives a JSON object on stdin containing the full prompt text.You could write a simple script that:
UserPromptSubmithook.promptstring./../.claude/commands/(project) vs.~/.claude/commands/(personal).It's definitely more work than having a built-in event, but it might get you the data you need in the meantime. You can find the details in the Hooks Guide documentation.
Still, hoping the team considers adding a dedicated
claude_code.slash_command.invokedevent with these attributes built-inHi team. Is there any update on this request?
Our org is running into the same scenario. We were using hooks but decided to move to otel to leverage the built-in functionalities instead of maintaining hooks.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still a useful feature request to have built-in, without needing to create custom hooks and telemetry uploading functionality
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.