Trilium AI Agent

May 4, 2026 ยท View on GitHub

A floating chat widget that turns your Trilium Notes share page into an AI-assisted docs site. One JS file, no build step.

Widget screenshot

Install (5 steps)

Requires TriliumNext โ‰ฅ 0.91.

  1. Find your shared root note's ID. Right-click it in Trilium โ†’ Copy note ID. Or grab it from the share URL (/share/<this-id>).

  2. Create a code/JavaScript note. Paste the contents of widget.js.

  3. Edit the script. Near the top, set:

    const ROOT_NOTE_ID = "your-root-note-id";
    
  4. Hide the JS note from the public sidebar. On it, add label: #shareHiddenFromTree

  5. Wire it up. On your shared root note, add a relation:

    • Name: shareJs
    • Target: the JS note
    • Inheritable: yes โ† required, or it won't load on child notes

Hard-refresh your share page. A ๐Ÿ’ฌ bubble appears bottom-right.

Use it

  • Click the bubble โ†’ enter your API key (Gemini works out of the box; any OpenAI-compatible provider works too)
  • Ask anything about your docs
  • The AI uses tools to search and read only the relevant notes

Optional: nicer code blocks

If your docs have code samples, code-blocks.css adds a Tokyo Night dark palette. Same install pattern: code/CSS note + #shareHiddenFromTree + inheritable ~shareCss relation on the shared root.

More