Skip to content

Keep unclaimed apps' claim links out of agent transcripts #580

Open

Description

@shane-kercheval

With #577, the CLI's not-linked advice tells an AI agent to run clerk open for an unclaimed app, an app no Clerk account owns yet. In agent mode, clerk open prints the app's claim link, so the link lands in the agent's transcript. Anyone who opens that link while signed in to the Clerk Dashboard can claim the app. The advice should have a person run clerk open in their own terminal instead, which opens the claim page in their browser.

Example. A Next.js project that ran next dev without keys gets an unclaimed app from Clerk's SDK. An agent runs clerk deploy, which stops because the folder isn't linked to a Clerk app. The error says "Run clerk open to print its claim link for a person to claim the app", and lists clerk open first in its examples, the commands the agent should run next. In agent mode, which is the CLI's output mode when no terminal is attached, clerk open prints JSON whose url field is the claim link.

Risk. A reader of the transcript could claim the app first and control its settings and users. The app is a development instance created moments earlier, and the folder's secret key already grants Backend API access to it. So the exposure is ownership of a throwaway development app, not production data.

Proposed change

Commits 4358199 and af8c910 on #577's branch implement it, and were reverted there to keep #577's scope. To restore them, run git cherry-pick 4358199f6 af8c9106e. They make three changes:

  • The agent's advice says a person runs clerk open in their own terminal, in the project folder the message names. The folder matters because clerk open reads the claim link from the folder it runs in.
  • clerk open never appears in an agent's examples.
  • clerk open <subpath> on an unclaimed app gives the folder's own next step, instead of "Run clerk open (no subpath) to claim it".

What a person sees at a terminal stays the same.

Open question: should clerk open stop printing the link in agent mode?

The proposed change still leaves one path: an agent that runs clerk open on its own prints the link. Closing it has two constraints:

  • commands/open/README.md documents a url field in agent-mode output, so removing it breaks that output.
  • Agent mode means "no terminal attached", not "an agent is running". A person piping clerk open --print is in agent mode, so --print must keep printing.

Options, none chosen:

  • Keep clerk open as it is, and rely on the advice and the Clerk skills.
  • Leave out url in agent mode unless --print is passed.
  • Open the claim page in a browser on that machine, as clerk auth login does, and leave out url.

Related

Drafted by Claude, reviewed by Shane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions