Managing books

The book list

The Books tab lists your books. Other users' books are not shown. The list shows one folder at a time, the folders of the current one above its books; at the top level, with no folders made, it is simply all your books.

The Books tab
The Books tab
Column  
Name The name of the book.
Tags The book's tags.
Created When the book was created.
Last Modified When the book was last changed.

The list is sorted by Last Modified, newest first. Click a column header to sort by it; with several sorted columns the list is sorted by all of them in order.

The row below the headers filters the list:

  • Name - books whose name starts with the text. Use * as a wildcard: *dragon finds every book with "dragon" anywhere in the name.

  • Tags - books that have all the selected tags.

The refresh button at the end of the filter row reloads the list.

Each row has buttons: the star makes the book a favorite, the pen opens it, Move to folder puts it into a folder, the clone button makes a copy of it and the trash button deletes it. The header has New folder, the Manage menu (Organise, the window to move and copy books and folders, Tag books, Statistics and the Mass changes sub menu) and Import, which makes a new book of files you have (see Importing a book).

A book is open in one window

A book can be open in one window at a time, also across your browser tabs, other browsers and your phone. When you open a book that is open somewhere else, Marginalia says since when and asks Open here: the book then opens here and its window in the other place closes, saying why (if a part is being generated there, the question says so and Open here stops the generation; what was written so far stays). Cancel leaves it where it is. When you log in and Marginalia opens the book you had open last, it does not take the book from another window: it leaves it closed and tells you where it is. A window in a tab that was closed or a device that went off does not keep the book: Open here takes it at once.

Search (in the header, next to Manage; the magnifier in the header on a phone) opens a window that finds books by more than the filter row can. Fill in what you want to check, leave the rest empty, and press Search (or Enter in a text field):

Field Finds books...
Name whose name contains the text (* is a wildcard).
Tags to include that have the tags: All of the tags or Any of the tags, as you choose next to the field.
Tags to exclude that do not have the tags: with Any of the tags a book with at least one of them is left out, with All of the tags only a book that has every one of them.
Created from / to, Modified from / to created or last changed in the range; the day of a to date is included.
Number of parts from / to with that many parts in all its branches (parts in the trash are not counted).
Text with a part that has every word of the text. Words, "phrases" and * work as in the search of the story.
Include versions off (the default): only the current text of the parts is searched; on: a book is also found when an earlier version of one of its parts has the words, see Version history.
Search in all branches off (the default): the text is searched only in the branch the book is at (the story as you see it when you open the book); on: in the parts of all branches.

A book has to pass every check you filled in. The books found are listed below with their tags, the last changed first; a click on a column header sorts them. The folder button opens a book (in its window above the search, so closing the book brings you back to the results). Clear empties the fields.

The advanced search of the books
The advanced search of the books

Cloning a book

The clone button asks for the Name of the new book (the name of the original with (Copy) by default) and has the check box Only current branch, checked by default. The new book is a separate book that gets:

Cloning a book
Cloning a book
  • the settings of the book (description, language, prompts, point of view, tense, style, backup settings), the data that extensions keep in the book, and the tags;

  • the same Model, Protocol and lorebook. The lorebook is linked, not copied: a change of it shows in both books;

  • the story with its own copy of the parts, their summaries and pictures. With Only current branch only the parts from the beginning to the end of the active branch are copied; without it all the branches are.

The clone starts a version history of its own (one version per part); the history of the original is not copied.

The clone is not published, even if the original is. The original is not changed. It is put into the same folder as the original.

Tagging many books at once

Tag books (in the Manage menu of the header) opens a window that puts one tag on many books, or takes it off them, without opening each. Pick the Tag (or type a new one and press Enter) and the list shows every book with its tags; the books that have the picked tag come first and show it highlighted. Each row has a + button that applies the tag to that book and a - button that removes it. To do the same for several books, tick their check boxes (the box in the header ticks all) and use Apply the tag to the checked or Remove the tag from the checked at the bottom. A book an agent works on is grayed out: it is locked, so it can not be ticked or changed until the run is paused or stopped. The same window tags lorebooks and their entries.

