Skip to content

460 add agent skill flag - #463

Merged
SeanAlexanderHarris merged 10 commits into
mainfrom
460-add-agent-skill-flag
Jul 22, 2026
Merged

460 add agent skill flag#463
SeanAlexanderHarris merged 10 commits into
mainfrom
460-add-agent-skill-flag

Conversation

@SeanAlexanderHarris

@SeanAlexanderHarris SeanAlexanderHarris commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a global --skill flag so an AI agent/workflow invoking the CLI can identify itself, for observability into agentic CLI usage.
  • Supersedes the original plan (a dedicated X-Prolific-Agent-Skill header) with a skill/<value> token folded into the existing User-Agent header, alongside the agent/<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.
  • The composed User-Agent is sent on all requests through Client.Execute(). 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 tokens 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 the agentenv AI-agent detection it adds.

Closes #460

Test plan

  • go build ./...
  • go test ./... (excluding the pre-existing, unrelated contract_test.TestAPICoverage drift on this branch lineage)
  • golangci-lint run ./...
  • Manually verified with PROLIFIC_DEBUG=true: --skill cli-command-create study list sends User-Agent: prolific-oss/cli/<version> agent/claude-code skill/cli-command-create

🤖 Generated with Claude Code

@SeanAlexanderHarris
SeanAlexanderHarris requested review from a team as code owners July 17, 2026 00:59
@prolific-snyk

prolific-snyk commented Jul 17, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@SeanAlexanderHarris
SeanAlexanderHarris marked this pull request as draft July 17, 2026 01:05
@SeanAlexanderHarris
SeanAlexanderHarris force-pushed the 460-add-agent-skill-flag branch from d582f2e to dd74bd0 Compare July 17, 2026 01:18
Base automatically changed from 459-add-agent-use-detection to main July 20, 2026 16:15
@SeanAlexanderHarris SeanAlexanderHarris linked an issue Jul 21, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --skill persistent flag on the root command and store it on the API client instance.
  • Introduce agentenv detection + client.ComposeUserAgent(...), and update Client.Execute() to always send the composed User-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.

Comment thread client/client.go
Comment thread agentenv/agentenv.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread client/client.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread agentenv/agentenv.go
@SeanAlexanderHarris
SeanAlexanderHarris marked this pull request as ready for review July 22, 2026 16:59
cemprolific
cemprolific previously approved these changes Jul 22, 2026
SeanAlexanderHarris and others added 9 commits July 22, 2026 18:25
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
SeanAlexanderHarris merged commit 8cc3f86 into main Jul 22, 2026
6 checks passed
@SeanAlexanderHarris
SeanAlexanderHarris deleted the 460-add-agent-skill-flag branch July 22, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add agent --skill flag

6 participants