mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5454] [MERGED] Feat/lorebook size macro #6773
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6773
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5454
Author: @ylli-selmani
Created: 8/23/2026
Status: ✅ Merged
Merged: 8/24/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/lorebookSizeMacro📝 Commits (8)
d609408added {{lorebooksize::lorebookID}} macro that resolves to number of total entries of said lorebook64bee23Update CHANGELOG.md443a569added a try and catch for the loading of entry counts.237adc7Update packages/server/src/services/prompt/macro-context.tse152a92reverted the logger.warn774c0bbre-did the logger, now correctly. oops.29bcd4cMerge branch 'staging' into feat/lorebookSizeMacrob32609ftest: cover lorebook size macro resolution📊 Changes
10 files changed (+68 additions, -0 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/prompts/macros.md(+8 -0)📝
packages/server/src/routes/generate.routes.ts(+1 -0)📝
packages/server/src/routes/generate/retry-agents-route.ts(+1 -0)📝
packages/server/src/services/agents/agent-executor.ts(+1 -0)📝
packages/server/src/services/prompt/macro-context.ts(+12 -0)📝
packages/server/src/services/storage/lorebooks.storage.ts(+11 -0)📝
packages/shared/src/types/agent.ts(+2 -0)📝
packages/shared/src/utils/macro-engine.ts(+16 -0)📝
scripts/regressions/prompt.regression.ts(+15 -0)📄 Description
Linked issue
Closes #5464
Why this change
{{lorebookSize::lorebookId}}macro that simply resolves to the total number of entries inside the specified lorebook.{{lorebookSize::lorebookId}} + 1(e.g. new memories will have a higher order, be injected lower in the prompt, and closer to the 'now' for chronological flow)What changed
{{lorebookSize::lorebookId}}that resolves to the total number of entries inside the Lorebook, specified by its ID.V1StGXR8_Z5jdHi6B-myTand contains 151 entries,{{lorebooksize::V1StGXR8_Z5jdHi6B-myT}}resolves to151.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
{{lorebooksize ::JparyXKfJPOF24kT_F0QC} }inside a main chat prompt section => resolved to151, the correct number.{{lorebooksize ::JparyXKfJPOF24kT_F0QC}} + 1inside an agent's prompt => Agent correctly output152.{{setvar::size::{{lorebooksize ::JparyXKfJPOF24kT_F0QC}}}}=> setvar resolves before 1{{lorebooksize}}` in macro pipeline, => turns into 0?Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Inside Main Prompt:
Inside Agent Prompt:
Gibberish:
Summary by CodeRabbit
New Features
{{lorebooksize::ID}}macro to return a lorebook’s total entry count.0.Documentation
Maintainer verification
pnpm checkpasses on the current head.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.