Tagging books
Tagging books

Changing the model and protocol of many books

The Mass changes sub menu of the Manage menu has the item Mass Change Model/Protocol. It opens a window that puts one Model and/or one Protocol on many books without opening each. Leave a box empty (it shows Do not replace) and that part of the books stays as it is: pick only a model to change the models and keep the protocols. The table lists the books of the current folder by name with the model and protocol they have now; Include subfolders adds the books below it. Type in the filter under Name to narrow the list, tick the books to change (the box in the header ticks all the books that are shown) and press Replace and exit. Books that the filter hides are unticked, so only what you see is changed. A book an agent works on is grayed out: it is locked, so it can not be ticked or changed until the run is paused or stopped.

Changing the model and protocol of many books
Changing the model and protocol of many books

The item Mass Change Language of the same menu works the same way for the Language of the books: pick the language, filter and tick the books, press Replace and exit. The table shows the language each book has now, with what it inherits from its folders (see Language).

Changing the language of many books
Changing the language of many books

Renaming many books

The item Mass Rename renames the checked books at once. Pick how:

Way What it does
Add prefix Puts the Text to add before the name.
Add postfix Puts the Text to add after the name.
Find and replace Replaces every occurrence of Find in the name with Replace with (empty removes it). The text is taken as it is, not as a pattern; Case sensitive is off by default.
Number the books Gives the books numbers: the Name pattern is the new name, with {name} for the current name and {n} for the number, for example {name} {n}, {n}. {name} or Chapter {n}. The first checked book gets Start at, each next one the Step more, and Digits pads the number with zeros (007).
Numbering the books of all folders
Numbering the books of all folders

The column New name shows what each checked book would get while you type, so check it before you press Rename. A numbering counts the checked books in the order of the list (by name). Spaces at the start and the end of the new name are removed. Nothing is renamed, and the window stays open, when a text is missing, when the pattern has no {n}, when no name would change, or when a name would end up empty. Filtering, Include subfolders and locked books work as in the other mass changes.

Tag books and the item Tag folders work on the books, or on the folders, of the current folder in the same way.

Creating a book

  1. Click Add Book.
  2. Enter the name and confirm.

The new book is put into the folder the list shows, and so are the books you import. It opens right away. It starts with your Default Model and Default Protocol from the Settings tab (see Account & settings), if you have set them; otherwise select them on the About tab before generating.

Importing a book

Import in the header of the list (the file button on a phone) opens one window for everything a new book can be made of. Pick the Source; the text, the accepted files and the options under the name follow it:

Source Upload Options
Import from archive a .zip of .md files, a part for each file, see Importing into the book none
Import from SillyTavern one or more .jsonl chats, see below merge user and assistant messages
Import from LM Studio one or more conversations, see below merge user and assistant messages
Import from a document a manuscript in one file (Word, LibreOffice, RTF, Markdown, plain text, EPUB), see below words per part, heading level of the chapters
Import from an Obsidian vault the .zip of a vault, see below the same
Import from a Scrivener project the .zip of a .scriv project, see below the same

Upload the file, give the book a name (it is filled from the file, the title of a document, or the character of a chat; the book is named New book when you leave it empty) and click Import. A progress window with Stop shows the parts being stored; stopping keeps what was stored. A file the source cannot read is refused with a warning, the other uploads stay.

The same window, from the settings menu (⚙) of a book, adds the parts to that book at a place you pick, see Importing into the book.

The sources of the import window
The sources of the import window
Importing a zip of text files as a new book
Importing a zip of text files as a new book

Importing a finished manuscript

