[GH-ISSUE #5464] [Feature]: Lorebook Total Entries Macro #3031

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

Originally created by @ylli-selmani on GitHub (Aug 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5464

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Currently the Lorebook Keeper (or a custom agent with Lorebook Edit abilities) has no real way to 'know' what order a new entry should get, which is why they either default to 100, or are handed an explicit number through the "order": integer,' field in their prompt.

However, if the Agent had the total number of entries inside a Lorebook, it could theoretically always increment the order by +1, ensuring that newer entries are placed lower in the final prompt. This could allow one to create an automatic Memory/Event Lorebook with a chronological flow of insertion. (e.g Day 1/Oldest sits at the top, while Day 100/Newest sits at the bottom.) Especially useful when paired with the {{outlet::name}} to fully contain a specific lorebook to a prompt section, without any pollution.

Proposed solution

Simply implement a macro that resolves to the total number of entries inside a lorebook, making use of the unique Lorebook ID each one has => {{lorebookSize::lorebookID}} -> e.g 100.

Alternatives considered

Some form of toggle placed inside the "Lorebook Write" section inside an agent's settings, that would automatically increment the default order of a new entry. However, since macros are already well established, and the agent's 'updates'-array has a dedicated field for 'order of injection', this seemed like the easiest implementation to me.

Additional context

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 @ylli-selmani on GitHub (Aug 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5464 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Currently the Lorebook Keeper (or a custom agent with Lorebook Edit abilities) has no real way to 'know' what order a new entry should get, which is why they either default to 100, or are handed an explicit number through the `"order": integer,'` field in their prompt. However, if the Agent had the total number of entries inside a Lorebook, it could theoretically always increment the order by +1, ensuring that newer entries are placed *lower* in the final prompt. This could allow one to create an automatic Memory/Event Lorebook with a chronological flow of insertion. (e.g Day 1/Oldest sits at the top, while Day 100/Newest sits at the bottom.) Especially useful when paired with the `{{outlet::name}}` to fully contain a specific lorebook to a prompt section, without any pollution. ## Proposed solution Simply implement a macro that resolves to the total number of entries inside a lorebook, making use of the unique Lorebook ID each one has => `{{lorebookSize::lorebookID}} -> e.g 100`. ## Alternatives considered Some form of toggle placed inside the "Lorebook Write" section inside an agent's settings, that would automatically increment the default order of a new entry. However, since macros are already well established, and the agent's 'updates'-array has a dedicated field for 'order of injection', this seemed like the easiest implementation to me. ## Additional context ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [x] I DID NOT read this template and provide the requested details.
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#3031
No description provided.