mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5158] [Issue]: Make local variable macros persist per chat like SillyTavern #2853
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#2853
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?
Originally created by @SpicyMarinara on GitHub (Aug 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5158
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Marinara Engine's local variable macros are not compatible with their SillyTavern equivalents.
{{setvar}}and related mutations currently live only in the in-memory macro context for one reply, while SillyTavern stores local variables in the current chat's metadata. Our documentation is also internally contradictory: the main macro guide says variables reset every reply, while the lorebook guide calls them persistent across the chat.Expected behavior
Match SillyTavern's semantics for Marinara's overlapping local-variable macros:
getvar,setvar,addvar,incvar, anddecvarmatch the corresponding SillyTavern behavior, including return values and numeric-versus-string addition.addnumvaras a Marinara extension if it is still useful, but document it as such.docs/prompts/macros.mdanddocs/lorebooks/entries.mdso they consistently describe chat-persistent behavior and note any intentional compatibility differences.Reference: https://docs.sillytavern.app/usage/core-concepts/macros/
Actual behavior
resolveVariableOperationMacrosmutates onlyMacroContext.variables. The generation route creates a new prompt macro context for each reply and never persists those mutations to chat metadata. Consequently, a value set during one reply is unavailable to a later reply.The documentation currently disagrees with itself:
docs/prompts/macros.mdsays variables only live for one reply.docs/lorebooks/entries.mdsaysgetvar/setvarare persistent across the chat.There are also behavioral differences from SillyTavern in the overlapping operations: Marinara's
addvaralways concatenates text, andincvar/decvarcurrently resolve to an empty string instead of returning the updated value.Steps to reproduce
{{setvar::test::remembered}}and confirm{{getvar::test}}can read it later in that same build.{{getvar::test}}without setting it again.Environment
Logs, screenshots, or video
Not applicable. The mismatch is visible in
packages/shared/src/utils/macro-engine.ts,packages/server/src/routes/generate.routes.ts, and the two documentation pages named above.Additional context
Existing chats can start with an empty variable map; no data migration is required for values that Marinara never persisted. Care should be taken not to let one chat's variables leak into another chat, and prompt assembly paths that intentionally use variable snapshots should remain side-effect-safe.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: