[GH-ISSUE #4775] [Issue]: Android/Termux lorebook corruption and missing shell access #2633

Closed
opened 2026-10-21 05:51:53 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @SpicyMarinara on GitHub (Aug 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4775

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Android/Termux users reported two lorebook bugs: lorebooks remain active after their character is deleted or unlinked, and Lorebook Keeper appends duplicate content instead of replacing existing entries. The report also requests native, safely sandboxed shell access on Android for debugging and file management.

Expected behavior

Deleting or unlinking a character should deactivate or remove its associated lorebooks from the All scope and leave them manageable. Updating or importing a lorebook through Lorebook Keeper should replace the existing entries and content rather than append duplicates. Android users should have a secure, documented way to perform necessary shell-based diagnostics and file operations.

Actual behavior

Lorebooks associated with deleted or unlinked characters remain active in the All scope, cannot be bulk-managed through the UI, and may conflict with newer lorebooks. Lorebook Keeper appends new entries and content during updates or imports, producing multiple stacked copies and contradictory context. Android/Termux users lack native shell access for operations such as deleting files, inspecting SQLite databases, querying JSON, searching files, and running cleanup scripts.

Steps to reproduce

  1. Run the engine locally on Android through Termux.
  2. Associate a lorebook with a character, then unlink or delete the character.
  3. Check the All lorebook scope and active context; the associated lorebook reportedly remains active and is no longer readily manageable from the UI.
  4. Update or import an existing lorebook through Lorebook Keeper.
  5. Inspect the resulting lorebook; the report indicates that new entries and content are appended alongside existing content, creating duplicate copies.
  6. On Android/Termux, attempt shell-based file, database, JSON, search, or cleanup operations from within the engine; native shell access is reportedly unavailable.

Environment

  • Marinara Engine version: Not provided
  • Install type: termux
  • OS + version: Android version not provided
  • Browser or app shell: Android/Termux local engine

Logs, screenshots, or video

Not provided in Discord context.

Additional context

The reporter observed one lorebook growing to contain three copies of its timeline, plot threads, and scene state, with slightly different content and naming conventions. Reported consequences include token waste, contradictory instructions, corrupted context, and incoherent generations. A participant noted that recent shell access may require a sandbox such as macOS Seatbelt or Linux bubblewrap, which Termux/Android may not support; no implementation or security solution was established. Marinara responded that this request is not easy to handle.

Discord thread: Android Bug Report
Discord thread link: https://discord.com/channels/1417099416812392641/1535737420379594923
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (6 messages)
[2026-08-08T19:52:13.640Z] Pomtherine: I ran into two lorebook bugs while using Android (Termux), running the engine locally. Dropping both here cause I remember someone saying they were fixed?

*Bug Report 1: Orphaned Lorebooks Persist After Character Deletion*

When a character is unlinked or deleted, any lorebooks previously associated with that character remain active in the "All" scope. They continue loading into context, can't be bulk-managed from the UI (since the character link is gone), and silently conflict with new lorebooks covering the same content. This corrupts context and produces incoherent generations that are very difficult to diagnose, especially on mobile where inspecting the active context is already painful.

*Bug Report 2: Lorebook Keeper Duplicates Entries Instead of Replacing*

When updating or importing a lorebook through the Lorebook Keeper, the engine appends new entries and content alongside existing ones rather than replacing them, resulting in multiple stacked copies of the same content within single entries. This silently corrupts lorebooks on every save cycle. In my case, a single lorebook grew to contain three full copies of its timeline, three copies of its plot threads, and three copies of its scene state, all with slightly different content and name conventions. This caused massive token waste, contradictory instructions, and incoherent generations.
[Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535737420379594923]

[2026-08-08T19:52:37.026Z] Pomtherine: Also 

*Request: Native Shell Access on Android*

I'm out here in Termux doing`cat`,`nano`, and`cp` just to read bug reports and move files around. It works but it's genuinely painful. Having native shell access inside the engine on Android would be a game changer for debugging, file management, and power users who live on their phones.

Right now, without shell access, Mari literally can't:
- Run`rm` to delete files (had to overwrite with empty content instead)
- Run`sqlite3` to inspect the database directly
- Run`jq` to query and validate JSON structures
- Run`grep` /`find` /`rg` to search across files
- Run`sed` /`awk` for bulk text processing
- Execute Node.js or Python scripts for data inspection or cleanup
- Run`git` commands for version control or diffing
- Use`cp` /`mv` /`chmod` for file operations
- Pipe commands together for complex diagnostics
- Check system resources (`du`,`df`,`ps`,`top`)
- and like a bunch of other things too

I'm literally copying markdown files to shared storage just to open them in a text viewer. Please. I'm begging you on my knees. 🧎
[Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535737518467850371]

[2026-08-08T20:33:07.544Z] containerd: i also enjoy having mari have arbitrary code execution in termux but i think a recent update only allows mari to use bash if it's in a sandbox (macos seatbelt, linux bwrap), which is an extremely sensible security decision and also how most agent harnesses do things

unfortunately android/termux doesn't support bwrap so we're kind of screwed. i haven't researched sandboxing in termux but i'm not optimistic about it and i think the only real options are either (1) extremely complicated whack a mole allowlisting that naughty models can probably break by accident, (2) giving an escape hatch for users to give mari the power to shoot them in the nuts
[Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535747712798957638]

[2026-08-08T21:08:25.629Z] DSBwizzard: I, for one, have no idea about any of these Android bugs that OP has posted, but I would like very much to upvote giving Prof. Mari the ability to shoot the user in the nuts
[Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535756596691599360]

[2026-08-08T22:04:20.696Z] Marinara: no easy to handle that, unfortunately.
[Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535770668862275644]

[2026-08-08T22:04:24.707Z] Marinara: :<
[Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535770685685633055]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Aug 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4775 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Android/Termux users reported two lorebook bugs: lorebooks remain active after their character is deleted or unlinked, and Lorebook Keeper appends duplicate content instead of replacing existing entries. The report also requests native, safely sandboxed shell access on Android for debugging and file management. ## Expected behavior Deleting or unlinking a character should deactivate or remove its associated lorebooks from the All scope and leave them manageable. Updating or importing a lorebook through Lorebook Keeper should replace the existing entries and content rather than append duplicates. Android users should have a secure, documented way to perform necessary shell-based diagnostics and file operations. ## Actual behavior Lorebooks associated with deleted or unlinked characters remain active in the All scope, cannot be bulk-managed through the UI, and may conflict with newer lorebooks. Lorebook Keeper appends new entries and content during updates or imports, producing multiple stacked copies and contradictory context. Android/Termux users lack native shell access for operations such as deleting files, inspecting SQLite databases, querying JSON, searching files, and running cleanup scripts. ## Steps to reproduce 1. Run the engine locally on Android through Termux. 2. Associate a lorebook with a character, then unlink or delete the character. 3. Check the All lorebook scope and active context; the associated lorebook reportedly remains active and is no longer readily manageable from the UI. 4. Update or import an existing lorebook through Lorebook Keeper. 5. Inspect the resulting lorebook; the report indicates that new entries and content are appended alongside existing content, creating duplicate copies. 6. On Android/Termux, attempt shell-based file, database, JSON, search, or cleanup operations from within the engine; native shell access is reportedly unavailable. ## Environment - Marinara Engine version: Not provided - Install type: termux - OS + version: Android version not provided - Browser or app shell: Android/Termux local engine ## Logs, screenshots, or video Not provided in Discord context. ## Additional context The reporter observed one lorebook growing to contain three copies of its timeline, plot threads, and scene state, with slightly different content and naming conventions. Reported consequences include token waste, contradictory instructions, corrupted context, and incoherent generations. A participant noted that recent shell access may require a sandbox such as macOS Seatbelt or Linux bubblewrap, which Termux/Android may not support; no implementation or security solution was established. Marinara responded that this request is not easy to handle. Discord thread: Android Bug Report Discord thread link: https://discord.com/channels/1417099416812392641/1535737420379594923 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (6 messages)</summary> ```text [2026-08-08T19:52:13.640Z] Pomtherine: I ran into two lorebook bugs while using Android (Termux), running the engine locally. Dropping both here cause I remember someone saying they were fixed? *Bug Report 1: Orphaned Lorebooks Persist After Character Deletion* When a character is unlinked or deleted, any lorebooks previously associated with that character remain active in the "All" scope. They continue loading into context, can't be bulk-managed from the UI (since the character link is gone), and silently conflict with new lorebooks covering the same content. This corrupts context and produces incoherent generations that are very difficult to diagnose, especially on mobile where inspecting the active context is already painful. *Bug Report 2: Lorebook Keeper Duplicates Entries Instead of Replacing* When updating or importing a lorebook through the Lorebook Keeper, the engine appends new entries and content alongside existing ones rather than replacing them, resulting in multiple stacked copies of the same content within single entries. This silently corrupts lorebooks on every save cycle. In my case, a single lorebook grew to contain three full copies of its timeline, three copies of its plot threads, and three copies of its scene state, all with slightly different content and name conventions. This caused massive token waste, contradictory instructions, and incoherent generations. [Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535737420379594923] [2026-08-08T19:52:37.026Z] Pomtherine: Also *Request: Native Shell Access on Android* I'm out here in Termux doing`cat`,`nano`, and`cp` just to read bug reports and move files around. It works but it's genuinely painful. Having native shell access inside the engine on Android would be a game changer for debugging, file management, and power users who live on their phones. Right now, without shell access, Mari literally can't: - Run`rm` to delete files (had to overwrite with empty content instead) - Run`sqlite3` to inspect the database directly - Run`jq` to query and validate JSON structures - Run`grep` /`find` /`rg` to search across files - Run`sed` /`awk` for bulk text processing - Execute Node.js or Python scripts for data inspection or cleanup - Run`git` commands for version control or diffing - Use`cp` /`mv` /`chmod` for file operations - Pipe commands together for complex diagnostics - Check system resources (`du`,`df`,`ps`,`top`) - and like a bunch of other things too I'm literally copying markdown files to shared storage just to open them in a text viewer. Please. I'm begging you on my knees. 🧎 [Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535737518467850371] [2026-08-08T20:33:07.544Z] containerd: i also enjoy having mari have arbitrary code execution in termux but i think a recent update only allows mari to use bash if it's in a sandbox (macos seatbelt, linux bwrap), which is an extremely sensible security decision and also how most agent harnesses do things unfortunately android/termux doesn't support bwrap so we're kind of screwed. i haven't researched sandboxing in termux but i'm not optimistic about it and i think the only real options are either (1) extremely complicated whack a mole allowlisting that naughty models can probably break by accident, (2) giving an escape hatch for users to give mari the power to shoot them in the nuts [Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535747712798957638] [2026-08-08T21:08:25.629Z] DSBwizzard: I, for one, have no idea about any of these Android bugs that OP has posted, but I would like very much to upvote giving Prof. Mari the ability to shoot the user in the nuts [Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535756596691599360] [2026-08-08T22:04:20.696Z] Marinara: no easy to handle that, unfortunately. [Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535770668862275644] [2026-08-08T22:04:24.707Z] Marinara: :< [Discord message: https://discord.com/channels/1417099416812392641/1535737420379594923/1535770685685633055] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:51:53 +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#2633
No description provided.