OmniscioGuidesClaude Code deep links
Claude Code deep links: open a session from a URL
A deep link is how a runbook, an alert or a dashboard hands someone a prepared Claude Code session: one click opens the right repository with the investigation prompt typed out, and the person decides whether to send it.
This page covers what a deep link is and is not, how to build one from its three parameters, where to put it, what the person clicking it sees, which terminal opens on each platform, how to disable it, and the four fixes for the usual failures.
Last checked against Anthropic's Claude Code documentation on November 21, 2026. By the Omniscio team. Updated .
What a deep link is
Anthropic defines a deep link as a claude-cli:// URL that opens Claude Code in a new terminal window. The URL can carry a working directory and a prompt to pre-fill.
The claude-cli:// prefix is a custom URL scheme Claude Code registers with your operating system, the same mechanism that makes mailto: open your email client. When you click a link, the browser or app hands the URL to the operating system, the operating system starts Claude Code, and a new terminal window opens in the directory the link named with the prompt text already in the input box.
The link can be hosted anywhere, but the session always opens on the computer where the person clicked it. A link in a shared wiki opens that reader's own clone, on their own machine, under their own account.
Because a deep link is a URL, it goes anywhere a link goes. Anthropic's four examples are an incident runbook step that opens the affected service's repository with a diagnostic prompt, a monitoring alert or dashboard that links to an investigation prompt for one metric, a README or wiki page that opens the project with an onboarding prompt, and a CI failure notification that pre-fills the failing job's name.
Sources: the introduction and "How deep links work" in Launch sessions from links, read November 21, 2026.
Build a link
Every deep link starts with claude-cli://open, followed by optional query parameters. The bare form opens Claude Code in your home directory with an empty prompt:
claude-cli://openThree parameters shape the session:
qis the text pre-filled in the prompt box. URL-encode it, use%0Afor line breaks, and keep it to 5,000 characters or fewer.cwdis an absolute path to use as the working directory. Network and UNC paths are rejected, and so are paths with..segments or invisible or bidirectional control characters.repois a GitHubowner/nameslug. Claude Code resolves it to a local clone it has seen before and starts there; with no matching clone, the session opens in your home directory instead.
A link from Anthropic's page, with the placeholder repository replaced, looks like this. The encoded %0A is the line break between the two sentences:
claude-cli://open?repo=acme/payments&q=Investigate%20the%20failed%20deploy%20of%20payments-api.%0ACheck%20recent%20commits%20to%20main%20and%20the%20last%20successful%20build.Clicking it opens a new terminal window, starts Claude Code in the local clone of that repository, and fills the prompt box with the decoded text, which you can edit before sending.
Source: "Build a link" in Launch sessions from links, read November 21, 2026.
Choose between cwd and repo
The two directory parameters suit different audiences. Use cwd when everyone who clicks has the project at the same absolute path, such as a standardized dev container or VM image. Use repo when the link is shared and each person clones to a different place.
A repo link resolves to the clone or worktree where you most recently ran claude. Each time you run Claude Code in a Git repository it records that directory against the repository's GitHub slug, and it tracks clones and worktrees separately.
- The link does not change which branch is checked out. The session opens in whatever state that directory is in.
- The welcome header shows the path it picked, so the person clicking can confirm the right clone opened.
- If you pass both
cwdandrepo,cwdwins andrepois ignored, even when thecwdpath does not exist.
Source: "Choose between cwd and repo" in Launch sessions from links, read November 21, 2026.
Put one in a runbook
A deep link in a runbook gives whoever is triaging a one-click way to start investigating in the right repository with a prepared prompt. The prompt is part of the URL, so it has to be encoded: any URL-encoder page will do it, and the function behind those pages is encodeURIComponent.
Anthropic's example adds an investigation entry point to a runbook for a service:
## High 5xx rate on web-gateway
1. Acknowledge the page in PagerDuty.
2. [Open Claude Code in the gateway repo](claude-cli://open?repo=acme/web-gateway&q=5xx%20rate%20is%20elevated%20on%20web-gateway.%20Check%20recent%20deploys%2C%20error%20logs%20from%20the%20last%2030%20minutes%2C%20and%20open%20incidents%20in%20Linear.)
3. Post initial findings in #incident.Two conditions have to hold before engineers get a working step 2: their machine has the handler registered, and they have run claude in their local clone or worktree at least once.
One platform refuses the link outright. GitHub renders READMEs, issues, pull requests and wikis with a renderer that only allows http and https links, so [label](claude-cli://...) shows the label with the URL removed. On those pages, put the deep link in a code block so readers can see it and paste it into the address bar.
Sources: "Embed a link in a runbook" and "The link renders as plain text instead of being clickable" in Launch sessions from links, read November 21, 2026.
Open one from the shell
A script, alias or automation can open a deep link by calling the operating system's URL opener with the link as the argument. Every command below relies on the handler Claude Code registers on that machine.
macOS. The built-in open command passes the URL to the registered handler.
open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"Linux. Most desktop environments provide xdg-open.
xdg-open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"Windows. In PowerShell, Start-Process passes the URL through:
Start-Process "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"In cmd.exe, start treats its first quoted argument as a window title, so pass an empty title before the URL:
start "" "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"On success a new terminal window opens with Claude Code running and the prompt pre-filled, exactly as if it had been clicked.
Source: "Open a link from the shell" in Launch sessions from links, read November 21, 2026.
What happens when someone clicks
A deep link never executes anything on its own. It chooses a directory and fills the prompt box. A link from a page you do not trust is still inert: nothing reaches the model until you read what was filled in and press Enter.
While the prompt is unsent, a warning line below the input box reads Prompt from an external link and stays there until you send or clear the prompt. For prompts over 1,000 characters the warning adds the character count and tells you to scroll and review the full text, because a long prompt can push instructions off screen.
Everything else behaves like a session you started yourself. Permission rules, CLAUDE.md and the trust prompts for the selected directory apply in the same way.
Source: "What a launched session shows" in Launch sessions from links, read November 21, 2026.
Registration and which terminal opens
Claude Code registers the handler on macOS, Linux and Windows in either of two cases: you send anything to an interactive claude session, even /help; or you start Claude Code in agent view, such as with claude agents, in a folder you have trusted. Starting a session and sending nothing does not register it, and there is no separate install command.
Registration writes to user-level locations only:
- macOS:
~/Applications/Claude Code URL Handler.app - Linux:
claude-code-url-handler.desktopunder$XDG_DATA_HOME/applications, which defaults to~/.local/share/applications - Windows:
HKEY_CURRENT_USER\Software\Classes\claude-cli
The handler launches Claude Code in a detected terminal emulator. On macOS, Claude Code reuses the terminal from your most recent interactive session, and supports iTerm2, Ghostty, kitty, Alacritty, WezTerm and Terminal.app. On Linux it honors $TERMINAL, then x-terminal-emulator, then a list of common emulators. On Windows it prefers Windows Terminal, then PowerShell, then cmd.exe.
Two neighbouring surfaces have their own links: the VS Code extension registers vscode://anthropic.claude-code/open, which opens an editor tab rather than a terminal, and Claude Desktop handles its own claude:// links. If your team keeps a repository open in an editor all day, the terminal link is the one to leave out of a runbook.
Sources: "Registration and supported platforms" and the two sections after it in Launch sessions from links, read November 21, 2026.
Turn it off
To prevent registration entirely, set disableDeepLinkRegistration to "disable" in settings.json. To enforce it across an organization so users cannot re-enable it, set the same key in managed settings instead.
The setting covers claude-cli:// links only. A team that disables it can still use the VS Code vscode:// link, because that handler belongs to the extension.
Source: "Registration and supported platforms" in Launch sessions from links, read November 21, 2026.
When the link does nothing
Four failures cover most of it, and each has its own cause:
- The click does nothing. The handler is not registered on that machine. Start an interactive session, send any prompt, exit, and try again. On Linux without a desktop environment,
xdg-openmay have nothing to dispatch to. xdg-openis not found. The command is part of thexdg-utilspackage, which minimal server images, containers and WSL distributions often leave out. Install it with your package manager, for examplesudo apt install xdg-utils.- The link is plain text. The page renders Markdown that allows only
httpandhttps, which is what GitHub does with READMEs, issues, pull requests and wikis. Move the link into a code block. - The session opens in the home directory.
repoonly resolves to clones Claude Code has already seen. Runclaudein the clone once, or switch the link tocwdwith an absolute path.
One more is a preference rather than a fault: the wrong terminal opens. On macOS, start claude in your preferred terminal once and the next link uses it; on Linux, set $TERMINAL; on Windows the order is fixed, so install Windows Terminal if you want links to open there.
If the prompt arrives but the session cannot do the work, the cause is usually the session's own setup rather than the link: the permission mode decides what it may do without asking, and tmux is what keeps a terminal session alive after the window closes.
Source: "Troubleshooting" in Launch sessions from links, read November 21, 2026.
Where these answers come from
- Everything on this page: Launch sessions from links, read November 21, 2026.
No deep link was clicked from this site's machine to check the page: that needs a desktop session with the handler registered, and every claim here is quoted from Anthropic's documentation instead.
Common questions
Does a deep link cost anything to send?
Nothing is sent until you press Enter, so a link nobody sends costs nothing. Once sent, it is an ordinary turn on whatever plan and model the session uses.
Can a link start a session with no terminal window?
No. A deep link always opens a terminal window, because it registers as a URL handler that launches Claude Code interactively. For a run with no window, Anthropic documents non-interactive mode with -p instead.
Why is my prompt cut short?
The q parameter is capped at 5,000 characters. Past that, Anthropic's advice is to store the long runbook as a skill in the repository, so the link's prompt only has to name it.
Does the link work on a machine that has never run Claude Code?
Not until someone sends one interactive message there. That first message is what writes the handler, so a freshly imaged laptop needs one manual session before links work.