[PR #8324] [CLOSED] [WIP] feat(novel): add Novel Mode, a Roleplay display style for co-writing a book #8276

Closed
opened 2026-10-26 04:04:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8324
Author: @ipodnerd3019
Created: 10/25/2026
Status: ❌ Closed

Base: staging ← Head: feature-novel-mode


📝 Commits (1)

  • 9509897 feat(novel): add Novel Mode, a Roleplay display style for co-writing a book

📊 Changes

58 files changed (+4852 additions, -598 deletions)

View changed files

📝 docs/prompts/generation-parameters.md (+1 -1)
📝 docs/prompts/presets.md (+1 -1)
📝 docs/roleplay/getting-started.md (+1 -1)
➕ docs/roleplay/novel-mode.md (+78 -0)
➕ e2e/novel-mode.e2e.ts (+866 -0)
📝 packages/client/package.json (+8 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+38 -4)
📝 packages/client/src/components/chat/ChatInput.tsx (+105 -48)
📝 packages/client/src/components/chat/ChatMessage.tsx (+237 -193)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+186 -114)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+56 -51)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+48 -8)
📝 packages/client/src/components/chat/CyoaChoices.tsx (+38 -4)
➕ packages/client/src/components/chat/NovelEditor.tsx (+427 -0)
📝 packages/client/src/components/chat/cyoa-choice-submission.ts (+21 -3)
➕ packages/client/src/components/chat/novel-document.ts (+603 -0)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+6 -2)
📝 packages/client/src/components/layout/GlobalOmnibar.tsx (+8 -2)
📝 packages/client/src/components/panels/PresetsPanel.tsx (+2 -2)
📝 packages/client/src/components/presets/PresetEditor.tsx (+3 -3)

...and 38 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Note

Work in progress. This is opened early for direction and feedback. It is not ready to merge. Before it is marked ready: a feature-request issue will be opened and linked, translated docs will be updated to match the final English text, and the manual checks below will be done.

Linked issue

Discord thread: (Co)Writer/Story chat mode

No issue yet. A feature request for Novel Mode will be opened and linked here before this PR is marked ready.

Why this change

  • Some people want to co-write a story with the AI the way NovelAI works: one continuous manuscript they can edit freely, not a turn-by-turn chat.
  • Roleplay is built around turns. The AI never writes your character, you speak through user messages, and each message sits in its own bubble. That makes it hard to write a book together, where the AI writes the protagonist too and you steer, edit, and write passages of your own.
  • Novel Mode is a Roleplay display style, not a new chat mode. Roleplay's generation, swipes, TTS, agents, lorebooks, memory, branches, and settings keep working, and the change avoids touching the many places that branch on chat mode.

What changed

Nothing that worked before stops working. The Universal preset is unchanged.

  • New "Novel" display style for Roleplay chats. Choose it in the new-chat wizard's Display step. A novel needs no persona and no characters, though both can be added.
  • The page reads as one manuscript. There are no avatars, names, or bubbles. Paragraphs are indented like a printed book, and each passage's actions (copy, translate, retry, speak, delete, and so on) sit in the right margin. The margin stays in view along long passages, and shows when you hover over a passage or put the cursor in it.
  • The whole novel is one editor. Click anywhere and type. Edits save to that passage automatically, on the swipe they were typed on. Text written at the end of the page becomes the next passage. Italic and bold work, with Ctrl/Cmd+I and Ctrl/Cmd+B. Deleting across passages trims each one and never removes a message. Emptying a passage and moving on asks whether to delete it.
  • The message bar only steers. Send writes the next passage. Text in the bar is sent as guidance for it and never becomes a user message. Your own end-of-page text is always saved first, and generation stops if that save fails. In a novel, attachments, Post only, Guide reply, Impersonate, /impersonate, and /send are not offered. CYOA choices and "Regenerate (guided)" also steer as guidance.
  • Groups always use Merged mode in a novel: one author voice writes every character. Novels never ask the model for speaker tags.
  • New built-in "Marinara's Novel Preset". It is read-only, can be copied, and is seeded and refreshed like the Universal preset. It is written for a book rather than a two-party roleplay. The AI writes the protagonist too, in plain book prose with italics for thoughts, and stops at a natural pause. It covers four setups: no persona or characters, a persona and characters, characters only, and a persona only. Choosing Novel in the wizard selects this preset, and choosing another style restores the previous one. Its options are content rating, point of view (person), narration style, tense, length, and language.
  • Built-in preset handling now covers every built-in preset, not only Universal: read-only protection, copying, admin cleanup, and profile import.
  • Novels show a book icon in the chat list.
  • Docs: a new docs/roleplay/novel-mode.md, plus updates to docs/roleplay/getting-started.md, docs/prompts/presets.md, and docs/prompts/generation-parameters.md.

