feat: accept --analytics-intent and --analytics-task-id on every command - #295
feat: accept --analytics-intent and --analytics-task-id on every command#295angeloashmore wants to merge 11 commits into
--analytics-intent and --analytics-task-id on every command#295Conversation
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
--analytics-intent and --analytics-task-id on every command
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
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.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e37c813. Configure here.
| } | ||
|
|
||
| const isTracked = !help && command && !UNTRACKED_COMMANDS.includes(command); | ||
| const isTracked = !help && command; |
There was a problem hiding this comment.
Sync command emits duplicate start events
Medium Severity
Removing UNTRACKED_COMMANDS makes index emit Prismic CLI Start for sync, but sync already calls trackCommandStart with watch: true. Amplitude now gets two starts for one watch session, and the first event lacks watch.
Reviewed by Cursor Bugbot for commit e37c813. Configure here.
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


Resolves:
Description
Analytics see each CLI command as an isolated event. When an agent runs ten commands to serve one user request, nothing ties them together.
Now every command accepts
--analytics-intentand--analytics-task-id. Agents pass the same values on every command for one request. The values reach Amplitude asuserIntentandtaskId, the same properties the MCP server sends, so both surfaces can be analyzed together. Sentry gets them too.Humans never see the options. They appear in help output only when an agent is detected, along with an AGENTS section on the router help pages that explains how to use them. All commands are now tracked, including the ones that were previously excluded.
An eval checks that agents pass one UUID and one intent across every command of a task. With the skill rule alone it passed 2 of 10 trials. With the AGENTS section as well it passed 10 of 10.
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
Medium Risk
Expands telemetry to previously untracked commands (login, docs, etc.) and adds new global CLI flags; behavior is unchanged unless flags are passed, but analytics volume and event content change.
Overview
Adds
--analytics-intentand--analytics-task-idon every CLI command so agents can tie multiple invocations to one user request. Values are analytics-only (parsed at the root inindex.ts) and are sent to Segment asuserIntent/taskIdand to Sentry as tags/context, aligned with the MCP server.When an agent is detected (
detectAgent()), help shows those options plus an AGENTS section on router/command help explaining UUID + intent usage; humans do not see them (hiddenoptions). All commands are now telemetry-tracked—the previousUNTRACKED_COMMANDSallowlist is removed.Eval harness no longer infers CLI usage from shell strings: the project
prismicshim logs argv to JSONL andtoHaveRunmatches positional args onresult.calls. A newgroup-commands-by-taskeval asserts one shared task UUID and intent across every command in a multi-step task.Reviewed by Cursor Bugbot for commit 6e540ac. 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. ↩