For a draft that already exists, choose Import from a document and upload the file: a .docx (Word), .odt (LibreOffice, OpenOffice), .rtf (Rich Text, from WordPad, TextEdit and any other program), .md (one Markdown file), .txt (plain text) or .epub (an e-book). The text becomes the parts of a new book, all of it marked as written by you (the import is not counted in the statistics as writing and the history of a part says Import from a document).

  • Chapters. A paragraph in a Heading style (a # heading in a Markdown file) starts a chapter, and each chapter starts with its heading (the first heading of a part is its chapter title, as in the export). Chapters start at heading level says which headings those are: the level you choose and the ones above it (the shallowest level the document has is chosen at first); deeper headings stay in the text as smaller headings. A document without headings is one chapter. The Title of the document is not imported as text, it names the book (in a Markdown file the title: of a header at the top, or a single # heading in front of ## chapters). A plain text file has no headings, so a line of its own that says Chapter 12, Part IV: The Return, Book two or Prologue (also Epilogue, Interlude, Preface, Foreword, Afterword) starts a chapter; the heading level choice is then not needed.

  • Words per part. The text is cut between paragraphs into parts of about this many words (1000 at first), at the paragraph boundary nearest to the number. A part never holds the end of one chapter and the beginning of the next, and a chapter is not cut for nothing: what would be left over at the end of a chapter, when it is less than half of the number, stays with the part before it, so a chapter of up to one and a half times the number is one part. A paragraph longer than the number is not cut.

  • A line under the name tells how many chapters, words and parts the import will make; it changes as you change the options.

  • Paragraphs of a text file. Blank lines separate the paragraphs and the lines of a paragraph are joined (text wrapped at a column becomes one paragraph); a file with no blank lines has a paragraph on each line. A Markdown file is kept as it is written, cut at the blank lines, headings and code blocks; text in Windows-1252 instead of UTF-8 is read too.

  • Formatting. Italic and bold are kept (as Markdown *italic*, **bold**); the rest of the formatting (fonts, sizes, alignment), images, headers and footers, footnotes, comments and deleted text of tracked changes are not imported. Tables are read cell by cell.

Importing a Word document, cut into parts of about 500 words
Importing a Word document, cut into parts of about 500 words

An old .doc file has to be saved as .docx, .odt or .rtf first.

An EPUB is read page by page in its reading order. The headings of the pages (h1 to h6) are the chapters; a page without a heading that the e-book's table of contents names gets that name as its heading. The cover, the table of contents, footnotes and the readings of ruby text are left out, and the title of the e-book names the book. A book protected by DRM cannot be read.

From an Obsidian vault or a Scrivener project

Both are folders, so zip the folder first (on a Mac Compress in the Finder; the .scriv of Scrivener is a folder too) and upload the .zip. The options are the same as for a document.

  • Obsidian vault. Every note (.md) is a chapter named after the note (or the title: of its header), in the order of the paths with numbers counted as numbers (Chapter 2 before Chapter 10). A folder is a part above its notes, and the headings inside a note are below the note's own. Links [[Note|text]] become their text; embeds ([[file]] with a ! before it), comments %%...%%, block ids and the marker of a callout are removed; a highlight ==text== is plain text. Hidden folders (.obsidian, .trash), attachments and notes without text are skipped. If the vault holds notes that are not part of the story, delete them before zipping.

  • Scrivener project. The manuscript (the Draft folder of the binder, Scrivener 2 and 3) is imported, not the research, the trash or the documents that are not included in compile. A folder, or a document that has documents under it, is a heading (its depth in the binder is its level, its title the text); the documents that are all a folder holds are its scenes, one after another with a scene break between them (their titles are not used). A document directly in the manuscript or in a folder of other folders is a chapter with its title. The name of the project names the book.

Whatever the source, the new book is opened when the import is done (also when you stopped it), and the window Import finished offers to write the summaries of the parts and to let an agent take the lore notes.

Importing from SillyTavern

To continue a roleplay or story you started in SillyTavern, use Import → Import from SillyTavern. In SillyTavern, export the chat (Manage chat files, or take the .jsonl files from data/<user>/chats/<character>/), then:

  1. Upload one or more .jsonl chats. A file that is not a SillyTavern chat is refused, the others stay.

  2. Give the book a name (it is filled from the character of the first chat).

  3. Tick Merge user and assistant messages into one part if you want one part per turn: the message of the user (several messages in a row are joined with an empty line) becomes the instructions of the part and the answer after it its text. Without it every message is a part of its own, with its text as the text of the part, so the book reads like the chat did.

  4. Click Import. A progress window with Stop shows the parts being stored; stopping keeps what was stored.

Importing a SillyTavern chat
Importing a SillyTavern chat

SillyTavern copies the chat when you create a branch or a checkpoint, so the chats of one story share their beginning. Upload them together and Marginalia finds the common messages and stores them once: the chats become the branches of one tree, which you can walk in the tree view. The swipes (alternative answers) of a message become sibling parts, and the book opens at the end of the chat written last (by the date of its last message). Chats that don't begin with the same message become separate first parts. Hidden (system) messages are skipped, and so are swipes that are empty. The reasoning and the model name of an answer are kept with the part.

Importing from LM Studio

To continue a conversation you had in LM Studio, use Import → Import from LM Studio. LM Studio keeps each conversation in a file <number>.conversation.json in the folder .lmstudio/conversations of your home folder (on Windows %USERPROFILE%\.lmstudio\conversations). It works like Importing from SillyTavern:

  1. Upload one or more conversations. A file that is not a conversation of LM Studio is refused, the others stay.

  2. Give the book a name (it is filled with the name of the conversation, or the name of the file when it has none).

  3. Tick Merge user and assistant messages into one part for one part per turn (your message is the instructions of the part), or leave it off so that every message is a part of its own.

  4. Click Import.

The window of the import from LM Studio with one conversation uploaded
The window of the import from LM Studio with one conversation uploaded

The versions of a message that LM Studio keeps (the answers you regenerated, the text you edited) become sibling parts and the version that was shown is the one the book opens on; conversations that share their beginning are joined into one tree. The thinking of a reasoning model is kept as the reasoning of the part, together with the model name. The system prompt of the conversation, the calls of tools and attached files are not imported.

To start a book from a backup file, use Import Backup as New Book in the Settings tab, see Book backups.

The About tab

The About tab of a book
The About tab of a book
Field  
Name The name of the book.
Tags Tags for sorting your books and for lorebook activation. Type to pick an existing tag or create a new one.
Description What the book is about. Available to the prompt templates as the book description.
Language The language the book is written in. Used for automatic hyphenation of the text in the book reading style and in the viewer; it does not change what the model writes. Empty means inherit: the language of the nearest folder above the book that sets one, else English; the box then shows which and from where.
Model The inference provider that writes this book.
Protocols The protocol with the generation settings.
Versions kept per part How many earlier versions of the text of a part the history keeps. Empty means inherit: the grey number in the box is the limit that applies and the line under it says which folder, your settings or the administrator sets it. 0 keeps no history.
Published Lets other users read the book, see Publishing & viewer. Once checked, the reader link of the book (<address of Marginalia>/view/<book ID>) is shown under the checkbox; copy it and send it to the readers.
Show the images to readers Checked by default. Readers of a published book see the pictures of its parts; uncheck it to show them the text only. You always see your own pictures.

Changes are saved as you type.

Below are read-only counts:

   
Total Word Count, Total Token Count All parts of the book, in all branches.
Active Branch Word Count, Active Branch Token Count Only the parts of the active branch.
Authorship of the branch Press Calculate: how many percent of the words of the active branch you wrote and how many a model generated, and the number of words. It is worked out from the version history of every part, so it takes a while on a long book, and a part whose history is switched off is compared with the text the model generated first. See Highlighting generated text.

A book needs a model and a protocol to generate. Without them, generating stops with Book is missing model. or Book is missing protocol.

Deleting a book

Click the trash button in the book list and confirm. The book disappears from your list.

A book is not deleted while something works on it: a part being generated, a summary batch, a translation, a redraft or annotation window, or the book open in another window. Marginalia then says what is in the way (This is in use: ...); wait until it is done or stop it, and delete again. The same holds for restoring a backup into the book while another window or a run works on it.

Deleted books are not removed from the database right away. Until an administrator removes them, with all their parts, using Cleanup, you can bring the book back from the Trash tab. Until then the data is still in the database backups. The book's own backups are files and stay where they are.