Overview
A deep link is a claude-cli:// URL that opens Claude Code in a new terminal
window, optionally in a specific repository and with a prompt already typed. It
turns a runbook step, alert, or dashboard into a one-click starting point for a
task. The prompt is pre-filled but never sent until you press Enter.
Build a link
Every link starts with claude-cli://open and takes optional query parameters:
| Parameter |
Description |
q |
Prompt text to pre-fill. URL-encode it; use %0A for newlines. Max 5,000 chars. |
cwd |
Absolute working directory. Network and UNC paths are rejected. |
repo |
A GitHub owner/name slug resolved to a local clone you have used before. |
If both cwd and repo are present, cwd wins. Example:
claude-cli://open?repo=acme/payments&q=Investigate%20the%20failed%20deploy.%0ACheck%20recent%20commits%20to%20main.
Clicking it opens Claude Code in your local clone of acme/payments with the
decoded two-line prompt ready to edit and send.
Embed in a runbook
## High 5xx rate on web-gateway
1. Acknowledge the page.
2. [Open Claude Code in the gateway repo](claude-cli://open?repo=acme/web-gateway&q=5xx%20rate%20is%20elevated.%20Check%20recent%20deploys%20and%20error%20logs.)
3. Post findings in the incident channel.
Note: GitHub-rendered Markdown strips claude-cli://, so on GitHub put the link
in a code block for readers to copy. Use a wiki, dashboard, or chat tool that
allows custom URL schemes for true one-click behavior.
Trigger from the shell
# macOS
open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"
# Linux
xdg-open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"
On Windows, Start-Process "claude-cli://open?..." in PowerShell.
cwd vs repo
- Use
cwd when everyone has the project at the same absolute path (for example
a standardized devcontainer).
- Use
repo when each person clones to a different location; Claude Code opens
the matching clone you used most recently. It only finds clones where you have
run Claude Code at least once, and the link does not change the checked-out
branch.
Safety model
The launched session shows a Prompt from an external link warning until you
send or clear it. For prompts over 1,000 characters, the warning includes the
length and reminds you to scroll and review. Nothing runs until you press Enter,
and normal permission rules, CLAUDE.md, and trust prompts still apply.
Tip
Store long runbook prompts as a /skill in the repo so the link's q parameter
only has to name the skill.
Source