Skip to content

[FEATURE] Clickable file links in agent responses (OSC 8 for Write/Edit/Read output paths) #27889

Description

@ilepn

Problem Statement

When Claude Code references file paths in its responses — after writing, editing, or reading files — the paths are plain text. Users must manually copy them, use terminal hints, or visually scan to locate files. This is especially painful when:

  • A session touches dozens of files across nested directories
  • File paths are wrapped in ANSI color codes (breaks terminal regex matching)
  • You want to quickly verify a file Claude just wrote or edited

Proposed Solution

Wrap file paths in agent responses with OSC 8 hyperlinks using the file:// URI scheme:

\033]8;;file:///C:/Users/user/project/src/auth.ts\033\src/auth.ts:142\033]8;;\033\

This would make every file path in Claude's output Ctrl+clickable (or Cmd+click on macOS) to open directly in the user's editor or file manager.

Where this applies

Context Example
Tool result summaries "Updated src/auth.ts" → clickable
Code references in explanations "The bug is in src/utils/parser.ts:42" → clickable
Write/Edit tool confirmations File path in the tool output → clickable
Error messages with file paths Stack traces, lint output → clickable paths

Prior art

Modern CLI tools already emit OSC 8 file links:

  • eza / exa (ls replacement)
  • fd (find replacement)
  • bat (cat replacement)
  • delta (git diff viewer)

Relationship to existing issues

Use case

I built a custom statusline with a PostToolUse hook that tracks every file Write/Edit during a session and displays them as clickable file:// links on a second statusline row. The hook and statusline work correctly, but the links aren't clickable due to #26356. Native support in agent responses would solve this at the source.

Platform

Windows 11, Windows Terminal, Claude Code 2.1.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions