[GH-ISSUE #4104] [Issue]: Custom agents do not trigger lorebook entries on agent calls #2220

Closed
opened 2026-10-21 05:46:23 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Custom agents in Marinara Engine v2.3.4 do not appear to trigger lorebook keyword/RAG entries from the agent call context. The user reports that built-in knowledge agents can use lorebooks, but the equivalent option or behavior is missing for custom agents.

Expected behavior

Custom agents should be able to trigger lorebook entries from the messages included in their agent-call context and inject the triggered content for prompt use. If this is controlled by a setting, the toggle or configuration should be visible in the custom agent UI.

Actual behavior

The user could not get any lorebook triggers to fire for a custom agent. They report that the option does not appear for custom agents, even though built-in knowledge agents can use lorebooks.

Steps to reproduce

  1. Create or use a custom agent in Chat mode: Roleplay.
  2. Configure a lorebook entry with Activation Keywords including "unidentified", Trigger cadence set to "Every run", and Context size set to "1 message".
  3. Have the assistant generate a turn containing the word "unidentified".
  4. Run the custom agent and attempt to use lorebook-triggered content in the agent context.
  5. Observe that no lorebook trigger appears to fire for the custom agent, and the user-visible option for this behavior does not appear in the custom agent configuration.

Environment

  • Marinara Engine version: Marinara Engine v2.3.4
  • Install type: installer
  • OS + version: Windows 11
  • Browser or app shell: Not provided

Logs, screenshots, or video

No logs or attachments were provided. Relevant Discord evidence: user said "I haven't been able to have my custom agent get any lorebook triggers" and "the built-in knowledge agents can, but the option doesn't appear to me in custom one." A Marinara response stated: "Yeah, we need to add a toggle that allows lorebooks to trigger for the agent call itself."

Additional context

User goal: trigger lorebook retrieval based on agent-call context and let the custom agent format/transform/inject the retrieved content into chat. The user also requested separate lorebook assignment for the main chat and the custom agent, similar to the built-in knowledge router agent.

Discord thread: Lorebook/RAG use on custom agents
Discord thread link: https://discord.com/channels/1417099416812392641/1530675473871540425
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (11 messages)
[2026-07-25T20:37:51.546Z] Nyashes: Hello!
OS: Win11
Install method: windows Installer
Current version: Marinara Engine v2.3.4
Chat mode: Roleplay


I've been trying to work on a agent that retrieve data from a lorebook and format/transform/inject it into the chat (either edit last assistant message or context injection, which are already doable)
Currently, there is only the tool call which I haven't been able to make work (there might be a bug there, but I'll report separately)

Regardless of the tool availability however, I think it would be beneficial to have a more classic "trigger word"/"RAG" option to retrieve the data.

- I think the most useful (for me anyway) way would be to run the trigger/RAG on all of the message given as context to the agents in the "context size" option then to inject the result either at a fixed point in the agent prompt, or using a prompt template
- I would also enjoy having a way to select separate lorebooks for the custom agent and the chat, like the built in knowledge router agent

That's about it! Thanks in advance ^^
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675473871540425]

[2026-07-25T20:38:59.565Z] Marinara: Oh, if you mean keywords we have those in lore books, and we also support semantic search.
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675759163773031]

[2026-07-25T20:39:07.401Z] Marinara: Custom agents also support those.
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675792030334996]

[2026-07-25T20:39:13.557Z] Nyashes: really? how?
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675817850343615]

[2026-07-25T20:39:40.589Z] Nyashes: I haven't been able to have my custom agent get any lorebook triggers
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675931230896138]

[2026-07-25T20:40:26.043Z] Nyashes: (like, the built-in knowledge agents can, but the option doesn't appear to me in custom one)
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530676121878925384]

[2026-07-25T20:42:21.218Z] Marinara: I mean, that depends on what you want your agent to do exactly
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530676604957757491]

[2026-07-25T20:45:20.852Z] Nyashes: Step 1: trigger on the word "unidentified" in the assistant turn (done using "Activation Keywords" with trigger cadence of "Every run" and Context size of "1 message"
Step 2: Trigger every lorebook that would trigger from the assistant message in agent context (???)
Step 3: Replace "unidentified" in the text by a lorebook entry that was triggered of the agent's choice (based on the prompt)

Bonus: Have separate lorebook assignment between the main chat and the agent
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530677358397358315]

[2026-07-25T20:47:35.469Z] Marinara: You want the agent to write something using a lorebook entry that triggered, yes?
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530677923022114916]

[2026-07-25T20:47:45.435Z] Nyashes: that is correct!
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530677964822417439]

