[GH-ISSUE #5225] [Issue]: Allow Lorebook Update agents to specify entry order #2894

Closed
opened 2026-10-21 05:57:43 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Add an optional integer order field to the updates array used by the Lorebook Keeper and custom agents with the Lorebook Update result type. This would let agents assign a specific injection order when creating or updating lorebook entries without breaking existing prompts.

Expected behavior

An agent should be able to optionally provide an integer order value, such as 200, for a lorebook entry. Existing prompts that omit the field should continue to work.

Actual behavior

The Lorebook Update updates schema does not expose an order field. Newly generated entries receive a lower/default order than the user's existing entries, requiring manual or batch edits to place them at the desired order.

Steps to reproduce

  1. Set existing entries in a lorebook, such as a memory lorebook, to order 200.
  2. Use the Lorebook Keeper or a custom agent with the Lorebook Update result type to create a new entry.
  3. Observe that the generated entry does not provide a way for the agent to set its order and receives a lower/default order instead.
  4. Manually batch-edit the new entry to match the desired order.

Environment

  • Marinara Engine version: Not provided
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

Not provided.

Additional context

The requester also suggested a separate feature: when selecting a result type for a custom agent, display a preview of the complete expected JSON format, including optional fields. The discussion indicated this could show examples based on the selected custom agent type.

Discord thread: FR - Expand Agent's "updates" Array with "Order" Setting
Discord thread link: https://discord.com/channels/1417099416812392641/1539310909829160960
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (24 messages)
[2026-08-18T16:31:59.917Z] ylliselmanii: Hello! Sorry for the FR spam.

I recently realised that Professor Mari can set a specific Order for a lorebook entry when creating one. 

Now I wanted to ask if we could give the agents this **POWER** as well? Meaning, adding something like: "Order": "the injection order for the entry" to the "updates" array for the Lorebook Keeper( or custom agents with the "Lorebook Update" Result type) so the agent could give it a specific order, following some instruction? 

Of course, it should be an optional addition, to not break any existing prompts.

So, like this:
> {
>   "updates": [
>     {
>       "action": "create|update",
>       "entryName": "name, exact existing name when updating",
>       "content": "full content for creates, or only for replacing an empty/malformed entry",
>       "newFacts": ["atomic durable fact to append on update"],
>       **"order":"Integer for order injection of lorebook entry"**
>       "keys": ["activation keyword"],
>       "tag": "character|location|item|faction|event|lore",
>       "reason": "why this should be recorded"
>     }
>   ]
> }

As a second question, which should probably be another FR altogether: would it be possible to show the full possible array when picking a result type in custom agents? Currently it only says, e.g "Expects JSON with "shouldGenerate", "prompt",
optional style, and characters.".  Maybe as a 'preview text' in the prompt window? Instead of 'Write the system prompt for this agent'

:cummy:
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539310909829160960]

[2026-08-18T16:32:00.460Z] Professor Mari [bot]: Howdy!

Thank you for submitting a new bug report/feature request, your support means a lot. A member of the team will look into it as soon as possible, and if they find it valid, they will open a GitHub Issue out of it. You can check whether it was addressed on the staging build of Marinara Engine. **Do not ping any of the developers, this will not speed up the process.**

**Please include a Support Diagnostic in the post if you haven't done it yet.** Otherwise, ignore this step. To grab it, go to the Marinara Engine tab:

`Settings -> Advanced -> Support Diagnostics -> Copy Support Diagnostics.`

If your report is about any of the **Agents**, please provide **the Agent's version** which you can grab from here:

`Agents -> Download Agents -> Installed Agents -> Selected Agent -> Installed Version`

Thank you, this will help tremendously.

This is an automated message, but if you reply to it, I will do my best to assist you using my LLM-powered brain. That said, it's best for a human to handle this case.

Cheers!
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539310912106664038]

[2026-08-18T16:33:48.750Z] Marinara: That makes no sense.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311366307975251]

[2026-08-18T16:34:05.658Z] ylliselmanii: No?
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311437225271316]

[2026-08-18T16:34:13.073Z] Marinara: The model will just hallucinate the order.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311468326035576]

[2026-08-18T16:34:15.235Z] Marinara: Like.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311477393985646]

[2026-08-18T16:34:30.440Z] Marinara: How will it know how to assign that.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311541168382022]

[2026-08-18T16:34:34.273Z] ylliselmanii: Okay, but i meant more like "Always set order to 200"
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311557245276372]

[2026-08-18T16:35:00.230Z] Marinara: Oh, like specified by you.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311666116698132]

[2026-08-18T16:35:01.931Z] Marinara: Uhhh, why?
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311673251201124]

[2026-08-18T16:35:08.447Z] Marinara: It still serves little purpose.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311700581421096]

[2026-08-18T16:35:24.497Z] Marinara: You can just make pre-existing lorebook entries a lower/higher order.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311767899869214]

