460 add agent skill flag - #463
Merged
Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Closed
SeanAlexanderHarris
marked this pull request as draft
July 17, 2026 01:05
SeanAlexanderHarris
force-pushed
the
460-add-agent-skill-flag
branch
from
July 17, 2026 01:18
d582f2e to
dd74bd0
Compare
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for identifying AI-driven CLI invocations (including the specific “skill/workflow”) by folding agent/<value> and skill/<value> tokens into the User-Agent header emitted by the CLI’s HTTP client.
Changes:
- Register a global
--skillpersistent flag on the root command and store it on the API client instance. - Introduce
agentenvdetection +client.ComposeUserAgent(...), and updateClient.Execute()to always send the composedUser-Agent. - Add/adjust tests and changelog/contract-test tracking for newly surfaced API operations.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contract_test/contract_test.go | Updates operation coverage list (adds AI task builder batch sync ops; removes cost ops no longer present). |
| cmd/root.go | Registers global --skill persistent flag wired into the shared client.Client. |
| cmd/root_test.go | Adds a test ensuring --skill is registered with an empty default. |
| cmd/aitaskbuilder/get_dataset_status_test.go | Small refactor in mock client setup helper. |
| client/client.go | Adds Skill field, introduces composed User-Agent, and sets it in Execute(). |
| client/client_test.go | Adds tests for ComposeUserAgent and validates Execute() sets User-Agent correctly. |
| CHANGELOG.md | Adds a ## next entry documenting the new --skill flag behavior. |
| agentenv/agentenv.go | Adds environment-variable based agent detection and header-safe token validation. |
| agentenv/agentenv_test.go | Tests agent detection precedence and header token validation. |
SeanAlexanderHarris
marked this pull request as ready for review
July 22, 2026 16:59
cemprolific
previously approved these changes
Jul 22, 2026
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Dataset upload and collection/batch export downloads hit presigned S3-style URLs directly, bypassing Client.Execute and Prolific's own request tracing, so the skill/agent User-Agent tokens sent there were never observable. Remove that plumbing and keep the tokens exclusively on the Execute path, where they're actually attributed. UserAgent() is no longer needed on the API interface as a result; regenerate the mock.
…tion Tighten ValidHeaderValue's doc comment to describe the actual byte-level check (ASCII control chars, DEL, space) instead of the broader "whitespace" claim. Cache the composed version prefix in ComposeUserAgent via sync.OnceValue so it's resolved once per process instead of on every request, avoiding a repeated debug.ReadBuildInfo() call in dev builds. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
SeanAlexanderHarris
force-pushed
the
460-add-agent-skill-flag
branch
from
July 22, 2026 20:22
372d481 to
4fd3058
Compare
SeanAlexanderHarris
enabled auto-merge (rebase)
July 22, 2026 20:24
dessskris
approved these changes
Jul 22, 2026
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.
Summary
--skillflag so an AI agent/workflow invoking the CLI can identify itself, for observability into agentic CLI usage.X-Prolific-Agent-Skillheader) with askill/<value>token folded into the existingUser-Agentheader, alongside theagent/<value>token from Add ai detection to include the agent or model using the cli Closes #459 #462 — avoids relying on a custom header that's likely scrubbed by the backend.User-Agentis sent on all requests throughClient.Execute(). Dataset upload and collection/batch export downloads hit presigned S3-style URLs directly (bypassingClient.Execute()and Prolific's own request tracing), so theskill/agenttokens are deliberately not sent there — Prolific's backend never observes those requests, so there's nothing to attribute.Stacked on #462 (
459-add-agent-use-detection) since this builds directly on theagentenvAI-agent detection it adds.Closes #460
Test plan
go build ./...go test ./...(excluding the pre-existing, unrelatedcontract_test.TestAPICoveragedrift on this branch lineage)golangci-lint run ./...PROLIFIC_DEBUG=true:--skill cli-command-create study listsendsUser-Agent: prolific-oss/cli/<version> agent/claude-code skill/cli-command-create🤖 Generated with Claude Code