[FEAT]: Navigate directly to a particular chat using the anythingllm:// protocol #3196

Open
opened 2026-02-28 06:33:13 -05:00 by deekerman · 0 comments
Owner

Originally created by @fred4code on GitHub (Feb 22, 2026).

I was looking for a way to directly open AnythingLLM Desktop (Windows version) to a specific chat, but I could not find this feature. So I tried to implement it myself. Below I explain how it can be done.

I am not opening a Pull Request because this is more of a proof-of-concept / hack. I decompiled the app.asar file, inspected dist-electron\main\index.js, modified it, minified the changes, and then rebuilt the asar file. It works, but I would like feedback from someone who knows the codebase better to understand whether this is the right approach and how it should be implemented properly.

I have been using AnythingLLM for about a week, so I might be missing some architectural considerations.

What works:

1) Go to the directory where AnythingLLM Desktop is installed on Windows. Typically:
C:\Users_YOUR_USER_\AppData\Local\Programs\AnythingLLM\resources

2) Extract app.asar:
npx asar extract app.asar app

3) In \app\dist-electron\main\index.js, just after "use strict", add the following function (and then re-minify it):

"use strict";
function routeProtocolUrl(win, from, rawUrl) {
  if (!win || !rawUrl) return;

  let u;
  try {
    u = new URL(rawUrl);
  } catch (err) {
    win.webContents.send("protocol-url", { from, url: rawUrl });
    return;
  }

  const protocol = u.protocol.toLowerCase();
  const host = u.host.toLowerCase();

  if (protocol === "anythingllm:" && host === "chat") {
    const fullPath = `/workspace${u.pathname}`;

    win.webContents.send("goto-page", { path: fullPath });
    win.show();
    return;
  }

[all the other code follows]

4) In index.js, find the four occurrences where "protocol-url" is used and replace them as follows (in the order they appear):
1)
replace:

null == t || t.webContents.send("protocol-url", { from: "second-instance", url: e })

with:

null == t || routeProtocolUrl(t, "second-instance", e)

2)
replace:

&& (null == mZ || mZ.webContents.send("protocol-url", { from: "cold-start", url: e }))

with:

&& (null == mZ || routeProtocolUrl(mZ, "cold-start", e))

3)
replace:

null == mZ || mZ.webContents.send("protocol-url", { from: "cold-start", url: fZ })

with:

null == mZ || routeProtocolUrl(mZ, "cold-start", fZ)

4)
replace:

null == mZ || mZ.webContents.send("protocol-url", { from: "open-url", url: n })

with:

null == mZ || routeProtocolUrl(mZ, "open-url", n)

5) Back up the original app.asar (so you can easily restore it if needed), delete it, and then repack the app folder:
npx asar pack app app.asar

6) Launch AnythingLLM Desktop again. If there are no errors, the modification was successful.
Now you can open a browser (e.g. Google Chrome) and type something like:

anythingLLM://chat/test/t/5398438f-01f2-56a6-gh0e-6b84k4a151kf
The chat with ID 5398438f-01f2-56a6-gh0e-6b84k4a151kf inside the workspace test will open directly.

Notes:
1) You can retrieve the chat URL by right-clicking a chat and selecting "Copy Link".
2) The "chat" part in the URL is a string I introduced in routeProtocolUrl to filter and route only chat-specific links.
3) This works if anythingllm:// is registered as a protocol in the system. On Windows, when I install AnythingLLM, the anythingllm:// protocol is automatically registered. I am not sure whether this is also handled automatically on Linux or macOS — this might be something to verify.

That’s all :D
Great tool — thank you for your work!

Originally created by @fred4code on GitHub (Feb 22, 2026). I was looking for a way to directly open AnythingLLM Desktop (Windows version) to a specific chat, but I could not find this feature. So I tried to implement it myself. Below I explain how it can be done. I am not opening a Pull Request because this is more of a proof-of-concept / hack. I decompiled the app.asar file, inspected dist-electron\main\index.js, modified it, minified the changes, and then rebuilt the asar file. It works, but I would like feedback from someone who knows the codebase better to understand whether this is the right approach and how it should be implemented properly. I have been using AnythingLLM for about a week, so I might be missing some architectural considerations. **What works:** **1) Go to the directory where AnythingLLM Desktop is installed on Windows. Typically:** C:\Users\_YOUR_USER_\AppData\Local\Programs\AnythingLLM\resources **2) Extract app.asar:** npx asar extract app.asar app **3) In \app\dist-electron\main\index.js, just after "use strict", add the following function (and then re-minify it):** ```js "use strict"; function routeProtocolUrl(win, from, rawUrl) { if (!win || !rawUrl) return; let u; try { u = new URL(rawUrl); } catch (err) { win.webContents.send("protocol-url", { from, url: rawUrl }); return; } const protocol = u.protocol.toLowerCase(); const host = u.host.toLowerCase(); if (protocol === "anythingllm:" && host === "chat") { const fullPath = `/workspace${u.pathname}`; win.webContents.send("goto-page", { path: fullPath }); win.show(); return; } ``` [all the other code follows] **4) In index.js, find the four occurrences where "protocol-url" is used and replace them as follows (in the order they appear):** **1)** replace: ```js null == t || t.webContents.send("protocol-url", { from: "second-instance", url: e }) ``` with: ```js null == t || routeProtocolUrl(t, "second-instance", e) ``` **2)** replace: ```js && (null == mZ || mZ.webContents.send("protocol-url", { from: "cold-start", url: e })) ``` with: ```js && (null == mZ || routeProtocolUrl(mZ, "cold-start", e)) ``` **3)** replace: ```js null == mZ || mZ.webContents.send("protocol-url", { from: "cold-start", url: fZ }) ``` with: ```js null == mZ || routeProtocolUrl(mZ, "cold-start", fZ) ``` **4)** replace: ```js null == mZ || mZ.webContents.send("protocol-url", { from: "open-url", url: n }) ``` with: ```js null == mZ || routeProtocolUrl(mZ, "open-url", n) ``` **5) Back up the original app.asar (so you can easily restore it if needed), delete it, and then repack the app folder:** npx asar pack app app.asar **6) Launch AnythingLLM Desktop again. If there are no errors, the modification was successful. Now you can open a browser (e.g. Google Chrome) and type something like:** anythingLLM://chat/test/t/5398438f-01f2-56a6-gh0e-6b84k4a151kf The chat with ID 5398438f-01f2-56a6-gh0e-6b84k4a151kf inside the workspace test will open directly. **Notes:** **1)** You can retrieve the chat URL by right-clicking a chat and selecting "Copy Link". **2)** The "chat" part in the URL is a string I introduced in routeProtocolUrl to filter and route only chat-specific links. **3)** This works if anythingllm:// is registered as a protocol in the system. On Windows, when I install AnythingLLM, the anythingllm:// protocol is automatically registered. I am not sure whether this is also handled automatically on Linux or macOS — this might be something to verify. That’s all :D Great tool — thank you for your work!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/anything-llm#3196
No description provided.