claude-code - 💡(How to fix) Fix Auto-linker wraps filenames as URLs (e.g. `CLAUDE.md` → `[CLAUDE.md](http://CLAUDE.md)`) [1 comments, 2 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#56097Fetched 2026-05-05 05:58:18
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

The implicit auto-linker in Claude Code's chat rendering treats any token matching word.tld-style patterns as a URL and wraps it in a markdown link to http://<token>. In practice this fires far more often on filenames in prose than on actual bare URLs, producing dead/incorrect links the vast majority of the time.

Root Cause

The implicit auto-linker in Claude Code's chat rendering treats any token matching word.tld-style patterns as a URL and wraps it in a markdown link to http://<token>. In practice this fires far more often on filenames in prose than on actual bare URLs, producing dead/incorrect links the vast majority of the time.

RAW_BUFFERClick to expand / collapse

Summary

The implicit auto-linker in Claude Code's chat rendering treats any token matching word.tld-style patterns as a URL and wraps it in a markdown link to http://<token>. In practice this fires far more often on filenames in prose than on actual bare URLs, producing dead/incorrect links the vast majority of the time.

Repro

Send (or have the model emit) a message containing a bare filename in prose, e.g.:

Just write CLAUDE.md as plain text.

Rendered output:

Just write CLAUDE.md as plain text.

The same happens with package.json, tsconfig.json, Program.cs, appsettings.json, Cargo.toml, etc. — the link target http://CLAUDE.md (or http://package.json, etc.) is not a real URL and resolves to nothing.

This also corrupts copy/paste round-trips: when a user copies the rendered text and pastes it back into chat (or into another tool), the markdown-link form is preserved, so future messages now contain [CLAUDE.md](http://CLAUDE.md) instead of the original CLAUDE.md. The artifact then propagates.

Why this is a regression

Before the auto-linker, filenames in prose rendered as plain inline code or plain text — correct. The new behavior:

  • False positives dominate. Filenames-in-prose are vastly more common in dev workflows than bare unlinked domains. The heuristic is wrong by default.
  • True positives are trivially user-fixable. If someone genuinely wants example.com to be clickable, they can write [example.com](https://example.com) or <https://example.com>. The implicit case is the lossy one.
  • Already-formatted links survive. Users and the model both already use explicit [text](url) markdown when a real link is intended. The implicit wrapper adds noise without solving an unmet need.
  • It mangles model-generated file references too. When the assistant mentions CLAUDE.md or tsconfig.json in a response, the rendering layer converts those to broken http:// links — which then look like the assistant did something wrong.

Requested change

At minimum, make implicit auto-linking opt-in via settings (default off), or restrict the heuristic to tokens that look like real domains (require a known TLD AND no path-style filename extension like .md/.json/.cs/.ts/.py/.toml/.yaml/.yml/.lock/.config).

Removing the auto-linker entirely is also reasonable — explicit markdown link syntax already covers the legitimate case.

Environment

  • Claude Code 2.1.119
  • Windows 11 Pro

extent analysis

TL;DR

The implicit auto-linker should be made opt-in or restricted to tokens that look like real domains to prevent false positives and broken links.

Guidance

  • Review the current implementation of the implicit auto-linker and consider adding a setting to make it opt-in, defaulting to off.
  • Restrict the auto-linker heuristic to tokens that have a known TLD and do not contain path-style filename extensions (e.g., .md, .json, .cs, etc.).
  • Test the updated auto-linker with various filenames and URLs to ensure it correctly identifies and links only valid URLs.
  • Consider removing the auto-linker entirely, as explicit markdown link syntax already covers the legitimate case.

Example

No code snippet is provided as the issue does not contain specific code references.

Notes

The current implementation of the auto-linker is causing more harm than good, and a change is necessary to prevent false positives and broken links. The suggested changes should be tested thoroughly to ensure they do not introduce new issues.

Recommendation

Apply a workaround by restricting the auto-linker heuristic to tokens that look like real domains, as this approach balances the need to link valid URLs with the need to prevent false positives and broken links.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING