You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File viewer: find relative paths in an agent's scratch folder outside the pane's folder #803
Agents sometimes write files outside the pane's working directory and then refer to them by a path relative to that place. Claude Code keeps a per-session scratchpad at /tmp/claude-<uid>/<project-slug>/<session-id>/scratchpad/ and says things like "the draft is in scratchpad/upstream-pr.md". Opening that link requests /api/fs/file?path=scratchpad%2Fupstream-pr.md&pane_id=…. locateFile resolves it against the pane's cwd, and filesNamed only searches under the cwd, so the viewer answers not_found even though the server can read the file.
Related to #434 / #730, which made SendUserFile paths openable. Those are absolute, so they already work. This is the relative form agents use in prose.
Proposal
An opt-in list of extra roots, tried only after the pane's folder found nothing:
{cwd-slug} in an entry is the pane's cwd with every non-alphanumeric character replaced by - (how Claude Code names <project-slug>), e.g. /tmp/claude-1000/{cwd-slug}/*.
One match opens directly. Several come back as the existing ambiguous_path candidates, newest first. Unset means today's behaviour exactly.
Globbing starts from the longest literal prefix of each entry, never from /.
I'm running this as a ~40-line patch to server/file-view.ts (a new filesInRoots(), called at the end of locateFile) with a test in server/file-view.test.ts, and I'm happy to open it as a PR if the shape works for you. A built-in default for Claude Code's layout could be a follow-up, but opt-in avoids reading other users' /tmp layouts by surprise.
Where
Other (file viewer)
Workarounds and alternatives
Pasting the absolute path into the viewer works, as does asking the agent to always print absolute paths, but the links agents print in chat stay broken.
Thanks for the clear write-up. Opening #1134 to fix this with a built-in lookup instead of HERDR_WEB_FILE_ROOTS:
When a relative path is not under the pane's folder and the pane runs Claude Code, the server looks in that session's temp folder, <tmp>/claude-<uid>/<project>/<session>/.
<project> and <session> come from the transcript the chat already resolves for the pane. That means only the live session's folder is read, so scratchpad/draft.md does not turn into a choice between every past session of the same cwd, which a {cwd-slug}/* glob would give.
No setting is needed, and only a claude-<uid> folder owned by the server's user is read.
An opt-in root list for other agents' layouts could still follow if one turns up. Feedback on #1134 is welcome.
Resolved in the latest release, v0.4.11 (shipped since v0.4.9): a relative link such as scratchpad/draft.md that is not under the pane's folder now opens from the live Claude Code session's temp folder, with no setting needed (#1134). Closing; an opt-in root list for other agents' layouts can be a new issue if one is needed.
Activity
devswha commentedon Oct 14, 2026
Thanks for the clear write-up. Opening #1134 to fix this with a built-in lookup instead of
HERDR_WEB_FILE_ROOTS:<tmp>/claude-<uid>/<project>/<session>/.<project>and<session>come from the transcript the chat already resolves for the pane. That means only the live session's folder is read, soscratchpad/draft.mddoes not turn into a choice between every past session of the same cwd, which a{cwd-slug}/*glob would give.claude-<uid>folder owned by the server's user is read.An opt-in root list for other agents' layouts could still follow if one turns up. Feedback on #1134 is welcome.
fix(files): open relative links into a Claude Code session's scratch …
devswha commentedon Oct 16, 2026
Resolved in the latest release, v0.4.11 (shipped since v0.4.9): a relative link such as
scratchpad/draft.mdthat is not under the pane's folder now opens from the live Claude Code session's temp folder, with no setting needed (#1134). Closing; an opt-in root list for other agents' layouts can be a new issue if one is needed.