← Grimoire

AI assistant

Grimoire’s assistant uses a local Ollama instance.

The Rust backend issues HTTP requests to http://localhost:11434. Examples include /api/chat for conversation and embedding endpoints used for RAG.

See:

There are no API keys for that path. If Ollama is installed and models are pulled, the app talks to your machine only.

Chat streaming

The chat Tauri command sends messages to Ollama with stream: true.

Tokens are pushed to the UI incrementally via the chat:token Tauri event until the stream completes (same module as above).

Models and settings

Embedding model

AppConfig in Rust tracks embedding_model (used for note, file, and Wikipedia embeddings).

If the key is missing in SQLite, the code falls back to nomic-embed-text.

See src-tauri/src/config.rs.

When does “Use notes” see your latest edits?

After each explicit save (Ctrl+S / the editor save path), the app persists the note and then runs note indexing so full-text search, semantic search, and RAG all target the saved version. In practice you can save and then ask the assistant about that note without a separate “rebuild index” step, as long as Ollama is up and the note is unlocked (locked / encrypted-inaccessible notes are not indexed the same way — see Privacy & security). Very long notes may still show Indexing… in the editor while embeddings finish.

Context toggles (chat panel)

The Svelte chat UI persists these booleans in localStorage. Keys are prefixed with grimoire:chat:.

ToggleRole
Use notesWhen on, relevant notes are injected as RAG context (useNotes).
Use WikipediaWikipedia articles in RAG when the feature is enabled (useWiki).
Use filesExternal file / scanner context (useFiles).
Use viewCurrent board/table view context (useViewContext).
Feature guideInjects the built-in markdown feature guide describing shortcuts and views (useFeatureGuide).

Source: src/lib/Chat.svelte (prefs and tooltips).

Common errors

KindWhat to do
OllamaUnavailableStart Ollama (ollama serve).
EmbeddingFailedPull the configured embedding model (ollama pull <model>).

These strings are formatted in Chat.svelte and shared error helpers when the backend returns structured AppError kinds.

Send selection to chat

Ctrl+Shift+Enter (Cmd+Shift+Enter on macOS) sends the current editor selection to chat.

Implemented in keyboardService.svelte.js.

See also