claude-code - 💡(How to fix) Fix Support OSC 8 hyperlink sequences for file paths and URLs in TUI output [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48652Fetched 2026-04-16 06:54:38
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3
  • Claude Code already outputs absolute paths (configurable in CLAUDE.md) specifically to enable terminal click-to-open
  • The PR status footer already has a clickable link — extending this to all paths/URLs would be consistent
  • Terminals that don't support OSC 8 simply ignore the sequences — zero visual impact on older terminals

Root Cause

  • Claude Code already outputs absolute paths (configurable in CLAUDE.md) specifically to enable terminal click-to-open
  • The PR status footer already has a clickable link — extending this to all paths/URLs would be consistent
  • Terminals that don't support OSC 8 simply ignore the sequences — zero visual impact on older terminals

Code Example

\e]8;;file:///Users/me/project/src/app.ts\e\\path/to/file.ts:42\e]8;;\e\\
\e]8;;https://github.com/org/repo/pull/1\e\\PR #1\e]8;;\e\\
RAW_BUFFERClick to expand / collapse

Problem

Claude Code outputs absolute file paths and URLs in its TUI, but they're not clickable. Modern terminals (Ghostty, iTerm2, WezTerm, Kitty) support OSC 8 hyperlink escape sequences — inline clickable links embedded directly in terminal output.

Since Claude Code's TUI captures all mouse events, the terminal's native URL detection (hover + Cmd/Ctrl) can't work. OSC 8 is the standard way TUI apps solve this — the terminal recognizes the escape sequence regardless of alternate screen buffer or mouse capture mode.

Expected behavior

File paths like /Users/me/project/src/app.ts:42 and URLs like https://github.com/org/repo/pull/1 in Claude Code output should be Cmd+clickable (macOS) / Ctrl+clickable (Linux) to open in the default editor or browser.

Proposed solution

Wrap file paths and URLs in OSC 8 sequences:

\e]8;;file:///Users/me/project/src/app.ts\e\\path/to/file.ts:42\e]8;;\e\\
\e]8;;https://github.com/org/repo/pull/1\e\\PR #1\e]8;;\e\\

This is already the approach used by tools like ls --hyperlink, gcc, and systemd for terminal-native link support.

Context

  • Claude Code already outputs absolute paths (configurable in CLAUDE.md) specifically to enable terminal click-to-open
  • The PR status footer already has a clickable link — extending this to all paths/URLs would be consistent
  • Terminals that don't support OSC 8 simply ignore the sequences — zero visual impact on older terminals

extent analysis

TL;DR

Wrap file paths and URLs in Claude Code's TUI output with OSC 8 hyperlink escape sequences to make them clickable.

Guidance

  • Identify all instances where Claude Code outputs absolute file paths and URLs in its TUI and apply the proposed OSC 8 wrapping solution.
  • Verify that the terminal supports OSC 8 hyperlink escape sequences, as this feature may not work on older terminals.
  • Test the wrapped file paths and URLs to ensure they are correctly formatted and clickable.
  • Consider extending this feature to all paths and URLs in the output for consistency, as it already works for the PR status footer.

Example

\e]8;;file:///Users/me/project/src/app.ts\e\\path/to/file.ts:42\e]8;;\e\\
\e]8;;https://github.com/org/repo/pull/1\e\\PR #1\e]8;;\e\\

This example demonstrates how to wrap a file path and a URL with OSC 8 sequences.

Notes

This solution assumes that the terminal used to run Claude Code supports OSC 8 hyperlink escape sequences. If the terminal does not support OSC 8, the sequences will be ignored, and there will be no visual impact.

Recommendation

Apply the workaround by wrapping file paths and URLs with OSC 8 sequences, as this is a standard approach used by other tools and provides a consistent user experience.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

File paths like /Users/me/project/src/app.ts:42 and URLs like https://github.com/org/repo/pull/1 in Claude Code output should be Cmd+clickable (macOS) / Ctrl+clickable (Linux) to open in the default editor or browser.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING