[GH-ISSUE #6912] [Feature]: "include" prompt macro #3876

Closed
opened 2026-10-21 06:08:23 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @usagirei on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6912

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Allow users to include content from a lorebook entry via prompt macros, possibly from lorebooks not included in the chat settings.

Powerful when paired with conditionals / decisions, constant entries, and entries that never match (no triggers / disabled)

Or to simply have an entry include content from another, without having recursive matching enabled and controlling where it appears

This allows for reusable snippets of content without repeating yourself and having divergent sources of truth

Proposed solution

Two new macros in the form of
{{include::ENTRY_NAME_OR_ID}} - Include entry(name/id) from the current lorebook
{{include::BOOK_NAME_OR_ID::ENTRY_NAME}} - Include entry(name) from book(name/id)

ID lookup first as it's likely a O(1) lookup,
If no matches, look for entry/book by name ( O(n) search ),
If no matches still, return an empty value

Optionally notify the user on generation that the entry was not matched [1]

This macro should probably be evaluated in a dedicated step before or after all others, since it can potentially be recursive.
(Before / After determines if an entry/book name could be a macro by itself)

To avoid cases where A -> B -> ... -> A or A -> A looping indefinitely, recursive include calls should keep a "seen" list.
If self-recursion is detected, either:

  • the recursive call evaluates to nothing / empty
  • abort the generation and show an error [1]

[1]: Maybe a .env setting, or a toggle in advanced settings

Alternatives considered

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 @usagirei on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6912 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Allow users to include content from a lorebook entry via prompt macros, possibly from lorebooks not included in the chat settings. Powerful when paired with conditionals / decisions, constant entries, and entries that never match (no triggers / disabled) Or to simply have an entry include content from another, without having recursive matching enabled and controlling where it appears This allows for reusable snippets of content without repeating yourself and having divergent sources of truth <!-- Describe the pain point or gap this feature would address --> ## Proposed solution Two new macros in the form of `{{include::ENTRY_NAME_OR_ID}}` - Include entry(name/id) from the current lorebook `{{include::BOOK_NAME_OR_ID::ENTRY_NAME}}` - Include entry(name) from book(name/id) ID lookup first as it's likely a O(1) lookup, If no matches, look for entry/book by name ( O(n) search ), If no matches still, return an empty value Optionally notify the user on generation that the entry was not matched [1] This macro should probably be evaluated in a dedicated step before or after all others, since it can potentially be recursive. (Before / After determines if an entry/book name could be a macro by itself) To avoid cases where `A -> B -> ... -> A` or `A -> A` looping indefinitely, recursive include calls should keep a "seen" list. If self-recursion is detected, either: * the recursive call evaluates to nothing / empty * abort the generation and show an error [1] [1]: Maybe a .env setting, or a toggle in advanced settings <!-- What would you like to see added or changed? --> ## Alternatives considered <!-- Any other approaches you thought about? --> ## Additional context <!-- Optional: mockups, related issues, references, or examples --> ## 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.
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#3876
No description provided.