Library
The Library keeps the texts, files and links you give your models in one place - saved once, used in any chat or Space. Sources are linked, not copied: edit an item in the Library and every chat and Space using it gets the new version with its next message.
Open it from Library in the sidebar, between Spaces and Snippets. The page has four tabs - Datasets, Texts, Files and Links, each with a count - and the button at the top right adds to whichever tab is open: New dataset, New text, Upload files or Add link. Everything is listed most recently updated first, and Loach remembers the tab you used last. The page has no search box of its own: search the Library from the search palette.
What it holds
- Texts - notes, specs or guidelines you write or paste with New text. Markdown works, and you can edit a text at any time. The title takes up to 120 characters; Ctrl + Enter in the text saves, and closing the editor with unsaved changes asks before discarding them.
- Files - Upload files, or drop them anywhere on the page: text and code files, PDFs and Word (
.docx) documents, whose text is extracted the same way as for attachments, and PNG, JPEG, WebP or GIF images. Each file can be up to 20 MB. Formats Loach can’t read - binary spreadsheets such as.xlsx, archives, legacy.doc- are turned away with a note, and so is a scanned PDF with no text layer (add its pages as images, or a text version, instead). Uploading a file whose content is already in the Library asks before storing it twice: Add anyway or Skip. - Links - Add link fetches a web page once and keeps its text as a dated snapshot, titled with the page’s own title. Refresh - on the row, in its
…menu or in the preview - fetches it again; Open in browser opens the original. Adding a link that’s already in the Library refreshes the copy you have.
Links are fetched with the same safety rules as web fetch: http and https only, no localhost or private-network addresses (an address without a dot can’t even be submitted), 30 seconds and 5 MB per page, and text pages only - a link to a PDF or another file has to be downloaded and uploaded under Files. A user name or password in the address is removed before the page is fetched, so it never reaches your Library or a backup.
A text body keeps up to 200,000 characters. Anything longer is cut, the item gets an amber Truncated badge, and the text ends with a note telling the model it’s incomplete. Split a long document into several items and group them in a dataset instead.
Datasets
A dataset is a named group of texts, files and links - “Thesis research”, say - so a whole set attaches to a chat or Space in one click. Create one with New dataset (a name of up to 80 characters and an optional description), or from a selection of items. Its card shows the mix (“3 texts · 2 files · 1 link”), the first few items, an estimated token count and a New chat button.
Each dataset opens on a page of its own, with a Library › name breadcrumb back to the list. There you can Add items from the Library, upload or drop files straight into it, and take an item out with the × on its row - it stays in your Library. The page’s … menu has Edit details, Upload files into it, New chat in Space, Add to Space and Delete dataset.
A dataset only groups items: they stay in the Library, and an item can sit in several datasets (a dataset can’t contain another dataset). Deleting a dataset keeps its items; deleting an item removes it from every dataset.
Managing items
- Preview - click an item to see its full text (or image), when it was added or fetched, its estimated tokens and the datasets it’s in. Rename it in place with the pencil next to the title: Enter saves, Esc cancels. The preview’s footer adds the item to a dataset, deletes it, and offers Edit for a text or Refresh for a link.
- The
…menu - Preview, Edit (texts), Refresh and Open in browser (links), New chat, New chat in Space, Add to dataset, Add to Space and Delete. - Select several - hover a card or row and tick its checkbox; once something is selected, clicking another card or row ticks it too. The selection survives switching tabs, so you can pick texts and files together, and Select all adds the rest of the open tab. The bar at the bottom then offers Add to dataset (a new or an existing one), Add to Space, New chat (its arrow starts the chat in a Space) and Delete.
- Delete - asks first, and says where the item is used: how many datasets and chats, and which Spaces, directly or through a dataset. It’s removed from all of them, and it can’t be undone. Deleting a dataset keeps its items.
Saving from elsewhere
- A reply - Save to Library in a reply’s
…menu saves it as a text, titled from its first line. - Your attachments - Save attachments to Library (Save attachment to Library for one) in the
…menu of a message you sent saves each readable file as a Library file. - A Space upload - Save to Library in the upload’s
…menu on the Space’s Sources tab. Uploads live only in their Space, so save one before deleting it if you want to keep a copy.
Saving something whose content is already in the Library saves nothing and tells you the name it’s stored under.
Using sources in a chat
+→ From Library - opens a picker with the same four tabs and a search box. Tick datasets and items, then Add to chat. The footer estimates the tokens and says how they’ll reach the model: Fits in full, Will be searched or Will be cut short (see How sources reach the model). Sources the chat already has are marked Added; ones it gets from its Space, In Space.#in the message box - type#at the start of the message or after a space to pick a dataset or item inline: on its own it lists your most recently updated sources, and a few letters narrow the list (up to eight matches; ones already attached are left out). Tab attaches the highlighted match, and so does Enter once you’ve moved with the arrow keys - otherwise Enter sends, so a message ending in#tagisn’t swallowed. Esc dismisses the list. The#text is removed once the source is attached.- New chat - on a text or dataset card, a dataset page, an item’s menu or a selection, starts a new chat with the sources already attached. New chat in Space starts it inside a Space you pick.
Attached sources show as chips above the message box: click one to preview it (or open a dataset’s page), or its × to remove it. They’re used on every message until you remove them. Sources picked on the welcome screen, or in the composer on a Space’s page, attach to the chat that message creates.
A chat in a Space also gets the Space’s sources - its uploads and the Library items linked to it - shown as one Space sources chip that opens the Space’s Sources tab, where they’re managed. Forking a chat keeps its sources. Private Chat has no Library sources.
In a Space
On a Space’s Sources tab, From Library links datasets and items to the Space, next to the files uploaded to it. Every chat in the Space can use them, and each source has a switch to keep it in the Space without using it. Library sources don’t count toward the Space’s 200 MB upload limit, and deleting the Space leaves them in your Library. You can also add an item or dataset to a Space from its … menu with Add to Space. See Spaces: reference sources.
How sources reach the model
Once a chat has sources, a Sources chip next to them sets how the chat uses them:
- Auto (the default) - the full text while all the sources fit in half the context window, the most relevant excerpts once they don’t. The chip shows which of the two Auto is using right now.
- Full text - always the whole text. If it can’t fit - sources may take up to about 80% of the window - it’s cut short, and the reply’s sources chip says so.
- Excerpts - always search. For each message, the passages most relevant to it - and to your previous message, so a short follow-up still finds its subject - are added to that message, up to about a quarter of the window (never more than 12,000 tokens). They’re picked again for every message, and aren’t saved into your message or sent again on later turns.
In a Space, the chip also offers Use the Space’s setting, which is where a chat in a Space starts. The Space’s own mode is set on its Settings tab. New Spaces start on Auto; Spaces created before Loach 1.6 - and Spaces restored from an older backup - start on Full text, which is how their sources always worked, until you switch them.
Full text goes into the system prompt and stays the same from turn to turn, so a local model’s prompt cache keeps it. When it has to leave something out, the chat’s own sources go in first, then the Space’s uploads, then the Space’s Library sources, and anything that didn’t fit is named in the reply’s sources chip. Images from your sources go with each message as images, for vision models - at most 16 per message, scaled as set under Images.
The window is the chat’s context length, and the context-usage bar shows what the sources will cost on the next message. An OpenAI-compatible server picks its own window and doesn’t say how big it is, so for those chats Loach assumes 32k tokens. If your model’s window differs, set the chat’s context length to it: it isn’t sent to the server, but it’s what sources are sized by.
Which sources a reply used
Every reply that drew on sources carries a chip above it - Read 3 sources in full, Used 6 excerpts from 3 sources or Searched 3 sources; nothing matched. Expand it to see which sources the model got (click a Library one to preview it) and, for excerpts, the passages themselves. Warnings show there too: sources cut short or left out to fit the window, images that didn’t go along, or an embedding model that couldn’t be reached, so the search used keywords only.
Search by keyword and by meaning
Every text source - Library items and a Space’s uploaded files alike - is split into passages of about 1,200 characters and indexed for keyword search as soon as it’s added. No setup, no network. Accents are folded, so gesla finds gęślą. Chinese, Japanese and Thai text isn’t split into words, though, so keyword search rarely matches it - use an embedding model for those languages.
Settings → Library adds an embedding model for search by meaning, which finds passages that answer a question even when they don’t share its words. It runs on Ollama, or on the OpenAI-compatible endpoint from Settings → Providers. Pick one of the suggestions or type a model name and click Use; Turn off goes back to keywords only. Suggested models:
- Ollama -
embeddinggemma(small and multilingual - a good default),embeddinggemma-2:270m(newer and better with code; needs a recent Ollama),qwen3-embedding:0.6b(multilingual, strong on retrieval),bge-m3(multilingual, handles long passages) andnomic-embed-text(compact, English-focused). A suggestion you haven’t pulled has a Download & use button, and embedding models you already have are listed too. - OpenAI-compatible -
text-embedding-3-small(cheap and fast) andtext-embedding-3-large(most accurate).
Indexing runs in the background, and keyword search keeps working meanwhile. The button in the Library’s header shows where it stands: Keyword search only without a model, Indexing n / m while passages are embedded, Search by meaning once done, or Embedding paused when the model can’t be reached (hover it for the reason). Click it to open Settings → Library, which shows the same status with a progress bar, the reason when embedding is paused, and Retry. While the model is away, searches fall back to keywords and the reply’s sources chip says so; once a message couldn’t reach the model, messages in the next minute go straight to keywords instead of each waiting on it. Loach tries the model again every minute, and straight away when you change it.
Changing the model, or the address of the server it runs on, re-embeds every source. Rebuild re-embeds everything too - for example after you pull a new version of a model under the same name. A passage the model refuses on its own is set aside for keyword search rather than holding up the rest.
The keyword and meaning rankings are merged, so passages both searches like come first. When nothing matches at all, the model gets the opening part of each source instead.
Images
Library images are scaled down before they’re sent to a model, so a full-size photo doesn’t cost thousands of image tokens. Settings → Library → Images sets how, for chats and Spaces that don’t set their own: Default follows the app’s setting in Settings → Features (longest side up to 1,024 px unless you change it), Scale down sets a size in pixels or percent, and Original sends them as they are. A Space or a chat can still set its own. The image in your Library is never changed. See Image scaling.
Where your sources go
The Library lives in Loach’s local database and works offline - fetching a link and a remote embedding model are the only parts that need the network. With an Ollama embedding model, indexing and search stay on your machine (or the Ollama server you’ve set). With an OpenAI-compatible embedding model, the text of your sources - and of each message that searches them, even in a chat with a local model - is sent to that endpoint. The sources themselves reach a chat’s model like the rest of the prompt, so with a cloud provider they go to that provider.
Settings → Data → Export data includes your Library items, datasets and which chats and Spaces use them, but not the search index - Loach rebuilds it after a restore. Remove my data deletes the whole Library. See Data management.
Upload a file to a Space when only that Space needs it. Put it in the Library when you want it in several chats or Spaces, want to edit it in one place, or want to keep it after the Space is gone.