feat: accept --analytics-intent and --analytics-task-id on every command - #295
Merged
Conversation
3 tasks
--analytics-intent and --analytics-task-id on every command
angeloashmore
marked this pull request as ready for review
September 9, 2026 14:55
3 tasks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit acfdae7. Configure here.
angeloashmore
added this pull request to stack #298
September 10, 2026 12:51
lihbr
approved these changes
Sep 10, 2026
Agents pass these two options so analytics can group the commands that serve one user request. The options are always accepted. They appear in help output only when an agent is detected. The values are sent as userIntent and taskId on the "Prismic CLI Start" and "Prismic CLI End" events, and attached to Sentry. Every command is now tracked, including the ones that were previously excluded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
Replaces the mutable global options hook. Help output decides at render time whether to list the agent options. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
Agent detection is synchronous, so help builders stay synchronous and the agent options are plain config with a hidden flag, like the router's hidden commands. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
…mmand The eval wraps the CLI bin to record the argv of every call, so it checks the values the CLI receives rather than the shell text the agent wrote. It pins the Prismic skill to the commit that adds the rule. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
…ics-task-id The prefix says what the options are for. Without it, the names read as if they change behavior. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
The section tells agents to generate one UUID per request and pass it, with the request in one sentence, on every command. It appears only when an agent is detected. Help text without it scored 0 of 3 eval trials; with it and the skill rule, 3 of 3. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
Agents generated the UUID late or more than once. The section now says to generate it before the first command, never use a placeholder, and never generate a second one. The option descriptions name read-only commands too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
The pin moves to the merged skill commit in a later change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
The harness now records argv for every call, so the eval no longer needs its own bin wrapper. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
sync runs until SIGINT and tracks itself with watch: true, so the entrypoint must not emit a second start event for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
The router parsed only --help, so a string-valued analytics option with no subcommand turned its value into a positional and the router rejected it as an unknown command. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
angeloashmore
force-pushed
the
claude/cli-intent-task-id-i1wobt
branch
from
September 10, 2026 14:04
3590dda to
4911d12
Compare
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.

Resolves:
Description
This PR adds the following options to all commands:
--analytics-intent--analytics-task-idThese options allow an agent to provide context around the CLI call. We know when specific commands are called, but we don't why why they are called. Knowing the intent behind a command or set of commands helps us understand where to focus efforts.
These options are only exposed when an agent uses the CLI. Help text is hidden from humans, but the options are always accepted. We expect only agents to provide these options.
Companion change in the skill: prismicio/skills#9
Checklist
Preview
How to QA 1
prismic --help. No AGENTS section and no analytics options.AI_AGENT=test prismic --help. Both appear.--analytics-intent "..." --analytics-task-id <uuid>. It succeeds, and the Amplitude event carriesuserIntentandtaskId.🤖 Generated with Claude Code
https://claude.ai/code/session_015pufvNWHTyTcd38NnNPyPK
Note
Low Risk
Analytics-only optional flags with broader command tracking for formerly untracked commands; no change to CLI command semantics.
Overview
Adds agent-only analytics flags
--analytics-intentand--analytics-task-idon every CLI entry point (root parse, command router, and leaf commands). Values are forwarded into Segment (Prismic CLI Start/End) and Sentry (tags/context) so multi-command agent workflows can be grouped by task; the flags do not change command behavior.When
detectAgent()finds an agent environment, help surfaces the options plus an AGENTS section with UUID/intent usage guidance; options stay accepted but hidden for non-agent runs.detectAgentis now synchronous (existsSyncfor Devin).Telemetry tracking at startup no longer skips
login,logout,whoami,docs, andstatus—onlysyncis excluded at the top level because it self-tracks withwatch: true. Tests and an eval assert agents reuse one UUID and one intent across all commands in a task.Reviewed by Cursor Bugbot for commit 4911d12. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