Skip to content

[FEATURE] OSC 8 Hyperlinks for Clickable File Paths #13008

@vwieczorek

Description

@vwieczorek

Problem Statement

When Claude Code outputs file paths like /Users/user/project/src/foo.ts:42, they are not clickable in terminals that support hyperlinks (Kitty, iTerm2, WezTerm, Windows Terminal).

This happens because:

  1. Paths are output as plain text without the file:// scheme
  2. ANSI color codes wrapped around paths break terminal pattern matching
  3. The path:line format isn't recognized as a clickable URL

Users must manually copy paths or use terminal-specific workarounds (like Kitty's hints kitten) to navigate to files.

Proposed Solution

Emit file paths using the OSC 8 hyperlink escape sequence, which is the terminal standard for embedded hyperlinks:

\033]8;;file:///absolute/path/to/file.ts\033\\file.ts:42\033]8;;\033\\

This makes paths clickable with a single click (or Cmd/Ctrl+click depending on terminal config). Many modern CLI tools already do this (ls, exa/eza, fd, bat).

Reference: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

Alternative Solutions

  • Workaround I currently use: Kitty's hints kitten (Cmd+Shift+F to select paths) - works but requires extra keystrokes
  • file:// prefix only: Would partially help but less robust than OSC 8
  • Opt-in config: Could be a setting if terminal compatibility is a concern

Use Case Example

  1. I ask Claude Code to find a bug in my project
  2. Claude outputs: "The issue is in /Users/victor/project/src/auth.ts:142"
  3. Currently: I manually copy the path or use hints kitten
  4. With this feature: I Cmd+click the path and it opens in my editor

This is especially valuable when Claude references multiple files in a single response.

Additional Context

OSC 8 terminal support (https://github.com/Alhadis/OSC8-Adoption):

  • Kitty, iTerm2 (3.1+), WezTerm, Windows Terminal
  • GNOME Terminal (VTE 0.50+), foot, Konsole
  • Alacritty (recent versions)

Related but distinct from #609 (URL text wrapping) - this is about file paths not being hyperlinks at all.

Environment: macOS, Kitty terminal with detect_urls yes, allow_hyperlinks yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions