diff --git a/apps/x/apps/main/src/ipc.ts b/apps/x/apps/main/src/ipc.ts index 7b42a98e..2896ee7a 100644 --- a/apps/x/apps/main/src/ipc.ts +++ b/apps/x/apps/main/src/ipc.ts @@ -462,6 +462,9 @@ export function setupIpcHandlers() { let filePath = args.path; if (filePath.startsWith('~')) { filePath = path.join(os.homedir(), filePath.slice(1)); + } else if (!path.isAbsolute(filePath)) { + // Workspace-relative path — resolve against ~/.rowboat/ + filePath = path.join(os.homedir(), '.rowboat', filePath); } const error = await shell.openPath(filePath); return { error: error || undefined }; @@ -470,6 +473,9 @@ export function setupIpcHandlers() { let filePath = args.path; if (filePath.startsWith('~')) { filePath = path.join(os.homedir(), filePath.slice(1)); + } else if (!path.isAbsolute(filePath)) { + // Workspace-relative path — resolve against ~/.rowboat/ + filePath = path.join(os.homedir(), '.rowboat', filePath); } const stat = await fs.stat(filePath); if (stat.size > 10 * 1024 * 1024) { diff --git a/apps/x/packages/core/src/application/assistant/instructions.ts b/apps/x/packages/core/src/application/assistant/instructions.ts index e0eb0205..1a70f28f 100644 --- a/apps/x/packages/core/src/application/assistant/instructions.ts +++ b/apps/x/packages/core/src/application/assistant/instructions.ts @@ -195,9 +195,11 @@ knowledge/People/Sarah Chen.md ~/Desktop/report.pdf \`\`\` -This renders as an interactive card in the UI. Use this format for: +This renders as an interactive card in the UI that the user can click to open the file. Use this format for: - Knowledge base file paths (knowledge/...) - Files on the user's machine (~/Desktop/..., /Users/..., etc.) - Audio files, images, documents, or any file reference -Never output raw file paths in plain text when they could be wrapped in a filepath block.`; +**IMPORTANT:** Only use filepath blocks for files that already exist. The card is clickable and opens the file, so it must point to a real file. If you are proposing a path for a file that hasn't been created yet (e.g., "Shall I save it at ~/Documents/report.pdf?"), use inline code (\`~/Documents/report.pdf\`) instead of a filepath block. Use the filepath block only after the file has been written/created successfully. + +Never output raw file paths in plain text when they could be wrapped in a filepath block — unless the file does not exist yet.`;