
Deep Links 把 runbook、告警和 CI 通知变成可点击的 Claude Code 启动入口。本篇拆解 claude-cli://open 的参数、repo 与 cwd 的取舍、prompt 预填的安全边界,以及团队落地时最容易踩的 GitHub 和 handler 注册问题。
claude-cli://open:它能解决什么、URL 怎么拼、cwd 和 repo 怎么选,以及为什么它适合放进 runbook、告警和内部 wiki。claude-cli:// URL。操作系统识别这个自定义协议后,会把链接交给 Claude Code 的本机 handler,Claude Code 再打开一个本地会话。官方把它定位为「从 URL 启动 Claude Code,并预填工作目录与 prompt」。1claude-cli://open| 参数 | 作用 | 适合什么时候用 |
|---|---|---|
q | 预填 prompt,需要 URL encode;多行 prompt 用 %0A;最大 5,000 字符。1 | runbook、告警、CI 通知里已经知道要问什么 |
cwd | 指定本机绝对路径作为工作目录;网络路径和 UNC 路径会被拒绝。1 | 团队有统一 devcontainer、VM 镜像或标准目录 |
repo | 指定 GitHub owner/name。Claude Code 会解析成本机见过的 clone。1 | 每个人 clone 路径不同,但仓库 slug 相同 |
claude-cli://open?repo=acme/payments&q=Investigate%20the%20failed%20deploy%20of%20payments-api.%0ACheck%20recent%20commits%20to%20main%20and%20the%20last%20successful%20build.acme/payments 仓库,并把两行诊断 prompt 填进输入框。1cwd 和 repo 都能设置工作目录;如果同时传入,cwd 优先,repo 会被忽略。即使 cwd 路径不存在,repo 也不会接管。1 团队模板里最好二选一,不要两个都塞。repo 不是远程 clone,它只是在本机找路径repo=owner/name 很像「让 Claude Code 打开 GitHub 仓库」,但它不会自动 clone,也不会切分支。claude,它会把这个本机路径记录到对应的 GitHub owner/name slug 下。之后 deep link 带着 repo 进来时,它会选择最近使用过的匹配路径。多个 clone 和 worktree 会分别记录。1claude。否则链接会退回 home 目录。1repo。cwd 看起来精确,但一换机器、一换用户名、一换 devcontainer 挂载路径就失效。repo 的失败方式更温和:找不到本地 clone 时会打开 home 目录,用户至少能看见 prompt,并知道自己少了本地准备。Prompt from an external link 警告;当 prompt 超过 1,000 字符时,警告还会显示字符数,并提醒你滚动查看全文。1CLAUDE.md 和工作目录 trust prompt 仍按普通会话生效。1Review the recent CI failure for service web-gateway.
Before changing files, summarize the failure, list likely causes, and ask for confirmation.
Check logs from the last 30 minutes and recent commits to main.claude-cli://claude-cli:// 这类自定义 URL scheme。你写 [Open Claude Code](claude-cli://...),GitHub 会只显示文字,背后的链接会被移除。1Copy this link into your browser address bar:
claude-cli://open?repo=acme/web-gateway&q=Investigate%20the%20high%205xx%20rate.open,Linux 桌面环境通常用 xdg-open,Windows PowerShell 用 Start-Process。1# 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"Start-Process "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"start "" "claude-cli://open?repo=acme/payments&q=review%20open%20PRs"investigate-service alias:它读取当前服务名和告警 ID,拼出 URL encode 后的 prompt,再打开 Claude Code。claude-cli:// handler,不需要额外运行 install 命令。1~/Applications/Claude Code URL Handler.app,Linux 写到 $XDG_DATA_HOME/applications 下的 desktop entry,Windows 写到 HKEY_CURRENT_USER\Software\Classes\claude-cli。1$TERMINAL,再看 x-terminal-emulator 和常见终端列表;Windows 优先 Windows Terminal,其次 PowerShell,再到 cmd.exe。1settings.json 里把 disableDeepLinkRegistration 设为 "disable";需要强制策略时,放到 managed settings。1claude-cli://。Claude Code 的 VS Code extension 注册的是 vscode://anthropic.claude-code/open,会打开编辑器 tab。1claude-cli://open:给终端用户,适合本地 shell、runbook、告警排障。vscode://anthropic.claude-code/open:给 IDE 用户,适合编辑器内工作流。claude-cli://open?repo=OWNER/REPO&q=Investigate%20the%20CI%20failure%20for%20JOB_NAME.%0AFirst%20summarize%20the%20failing%20step%20and%20likely%20cause.%0AThen%20inspect%20recent%20commits%20and%20ask%20before%20editing%20files.claude,让 repo 能解析到本机路径。1claude-cli:// 的平台;如果平台会过滤自定义 scheme,就用代码块暴露 URL。1docs.anthropic.com
This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.