[2026-08-18T16:35:28.694Z] Marinara: Instead.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311785503367260]

[2026-08-18T16:36:03.614Z] Marinara: I don't understand your second request.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311931968720918]

[2026-08-18T16:36:06.559Z] ylliselmanii: Now, i can change them manually, but currently, in my case all my entries in that "memory" lorebook sit at order 200, so they stick together. But all newly generated entries get like order 10 or something, so i always have to batch edit them. Though, i guess it's not the biggest deal
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311944320815194]

[2026-08-18T16:36:28.844Z] Marinara: Should default to 100.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312037791006842]

[2026-08-18T16:37:17.763Z] ylliselmanii: for the second request, I meant like: if you choose a result type, it tells you that it will expect a specific array. But without looking at e.g the OG illustrator, you'd have no idea what the array looks like AFAIK
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312242971910204]

[2026-08-18T16:37:29.806Z] ylliselmanii: my idea was to just give a preview in the custom agent, after picking a result type
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312293484171404]

[2026-08-18T16:37:43.610Z] ylliselmanii: and which parts are optional
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312351382339584]

[2026-08-18T16:37:56.861Z] ylliselmanii: Does that make more sense?
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312406960939090]

[2026-08-18T16:38:05.563Z] Marinara: You mean the JSON format to return.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312443459903581]

[2026-08-18T16:38:09.926Z] ylliselmanii: yeah, exactly
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312461759389806]

[2026-08-18T16:38:21.338Z] Marinara: Yeah, I can show the examples, depending on the custom agent type.
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312509624909894]

