[GH-ISSUE #4924] [Issue]: Professor Mari has no safe lorebook entry-delete and mass-deletes via raw mari db delete --where #2728

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

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

Originally assigned to: @kolacheee on GitHub.

Summary

Professor Mari has no safe way to delete a single lorebook entry: her structured app_data toolkit exposes lorebook.addEntry and lorebook.updateEntry but no lorebook.deleteEntry. When a user asked her to delete one entry, she tried lorebook.deleteEntry (not a real action, so it failed), then fell back to the raw mari db delete <table> --where <expr> command — which matched and deleted 77 entries across multiple unrelated lorebooks instead of the one entry.

Expected behavior

Mari can delete a single lorebook entry by id through a structured, scoped action that goes through the normal Keep/Restore review, the same way she adds and updates entries.

Actual behavior

lorebook.deleteEntry fails (unsupported action), so Mari improvises with mari db delete lorebook_entries --where …, a raw bulk-delete with no row-count guard, and removes far more than intended. The deletion is recoverable via the Keep/Restore card, but the blast radius is the whole matched set.

Steps to reproduce

  1. In Professor Mari Workspace, ask her to delete a specific lorebook entry.
  2. She attempts lorebook.deleteEntry (fails), then uses mari db delete with a --where expression.
  3. The raw delete matches many rows and removes unrelated entries.

Environment

  • Marinara Engine version: staging (post-#4791)
  • Install type: source
  • OS + version: Windows 11
  • Browser or app shell: Professor Mari Workspace

Logs, screenshots, or video

Mari: "lorebook.deleteEntry isn't a direct action in app_data. To delete an entry via CLI/DB commands, I can use mari lorebooks or mari db. Let's delete entry <id> using mari db." Result: a Keep/Restore card reading "77 lorebook_entries / 77 rows" removed.

Additional context

Root cause is the missing structured delete: packages/server/src/services/mari-db/mari-db.service.ts has addentry/updateentry cases in the lorebook app_data handler but no deleteentry; the CLI already has a safe mari lorebooks delete-entry <id> (single row), but Mari reached for raw mari db delete instead.

Proposed fix (this issue):

  1. Add a lorebook.deleteEntry app_data action — single entry by id, scoped to lorebook_entries, routed through the same Keep/Restore review as add/update.
  2. Prompt guidance: to delete a lorebook entry use lorebook.deleteEntry (or mari lorebooks delete-entry <id>); never use mari db delete --where for routine entry deletes.

A separate, more invasive guardrail on raw mari db delete --where bulk deletes (dry-run-and-confirm before applying) is deliberately out of scope here and can be tracked separately.

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 @kolacheee on GitHub (Aug 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4924 Originally assigned to: @kolacheee on GitHub. ## Summary Professor Mari has no safe way to delete a single lorebook entry: her structured `app_data` toolkit exposes `lorebook.addEntry` and `lorebook.updateEntry` but **no `lorebook.deleteEntry`**. When a user asked her to delete one entry, she tried `lorebook.deleteEntry` (not a real action, so it failed), then fell back to the raw `mari db delete <table> --where <expr>` command — which matched and deleted **77 entries across multiple unrelated lorebooks** instead of the one entry. ## Expected behavior Mari can delete a single lorebook entry by id through a structured, scoped action that goes through the normal Keep/Restore review, the same way she adds and updates entries. ## Actual behavior `lorebook.deleteEntry` fails (unsupported action), so Mari improvises with `mari db delete lorebook_entries --where …`, a raw bulk-delete with no row-count guard, and removes far more than intended. The deletion is recoverable via the Keep/Restore card, but the blast radius is the whole matched set. ## Steps to reproduce 1. In Professor Mari Workspace, ask her to delete a specific lorebook entry. 2. She attempts `lorebook.deleteEntry` (fails), then uses `mari db delete` with a `--where` expression. 3. The raw delete matches many rows and removes unrelated entries. ## Environment - Marinara Engine version: staging (post-#4791) - Install type: source - OS + version: Windows 11 - Browser or app shell: Professor Mari Workspace ## Logs, screenshots, or video Mari: "`lorebook.deleteEntry` isn't a direct action in `app_data`. To delete an entry via CLI/DB commands, I can use `mari lorebooks` or `mari db`. Let's delete entry `<id>` using `mari db`." Result: a Keep/Restore card reading "77 lorebook_entries / 77 rows" removed. ## Additional context Root cause is the missing structured delete: `packages/server/src/services/mari-db/mari-db.service.ts` has `addentry`/`updateentry` cases in the lorebook `app_data` handler but no `deleteentry`; the CLI already has a safe `mari lorebooks delete-entry <id>` (single row), but Mari reached for raw `mari db delete` instead. Proposed fix (this issue): 1. Add a `lorebook.deleteEntry` `app_data` action — single entry by id, scoped to `lorebook_entries`, routed through the same Keep/Restore review as add/update. 2. Prompt guidance: to delete a lorebook entry use `lorebook.deleteEntry` (or `mari lorebooks delete-entry <id>`); never use `mari db delete --where` for routine entry deletes. A separate, more invasive guardrail on raw `mari db delete --where` bulk deletes (dry-run-and-confirm before applying) is deliberately out of scope here and can be tracked separately. ## 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:54:00 +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#2728
No description provided.