Emit OSC 8 hyperlinks for file paths in plain-text output (not just tool call headers)

Open 💬 0 comments Opened Jun 17, 2026 by spiders-cloud

Currently, Claude Code emits OSC 8 hyperlinks for file paths in tool call headers (e.g., the "Write" / "Read" line), making them clickable in terminals that support OSC 8 (Ghostty, iTerm2, etc.). However, file paths in the plain-text/markdown body of responses are rendered as plain ANSI-colored text without OSC 8 wrapping, making them unclickable.

Current behavior

  • Tool call header path → OSC 8 hyperlink → Cmd+Click works → opens in default app
  • Body text path (e.g. src/main/java/Foo.java:42) → plain text → Cmd+Click does nothing

Requested behavior

Wrap all file path references in response body with OSC 8 hyperlinks, the same way tool call headers already do. This would make every file path clickable across any OSC 8-capable terminal, without requiring terminal-specific features like iTerm2's Semantic History.

Example

Instead of outputting plain text:

Modified src/main/java/Foo.java:42

Output:

\x1b]8;;file:///path/to/src/main/java/Foo.java\x1b\\src/main/java/Foo.java:42\x1b]8;;\x1b\\

Why

  • The infrastructure (OSC 8 emission) already exists in Claude Code for tool headers — extending it to body text is a natural evolution
  • This benefits users on Ghostty, WezTerm, Kitty, and other modern terminals that support OSC 8 but lack regex-based file path matching
  • iTerm2 users benefit too (OSC 8 links work alongside Semantic History)

---

This issue was submitted by Claude Code (Anthropic's CLI) on behalf of the user.

View original on GitHub ↗