[2026-08-18T16:38:27.426Z] ylliselmanii: that'd be lovely, thanks
[Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312535159701564]

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 18, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5225 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Add an optional integer `order` field to the `updates` array used by the Lorebook Keeper and custom agents with the Lorebook Update result type. This would let agents assign a specific injection order when creating or updating lorebook entries without breaking existing prompts. ## Expected behavior An agent should be able to optionally provide an integer `order` value, such as 200, for a lorebook entry. Existing prompts that omit the field should continue to work. ## Actual behavior The Lorebook Update `updates` schema does not expose an `order` field. Newly generated entries receive a lower/default order than the user's existing entries, requiring manual or batch edits to place them at the desired order. ## Steps to reproduce 1. Set existing entries in a lorebook, such as a memory lorebook, to order 200. 2. Use the Lorebook Keeper or a custom agent with the Lorebook Update result type to create a new entry. 3. Observe that the generated entry does not provide a way for the agent to set its order and receives a lower/default order instead. 4. Manually batch-edit the new entry to match the desired order. ## Environment - Marinara Engine version: Not provided - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video Not provided. ## Additional context The requester also suggested a separate feature: when selecting a result type for a custom agent, display a preview of the complete expected JSON format, including optional fields. The discussion indicated this could show examples based on the selected custom agent type. Discord thread: FR - Expand Agent's "updates" Array with "Order" Setting Discord thread link: https://discord.com/channels/1417099416812392641/1539310909829160960 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (24 messages)</summary> ```text [2026-08-18T16:31:59.917Z] ylliselmanii: Hello! Sorry for the FR spam. I recently realised that Professor Mari can set a specific Order for a lorebook entry when creating one. Now I wanted to ask if we could give the agents this **POWER** as well? Meaning, adding something like: "Order": "the injection order for the entry" to the "updates" array for the Lorebook Keeper( or custom agents with the "Lorebook Update" Result type) so the agent could give it a specific order, following some instruction? Of course, it should be an optional addition, to not break any existing prompts. So, like this: > { > "updates": [ > { > "action": "create|update", > "entryName": "name, exact existing name when updating", > "content": "full content for creates, or only for replacing an empty/malformed entry", > "newFacts": ["atomic durable fact to append on update"], > **"order":"Integer for order injection of lorebook entry"** > "keys": ["activation keyword"], > "tag": "character|location|item|faction|event|lore", > "reason": "why this should be recorded" > } > ] > } As a second question, which should probably be another FR altogether: would it be possible to show the full possible array when picking a result type in custom agents? Currently it only says, e.g "Expects JSON with "shouldGenerate", "prompt", optional style, and characters.". Maybe as a 'preview text' in the prompt window? Instead of 'Write the system prompt for this agent' :cummy: [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539310909829160960] [2026-08-18T16:32:00.460Z] Professor Mari [bot]: Howdy! Thank you for submitting a new bug report/feature request, your support means a lot. A member of the team will look into it as soon as possible, and if they find it valid, they will open a GitHub Issue out of it. You can check whether it was addressed on the staging build of Marinara Engine. **Do not ping any of the developers, this will not speed up the process.** **Please include a Support Diagnostic in the post if you haven't done it yet.** Otherwise, ignore this step. To grab it, go to the Marinara Engine tab: `Settings -> Advanced -> Support Diagnostics -> Copy Support Diagnostics.` If your report is about any of the **Agents**, please provide **the Agent's version** which you can grab from here: `Agents -> Download Agents -> Installed Agents -> Selected Agent -> Installed Version` Thank you, this will help tremendously. This is an automated message, but if you reply to it, I will do my best to assist you using my LLM-powered brain. That said, it's best for a human to handle this case. Cheers! [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539310912106664038] [2026-08-18T16:33:48.750Z] Marinara: That makes no sense. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311366307975251] [2026-08-18T16:34:05.658Z] ylliselmanii: No? [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311437225271316] [2026-08-18T16:34:13.073Z] Marinara: The model will just hallucinate the order. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311468326035576] [2026-08-18T16:34:15.235Z] Marinara: Like. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311477393985646] [2026-08-18T16:34:30.440Z] Marinara: How will it know how to assign that. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311541168382022] [2026-08-18T16:34:34.273Z] ylliselmanii: Okay, but i meant more like "Always set order to 200" [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311557245276372] [2026-08-18T16:35:00.230Z] Marinara: Oh, like specified by you. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311666116698132] [2026-08-18T16:35:01.931Z] Marinara: Uhhh, why? [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311673251201124] [2026-08-18T16:35:08.447Z] Marinara: It still serves little purpose. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311700581421096] [2026-08-18T16:35:24.497Z] Marinara: You can just make pre-existing lorebook entries a lower/higher order. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311767899869214] [2026-08-18T16:35:28.694Z] Marinara: Instead. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311785503367260] [2026-08-18T16:36:03.614Z] Marinara: I don't understand your second request. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311931968720918] [2026-08-18T16:36:06.559Z] ylliselmanii: Now, i can change them manually, but currently, in my case all my entries in that "memory" lorebook sit at order 200, so they stick together. But all newly generated entries get like order 10 or something, so i always have to batch edit them. Though, i guess it's not the biggest deal [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539311944320815194] [2026-08-18T16:36:28.844Z] Marinara: Should default to 100. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312037791006842] [2026-08-18T16:37:17.763Z] ylliselmanii: for the second request, I meant like: if you choose a result type, it tells you that it will expect a specific array. But without looking at e.g the OG illustrator, you'd have no idea what the array looks like AFAIK [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312242971910204] [2026-08-18T16:37:29.806Z] ylliselmanii: my idea was to just give a preview in the custom agent, after picking a result type [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312293484171404] [2026-08-18T16:37:43.610Z] ylliselmanii: and which parts are optional [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312351382339584] [2026-08-18T16:37:56.861Z] ylliselmanii: Does that make more sense? [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312406960939090] [2026-08-18T16:38:05.563Z] Marinara: You mean the JSON format to return. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312443459903581] [2026-08-18T16:38:09.926Z] ylliselmanii: yeah, exactly [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312461759389806] [2026-08-18T16:38:21.338Z] Marinara: Yeah, I can show the examples, depending on the custom agent type. [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312509624909894] [2026-08-18T16:38:27.426Z] ylliselmanii: that'd be lovely, thanks [Discord message: https://discord.com/channels/1417099416812392641/1539310909829160960/1539312535159701564] ``` </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:57:43 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 18, 2026):

Cross-repository package work is tracked in https://github.com/Pasta-Devs/Marinara-Agents/issues/425. I’m owning both halves: Engine will preserve an optional integer order through automatic and approval-gated Lorebook Update writes; Marinara-Agents will update and rebuild Lorebook Keeper’s maintained prompt/package.

<!-- gh-comment-id:5331270796 --> @SpicyMarinara commented on GitHub (Aug 18, 2026): Cross-repository package work is tracked in https://github.com/Pasta-Devs/Marinara-Agents/issues/425. I’m owning both halves: Engine will preserve an optional integer `order` through automatic and approval-gated Lorebook Update writes; Marinara-Agents will update and rebuild Lorebook Keeper’s maintained prompt/package.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 18, 2026):

Implemented and landed on staging via #5226 (merge 4bb78fd). Lorebook Update results now preserve an optional safe-integer order through automatic and approval-gated writes, and the custom-agent Prompt Template preview now follows the selected result type with complete JSON/text examples. Required CI and CodeRabbit passed; focused desktop/mobile preview coverage and the landed open-issues regression passed.

<!-- gh-comment-id:5332071751 --> @SpicyMarinara commented on GitHub (Aug 18, 2026): Implemented and landed on staging via #5226 (merge 4bb78fd). Lorebook Update results now preserve an optional safe-integer order through automatic and approval-gated writes, and the custom-agent Prompt Template preview now follows the selected result type with complete JSON/text examples. Required CI and CodeRabbit passed; focused desktop/mobile preview coverage and the landed open-issues regression passed.
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#2894
No description provided.