[GH-ISSUE #738] [Issue]: Regex scripts and lorebook entries cannot use prompt macros #350

Closed
opened 2026-10-20 17:27:54 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Xelvanis on GitHub (May 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/738

Summary

Regex scripts and lorebook entries currently cannot reliably use prompt macros. A user reported that macros such as {{user}}, {{char}}, random macros, and variable-style macros are not available in those surfaces the way they are in prompt/preset text.

Expected behavior

  • Lorebook entry content should resolve prompt macros at generation time using the same relevant chat/character/persona context as the final prompt.
  • Regex script fields that affect prompt/message text, including find/replacement/trim-style text where applicable, should resolve macros consistently before the script is applied.
  • The behavior should match docs/MACROS.md, which says lorebook entries support prompt macros.

Actual behavior

  • Macro text can be left literal or applied inconsistently in lorebook and regex paths.
  • This prevents users from authoring dynamic lorebook entries or regex scripts that depend on current chat context.

Steps to reproduce

  1. Create or edit a lorebook entry and include a prompt macro such as {{user}} or {{char}} in the entry content.
  2. Attach/activate the lorebook in a chat and trigger the entry.
  3. Inspect the generated prompt/world-info output.
  4. Create or edit a regex script that uses a macro in a relevant regex field, then apply it through generation or the regex editor live test.

Expected: the macro resolves to the current runtime value.

Actual: the macro remains literal or is not resolved at the correct point in the pipeline.

Environment

  • Marinara Engine version: unknown; reported by a user
  • Install type: unknown
  • OS + version: unknown
  • Browser or app shell: unknown

Logs, screenshots, or video

No logs or screenshots yet.

Additional context

  • Related active PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/736
  • Existing closed macro issue found during duplicate search: https://github.com/Pasta-Devs/Marinara-Engine/issues/309. That covered DM-mode {{user}}/{{char}} replacement and does not appear to cover this lorebook/regex problem.
  • Suggested acceptance criteria:
    • Lorebook macro resolution works before final injection/token budgeting and world-info display.
    • Regex macro resolution works in server/client application paths and editor live testing.
    • Focused regression coverage exists for lorebook and regex macro use.

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 @Xelvanis on GitHub (May 12, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/738 ## Summary Regex scripts and lorebook entries currently cannot reliably use prompt macros. A user reported that macros such as `{{user}}`, `{{char}}`, random macros, and variable-style macros are not available in those surfaces the way they are in prompt/preset text. ## Expected behavior - Lorebook entry content should resolve prompt macros at generation time using the same relevant chat/character/persona context as the final prompt. - Regex script fields that affect prompt/message text, including find/replacement/trim-style text where applicable, should resolve macros consistently before the script is applied. - The behavior should match `docs/MACROS.md`, which says lorebook entries support prompt macros. ## Actual behavior - Macro text can be left literal or applied inconsistently in lorebook and regex paths. - This prevents users from authoring dynamic lorebook entries or regex scripts that depend on current chat context. ## Steps to reproduce 1. Create or edit a lorebook entry and include a prompt macro such as `{{user}}` or `{{char}}` in the entry content. 2. Attach/activate the lorebook in a chat and trigger the entry. 3. Inspect the generated prompt/world-info output. 4. Create or edit a regex script that uses a macro in a relevant regex field, then apply it through generation or the regex editor live test. Expected: the macro resolves to the current runtime value. Actual: the macro remains literal or is not resolved at the correct point in the pipeline. ## Environment - Marinara Engine version: unknown; reported by a user - Install type: unknown - OS + version: unknown - Browser or app shell: unknown ## Logs, screenshots, or video No logs or screenshots yet. ## Additional context - Related active PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/736 - Existing closed macro issue found during duplicate search: https://github.com/Pasta-Devs/Marinara-Engine/issues/309. That covered DM-mode `{{user}}`/`{{char}}` replacement and does not appear to cover this lorebook/regex problem. - Suggested acceptance criteria: - Lorebook macro resolution works before final injection/token budgeting and world-info display. - Regex macro resolution works in server/client application paths and editor live testing. - Focused regression coverage exists for lorebook and regex macro use. ## 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-20 17:27:54 +07:00
  • closed this issue
  • added the
    bug
    label
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#350
No description provided.