Implementation notes for reviewers:

  • Editor: TipTap 3.31.4 (ProseMirror), lazy-loaded in its own vendor-tiptap chunk, about 330 kB raw. It is not in the startup bundle.
  • Passages and messages: each passage is a message. The editor's passage node renders the normal Roleplay ChatMessage row around the editable text.
  • Message bar rules: all message-bar rules for novels are in packages/client/src/lib/message-bar-rules.ts.
  • Message edits: the edit endpoint accepts an optional swipeIndex, so an edit can name the swipe it was written for. Callers that don't send it behave exactly as before.
  • Bold and italic parsing: novel bold/italic parsing follows CommonMark's emphasis rules. In rare edge cases it can differ from Roleplay's inline renderer, for example 5 * 3 * 2 stays literal in a novel.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated runs on the branch, which an AI agent did. They are not a substitute for the boxes above:

  • pnpm check: passes. The only warning is the existing serverRun hook warning in an unrelated file.
  • pnpm regression:prompt: passes.
  • Full Node regression suite: every failure passed when rerun alone, except dottore-auto-dispatch, which also fails on staging.
  • e2e/novel-mode.e2e.ts: 6/6 on desktop-chromium and 6/6 on mobile-chromium.
  • pnpm smoke:ui: 7/7.
  • New regressions: scripts/regressions/novel-mode.regression.ts and scripts/regressions/novel-preset.regression.ts. Several existing preset regressions were extended.
  • Local CodeRabbit review, several passes. Valid findings were fixed. Three were dismissed with reasons:
    • The regenerate target restore already receives a novel-resolved Merged mode.
    • Profile import overwriting a stock row is existing Universal behavior, and seeding restores it.
    • Forcing Merged mode for novels is intentional.

Manual verification notes

Still to verify by hand:

  • Wizard: create a novel from the wizard with no persona and no characters. Check that Send writes a first passage, and that guidance typed in the bar steers it without appearing as a message.
  • Real models: try the Novel preset with real models in each setup (persona + characters, characters only, persona only). Check that the AI writes the protagonist, writes no [guidance: …] notes, and uses italics only for thoughts and emphasis.
  • Editing:
    • Edit text in the middle of a passage, reload, and confirm the edit was saved.
    • Delete across two passages, and confirm both messages remain.
    • Empty a passage, click away, and check the delete dialog's Cancel and Delete paths.
  • Swipes:
    • Swipe, then retry an older passage and confirm its arrows appear.
    • Type in a passage and switch swipes immediately. The edit should stay on the swipe it was typed on.
  • Mobile: tap a passage to show its actions, and check that typing with the on-screen keyboard works. Deleting across passages on a real Android keyboard is untested.
  • Light and dark themes: check the page panel, highlight, and margin toolbar in both.
  • Group novel: check that it always uses Merged mode, and that Chat Settings hides the group-mode options.
  • Docker / Podman: build and run the container.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Docs changed under docs/: roleplay/novel-mode.md (new), roleplay/getting-started.md, prompts/presets.md, and prompts/generation-parameters.md.

Translations for all ten language packs are prepared on ipodnerd3019:docs-i18n-novel-mode. They are machine-translated, need native-speaker review, and will be updated to the final English text before a docs-i18n PR is opened. No version bump, and CHANGELOG.md is untouched.

UI evidence (if applicable)