[2026-07-25T21:32:42.056Z] Marinara: Yeah, we need to add a toggle that allows lorebooks to trigger for the agent call itself.
[Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530689275270533160]

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 (Jul 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4104 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Custom agents in Marinara Engine v2.3.4 do not appear to trigger lorebook keyword/RAG entries from the agent call context. The user reports that built-in knowledge agents can use lorebooks, but the equivalent option or behavior is missing for custom agents. ## Expected behavior Custom agents should be able to trigger lorebook entries from the messages included in their agent-call context and inject the triggered content for prompt use. If this is controlled by a setting, the toggle or configuration should be visible in the custom agent UI. ## Actual behavior The user could not get any lorebook triggers to fire for a custom agent. They report that the option does not appear for custom agents, even though built-in knowledge agents can use lorebooks. ## Steps to reproduce 1. Create or use a custom agent in Chat mode: Roleplay. 2. Configure a lorebook entry with Activation Keywords including "unidentified", Trigger cadence set to "Every run", and Context size set to "1 message". 3. Have the assistant generate a turn containing the word "unidentified". 4. Run the custom agent and attempt to use lorebook-triggered content in the agent context. 5. Observe that no lorebook trigger appears to fire for the custom agent, and the user-visible option for this behavior does not appear in the custom agent configuration. ## Environment - Marinara Engine version: Marinara Engine v2.3.4 - Install type: installer - OS + version: Windows 11 - Browser or app shell: Not provided ## Logs, screenshots, or video No logs or attachments were provided. Relevant Discord evidence: user said "I haven't been able to have my custom agent get any lorebook triggers" and "the built-in knowledge agents can, but the option doesn't appear to me in custom one." A Marinara response stated: "Yeah, we need to add a toggle that allows lorebooks to trigger for the agent call itself." ## Additional context User goal: trigger lorebook retrieval based on agent-call context and let the custom agent format/transform/inject the retrieved content into chat. The user also requested separate lorebook assignment for the main chat and the custom agent, similar to the built-in knowledge router agent. Discord thread: Lorebook/RAG use on custom agents Discord thread link: https://discord.com/channels/1417099416812392641/1530675473871540425 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (11 messages)</summary> ```text [2026-07-25T20:37:51.546Z] Nyashes: Hello! OS: Win11 Install method: windows Installer Current version: Marinara Engine v2.3.4 Chat mode: Roleplay I've been trying to work on a agent that retrieve data from a lorebook and format/transform/inject it into the chat (either edit last assistant message or context injection, which are already doable) Currently, there is only the tool call which I haven't been able to make work (there might be a bug there, but I'll report separately) Regardless of the tool availability however, I think it would be beneficial to have a more classic "trigger word"/"RAG" option to retrieve the data. - I think the most useful (for me anyway) way would be to run the trigger/RAG on all of the message given as context to the agents in the "context size" option then to inject the result either at a fixed point in the agent prompt, or using a prompt template - I would also enjoy having a way to select separate lorebooks for the custom agent and the chat, like the built in knowledge router agent That's about it! Thanks in advance ^^ [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675473871540425] [2026-07-25T20:38:59.565Z] Marinara: Oh, if you mean keywords we have those in lore books, and we also support semantic search. [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675759163773031] [2026-07-25T20:39:07.401Z] Marinara: Custom agents also support those. [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675792030334996] [2026-07-25T20:39:13.557Z] Nyashes: really? how? [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675817850343615] [2026-07-25T20:39:40.589Z] Nyashes: I haven't been able to have my custom agent get any lorebook triggers [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530675931230896138] [2026-07-25T20:40:26.043Z] Nyashes: (like, the built-in knowledge agents can, but the option doesn't appear to me in custom one) [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530676121878925384] [2026-07-25T20:42:21.218Z] Marinara: I mean, that depends on what you want your agent to do exactly [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530676604957757491] [2026-07-25T20:45:20.852Z] Nyashes: Step 1: trigger on the word "unidentified" in the assistant turn (done using "Activation Keywords" with trigger cadence of "Every run" and Context size of "1 message" Step 2: Trigger every lorebook that would trigger from the assistant message in agent context (???) Step 3: Replace "unidentified" in the text by a lorebook entry that was triggered of the agent's choice (based on the prompt) Bonus: Have separate lorebook assignment between the main chat and the agent [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530677358397358315] [2026-07-25T20:47:35.469Z] Marinara: You want the agent to write something using a lorebook entry that triggered, yes? [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530677923022114916] [2026-07-25T20:47:45.435Z] Nyashes: that is correct! [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530677964822417439] [2026-07-25T21:32:42.056Z] Marinara: Yeah, we need to add a toggle that allows lorebooks to trigger for the agent call itself. [Discord message: https://discord.com/channels/1417099416812392641/1530675473871540425/1530689275270533160] ``` </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:46:23 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 25, 2026):

Resolved by #4108 and merged into staging in e95f5785cb.

<!-- gh-comment-id:5081017611 --> @SpicyMarinara commented on GitHub (Jul 25, 2026): Resolved by #4108 and merged into `staging` in e95f5785cbe141bf83d858f7c422da7554927fe7.
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#2220
No description provided.