Skip to content

Prototype agent session start in Shopify CLI#7584

Draft
dmerand wants to merge 1 commit into
mainfrom
donald/agent-session-poc
Draft

Prototype agent session start in Shopify CLI#7584
dmerand wants to merge 1 commit into
mainfrom
donald/agent-session-poc

Conversation

@dmerand
Copy link
Copy Markdown
Contributor

@dmerand dmerand commented May 19, 2026

What

Prototype CLI-owned agent session state.

This PR adds:

  • shopify agent session start
  • persisted agent session state in cli-kit
  • analytics attribution from persisted session state when explicit SHOPIFY_CLI_AGENT_* env vars are absent
  • prototype analytics opt-out through metricsMode=off
  • one downstream default-mode proof in app release

Why

ai-toolkit-source currently attributes agent-run Shopify CLI commands by prefixing each command with SHOPIFY_CLI_AGENT_INFO and SHOPIFY_CLI_AGENT_IDS. That works, but it is noisy, token-expensive, and harness-specific.

This prototype tests a different shape: start one agent session in Shopify CLI, persist it there, and let later CLI commands reuse that state for attribution and behavior.

app release is the default-mode proof because it already has an established non-interactive path through --allow-updates. Reusing that seam makes the prototype easier to evaluate: it shows that agent session state can affect later CLI behavior without inventing a new global --no-input contract or taking on a larger command surface like app init.

Behavior

  • shopify agent session start persists:
    • agent identity
    • session id
    • metrics mode
    • defaultNonInteractive
  • analytics synthesize packed SHOPIFY_CLI_AGENT_INFO / SHOPIFY_CLI_AGENT_IDS from persisted session state when explicit env vars are absent
  • metricsMode=off suppresses command analytics for this prototype path
  • when defaultNonInteractive=true and the user passed no explicit release-control flags, app release follows its existing non-interactive --allow-updates path

Boundaries

This PR does not:

  • migrate all deterministic ai-toolkit helpers into CLI
  • add a universal --no-input contract
  • redesign Monorail schema
  • generalize agent-mode behavior across all commands

The goal is to demonstrate the value of CLI-owned agent session state clearly.

Manual testing

Start a session and inspect the stored shape:

shopify agent session start \
  --agent river \
  --agent-version 1.0.0 \
  --provider openai \
  --metrics on \
  --json

Confirm later CLI analytics can pick up packed agent attribution without explicit SHOPIFY_CLI_AGENT_* env vars.

Then start a non-interactive session:

shopify agent session start \
  --agent river \
  --agent-version 1.0.0 \
  --provider openai \
  --metrics off \
  --default-non-interactive

Then verify:

shopify app release --version <version>

uses the prototype agent-mode path without requiring an explicit --allow-updates.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 19, 2026
@gonzaloriestra gonzaloriestra force-pushed the donald/agent-session-poc branch from 81ecf37 to 17c8c0a Compare May 20, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant