Skip to content

Open in AI

A prompt someone hands to their coding agent. The first lines show, the rest folds away; Copy prompt copies it and Open in starts a new chat in Claude, ChatGPT or Cursor with it filled in. Give it a second prompt with a key in it and it offers Safe or Include my key, while the links always stay safe.

On this page
Used for
  • Set up with AI
  • A docs page as a prompt
  • An install guide
  • An onboarding step
  • A support answer

Examples

Fold after

Your own apps

Installation

npx knowns-ui@latest add open-in-ai
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

The Claude and OpenAI marks come from the Knowns UI icon set and are trademarks of their owners, shown only to name the app a button opens. There is no Cursor mark in the set, so Cursor gets a plain pointer.

Props

promptrequired
string
The prompt. Open in always sends this one.
securePrompt
string
The same prompt with a key in it. Adds Safe / Include my key; only Copy uses it.
secret
string
The key inside securePrompt, masked to its last 4 characters in the preview.
providers
OpenInProvider[]
DefaultClaude, ChatGPT, Cursor
Each { id, label, href(text), home, icon }. openInPresets() returns the built-in ones; [] hides Open in.
foldLines
number
Default6
Lines shown before Show all.
maxUrl
number
Default6000
Longest link handed out. Longer: Open in copies, then opens the app's new chat.
onCopy
(which: "safe" | "secret") => void
After a copy. Show a toast here.
onOpen
(id, how: "link" | "copy") => void
After an Open in press, and whether it went as a link or copy-then-open.
label
string
Default"Prompt"
The accessible name of the preview.
copy
{ safe?, secret?, safeNote?, secretNote?, copy?, copied?, openIn?, footer? }
Your words.
copyButtonProps
Record<`data-${string}`, string>
data-* attributes on the Copy prompt button, such as an analytics hook.
className
string
Classes for the outer column.

What it handles

  1. 01Shows the first six lines of the prompt with the rest folded behind Show all, so a long prompt never takes half the screen.
  2. 02Copy prompt confirms in place for a moment and tells your app through onCopy, where you can show a toast.
  3. 03Open in starts a new chat in Claude, ChatGPT or Cursor with the prompt filled in. Pass your own providers, or none.
  4. 04With securePrompt it offers Safe or Include my key. Copy uses the choice; the Open in links always carry the safe prompt, because a link ends up in history and on the chat app's servers.
  5. 05Masks the secret in the preview down to its last four characters, so a screen share never shows the key.
  6. 06A prompt too long for a link (over 6,000 characters) is copied first, then the app opens on a new chat, with a note to paste.

States

First render
Nothing moves: the prompt shows folded
none
Show all
The rest of the prompt unfolds and the chevron turns
200ms, ease out
Copy prompt
The label changes to Copied with a check, then back after 1.5s
120ms, ease out
Include my key
The thumb slides, the note turns amber and the preview frame gets an amber ring
120ms, ease in-out
Reduced motion
The fold and the label change at once
0ms

Works with

When to use

When to use

  • Handing a setup or install prompt to someone's coding agent, with Copy and a one-click new chat.
  • Turning a docs page or a support answer into a prompt the reader can run, with the key kept out of links.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Open in AI to my app and wire it to my own data.
  • I need handing a setup or install prompt to someone's coding agent, with Copy and a one-click new chat. Set that up with the Knowns UI Open in AI.
  • Which Open in AI props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "open-in-ai" }) and search_docs({ query: "open in ai" }).

Need help?

Stuck on Open in AI, or found something off? We read every message.