Desktop Video: https://discord.com/channels/1417099416812392641/1562101875355025489/1563749150984773725
Mobile editor screenshot: image

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8324 **Author:** [@ipodnerd3019](https://github.com/ipodnerd3019) **Created:** 10/25/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `feature-novel-mode` --- ### 📝 Commits (1) - [`9509897`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9509897bab6a44fbf0039309eb3b1cf5b7abc335) feat(novel): add Novel Mode, a Roleplay display style for co-writing a book ### 📊 Changes **58 files changed** (+4852 additions, -598 deletions) <details> <summary>View changed files</summary> 📝 `docs/prompts/generation-parameters.md` (+1 -1) 📝 `docs/prompts/presets.md` (+1 -1) 📝 `docs/roleplay/getting-started.md` (+1 -1) ➕ `docs/roleplay/novel-mode.md` (+78 -0) ➕ `e2e/novel-mode.e2e.ts` (+866 -0) 📝 `packages/client/package.json` (+8 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+38 -4) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+105 -48) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+237 -193) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+186 -114) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+56 -51) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+48 -8) 📝 `packages/client/src/components/chat/CyoaChoices.tsx` (+38 -4) ➕ `packages/client/src/components/chat/NovelEditor.tsx` (+427 -0) 📝 `packages/client/src/components/chat/cyoa-choice-submission.ts` (+21 -3) ➕ `packages/client/src/components/chat/novel-document.ts` (+603 -0) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+6 -2) 📝 `packages/client/src/components/layout/GlobalOmnibar.tsx` (+8 -2) 📝 `packages/client/src/components/panels/PresetsPanel.tsx` (+2 -2) 📝 `packages/client/src/components/presets/PresetEditor.tsx` (+3 -3) _...and 38 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> > [!NOTE] > **Work in progress.** This is opened early for direction and feedback. It is not ready to merge. Before it is marked ready: a feature-request issue will be opened and linked, translated docs will be updated to match the final English text, and the manual checks below will be done. ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Discord thread: [(Co)Writer/Story chat mode](https://discord.com/channels/1417099416812392641/1562101875355025489) No issue yet. A feature request for Novel Mode will be opened and linked here before this PR is marked ready. ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Some people want to co-write a story with the AI the way NovelAI works: one continuous manuscript they can edit freely, not a turn-by-turn chat. - Roleplay is built around turns. The AI never writes your character, you speak through user messages, and each message sits in its own bubble. That makes it hard to write a book together, where the AI writes the protagonist too and you steer, edit, and write passages of your own. - Novel Mode is a **Roleplay display style**, not a new chat mode. Roleplay's generation, swipes, TTS, agents, lorebooks, memory, branches, and settings keep working, and the change avoids touching the many places that branch on chat mode. ## What changed <!-- List the key changes in this PR --> Nothing that worked before stops working. The Universal preset is unchanged. - **New "Novel" display style for Roleplay chats.** Choose it in the new-chat wizard's Display step. A novel needs no persona and no characters, though both can be added. - **The page reads as one manuscript.** There are no avatars, names, or bubbles. Paragraphs are indented like a printed book, and each passage's actions (copy, translate, retry, speak, delete, and so on) sit in the right margin. The margin stays in view along long passages, and shows when you hover over a passage or put the cursor in it. - **The whole novel is one editor.** Click anywhere and type. Edits save to that passage automatically, on the swipe they were typed on. Text written at the end of the page becomes the next passage. Italic and bold work, with Ctrl/Cmd+I and Ctrl/Cmd+B. Deleting across passages trims each one and never removes a message. Emptying a passage and moving on asks whether to delete it. - **The message bar only steers.** Send writes the next passage. Text in the bar is sent as guidance for it and never becomes a user message. Your own end-of-page text is always saved first, and generation stops if that save fails. In a novel, attachments, Post only, Guide reply, Impersonate, `/impersonate`, and `/send` are not offered. CYOA choices and "Regenerate (guided)" also steer as guidance. - **Groups always use Merged mode** in a novel: one author voice writes every character. Novels never ask the model for speaker tags. - **New built-in "Marinara's Novel Preset".** It is read-only, can be copied, and is seeded and refreshed like the Universal preset. It is written for a book rather than a two-party roleplay. The AI writes the protagonist too, in plain book prose with italics for thoughts, and stops at a natural pause. It covers four setups: no persona or characters, a persona and characters, characters only, and a persona only. Choosing Novel in the wizard selects this preset, and choosing another style restores the previous one. Its options are content rating, point of view (person), narration style, tense, length, and language. - **Built-in preset handling now covers every built-in preset,** not only Universal: read-only protection, copying, admin cleanup, and profile import. - **Novels show a book icon in the chat list.** - **Docs:** a new `docs/roleplay/novel-mode.md`, plus updates to `docs/roleplay/getting-started.md`, `docs/prompts/presets.md`, and `docs/prompts/generation-parameters.md`. Implementation notes for reviewers: - **Editor:** TipTap 3.31.4 (ProseMirror), lazy-loaded in its own `vendor-tiptap` chunk, about 330 kB raw. It is not in the startup bundle. - **Passages and messages:** each passage is a message. The editor's passage node renders the normal Roleplay `ChatMessage` row around the editable text. - **Message bar rules:** all message-bar rules for novels are in `packages/client/src/lib/message-bar-rules.ts`. - **Message edits:** the edit endpoint accepts an optional `swipeIndex`, so an edit can name the swipe it was written for. Callers that don't send it behave exactly as before. - **Bold and italic parsing:** novel bold/italic parsing follows CommonMark's emphasis rules. In rare edge cases it can differ from Roleplay's inline renderer, for example `5 * 3 * 2` stays literal in a novel. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated runs on the branch, which an AI agent did. They are not a substitute for the boxes above: - `pnpm check`: passes. The only warning is the existing `serverRun` hook warning in an unrelated file. - `pnpm regression:prompt`: passes. - Full Node regression suite: every failure passed when rerun alone, except `dottore-auto-dispatch`, which also fails on `staging`. - `e2e/novel-mode.e2e.ts`: 6/6 on desktop-chromium and 6/6 on mobile-chromium. - `pnpm smoke:ui`: 7/7. - New regressions: `scripts/regressions/novel-mode.regression.ts` and `scripts/regressions/novel-preset.regression.ts`. Several existing preset regressions were extended. - Local CodeRabbit review, several passes. Valid findings were fixed. Three were dismissed with reasons: - The regenerate target restore already receives a novel-resolved Merged mode. - Profile import overwriting a stock row is existing Universal behavior, and seeding restores it. - Forcing Merged mode for novels is intentional. ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> Still to verify by hand: - **Wizard:** create a novel from the wizard with no persona and no characters. Check that Send writes a first passage, and that guidance typed in the bar steers it without appearing as a message. - **Real models:** try the Novel preset with real models in each setup (persona + characters, characters only, persona only). Check that the AI writes the protagonist, writes no `[guidance: …]` notes, and uses italics only for thoughts and emphasis. - **Editing:** - Edit text in the middle of a passage, reload, and confirm the edit was saved. - Delete across two passages, and confirm both messages remain. - Empty a passage, click away, and check the delete dialog's Cancel and Delete paths. - **Swipes:** - Swipe, then retry an older passage and confirm its arrows appear. - Type in a passage and switch swipes immediately. The edit should stay on the swipe it was typed on. - **Mobile:** tap a passage to show its actions, and check that typing with the on-screen keyboard works. Deleting across passages on a real Android keyboard is untested. - **Light and dark themes:** check the page panel, highlight, and margin toolbar in both. - **Group novel:** check that it always uses Merged mode, and that Chat Settings hides the group-mode options. - **Docker / Podman:** build and run the container. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs changed under `docs/`: `roleplay/novel-mode.md` (new), `roleplay/getting-started.md`, `prompts/presets.md`, and `prompts/generation-parameters.md`. Translations for all ten language packs are prepared on `ipodnerd3019:docs-i18n-novel-mode`. They are machine-translated, need native-speaker review, and will be updated to the final English text before a docs-i18n PR is opened. No version bump, and `CHANGELOG.md` is untouched. ## UI evidence (if applicable) <!-- Add before/after screenshots or recordings for UI changes --> Desktop Video: https://discord.com/channels/1417099416812392641/1562101875355025489/1563749150984773725 Mobile editor screenshot: <img width="842" height="1409" alt="image" src="https://github.com/user-attachments/assets/a455ecbe-750d-443e-8ec8-242131c6add5" /> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 04:04:19 +07:00
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
Pasta-Devs/Marinara-Engine#8276
No description provided.