AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
docs: explain Claude Code reattach preview flattening citation links (#1254)
Matt Van Horn94800613fe29
diff --git a/docs/solutions/integration-issues/claude-code-reattach-preview-flattens-links.md b/docs/solutions/integration-issues/claude-code-reattach-preview-flattens-links.mdnew file mode 100644index 00000000..8af55bb3--- /dev/null+++ b/docs/solutions/integration-issues/claude-code-reattach-preview-flattens-links.md@@ -0,0 +1,45 @@+---+title: "Claude Code's background-session reattach preview prints every markdown link as `label (url)`; LAW 8's hidden-link default is still correct"+date: "2026-10-11"+category: "integration-issues"+module: "skills/last30days/SKILL.md (LAW 8)"+problem_type: "integration_issue"+component: "synthesis_output"+severity: "low"+applies_when:+ - "A /last30days report in Claude Code shows full URLs in parentheses after every source name"+ - "The top of a report shows `label (https://...)` while the bottom shows clickable blue labels, with one line printed twice at the boundary"+ - "Someone proposes moving Claude Code to LAW 8's visible-URL (plain-label) regime to hide URLs"+---++# Claude Code reattach preview flattens links++## Symptom++In Claude Code, the top part of a long /last30days report showed every citation as `label (https://...)` instead of a clickable label. That included X, YouTube, Reddit, GitHub, and web links, so the problem was not specific to X. Lower down, the same report showed clickable blue labels (`u/Defkox`, `r/gamedev`, `HN`). One line appeared twice at the point where the two styles met.++Seen on 2026-10-11 with Claude Code 2.1.296 in Ghostty (via cmux), after a `/last30days Reverse Engineer Anything` run.++## Cause++The skill emitted correct markdown. Every citation was `[label](url)`, as LAW 8 requires on hidden-link hosts.++The flattening happens in Claude Code. When a client reattaches to a background session, Claude Code prints a tail of the transcript before the live session redraws. That preview renders assistant markdown with hyperlinks hard-coded off (`linkCap:!1` in the attach-preview renderer, in the module with the `Waiting for session to redraw… Ctrl+Z to detach` string). With hyperlinks off, Claude Code's link renderer falls back to `${text} (${url})`.++The live session then draws below the preview with hyperlinks on, so links are clickable from that point down. The duplicated line is where the preview tail overlaps the redraw.++Claude Code's normal markdown path also drops hyperlinks when one markdown chunk passes 1,000 lines or about 100K characters ("windowed" rendering). A last30days report is far below that limit, so it was not the cause here.++## Fix++No skill change. Keep LAW 8's hidden-link default for Claude Code:++- In the live view, `[label](url)` renders as a clickable label with no visible URL. That is the intended experience, and it lets readers open the source post.+- Switching Claude Code to plain labels would hide URLs in the preview, but it would also remove clickable links from every live report. Readers would then need the saved raw file or a follow-up question to reach a source.++The upstream fix belongs in Claude Code: render the reattach preview with the same hyperlink support as the live view.++## Guardrails++- `tests/test_codex_host_contract.py::test_law8_keeps_claude_code_hidden_link_despite_reattach_preview` fails if Claude Code is named as a visible-URL host or drops out of the hidden-link host list.+- If URLs show up in a Claude Code report, first check whether the session was reattached (top flattened, bottom clickable, one line repeated). If the whole live render is flattened, check terminal hyperlink support (`FORCE_HYPERLINK`, OSC 8) before changing LAW 8.diff --git a/tests/test_codex_host_contract.py b/tests/test_codex_host_contract.pyindex b2ff5166..3ff051ad 100644--- a/tests/test_codex_host_contract.py+++ b/tests/test_codex_host_contract.py@@ -130,6 +130,24 @@ def test_law8_visible_url_hosts_exclude_cursor_and_split_from_step0():assert "renderer split is separate from onboarding; Cursor remains non-modal" in law8+def test_law8_keeps_claude_code_hidden_link_despite_reattach_preview():+ # Claude Code's background-session reattach preview prints every markdown+ # link as `label (url)`; the live view below it renders clickable labels.+ # Moving Claude Code to plain labels would hide those URLs but strip every+ # clickable source link. See docs/solutions/integration-issues/+ # claude-code-reattach-preview-flattens-links.md.+ text = "\n".join(contract_documents().values())+ visible_lists = re.findall(r"[Vv]isible-URL hosts? \(([^)]*)\)", text)+ assert visible_lists, "no visible-URL host list found"+ for hosts in visible_lists:+ assert "Claude Code" not in hosts, f"Claude Code named as visible-URL host: {hosts!r}"+ hidden_lists = re.findall(r"[Hh]idden-link hosts? \(([^)]*)\)", text)+ assert hidden_lists, "no hidden-link host list found"+ assert all("Claude Code" in hosts for hosts in hidden_lists)+ law8 = _law8_block()+ assert "`CLAUDECODE` or `CURSOR_AGENT` set means hidden-link default" in law8++def test_law8_wrap_list_includes_u_name_and_github_repo_first_mentions():# u/name comment authors and GitHub repos must be in the wrap-every-citation# list, with URLs copied from the comment row / engine evidence block.