[GH-ISSUE #768] [Issue]: Lorebook automation/agent system fails to overwrite #369

Closed
opened 2026-10-20 17:28:06 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Navgner on GitHub (May 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/768

Originally assigned to: @Promansis on GitHub.

Summary

Expected behavior

Actual behavior

Summary

The Lorebook automation/agent system fails to overwrite existing entries when the "action": "update" parameter is returned by the LLM. Instead of replacing the old text, the engine appends the new text to the end of the entry, causing massive text duplication.
Expected behavior

When an agent/prompt outputs a JSON payload containing "action": "update" (or similar logic) for a specific entryName, the system's backend should completely overwrite the existing content of that Lorebook entry with the new content provided in the JSON.
Actual behavior

The system concatenates (appends) the new content to the existing one. For example, if a relationship entry is updated 5 times during a roleplay session, the Lorebook will contain 5 chronological versions of the same entry pasted one after the other, completely breaking the token limit and formatting.
Steps to reproduce

Set up a Lorebook agent/prompt designed to update existing lore (instructing the LLM to output a JSON with an update action, e.g., {"action": "update", "entryName": "TargetEntry", "content": "New synthesized text"}).

Have the LLM generate an update for an already existing Lorebook entry.

Open the Lorebook and inspect the updated entry.

Observe that the newly generated text has been appended at the bottom of the old text, rather than replacing it.

Result in the Lorebook (Bug):
Status: Professional Employer-Employee
[...old text...]
Status: Candid Professionalism
[...older text...]
Status: Playful Professionalism
[...new text added at the end instead of replacing everything...]

Additional context

The prompt explicitly instructs the LLM to "synthesize, rewrite, and not append", and the LLM correctly outputs a single, clean JSON block with the "action": "update" flag. The issue lies strictly in how the engine handles the insertion of the updated text into the Lorebook database.
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.
  • I DID NOT read this template and provide the requested details.
Originally created by @Navgner on GitHub (May 12, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/768 Originally assigned to: @Promansis on GitHub. ## Summary <!-- What is wrong in one or two sentences? --> ## Expected behavior <!-- What should have happened? --> ## Actual behavior Summary The Lorebook automation/agent system fails to overwrite existing entries when the "action": "update" parameter is returned by the LLM. Instead of replacing the old text, the engine appends the new text to the end of the entry, causing massive text duplication. Expected behavior When an agent/prompt outputs a JSON payload containing "action": "update" (or similar logic) for a specific entryName, the system's backend should completely overwrite the existing content of that Lorebook entry with the new content provided in the JSON. Actual behavior The system concatenates (appends) the new content to the existing one. For example, if a relationship entry is updated 5 times during a roleplay session, the Lorebook will contain 5 chronological versions of the same entry pasted one after the other, completely breaking the token limit and formatting. Steps to reproduce Set up a Lorebook agent/prompt designed to update existing lore (instructing the LLM to output a JSON with an update action, e.g., {"action": "update", "entryName": "TargetEntry", "content": "New synthesized text"}). Have the LLM generate an update for an already existing Lorebook entry. Open the Lorebook and inspect the updated entry. Observe that the newly generated text has been appended at the bottom of the old text, rather than replacing it. Result in the Lorebook (Bug): Status: Professional Employer-Employee [...old text...] Status: Candid Professionalism [...older text...] Status: Playful Professionalism [...new text added at the end instead of replacing everything...] Additional context The prompt explicitly instructs the LLM to "synthesize, rewrite, and not append", and the LLM correctly outputs a single, clean JSON block with the "action": "update" flag. The issue lies strictly in how the engine handles the insertion of the updated text into the Lorebook database. 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. - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:28:06 +07:00
  • closed this issue
  • added the
    bug
    label
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#369
No description provided.